Commit 00ae3c59 authored by Stuart Abercrombie's avatar Stuart Abercrombie Committed by Paul Berry
Browse files

shader_runner: remove explicit #version directive from generated_tests.



It is instead inserted by shader_runner based on the GLSL requirement.

Tested with all.tests - glean: same number of passes.
Signed-off-by: default avatarStuart Abercrombie <sabercrombie@chromium.org>
Reviewed-by: Paul Berry's avatarPaul Berry <stereotype441@gmail.com>
parent 4cd2cb8e
......@@ -362,12 +362,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'
......@@ -425,8 +419,7 @@ class ShaderTest(object):
statements that need to be inside the main() funciton of the
shader, after the built-in function is called.
"""
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)
......@@ -540,8 +533,7 @@ class VertexShaderTest(ShaderTest):
'color', '')
def make_fragment_shader(self):
shader = self.version_directive()
shader += '''varying vec4 color;
shader = '''varying vec4 color;
void main()
{
......@@ -563,7 +555,7 @@ class GeometryShaderTest(ShaderTest):
return 'GL_ARB_geometry_shader4\n'
def make_vertex_shader(self):
shader = self.version_directive()
shader = ''
if self.glsl_version() >= 140:
shader += "in vec4 vertex;\n"
......@@ -601,8 +593,7 @@ class GeometryShaderTest(ShaderTest):
return layout
def make_fragment_shader(self):
shader = self.version_directive()
shader += '''varying vec4 color;
shader = '''varying vec4 color;
void main()
{
......@@ -621,7 +612,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"
......
......@@ -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 '',
......
......@@ -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};
......
......@@ -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};
......
......@@ -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};
......
......@@ -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};
......
......@@ -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()
......
......@@ -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()
......
......@@ -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:
......
......@@ -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()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment