Fix GLES2 negative test issues.
authorJarkko Pöyry <jpoyry@google.com>
Wed, 17 Dec 2014 01:07:56 +0000 (17:07 -0800)
committerJarkko Pöyry <jpoyry@google.com>
Wed, 17 Dec 2014 01:14:09 +0000 (17:14 -0800)
- Check GL_OES_fbo_render_mipmap extension in framebuffer_texture2d negative
  test.
- Check GL_EXT_draw_buffers in builtin_variable.max_draw_buffers_* tests.
- Fix invalid uniform location check in get_uniformfv negative state test.

Bug: 18620565
Change-Id: I2158a10ca859e3c40219bd324e7a02c0ff10e42b

modules/gles2/functional/es2fNegativeBufferApiTests.cpp
modules/gles2/functional/es2fNegativeStateApiTests.cpp
modules/gles2/functional/es2fShaderBuiltinVarTests.cpp

index 911ea33..84894f9 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "es2fNegativeBufferApiTests.hpp"
 #include "es2fApiCase.hpp"
+#include "gluContextInfo.hpp"
 
 #include "glwEnums.hpp"
 #include "glwDefs.hpp"
@@ -339,10 +340,13 @@ void NegativeBufferApiTests::init (void)
                        expectError(GL_INVALID_ENUM);
                        m_log << TestLog::EndSection;
 
-                       m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is not 0.");
-                       glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex2D, 3);
-                       expectError(GL_INVALID_VALUE);
-                       m_log << TestLog::EndSection;
+                       if (!m_context.getContextInfo().isExtensionSupported("GL_OES_fbo_render_mipmap"))
+                       {
+                               m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is not 0.");
+                               glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex2D, 3);
+                               expectError(GL_INVALID_VALUE);
+                               m_log << TestLog::EndSection;
+                       }
 
                        m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if texture is neither 0 nor the name of an existing texture object.");
                        glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, -1, 0);
index 22979fb..72acf27 100644 (file)
@@ -348,7 +348,7 @@ void NegativeStateApiTests::init (void)
 
                        GLint vUnif = glGetUniformLocation(program.getProgram(), "vTest");      // vec4
                        GLint fUnif = glGetUniformLocation(program.getProgram(), "fTest");      // ivec4
-                       if (vUnif == -1 || fUnif)
+                       if (vUnif == -1 || fUnif == -1)
                                m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Failed to retrieve uniform location");
 
                        GLuint shader           = glCreateShader(GL_VERTEX_SHADER);
index fd33737..9129c51 100644 (file)
@@ -63,11 +63,12 @@ public:
                                                ShaderBuiltinConstantCase                               (Context& context, const char* name, const char* desc, const char* varName, deUint32 paramName, bool isVertexCase);
                                                ~ShaderBuiltinConstantCase                              (void);
 
+       int                                     getRefValue                                                             (void);
        void                            init                                                                    (void);
 
 private:
-       std::string                     m_varName;
-       deUint32                        m_paramName;
+       const std::string       m_varName;
+       const deUint32          m_paramName;
 };
 
 ShaderBuiltinConstantCase::ShaderBuiltinConstantCase (Context& context, const char* name, const char* desc, const char* varName, deUint32 paramName, bool isVertexCase)
@@ -81,20 +82,25 @@ ShaderBuiltinConstantCase::~ShaderBuiltinConstantCase (void)
 {
 }
 
-static int getConstRefValue (const char* varName)
+int ShaderBuiltinConstantCase::getRefValue (void)
 {
-       if (deStringEqual(varName, "gl_MaxDrawBuffers"))
-               return 1;
+       if (m_varName == "gl_MaxDrawBuffers")
+       {
+               if (m_ctxInfo.isExtensionSupported("GL_EXT_draw_buffers"))
+                       return m_ctxInfo.getInt(GL_MAX_DRAW_BUFFERS);
+               else
+                       return 1;
+       }
        else
        {
-               DE_ASSERT(DE_FALSE);
-               return 0;
+               DE_ASSERT(m_paramName != GL_NONE);
+               return m_ctxInfo.getInt(m_paramName);
        }
 }
 
 void ShaderBuiltinConstantCase::init (void)
 {
-       int refValue = m_paramName != GL_NONE ? m_ctxInfo.getInt(m_paramName) : getConstRefValue(m_varName.c_str());
+       const int refValue = getRefValue();
        m_testCtx.getLog() << tcu::TestLog::Message << m_varName << " = " << refValue << tcu::TestLog::EndMessage;
 
        static const char* defaultVertSrc =