[Piglit] [PATCH] Test implicit type conversion of out parameters.

Paul Berry stereotype441 at gmail.com
Tue Aug 2 17:34:29 PDT 2011


This patch adds four tests of the proper behavior of function out
parameters when used in a context that requires implicit type
conversion.
---
 .../spec/glsl-1.20/compiler/qualifiers/out-03.vert |   17 ++++++++++
 .../execution/qualifiers/vs-out-01.shader_test     |   27 ++++++++++++++++
 .../execution/qualifiers/vs-out-02.shader_test     |   28 +++++++++++++++++
 .../execution/qualifiers/vs-out-03.shader_test     |   32 ++++++++++++++++++++
 4 files changed, 104 insertions(+), 0 deletions(-)
 create mode 100644 tests/spec/glsl-1.20/compiler/qualifiers/out-03.vert
 create mode 100644 tests/spec/glsl-1.20/execution/qualifiers/vs-out-01.shader_test
 create mode 100644 tests/spec/glsl-1.20/execution/qualifiers/vs-out-02.shader_test
 create mode 100644 tests/spec/glsl-1.20/execution/qualifiers/vs-out-03.shader_test

diff --git a/tests/spec/glsl-1.20/compiler/qualifiers/out-03.vert b/tests/spec/glsl-1.20/compiler/qualifiers/out-03.vert
new file mode 100644
index 0000000..135333b
--- /dev/null
+++ b/tests/spec/glsl-1.20/compiler/qualifiers/out-03.vert
@@ -0,0 +1,17 @@
+/*
+ * [config]
+ * glsl_version: 1.20
+ * expect_result: pass
+ * [end_config]
+ */
+
+#version 120
+
+void f(out int x);
+
+void
+main() {
+    float x;
+    f(x);
+    gl_Position = gl_Vertex;
+}
diff --git a/tests/spec/glsl-1.20/execution/qualifiers/vs-out-01.shader_test b/tests/spec/glsl-1.20/execution/qualifiers/vs-out-01.shader_test
new file mode 100644
index 0000000..43f2721
--- /dev/null
+++ b/tests/spec/glsl-1.20/execution/qualifiers/vs-out-01.shader_test
@@ -0,0 +1,27 @@
+[require]
+GLSL >= 1.20
+
+[vertex shader]
+#version 120
+void f(out int x)
+{
+  x = 4;
+}
+
+void main()
+{
+  gl_Position = gl_Vertex;
+  float value;
+  f(value);
+  gl_FrontColor = vec4(1.0/value);
+}
+
+[fragment shader]
+void main()
+{
+  gl_FragColor = gl_Color;
+}
+
+[test]
+draw rect -1 -1 2 2
+probe all rgba 0.25 0.25 0.25 0.25
diff --git a/tests/spec/glsl-1.20/execution/qualifiers/vs-out-02.shader_test b/tests/spec/glsl-1.20/execution/qualifiers/vs-out-02.shader_test
new file mode 100644
index 0000000..3d3da7c
--- /dev/null
+++ b/tests/spec/glsl-1.20/execution/qualifiers/vs-out-02.shader_test
@@ -0,0 +1,28 @@
+[require]
+GLSL >= 1.20
+
+[vertex shader]
+#version 120
+float f(out int x)
+{
+  x = 4;
+  return 0.5;
+}
+
+void main()
+{
+  gl_Position = gl_Vertex;
+  float value1;
+  float value2 = f(value1);
+  gl_FrontColor = vec4(1.0/value1, value2, 0.0, 0.0);
+}
+
+[fragment shader]
+void main()
+{
+  gl_FragColor = gl_Color;
+}
+
+[test]
+draw rect -1 -1 2 2
+probe all rgba 0.25 0.5 0.0 0.0
diff --git a/tests/spec/glsl-1.20/execution/qualifiers/vs-out-03.shader_test b/tests/spec/glsl-1.20/execution/qualifiers/vs-out-03.shader_test
new file mode 100644
index 0000000..bc188e1
--- /dev/null
+++ b/tests/spec/glsl-1.20/execution/qualifiers/vs-out-03.shader_test
@@ -0,0 +1,32 @@
+[require]
+GLSL >= 1.20
+
+[vertex shader]
+#version 120
+float f(out int x, out int y, out float z)
+{
+  x = 4;
+  y = 5;
+  z = 0.75;
+  return 0.5;
+}
+
+void main()
+{
+  gl_Position = gl_Vertex;
+  float value1;
+  float value2;
+  float value3;
+  float value4 = f(value1, value2, value3);
+  gl_FrontColor = vec4(1.0/value1, 1.0/value2, value3, value4);
+}
+
+[fragment shader]
+void main()
+{
+  gl_FragColor = gl_Color;
+}
+
+[test]
+draw rect -1 -1 2 2
+probe all rgba 0.25 0.2 0.75 0.5
-- 
1.7.6



More information about the Piglit mailing list