Block/non-block uniforms match
authorPiotr Byszewski <piotr.byszewski@mobica.com>
Fri, 3 Nov 2017 09:11:09 +0000 (10:11 +0100)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Mon, 11 Dec 2017 14:41:41 +0000 (09:41 -0500)
Test if uniforms in anonymous blocks do not match loose uniforms with
the same name in a different stage.

Components: OpenGL

VK-GL-CTS issue: 707

Affects:
KHR-GLES3.shaders.uniform_block.common.name_matching
KHR-GL33.shaders.uniform_block.common.name_matching

Change-Id: Ib1ea850ffbea7eb62ddbd6008463c8855f764c7e

external/openglcts/modules/common/glcUniformBlockTests.cpp

index a3ac986..656e0e4 100644 (file)
@@ -739,6 +739,22 @@ public:
                if (!Test(vs3, fs3, GL_TRUE))
                        return STOP;
 
+               std::string vs4("precision highp float;\n"
+                                               "layout (std140) uniform Data { float f; };\n"
+                                               "void main() {\n"
+                                               "  gl_Position = vec4(f);\n"
+                                               "}\n");
+               std::string fs4("precision highp float;\n"
+                                               "uniform float f;\n"
+                                               "out vec4 color;\n"
+                                               "void main() {\n"
+                                               "  color = vec4(f);\n"
+                                               "}\n");
+
+               // check if link error is generated when the same name is used for block and non-block uniform
+               if (!Test(vs4, fs4, GL_FALSE))
+                       return STOP;
+
                m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
                return STOP;
        }