[Piglit] [PATCH] shader_runner: remove explicit #version directive from generated_tests.
Stuart Abercrombie
sabercrombie at chromium.org
Thu Feb 14 10:09:16 PST 2013
It is instead inserted by shader_runner based on the GLSL requirement.
Tested with all.tests - glean: same number of passes.
Signed-off-by: Stuart Abercrombie <sabercrombie at chromium.org>
---
generated_tests/gen_builtin_uniform_tests.py | 14 +++-----------
generated_tests/gen_interpolation_tests.py | 11 ++++-------
.../fs-initializer-from-const.template | 2 --
.../fs-initializer-set-by-API.template | 2 --
.../fs-initializer-set-by-other-stage.template | 2 --
.../fs-initializer.template | 2 --
.../vs-initializer-from-const.template | 2 --
.../vs-initializer-set-by-API.template | 2 --
.../vs-initializer-set-by-other-stage.template | 2 --
.../vs-initializer.template | 2 --
10 files changed, 7 insertions(+), 34 deletions(-)
diff --git a/generated_tests/gen_builtin_uniform_tests.py b/generated_tests/gen_builtin_uniform_tests.py
index 323985f..78f623a 100644
--- a/generated_tests/gen_builtin_uniform_tests.py
+++ b/generated_tests/gen_builtin_uniform_tests.py
@@ -361,12 +361,6 @@ class ShaderTest(object):
def glsl_version(self):
return self._signature.version_introduced
- def version_directive(self):
- if self.glsl_version() == 110:
- return ''
- else:
- return '#version {0}\n'.format(self.glsl_version())
-
def draw_command(self):
if self.glsl_version() >= 140:
return 'draw arrays GL_TRIANGLE_FAN 0 4\n'
@@ -400,8 +394,7 @@ class ShaderTest(object):
built-in function should be assigned to, after conversion to a
vec4.
"""
- shader = self.version_directive()
- shader += additional_declarations
+ shader = additional_declarations
for i in xrange(len(self._signature.argtypes)):
shader += 'uniform {0} arg{1};\n'.format(
self._signature.argtypes[i], i)
@@ -503,8 +496,7 @@ class VertexShaderTest(ShaderTest):
'color')
def make_fragment_shader(self):
- shader = self.version_directive()
- shader += '''varying vec4 color;
+ shader = '''varying vec4 color;
void main()
{
@@ -523,7 +515,7 @@ class FragmentShaderTest(ShaderTest):
return 'fs'
def make_vertex_shader(self):
- shader = self.version_directive()
+ shader = ""
if self.glsl_version() >= 140:
shader += "in vec4 vertex;\n"
diff --git a/generated_tests/gen_interpolation_tests.py b/generated_tests/gen_interpolation_tests.py
index a1799c4..da88f68 100644
--- a/generated_tests/gen_interpolation_tests.py
+++ b/generated_tests/gen_interpolation_tests.py
@@ -114,18 +114,17 @@ class Test(object):
self.builtin_variable = variable[:3] == 'gl_'
# Determine whether the test requires GLSL 1.30. If it does,
- # use an appropriate version directive and use "in" and "out"
- # to qualify shader inputs and outputs. Otherwise use the old
- # keywords "attribute" and "varying".
+ # use "in" and "out" to qualify shader inputs and outputs.
+ # Otherwise use the old keywords "attribute" and "varying".
+ # shader_runner will insert a #version directive based on
+ # glsl_version.
if self.interpolation_qualifier or self.clipping == 'distance':
self.glsl_version = '1.30'
- self.version_directive = '#version 130\n'
self.vs_input = 'in'
self.vs_output = 'out'
self.fs_input = 'in'
else:
self.glsl_version = '1.10'
- self.version_directive = ''
self.vs_input = 'attribute'
self.vs_output = 'varying'
self.fs_input = 'varying'
@@ -279,7 +278,6 @@ class Test(object):
test += 'GLSL >= {0}\n'.format(self.glsl_version)
test += '\n'
test += '[vertex shader]\n'
- test += self.version_directive
test += '{0} vec4 vertex;\n'.format(self.vs_input)
test += '{0} vec4 input_data;\n'.format(self.vs_input)
if self.interpolation_qualifier or not self.builtin_variable:
@@ -297,7 +295,6 @@ class Test(object):
test += '}\n'
test += '\n'
test += '[fragment shader]\n'
- test += self.version_directive
if self.interpolation_qualifier or not self.builtin_variable:
test += '{0} {1} vec4 {2};'.format(
self.interpolation_qualifier or '',
diff --git a/generated_tests/uniform-initializer-templates/fs-initializer-from-const.template b/generated_tests/uniform-initializer-templates/fs-initializer-from-const.template
index 77cf3c4..29f10ed 100644
--- a/generated_tests/uniform-initializer-templates/fs-initializer-from-const.template
+++ b/generated_tests/uniform-initializer-templates/fs-initializer-from-const.template
@@ -2,7 +2,6 @@
GLSL >= ${"{0}.{1}".format(major, minor)}
[vertex shader]
-#version ${"{0}{1}".format(major, minor)}
void main()
{
@@ -10,7 +9,6 @@ void main()
}
[fragment shader]
-#version ${"{0}{1}".format(major, minor)}
% for (type, name, value) in type_list:
const ${type} c${name} = ${value};
diff --git a/generated_tests/uniform-initializer-templates/fs-initializer-set-by-API.template b/generated_tests/uniform-initializer-templates/fs-initializer-set-by-API.template
index 30fa213..415df81 100644
--- a/generated_tests/uniform-initializer-templates/fs-initializer-set-by-API.template
+++ b/generated_tests/uniform-initializer-templates/fs-initializer-set-by-API.template
@@ -6,7 +6,6 @@ def constructor(type, values):
GLSL >= ${"{0}.{1}".format(major, minor)}
[vertex shader]
-#version ${"{0}{1}".format(major, minor)}
void main()
{
@@ -14,7 +13,6 @@ void main()
}
[fragment shader]
-#version ${"{0}{1}".format(major, minor)}
% for (type, name, value) in type_list:
uniform ${type} ${name} = ${value};
diff --git a/generated_tests/uniform-initializer-templates/fs-initializer-set-by-other-stage.template b/generated_tests/uniform-initializer-templates/fs-initializer-set-by-other-stage.template
index 92c4393..626f6b5 100644
--- a/generated_tests/uniform-initializer-templates/fs-initializer-set-by-other-stage.template
+++ b/generated_tests/uniform-initializer-templates/fs-initializer-set-by-other-stage.template
@@ -2,7 +2,6 @@
GLSL >= ${"{0}.{1}".format(major, minor)}
[vertex shader]
-#version ${"{0}{1}".format(major, minor)}
% for (type, name, value) in type_list:
uniform ${type} ${name} = ${value};
@@ -14,7 +13,6 @@ void main()
}
[fragment shader]
-#version ${"{0}{1}".format(major, minor)}
% for (type, name, value) in type_list:
uniform ${type} ${name};
diff --git a/generated_tests/uniform-initializer-templates/fs-initializer.template b/generated_tests/uniform-initializer-templates/fs-initializer.template
index 2ad9819..a4f84af 100644
--- a/generated_tests/uniform-initializer-templates/fs-initializer.template
+++ b/generated_tests/uniform-initializer-templates/fs-initializer.template
@@ -2,7 +2,6 @@
GLSL >= ${"{0}.{1}".format(major, minor)}
[vertex shader]
-#version ${"{0}{1}".format(major, minor)}
void main()
{
@@ -10,7 +9,6 @@ void main()
}
[fragment shader]
-#version ${"{0}{1}".format(major, minor)}
% for (type, name, value) in type_list:
uniform ${type} ${name} = ${value};
diff --git a/generated_tests/uniform-initializer-templates/vs-initializer-from-const.template b/generated_tests/uniform-initializer-templates/vs-initializer-from-const.template
index 7342e8c..bbb6c66 100644
--- a/generated_tests/uniform-initializer-templates/vs-initializer-from-const.template
+++ b/generated_tests/uniform-initializer-templates/vs-initializer-from-const.template
@@ -2,7 +2,6 @@
GLSL >= ${"{0}.{1}".format(major, minor)}
[vertex shader]
-#version ${"{0}{1}".format(major, minor)}
varying vec4 color;
% for (type, name, value) in type_list:
@@ -25,7 +24,6 @@ void main()
}
[fragment shader]
-#version ${"{0}{1}".format(major, minor)}
varying vec4 color;
void main()
diff --git a/generated_tests/uniform-initializer-templates/vs-initializer-set-by-API.template b/generated_tests/uniform-initializer-templates/vs-initializer-set-by-API.template
index 1e6de73..458e711 100644
--- a/generated_tests/uniform-initializer-templates/vs-initializer-set-by-API.template
+++ b/generated_tests/uniform-initializer-templates/vs-initializer-set-by-API.template
@@ -6,7 +6,6 @@ def constructor(type, values):
GLSL >= ${"{0}.{1}".format(major, minor)}
[vertex shader]
-#version ${"{0}{1}".format(major, minor)}
varying vec4 color;
% for (type, name, value) in type_list:
@@ -25,7 +24,6 @@ void main()
}
[fragment shader]
-#version ${"{0}{1}".format(major, minor)}
varying vec4 color;
void main()
diff --git a/generated_tests/uniform-initializer-templates/vs-initializer-set-by-other-stage.template b/generated_tests/uniform-initializer-templates/vs-initializer-set-by-other-stage.template
index b5fd310..6f337d5 100644
--- a/generated_tests/uniform-initializer-templates/vs-initializer-set-by-other-stage.template
+++ b/generated_tests/uniform-initializer-templates/vs-initializer-set-by-other-stage.template
@@ -2,7 +2,6 @@
GLSL >= ${"{0}.{1}".format(major, minor)}
[vertex shader]
-#version ${"{0}{1}".format(major, minor)}
varying vec4 color;
% for (type, name, value) in type_list:
@@ -21,7 +20,6 @@ void main()
}
[fragment shader]
-#version ${"{0}{1}".format(major, minor)}
varying vec4 color;
% for (type, name, value) in type_list:
diff --git a/generated_tests/uniform-initializer-templates/vs-initializer.template b/generated_tests/uniform-initializer-templates/vs-initializer.template
index 0f7c691..94442da 100644
--- a/generated_tests/uniform-initializer-templates/vs-initializer.template
+++ b/generated_tests/uniform-initializer-templates/vs-initializer.template
@@ -2,7 +2,6 @@
GLSL >= ${"{0}.{1}".format(major, minor)}
[vertex shader]
-#version ${"{0}{1}".format(major, minor)}
varying vec4 color;
% for (type, name, value) in type_list:
@@ -21,7 +20,6 @@ void main()
}
[fragment shader]
-#version ${"{0}{1}".format(major, minor)}
varying vec4 color;
void main()
--
1.7.5.4
More information about the Piglit
mailing list