+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;
+}
+