From e1d87d965cc8d9648ce6e188d40517e1167388b9 Mon Sep 17 00:00:00 2001 From: "Juan A. Suarez Romero" Date: Tue, 30 Jan 2018 10:55:40 +0100 Subject: [PATCH] Add more cases for block/non-block uniforms match Cover more situations as described in GLSL 3.20 spec, section 4.3.9. - It is a link-error when using the same name inside a block with non instance name and outside a block, but it is correct if the block has instance name. - It is a link-error when using the same name inside two different blocks with non instance name. Components: OpenGL VK-GL-CTS issue: 972 Affects: KHR-GLES3.shaders.uniform_block.common.name_matching KHR-GL33.shaders.uniform_block.common.name_matching Change-Id: Ie91300685e807774a9cc9bbb9139936133a8ae1c --- .../modules/common/glcUniformBlockTests.cpp | 39 ++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/external/openglcts/modules/common/glcUniformBlockTests.cpp b/external/openglcts/modules/common/glcUniformBlockTests.cpp index 656e0e4..f7d3fe6 100644 --- a/external/openglcts/modules/common/glcUniformBlockTests.cpp +++ b/external/openglcts/modules/common/glcUniformBlockTests.cpp @@ -735,7 +735,7 @@ public: " color = b.v;\n" "}"); - // check if linking succeeds when both matched blocks are lacking an instance name + // check if linking succeeds when both blocks have a different instance name if (!Test(vs3, fs3, GL_TRUE)) return STOP; @@ -751,10 +751,45 @@ public: " color = vec4(f);\n" "}\n"); - // check if link error is generated when the same name is used for block and non-block uniform + // check if link error is generated when the same name is used for block + // with no intance name and non-block uniform if (!Test(vs4, fs4, GL_FALSE)) return STOP; + std::string vs5("precision highp float;\n" + "layout (std140) uniform Data { float f; } a;\n" + "void main() {\n" + " gl_Position = vec4(a.f);\n" + "}\n"); + std::string fs5("precision highp float;\n" + "uniform float f;\n" + "out vec4 color;\n" + "void main() {\n" + " color = vec4(f);\n" + "}\n"); + + // check if link succeeds when the same name is used for block with + // instance name and non-block uniform + if (!Test(vs5, fs5, GL_TRUE)) + return STOP; + + + std::string vs6("precision highp float;\n" + "uniform Data1 { float u; vec4 v; };\n" + "void main() {\n" + " gl_Position = v;\n" + "}"); + std::string fs6("precision highp float;\n" + "out vec4 color;\n" + "uniform Data2 { vec4 v; };\n" + "void main() {\n" + " color = v;\n" + "}"); + + // check if link error is generated when same name is used in two different blocks + if (!Test(vs6, fs6, GL_FALSE)) + return STOP; + m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass"); return STOP; } -- 2.7.4