[Piglit] [PATCH 8/8] arb_gpu_shader_fp64: add more tests for this spec

Andres Gomez agomez at igalia.com
Tue Mar 15 15:50:49 UTC 2016


From: "Juan A. Suarez Romero" <jasuarez at igalia.com>

Miscellaneus set of tests that checks different aspects of
GL_ARB_gpu_shader_fp64 spec.

Signed-off-by: Andres Gomez <agomez at igalia.com>
---
 tests/all.py                                       |   1 +
 .../execution/CMakeLists.gl.txt                    |   1 +
 .../execution/double-suffix-value.shader_test      |  33 ++++++
 .../execution/fs-isinf-dvec.shader_test            |  66 +++++++++++
 .../execution/fs-isnan-dvec.shader_test            |  73 ++++++++++++
 .../execution/gs-isinf-dvec.shader_test            |  96 ++++++++++++++++
 .../execution/gs-isnan-dvec.shader_test            | 104 +++++++++++++++++
 .../execution/uniform-invalid-operation.c          | 128 +++++++++++++++++++++
 .../execution/vs-constructors.shader_test          | 124 ++++++++++++++++++++
 .../execution/vs-decrement-dvec.shader_test        |  67 +++++++++++
 .../execution/vs-increment-dvec.shader_test        |  67 +++++++++++
 .../execution/vs-isinf-dvec.shader_test            |  78 +++++++++++++
 .../execution/vs-isnan-dvec.shader_test            |  85 ++++++++++++++
 13 files changed, 923 insertions(+)
 create mode 100644 tests/spec/arb_gpu_shader_fp64/execution/double-suffix-value.shader_test
 create mode 100644 tests/spec/arb_gpu_shader_fp64/execution/fs-isinf-dvec.shader_test
 create mode 100644 tests/spec/arb_gpu_shader_fp64/execution/fs-isnan-dvec.shader_test
 create mode 100644 tests/spec/arb_gpu_shader_fp64/execution/gs-isinf-dvec.shader_test
 create mode 100644 tests/spec/arb_gpu_shader_fp64/execution/gs-isnan-dvec.shader_test
 create mode 100644 tests/spec/arb_gpu_shader_fp64/execution/uniform-invalid-operation.c
 create mode 100644 tests/spec/arb_gpu_shader_fp64/execution/vs-constructors.shader_test
 create mode 100644 tests/spec/arb_gpu_shader_fp64/execution/vs-decrement-dvec.shader_test
 create mode 100644 tests/spec/arb_gpu_shader_fp64/execution/vs-increment-dvec.shader_test
 create mode 100644 tests/spec/arb_gpu_shader_fp64/execution/vs-isinf-dvec.shader_test
 create mode 100644 tests/spec/arb_gpu_shader_fp64/execution/vs-isnan-dvec.shader_test

diff --git a/tests/all.py b/tests/all.py
index 56cd7e3..b8a9d6d 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -2160,6 +2160,7 @@ with profile.group_manager(
      g(['arb_gpu_shader_fp64-gs-getuniformdv'])
      g(['arb_gpu_shader_fp64-wrong-type-setter'])
      g(['arb_gpu_shader_fp64-double_in_bool_uniform'])
+     g(['arb_gpu_shader_fp64-uniform-invalid-operation'])
 
 with profile.group_manager(
         PiglitGLTest,
diff --git a/tests/spec/arb_gpu_shader_fp64/execution/CMakeLists.gl.txt b/tests/spec/arb_gpu_shader_fp64/execution/CMakeLists.gl.txt
index ab5618c..123f898 100644
--- a/tests/spec/arb_gpu_shader_fp64/execution/CMakeLists.gl.txt
+++ b/tests/spec/arb_gpu_shader_fp64/execution/CMakeLists.gl.txt
@@ -17,3 +17,4 @@ piglit_add_executable (arb_gpu_shader_fp64-vs-getuniformdv vs-getuniformdv.c)
 piglit_add_executable (arb_gpu_shader_fp64-fs-getuniformdv fs-getuniformdv.c)
 piglit_add_executable (arb_gpu_shader_fp64-gs-getuniformdv gs-getuniformdv.c)
 piglit_add_executable (arb_gpu_shader_fp64-wrong-type-setter wrong-type-setter.c)
+piglit_add_executable (arb_gpu_shader_fp64-uniform-invalid-operation uniform-invalid-operation.c)
diff --git a/tests/spec/arb_gpu_shader_fp64/execution/double-suffix-value.shader_test b/tests/spec/arb_gpu_shader_fp64/execution/double-suffix-value.shader_test
new file mode 100644
index 0000000..4f53919
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/execution/double-suffix-value.shader_test
@@ -0,0 +1,33 @@
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader_fp64
+
+[vertex shader]
+#version 150
+#extension GL_ARB_gpu_shader_fp64 : require
+
+in vec4 piglit_vertex;
+out vec4 vscolor;
+
+void main()
+{
+  double d1 = 5.0LF;
+  double d2 = 5.0lf;
+
+  gl_Position = piglit_vertex;
+  vscolor = (d1 == d2) ? vec4(0.0, 0.0, 0.0, 0.0) : vec4(1.0, 0.0, 0.0, 0.0);
+}
+
+[fragment shader]
+#version 150
+
+in vec4 vscolor;
+out vec4 color;
+
+void main() {
+  color = vscolor;
+}
+
+[test]
+draw rect -1 -1 2 2
+probe rgba 0 0 0.0 0.0 0.0 0.0
diff --git a/tests/spec/arb_gpu_shader_fp64/execution/fs-isinf-dvec.shader_test b/tests/spec/arb_gpu_shader_fp64/execution/fs-isinf-dvec.shader_test
new file mode 100644
index 0000000..7bfbf4e
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/execution/fs-isinf-dvec.shader_test
@@ -0,0 +1,66 @@
+# Test proper behavior of the isinf(vec4) function.
+#
+# Note: testing behavior if isinf() is challenging because the GLSL
+# 1.50 spec does not explicitly define any circumstances under which
+# infinite values are required to be generated.  This test assumes
+# that the expressions 1.0*exp(1000.0) and -1.0*exp(1000.0) produce
+# infinite values when evaluated in the shader.
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader_fp64
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 150
+#extension GL_ARB_gpu_shader_fp64 : require
+
+uniform double tolerance;
+uniform dvec4 multiplier;
+uniform vec4 exponent;
+uniform dvec4 expected;
+
+void main()
+{
+  gl_FragColor = vec4(0.0);
+
+  dvec4 r4 = multiplier*exp(exponent);
+  dvec4 bl4 = dvec4(isinf(r4));
+  if (distance(bl4, expected) > tolerance) {
+     gl_FragColor.x = 1.0;
+  }
+
+  dvec3 r3 = multiplier.xyz*exp(exponent.xyz);
+  dvec3 bl3 = dvec3(isinf(r3));
+  if (distance(bl3, expected.xyz) > tolerance) {
+     gl_FragColor.y = 1.0;
+  }
+
+  dvec2 r2 = multiplier.zw*exp(exponent.zw);
+  dvec2 bl2 = dvec2(isinf(r2));
+  if (distance(bl2, expected.zw) > tolerance) {
+     gl_FragColor.z = 1.0;
+  }
+
+  double r1 = multiplier.x*exp(exponent.x);
+  double bl1 = double(isinf(r1));
+  if (distance(bl1, expected.x) > tolerance) {
+     gl_FragColor.w = 1.0;
+  }
+}
+
+[test]
+uniform double tolerance 0.0
+uniform dvec4 multiplier 1.0 1.0   -1.0   -1.0
+uniform vec4 exponent    1.0 1000.0 1000.0 1.0
+uniform dvec4 expected   0.0 1.0    1.0    0.0
+draw rect -1 -1 2 2
+probe rgba 0 0 0.0 0.0 0.0 0.0
+
+uniform double tolerance  0.0
+uniform dvec4 multiplier -1.0   -1.0 1.0 1.0
+uniform vec4 exponent     1000.0 1.0 1.0 1000.0
+uniform dvec4 expected    1.0    0.0 0.0 1.0
+draw rect -1 -1 2 2
+probe rgba 1 0 0.0 0.0 0.0 0.0
diff --git a/tests/spec/arb_gpu_shader_fp64/execution/fs-isnan-dvec.shader_test b/tests/spec/arb_gpu_shader_fp64/execution/fs-isnan-dvec.shader_test
new file mode 100644
index 0000000..0d0fea6
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/execution/fs-isnan-dvec.shader_test
@@ -0,0 +1,73 @@
+# Test proper behavior of the isnan(vec4) function.
+#
+# Note: testing behavior if isnan() is challenging because the GLSL
+# 1.50 spec does not explicitly define any circumstances under which
+# NaN values are required to be generated.  This test assumes that the
+# expression 0.0/0.0 produces a NaN value when evaluated in the
+# shader.
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader_fp64
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 150
+#extension GL_ARB_gpu_shader_fp64 : require
+
+uniform double tolerance;
+uniform dvec4 numerator;
+uniform dvec4 denominator;
+uniform dvec4 expected;
+
+void main()
+{
+  gl_FragColor = vec4(0.0);
+
+  dvec4 r4 = numerator/denominator;
+  dvec4 bl4 = dvec4(isnan(r4));
+  if (distance(bl4, expected) > tolerance) {
+     gl_FragColor.x = 1.0;
+  }
+
+  dvec3 r3 = numerator.xyz/denominator.xyz;
+  dvec3 bl3 = dvec3(isnan(r3));
+  if (distance(bl3, expected.xyz) > tolerance) {
+     gl_FragColor.y = 1.0;
+  }
+
+  dvec2 r2 = numerator.zw/denominator.zw;
+  dvec2 bl2 = dvec2(isnan(r2));
+  if (distance(bl2, expected.zw) > tolerance) {
+     gl_FragColor.z = 1.0;
+  }
+
+  double r1 = numerator.x/denominator.x;
+  double bl1 = double(isnan(r1));
+  if (distance(bl1, expected.x) > tolerance) {
+     gl_FragColor.w = 1.0;
+  }
+}
+
+[test]
+uniform double tolerance  0.0
+uniform dvec4 numerator   1.0 0.0 0.0 1.0
+uniform dvec4 denominator 1.0 0.0 0.0 1.0
+uniform dvec4 expected    0.0 1.0 1.0 0.0
+draw rect -1 -1 2 2
+probe rgba 0 0 0.0 0.0 0.0 0.0
+
+uniform double tolerance  0.0
+uniform dvec4 numerator   0.0 1.0 1.0 0.0
+uniform dvec4 denominator 0.0 1.0 1.0 0.0
+uniform dvec4 expected    1.0 0.0 0.0 1.0
+draw rect -1 -1 2 2
+probe rgba 1 0 0.0 0.0 0.0 0.0
+
+uniform double tolerance  0.0
+uniform dvec4 numerator   0.0 0.0 1.0 1.0
+uniform dvec4 denominator 0.0 1.0 1.0 0.0
+uniform dvec4 expected    1.0 0.0 0.0 0.0
+draw rect -1 -1 2 2
+probe rgba 2 0 0.0 0.0 0.0 0.0
diff --git a/tests/spec/arb_gpu_shader_fp64/execution/gs-isinf-dvec.shader_test b/tests/spec/arb_gpu_shader_fp64/execution/gs-isinf-dvec.shader_test
new file mode 100644
index 0000000..cdba59d
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/execution/gs-isinf-dvec.shader_test
@@ -0,0 +1,96 @@
+# Test proper behavior of the isinf(vec4) function.
+#
+# Note: testing behavior if isinf() is challenging because the GLSL
+# 1.50 spec does not explicitly define any circumstances under which
+# infinite values are required to be generated.  This test assumes
+# that the expressions 1.0*exp(1000.0) and -1.0*exp(1000.0) produce
+# infinite values when evaluated in the shader.
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader_fp64
+
+[vertex shader]
+#version 150
+
+in vec4 piglit_vertex;
+out vec4 vertex_to_gs;
+
+void main()
+{
+    vertex_to_gs = piglit_vertex;
+}
+
+[geometry shader]
+#version 150
+#extension GL_ARB_gpu_shader_fp64 : require
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+uniform double tolerance;
+uniform dvec4 multiplier;
+uniform vec4 exponent;
+uniform dvec4 expected;
+
+in vec4 vertex_to_gs[3];
+out vec4 fs_color;
+
+void main()
+{
+  fs_color = vec4(0.0);
+
+  dvec4 r4 = multiplier*exp(exponent);
+  dvec4 bl4 = dvec4(isinf(r4));
+  if (distance(bl4, expected) > tolerance) {
+     fs_color.x = 1.0;
+  }
+
+  dvec3 r3 = multiplier.xyz*exp(exponent.xyz);
+  dvec3 bl3 = dvec3(isinf(r3));
+  if (distance(bl3, expected.xyz) > tolerance) {
+     fs_color.y = 1.0;
+  }
+
+  dvec2 r2 = multiplier.zw*exp(exponent.zw);
+  dvec2 bl2 = dvec2(isinf(r2));
+  if (distance(bl2, expected.zw) > tolerance) {
+     fs_color.z = 1.0;
+  }
+
+  double r1 = multiplier.x*exp(exponent.x);
+  double bl1 = double(isinf(r1));
+  if (distance(bl1, expected.x) > tolerance) {
+     fs_color.w = 1.0;
+  }
+
+  for (int i = 0; i < 3; i++) {
+     gl_Position = vertex_to_gs[i];
+     EmitVertex();
+  }
+}
+
+[fragment shader]
+#version 150
+
+in vec4 fs_color;
+out vec4 color;
+
+void main() {
+  color = fs_color;
+}
+
+[test]
+uniform double tolerance 0.0
+uniform dvec4 multiplier 1.0 1.0   -1.0   -1.0
+uniform vec4 exponent    1.0 1000.0 1000.0 1.0
+uniform dvec4 expected   0.0 1.0    1.0    0.0
+draw rect -1 -1 2 2
+probe rgba 0 0 0.0 0.0 0.0 0.0
+
+uniform double tolerance  0.0
+uniform dvec4 multiplier -1.0   -1.0 1.0 1.0
+uniform vec4 exponent     1000.0 1.0 1.0 1000.0
+uniform dvec4 expected    1.0    0.0 0.0 1.0
+draw rect -1 -1 2 2
+probe rgba 1 0 0.0 0.0 0.0 0.0
diff --git a/tests/spec/arb_gpu_shader_fp64/execution/gs-isnan-dvec.shader_test b/tests/spec/arb_gpu_shader_fp64/execution/gs-isnan-dvec.shader_test
new file mode 100644
index 0000000..fd1d5c4
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/execution/gs-isnan-dvec.shader_test
@@ -0,0 +1,104 @@
+# Test proper behavior of the isnan(vec4) function.
+#
+# Note: testing behavior if isnan() is challenging because the GLSL
+# 1.50 spec does not explicitly define any circumstances under which
+# NaN values are required to be generated.  This test assumes that the
+# expression 0.0/0.0 produces a NaN value when evaluated in the
+# shader.
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader_fp64
+
+[vertex shader]
+#version 150
+
+in vec4 piglit_vertex;
+out vec4 vertex_to_gs;
+
+void main()
+{
+    vertex_to_gs = piglit_vertex;
+}
+
+
+[geometry shader]
+#version 150
+#extension GL_ARB_gpu_shader_fp64 : require
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+uniform double tolerance;
+uniform dvec4 numerator;
+uniform dvec4 denominator;
+uniform dvec4 expected;
+
+in vec4 vertex_to_gs[3];
+out vec4 fs_color;
+
+void main()
+{
+  fs_color = vec4(0.0);
+
+  dvec4 r4 = numerator/denominator;
+  dvec4 bl4 = dvec4(isnan(r4));
+  if (distance(bl4, expected) > tolerance) {
+     fs_color.x = 1.0;
+  }
+
+  dvec3 r3 = numerator.xyz/denominator.xyz;
+  dvec3 bl3 = dvec3(isnan(r3));
+  if (distance(bl3, expected.xyz) > tolerance) {
+     fs_color.y = 1.0;
+  }
+
+  dvec2 r2 = numerator.zw/denominator.zw;
+  dvec2 bl2 = dvec2(isnan(r2));
+  if (distance(bl2, expected.zw) > tolerance) {
+     fs_color.z = 1.0;
+  }
+
+  double r1 = numerator.x/denominator.x;
+  double bl1 = double(isnan(r1));
+  if (distance(bl1, expected.x) > tolerance) {
+     fs_color.w = 1.0;
+  }
+
+  for (int i = 0; i < 3; i++) {
+     gl_Position = vertex_to_gs[i];
+     EmitVertex();
+  }
+}
+
+[fragment shader]
+#version 150
+
+in vec4 fs_color;
+out vec4 color;
+
+void main() {
+  color = fs_color;
+}
+
+[test]
+uniform double tolerance  0.0
+uniform dvec4 numerator   1.0 0.0 0.0 1.0
+uniform dvec4 denominator 1.0 0.0 0.0 1.0
+uniform dvec4 expected    0.0 1.0 1.0 0.0
+draw rect -1 -1 2 2
+probe rgba 0 0 0.0 0.0 0.0 0.0
+
+uniform double tolerance  0.0
+uniform dvec4 numerator   0.0 1.0 1.0 0.0
+uniform dvec4 denominator 0.0 1.0 1.0 0.0
+uniform dvec4 expected    1.0 0.0 0.0 1.0
+draw rect -1 -1 2 2
+probe rgba 1 0 0.0 0.0 0.0 0.0
+
+uniform double tolerance  0.0
+uniform dvec4 numerator   0.0 0.0 1.0 1.0
+uniform dvec4 denominator 0.0 1.0 1.0 0.0
+uniform dvec4 expected    1.0 0.0 0.0 0.0
+draw rect -1 -1 2 2
+probe rgba 2 0 0.0 0.0 0.0 0.0
diff --git a/tests/spec/arb_gpu_shader_fp64/execution/uniform-invalid-operation.c b/tests/spec/arb_gpu_shader_fp64/execution/uniform-invalid-operation.c
new file mode 100644
index 0000000..ceaf090
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/execution/uniform-invalid-operation.c
@@ -0,0 +1,128 @@
+/*
+ * Copyright © 2016 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+/**
+ * \file uniform-invalid-operation.c
+ *
+ * From the GL_ARB_gpu_shader_fp64 spec:
+ *     "regarding INVALID_OPERATION errors in Uniform* comamnds, if the type of
+ *     the uniform declared in the shader does not match the component type and
+ *     count indicated in the Uniform* command name (where a boolean uniform
+ *     component type is considered to match any of the Uniform*i{v},
+ *     Uniform*ui{v}, or Uniform*f{v} commands)"
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+	config.supports_gl_core_version = 32;
+
+	config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static const char vs_text[] =
+   "#version 150\n"
+   "#extension GL_ARB_gpu_shader_fp64 : require\n"
+   "\n"
+   "uniform double d;\n"
+   "uniform dvec3 v;\n"
+   "uniform bool b;\n"
+   "out vec4 vscolor;\n"
+   "\n"
+   "void main()\n"
+   "{\n"
+   "  if (b)\n"
+   "    gl_Position = vec4(v, d);\n"
+   "  else\n"
+   "    gl_Position = vec4(v, 0.0);\n"
+   "  vscolor = vec4(v, d);\n"
+   "}\n";
+
+static const char fs_text[] =
+   "#version 150\n"
+   "in vec4 vscolor;\n"
+   "out vec4 fscolor;\n"
+   "void main()\n"
+   "{\n"
+   "  fscolor = vscolor;\n"
+   "}\n";
+
+enum piglit_result
+piglit_display(void)
+{
+   /* never called */
+   return PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+   bool piglit_pass = true;
+   GLuint vs, fs, prog;
+   GLint loc;
+   float vf[] = { 1.0, 2.0, 3.0 };
+   double vd[] = { 1.0, 2.0, 3.0, 4.0, 5.0};
+
+   piglit_require_extension("GL_ARB_gpu_shader_fp64");
+
+   vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_text);
+   fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_text);
+   prog = piglit_link_simple_program(vs, fs);
+
+   glUseProgram(prog);
+
+   //Setting different type should fail
+   loc = glGetUniformLocation(prog, "d");
+   glUniform1i(loc, 3);
+   piglit_pass = piglit_pass && piglit_check_gl_error(GL_INVALID_OPERATION);
+   glUniform1f(loc, 3.0);
+   piglit_pass = piglit_pass && piglit_check_gl_error(GL_INVALID_OPERATION);
+   glUniform1d(loc, 3.0);
+   piglit_pass = piglit_pass && piglit_check_gl_error(GL_NO_ERROR);
+
+   loc = glGetUniformLocation(prog, "v");
+   glUniform3fv(loc, 1, vf);
+   piglit_pass = piglit_pass && piglit_check_gl_error(GL_INVALID_OPERATION);
+   glUniform3d(loc, vd[0], vd[1], vd[2]);
+   piglit_pass = piglit_pass && piglit_check_gl_error(GL_NO_ERROR);
+
+   //Setting different size should fail
+   loc = glGetUniformLocation(prog, "v");
+   glUniform2d(loc, vd[0], vd[1]);
+   piglit_pass = piglit_pass && piglit_check_gl_error(GL_INVALID_OPERATION);
+   glUniform4d(loc, vd[0], vd[1], vd[2], vd[3]);
+   piglit_pass = piglit_pass && piglit_check_gl_error(GL_INVALID_OPERATION);
+   glUniform3d(loc, vd[0], vd[1], vd[2]);
+   piglit_pass = piglit_pass && piglit_check_gl_error(GL_NO_ERROR);
+
+   //Special case for booleans
+   loc = glGetUniformLocation(prog, "b");
+   glUniform1d(loc, 1.0);
+   piglit_pass = piglit_pass && piglit_check_gl_error(GL_INVALID_OPERATION);
+   glUniform1f(loc, 1.0);
+   piglit_pass = piglit_pass && piglit_check_gl_error(GL_NO_ERROR);
+
+   piglit_report_result(piglit_pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
diff --git a/tests/spec/arb_gpu_shader_fp64/execution/vs-constructors.shader_test b/tests/spec/arb_gpu_shader_fp64/execution/vs-constructors.shader_test
new file mode 100644
index 0000000..cd28c80
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/execution/vs-constructors.shader_test
@@ -0,0 +1,124 @@
+# test truncating a double holds precision
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader_fp64
+
+[vertex shader]
+#version 150
+#extension GL_ARB_gpu_shader_fp64 : require
+
+in vec4 vertex;
+out vec4 cc;
+
+void main()
+{
+  double d1 = 8.0lf;
+  double d2 = 5.0lf;
+  dvec2 v2_1 = dvec2(2.0, 3.0);
+  dvec2 v2_2 = dvec2(4.0, 5.0);
+  dvec3 v3_1 = dvec3(80.0, 81.0, 82.0);
+  dvec3 v3_2 = dvec3(11.0, 12.0, 13.0);
+  dvec3 v3_3 = dvec3(15.0, 16.0, 17.0);
+  dvec4 v4_1 = dvec4(16.0, 17.0, 18.0, 19.0);
+  dvec4 v4_2 = dvec4(20.0, 21.0, 22.0, 23.0);
+  dvec4 v4_3 = dvec4(24.0, 25.0, 26.0, 27.0);
+  dvec4 v4_4 = dvec4(38.0, 39.0, 40.0, 41.0);
+  dmat2 m2 = dmat2(50.0, 51.0, 52.0, 53.0);
+
+  cc = vec4(0.0, 0.0, 0.0, 0.0);
+
+  dmat2 expected_m2 = dmat2(2.0, 3.0, 4.0, 5.0);
+  dmat2 real_m2 = dmat2(v2_1, v2_2);
+  if (expected_m2 != real_m2)
+    cc = vec4(0.5, 0.0, 0.0, 0.0);
+  
+  dmat3 expected_m3_1 = dmat3(8.0, 0.0, 0.0,
+                              0.0, 8.0, 0.0,
+                              0.0, 0.0, 8.0);
+  dmat3 real_m3_1 = dmat3(d1);
+  if (expected_m3_1 != real_m3_1)
+    cc = vec4(1.0, 0.0, 0.0, 0.0);
+
+  dmat3 expected_m3_2 = dmat3(80.0, 81.0, 82.0,
+                              11.0, 12.0, 13.0,
+                              15.0, 16.0, 17.0);
+  dmat3 real_m3_2 = dmat3(v3_1, v3_2, v3_3);
+  if (expected_m3_2 != real_m3_2)
+    cc = vec4(0.0, 1.0, 0.0, 0.0);
+
+  dmat4 expected_m4_1 = dmat4(16.0, 17.0, 18.0, 19.0,
+                              20.0, 21.0, 22.0, 23.0,
+                              24.0, 25.0, 26.0, 27.0,
+                              38.0, 39.0, 40.0, 41.0);
+  dmat4 real_m4_1 = dmat4(v4_1, v4_2, v4_3, v4_4);
+  if (expected_m4_1 != real_m4_1)
+    cc = vec4(0.0, 0.0, 1.0, 0.0);
+
+  dmat4 expected_m4_2 = dmat4(50.0, 51.0, 0.0, 0.0,
+                              52.0, 53.0, 0.0, 0.0,
+                              0.0, 0.0, 1.0, 0.0,
+                              0.0, 0.0, 0.0, 1.0);
+  dmat4 real_m4_2 = dmat4(m2);
+  if (expected_m4_2 != real_m4_2)
+    cc = vec4(0.0, 0.0, 0.0, 1.0);
+
+  dmat2x4 expected_m2x4_1 = dmat2x4(80.0, 81.0, 82.0, 8.0,
+                                    5.0, 11.0, 12.0, 13.0);
+  dmat2x4 real_m2x4_1 = dmat2x4(v3_1, d1, d2, v3_2);
+  if (expected_m2x4_1 != real_m2x4_1)
+    cc = vec4(1.0, 1.0, 0.0, 0.0);
+
+  dmat2x4 expected_m2x4_2 = dmat2x4(16.0, 17.0, 18.0, 19.0,
+                                    20.0, 21.0, 22.0, 23.0);
+  dmat2x4 real_m2x4_2 = dmat2x4(v4_1, v4_2);
+  if (expected_m2x4_2 != real_m2x4_2)
+    cc = vec4(1.0, 0.0, 1.0, 0.0);
+
+  dvec3 expected_v3_1 = dvec3(8.0, 8.0, 8.0);
+  dvec3 real_v3_1 = dvec3(d1);
+  if (expected_v3_1 != real_v3_1)
+    cc = vec4(1.0, 0.0, 0.0, 1.0);
+
+  dvec3 expected_v3_2 = dvec3(8.0, 2.0, 3.0);
+  dvec3 real_v3_2 = dvec3(d1, v2_1);
+  if (expected_v3_2 != real_v3_2)
+    cc = vec4(1.0, 1.0, 1.0, 0.0);
+
+  dvec3 expected_v3_3 = dvec3(16.0, 17.0, 18.0);
+  dvec3 real_v3_3 = dvec3(v4_1);
+  if (expected_v3_3 != real_v3_3)
+    cc = vec4(1.0, 1.0, 1.0, 1.0);
+
+  dvec3 expected_v4_4 = dvec3(50.0, 51.0, 52.0);
+  dvec3 real_v4_4 = dvec3(m2);
+  if (expected_v4_4 != real_v4_4)
+    cc = vec4(0.0, 0.5, 0.0, 1.0);
+
+  gl_Position = vertex;
+}
+
+[fragment shader]
+#version 150
+#extension GL_ARB_gpu_shader_fp64 : require
+
+uniform double tolerance;
+uniform double expected;
+
+in vec4 cc;
+out vec4 color;
+
+void main()
+{
+  color = cc;
+}
+
+[vertex data]
+vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+ 1.0  1.0
+-1.0  1.0
+
+[test]
+draw arrays GL_TRIANGLE_FAN 0 4
+probe rgba 0 0 0.0 0.0 0.0 0.0
diff --git a/tests/spec/arb_gpu_shader_fp64/execution/vs-decrement-dvec.shader_test b/tests/spec/arb_gpu_shader_fp64/execution/vs-decrement-dvec.shader_test
new file mode 100644
index 0000000..616a124
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/execution/vs-decrement-dvec.shader_test
@@ -0,0 +1,67 @@
+# Test proper behavior of the unary '--' operator.
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader_fp64
+
+[vertex shader]
+#version 150
+#extension GL_ARB_gpu_shader_fp64 : require
+
+uniform double tolerance;
+uniform dvec4 starting_value;
+uniform dvec4 expected4;
+uniform dvec3 expected3;
+uniform dvec2 expected2;
+uniform double expected1;
+
+in vec4 piglit_vertex;
+out vec4 vscolor;
+
+void main()
+{
+  gl_Position = piglit_vertex;
+  vscolor = vec4(0.0);
+  dvec4 starting_point = starting_value;
+
+  dvec4 result4 = starting_point--;
+  if (distance(result4, expected4) > tolerance) {
+    vscolor.x = 1.0;
+  }
+
+  dvec3 result3 = --starting_point.xyz;
+  if (distance(result3, expected3) > tolerance) {
+    vscolor.y = 1.0;
+  }
+
+  dvec2 result2 = starting_point.zw--;
+  if (distance(result2, expected2) > tolerance) {
+    vscolor.z = 1.0;
+  }
+
+  double result1 = --starting_point.x;
+  if (distance(result1, expected1) > tolerance) {
+    vscolor.w = 1.0;
+  }
+}
+
+[fragment shader]
+#version 150
+
+in vec4 vscolor;
+out vec4 color;
+
+void main() {
+  color = vscolor;
+}
+
+[test]
+uniform double tolerance 0.0
+uniform dvec4 starting_value 0.0 1.0 1.25 0.75
+uniform dvec4 expected4 0.0 1.0 1.25 0.75
+uniform dvec3 expected3 -2.0 -1.0 -0.75
+uniform dvec2 expected2 -0.75 -0.25
+uniform double expected1 -3.0
+
+draw rect -1 -1 2 2
+probe rgba 0 0 0.0 0.0 0.0 0.0
diff --git a/tests/spec/arb_gpu_shader_fp64/execution/vs-increment-dvec.shader_test b/tests/spec/arb_gpu_shader_fp64/execution/vs-increment-dvec.shader_test
new file mode 100644
index 0000000..9ebacba
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/execution/vs-increment-dvec.shader_test
@@ -0,0 +1,67 @@
+# Test proper behavior of the unary '++' operator.
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader_fp64
+
+[vertex shader]
+#version 150
+#extension GL_ARB_gpu_shader_fp64 : require
+
+uniform double tolerance;
+uniform dvec4 starting_value;
+uniform dvec4 expected4;
+uniform dvec3 expected3;
+uniform dvec2 expected2;
+uniform double expected1;
+
+in vec4 piglit_vertex;
+out vec4 vscolor;
+
+void main()
+{
+  gl_Position = piglit_vertex;
+  vscolor = vec4(0.0);
+  dvec4 starting_point = starting_value;
+
+  dvec4 result4 = starting_point++;
+  if (distance(result4, expected4) > tolerance) {
+    vscolor.x = 1.0;
+  }
+
+  dvec3 result3 = ++starting_point.xyz;
+  if (distance(result3, expected3) > tolerance) {
+    vscolor.y = 1.0;
+  }
+
+  dvec2 result2 = starting_point.zw++;
+  if (distance(result2, expected2) > tolerance) {
+    vscolor.z = 1.0;
+  }
+
+  double result1 = ++starting_point.x;
+  if (distance(result1, expected1) > tolerance) {
+    vscolor.w = 1.0;
+  }
+}
+
+[fragment shader]
+#version 150
+
+in vec4 vscolor;
+out vec4 color;
+
+void main() {
+  color = vscolor;
+}
+
+[test]
+uniform double tolerance 0.0
+uniform dvec4 starting_value 0.0 1.0 1.25 0.75
+uniform dvec4 expected4 0.0 1.0 1.25 0.75
+uniform dvec3 expected3 2.0 3.0 3.25
+uniform dvec2 expected2 3.25 1.75
+uniform double expected1 3.0
+
+draw rect -1 -1 2 2
+probe rgba 0 0 0.0 0.0 0.0 0.0
diff --git a/tests/spec/arb_gpu_shader_fp64/execution/vs-isinf-dvec.shader_test b/tests/spec/arb_gpu_shader_fp64/execution/vs-isinf-dvec.shader_test
new file mode 100644
index 0000000..23d21ad
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/execution/vs-isinf-dvec.shader_test
@@ -0,0 +1,78 @@
+# Test proper behavior of the isinf(vec4) function.
+#
+# Note: testing behavior if isinf() is challenging because the GLSL
+# 1.50 spec does not explicitly define any circumstances under which
+# infinite values are required to be generated.  This test assumes
+# that the expressions 1.0*exp(1000.0) and -1.0*exp(1000.0) produce
+# infinite values when evaluated in the shader.
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader_fp64
+
+[vertex shader]
+#version 150
+#extension GL_ARB_gpu_shader_fp64 : require
+
+uniform double tolerance;
+uniform dvec4 multiplier;
+uniform vec4 exponent;
+uniform dvec4 expected;
+
+in vec4 piglit_vertex;
+out vec4 vscolor;
+
+void main()
+{
+  gl_Position = piglit_vertex;
+  vscolor = vec4(0.0);
+
+  dvec4 r4 = multiplier*exp(exponent);
+  dvec4 bl4 = dvec4(isinf(r4));
+  if (distance(bl4, expected) > tolerance) {
+     vscolor.x = 1.0;
+  }
+
+  dvec3 r3 = multiplier.xyz*exp(exponent.xyz);
+  dvec3 bl3 = dvec3(isinf(r3));
+  if (distance(bl3, expected.xyz) > tolerance) {
+     vscolor.y = 1.0;
+  }
+
+  dvec2 r2 = multiplier.zw*exp(exponent.zw);
+  dvec2 bl2 = dvec2(isinf(r2));
+  if (distance(bl2, expected.zw) > tolerance) {
+     vscolor.z = 1.0;
+  }
+
+  double r1 = multiplier.x*exp(exponent.x);
+  double bl1 = double(isinf(r1));
+  if (distance(bl1, expected.x) > tolerance) {
+     vscolor.w = 1.0;
+  }
+}
+
+[fragment shader]
+#version 150
+
+in vec4 vscolor;
+out vec4 color;
+
+void main() {
+  color = vscolor;
+}
+
+[test]
+uniform double tolerance 0.0
+uniform dvec4 multiplier 1.0 1.0   -1.0   -1.0
+uniform vec4 exponent    1.0 1000.0 1000.0 1.0
+uniform dvec4 expected   0.0 1.0    1.0    0.0
+draw rect -1 -1 2 2
+probe rgba 0 0 0.0 0.0 0.0 0.0
+
+uniform double tolerance  0.0
+uniform dvec4 multiplier -1.0   -1.0 1.0 1.0
+uniform vec4 exponent     1000.0 1.0 1.0 1000.0
+uniform dvec4 expected    1.0    0.0 0.0 1.0
+draw rect -1 -1 2 2
+probe rgba 1 0 0.0 0.0 0.0 0.0
diff --git a/tests/spec/arb_gpu_shader_fp64/execution/vs-isnan-dvec.shader_test b/tests/spec/arb_gpu_shader_fp64/execution/vs-isnan-dvec.shader_test
new file mode 100644
index 0000000..0adf430
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/execution/vs-isnan-dvec.shader_test
@@ -0,0 +1,85 @@
+# Test proper behavior of the isnan(vec4) function.
+#
+# Note: testing behavior if isnan() is challenging because the GLSL
+# 1.50 spec does not explicitly define any circumstances under which
+# NaN values are required to be generated.  This test assumes that the
+# expression 0.0/0.0 produces a NaN value when evaluated in the
+# shader.
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader_fp64
+
+[vertex shader]
+#version 150
+#extension GL_ARB_gpu_shader_fp64 : require
+
+uniform double tolerance;
+uniform dvec4 numerator;
+uniform dvec4 denominator;
+uniform dvec4 expected;
+
+in vec4 piglit_vertex;
+out vec4 vscolor;
+
+void main()
+{
+  gl_Position = piglit_vertex;
+  vscolor = vec4(0.0);
+
+  dvec4 r4 = numerator/denominator;
+  dvec4 bl4 = dvec4(isnan(r4));
+  if (distance(bl4, expected) > tolerance) {
+     vscolor.x = 1.0;
+  }
+
+  dvec3 r3 = numerator.xyz/denominator.xyz;
+  dvec3 bl3 = dvec3(isnan(r3));
+  if (distance(bl3, expected.xyz) > tolerance) {
+     vscolor.y = 1.0;
+  }
+
+  dvec2 r2 = numerator.zw/denominator.zw;
+  dvec2 bl2 = dvec2(isnan(r2));
+  if (distance(bl2, expected.zw) > tolerance) {
+     vscolor.z = 1.0;
+  }
+
+  double r1 = numerator.x/denominator.x;
+  double bl1 = double(isnan(r1));
+  if (distance(bl1, expected.x) > tolerance) {
+     vscolor.w = 1.0;
+  }
+}
+
+[fragment shader]
+#version 150
+
+in vec4 vscolor;
+out vec4 color;
+
+void main() {
+  color = vscolor;
+}
+
+[test]
+uniform double tolerance  0.0
+uniform dvec4 numerator   1.0 0.0 0.0 1.0
+uniform dvec4 denominator 1.0 0.0 0.0 1.0
+uniform dvec4 expected    0.0 1.0 1.0 0.0
+draw rect -1 -1 2 2
+probe rgba 0 0 0.0 0.0 0.0 0.0
+
+uniform double tolerance  0.0
+uniform dvec4 numerator   0.0 1.0 1.0 0.0
+uniform dvec4 denominator 0.0 1.0 1.0 0.0
+uniform dvec4 expected    1.0 0.0 0.0 1.0
+draw rect -1 -1 2 2
+probe rgba 1 0 0.0 0.0 0.0 0.0
+
+uniform double tolerance  0.0
+uniform dvec4 numerator   0.0 0.0 1.0 1.0
+uniform dvec4 denominator 0.0 1.0 1.0 0.0
+uniform dvec4 expected    1.0 0.0 0.0 0.0
+draw rect -1 -1 2 2
+probe rgba 2 0 0.0 0.0 0.0 0.0
-- 
2.1.0



More information about the Piglit mailing list