From 6548214158a4646849b06b5a3768a6d0a04e7246 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jarkko=20P=C3=B6yry?= Date: Mon, 10 Nov 2014 13:03:52 -0800 Subject: [PATCH] Relax GLES3 internal format queries for GLES31 compatibility. - Allow multisample configurations for integer formats in GLES3. - Add GLES31 test set for rbo internal formats. Bug: 18315640 Change-Id: I9db53a5896511e29b0cc969812d2bf4f306e4612 --- .../functional/es3fInternalFormatQueryTests.cpp | 40 +++++++++------------- .../functional/es31fInternalFormatQueryTests.cpp | 22 +++++++----- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/modules/gles3/functional/es3fInternalFormatQueryTests.cpp b/modules/gles3/functional/es3fInternalFormatQueryTests.cpp index 5955250..eefb110 100644 --- a/modules/gles3/functional/es3fInternalFormatQueryTests.cpp +++ b/modules/gles3/functional/es3fInternalFormatQueryTests.cpp @@ -64,15 +64,6 @@ public: 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; @@ -106,26 +97,29 @@ public: } } - // the maximum value in SAMPLES is guaranteed to be at least the value of MAX_SAMPLES - StateQueryMemoryWriteGuard 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 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 diff --git a/modules/gles31/functional/es31fInternalFormatQueryTests.cpp b/modules/gles31/functional/es31fInternalFormatQueryTests.cpp index 2251aa7..d91f84d 100644 --- a/modules/gles31/functional/es31fInternalFormatQueryTests.cpp +++ b/modules/gles31/functional/es31fInternalFormatQueryTests.cpp @@ -53,27 +53,32 @@ private: 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"); } @@ -103,7 +108,7 @@ FormatSamplesCase::IterateResult FormatSamplesCase::iterate (void) // 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; @@ -124,7 +129,7 @@ FormatSamplesCase::IterateResult FormatSamplesCase::iterate (void) { 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 @@ -401,6 +406,7 @@ void InternalFormatQueryTests::init (void) deUint32 target; } textureTargets[] = { + { "renderbuffer", GL_RENDERBUFFER }, { "texture_2d_multisample", GL_TEXTURE_2D_MULTISAMPLE }, { "texture_2d_multisample_array", GL_TEXTURE_2D_MULTISAMPLE_ARRAY }, }; -- 2.7.4