Enable tests for EXT_shader_group_vote
authorPiotr Byszewski <piotr.byszewski@mobica.com>
Mon, 24 Jul 2017 12:48:21 +0000 (14:48 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Mon, 11 Sep 2017 09:51:57 +0000 (05:51 -0400)
ShaderGroupVoteTests were generalized so that thay can
test ARB_shader_group_vote for GL core and
EXT_shader_group_vote for ES.

Components: OpenGL

VK-GL-CTS issue: 383

Affects:
KHR-GL45.shader_group_vote.*
KHR-GLES31.core.shader_group_vote.*

Change-Id: I3822cd386e522ceb9f8609544828e2febc257770

external/openglcts/data/mustpass/gl/khronos_mustpass/4.6.0.x/gl45-master.txt
external/openglcts/data/mustpass/gl/khronos_mustpass/4.6.0.x/gl46-master.txt
external/openglcts/data/mustpass/gles/khronos_mustpass/3.2.4.x/gles31-khr-master.txt
external/openglcts/data/mustpass/gles/khronos_mustpass/master/gles31-khr-master.txt
external/openglcts/modules/common/CMakeLists.txt
external/openglcts/modules/common/glcShaderGroupVoteTests.cpp [moved from external/openglcts/modules/gl/gl4cShaderGroupVoteTests.cpp with 54% similarity]
external/openglcts/modules/common/glcShaderGroupVoteTests.hpp [moved from external/openglcts/modules/gl/gl4cShaderGroupVoteTests.hpp with 77% similarity]
external/openglcts/modules/gl/CMakeLists.txt
external/openglcts/modules/gl/gl4cTestPackages.cpp
external/openglcts/modules/gles31/es31cTestPackage.cpp

index 7e8f3d2..18a7e3a 100644 (file)
@@ -7060,10 +7060,6 @@ KHR-GL45.shader_atomic_counter_ops_tests.ShaderAtomicCounterOpsAdditionSubstract
 KHR-GL45.shader_atomic_counter_ops_tests.ShaderAtomicCounterOpsMinMaxTestCase
 KHR-GL45.shader_atomic_counter_ops_tests.ShaderAtomicCounterOpsBitwiseTestCase
 KHR-GL45.shader_atomic_counter_ops_tests.ShaderAtomicCounterOpsExchangeTestCase
-KHR-GL45.shader_group_vote_tests.ShaderGroupVoteAvailabilityTestCase
-KHR-GL45.shader_group_vote_tests.ShaderGroupVoteAllInvocationsTestCase
-KHR-GL45.shader_group_vote_tests.ShaderGroupVoteAnyInvocationTestCase
-KHR-GL45.shader_group_vote_tests.ShaderGroupVoteAllInvocationsEqualTestCase
 KHR-GL45.shader_draw_parameters_tests.ShaderDrawParametersExtension
 KHR-GL45.shader_draw_parameters_tests.ShaderDrawArraysParameters
 KHR-GL45.shader_draw_parameters_tests.ShaderDrawElementsParameters
@@ -7220,6 +7216,10 @@ KHR-GL45.limits.min_fragment_interpolation_offset
 KHR-GL45.limits.max_fragment_interpolation_offset
 KHR-GL45.limits.max_compute_work_group_count
 KHR-GL45.limits.max_compute_work_group_size
+KHR-GL45.shader_group_vote.availability
+KHR-GL45.shader_group_vote.all_invocations
+KHR-GL45.shader_group_vote.any_invocation
+KHR-GL45.shader_group_vote.all_invocations_equal
 KHR-GL45.polygon_offset_clamp.PolygonOffsetClampAvailability
 KHR-GL45.polygon_offset_clamp.PolygonOffsetClampMinMax
 KHR-GL45.polygon_offset_clamp.PolygonOffsetClampZeroInfinity
index c3000eb..446572a 100644 (file)
@@ -7060,10 +7060,6 @@ KHR-GL46.shader_atomic_counter_ops_tests.ShaderAtomicCounterOpsAdditionSubstract
 KHR-GL46.shader_atomic_counter_ops_tests.ShaderAtomicCounterOpsMinMaxTestCase
 KHR-GL46.shader_atomic_counter_ops_tests.ShaderAtomicCounterOpsBitwiseTestCase
 KHR-GL46.shader_atomic_counter_ops_tests.ShaderAtomicCounterOpsExchangeTestCase
-KHR-GL46.shader_group_vote_tests.ShaderGroupVoteAvailabilityTestCase
-KHR-GL46.shader_group_vote_tests.ShaderGroupVoteAllInvocationsTestCase
-KHR-GL46.shader_group_vote_tests.ShaderGroupVoteAnyInvocationTestCase
-KHR-GL46.shader_group_vote_tests.ShaderGroupVoteAllInvocationsEqualTestCase
 KHR-GL46.shader_draw_parameters_tests.ShaderDrawParametersExtension
 KHR-GL46.shader_draw_parameters_tests.ShaderDrawArraysParameters
 KHR-GL46.shader_draw_parameters_tests.ShaderDrawElementsParameters
@@ -7220,6 +7216,10 @@ KHR-GL46.limits.min_fragment_interpolation_offset
 KHR-GL46.limits.max_fragment_interpolation_offset
 KHR-GL46.limits.max_compute_work_group_count
 KHR-GL46.limits.max_compute_work_group_size
+KHR-GL46.shader_group_vote.availability
+KHR-GL46.shader_group_vote.all_invocations
+KHR-GL46.shader_group_vote.any_invocation
+KHR-GL46.shader_group_vote.all_invocations_equal
 KHR-GL46.polygon_offset_clamp.PolygonOffsetClampAvailability
 KHR-GL46.polygon_offset_clamp.PolygonOffsetClampMinMax
 KHR-GL46.polygon_offset_clamp.PolygonOffsetClampZeroInfinity
index 7109665..583d2a7 100644 (file)
@@ -2248,6 +2248,10 @@ KHR-GLES31.core.arrays_of_arrays.InteractionInterfaceArrays4
 KHR-GLES31.core.polygon_offset_clamp.PolygonOffsetClampAvailability
 KHR-GLES31.core.polygon_offset_clamp.PolygonOffsetClampMinMax
 KHR-GLES31.core.polygon_offset_clamp.PolygonOffsetClampZeroInfinity
+KHR-GLES31.core.shader_group_vote.availability
+KHR-GLES31.core.shader_group_vote.all_invocations
+KHR-GLES31.core.shader_group_vote.any_invocation
+KHR-GLES31.core.shader_group_vote.all_invocations_equal
 KHR-GLES31.core.geometry_shader.adjacency.adjacency_non_indiced_lines
 KHR-GLES31.core.geometry_shader.adjacency.adjacency_indiced_lines
 KHR-GLES31.core.geometry_shader.adjacency.adjacency_non_indiced_line_strip
index 7109665..583d2a7 100644 (file)
@@ -2248,6 +2248,10 @@ KHR-GLES31.core.arrays_of_arrays.InteractionInterfaceArrays4
 KHR-GLES31.core.polygon_offset_clamp.PolygonOffsetClampAvailability
 KHR-GLES31.core.polygon_offset_clamp.PolygonOffsetClampMinMax
 KHR-GLES31.core.polygon_offset_clamp.PolygonOffsetClampZeroInfinity
+KHR-GLES31.core.shader_group_vote.availability
+KHR-GLES31.core.shader_group_vote.all_invocations
+KHR-GLES31.core.shader_group_vote.any_invocation
+KHR-GLES31.core.shader_group_vote.all_invocations_equal
 KHR-GLES31.core.geometry_shader.adjacency.adjacency_non_indiced_lines
 KHR-GLES31.core.geometry_shader.adjacency.adjacency_indiced_lines
 KHR-GLES31.core.geometry_shader.adjacency.adjacency_non_indiced_line_strip
index d703ddb..daee52c 100644 (file)
@@ -46,6 +46,8 @@ set(GLCTS_COMMON_SRCS
        glcSeparableProgramsTransformFeedbackTests.hpp
        glcShaderConstExprTests.hpp
        glcShaderConstExprTests.cpp
+       glcShaderGroupVoteTests.cpp
+       glcShaderGroupVoteTests.hpp
        glcShaderIndexingTests.cpp
        glcShaderIndexingTests.hpp
        glcShaderIntegerMixTests.cpp
 * limitations under the License.
 *
 */ /*!
-* \file  gl4cShaderGroupVoteTests.cpp
+* \file  glcShaderGroupVoteTests.cpp
 * \brief Conformance tests for the ARB_shader_group_vote functionality.
 */ /*-------------------------------------------------------------------*/
 
-#include "gl4cShaderGroupVoteTests.hpp"
+#include "glcShaderGroupVoteTests.hpp"
 #include "gluContextInfo.hpp"
 #include "gluDefs.hpp"
 #include "gluDrawUtil.hpp"
 #include "glwEnums.hpp"
 #include "glwFunctions.hpp"
 #include "tcuRenderTarget.hpp"
+#include "tcuTestLog.hpp"
 
 using namespace glw;
 
-namespace gl4cts
+namespace glcts
 {
 
+enum TextureSize
+{
+       RENDER_WIDTH  = 16,
+       RENDER_HEIGHT = 16
+};
+
 ShaderGroupVoteTestCaseBase::ComputeShader::ComputeShader(const std::string& name, const std::string& shader)
        : m_name(name), m_shader(shader), m_program(NULL), m_compileOnly(true)
 {
 }
 
 ShaderGroupVoteTestCaseBase::ComputeShader::ComputeShader(const std::string& name, const std::string& shader,
-                                                                                                                 const tcu::Vec4& desiredColor)
+                                                                                                                 const tcu::IVec4& desiredColor)
        : m_name(name), m_shader(shader), m_program(NULL), m_desiredColor(desiredColor), m_compileOnly(false)
 {
 }
@@ -63,6 +70,9 @@ void ShaderGroupVoteTestCaseBase::ComputeShader::create(deqp::Context& context)
 
        if (!m_program->isOk())
        {
+               context.getTestContext().getLog()
+                       << tcu::TestLog::Message << m_shader << m_program->getShaderInfo(glu::SHADERTYPE_COMPUTE).infoLog
+                       << m_program->getProgramInfo().infoLog << tcu::TestLog::EndMessage;
                TCU_FAIL("Shader compilation failed");
        }
 }
@@ -85,38 +95,43 @@ void ShaderGroupVoteTestCaseBase::ComputeShader::execute(deqp::Context& context)
 
        // output image
        gl.bindTexture(GL_TEXTURE_2D, *outputTexture);
-       gl.texStorage2D(GL_TEXTURE_2D, 1, GL_RGBA32UI, 16, 16);
+       gl.texStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, RENDER_WIDTH, RENDER_HEIGHT);
        gl.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
        gl.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
        GLU_EXPECT_NO_ERROR(gl.getError(), "Uploading image data failed");
 
        // bind image
-       gl.bindImageTexture(2, *outputTexture, 0, GL_FALSE, 0, GL_READ_WRITE, GL_RGBA32UI);
+       gl.bindImageTexture(2, *outputTexture, 0, GL_FALSE, 0, GL_READ_WRITE, GL_RGBA8);
        GLU_EXPECT_NO_ERROR(gl.getError(), "bindImageTexture failed");
 
        // dispatch compute
        gl.dispatchCompute(1, 1, 1);
        GLU_EXPECT_NO_ERROR(gl.getError(), "dispatchCompute failed");
 
+       glu::GLSLVersion glslVersion            = glu::getContextTypeGLSLVersion(context.getRenderContext().getType());
+       const char*              versionDeclaration = glu::getGLSLVersionDeclaration(glslVersion);
+
        // render output texture
-       std::string vs = "#version 450 core\n"
-                                        "in highp vec2 position;\n"
-                                        "in vec2 inTexcoord;\n"
-                                        "out vec2 texcoord;\n"
-                                        "void main()\n"
-                                        "{\n"
-                                        "      texcoord = inTexcoord;\n"
-                                        "      gl_Position = vec4(position, 0.0, 1.0);\n"
-                                        "}\n";
-
-       std::string fs = "#version 450 core\n"
-                                        "uniform sampler2D sampler;\n"
-                                        "in vec2 texcoord;\n"
-                                        "out vec4 color;\n"
-                                        "void main()\n"
-                                        "{\n"
-                                        "      color = texture(sampler, texcoord);\n"
-                                        "}\n";
+       std::string vs = versionDeclaration;
+       vs += "\n"
+                 "in highp vec2 position;\n"
+                 "in highp vec2 inTexcoord;\n"
+                 "out highp vec2 texcoord;\n"
+                 "void main()\n"
+                 "{\n"
+                 "     texcoord = inTexcoord;\n"
+                 "     gl_Position = vec4(position, 0.0, 1.0);\n"
+                 "}\n";
+
+       std::string fs = versionDeclaration;
+       fs += "\n"
+                 "uniform highp sampler2D sampler;\n"
+                 "in highp vec2 texcoord;\n"
+                 "out highp vec4 color;\n"
+                 "void main()\n"
+                 "{\n"
+                 "     color = texture(sampler, texcoord);\n"
+                 "}\n";
 
        glu::ProgramSources sources;
        sources.sources[glu::SHADERTYPE_VERTEX].push_back(vs);
@@ -150,6 +165,7 @@ void ShaderGroupVoteTestCaseBase::ComputeShader::execute(deqp::Context& context)
        glu::VertexArrayBinding vertexArrays[] = { glu::va::Float("position", 2, 4, 0, position),
                                                                                           glu::va::Float("inTexcoord", 2, 4, 0, texCoord) };
 
+       gl.viewport(0, 0, RENDER_WIDTH, RENDER_HEIGHT);
        glu::draw(context.getRenderContext(), renderShader.getProgram(), DE_LENGTH_OF_ARRAY(vertexArrays), vertexArrays,
                          glu::pr::TriangleStrip(DE_LENGTH_OF_ARRAY(quadIndices), quadIndices));
 
@@ -171,61 +187,24 @@ void ShaderGroupVoteTestCaseBase::ComputeShader::validate(deqp::Context& context
        TCU_CHECK_MSG(validationResult, validationErrorMsg.c_str());
 }
 
-bool ShaderGroupVoteTestCaseBase::ComputeShader::validateColor(tcu::Vec4 testedColor, tcu::Vec4 desiredColor)
+bool ShaderGroupVoteTestCaseBase::ComputeShader::validateScreenPixels(deqp::Context& context, tcu::IVec4 desiredColor)
 {
-       const float epsilon = 0.008f;
-       return de::abs(testedColor.x() - desiredColor.x()) < epsilon &&
-                  de::abs(testedColor.y() - desiredColor.y()) < epsilon &&
-                  de::abs(testedColor.z() - desiredColor.z()) < epsilon;
-}
-
-bool ShaderGroupVoteTestCaseBase::ComputeShader::validateScreenPixels(deqp::Context& context, tcu::Vec4 desiredColor)
-{
-       const glw::Functions&   gl                       = context.getRenderContext().getFunctions();
-       const tcu::RenderTarget renderTarget = context.getRenderContext().getRenderTarget();
-       tcu::IVec2                              size(renderTarget.getWidth(), renderTarget.getHeight());
-
-       glw::GLfloat* pixels = new glw::GLfloat[size.x() * size.y() * 4];
-
-       // clear buffer
-       for (int x = 0; x < size.x(); ++x)
-       {
-               for (int y = 0; y < size.y(); ++y)
-               {
-                       int mappedPixelPosition = y * size.x() + x;
-
-                       pixels[mappedPixelPosition * 4 + 0] = -1.0f;
-                       pixels[mappedPixelPosition * 4 + 1] = -1.0f;
-                       pixels[mappedPixelPosition * 4 + 2] = -1.0f;
-                       pixels[mappedPixelPosition * 4 + 3] = -1.0f;
-               }
-       }
+       const glw::Functions&    gl             = context.getRenderContext().getFunctions();
+       std::size_t                               totalSize = RENDER_WIDTH * RENDER_HEIGHT * 4;
+       std::vector<glw::GLubyte> pixels(totalSize, 128);
 
        // read pixels
-       gl.readPixels(0, 0, size.x(), size.y(), GL_RGBA, GL_FLOAT, pixels);
+       gl.readPixels(0, 0, RENDER_WIDTH, RENDER_HEIGHT, GL_RGBA, GL_UNSIGNED_BYTE, &pixels[0]);
 
-       // validate pixels
-       bool validationResult = true;
-
-       for (int x = 0; x < size.x(); ++x)
+       // compare pixels to desired color
+       for (std::size_t i = 0; i < totalSize; i += 4)
        {
-               for (int y = 0; y < size.y(); ++y)
-               {
-                       int mappedPixelPosition = y * size.x() + x;
-
-                       tcu::Vec4 color(pixels[mappedPixelPosition * 4 + 0], pixels[mappedPixelPosition * 4 + 1],
-                                                       pixels[mappedPixelPosition * 4 + 2], pixels[mappedPixelPosition * 4 + 3]);
-
-                       if (!validateColor(color, desiredColor))
-                       {
-                               validationResult = false;
-                       }
-               }
+               if ((pixels[i + 0] != desiredColor.x()) || (pixels[i + 1] != desiredColor.y()) ||
+                       (pixels[i + 2] != desiredColor.z()))
+                       return false;
        }
 
-       delete[] pixels;
-
-       return validationResult;
+       return true;
 }
 
 /** Constructor.
@@ -234,33 +213,29 @@ bool ShaderGroupVoteTestCaseBase::ComputeShader::validateScreenPixels(deqp::Cont
 *  @param name Test name
 *  @param description Test description
 */
-ShaderGroupVoteTestCaseBase::ShaderGroupVoteTestCaseBase(deqp::Context& context, const char* name,
-                                                                                                                const char* description)
+ShaderGroupVoteTestCaseBase::ShaderGroupVoteTestCaseBase(deqp::Context& context, ExtParameters& extParam,
+                                                                                                                const char* name, const char* description)
        : TestCaseBase(context, glcts::ExtParameters(glu::GLSL_VERSION_450, glcts::EXTENSIONTYPE_EXT), name, description)
-       , m_glslFunctionPostfix("")
-
+       , m_extensionSupported(true)
 {
-       glu::ContextType contextType             = m_context.getRenderContext().getType();
-       bool                     contextSupportsGL46 = glu::contextSupports(contextType, glu::ApiType::core(4, 6));
-       m_extensionSupported =
-               contextSupportsGL46 || context.getContextInfo().isExtensionSupported("GL_ARB_shader_group_vote");
+       glu::ContextType contextType   = m_context.getRenderContext().getType();
+       m_specializationMap["VERSION"] = glu::getGLSLVersionDeclaration(extParam.glslVersion);
 
-       if (contextSupportsGL46)
+       if (glu::contextSupports(contextType, glu::ApiType::core(4, 6)))
        {
-               m_specializationMap["VERSION"]                                    = "#version 460 core";
-               m_specializationMap["GROUP_VOTE_EXTENSION"]               = "";
-               m_specializationMap["ALL_INVOCATIONS_FUNC"]               = "allInvocations";
-               m_specializationMap["ANY_INVOCATION_FUNC"]                = "anyInvocation";
-               m_specializationMap["ALL_INVOCATIONS_EQUAL_FUNC"] = "allInvocationsEqual";
+               m_specializationMap["GROUP_VOTE_EXTENSION"] = "";
+               m_specializationMap["EXT_TYPE"]                         = "";
        }
        else
        {
-               m_specializationMap["VERSION"]                                    = "#version 450 core";
-               m_specializationMap["GROUP_VOTE_EXTENSION"]               = "#extension GL_ARB_shader_group_vote : enable";
-               m_specializationMap["ALL_INVOCATIONS_FUNC"]               = "allInvocationsARB";
-               m_specializationMap["ANY_INVOCATION_FUNC"]                = "anyInvocationARB";
-               m_specializationMap["ALL_INVOCATIONS_EQUAL_FUNC"] = "allInvocationsEqualARB";
-               m_glslFunctionPostfix                                                     = "ARB";
+               bool            isCoreGL          = glu::isContextTypeGLCore(contextType);
+               std::string extensionName = isCoreGL ? "GL_ARB_shader_group_vote" : "GL_EXT_shader_group_vote";
+               m_extensionSupported      = context.getContextInfo().isExtensionSupported(extensionName.c_str());
+               std::stringstream extensionString;
+               extensionString << "#extension " + extensionName + " : enable";
+
+               m_specializationMap["GROUP_VOTE_EXTENSION"] = extensionString.str();
+               m_specializationMap["EXT_TYPE"]                         = isCoreGL ? "ARB" : "EXT";
        }
 }
 
@@ -305,23 +280,24 @@ tcu::TestNode::IterateResult ShaderGroupVoteTestCaseBase::iterate()
 *
 *  @param context Rendering context
 */
-ShaderGroupVoteAvailabilityTestCase::ShaderGroupVoteAvailabilityTestCase(deqp::Context& context)
-       : ShaderGroupVoteTestCaseBase(context, "ShaderGroupVoteAvailabilityTestCase", "Implements ...")
+ShaderGroupVoteAvailabilityTestCase::ShaderGroupVoteAvailabilityTestCase(deqp::Context& context,
+                                                                                                                                                ExtParameters& extParam)
+       : ShaderGroupVoteTestCaseBase(context, extParam, "availability", "Implements ...")
 {
        const char* shader = "${VERSION}\n"
                                                 "${GROUP_VOTE_EXTENSION}\n"
-                                                "layout(rgba32f, binding = 2) writeonly uniform highp image2D destImage;\n"
+                                                "layout(rgba8, binding = 2) writeonly uniform highp image2D destImage;\n"
                                                 "layout(local_size_x = 16, local_size_y = 16) in;\n"
                                                 "void main (void)\n"
                                                 "{\n"
                                                 "      vec4 outColor = vec4(0.0);\n"
-                                                "      outColor.r = ${ALL_INVOCATIONS_FUNC}(true) ? 1.0 : 0.0;\n"
-                                                "      outColor.g = ${ANY_INVOCATION_FUNC}(true) ? 1.0 : 0.0;\n"
-                                                "      outColor.b = ${ALL_INVOCATIONS_EQUAL_FUNC}(true) ? 1.0 : 0.0;\n"
+                                                "      outColor.r = allInvocations${EXT_TYPE}(true) ? 1.0 : 0.0;\n"
+                                                "      outColor.g = anyInvocation${EXT_TYPE}(true) ? 1.0 : 0.0;\n"
+                                                "      outColor.b = allInvocationsEqual${EXT_TYPE}(true) ? 1.0 : 0.0;\n"
                                                 "      imageStore(destImage, ivec2(gl_GlobalInvocationID.xy), outColor);\n"
                                                 "}\n";
-       std::string cs = specializeShader(1, &shader);
-       m_shaders.push_back(new ComputeShader("availability", cs));
+
+       m_shaders.push_back(new ComputeShader("availability", specializeShader(1, &shader)));
 }
 
 /** Constructor.
@@ -330,60 +306,73 @@ ShaderGroupVoteAvailabilityTestCase::ShaderGroupVoteAvailabilityTestCase(deqp::C
 *  @param name Test name
 *  @param description Test description
 */
-ShaderGroupVoteFunctionTestCaseBase::ShaderGroupVoteFunctionTestCaseBase(deqp::Context& context, const char* name,
+ShaderGroupVoteFunctionTestCaseBase::ShaderGroupVoteFunctionTestCaseBase(deqp::Context& context,
+                                                                                                                                                ExtParameters& extParam, const char* name,
                                                                                                                                                 const char* description)
-       : ShaderGroupVoteTestCaseBase(context, name, description)
+       : ShaderGroupVoteTestCaseBase(context, extParam, name, description)
 {
-       m_shaderBase = "${VERSION}\n"
-                                  "${GROUP_VOTE_EXTENSION}\n"
-                                  "layout(rgba32f, binding = 2) writeonly uniform highp image2D destImage;\n"
-                                  "layout(local_size_x = 16, local_size_y = 16) in;\n"
-                                  "void main (void)\n"
-                                  "{\n"
-                                  "    bool result = ${FUNC_RESULT};\n"
-                                  "    vec4 outColor = vec4(vec3(result ? 1.0 : 0.0), 1.0);\n"
-                                  "    imageStore(destImage, ivec2(gl_GlobalInvocationID.xy), outColor);\n"
-                                  "}\n";
+       m_shaderBase += "${VERSION}\n"
+                                       "${GROUP_VOTE_EXTENSION}\n"
+                                       "layout(rgba8, binding = 2) writeonly uniform highp image2D destImage;\n"
+                                       "layout(local_size_x = 16, local_size_y = 16) in;\n"
+                                       "void main (void)\n"
+                                       "{\n"
+                                       "       bool result = ${FUNC}${EXT_TYPE}(${FUNC_PARAMETER});\n"
+                                       "       vec4 outColor = vec4(vec3(result ? 1.0 : 0.0), 1.0);\n"
+                                       "       imageStore(destImage, ivec2(gl_GlobalInvocationID.xy), outColor);\n"
+                                       "}\n";
 }
 
 /** Constructor.
 *
 *  @param context Rendering context
 */
-ShaderGroupVoteAllInvocationsTestCase::ShaderGroupVoteAllInvocationsTestCase(deqp::Context& context)
-       : ShaderGroupVoteFunctionTestCaseBase(context, "ShaderGroupVoteAllInvocationsTestCase", "Implements ...")
+ShaderGroupVoteAllInvocationsTestCase::ShaderGroupVoteAllInvocationsTestCase(deqp::Context& context,
+                                                                                                                                                        ExtParameters& extParam)
+       : ShaderGroupVoteFunctionTestCaseBase(context, extParam, "all_invocations", "Implements ...")
 {
-       m_specializationMap["FUNC_RESULT"] = "allInvocations" + m_glslFunctionPostfix + "(true)";
+       const char* shaderBase                            = m_shaderBase.c_str();
+       m_specializationMap["FUNC"]                       = "allInvocations";
+       m_specializationMap["FUNC_PARAMETER"] = "true";
+
        m_shaders.push_back(
-               new ComputeShader("allInvocationsARB", specializeShader(1, &m_shaderBase), tcu::Vec4(1.0f, 1.0f, 1.0f, 1.0f)));
+               new ComputeShader("allInvocationsARB", specializeShader(1, &shaderBase), tcu::IVec4(255, 255, 255, 255)));
 }
 
 /** Constructor.
 *
 *  @param context Rendering context
 */
-ShaderGroupVoteAnyInvocationTestCase::ShaderGroupVoteAnyInvocationTestCase(deqp::Context& context)
-       : ShaderGroupVoteFunctionTestCaseBase(context, "ShaderGroupVoteAnyInvocationTestCase", "Implements ...")
+ShaderGroupVoteAnyInvocationTestCase::ShaderGroupVoteAnyInvocationTestCase(deqp::Context& context,
+                                                                                                                                                  ExtParameters& extParam)
+       : ShaderGroupVoteFunctionTestCaseBase(context, extParam, "any_invocation", "Implements ...")
 {
-       m_specializationMap["FUNC_RESULT"] = "anyInvocation" + m_glslFunctionPostfix + "(false)";
+       const char* shaderBase                            = m_shaderBase.c_str();
+       m_specializationMap["FUNC"]                       = "anyInvocation";
+       m_specializationMap["FUNC_PARAMETER"] = "false";
+
        m_shaders.push_back(
-               new ComputeShader("anyInvocationARB", specializeShader(1, &m_shaderBase), tcu::Vec4(0.0f, 0.0f, 0.0f, 1.0f)));
+               new ComputeShader("anyInvocationARB", specializeShader(1, &shaderBase), tcu::IVec4(0, 0, 0, 255)));
 }
 
 /** Constructor.
 *
 *  @param context Rendering context
 */
-ShaderGroupVoteAllInvocationsEqualTestCase::ShaderGroupVoteAllInvocationsEqualTestCase(deqp::Context& context)
-       : ShaderGroupVoteFunctionTestCaseBase(context, "ShaderGroupVoteAllInvocationsEqualTestCase", "Implements ...")
+ShaderGroupVoteAllInvocationsEqualTestCase::ShaderGroupVoteAllInvocationsEqualTestCase(deqp::Context& context,
+                                                                                                                                                                          ExtParameters& extParam)
+       : ShaderGroupVoteFunctionTestCaseBase(context, extParam, "all_invocations_equal", "Implements ...")
 {
-       m_specializationMap["FUNC_RESULT"] = "allInvocationsEqual" + m_glslFunctionPostfix + "(true)";
-       m_shaders.push_back(new ComputeShader("allInvocationsEqual", specializeShader(1, &m_shaderBase),
-                                                                                 tcu::Vec4(1.0f, 1.0f, 1.0f, 1.0f)));
+       const char* shaderBase                            = m_shaderBase.c_str();
+       m_specializationMap["FUNC"]                       = "allInvocationsEqual";
+       m_specializationMap["FUNC_PARAMETER"] = "true";
+       m_shaders.push_back(
+               new ComputeShader("allInvocationsEqualARB", specializeShader(1, &shaderBase), tcu::IVec4(255, 255, 255, 255)));
 
-       m_specializationMap["FUNC_RESULT"] = "allInvocationsEqual" + m_glslFunctionPostfix + "(false)";
-       m_shaders.push_back(new ComputeShader("allInvocationsEqual", specializeShader(1, &m_shaderBase),
-                                                                                 tcu::Vec4(1.0f, 1.0f, 1.0f, 1.0f)));
+       m_specializationMap["FUNC"]                       = "allInvocationsEqual";
+       m_specializationMap["FUNC_PARAMETER"] = "false";
+       m_shaders.push_back(
+               new ComputeShader("allInvocationsEqualARB", specializeShader(1, &shaderBase), tcu::IVec4(255, 255, 255, 255)));
 }
 
 /** Constructor.
@@ -391,17 +380,20 @@ ShaderGroupVoteAllInvocationsEqualTestCase::ShaderGroupVoteAllInvocationsEqualTe
 *  @param context Rendering context.
 */
 ShaderGroupVote::ShaderGroupVote(deqp::Context& context)
-       : TestCaseGroup(context, "shader_group_vote_tests",
-                                       "Verify conformance of CTS_ARB_shader_group_vote implementation")
+       : TestCaseGroup(context, "shader_group_vote",
+                                       "Verify conformance of shader_group_vote functionality implementation")
 {
 }
 
 /** Initializes the test group contents. */
 void ShaderGroupVote::init()
 {
-       addChild(new ShaderGroupVoteAvailabilityTestCase(m_context));
-       addChild(new ShaderGroupVoteAllInvocationsTestCase(m_context));
-       addChild(new ShaderGroupVoteAnyInvocationTestCase(m_context));
-       addChild(new ShaderGroupVoteAllInvocationsEqualTestCase(m_context));
+       glu::GLSLVersion glslVersion = getContextTypeGLSLVersion(m_context.getRenderContext().getType());
+       ExtParameters   extParam        = glcts::ExtParameters(glslVersion, glcts::EXTENSIONTYPE_EXT);
+
+       addChild(new ShaderGroupVoteAvailabilityTestCase(m_context, extParam));
+       addChild(new ShaderGroupVoteAllInvocationsTestCase(m_context, extParam));
+       addChild(new ShaderGroupVoteAnyInvocationTestCase(m_context, extParam));
+       addChild(new ShaderGroupVoteAllInvocationsEqualTestCase(m_context, extParam));
 }
-} /* gl4cts namespace */
+} /* glcts namespace */
@@ -1,5 +1,5 @@
-#ifndef _GL4CSHADERGROUPVOTETESTS_HPP
-#define _GL4CSHADERGROUPVOTETESTS_HPP
+#ifndef _GLCSHADERGROUPVOTETESTS_HPP
+#define _GLCSHADERGROUPVOTETESTS_HPP
 /*-------------------------------------------------------------------------
 * OpenGL Conformance Test Suite
 * -----------------------------
@@ -19,7 +19,7 @@
 * limitations under the License.
 *
 */ /*!
-* \file  gl4cShaderGroupVoteTests.hpp
+* \file  glcShaderGroupVoteTests.hpp
 * \brief Conformance tests for the ARB_shader_group_vote functionality.
 */ /*-------------------------------------------------------------------*/
 
@@ -29,7 +29,7 @@
 
 #include <string>
 
-namespace gl4cts
+namespace glcts
 {
 class ShaderGroupVoteTestCaseBase : public glcts::TestCaseBase
 {
@@ -41,17 +41,16 @@ public:
                std::string                     m_name;
                std::string                     m_shader;
                glu::ShaderProgram* m_program;
-               tcu::Vec4                       m_desiredColor;
+               tcu::IVec4                      m_desiredColor;
                bool                            m_compileOnly;
 
                /* Private methods */
-               bool validateColor(tcu::Vec4 testedColor, tcu::Vec4 desiredColor);
-               bool validateScreenPixels(deqp::Context& context, tcu::Vec4 desiredColor);
+               bool validateScreenPixels(deqp::Context& context, tcu::IVec4 desiredColor);
 
        public:
                /* Public methods */
                ComputeShader(const std::string& name, const std::string& shader);
-               ComputeShader(const std::string& name, const std::string& shader, const tcu::Vec4& desiredColor);
+               ComputeShader(const std::string& name, const std::string& shader, const tcu::IVec4& desiredColor);
                ~ComputeShader();
 
                void create(deqp::Context& context);
@@ -60,7 +59,8 @@ public:
        };
 
        /* Public methods */
-       ShaderGroupVoteTestCaseBase(deqp::Context& context, const char* name, const char* description);
+       ShaderGroupVoteTestCaseBase(deqp::Context& context, ExtParameters& extParam, const char* name,
+                                                               const char* description);
 
        void init();
        void deinit();
@@ -72,7 +72,6 @@ public:
 protected:
        /* Protected members */
        bool                                            m_extensionSupported;
-       std::string                                     m_glslFunctionPostfix;
        std::vector<ComputeShader*> m_shaders;
 };
 
@@ -82,18 +81,19 @@ class ShaderGroupVoteAvailabilityTestCase : public ShaderGroupVoteTestCaseBase
 {
 public:
        /* Public methods */
-       ShaderGroupVoteAvailabilityTestCase(deqp::Context& context);
+       ShaderGroupVoteAvailabilityTestCase(deqp::Context& context, ExtParameters& extParam);
 };
 
 class ShaderGroupVoteFunctionTestCaseBase : public ShaderGroupVoteTestCaseBase
 {
 protected:
        /* Protected members*/
-       const char* m_shaderBase;
+       std::string m_shaderBase;
 
 public:
        /* Public methods */
-       ShaderGroupVoteFunctionTestCaseBase(deqp::Context& context, const char* name, const char* description);
+       ShaderGroupVoteFunctionTestCaseBase(deqp::Context& context, ExtParameters& extParam, const char* name,
+                                                                               const char* description);
 };
 
 /** Test verifies allInvocationsARB function calls
@@ -102,7 +102,7 @@ class ShaderGroupVoteAllInvocationsTestCase : public ShaderGroupVoteFunctionTest
 {
 public:
        /* Public methods */
-       ShaderGroupVoteAllInvocationsTestCase(deqp::Context& context);
+       ShaderGroupVoteAllInvocationsTestCase(deqp::Context& context, ExtParameters& extParam);
 };
 
 /** Test verifies anyInvocationARB function calls
@@ -111,7 +111,7 @@ class ShaderGroupVoteAnyInvocationTestCase : public ShaderGroupVoteFunctionTestC
 {
 public:
        /* Public methods */
-       ShaderGroupVoteAnyInvocationTestCase(deqp::Context& context);
+       ShaderGroupVoteAnyInvocationTestCase(deqp::Context& context, ExtParameters& extParam);
 };
 
 /** Test verifies allInvocationsEqualARB function calls
@@ -120,7 +120,7 @@ class ShaderGroupVoteAllInvocationsEqualTestCase : public ShaderGroupVoteFunctio
 {
 public:
        /* Public methods */
-       ShaderGroupVoteAllInvocationsEqualTestCase(deqp::Context& context);
+       ShaderGroupVoteAllInvocationsEqualTestCase(deqp::Context& context, ExtParameters& extParam);
 };
 
 /** Test group which encapsulates all ARB_shader_group_vote conformance tests */
@@ -138,4 +138,4 @@ private:
 
 } /* glcts namespace */
 
-#endif // _GL4CSHADERGROUPVOTETESTS_HPP
+#endif // _GLCSHADERGROUPVOTETESTS_HPP
index 21d4682..6084bd6 100644 (file)
@@ -56,8 +56,6 @@ set(GLCTS_GL_SRCS
        gl4cMultiBindTests.hpp
        gl4cShaderAtomicCountersTests.cpp
        gl4cShaderAtomicCountersTests.hpp
-       gl4cShaderGroupVoteTests.cpp
-       gl4cShaderGroupVoteTests.hpp
        gl4cShaderDrawParametersTests.cpp
        gl4cShaderDrawParametersTests.hpp
        gl4cTextureGatherTests.hpp
index 200526d..73d4cb1 100644 (file)
@@ -47,7 +47,6 @@
 #include "gl4cShaderAtomicCountersTests.hpp"
 #include "gl4cShaderBallotTests.hpp"
 #include "gl4cShaderDrawParametersTests.hpp"
-#include "gl4cShaderGroupVoteTests.hpp"
 #include "gl4cShaderImageLoadStoreTests.hpp"
 #include "gl4cShaderImageSizeTests.hpp"
 #include "gl4cShaderStorageBufferObjectTests.hpp"
 #include "glcBlendEquationAdvancedTests.hpp"
 #include "glcExposedExtensionsTests.hpp"
 #include "glcInfoTests.hpp"
-#include "glcPolygonOffsetClampTests.hpp"
 #include "glcParallelShaderCompileTests.hpp"
+#include "glcPolygonOffsetClampTests.hpp"
 #include "glcRobustBufferAccessBehaviorTests.hpp"
 #include "glcSampleVariablesTests.hpp"
 #include "glcSeparableProgramsTransformFeedbackTests.hpp"
 #include "glcShaderConstExprTests.hpp"
+#include "glcShaderGroupVoteTests.hpp"
 #include "glcShaderIntegerMixTests.hpp"
 #include "glcShaderLibrary.hpp"
 #include "glcShaderMultisampleInterpolationTests.hpp"
@@ -365,10 +365,10 @@ void GL45TestPackage::init(void)
                addChild(new gl4cts::SparseTextureClampTests(getContext()));
                addChild(new gl4cts::TextureFilterMinmax(getContext()));
                addChild(new gl4cts::ShaderAtomicCounterOps(getContext()));
-               addChild(new gl4cts::ShaderGroupVote(getContext()));
                addChild(new gl4cts::ShaderDrawParametersTests(getContext()));
                addChild(new gl4cts::ShaderViewportLayerArray(getContext()));
                addChild(new gl4cts::LimitsTests(getContext()));
+               addChild(new glcts::ShaderGroupVote(getContext()));
                addChild(new glcts::PolygonOffsetClamp(getContext()));
                addChild(new glcts::SeparableProgramsTransformFeedbackTests(getContext()));
                addChild(new gl4cts::SpirvExtensionsTests(getContext()));
index f57d035..24325a1 100644 (file)
@@ -47,6 +47,7 @@
 #include "glcPolygonOffsetClampTests.hpp"
 #include "glcSampleVariablesTests.hpp"
 #include "glcShaderConstExprTests.hpp"
+#include "glcShaderGroupVoteTests.hpp"
 #include "glcShaderIntegerMixTests.hpp"
 #include "glcShaderMultisampleInterpolationTests.hpp"
 #include "glcShaderNegativeTests.hpp"
@@ -191,6 +192,7 @@ void ES31TestPackage::init(void)
                coreGroup->addChild(new glcts::FramebufferNoAttachmentsTests(getContext()));
                coreGroup->addChild(new glcts::ArrayOfArraysTestGroup(getContext()));
                coreGroup->addChild(new glcts::PolygonOffsetClamp(getContext()));
+               coreGroup->addChild(new glcts::ShaderGroupVote(getContext()));
 
                glcts::ExtParameters extParams(glu::GLSL_VERSION_310_ES, glcts::EXTENSIONTYPE_OES);
                coreGroup->addChild(new glcts::GeometryShaderTests(getContext(), extParams));