Commit 65b1fb4f authored by Dylan Baker's avatar Dylan Baker
Browse files

interpolation-qualifier...: put templates in templates dir


Signed-off-by: default avatarDylan Baker <dylanx.c.baker@intel.com>
parent 043cb649
...@@ -84,7 +84,13 @@ piglit_make_generated_tests( ...@@ -84,7 +84,13 @@ piglit_make_generated_tests(
generate-cl-relational-builtins.py) generate-cl-relational-builtins.py)
piglit_make_generated_tests( piglit_make_generated_tests(
interpolation-qualifier-built-in-variable.list interpolation-qualifier-built-in-variable.list
interpolation-qualifier-built-in-variable.py) interpolation-qualifier-built-in-variable.py
templates/interpolation-qualifier-built-in-variable/fs-vs-unused.shader_test.mako
templates/interpolation-qualifier-built-in-variable/vs-unused.shader_test.mako
templates/interpolation-qualifier-built-in-variable/fs-unused.shader_test.mako
templates/interpolation-qualifier-built-in-variable/vs-fs-flip.shader_test.mako
templates/interpolation-qualifier-built-in-variable/vs-fs.shader_test.mako
)
piglit_make_generated_tests( piglit_make_generated_tests(
texture_lod_tests.list texture_lod_tests.list
gen_texture_lod_tests.py gen_texture_lod_tests.py
......
...@@ -23,9 +23,10 @@ ...@@ -23,9 +23,10 @@
from __future__ import print_function from __future__ import print_function
import os import os
from textwrap import dedent
from mako.template import Template from templates import template_dir
TEMPLATES = template_dir(os.path.basename(os.path.splitext(__file__)[0]))
interpolation_modes = [ interpolation_modes = [
'flat', 'flat',
...@@ -60,42 +61,6 @@ vertex_shader_to_fragment_shader_variable_map = { ...@@ -60,42 +61,6 @@ vertex_shader_to_fragment_shader_variable_map = {
'gl_BackSecondaryColor': 'gl_SecondaryColor' 'gl_BackSecondaryColor': 'gl_SecondaryColor'
} }
template = Template(dedent("""\
# Section 4.3.7 (Interpolation) of the GLSL 1.30 spec says:
#
# "If gl_Color is redeclared with an interpolation qualifier, then
# gl_FrontColor and gl_BackColor (if they are written to) must
# also be redeclared with the same interpolation qualifier, and
# vice versa. If gl_SecondaryColor is redeclared with an
# interpolation qualifier, then gl_FrontSecondaryColor and
# gl_BackSecondaryColor (if they are written to) must also be
# redeclared with the same interpolation qualifier, and vice
# versa. This qualifier matching on predeclared variables is only
# required for variables that are statically used within the
# shaders in a program."
#
# Even though some of the other rules for interpolation qualifier
# matching changed in 4.x specifications, this rule has remained the
# same.
[require]
GLSL >= 1.30
[vertex shader]
% if vs_mode != 'default':
${vs_mode} out vec4 ${vs_variable};
% endif
void main() { gl_Position = vec4(0); ${vs_variable} = vec4(0); }
[fragment shader]
% if fs_mode != 'default':
${fs_mode} in vec4 ${fs_variable};
% endif
out vec4 c;
void main() { c = ${fs_variable}; }
[test]
link error
"""))
for fs_mode in interpolation_modes: for fs_mode in interpolation_modes:
for vs_mode in interpolation_modes: for vs_mode in interpolation_modes:
...@@ -118,49 +83,12 @@ for fs_mode in interpolation_modes: ...@@ -118,49 +83,12 @@ for fs_mode in interpolation_modes:
os.makedirs(dirname) os.makedirs(dirname)
with open(filename, 'w') as f: with open(filename, 'w') as f:
f.write(template.render( f.write(TEMPLATES.get_template('vs-fs.shader_test.mako').render(
vs_mode=vs_mode, vs_mode=vs_mode,
vs_variable=var, vs_variable=var,
fs_mode=fs_mode, fs_mode=fs_mode,
fs_variable=vertex_shader_to_fragment_shader_variable_map[var])) fs_variable=vertex_shader_to_fragment_shader_variable_map[var]))
template = Template(dedent("""\
# Section 4.3.7 (Interpolation) of the GLSL 1.30 spec says:
#
# "If gl_Color is redeclared with an interpolation qualifier, then
# gl_FrontColor and gl_BackColor (if they are written to) must
# also be redeclared with the same interpolation qualifier, and
# vice versa. If gl_SecondaryColor is redeclared with an
# interpolation qualifier, then gl_FrontSecondaryColor and
# gl_BackSecondaryColor (if they are written to) must also be
# redeclared with the same interpolation qualifier, and vice
# versa. This qualifier matching on predeclared variables is only
# required for variables that are statically used within the
# shaders in a program."
#
# Even though some of the other rules for interpolation qualifier
# matching changed in 4.x specifications, this rule has remained the
# same.
#
# We interpret the sentence "variables that are statically used within the
# shaders in a program" to mean static use of the variable in a shader stage
# invokes the redeclaration requirement for that stage only. This is based on
# the additional text "..gl_FrontColor and gl_BackColor (if they are written
# to) must also be redeclared with the same interpolation qualifier..."
[require]
GLSL >= 1.30
[vertex shader]
${vs_mode} out vec4 ${vs_variable};
void main() { gl_Position = vec4(0); ${vs_variable} = vec4(0); }
[fragment shader]
out vec4 c;
void main() { c = vec4(0); }
[test]
link success
"""))
for vs_mode in interpolation_modes: for vs_mode in interpolation_modes:
if vs_mode == 'default': if vs_mode == 'default':
...@@ -181,46 +109,11 @@ for vs_mode in interpolation_modes: ...@@ -181,46 +109,11 @@ for vs_mode in interpolation_modes:
os.makedirs(dirname) os.makedirs(dirname)
with open(filename, 'w') as f: with open(filename, 'w') as f:
f.write(template.render(vs_mode=vs_mode, f.write(
vs_variable=var)) TEMPLATES.get_template('vs-unused.shader_test.mako').render(
vs_mode=vs_mode,
template = Template(dedent("""\ vs_variable=var))
# Section 4.3.7 (Interpolation) of the GLSL 1.30 spec says:
#
# "If gl_Color is redeclared with an interpolation qualifier, then
# gl_FrontColor and gl_BackColor (if they are written to) must
# also be redeclared with the same interpolation qualifier, and
# vice versa. If gl_SecondaryColor is redeclared with an
# interpolation qualifier, then gl_FrontSecondaryColor and
# gl_BackSecondaryColor (if they are written to) must also be
# redeclared with the same interpolation qualifier, and vice
# versa. This qualifier matching on predeclared variables is only
# required for variables that are statically used within the
# shaders in a program."
#
# Even though some of the other rules for interpolation qualifier
# matching changed in 4.x specifications, this rule has remained the
# same.
#
# We interpret the sentence "variables that are statically used within the
# shaders in a program" to mean static use of the variable in a shader stage
# invokes the redeclaration requirement for that stage only. This is based on
# the additional text "..gl_FrontColor and gl_BackColor (if they are written
# to) must also be redeclared with the same interpolation qualifier..."
[require]
GLSL >= 1.30
[vertex shader]
void main() { gl_Position = vec4(0); }
[fragment shader]
${fs_mode} in vec4 ${fs_variable};
out vec4 c;
void main() { c = ${fs_variable}; }
[test]
link success
"""))
for fs_mode in interpolation_modes: for fs_mode in interpolation_modes:
if fs_mode == 'default': if fs_mode == 'default':
...@@ -242,55 +135,13 @@ for fs_mode in interpolation_modes: ...@@ -242,55 +135,13 @@ for fs_mode in interpolation_modes:
os.makedirs(dirname) os.makedirs(dirname)
with open(filename, 'w') as f: with open(filename, 'w') as f:
f.write(template.render( f.write(TEMPLATES.get_template('fs-unused.shader_test.mako').render(
vs_mode=vs_mode, vs_mode=vs_mode,
vs_variable=var, vs_variable=var,
fs_mode=fs_mode, fs_mode=fs_mode,
fs_variable=vertex_shader_to_fragment_shader_variable_map[var])) fs_variable=vertex_shader_to_fragment_shader_variable_map[var]))
template = Template(dedent("""\
# Section 4.3.7 (Interpolation) of the GLSL 1.30 spec says:
#
# "If gl_Color is redeclared with an interpolation qualifier, then
# gl_FrontColor and gl_BackColor (if they are written to) must
# also be redeclared with the same interpolation qualifier, and
# vice versa. If gl_SecondaryColor is redeclared with an
# interpolation qualifier, then gl_FrontSecondaryColor and
# gl_BackSecondaryColor (if they are written to) must also be
# redeclared with the same interpolation qualifier, and vice
# versa. This qualifier matching on predeclared variables is only
# required for variables that are statically used within the
# shaders in a program."
#
# Even though some of the other rules for interpolation qualifier
# matching changed in 4.x specifications, this rule has remained the
# same.
#
# We interpret the sentence "variables that are statically used within the
# shaders in a program" to mean static use of the variable in any shader in
# the program invokes the redeclaration requirement. Since neither shader
# accesses any built-in variables, linking should succeed no matter what the
# interpolation qualifiers say.
[require]
GLSL >= 1.30
[vertex shader]
% if vs_mode != 'default':
${vs_mode} out vec4 ${vs_variable};
% endif
void main() { gl_Position = vec4(0); }
[fragment shader]
% if fs_mode != 'default':
${fs_mode} in vec4 ${fs_variable};
% endif
out vec4 c;
void main() { c = vec4(0); }
[test]
link success
"""))
for fs_mode in interpolation_modes: for fs_mode in interpolation_modes:
for vs_mode in interpolation_modes: for vs_mode in interpolation_modes:
...@@ -313,52 +164,14 @@ for fs_mode in interpolation_modes: ...@@ -313,52 +164,14 @@ for fs_mode in interpolation_modes:
os.makedirs(dirname) os.makedirs(dirname)
with open(filename, 'w') as f: with open(filename, 'w') as f:
f.write(template.render( f.write(TEMPLATES.get_template(
vs_mode=vs_mode, 'fs-vs-unused.shader_test.mako').render(
vs_variable=var, vs_mode=vs_mode,
fs_mode=fs_mode, vs_variable=var,
fs_variable=vertex_shader_to_fragment_shader_variable_map[var])) fs_mode=fs_mode,
fs_variable=vertex_shader_to_fragment_shader_variable_map[var]))
template = Template(dedent("""\
# Section 4.3.7 (Interpolation) of the GLSL 1.30 spec says:
#
# "If gl_Color is redeclared with an interpolation qualifier, then
# gl_FrontColor and gl_BackColor (if they are written to) must
# also be redeclared with the same interpolation qualifier, and
# vice versa. If gl_SecondaryColor is redeclared with an
# interpolation qualifier, then gl_FrontSecondaryColor and
# gl_BackSecondaryColor (if they are written to) must also be
# redeclared with the same interpolation qualifier, and vice
# versa. This qualifier matching on predeclared variables is only
# required for variables that are statically used within the
# shaders in a program."
#
# Even though some of the other rules for interpolation qualifier
# matching changed in 4.x specifications, this rule has remained the
# same.
[require]
GLSL >= 1.30
[vertex shader]
% if fs_mode != 'default':
${fs_mode} out vec4 ${this_side_variable};
% endif
% if vs_mode != 'default':
${vs_mode} out vec4 ${other_side_variable};
% endif
void main() { gl_Position = vec4(0); ${this_side_variable} = vec4(0); ${other_side_variable} = vec4(1); }
[fragment shader]
% if fs_mode != 'default':
${fs_mode} in vec4 ${fs_variable};
% endif
out vec4 c;
void main() { c = ${fs_variable}; }
[test]
link error
"""))
for fs_mode in interpolation_modes: for fs_mode in interpolation_modes:
for vs_mode in interpolation_modes: for vs_mode in interpolation_modes:
...@@ -381,9 +194,10 @@ for fs_mode in interpolation_modes: ...@@ -381,9 +194,10 @@ for fs_mode in interpolation_modes:
os.makedirs(dirname) os.makedirs(dirname)
with open(filename, 'w') as f: with open(filename, 'w') as f:
f.write(template.render( f.write(TEMPLATES.get_template(
vs_mode=vs_mode, 'vs-fs-flip.shader_test.mako').render(
this_side_variable=this_side, vs_mode=vs_mode,
other_side_variable=other_side, this_side_variable=this_side,
fs_mode=fs_mode, other_side_variable=other_side,
fs_variable=vertex_shader_to_fragment_shader_variable_map[this_side])) fs_mode=fs_mode,
fs_variable=vertex_shader_to_fragment_shader_variable_map[this_side]))
# Section 4.3.7 (Interpolation) of the GLSL 1.30 spec says:
#
# "If gl_Color is redeclared with an interpolation qualifier, then
# gl_FrontColor and gl_BackColor (if they are written to) must
# also be redeclared with the same interpolation qualifier, and
# vice versa. If gl_SecondaryColor is redeclared with an
# interpolation qualifier, then gl_FrontSecondaryColor and
# gl_BackSecondaryColor (if they are written to) must also be
# redeclared with the same interpolation qualifier, and vice
# versa. This qualifier matching on predeclared variables is only
# required for variables that are statically used within the
# shaders in a program."
#
# Even though some of the other rules for interpolation qualifier
# matching changed in 4.x specifications, this rule has remained the
# same.
#
# We interpret the sentence "variables that are statically used within the
# shaders in a program" to mean static use of the variable in a shader stage
# invokes the redeclaration requirement for that stage only. This is based on
# the additional text "..gl_FrontColor and gl_BackColor (if they are written
# to) must also be redeclared with the same interpolation qualifier..."
[require]
GLSL >= 1.30
[vertex shader]
void main() { gl_Position = vec4(0); }
[fragment shader]
${fs_mode} in vec4 ${fs_variable};
out vec4 c;
void main() { c = ${fs_variable}; }
[test]
link success
# Section 4.3.7 (Interpolation) of the GLSL 1.30 spec says:
#
# "If gl_Color is redeclared with an interpolation qualifier, then
# gl_FrontColor and gl_BackColor (if they are written to) must
# also be redeclared with the same interpolation qualifier, and
# vice versa. If gl_SecondaryColor is redeclared with an
# interpolation qualifier, then gl_FrontSecondaryColor and
# gl_BackSecondaryColor (if they are written to) must also be
# redeclared with the same interpolation qualifier, and vice
# versa. This qualifier matching on predeclared variables is only
# required for variables that are statically used within the
# shaders in a program."
#
# Even though some of the other rules for interpolation qualifier
# matching changed in 4.x specifications, this rule has remained the
# same.
#
# We interpret the sentence "variables that are statically used within the
# shaders in a program" to mean static use of the variable in any shader in
# the program invokes the redeclaration requirement. Since neither shader
# accesses any built-in variables, linking should succeed no matter what the
# interpolation qualifiers say.
[require]
GLSL >= 1.30
[vertex shader]
% if vs_mode != 'default':
${vs_mode} out vec4 ${vs_variable};
% endif
void main() { gl_Position = vec4(0); }
[fragment shader]
% if fs_mode != 'default':
${fs_mode} in vec4 ${fs_variable};
% endif
out vec4 c;
void main() { c = vec4(0); }
[test]
link success
# Section 4.3.7 (Interpolation) of the GLSL 1.30 spec says:
#
# "If gl_Color is redeclared with an interpolation qualifier, then
# gl_FrontColor and gl_BackColor (if they are written to) must
# also be redeclared with the same interpolation qualifier, and
# vice versa. If gl_SecondaryColor is redeclared with an
# interpolation qualifier, then gl_FrontSecondaryColor and
# gl_BackSecondaryColor (if they are written to) must also be
# redeclared with the same interpolation qualifier, and vice
# versa. This qualifier matching on predeclared variables is only
# required for variables that are statically used within the
# shaders in a program."
#
# Even though some of the other rules for interpolation qualifier
# matching changed in 4.x specifications, this rule has remained the
# same.
[require]
GLSL >= 1.30
[vertex shader]
% if fs_mode != 'default':
${fs_mode} out vec4 ${this_side_variable};
% endif
% if vs_mode != 'default':
${vs_mode} out vec4 ${other_side_variable};
% endif
void main() {
gl_Position = vec4(0);
${this_side_variable} = vec4(0);
${other_side_variable} = vec4(1);
}
[fragment shader]
% if fs_mode != 'default':
${fs_mode} in vec4 ${fs_variable};
% endif
out vec4 c;
void main() { c = ${fs_variable}; }
[test]
link error
# Section 4.3.7 (Interpolation) of the GLSL 1.30 spec says:
#
# "If gl_Color is redeclared with an interpolation qualifier, then
# gl_FrontColor and gl_BackColor (if they are written to) must
# also be redeclared with the same interpolation qualifier, and
# vice versa. If gl_SecondaryColor is redeclared with an
# interpolation qualifier, then gl_FrontSecondaryColor and
# gl_BackSecondaryColor (if they are written to) must also be
# redeclared with the same interpolation qualifier, and vice
# versa. This qualifier matching on predeclared variables is only
# required for variables that are statically used within the
# shaders in a program."
#
# Even though some of the other rules for interpolation qualifier
# matching changed in 4.x specifications, this rule has remained the
# same.
[require]
GLSL >= 1.30
[vertex shader]
% if vs_mode != 'default':
${vs_mode} out vec4 ${vs_variable};
% endif
void main() { gl_Position = vec4(0); ${vs_variable} = vec4(0); }
[fragment shader]
% if fs_mode != 'default':
${fs_mode} in vec4 ${fs_variable};
% endif
out vec4 c;
void main() { c = ${fs_variable}; }
[test]
link error
# Section 4.3.7 (Interpolation) of the GLSL 1.30 spec says:
#
# "If gl_Color is redeclared with an interpolation qualifier, then
# gl_FrontColor and gl_BackColor (if they are written to) must
# also be redeclared with the same interpolation qualifier, and
# vice versa. If gl_SecondaryColor is redeclared with an
# interpolation qualifier, then gl_FrontSecondaryColor and
# gl_BackSecondaryColor (if they are written to) must also be
# redeclared with the same interpolation qualifier, and vice
# versa. This qualifier matching on predeclared variables is only
# required for variables that are statically used within the
# shaders in a program."
#
# Even though some of the other rules for interpolation qualifier
# matching changed in 4.x specifications, this rule has remained the
# same.
#
# We interpret the sentence "variables that are statically used within the
# shaders in a program" to mean static use of the variable in a shader stage
# invokes the redeclaration requirement for that stage only. This is based on
# the additional text "..gl_FrontColor and gl_BackColor (if they are written
# to) must also be redeclared with the same interpolation qualifier..."
[require]
GLSL >= 1.30
[vertex shader]
${vs_mode} out vec4 ${vs_variable};
void main() { gl_Position = vec4(0); ${vs_variable} = vec4(0); }
[fragment shader]
out vec4 c;
void main() { c = vec4(0); }
[test]
link success
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