m_testCtx.getLog() << TestLog::Message << "// sample counts is " << sampleCounts << TestLog::EndMessage;
- if (m_isIntegerInternalFormat && sampleCounts != 0)
- {
- // Since multisampling is not supported for signed and unsigned integer internal
- // formats, the value of NUM_SAMPLE_COUNTS will be zero for such formats.
- m_testCtx.getLog() << TestLog::Message << "// ERROR: integer internal formats should have NUM_SAMPLE_COUNTS = 0; got " << sampleCounts << TestLog::EndMessage;
- if (m_testCtx.getTestResult() == QP_TEST_RESULT_PASS)
- m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "got invalid value");
- }
-
if (sampleCounts == 0)
return;
}
}
- // the maximum value in SAMPLES is guaranteed to be at least the value of MAX_SAMPLES
- StateQueryMemoryWriteGuard<GLint> maxSamples;
- glGetIntegerv(GL_MAX_SAMPLES, &maxSamples);
- expectError(GL_NO_ERROR);
-
- if (maxSamples.verifyValidity(m_testCtx))
+ if (!m_isIntegerInternalFormat)
{
- const GLint maximumFormatSampleCount = samples[0];
- if (!(maximumFormatSampleCount >= maxSamples))
+ // the maximum value in SAMPLES is guaranteed to be at least the value of MAX_SAMPLES
+ StateQueryMemoryWriteGuard<GLint> maxSamples;
+ glGetIntegerv(GL_MAX_SAMPLES, &maxSamples);
+ expectError(GL_NO_ERROR);
+
+ if (maxSamples.verifyValidity(m_testCtx))
{
- m_testCtx.getLog() << TestLog::Message << "// ERROR: Expected maximum value in SAMPLES (" << maximumFormatSampleCount << ") to be at least the value of MAX_SAMPLES (" << maxSamples << ")" << TestLog::EndMessage;
- if (m_testCtx.getTestResult() == QP_TEST_RESULT_PASS)
- m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "got invalid maximum sample count");
- }
+ const GLint maximumFormatSampleCount = samples[0];
+ if (!(maximumFormatSampleCount >= maxSamples))
+ {
+ m_testCtx.getLog() << TestLog::Message << "// ERROR: Expected maximum value in SAMPLES (" << maximumFormatSampleCount << ") to be at least the value of MAX_SAMPLES (" << maxSamples << ")" << TestLog::EndMessage;
+ if (m_testCtx.getTestResult() == QP_TEST_RESULT_PASS)
+ m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "got invalid maximum sample count");
+ }
+ }
}
}
private:
- GLenum m_internalFormat;
- bool m_isIntegerInternalFormat;
+ const GLenum m_internalFormat;
+ const bool m_isIntegerInternalFormat;
};
class SamplesBufferSizeCase : public ApiCase
void init (void);
IterateResult iterate (void);
- const glw::GLenum m_texTarget;
+ const glw::GLenum m_target;
const glw::GLenum m_internalFormat;
const FormatType m_type;
};
-FormatSamplesCase::FormatSamplesCase (Context& ctx, const char* name, const char* desc, glw::GLenum texTarget, glw::GLenum internalFormat, FormatType type)
+FormatSamplesCase::FormatSamplesCase (Context& ctx, const char* name, const char* desc, glw::GLenum target, glw::GLenum internalFormat, FormatType type)
: TestCase (ctx, name, desc)
- , m_texTarget (texTarget)
+ , m_target (target)
, m_internalFormat (internalFormat)
, m_type (type)
{
- DE_ASSERT(m_texTarget == GL_TEXTURE_2D_MULTISAMPLE || m_texTarget == GL_TEXTURE_2D_MULTISAMPLE_ARRAY);
+ DE_ASSERT(m_target == GL_TEXTURE_2D_MULTISAMPLE ||
+ m_target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY ||
+ m_target == GL_RENDERBUFFER);
}
void FormatSamplesCase::init (void)
{
- if (m_texTarget == GL_TEXTURE_2D_MULTISAMPLE_ARRAY && !m_context.getContextInfo().isExtensionSupported("GL_OES_texture_storage_multisample_2d_array"))
+ const bool isTextureTarget = (m_target == GL_TEXTURE_2D_MULTISAMPLE) ||
+ (m_target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY);
+
+ if (m_target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY && !m_context.getContextInfo().isExtensionSupported("GL_OES_texture_storage_multisample_2d_array"))
throw tcu::NotSupportedError("Test requires OES_texture_storage_multisample_2d_array extension");
// stencil8 textures are not supported without GL_OES_texture_stencil8 extension
- if (m_internalFormat == GL_STENCIL_INDEX8 && !m_context.getContextInfo().isExtensionSupported("GL_OES_texture_stencil8"))
+ if (isTextureTarget && m_internalFormat == GL_STENCIL_INDEX8 && !m_context.getContextInfo().isExtensionSupported("GL_OES_texture_stencil8"))
throw tcu::NotSupportedError("Test requires GL_OES_texture_stencil8 extension");
}
// Number of sample counts
{
- gl.getInternalformativ(m_texTarget, m_internalFormat, GL_NUM_SAMPLE_COUNTS, 1, &numSampleCounts);
+ gl.getInternalformativ(m_target, m_internalFormat, GL_NUM_SAMPLE_COUNTS, 1, &numSampleCounts);
GLU_EXPECT_NO_ERROR(gl.getError(), "get GL_NUM_SAMPLE_COUNTS");
m_testCtx.getLog() << tcu::TestLog::Message << "GL_NUM_SAMPLE_COUNTS = " << numSampleCounts << tcu::TestLog::EndMessage;
{
samples.resize(numSampleCounts, -1);
- gl.getInternalformativ(m_texTarget, m_internalFormat, GL_SAMPLES, numSampleCounts, &samples[0]);
+ gl.getInternalformativ(m_target, m_internalFormat, GL_SAMPLES, numSampleCounts, &samples[0]);
GLU_EXPECT_NO_ERROR(gl.getError(), "get GL_SAMPLES");
}
else
deUint32 target;
} textureTargets[] =
{
+ { "renderbuffer", GL_RENDERBUFFER },
{ "texture_2d_multisample", GL_TEXTURE_2D_MULTISAMPLE },
{ "texture_2d_multisample_array", GL_TEXTURE_2D_MULTISAMPLE_ARRAY },
};