Add state query tests for GL_EXT_draw_buffers_indexed.
authorMika Isojärvi <misojarvi@google.com>
Fri, 27 Feb 2015 22:54:11 +0000 (14:54 -0800)
committerMika Isojärvi <misojarvi@google.com>
Mon, 16 Mar 2015 21:45:39 +0000 (14:45 -0700)
Bug: 18925583
Change-Id: I7edf58afd794d7717eedc63115b36462ea0d6567

modules/gles31/functional/es31fIndexedStateQueryTests.cpp
modules/glshared/glsStateQueryUtil.cpp
modules/glshared/glsStateQueryUtil.hpp

index 877e367..3e1f37f 100644 (file)
@@ -27,6 +27,7 @@
 #include "gluRenderContext.hpp"
 #include "gluCallLogWrapper.hpp"
 #include "gluStrUtil.hpp"
+#include "gluContextInfo.hpp"
 #include "gluObjectWrapper.hpp"
 #include "glwFunctions.hpp"
 #include "glwEnums.hpp"
@@ -49,9 +50,13 @@ static const char* getVerifierSuffix (QueryType type)
 {
        switch (type)
        {
-               case QUERY_INDEXED_BOOLEAN:             return "getbooleani_v";
-               case QUERY_INDEXED_INTEGER:             return "getintegeri_v";
-               case QUERY_INDEXED_INTEGER64:   return "getinteger64i_v";
+               case QUERY_INDEXED_BOOLEAN:                     return "getbooleani_v";
+               case QUERY_INDEXED_INTEGER:                     return "getintegeri_v";
+               case QUERY_INDEXED_INTEGER64:           return "getinteger64i_v";
+               case QUERY_INDEXED_BOOLEAN_VEC4:        return "getbooleani_v";
+               case QUERY_INDEXED_INTEGER_VEC4:        return "getintegeri_v";
+               case QUERY_INDEXED_INTEGER64_VEC4:      return "getinteger64i_v";
+               case QUERY_INDEXED_ISENABLED:           return "isenabledi";
                default:
                        DE_ASSERT(DE_FALSE);
                        return DE_NULL;
@@ -835,6 +840,612 @@ ImageBindingFormatCase::IterateResult ImageBindingFormatCase::iterate (void)
        return STOP;
 }
 
+class EnableBlendCase : public TestCase
+{
+public:
+                                               EnableBlendCase (Context& context, const char* name, const char* desc, QueryType verifierType);
+
+       void                            init                    (void);
+private:
+       IterateResult           iterate                 (void);
+
+       const QueryType         m_verifierType;
+};
+
+EnableBlendCase::EnableBlendCase (Context& context, const char* name, const char* desc, QueryType verifierType)
+       : TestCase                      (context, name, desc)
+       , m_verifierType        (verifierType)
+{
+}
+
+void EnableBlendCase::init (void)
+{
+       if (!m_context.getContextInfo().isExtensionSupported("GL_EXT_draw_buffers_indexed"))
+               throw tcu::NotSupportedError("Extension GL_EXT_draw_buffers_indexed not supported", "", __FILE__, __LINE__);
+}
+
+EnableBlendCase::IterateResult EnableBlendCase::iterate (void)
+{
+       glu::CallLogWrapper             gl                              (m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
+       tcu::ResultCollector    result                  (m_testCtx.getLog(), " // ERROR: ");
+       deInt32                                 maxDrawBuffers = 0;
+
+       gl.enableLogging(true);
+
+       gl.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
+       GLU_EXPECT_NO_ERROR(gl.glGetError(), "glGetIntegerv");
+
+       {
+               const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial value");
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedBoolean(result, gl, GL_BLEND, ndx, false, m_verifierType);
+       }
+       {
+               const tcu::ScopedLogSection     superSection    (m_testCtx.getLog(), "AfterSettingCommon", "After setting common");
+
+               gl.glEnable(GL_BLEND);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedBoolean(result, gl, GL_BLEND, ndx, true, m_verifierType);
+
+       }
+       {
+               const tcu::ScopedLogSection     superSection    (m_testCtx.getLog(), "AfterSettingIndexed", "After setting indexed");
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+               {
+                       if (ndx % 2 == 0)
+                               gl.glEnablei(GL_BLEND, ndx);
+                       else
+                               gl.glDisablei(GL_BLEND, ndx);
+               }
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedBoolean(result, gl, GL_BLEND, ndx, (ndx % 2 == 0), m_verifierType);
+       }
+       {
+               const tcu::ScopedLogSection     superSection    (m_testCtx.getLog(), "AfterResettingIndexedWithCommon", "After resetting indexed with common");
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+               {
+                       if (ndx % 2 == 0)
+                               gl.glEnablei(GL_BLEND, ndx);
+                       else
+                               gl.glDisablei(GL_BLEND, ndx);
+               }
+
+               gl.glEnable(GL_BLEND);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedBoolean(result, gl, GL_BLEND, ndx, true, m_verifierType);
+       }
+
+       result.setTestContextResult(m_testCtx);
+       return STOP;
+}
+
+class ColorMaskCase : public TestCase
+{
+public:
+                                               ColorMaskCase   (Context& context, const char* name, const char* desc, QueryType verifierType);
+
+       void                            init                    (void);
+private:
+       IterateResult           iterate                 (void);
+
+       const QueryType         m_verifierType;
+};
+
+ColorMaskCase::ColorMaskCase (Context& context, const char* name, const char* desc, QueryType verifierType)
+       : TestCase                      (context, name, desc)
+       , m_verifierType        (verifierType)
+{
+}
+
+void ColorMaskCase::init (void)
+{
+       if (!m_context.getContextInfo().isExtensionSupported("GL_EXT_draw_buffers_indexed"))
+               throw tcu::NotSupportedError("Extension GL_EXT_draw_buffers_indexed not supported", "", __FILE__, __LINE__);
+}
+
+ColorMaskCase::IterateResult ColorMaskCase::iterate (void)
+{
+       glu::CallLogWrapper             gl                              (m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
+       tcu::ResultCollector    result                  (m_testCtx.getLog(), " // ERROR: ");
+       deInt32                                 maxDrawBuffers = 0;
+
+       gl.enableLogging(true);
+
+       gl.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
+       GLU_EXPECT_NO_ERROR(gl.glGetError(), "glGetIntegerv");
+
+       {
+               const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial value");
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedBooleanVec4(result, gl, GL_COLOR_WRITEMASK, ndx, tcu::BVec4(true), m_verifierType);
+       }
+       {
+               const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterSettingCommon", "After setting common");
+
+               gl.glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_FALSE);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedBooleanVec4(result, gl, GL_COLOR_WRITEMASK, ndx, tcu::BVec4(false, true, true, false), m_verifierType);
+       }
+       {
+               const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterSettingIndexed", "After setting indexed");
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       gl.glColorMaski(ndx, (ndx % 2 == 0 ? GL_TRUE : GL_FALSE), (ndx % 2 == 1 ? GL_TRUE : GL_FALSE), (ndx % 2 == 0 ? GL_TRUE : GL_FALSE), (ndx % 2 == 1 ? GL_TRUE : GL_FALSE));
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedBooleanVec4(result, gl, GL_COLOR_WRITEMASK, ndx, (ndx % 2 == 0 ? tcu::BVec4(true, false, true, false) : tcu::BVec4(false, true, false, true)), m_verifierType);
+       }
+       {
+               const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterResettingIndexedWithCommon", "After resetting indexed with common");
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       gl.glColorMaski(ndx, (ndx % 2 == 0 ? GL_TRUE : GL_FALSE), (ndx % 2 == 1 ? GL_TRUE : GL_FALSE), (ndx % 2 == 0 ? GL_TRUE : GL_FALSE), (ndx % 2 == 1 ? GL_TRUE : GL_FALSE));
+
+               gl.glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_FALSE);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedBooleanVec4(result, gl, GL_COLOR_WRITEMASK, ndx, tcu::BVec4(false, true, true, false), m_verifierType);
+       }
+
+       result.setTestContextResult(m_testCtx);
+       return STOP;
+}
+
+class BlendFuncCase : public TestCase
+{
+public:
+                                               BlendFuncCase   (Context& context, const char* name, const char* desc, QueryType verifierType);
+
+       void                            init                    (void);
+private:
+       IterateResult           iterate                 (void);
+
+       const QueryType         m_verifierType;
+};
+
+BlendFuncCase::BlendFuncCase (Context& context, const char* name, const char* desc, QueryType verifierType)
+       : TestCase                      (context, name, desc)
+       , m_verifierType        (verifierType)
+{
+}
+
+void BlendFuncCase::init (void)
+{
+       if (!m_context.getContextInfo().isExtensionSupported("GL_EXT_draw_buffers_indexed"))
+               throw tcu::NotSupportedError("Extension GL_EXT_draw_buffers_indexed not supported", "", __FILE__, __LINE__);
+}
+
+BlendFuncCase::IterateResult BlendFuncCase::iterate (void)
+{
+       const deUint32 blendFuncs[] =
+       {
+               GL_ZERO,
+               GL_ONE,
+               GL_SRC_COLOR,
+               GL_ONE_MINUS_SRC_COLOR,
+               GL_DST_COLOR,
+               GL_ONE_MINUS_DST_COLOR,
+               GL_SRC_ALPHA,
+               GL_ONE_MINUS_SRC_ALPHA,
+               GL_DST_ALPHA,
+               GL_ONE_MINUS_DST_ALPHA,
+               GL_CONSTANT_COLOR,
+               GL_ONE_MINUS_CONSTANT_COLOR,
+               GL_CONSTANT_ALPHA,
+               GL_ONE_MINUS_CONSTANT_ALPHA,
+               GL_SRC_ALPHA_SATURATE
+       };
+
+       glu::CallLogWrapper             gl                              (m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
+       tcu::ResultCollector    result                  (m_testCtx.getLog(), " // ERROR: ");
+       deInt32                                 maxDrawBuffers = 0;
+
+       gl.enableLogging(true);
+
+       gl.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
+       GLU_EXPECT_NO_ERROR(gl.glGetError(), "glGetIntegerv");
+
+       {
+               const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial value");
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_RGB, ndx, GL_ONE, m_verifierType);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_DST_RGB, ndx, GL_ZERO, m_verifierType);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_ALPHA, ndx, GL_ONE, m_verifierType);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_DST_ALPHA, ndx, GL_ZERO, m_verifierType);
+       }
+       {
+               const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterSettingCommon", "After setting common");
+
+               gl.glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_RGB, ndx, GL_SRC_ALPHA, m_verifierType);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_DST_RGB, ndx, GL_DST_ALPHA, m_verifierType);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_ALPHA, ndx, GL_SRC_ALPHA, m_verifierType);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_DST_ALPHA, ndx, GL_DST_ALPHA, m_verifierType);
+       }
+       {
+               const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterSettingCommonSeparate", "After setting common separate");
+
+               gl.glBlendFuncSeparate(GL_SRC_COLOR, GL_ONE_MINUS_SRC_ALPHA, GL_DST_COLOR, GL_ONE_MINUS_DST_ALPHA);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_RGB, ndx, GL_SRC_COLOR, m_verifierType);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_DST_RGB, ndx, GL_ONE_MINUS_SRC_ALPHA, m_verifierType);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_ALPHA, ndx, GL_DST_COLOR, m_verifierType);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_DST_ALPHA, ndx, GL_ONE_MINUS_DST_ALPHA, m_verifierType);
+       }
+       {
+               const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterSettingIndexed", "After setting indexed");
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       gl.glBlendFunci(ndx, blendFuncs[ndx % DE_LENGTH_OF_ARRAY(blendFuncs)], blendFuncs[(ndx + 1) % DE_LENGTH_OF_ARRAY(blendFuncs)]);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_RGB, ndx, blendFuncs[ndx % DE_LENGTH_OF_ARRAY(blendFuncs)], m_verifierType);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_DST_RGB, ndx, blendFuncs[(ndx + 1) % DE_LENGTH_OF_ARRAY(blendFuncs)], m_verifierType);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_ALPHA, ndx, blendFuncs[ndx % DE_LENGTH_OF_ARRAY(blendFuncs)], m_verifierType);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_DST_ALPHA, ndx, blendFuncs[(ndx + 1) % DE_LENGTH_OF_ARRAY(blendFuncs)], m_verifierType);
+       }
+       {
+               const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterSettingIndexedSeparate", "After setting indexed separate");
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       gl.glBlendFuncSeparatei(ndx, blendFuncs[(ndx + 3) % DE_LENGTH_OF_ARRAY(blendFuncs)],
+                                                                                blendFuncs[(ndx + 2) % DE_LENGTH_OF_ARRAY(blendFuncs)],
+                                                                                blendFuncs[(ndx + 1) % DE_LENGTH_OF_ARRAY(blendFuncs)],
+                                                                                blendFuncs[(ndx + 0) % DE_LENGTH_OF_ARRAY(blendFuncs)]);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_RGB, ndx, blendFuncs[(ndx + 3) % DE_LENGTH_OF_ARRAY(blendFuncs)], m_verifierType);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_DST_RGB, ndx, blendFuncs[(ndx + 2) % DE_LENGTH_OF_ARRAY(blendFuncs)], m_verifierType);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_ALPHA, ndx, blendFuncs[(ndx + 1) % DE_LENGTH_OF_ARRAY(blendFuncs)], m_verifierType);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_DST_ALPHA, ndx, blendFuncs[(ndx + 0) % DE_LENGTH_OF_ARRAY(blendFuncs)], m_verifierType);
+
+       }
+       {
+               const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterResettingIndexedWithCommon", "After resetting indexed with common");
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       gl.glBlendFunci(ndx, blendFuncs[ndx % DE_LENGTH_OF_ARRAY(blendFuncs)], blendFuncs[(ndx + 1) % DE_LENGTH_OF_ARRAY(blendFuncs)]);
+
+               gl.glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_RGB, ndx, GL_SRC_ALPHA, m_verifierType);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_DST_RGB, ndx, GL_DST_ALPHA, m_verifierType);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_ALPHA, ndx, GL_SRC_ALPHA, m_verifierType);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_DST_ALPHA, ndx, GL_DST_ALPHA, m_verifierType);
+       }
+       {
+               const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterResettingIndexedWithCommonSeparate", "After resetting indexed with common separate");
+
+               gl.glBlendFuncSeparate(GL_SRC_COLOR, GL_ONE_MINUS_SRC_ALPHA, GL_DST_COLOR, GL_ONE_MINUS_DST_ALPHA);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       gl.glBlendFuncSeparatei(ndx, blendFuncs[(ndx + 3) % DE_LENGTH_OF_ARRAY(blendFuncs)],
+                                                                                blendFuncs[(ndx + 2) % DE_LENGTH_OF_ARRAY(blendFuncs)],
+                                                                                blendFuncs[(ndx + 1) % DE_LENGTH_OF_ARRAY(blendFuncs)],
+                                                                                blendFuncs[(ndx + 0) % DE_LENGTH_OF_ARRAY(blendFuncs)]);
+
+               gl.glBlendFuncSeparate(GL_SRC_COLOR, GL_ONE_MINUS_SRC_ALPHA, GL_DST_COLOR, GL_ONE_MINUS_DST_ALPHA);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_RGB, ndx, GL_SRC_COLOR, m_verifierType);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_DST_RGB, ndx, GL_ONE_MINUS_SRC_ALPHA, m_verifierType);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_ALPHA, ndx, GL_DST_COLOR, m_verifierType);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_DST_ALPHA, ndx, GL_ONE_MINUS_DST_ALPHA, m_verifierType);
+       }
+
+       result.setTestContextResult(m_testCtx);
+       return STOP;
+}
+
+class BlendEquationCase : public TestCase
+{
+public:
+                                               BlendEquationCase       (Context& context, const char* name, const char* desc, QueryType verifierType);
+
+       void                            init                            (void);
+private:
+       IterateResult           iterate                         (void);
+
+       const QueryType         m_verifierType;
+};
+
+BlendEquationCase::BlendEquationCase (Context& context, const char* name, const char* desc, QueryType verifierType)
+       : TestCase                      (context, name, desc)
+       , m_verifierType        (verifierType)
+{
+}
+
+void BlendEquationCase::init (void)
+{
+       if (!m_context.getContextInfo().isExtensionSupported("GL_EXT_draw_buffers_indexed"))
+               throw tcu::NotSupportedError("Extension GL_EXT_draw_buffers_indexed not supported", "", __FILE__, __LINE__);
+}
+
+BlendEquationCase::IterateResult BlendEquationCase::iterate (void)
+{
+       const deUint32 blendEquations[] =
+       {
+               GL_FUNC_ADD,
+               GL_FUNC_SUBTRACT,
+               GL_FUNC_REVERSE_SUBTRACT,
+               GL_MIN,
+               GL_MAX
+       };
+
+       glu::CallLogWrapper             gl                              (m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
+       tcu::ResultCollector    result                  (m_testCtx.getLog(), " // ERROR: ");
+       deInt32                                 maxDrawBuffers = 0;
+
+       gl.enableLogging(true);
+
+       gl.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
+       GLU_EXPECT_NO_ERROR(gl.glGetError(), "glGetIntegerv");
+
+       {
+               const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial value");
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_RGB, ndx, GL_FUNC_ADD, m_verifierType);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_ALPHA, ndx, GL_FUNC_ADD, m_verifierType);
+       }
+       {
+               const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterSettingCommon", "After setting common");
+
+               gl.glBlendEquation(GL_FUNC_SUBTRACT);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_RGB, ndx, GL_FUNC_SUBTRACT, m_verifierType);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_ALPHA, ndx, GL_FUNC_SUBTRACT, m_verifierType);
+       }
+       {
+               const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterSettingCommonSeparate", "After setting common separate");
+
+               gl.glBlendEquationSeparate(GL_FUNC_REVERSE_SUBTRACT, GL_FUNC_SUBTRACT);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_RGB, ndx, GL_FUNC_REVERSE_SUBTRACT, m_verifierType);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_ALPHA, ndx, GL_FUNC_SUBTRACT, m_verifierType);
+       }
+       {
+               const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterSettingIndexed", "After setting indexed");
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       gl.glBlendEquationi(ndx, blendEquations[ndx % DE_LENGTH_OF_ARRAY(blendEquations)]);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_RGB, ndx, blendEquations[ndx % DE_LENGTH_OF_ARRAY(blendEquations)], m_verifierType);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_ALPHA, ndx, blendEquations[ndx % DE_LENGTH_OF_ARRAY(blendEquations)], m_verifierType);
+       }
+       {
+               const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterSettingIndexedSeparate", "After setting indexed separate");
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       gl.glBlendEquationSeparatei(ndx, blendEquations[ndx % DE_LENGTH_OF_ARRAY(blendEquations)], blendEquations[(ndx + 1) % DE_LENGTH_OF_ARRAY(blendEquations)]);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_RGB, ndx, blendEquations[ndx % DE_LENGTH_OF_ARRAY(blendEquations)], m_verifierType);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_ALPHA, ndx, blendEquations[(ndx + 1) % DE_LENGTH_OF_ARRAY(blendEquations)], m_verifierType);
+       }
+       {
+               const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterResettingIndexedWithCommon", "After resetting indexed with common");
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       gl.glBlendEquationi(ndx, blendEquations[ndx % DE_LENGTH_OF_ARRAY(blendEquations)]);
+
+               gl.glBlendEquation(GL_FUNC_SUBTRACT);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_RGB, ndx, GL_FUNC_SUBTRACT, m_verifierType);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_ALPHA, ndx, GL_FUNC_SUBTRACT, m_verifierType);
+       }
+       {
+               const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterResettingIndexedWithCommonSeparate", "After resetting indexed with common separate");
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       gl.glBlendEquationSeparatei(ndx, blendEquations[ndx % DE_LENGTH_OF_ARRAY(blendEquations)], blendEquations[(ndx + 1) % DE_LENGTH_OF_ARRAY(blendEquations)]);
+
+               gl.glBlendEquationSeparate(GL_FUNC_REVERSE_SUBTRACT, GL_FUNC_SUBTRACT);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_RGB, ndx, GL_FUNC_REVERSE_SUBTRACT, m_verifierType);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_ALPHA, ndx, GL_FUNC_SUBTRACT, m_verifierType);
+       }
+
+       result.setTestContextResult(m_testCtx);
+       return STOP;
+}
+
+class BlendEquationAdvancedCase : public TestCase
+{
+public:
+                                               BlendEquationAdvancedCase       (Context& context, const char* name, const char* desc, QueryType verifierType);
+
+       void                            init                            (void);
+private:
+       IterateResult           iterate                         (void);
+
+       const QueryType         m_verifierType;
+};
+
+BlendEquationAdvancedCase::BlendEquationAdvancedCase (Context& context, const char* name, const char* desc, QueryType verifierType)
+       : TestCase                      (context, name, desc)
+       , m_verifierType        (verifierType)
+{
+}
+
+void BlendEquationAdvancedCase::init (void)
+{
+       if (!m_context.getContextInfo().isExtensionSupported("GL_EXT_draw_buffers_indexed"))
+               throw tcu::NotSupportedError("Extension GL_EXT_draw_buffers_indexed not supported", "", __FILE__, __LINE__);
+
+       if (!m_context.getContextInfo().isExtensionSupported("GL_KHR_blend_equation_advanced"))
+               throw tcu::NotSupportedError("Extension GL_KHR_blend_equation_advanced not supported", "", __FILE__, __LINE__);
+}
+
+BlendEquationAdvancedCase::IterateResult BlendEquationAdvancedCase::iterate (void)
+{
+       const deUint32 blendEquations[] =
+       {
+               GL_FUNC_ADD,
+               GL_FUNC_SUBTRACT,
+               GL_FUNC_REVERSE_SUBTRACT,
+               GL_MIN,
+               GL_MAX
+       };
+
+       const deUint32 blendEquationAdvanced[] =
+       {
+               GL_MULTIPLY_KHR,
+               GL_SCREEN_KHR,
+               GL_OVERLAY_KHR,
+               GL_DARKEN_KHR,
+               GL_LIGHTEN_KHR,
+               GL_COLORDODGE_KHR,
+               GL_COLORBURN_KHR,
+               GL_HARDLIGHT_KHR,
+               GL_SOFTLIGHT_KHR,
+               GL_DIFFERENCE_KHR,
+               GL_EXCLUSION_KHR,
+               GL_HSL_HUE_KHR,
+               GL_HSL_SATURATION_KHR,
+               GL_HSL_COLOR_KHR,
+               GL_HSL_LUMINOSITY_KHR
+       };
+
+       glu::CallLogWrapper             gl                              (m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
+       tcu::ResultCollector    result                  (m_testCtx.getLog(), " // ERROR: ");
+       deInt32                                 maxDrawBuffers = 0;
+
+       gl.enableLogging(true);
+
+       gl.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
+       GLU_EXPECT_NO_ERROR(gl.glGetError(), "glGetIntegerv");
+
+       {
+               const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterSettingCommon", "After setting common");
+
+               gl.glBlendEquation(GL_SCREEN_KHR);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_RGB, ndx, GL_SCREEN_KHR, m_verifierType);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_ALPHA, ndx, GL_SCREEN_KHR, m_verifierType);
+       }
+       {
+               const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterSettingIndexed", "After setting indexed");
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       gl.glBlendEquationi(ndx, blendEquationAdvanced[ndx % DE_LENGTH_OF_ARRAY(blendEquationAdvanced)]);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_RGB, ndx, blendEquationAdvanced[ndx % DE_LENGTH_OF_ARRAY(blendEquationAdvanced)], m_verifierType);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_ALPHA, ndx, blendEquationAdvanced[ndx % DE_LENGTH_OF_ARRAY(blendEquationAdvanced)], m_verifierType);
+       }
+       {
+               const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterResettingIndexedWithCommon", "After resetting indexed with common");
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       gl.glBlendEquationi(ndx, blendEquationAdvanced[ndx % DE_LENGTH_OF_ARRAY(blendEquationAdvanced)]);
+
+               gl.glBlendEquation(GL_MULTIPLY_KHR);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_RGB, ndx, GL_MULTIPLY_KHR, m_verifierType);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_ALPHA, ndx, GL_MULTIPLY_KHR, m_verifierType);
+       }
+       {
+               const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterResettingIndexedSeparateWithCommon", "After resetting indexed separate with common");
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       gl.glBlendEquationSeparatei(ndx, blendEquations[ndx % DE_LENGTH_OF_ARRAY(blendEquations)], blendEquations[(ndx + 1) % DE_LENGTH_OF_ARRAY(blendEquations)]);
+
+               gl.glBlendEquation(GL_LIGHTEN_KHR);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_RGB, ndx, GL_LIGHTEN_KHR, m_verifierType);
+
+               for (int ndx = 0; ndx < maxDrawBuffers; ++ndx)
+                       verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_ALPHA, ndx, GL_LIGHTEN_KHR, m_verifierType);
+       }
+
+       result.setTestContextResult(m_testCtx);
+       return STOP;
+}
+
 } // anonymous
 
 IndexedStateQueryTests::IndexedStateQueryTests (Context& context)
@@ -849,15 +1460,24 @@ IndexedStateQueryTests::~IndexedStateQueryTests (void)
 void IndexedStateQueryTests::init (void)
 {
        static const QueryType verifiers[] = { QUERY_INDEXED_BOOLEAN, QUERY_INDEXED_INTEGER, QUERY_INDEXED_INTEGER64 };
+       static const QueryType vec4Verifiers[] = { QUERY_INDEXED_BOOLEAN_VEC4, QUERY_INDEXED_INTEGER_VEC4, QUERY_INDEXED_INTEGER64_VEC4 };
 
 #define FOR_EACH_VERIFIER(X) \
        for (int verifierNdx = 0; verifierNdx < DE_LENGTH_OF_ARRAY(verifiers); ++verifierNdx)   \
        {                                                                                                                                                                               \
-               const char* verifierSuffix = getVerifierSuffix(verifiers[verifierNdx]);                         \
                const QueryType verifier = verifiers[verifierNdx];                                                                      \
+               const char* verifierSuffix = getVerifierSuffix(verifier);                                                       \
                this->addChild(X);                                                                                                                                      \
        }
 
+#define FOR_EACH_VEC4_VERIFIER(X) \
+       for (int verifierNdx = 0; verifierNdx < DE_LENGTH_OF_ARRAY(vec4Verifiers); ++verifierNdx)       \
+       {                                                                                                                                                                                       \
+               const QueryType verifier = vec4Verifiers[verifierNdx];                                                                  \
+               const char* verifierSuffix = getVerifierSuffix(verifier);                                                               \
+               this->addChild(X);                                                                                                                                              \
+       }
+
        FOR_EACH_VERIFIER(new SampleMaskCase                    (m_context, (std::string() + "sample_mask_value_" + verifierSuffix).c_str(),                            "Test SAMPLE_MASK_VALUE", verifier))
 
        FOR_EACH_VERIFIER(new MinValueIndexed3Case              (m_context, (std::string() + "max_compute_work_group_count_" + verifierSuffix).c_str(),         "Test MAX_COMPUTE_WORK_GROUP_COUNT",    GL_MAX_COMPUTE_WORK_GROUP_COUNT,        tcu::IVec3(65535,65535,65535),  verifier))
@@ -878,6 +1498,17 @@ void IndexedStateQueryTests::init (void)
        FOR_EACH_VERIFIER(new ImageBindingAccessCase    (m_context, (std::string() + "image_binding_access_" + verifierSuffix).c_str(),                         "Test IMAGE_BINDING_ACCESS",                    verifier))
        FOR_EACH_VERIFIER(new ImageBindingFormatCase    (m_context, (std::string() + "image_binding_format_" + verifierSuffix).c_str(),                         "Test IMAGE_BINDING_FORMAT",                    verifier))
 
+       {
+               const QueryType verifier = QUERY_INDEXED_ISENABLED;
+               const char* verifierSuffix = getVerifierSuffix(verifier);
+               this->addChild(new EnableBlendCase                      (m_context, (std::string() + "blend_" + verifierSuffix).c_str(),                                                        "BLEND",                                                                verifier));
+       }
+       FOR_EACH_VEC4_VERIFIER(new ColorMaskCase                (m_context, (std::string() + "color_mask_" + verifierSuffix).c_str(),                                           "COLOR_WRITEMASK",                                              verifier))
+       FOR_EACH_VERIFIER(new BlendFuncCase                             (m_context, (std::string() + "blend_func_" + verifierSuffix).c_str(),                                           "BLEND_SRC and BLEND_DST",                              verifier))
+       FOR_EACH_VERIFIER(new BlendEquationCase                 (m_context, (std::string() + "blend_equation_" + verifierSuffix).c_str(),                                       "BLEND_EQUATION_RGB and BLEND_DST",             verifier))
+       FOR_EACH_VERIFIER(new BlendEquationAdvancedCase (m_context, (std::string() + "blend_equation_advanced_" + verifierSuffix).c_str(),                      "BLEND_EQUATION_RGB and BLEND_DST",             verifier))
+
+#undef FOR_EACH_VEC4_VERIFIER
 #undef FOR_EACH_VERIFIER
 }
 
index b43954c..25cf96d 100644 (file)
@@ -35,6 +35,11 @@ namespace gls
 namespace StateQueryUtil
 {
 
+static glw::GLboolean mapBoolToGLBoolean (bool b)
+{
+       return (b ? GL_TRUE : GL_FALSE);
+}
+
 static bool checkError (tcu::ResultCollector& result, glu::CallLogWrapper& gl, const char* msg)
 {
        const glw::GLenum errorCode = gl.glGetError();
@@ -122,6 +127,24 @@ QueriedState::QueriedState (const GLFloatVec4& v)
        m_v.vFloatVec4[3] = v[3];
 }
 
+QueriedState::QueriedState (const BooleanVec4& v)
+       : m_type(DATATYPE_BOOLEAN_VEC4)
+{
+       m_v.vBooleanVec4[0] = v[0];
+       m_v.vBooleanVec4[1] = v[1];
+       m_v.vBooleanVec4[2] = v[2];
+       m_v.vBooleanVec4[3] = v[3];
+}
+
+QueriedState::QueriedState (const GLInt64Vec4& v)
+       : m_type(DATATYPE_INTEGER64_VEC4)
+{
+       m_v.vInt64Vec4[0] = v[0];
+       m_v.vInt64Vec4[1] = v[1];
+       m_v.vInt64Vec4[2] = v[2];
+       m_v.vInt64Vec4[3] = v[3];
+}
+
 bool QueriedState::isUndefined (void) const
 {
        return m_type == DATATYPE_LAST;
@@ -192,6 +215,18 @@ QueriedState::GLFloatVec4& QueriedState::getFloatVec4Access (void)
        return m_v.vFloatVec4;
 }
 
+QueriedState::BooleanVec4& QueriedState::getBooleanVec4Access (void)
+{
+       DE_ASSERT(m_type == DATATYPE_BOOLEAN_VEC4);
+       return m_v.vBooleanVec4;
+}
+
+QueriedState::GLInt64Vec4& QueriedState::getInt64Vec4Access (void)
+{
+       DE_ASSERT(m_type == DATATYPE_INTEGER64_VEC4);
+       return m_v.vInt64Vec4;
+}
+
 // query
 
 static bool verifyBooleanValidity (tcu::ResultCollector& result, glw::GLboolean v)
@@ -207,6 +242,32 @@ static bool verifyBooleanValidity (tcu::ResultCollector& result, glw::GLboolean
        }
 }
 
+static bool verifyBooleanVec4Validity (tcu::ResultCollector& result, const glw::GLboolean v[4])
+{
+       bool valid = true;
+
+       for (int i = 0; i < 4; i++)
+       {
+               if (v[i] != GL_TRUE && v[i] != GL_FALSE)
+                       valid = false;
+       }
+
+       if (!valid)
+       {
+               std::ostringstream buf;
+               buf << "Boolean vec4 value was not neither GL_TRUE nor GL_FALSE, got (";
+
+               for (int i = 0; i < 4; i++)
+                       buf << (i > 0 ? ", " : "") << de::toString(tcu::Format::Hex<2>(v[i]));
+
+               buf << ")";
+
+               result.fail(buf.str());
+       }
+
+       return valid;
+}
+
 void queryState (tcu::ResultCollector& result, glu::CallLogWrapper& gl, QueryType type, glw::GLenum target, QueriedState& state)
 {
        switch (type)
@@ -297,6 +358,76 @@ void queryIndexedState (tcu::ResultCollector& result, glu::CallLogWrapper& gl, Q
 {
        switch (type)
        {
+               case QUERY_INDEXED_BOOLEAN_VEC4:
+               {
+                       StateQueryMemoryWriteGuard<glw::GLboolean[4]> value;
+                       gl.glGetBooleani_v(target, index, value);
+
+                       if (!checkError(result, gl, "glGetBooleani_v"))
+                               return;
+
+                       if (!value.verifyValidity(result))
+                               return;
+
+                       if (!verifyBooleanVec4Validity(result, value))
+                               return;
+
+                       {
+                               bool res[4];
+
+                               for (int i = 0; i < 4; i++)
+                                       res[i] = value[i] == GL_TRUE;
+
+                               state = QueriedState(res);
+                       }
+
+                       break;
+               }
+
+               case QUERY_INDEXED_INTEGER_VEC4:
+               {
+                       StateQueryMemoryWriteGuard<glw::GLint[4]> value;
+                       gl.glGetIntegeri_v(target, index, value);
+
+                       if (!checkError(result, gl, "glGetIntegeri_v"))
+                               return;
+
+                       if (!value.verifyValidity(result))
+                               return;
+
+                       state = QueriedState(value);
+                       break;
+               }
+
+               case QUERY_INDEXED_INTEGER64_VEC4:
+               {
+                       StateQueryMemoryWriteGuard<glw::GLint64[4]> value;
+                       gl.glGetInteger64i_v(target, index, value);
+
+                       if (!checkError(result, gl, "glGetInteger64i_v"))
+                               return;
+
+                       if (!value.verifyValidity(result))
+                               return;
+
+                       state = QueriedState(value);
+                       break;
+               }
+
+               case QUERY_INDEXED_ISENABLED:
+               {
+                       const glw::GLboolean value = gl.glIsEnabledi(target, index);
+
+                       if (!checkError(result, gl, "glIsEnabledi"))
+                               return;
+
+                       if (!verifyBooleanValidity(result, value))
+                               return;
+
+                       state = QueriedState(value == GL_TRUE);
+                       break;
+               }
+
                case QUERY_INDEXED_BOOLEAN:
                {
                        StateQueryMemoryWriteGuard<glw::GLboolean> value;
@@ -847,11 +978,6 @@ void querySamplerState (tcu::ResultCollector& result, glu::CallLogWrapper& gl, Q
 
 // verify
 
-static const char* getGLBooleanStr (bool v)
-{
-       return (v) ? ("GL_TRUE") : ("GL_FALSE");
-}
-
 void verifyBoolean (tcu::ResultCollector& result, QueriedState& state, bool expected)
 {
        switch (state.getType())
@@ -861,7 +987,7 @@ void verifyBoolean (tcu::ResultCollector& result, QueriedState& state, bool expe
                        if (state.getBoolAccess() != expected)
                        {
                                std::ostringstream buf;
-                               buf << "Expected " << getGLBooleanStr(expected) << ", got " << getGLBooleanStr(state.getBoolAccess());
+                               buf << "Expected " << glu::getBooleanStr(mapBoolToGLBoolean(expected)) << ", got " << glu::getBooleanStr(mapBoolToGLBoolean(state.getBoolAccess()));
                                result.fail(buf.str());
                        }
                        break;
@@ -919,7 +1045,7 @@ void verifyInteger (tcu::ResultCollector& result, QueriedState& state, int expec
                        if (state.getBoolAccess() != reference)
                        {
                                std::ostringstream buf;
-                               buf << "Expected " << getGLBooleanStr(reference) << ", got " << getGLBooleanStr(state.getBoolAccess());
+                               buf << "Expected " << glu::getBooleanStr(mapBoolToGLBoolean(reference)) << ", got " << glu::getBooleanStr(mapBoolToGLBoolean(state.getBoolAccess()));
                                result.fail(buf.str());
                        }
                        break;
@@ -1097,10 +1223,11 @@ void verifyFloat (tcu::ResultCollector& result, QueriedState& state, float expec
                case DATATYPE_BOOLEAN:
                {
                        const bool reference = (expected != 0.0f);
+
                        if (state.getBoolAccess() != reference)
                        {
                                std::ostringstream buf;
-                               buf << "Expected " << getGLBooleanStr(reference) << ", got " << getGLBooleanStr(state.getBoolAccess());
+                               buf << "Expected " << glu::getBooleanStr(mapBoolToGLBoolean(reference)) << ", got " << glu::getBooleanStr(mapBoolToGLBoolean(state.getBoolAccess()));
                                result.fail(buf.str());
                        }
                        break;
@@ -1362,6 +1489,132 @@ void verifyUnsignedIntegerVec4 (tcu::ResultCollector& result, QueriedState& stat
        }
 }
 
+void verifyBooleanVec4 (tcu::ResultCollector& result, QueriedState& state, const tcu::BVec4& expected)
+{
+       switch (state.getType())
+       {
+               case DATATYPE_BOOLEAN_VEC4:
+               {
+                       const glw::GLboolean referenceVec4[4] =
+                       {
+                               mapBoolToGLBoolean(expected[0]),
+                               mapBoolToGLBoolean(expected[1]),
+                               mapBoolToGLBoolean(expected[2]),
+                               mapBoolToGLBoolean(expected[3])
+                       };
+
+                       const glw::GLboolean resultVec4[4] =
+                       {
+                               mapBoolToGLBoolean(state.getBooleanVec4Access()[0]),
+                               mapBoolToGLBoolean(state.getBooleanVec4Access()[1]),
+                               mapBoolToGLBoolean(state.getBooleanVec4Access()[2]),
+                               mapBoolToGLBoolean(state.getBooleanVec4Access()[3])
+                       };
+
+                       if (resultVec4[0] != referenceVec4[0] ||
+                               resultVec4[1] != referenceVec4[1] ||
+                               resultVec4[2] != referenceVec4[2] ||
+                               resultVec4[3] != referenceVec4[3])
+                       {
+                               std::ostringstream buf;
+                               buf << "Expected " << glu::getBooleanPointerStr(referenceVec4, 4) << ", got " << glu::getBooleanPointerStr(resultVec4, 4);
+                               result.fail(buf.str());
+                       }
+
+                       break;
+               }
+               case DATATYPE_FLOAT_VEC4:
+               {
+                       const glw::GLfloat reference[4] =
+                       {
+                               (expected[0] ? 1.0f : 0.0f),
+                               (expected[1] ? 1.0f : 0.0f),
+                               (expected[2] ? 1.0f : 0.0f),
+                               (expected[3] ? 1.0f : 0.0f)
+                       };
+
+                       if (state.getFloatVec4Access()[0] != reference[0] ||
+                               state.getFloatVec4Access()[1] != reference[1] ||
+                               state.getFloatVec4Access()[2] != reference[2] ||
+                               state.getFloatVec4Access()[3] != reference[3])
+                       {
+                               std::ostringstream buf;
+                               buf << "Expected " << reference << ", got " << tcu::formatArray(state.getFloatVec4Access());
+                               result.fail(buf.str());
+                       }
+                       break;
+               }
+               case DATATYPE_INTEGER_VEC4:
+               {
+                       const glw::GLint reference[4] =
+                       {
+                               (expected[0] ? 1 : 0),
+                               (expected[1] ? 1 : 0),
+                               (expected[2] ? 1 : 0),
+                               (expected[3] ? 1 : 0)
+                       };
+
+                       if (state.getIntVec4Access()[0] != reference[0] ||
+                               state.getIntVec4Access()[1] != reference[1] ||
+                               state.getIntVec4Access()[2] != reference[2] ||
+                               state.getIntVec4Access()[3] != reference[3])
+                       {
+                               std::ostringstream buf;
+                               buf << "Expected " << reference << ", got " << tcu::formatArray(state.getIntVec4Access());
+                               result.fail(buf.str());
+                       }
+                       break;
+               }
+               case DATATYPE_INTEGER64_VEC4:
+               {
+                       const glw::GLint64 reference[4] =
+                       {
+                               (expected[0] ? 1 : 0),
+                               (expected[1] ? 1 : 0),
+                               (expected[2] ? 1 : 0),
+                               (expected[3] ? 1 : 0)
+                       };
+
+                       if (state.getInt64Vec4Access()[0] != reference[0] ||
+                               state.getInt64Vec4Access()[1] != reference[1] ||
+                               state.getInt64Vec4Access()[2] != reference[2] ||
+                               state.getInt64Vec4Access()[3] != reference[3])
+                       {
+                               std::ostringstream buf;
+                               buf << "Expected " << reference << ", got " << tcu::formatArray(state.getInt64Vec4Access());
+                               result.fail(buf.str());
+                       }
+                       break;
+               }
+               case DATATYPE_UNSIGNED_INTEGER_VEC4:
+               {
+                       const glw::GLuint reference[4] =
+                       {
+                               (expected[0] ? 1u : 0u),
+                               (expected[1] ? 1u : 0u),
+                               (expected[2] ? 1u : 0u),
+                               (expected[3] ? 1u : 0u)
+                       };
+
+                       if (state.getUintVec4Access()[0] != reference[0] ||
+                               state.getUintVec4Access()[1] != reference[1] ||
+                               state.getUintVec4Access()[2] != reference[2] ||
+                               state.getUintVec4Access()[3] != reference[3])
+                       {
+                               std::ostringstream buf;
+                               buf << "Expected " << reference << ", got " << tcu::formatArray(state.getUintVec4Access());
+                               result.fail(buf.str());
+                       }
+                       break;
+               }
+
+               default:
+                       DE_ASSERT(DE_FALSE);
+                       break;
+       }
+}
+
+
 void verifyFloatVec4 (tcu::ResultCollector& result, QueriedState& state, const tcu::Vec4& expected)
 {
        switch (state.getType())
@@ -1702,6 +1955,16 @@ void verifyStateIndexedBoolean (tcu::ResultCollector& result, glu::CallLogWrappe
                verifyBoolean(result, state, expected);
 }
 
+void verifyStateIndexedBooleanVec4 (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLenum target, int index, const tcu::BVec4& expected, QueryType type)
+{
+       QueriedState state;
+
+       queryIndexedState(result, gl, type, target, index, state);
+
+       if (!state.isUndefined())
+               verifyBooleanVec4(result, state, expected);
+}
+
 void verifyStateIndexedInteger (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLenum target, int index, int expected, QueryType type)
 {
        QueriedState state;
index 1cb7dca..cd34dbc 100644 (file)
@@ -243,8 +243,12 @@ enum QueryType
 
        // indexed
        QUERY_INDEXED_BOOLEAN,
+       QUERY_INDEXED_BOOLEAN_VEC4,
+       QUERY_INDEXED_ISENABLED,
        QUERY_INDEXED_INTEGER,
+       QUERY_INDEXED_INTEGER_VEC4,
        QUERY_INDEXED_INTEGER64,
+       QUERY_INDEXED_INTEGER64_VEC4,
 
        // attributes
        QUERY_ATTRIBUTE_INTEGER,
@@ -308,7 +312,9 @@ enum DataType
        DATATYPE_INTEGER_VEC3,
        DATATYPE_FLOAT_VEC4,
        DATATYPE_INTEGER_VEC4,
+       DATATYPE_INTEGER64_VEC4,
        DATATYPE_UNSIGNED_INTEGER_VEC4,
+       DATATYPE_BOOLEAN_VEC4,
        DATATYPE_POINTER,
 
        DATATYPE_LAST
@@ -321,32 +327,38 @@ public:
        typedef glw::GLint              GLIntVec4[4];
        typedef glw::GLuint             GLUintVec4[4];
        typedef glw::GLfloat    GLFloatVec4[4];
-
-                                                       QueriedState            (void);
-       explicit                                QueriedState            (glw::GLint);
-       explicit                                QueriedState            (glw::GLint64);
-       explicit                                QueriedState            (bool);
-       explicit                                QueriedState            (glw::GLfloat);
-       explicit                                QueriedState            (glw::GLuint);
-       explicit                                QueriedState            (const GLIntVec3&);
-       explicit                                QueriedState            (void*);
-       explicit                                QueriedState            (const GLIntVec4&);
-       explicit                                QueriedState            (const GLUintVec4&);
-       explicit                                QueriedState            (const GLFloatVec4&);
-
-       bool                                    isUndefined                     (void) const;
-       DataType                                getType                         (void) const;
-
-       glw::GLint&                             getIntAccess            (void);
-       glw::GLint64&                   getInt64Access          (void);
-       bool&                                   getBoolAccess           (void);
-       glw::GLfloat&                   getFloatAccess          (void);
-       glw::GLuint&                    getUintAccess           (void);
-       GLIntVec3&                              getIntVec3Access        (void);
-       void*&                                  getPtrAccess            (void);
-       GLIntVec4&                              getIntVec4Access        (void);
-       GLUintVec4&                             getUintVec4Access       (void);
-       GLFloatVec4&                    getFloatVec4Access      (void);
+       typedef bool                    BooleanVec4[4];
+       typedef glw::GLint64    GLInt64Vec4[4];
+
+                                                       QueriedState                    (void);
+       explicit                                QueriedState                    (glw::GLint);
+       explicit                                QueriedState                    (glw::GLint64);
+       explicit                                QueriedState                    (bool);
+       explicit                                QueriedState                    (glw::GLfloat);
+       explicit                                QueriedState                    (glw::GLuint);
+       explicit                                QueriedState                    (const GLIntVec3&);
+       explicit                                QueriedState                    (void*);
+       explicit                                QueriedState                    (const GLIntVec4&);
+       explicit                                QueriedState                    (const GLUintVec4&);
+       explicit                                QueriedState                    (const GLFloatVec4&);
+       explicit                                QueriedState                    (const BooleanVec4&);
+       explicit                                QueriedState                    (const GLInt64Vec4&);
+
+       bool                                    isUndefined                             (void) const;
+       DataType                                getType                                 (void) const;
+
+       glw::GLint&                             getIntAccess                    (void);
+       glw::GLint64&                   getInt64Access                  (void);
+       bool&                                   getBoolAccess                   (void);
+       glw::GLfloat&                   getFloatAccess                  (void);
+       glw::GLuint&                    getUintAccess                   (void);
+       GLIntVec3&                              getIntVec3Access                (void);
+       void*&                                  getPtrAccess                    (void);
+       GLIntVec4&                              getIntVec4Access                (void);
+       GLUintVec4&                             getUintVec4Access               (void);
+       GLFloatVec4&                    getFloatVec4Access              (void);
+       BooleanVec4&                    getBooleanVec4Access    (void);
+       GLInt64Vec4&                    getInt64Vec4Access              (void);
 
 private:
        DataType                                m_type;
@@ -362,6 +374,8 @@ private:
                GLIntVec4                       vIntVec4;
                GLUintVec4                      vUintVec4;
                GLFloatVec4                     vFloatVec4;
+               BooleanVec4                     vBooleanVec4;
+               GLInt64Vec4                     vInt64Vec4;
        } m_v;
 };
 
@@ -394,6 +408,7 @@ void verifyIntegerVec3                                                      (tcu::ResultCollector& result, QueriedState& state,
 void verifyIntegerVec4                                                 (tcu::ResultCollector& result, QueriedState& state, const tcu::IVec4& expected);
 void verifyUnsignedIntegerVec4                                 (tcu::ResultCollector& result, QueriedState& state, const tcu::UVec4& expected);
 void verifyFloatVec4                                                   (tcu::ResultCollector& result, QueriedState& state, const tcu::Vec4& expected);
+void verifyBooleanVec4                                                 (tcu::ResultCollector& result, QueriedState& state, const tcu::BVec4& expected);
 void verifyPointer                                                             (tcu::ResultCollector& result, QueriedState& state, const void* expected);
 void verifyNormalizedI32Vec4                                   (tcu::ResultCollector& result, QueriedState& state, const tcu::IVec4& expected);
 
@@ -409,6 +424,7 @@ void verifyStateFloatMin                                            (tcu::ResultCollector& result, glu::CallLogWrapper
 void verifyStateFloatMax                                               (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLenum target,             float maxValue,                 QueryType type);
 void verifyStatePointer                                                        (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLenum target,             const void* expected,   QueryType type);
 void verifyStateIndexedBoolean                                 (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLenum target,             int index,                              bool expected,                          QueryType type);
+void verifyStateIndexedBooleanVec4                             (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLenum target,             int index,                              const tcu::BVec4& expected,     QueryType type);
 void verifyStateIndexedInteger                                 (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLenum target,             int index,                              int expected,                           QueryType type);
 void verifyStateIndexedIntegerMin                              (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLenum target,             int index,                              int minValue,                           QueryType type);
 void verifyStateAttributeInteger                               (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLenum target,             int index,                              int expected,                           QueryType type);