[Piglit] [PATCH 1/6] gs: Make generated geometry shader tests use GLSL 1.50.

Paul Berry stereotype441 at gmail.com
Sat Jul 27 06:10:02 PDT 2013


Previously, these tests used ARB_geometry_shader4.  However, the
initial implementation of geometry shaders in Mesa isn't going to
support ARB_geometry_shader4.  So test this functionality using GLSL
1.50 geometry shaders instead.
---
 generated_tests/gen_builtin_uniform_tests.py     | 35 +++++++++---------------
 generated_tests/gen_constant_array_size_tests.py |  9 ++----
 2 files changed, 16 insertions(+), 28 deletions(-)

diff --git a/generated_tests/gen_builtin_uniform_tests.py b/generated_tests/gen_builtin_uniform_tests.py
index e0b6da2..2fd1d67 100644
--- a/generated_tests/gen_builtin_uniform_tests.py
+++ b/generated_tests/gen_builtin_uniform_tests.py
@@ -551,47 +551,38 @@ class GeometryShaderTest(ShaderTest):
     def test_prefix(self):
 	return 'gs'
 
-    def make_additional_requirements(self):
-	return 'GL_ARB_geometry_shader4\n'
+    def glsl_version(self):
+	return max(150, ShaderTest.glsl_version(self))
 
     def make_vertex_shader(self):
 	shader = ''
-	if self.glsl_version() >= 140:
-	    shader += "in vec4 vertex;\n"
+	shader += "in vec4 vertex;\n"
+	shader += "out vec4 vertex_to_gs;\n"
 
 	shader += "void main()\n"
 	shader += "{\n"
-        if self.glsl_version() >= 140:
-            shader += "	gl_Position = vertex;\n"
-        else:
-            shader += "	gl_Position = gl_Vertex;\n"
+	shader += "	vertex_to_gs = vertex;\n"
         shader += "}\n"
 
 	return shader
 
     def make_geometry_shader(self):
-	additional_declarations = \
-	    '#extension GL_ARB_geometry_shader4: enable\n'
-	if self.glsl_version() >= 130:
-	    additional_declarations += 'out vec4 color;\n'
-	else:
-	    additional_declarations += 'varying out vec4 color;\n'
+	additional_declarations = ''
+	additional_declarations += 'layout(triangles) in;\n'
+	additional_declarations \
+	    += 'layout(triangle_strip, max_vertices = 3) out;\n'
+	additional_declarations += 'in vec4 vertex_to_gs[3];\n'
+	additional_declarations += 'out vec4 color;\n'
 	return self.make_test_shader(
 	    additional_declarations,
 	    '  vec4 tmp_color;\n',
 	    'tmp_color',
-	    '  for (int i = 0; i < gl_VerticesIn; i++) {\n'
-	    '    gl_Position = gl_PositionIn[i];\n'
+	    '  for (int i = 0; i < 3; i++) {\n'
+	    '    gl_Position = vertex_to_gs[i];\n'
 	    '    color = tmp_color;\n'
 	    '    EmitVertex();\n'
 	    '  }\n')
 
-    def make_geometry_layout(self):
-	layout = 'input type GL_TRIANGLES\n'
-	layout += 'output type GL_TRIANGLE_STRIP\n'
-	layout += 'vertices out 3\n'
-	return layout
-
     def make_fragment_shader(self):
 	shader = '''varying vec4 color;
 
diff --git a/generated_tests/gen_constant_array_size_tests.py b/generated_tests/gen_constant_array_size_tests.py
index c1baf54..b56b875 100644
--- a/generated_tests/gen_constant_array_size_tests.py
+++ b/generated_tests/gen_constant_array_size_tests.py
@@ -215,15 +215,12 @@ class GeometryParserTest(ParserTest):
     """Derived class for tests that exercise the built-in in a geometry
     shader.
     """
+    def glsl_version(self):
+	return max(150, ParserTest.glsl_version(self))
+
     def test_suffix(self):
 	return 'geom'
 
-    def additional_declarations(self):
-	return '#extension GL_ARB_geometry_shader4: enable\n'
-
-    def additional_extensions(self):
-	return ['GL_ARB_geometry_shader4']
-
     def output_var(self):
 	return 'gl_Position'
 
-- 
1.8.3.4



More information about the Piglit mailing list