From: Ian Romanick <[email protected]>

Previous to this, running the test on OpenGL ES 3.1 would generate
spurious warnings from Mesa:

    Mesa: User error: GL_INVALID_ENUM in CreateShader(GL_GEOMETRY_SHADER)

This fixes that in a way that is understandable.  It also allows the
desktop geometry shader check to be simplified.

This also prevents spurious failures when we enable
GL_OES_geometry_shaders in Mesa.

Signed-off-by: Ian Romanick <[email protected]>
---
 tests/shaders/built-in-constants.c | 32 +++++++++++++++++++++++++-------
 1 file changed, 25 insertions(+), 7 deletions(-)

diff --git a/tests/shaders/built-in-constants.c 
b/tests/shaders/built-in-constants.c
index b1951fb..be4eb64 100644
--- a/tests/shaders/built-in-constants.c
+++ b/tests/shaders/built-in-constants.c
@@ -376,13 +376,31 @@ create_shader(GLenum type)
 {
        if (shader_type != 0 && shader_type != type && 
!is_tessellation_type(shader_type))
                return 0;
-       if (is_tessellation_type(type) &&
-           (required_glsl_version < 400 &&
-            !piglit_is_extension_supported("GL_ARB_tessellation_shader")))
-               return 0;
-       if (type == GL_GEOMETRY_SHADER &&
-           (required_glsl_version < 150 || required_glsl_version == 300))
-               return 0;
+       if (es_shader) {
+               if (is_tessellation_type(type) &&
+                   required_glsl_version < 320 &&
+                   (required_glsl_version < 310 ||
+                    
!piglit_is_extension_supported("GL_OES_tessellation_shader")))
+                       return 0;
+
+               if (type == GL_GEOMETRY_SHADER &&
+                   required_glsl_version < 320 &&
+                   (required_glsl_version < 310 ||
+                    !piglit_is_extension_supported("GL_OES_geometry_shader")))
+                       return 0;
+       } else {
+               if (is_tessellation_type(type) &&
+                   (required_glsl_version < 400 &&
+                    
!piglit_is_extension_supported("GL_ARB_tessellation_shader")))
+                       return 0;
+
+               /* Only support geometry shaders on desktop as introduced in
+                * OpenGL 3.2.
+                */
+               if (type == GL_GEOMETRY_SHADER &&
+                   required_glsl_version < 320)
+                       return 0;
+       }
        /* Only create compute shaders when explicitly requested
         */
        if (type == GL_COMPUTE_SHADER && shader_type != type)
-- 
2.5.5

_______________________________________________
Piglit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to