Fix more spurious failures in KHR-GL*.transform_feedback.api_errors_test
authorEric Anholt <anholt@google.com>
Wed, 3 Feb 2021 20:33:46 +0000 (12:33 -0800)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Thu, 25 Feb 2021 18:52:58 +0000 (18:52 +0000)
It was checking for extensions (or not even checking!), then using the
corresponding core GLSL versions in the programs when trying to test
GS and tess.  Just skip these shader stage tests if we don't have the
core GL version necessary to compile our programs.

Fixes spurious failures on softpipe (which has GS) on the KHR-GL32
variant of the test, and on freedreno (which has tess but only GL 3.3)
on the KHR-GL33 variant.

Components: OpenGL
Affects: KHR-GL3*.transform_feedback.api_errors_test
Change-Id: Iaccd402c0a8420a5ce698d9befd54ec05b23c869

external/openglcts/modules/gl/gl3cTransformFeedbackTests.cpp

index 4e5bd7c..fb3f596 100644 (file)
@@ -135,6 +135,7 @@ tcu::TestNode::IterateResult gl3cts::TransformFeedback::APIErrors::iterate(void)
 
        /* Initializations. */
        bool is_at_least_gl_30 = (glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::core(3, 0)));
+       bool is_at_least_gl_33 = (glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::core(3, 3)));
        bool is_at_least_gl_40 = (glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::core(4, 0)));
        bool is_at_least_gl_42 = (glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::core(4, 2)));
 
@@ -142,7 +143,6 @@ tcu::TestNode::IterateResult gl3cts::TransformFeedback::APIErrors::iterate(void)
        bool is_arb_tf_2                 = m_context.getContextInfo().isExtensionSupported("GL_ARB_transform_feedback2");
        bool is_arb_tf_3                 = m_context.getContextInfo().isExtensionSupported("GL_ARB_transform_feedback3");
        bool is_arb_tf_instanced = m_context.getContextInfo().isExtensionSupported("GL_ARB_transform_feedback_instanced");
-       bool is_tessellation = m_context.getContextInfo().isExtensionSupported("GL_ARB_tessellation_shader");
 
        if (is_ext_tf_1)
        {
@@ -226,14 +226,17 @@ tcu::TestNode::IterateResult gl3cts::TransformFeedback::APIErrors::iterate(void)
                        gl, m_context.getTestContext().getLog(), NULL, NULL, NULL, s_vertex_shader_without_output,
                        s_fragment_shader, NULL, 0, GL_SEPARATE_ATTRIBS);
 
-               m_program_id_with_geometry_shader = gl3cts::TransformFeedback::Utilities::buildProgram(
-                       gl, m_context.getTestContext().getLog(), m_geometry_shader, NULL, NULL, s_vertex_shader_without_output,
-                       s_fragment_shader, &m_varying_name, 1, GL_INTERLEAVED_ATTRIBS);
+               is_ok = is_ok && m_program_id_with_input_output && m_program_id_with_output && m_program_id_without_output;
 
-               is_ok = is_ok && m_program_id_with_input_output && m_program_id_with_output && m_program_id_without_output &&
-                               m_program_id_with_geometry_shader;
+               if (is_at_least_gl_33) {
+                       m_program_id_with_geometry_shader = gl3cts::TransformFeedback::Utilities::buildProgram(
+                               gl, m_context.getTestContext().getLog(), m_geometry_shader, NULL, NULL, s_vertex_shader_without_output,
+                               s_fragment_shader, &m_varying_name, 1, GL_INTERLEAVED_ATTRIBS);
+
+                       is_ok = is_ok && m_program_id_with_geometry_shader;
+               }
 
-                if (is_at_least_gl_40 || is_tessellation) {
+        if (is_at_least_gl_40) {
                        m_program_id_with_tessellation_shaders = gl3cts::TransformFeedback::Utilities::buildProgram(
                                        gl, m_context.getTestContext().getLog(), NULL, m_tessellation_control_shader,
                                        m_tessellation_evaluation_shader, s_vertex_shader_without_output, s_fragment_shader, &m_varying_name, 1,
@@ -1415,63 +1418,65 @@ bool gl3cts::TransformFeedback::APIErrors::testInstanced(void)
                return false;
        }
 
-       /*  INVALID_OPERATION is generated by DrawTransformFeedbackInstanced and
-        DrawTransformFeedbackStreamInstanced if <mode> does not match geometry
-        shader */
+       if (m_program_id_with_geometry_shader != 0) {
+               /*  INVALID_OPERATION is generated by DrawTransformFeedbackInstanced and
+               DrawTransformFeedbackStreamInstanced if <mode> does not match geometry
+               shader */
 
-       gl.bindTransformFeedback(GL_TRANSFORM_FEEDBACK, m_transform_feedback_object_0);
+               gl.bindTransformFeedback(GL_TRANSFORM_FEEDBACK, m_transform_feedback_object_0);
 
-       GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTransformFeedback call failed.");
+               GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTransformFeedback call failed.");
 
-       gl.useProgram(m_program_id_with_geometry_shader);
+               gl.useProgram(m_program_id_with_geometry_shader);
 
-       GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram call failed.");
+               GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram call failed.");
 
-       gl.bindVertexArray(m_vertex_array_object);
+               gl.bindVertexArray(m_vertex_array_object);
 
-       GLU_EXPECT_NO_ERROR(gl.getError(), "glBindVertexArray call failed.");
+               GLU_EXPECT_NO_ERROR(gl.getError(), "glBindVertexArray call failed.");
 
-       gl.bindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, m_buffer_0);
+               gl.bindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, m_buffer_0);
 
-       GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer call failed.");
+               GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer call failed.");
 
-       gl.beginTransformFeedback(GL_POINTS);
+               gl.beginTransformFeedback(GL_POINTS);
 
-       GLU_EXPECT_NO_ERROR(gl.getError(), "glBeginTransformFeedback call failed.");
+               GLU_EXPECT_NO_ERROR(gl.getError(), "glBeginTransformFeedback call failed.");
 
-       gl.drawArrays(GL_POINTS, 0, 1);
+               gl.drawArrays(GL_POINTS, 0, 1);
 
-       GLU_EXPECT_NO_ERROR(gl.getError(), "glDrawArrays call failed.");
+               GLU_EXPECT_NO_ERROR(gl.getError(), "glDrawArrays call failed.");
 
-       gl.endTransformFeedback();
+               gl.endTransformFeedback();
 
-       GLU_EXPECT_NO_ERROR(gl.getError(), "glEndTransformFeedback call failed.");
+               GLU_EXPECT_NO_ERROR(gl.getError(), "glEndTransformFeedback call failed.");
 
-       gl.drawTransformFeedbackInstanced(GL_LINES, m_transform_feedback_object_0, 1);
+               gl.drawTransformFeedbackInstanced(GL_LINES, m_transform_feedback_object_0, 1);
 
-       if (GL_INVALID_OPERATION != gl.getError())
-       {
-               m_context.getTestContext().getLog()
-                       << tcu::TestLog::Message << "INVALID_OPERATION was not generated by DrawTransformFeedbackInstanced and "
-                                                                               "DrawTransformFeedbackStreamInstanced if <mode> did not match geometry shader."
-                       << tcu::TestLog::EndMessage;
-               return false;
-       }
+               if (GL_INVALID_OPERATION != gl.getError())
+               {
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "INVALID_OPERATION was not generated by DrawTransformFeedbackInstanced and "
+                                                                                       "DrawTransformFeedbackStreamInstanced if <mode> did not match geometry shader."
+                               << tcu::TestLog::EndMessage;
+                       return false;
+               }
 
-       gl.drawTransformFeedbackStreamInstanced(GL_LINES, m_transform_feedback_object_0, 0, 1);
+               gl.drawTransformFeedbackStreamInstanced(GL_LINES, m_transform_feedback_object_0, 0, 1);
 
-       if (GL_INVALID_OPERATION != gl.getError())
-       {
-               m_context.getTestContext().getLog()
-                       << tcu::TestLog::Message << "INVALID_OPERATION was not generated by DrawTransformFeedbackInstanced and "
-                                                                               "DrawTransformFeedbackStreamInstanced if <mode> did not match geometry shader."
-                       << tcu::TestLog::EndMessage;
-               return false;
+               if (GL_INVALID_OPERATION != gl.getError())
+               {
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "INVALID_OPERATION was not generated by DrawTransformFeedbackInstanced and "
+                                                                                       "DrawTransformFeedbackStreamInstanced if <mode> did not match geometry shader."
+                               << tcu::TestLog::EndMessage;
+                       return false;
+               }
        }
 
        /* All of the below tests concern themselves with GL_PATCHES and
         * tessellation shaders */
-       if (!has_patches)
+       if (m_program_id_with_tessellation_shaders == 0)
        {
                return true;
        }