From 0961f085a5a9ab8ca2389e63ffcd62eab12bffec Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alejandro=20Pi=C3=B1eiro?= Date: Mon, 11 Dec 2017 12:29:10 +0100 Subject: [PATCH] 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 --- .../data/spirv/modules_state_queries/vertex.nspv | Bin 1333 -> 1049 bytes external/openglcts/modules/gl/gl4cGlSpirvTests.cpp | 21 ++++++++++----------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/external/openglcts/data/spirv/modules_state_queries/vertex.nspv b/external/openglcts/data/spirv/modules_state_queries/vertex.nspv index 3742ddc0a6ef3644b9abc51881de2462b8924ad5..39e6b48ac7afaab97706080882c28e479cc8e2d1 100644 GIT binary patch literal 1049 zcmYk4$xZ@M5Jg{uf{KEOfFm}OV?tbrF)^CB!UYSBUtr?Kg>Li*{58MIjfv+p{S1}d zuDUh8s&o>NVxeCSA;Bt#QyoY>6f%!`46lSz#wXLK>FDG0Wppt>g0;DenSzl&gJjrRQqyZ(*-t zr=U%J6)m5=eYUT@6i*H9&feg9j_Yf}y;}+raF+8rwqpGT+L-;UmpezF@djFnak)2B ze4BUkZQh~-_b%q@x4wxsrr-W@@1xInE4QtQ?`vbn`CED1e#V`(4HWBl(C%uzd>3u4 zdpl3=-StK8-Q|}=yuEKxy#Ehu4}C+eJ@Io5Tt zQxNNV*w*T|&OQCVtaE?s+<5@>Ka%6_!`z4Z_Z{ZG1pUCD;Jc21xyHPgh_jEeoo|k_ Tz2OP)j=uR8OK#pTm%0LfUj-om literal 1333 zcmYk4T}xC^6o$7mj#idtruJdu8BMJ$si+8|AQC3Q3q$BOWIV`$=_t+#qPzZDzp9&{ z=h^4%(LJnL>wVYv-e)3k+O75J5GJsu!!rrad}u{xCQL=$-#^^n8CAzSuUXu=tf5XNErOge+R8k-uhziT2BAn z#x^I-cMm)Dzu)++r{7*Hh{yZ~Xm>SV>~~~Yn~C4x@!g!oW_Z*zhTD18lCmdG5K1nCJfHx$_nx|AiQL xf7EcOG55IP-06TX!MUCw#_IFFl+=40+y2Jb+dF)Uc#qEf0ZVM$KW^$R@*llxNX`HN 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"); -- 2.7.4