Relax XFB begin check to match recent spec edit
authorJames Helferty <jhelferty@nvidia.com>
Thu, 19 Oct 2017 18:24:35 +0000 (14:24 -0400)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Fri, 3 Nov 2017 14:39:20 +0000 (10:39 -0400)
Update tests to reflect a recent change to the GL 4.6 specification.
Previously, if a shader layout qualifier specified that xfb_stride was
non-zero for a given xfb_buffer, then a buffer object was required to
be bound at that transform feedback buffer binding point. After the
spec change, it is now legal to not have a buffer bound, provided no
outputs are associated with the buffer.

Components: OpenGL

VK-GL-CTS issue: 785

Affects:
* KHR-GL44/45/46.enhanced_layouts.xfb_stride_of_empty_list
* KHR-GL44/45/46.enhanced_layouts.xfb_stride_of_empty_list_and_api

Change-Id: I38622bad1af3bc8a2a4c683eadc184e6231f7c85

external/openglcts/modules/gl/gl4cEnhancedLayoutsTests.cpp
external/openglcts/modules/gl/gl4cEnhancedLayoutsTests.hpp

index f221203..60afa14 100644 (file)
@@ -20006,8 +20006,9 @@ const GLuint XFBStrideOfEmptyListTest::m_stride = 64;
  * @param context Test context
  **/
 XFBStrideOfEmptyListTest::XFBStrideOfEmptyListTest(deqp::Context& context)
-       : BufferTestBase(context, "xfb_stride_of_empty_list",
-                                        "Test verifies that xfb_stride qualifier is respected when no xfb_offset is specified")
+       : BufferTestBase(
+                 context, "xfb_stride_of_empty_list",
+                 "Test verifies correct behavior when xfb_stride qualifier is specified but no xfb_offset is specified")
 {
        /* Nothing to be done here */
 }
@@ -20066,20 +20067,18 @@ bool XFBStrideOfEmptyListTest::executeDrawCall(bool /* tesEnabled */, GLuint tes
                break;
 
        case SECOND_MISSING:
-               if (GL_NO_ERROR == error)
+               if (GL_NO_ERROR != error)
                {
                        gl.endTransformFeedback();
+                       GLU_EXPECT_NO_ERROR(error, "BeginTransformFeedback");
                }
 
-               if (GL_INVALID_OPERATION != error)
-               {
-                       m_context.getTestContext().getLog()
-                               << tcu::TestLog::Message << "XFB at index 1, that is declared as empty, is missing. It was expected "
-                                                                                       "that INVALID_OPERATION will generated by BeginTransformFeedback. Got: "
-                               << glu::getErrorStr(error) << tcu::TestLog::EndMessage;
+               gl.drawArrays(GL_PATCHES, 0 /* first */, 1 /* count */);
+               error = gl.getError();
 
-                       result = false;
-               }
+               gl.endTransformFeedback();
+               GLU_EXPECT_NO_ERROR(error, "DrawArrays");
+               GLU_EXPECT_NO_ERROR(gl.getError(), "EndTransformFeedback");
 
                break;
        }
@@ -20183,8 +20182,8 @@ void XFBStrideOfEmptyListTest::getBufferDescriptors(glw::GLuint                           test_case_i
                /* Data */
                uniform.m_initial_data = Utils::Type::vec4.GenerateDataPacked();
 
-               /* Draw call will not be executed, contents does not matter */
                xfb_0.m_initial_data = Utils::Type::vec4.GenerateDataPacked();
+               xfb_0.m_expected_data = uniform.m_initial_data;
        }
 
        break;
@@ -20341,20 +20340,18 @@ bool XFBStrideOfEmptyListAndAPITest::executeDrawCall(bool /* tesEnabled */, GLui
                break;
 
        case FIRST_MISSING:
-               if (GL_NO_ERROR == error)
+               if (GL_NO_ERROR != error)
                {
                        gl.endTransformFeedback();
+                       GLU_EXPECT_NO_ERROR(error, "BeginTransformFeedback");
                }
 
-               if (GL_INVALID_OPERATION != error)
-               {
-                       m_context.getTestContext().getLog()
-                               << tcu::TestLog::Message << "XFB at index 0, that is declared as empty, is missing. It was expected "
-                                                                                       "that INVALID_OPERATION will generated by BeginTransformFeedback. Got: "
-                               << glu::getErrorStr(error) << tcu::TestLog::EndMessage;
+               gl.drawArrays(GL_PATCHES, 0 /* first */, 1 /* count */);
+               error = gl.getError();
 
-                       result = false;
-               }
+               gl.endTransformFeedback();
+               GLU_EXPECT_NO_ERROR(error, "DrawArrays");
+               GLU_EXPECT_NO_ERROR(gl.getError(), "EndTransformFeedback");
 
                break;
 
@@ -20367,8 +20364,8 @@ bool XFBStrideOfEmptyListAndAPITest::executeDrawCall(bool /* tesEnabled */, GLui
                if (GL_INVALID_OPERATION != error)
                {
                        m_context.getTestContext().getLog()
-                               << tcu::TestLog::Message << "XFB at index 1, that is written by GS, is missing. It was expected that "
-                                                                                       "INVALID_OPERATION will generated by BeginTransformFeedback. Got: "
+                               << tcu::TestLog::Message << "XFB at index 1, that is declared as empty, is missing. It was expected "
+                                                                                       "that INVALID_OPERATION will generated by BeginTransformFeedback. Got: "
                                << glu::getErrorStr(error) << tcu::TestLog::EndMessage;
 
                        result = false;
@@ -20450,8 +20447,9 @@ void XFBStrideOfEmptyListAndAPITest::getBufferDescriptors(glw::GLuint                           test_ca
                /* Data */
                uniform.m_initial_data = Utils::Type::vec4.GenerateDataPacked();
 
-               /* Draw call will not be executed, contents does not matter */
-               xfb_1.m_initial_data = Utils::Type::vec4.GenerateDataPacked();
+               /* Data, contents are the same as no modification is expected */
+               xfb_1.m_initial_data  = Utils::Type::vec4.GenerateDataPacked();
+               xfb_1.m_expected_data = uniform.m_initial_data;
        }
 
        break;
@@ -20477,7 +20475,7 @@ void XFBStrideOfEmptyListAndAPITest::getBufferDescriptors(glw::GLuint                           test_ca
                uniform.m_initial_data = Utils::Type::vec4.GenerateDataPacked();
 
                /* Draw call will not be executed, contents does not matter */
-               xfb_0.m_initial_data.resize(m_stride);
+               xfb_0.m_initial_data = Utils::Type::vec4.GenerateDataPacked();
        }
 
        break;
@@ -20493,7 +20491,8 @@ void XFBStrideOfEmptyListAndAPITest::getCapturedVaryings(glw::GLuint /* test_cas
                                                                                                                 Utils::Program::NameVector& captured_varyings,
                                                                                                                 GLint* xfb_components)
 {
-       captured_varyings.push_back("gs_fs");
+       captured_varyings.push_back("gs_fs1");
+       captured_varyings.push_back("gs_fs2");
        *xfb_components = 4;
 }
 
@@ -20509,8 +20508,9 @@ void XFBStrideOfEmptyListAndAPITest::getShaderBody(GLuint /* test_case_index */,
 {
        out_calculations = "";
 
-       static const GLchar* gs = "    gs_fs  = uni_gs;\n";
-       static const GLchar* fs = "    fs_out = vec4(gs_fs);\n";
+       static const GLchar* gs = "    gs_fs1 = -uni_gs;\n"
+                                                         "    gs_fs2 = uni_gs;\n";
+       static const GLchar* fs = "    fs_out = vec4(gs_fs2);\n";
 
        const GLchar* assignments = "";
        switch (stage)
@@ -20537,13 +20537,13 @@ void XFBStrideOfEmptyListAndAPITest::getShaderBody(GLuint /* test_case_index */,
 void XFBStrideOfEmptyListAndAPITest::getShaderInterface(GLuint /* test_case_index */, Utils::Shader::STAGES stage,
                                                                                                                std::string& out_interface)
 {
-       static const GLchar* gs = "layout (xfb_buffer = 0, xfb_stride = 64) out;\n"
-                                                         "layout (xfb_buffer = 1, xfb_offset = 0)  out vec4 gs_fs;\n"
+       static const GLchar* gs = "layout (xfb_buffer = 0, xfb_stride = 64) out vec4 gs_fs1;\n"
+                                                         "layout (xfb_buffer = 1, xfb_offset = 0)  out vec4 gs_fs2;\n"
                                                          "\n"
                                                          "layout(binding    = 0) uniform gs_block {\n"
                                                          "    vec4 uni_gs;\n"
                                                          "};\n";
-       static const GLchar* fs = "in  vec4 gs_fs;\n"
+       static const GLchar* fs = "in  vec4 gs_fs2;\n"
                                                          "out vec4 fs_out;\n";
 
        switch (stage)
index f5d4225..fdfe45c 100644 (file)
@@ -3381,8 +3381,8 @@ private:
 
 /** Implementation of test XFBStrideOfEmptyList. Description follows:
  *
- * Test verifies that xfb_stride directive is respected even if there are no
- * variables qualified with xfb_offset.
+ * Test verifies correct behavior when xfb_stride qualifier is specified
+ * but no variables are qualified with xfb_offset.
  *
  * Test implements Buffer algorithm. Rasterization can be discarded.
  *
@@ -3398,10 +3398,10 @@ private:
  *     3 Provide buffer to XFB at index 0, index 1 should be missing
  *
  * It is expected that:
- *     - BeginTransformFeedback operation will report GL_INVALID_OPERATION in cases
- *     2 and 3,
- *     - XFB at index 1 will not be modified in case 1.
+ *     - BeginTransformFeedback operation will report GL_INVALID_OPERATION in case 2
+ *     - XFB at index 1 will not be modified in cases 1 and 3.
  **/
+
 class XFBStrideOfEmptyListTest : public BufferTestBase
 {
 public: