Check that our MSAA sample count is supported in GL texture zoo test

This commit is contained in:
baldurk
2019-12-18 12:35:29 +00:00
parent a8301168fc
commit b123ef42a9
+19 -1
View File
@@ -328,7 +328,7 @@ void main()
bool QueryFormatBool(GLenum target, GLenum format, GLenum pname)
{
GLint param = 0;
glGetInternalformativ(target, format, pname, 4, &param);
glGetInternalformativ(target, format, pname, sizeof(param), &param);
return param != 0;
}
@@ -338,6 +338,13 @@ void main()
test.canDepth = QueryFormatBool(test.target, test.fmt.internalFormat, GL_DEPTH_RENDERABLE);
test.canStencil = QueryFormatBool(test.target, test.fmt.internalFormat, GL_STENCIL_RENDERABLE);
GLint numSamples = 0;
glGetInternalformativ(test.target, test.fmt.internalFormat, GL_NUM_SAMPLE_COUNTS,
sizeof(numSamples), &numSamples);
GLint samples[8];
glGetInternalformativ(test.target, test.fmt.internalFormat, GL_SAMPLES, sizeof(samples), samples);
Vec4i dimensions(texWidth, texHeight, texDepth);
bool isCompressed =
@@ -349,6 +356,17 @@ void main()
if(isCompressed && (test.dim == 1 || test.dim == 3 || test.isRect || test.isMSAA))
return;
// if the format is MSAA check we have our sample count
if(test.isMSAA)
{
bool found = false;
for(GLint i = 0; i < numSamples; i++)
found |= (samples[i] == texSamples);
if(!found)
return;
}
// any format that supports MSAA but can't be rendered to is unsupported
if(!test.canRender && !test.canDepth && !test.canStencil && test.isMSAA)
return;