From: Alejandro PiƱeiro Date: Mon, 11 Dec 2017 11:29:10 +0000 (+0100) Subject: glSpirvTests: fix transform feedback query X-Git-Tag: upstream/1.3.5~2373 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0961f085a5a9ab8ca2389e63ffcd62eab12bffec;p=platform%2Fupstream%2FVK-GL-CTS.git glSpirvTests: fix transform feedback query The test removes the names for several variables of the shader, and then it expect a length of 1 for all of them when doing a state query. But on the case of TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH it is not activating any varying. This commits adds an output definition with xfb decorations so the variable would become active without the need to call glTransformFeedbackVaryings. From ARB_gl_spirv spec: "If the shader used to record output variables for transform feedback varyings uses the xfb_buffer, xfb_offset, or xfb_stride layout qualifiers, or its SPIR-V entry point declares the *Xfb* Execution Mode, the values specified by TransformFeedbackVaryings are ignored, and the set of variables captured for transform feedback is instead derived from the specified layout qualifiers or SPIR-V decorations: outputs specifying both an *XfbBuffer* and an *Offset* are captured, while outputs not specifying both of these are not captured. Values are captured each time the shader writes to such a decorated object." As we are here, we also simplify how name reflection is stripped. Instead of stripping each individual OpName and OpMemberName that we know the shader have, we just remove any OpName and OpMemberName line. Modules: OpenGL VK-GL-CTS issue: 886 Affects: KHR-GL45.gl_spirv.spirv_modules_state_queries_test KHR-GL46.gl_spirv.spirv_modules_state_queries_test Change-Id: I124c90c61f8bee1e873867cf0d2b2e689679d70a --- diff --git a/external/openglcts/data/spirv/modules_state_queries/vertex.nspv b/external/openglcts/data/spirv/modules_state_queries/vertex.nspv index 3742ddc..39e6b48 100644 Binary files a/external/openglcts/data/spirv/modules_state_queries/vertex.nspv and b/external/openglcts/data/spirv/modules_state_queries/vertex.nspv differ diff --git a/external/openglcts/modules/gl/gl4cGlSpirvTests.cpp b/external/openglcts/modules/gl/gl4cGlSpirvTests.cpp index f737779..e737dc8 100644 --- a/external/openglcts/modules/gl/gl4cGlSpirvTests.cpp +++ b/external/openglcts/modules/gl/gl4cGlSpirvTests.cpp @@ -1073,6 +1073,10 @@ void SpirvModulesStateQueriesTest::init() " vec4 c1;\n" " vec2 c2;\n" "} components;\n" + "layout (xfb_buffer = 0, xfb_offset = 16) out gl_PerVertex\n" + "{\n" + " vec4 gl_Position;\n" + "};\n" "\n" "void main()\n" "{\n" @@ -1109,13 +1113,10 @@ tcu::TestNode::IterateResult SpirvModulesStateQueriesTest::iterate() std::string input; for (int i = 0; i < (signed)lines.size(); ++i) { - if (lines[i].find("OpName %position") != std::string::npos) - continue; - if (lines[i].find("OpName %extPosition") != std::string::npos) + if (lines[i].find("OpName") != std::string::npos) continue; - if (lines[i].find("OpName %ComponentsBlock") != std::string::npos) - continue; - if (lines[i].find("OpName %components") != std::string::npos) + + if (lines[i].find("OpMemberName") != std::string::npos) continue; input.append(lines[i] + "\n"); @@ -1162,18 +1163,16 @@ tcu::TestNode::IterateResult SpirvModulesStateQueriesTest::iterate() } // 3) Check if queries for ACTIVE_ATTRIBUTE_MAX_LENGTH, ACTIVE_UNIFORM_MAX_LENGTH, - // ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH return value equal to 1, and - // TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH value equals to 0 + // ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH and TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH return + // value equal to 1 GLint programState[4]; - GLint expectedValues[4] = {1, 1, 0, 1}; + GLint expectedValues[4] = {1, 1, 1, 1}; gl.getProgramiv(program.getProgram(), GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &programState[0]); GLU_EXPECT_NO_ERROR(gl.getError(), "getProgramiv"); gl.getProgramiv(program.getProgram(), GL_ACTIVE_UNIFORM_MAX_LENGTH, &programState[1]); GLU_EXPECT_NO_ERROR(gl.getError(), "getProgramiv"); - // We expect 0 for GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH because the current program - // doesn't activate transform feedback so there isn't any active varying. gl.getProgramiv(program.getProgram(), GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH, &programState[2]); GLU_EXPECT_NO_ERROR(gl.getError(), "getProgramiv");