Check for ARB_texture_multisample being available

* We need to hack around GLES, as it somehow added only part of the original
  extension - non-arrayed textures. So we conceptually split up the extension
  into two, and treat the real extension as a superset.
This commit is contained in:
baldurk
2018-07-06 11:13:10 +01:00
parent 3794d3facc
commit 89a3da2171
2 changed files with 38 additions and 6 deletions
+6
View File
@@ -584,6 +584,12 @@ extern bool IsGLES;
EXT_TO_CHECK(30, 30, EXT_transform_feedback) \
EXT_TO_CHECK(30, 32, EXT_draw_buffers2) \
EXT_TO_CHECK(31, 99, ARB_texture_buffer_object) \
/* This is a hack, the extension doesn't exist but is */ \
/* equivalent to GLES 3.1's addition of MSAA textures but */ \
/* NOT array MSAA textures. We'll treat the real ext as a */ \
/* super-set. */ \
EXT_TO_CHECK(32, 31, ARB_texture_multisample_no_array) \
EXT_TO_CHECK(32, 32, ARB_texture_multisample) \
EXT_TO_CHECK(33, 30, ARB_explicit_attrib_location) \
EXT_TO_CHECK(33, 30, ARB_sampler_objects) \
EXT_TO_CHECK(33, 30, ARB_texture_swizzle) \
+32 -6
View File
@@ -666,6 +666,9 @@ bool GLRenderState::CheckEnableDisableParam(GLenum pname)
// see DoVendorChecks()
return false;
case eGL_SAMPLE_MASK:
return HasExt[ARB_texture_multisample_no_array] || HasExt[ARB_texture_multisample];
case eGL_CLIP_DISTANCE0:
case eGL_CLIP_DISTANCE1:
case eGL_CLIP_DISTANCE2:
@@ -785,8 +788,15 @@ void GLRenderState::FetchState(WrappedOpenGL *driver)
else
TexBuffer[i].name = 0;
GL.glGetIntegerv(eGL_TEXTURE_BINDING_2D_MULTISAMPLE, (GLint *)&Tex2DMS[i].name);
GL.glGetIntegerv(eGL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY, (GLint *)&Tex2DMSArray[i].name);
if(HasExt[ARB_texture_multisample_no_array] || HasExt[ARB_texture_multisample])
GL.glGetIntegerv(eGL_TEXTURE_BINDING_2D_MULTISAMPLE, (GLint *)&Tex2DMS[i].name);
else
Tex2DMS[i].name = 0;
if(HasExt[ARB_texture_multisample])
GL.glGetIntegerv(eGL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY, (GLint *)&Tex2DMSArray[i].name);
else
Tex2DMSArray[i].name = 0;
if(HasExt[ARB_texture_cube_map_array])
GL.glGetIntegerv(eGL_TEXTURE_BINDING_CUBE_MAP_ARRAY, (GLint *)&TexCubeArray[i].name);
@@ -1196,7 +1206,9 @@ void GLRenderState::FetchState(WrappedOpenGL *driver)
memcpy(&ColorMasks[i], &ColorMasks[0], sizeof(ColorMask));
}
GL.glGetIntegeri_v(eGL_SAMPLE_MASK_VALUE, 0, (GLint *)&SampleMask[0]);
if(HasExt[ARB_texture_multisample_no_array] || HasExt[ARB_texture_multisample])
GL.glGetIntegeri_v(eGL_SAMPLE_MASK_VALUE, 0, (GLint *)&SampleMask[0]);
GL.glGetIntegerv(eGL_SAMPLE_COVERAGE_VALUE, (GLint *)&SampleCoverage);
{
@@ -1300,20 +1312,31 @@ void GLRenderState::ApplyState(WrappedOpenGL *driver)
for(GLuint i = 0; i < RDCMIN(maxTextures, (GLuint)ARRAY_COUNT(Tex2D)); i++)
{
GL.glActiveTexture(GLenum(eGL_TEXTURE0 + i));
if(!IsGLES)
GL.glBindTexture(eGL_TEXTURE_1D, Tex1D[i].name);
GL.glBindTexture(eGL_TEXTURE_2D, Tex2D[i].name);
GL.glBindTexture(eGL_TEXTURE_3D, Tex3D[i].name);
if(!IsGLES)
GL.glBindTexture(eGL_TEXTURE_1D_ARRAY, Tex1DArray[i].name);
GL.glBindTexture(eGL_TEXTURE_2D_ARRAY, Tex2DArray[i].name);
if(!IsGLES)
GL.glBindTexture(eGL_TEXTURE_RECTANGLE, TexRect[i].name);
if(HasExt[ARB_texture_buffer_object])
GL.glBindTexture(eGL_TEXTURE_BUFFER, TexBuffer[i].name);
GL.glBindTexture(eGL_TEXTURE_CUBE_MAP, TexCube[i].name);
GL.glBindTexture(eGL_TEXTURE_2D_MULTISAMPLE, Tex2DMS[i].name);
GL.glBindTexture(eGL_TEXTURE_2D_MULTISAMPLE_ARRAY, Tex2DMSArray[i].name);
if(HasExt[ARB_texture_multisample_no_array] || HasExt[ARB_texture_multisample])
GL.glBindTexture(eGL_TEXTURE_2D_MULTISAMPLE, Tex2DMS[i].name);
if(HasExt[ARB_texture_multisample])
GL.glBindTexture(eGL_TEXTURE_2D_MULTISAMPLE_ARRAY, Tex2DMSArray[i].name);
if(HasExt[ARB_sampler_objects])
GL.glBindSampler(i, Samplers[i].name);
@@ -1641,8 +1664,11 @@ void GLRenderState::ApplyState(WrappedOpenGL *driver)
GL.glColorMask(ColorMasks[0].red, ColorMasks[0].green, ColorMasks[0].blue, ColorMasks[0].alpha);
}
GL.glSampleMaski(0, (GLbitfield)SampleMask[0]);
if(HasExt[ARB_texture_multisample_no_array] || HasExt[ARB_texture_multisample])
GL.glSampleMaski(0, (GLbitfield)SampleMask[0]);
GL.glSampleCoverage(SampleCoverage, SampleCoverageInvert ? GL_TRUE : GL_FALSE);
if(HasExt[ARB_sample_shading])
GL.glMinSampleShading(MinSampleShading);