Relax GLES3 internal format queries for GLES31 compatibility.
authorJarkko Pöyry <jpoyry@google.com>
Mon, 10 Nov 2014 21:03:52 +0000 (13:03 -0800)
committerJarkko Pöyry <jpoyry@google.com>
Mon, 10 Nov 2014 22:08:51 +0000 (14:08 -0800)
- Allow multisample configurations for integer formats in GLES3.
- Add GLES31 test set for rbo internal formats.

Bug: 18315640
Change-Id: I9db53a5896511e29b0cc969812d2bf4f306e4612

modules/gles3/functional/es3fInternalFormatQueryTests.cpp
modules/gles31/functional/es31fInternalFormatQueryTests.cpp

index 5955250..eefb110 100644 (file)
@@ -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<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
index 2251aa7..d91f84d 100644 (file)
@@ -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 },
        };