Fix geometry shader limits regarding available image units
authorIago Toral Quiroga <itoral@igalia.com>
Tue, 15 Oct 2019 11:16:21 +0000 (13:16 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Tue, 12 Nov 2019 09:31:48 +0000 (04:31 -0500)
The test case KHR-GLES31.core.geometry_shader.api.max_image_uniforms
would fail if the implementations reports:

MAX_GEOMETRY_TEXTURE_IMAGE_UNITS < MAX_GEOMETRY_IMAGE_UNIFORMS

However, the latter was introduced with ARB_shader_image_load_store,
whereas the former refers to samplers. From the GLES 3.2 spec:

   "Note that image units used for image variables are independent
    of the texture image units used for sampler variables; the number
    of units provided by the implementation may differ.  Textures
    are bound independently and separately to image and texture image
    units".

In fact the ARB_shader_image_load_store spec doesn't mention any of
the MAX_{*}_TEXTURE_IMAGE_UNITS at all, and it only talks about
MAX_IMAGE_UNITS and MAX_{*}_IMAGE_UNIFORMS.

Specifically, the test calls glBindImageTexture for as many
units as reported by MAX_GEOMETRY_IMAGE_UNIFORMS and the spec for
glBindImageTexture only requires that:

   "An INVALID_VALUE error is generated if unit is greater than
    or equal tothe value of MAX_IMAGE_UNITS, (...)"

So this changes the test to fail only if:

MAX_IMAGE_UNITS < MAX_GEOMETRY_IMAGE_UNIFORMS

VK-GL-CTS issue: 2057
Components: OpenGL ES
Affects: KHR-GLES31.core.geometry_shader.api.max_image_uniforms
Change-Id: I24566a1372c486512b64ce5d4b329925d859e0af

external/openglcts/modules/glesext/geometry_shader/esextcGeometryShaderAPI.cpp

index 2695949..c4bc8d8 100644 (file)
@@ -1554,6 +1554,11 @@ tcu::TestNode::IterateResult GeometryShaderMaxImageUniformsTest::iterate()
        gl.getIntegerv(m_glExtTokens.MAX_GEOMETRY_TEXTURE_IMAGE_UNITS, &m_gl_max_geometry_texture_image_units_ext_value);
        GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv() failed for GL_MAX_GEOMETRY_IMAGE_UNIFORMS_EXT pname");
 
+       /* Retrieve GL_MAX_IMAGE_UNITS pname value */
+       glw::GLint m_gl_max_image_units_value = 0;
+       gl.getIntegerv(GL_MAX_IMAGE_UNITS, &m_gl_max_image_units_value);
+       GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv() failed for GL_MAX_IMAGE_UNITS pname");
+
        /* Check if m_gl_max_geometry_image_uniforms_value is less than or equal zero. */
        if (m_gl_max_geometry_image_uniforms_ext_value <= 0)
        {
@@ -1575,15 +1580,15 @@ tcu::TestNode::IterateResult GeometryShaderMaxImageUniformsTest::iterate()
                }
        }
 
-       /* Check if m_gl_max_geometry_texture_image_units_value is less than m_gl_max_geometry_image_uniforms_value. */
-       if (m_gl_max_geometry_texture_image_units_ext_value < m_gl_max_geometry_image_uniforms_ext_value)
+       /* Check if m_gl_max_image_units_value is less than m_gl_max_geometry_image_uniforms_value. */
+       if (m_gl_max_image_units_value < m_gl_max_geometry_image_uniforms_ext_value)
        {
                m_testCtx.getLog() << tcu::TestLog::Message << "GL_MAX_GEOMETRY_IMAGE_UNIFORMS_EXT query value "
                                                   << "[" << m_gl_max_geometry_image_uniforms_ext_value
                                                   << "]"
-                                                         " is greater than GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT query value "
+                                                         " is greater than GL_MAX_IMAGE_UNITS query value "
                                                          "["
-                                                  << m_gl_max_geometry_texture_image_units_ext_value << "]." << tcu::TestLog::EndMessage;
+                                                  << m_gl_max_image_units_value << "]." << tcu::TestLog::EndMessage;
 
                result = false;
                goto end;