[Piglit] [PATCH 3/6] glsl-1.20 / glsl-1.30: Add tests for uniforms with initializers in another stage
Ian Romanick
idr at freedesktop.org
Wed May 16 14:23:45 PDT 2012
From: Ian Romanick <ian.d.romanick at intel.com>
These are similar to the first tests except the uniform is initialized
in one stage (vertex or fragment) but used in the other stage
(vice-versa).
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
generated_tests/CMakeLists.txt | 2 +
generated_tests/gen_uniform_initializer_tests.py | 1 +
.../fs-initializer-set-by-other-stage.template | 38 ++++++++++++++++++
.../vs-initializer-set-by-other-stage.template | 42 ++++++++++++++++++++
4 files changed, 83 insertions(+), 0 deletions(-)
create mode 100644 generated_tests/uniform-initializer-templates/fs-initializer-set-by-other-stage.template
create mode 100644 generated_tests/uniform-initializer-templates/vs-initializer-set-by-other-stage.template
diff --git a/generated_tests/CMakeLists.txt b/generated_tests/CMakeLists.txt
index 33be413..f9e07a1 100644
--- a/generated_tests/CMakeLists.txt
+++ b/generated_tests/CMakeLists.txt
@@ -40,6 +40,8 @@ piglit_make_generated_tests(
uniform-initializer-templates/vs-initializer.template
uniform-initializer-templates/fs-initializer-from-const.template
uniform-initializer-templates/vs-initializer-from-const.template
+ uniform-initializer-templates/fs-initializer-set-by-other-stage.template
+ uniform-initializer-templates/vs-initializer-set-by-other-stage.template
)
# Add a "gen-tests" target that can be used to generate all the
diff --git a/generated_tests/gen_uniform_initializer_tests.py b/generated_tests/gen_uniform_initializer_tests.py
index 81f41bd..d9fedd2 100644
--- a/generated_tests/gen_uniform_initializer_tests.py
+++ b/generated_tests/gen_uniform_initializer_tests.py
@@ -170,6 +170,7 @@ random_numbers = (0.78685, 0.89828, 0.36590, 0.92504, 0.48998, 0.27989,
all_templates = ("",
"-from-const",
+ "-set-by-other-stage",
)
bool_types = [("bool", 1), ("bvec2", 2), ("bvec3", 3), ("bvec4", 4)]
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
new file mode 100644
index 0000000..af187e3
--- /dev/null
+++ b/generated_tests/uniform-initializer-templates/fs-initializer-set-by-other-stage.template
@@ -0,0 +1,38 @@
+[require]
+GLSL >= ${"{}.{}".format(major, minor)}
+
+[vertex shader]
+#version ${"{}{}".format(major, minor)}
+
+% for (type, name, value) in type_list:
+uniform ${type} ${name} = ${value};
+% endfor
+
+void main()
+{
+ gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+#version ${"{}{}".format(major, minor)}
+
+% for (type, name, value) in type_list:
+uniform ${type} ${name};
+% endfor
+
+void main()
+{
+ if ((${type_list[0][1]} == ${type_list[0][2]})
+% for (type, name, value) in type_list[1:-1]:
+ && (${name} == ${value})
+% endfor
+ && (${type_list[-1][1]} == ${type_list[-1][2]})) {
+ gl_FragColor = vec4(0, 1, 0, 1);
+ } else {
+ gl_FragColor = vec4(1, 0, 0, 1);
+ }
+}
+
+[test]
+draw rect -1 -1 2 2
+probe all rgb 0 1 0
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
new file mode 100644
index 0000000..d16069a
--- /dev/null
+++ b/generated_tests/uniform-initializer-templates/vs-initializer-set-by-other-stage.template
@@ -0,0 +1,42 @@
+[require]
+GLSL >= ${"{}.{}".format(major, minor)}
+
+[vertex shader]
+#version ${"{}{}".format(major, minor)}
+varying vec4 color;
+
+% for (type, name, value) in type_list:
+uniform ${type} ${name};
+% endfor
+
+void main()
+{
+ if ((${type_list[0][1]} == ${type_list[0][2]})
+% for (type, name, value) in type_list[1:-1]:
+ && (${name} == ${value})
+% endfor
+ && (${type_list[-1][1]} == ${type_list[-1][2]})) {
+ color = vec4(0, 1, 0, 1);
+ } else {
+ color = vec4(1, 0, 0, 1);
+ }
+
+ gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+#version ${"{}{}".format(major, minor)}
+varying vec4 color;
+
+% for (type, name, value) in type_list:
+uniform ${type} ${name} = ${value};
+% endfor
+
+void main()
+{
+ gl_FragColor = color;
+}
+
+[test]
+draw rect -1 -1 2 2
+probe all rgb 0 1 0
--
1.7.6.5
More information about the Piglit
mailing list