summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Iglesias Gonsálvez <siglesias@igalia.com>2016-04-11 08:16:40 (GMT)
committerSamuel Iglesias Gonsálvez <siglesias@igalia.com>2016-05-14 08:17:01 (GMT)
commitc956a3ff324378022fb3d64553a17be349e3460c (patch)
tree0da9eba41ce225b4d674bb608e4ea833af26856b
parent35469c1b05bb3c3d692a2abe4ebbff9e3fb64c88 (diff)
downloadpiglit-c956a3ff324378022fb3d64553a17be349e3460c.tar.gz
piglit-c956a3ff324378022fb3d64553a17be349e3460c.tar.xz
arb_gpu_shader_fp64: Add tests to check non-uniform-control-flow writes
They are use to detect if a bug in i965 driver related to operations working with doubles under non-uniform control flow is still happening. v2: - Remove empty lines, fix GLSL versions and minor changes (Andrés) Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com> Reviewed-by: Andres Gomez <agomez@igalia.com>
-rw-r--r--tests/all.py10
-rw-r--r--tests/spec/arb_gpu_shader_fp64/CMakeLists.gl.txt10
-rw-r--r--tests/spec/arb_gpu_shader_fp64/fs-non-uniform-control-flow-alu.c147
-rw-r--r--tests/spec/arb_gpu_shader_fp64/fs-non-uniform-control-flow-const.c129
-rw-r--r--tests/spec/arb_gpu_shader_fp64/fs-non-uniform-control-flow-packing.c147
-rw-r--r--tests/spec/arb_gpu_shader_fp64/fs-non-uniform-control-flow-ssbo.c149
-rw-r--r--tests/spec/arb_gpu_shader_fp64/fs-non-uniform-control-flow-ubo.c148
-rw-r--r--tests/spec/arb_gpu_shader_fp64/vs-non-uniform-control-flow-alu.c179
-rw-r--r--tests/spec/arb_gpu_shader_fp64/vs-non-uniform-control-flow-const.c161
-rw-r--r--tests/spec/arb_gpu_shader_fp64/vs-non-uniform-control-flow-packing.c179
-rw-r--r--tests/spec/arb_gpu_shader_fp64/vs-non-uniform-control-flow-ssbo.c175
-rw-r--r--tests/spec/arb_gpu_shader_fp64/vs-non-uniform-control-flow-ubo.c176
12 files changed, 1610 insertions, 0 deletions
diff --git a/tests/all.py b/tests/all.py
index 54d57ef..97ce02a 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -2171,6 +2171,16 @@ with profile.group_manager(
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'])
+ g(['arb_gpu_shader_fp64-vs-non-uniform-control-flow-const'])
+ g(['arb_gpu_shader_fp64-fs-non-uniform-control-flow-const'])
+ g(['arb_gpu_shader_fp64-vs-non-uniform-control-flow-ubo'])
+ g(['arb_gpu_shader_fp64-fs-non-uniform-control-flow-ubo'])
+ g(['arb_gpu_shader_fp64-vs-non-uniform-control-flow-ssbo'])
+ g(['arb_gpu_shader_fp64-fs-non-uniform-control-flow-ssbo'])
+ g(['arb_gpu_shader_fp64-vs-non-uniform-control-flow-alu'])
+ g(['arb_gpu_shader_fp64-fs-non-uniform-control-flow-alu'])
+ g(['arb_gpu_shader_fp64-vs-non-uniform-control-flow-packing'])
+ g(['arb_gpu_shader_fp64-fs-non-uniform-control-flow-packing'])
with profile.group_manager(
PiglitGLTest,
diff --git a/tests/spec/arb_gpu_shader_fp64/CMakeLists.gl.txt b/tests/spec/arb_gpu_shader_fp64/CMakeLists.gl.txt
index 84601b7..209442f 100644
--- a/tests/spec/arb_gpu_shader_fp64/CMakeLists.gl.txt
+++ b/tests/spec/arb_gpu_shader_fp64/CMakeLists.gl.txt
@@ -9,3 +9,13 @@ link_libraries (
)
piglit_add_executable (arb_gpu_shader_fp64-double_in_bool_uniform double_in_bool_uniform.c)
+piglit_add_executable (arb_gpu_shader_fp64-fs-non-uniform-control-flow-ssbo fs-non-uniform-control-flow-ssbo.c)
+piglit_add_executable (arb_gpu_shader_fp64-vs-non-uniform-control-flow-ssbo vs-non-uniform-control-flow-ssbo.c)
+piglit_add_executable (arb_gpu_shader_fp64-fs-non-uniform-control-flow-const fs-non-uniform-control-flow-const.c)
+piglit_add_executable (arb_gpu_shader_fp64-vs-non-uniform-control-flow-const vs-non-uniform-control-flow-const.c)
+piglit_add_executable (arb_gpu_shader_fp64-fs-non-uniform-control-flow-ubo fs-non-uniform-control-flow-ubo.c)
+piglit_add_executable (arb_gpu_shader_fp64-vs-non-uniform-control-flow-ubo vs-non-uniform-control-flow-ubo.c)
+piglit_add_executable (arb_gpu_shader_fp64-fs-non-uniform-control-flow-alu fs-non-uniform-control-flow-alu.c)
+piglit_add_executable (arb_gpu_shader_fp64-vs-non-uniform-control-flow-alu vs-non-uniform-control-flow-alu.c)
+piglit_add_executable (arb_gpu_shader_fp64-fs-non-uniform-control-flow-packing fs-non-uniform-control-flow-packing.c)
+piglit_add_executable (arb_gpu_shader_fp64-vs-non-uniform-control-flow-packing vs-non-uniform-control-flow-packing.c)
diff --git a/tests/spec/arb_gpu_shader_fp64/fs-non-uniform-control-flow-alu.c b/tests/spec/arb_gpu_shader_fp64/fs-non-uniform-control-flow-alu.c
new file mode 100644
index 0000000..98eb3b4
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/fs-non-uniform-control-flow-alu.c
@@ -0,0 +1,147 @@
+/*
+ * 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 fs-non-uniform-control-flow-alu.c
+ *
+ * It that checks the double ALU ops work correctly when they are
+ * under non-uniform control flow.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+ config.window_width = 62;
+ config.window_height = 62;
+ config.supports_gl_compat_version = 32;
+ config.supports_gl_core_version = 32;
+ config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+PIGLIT_GL_TEST_CONFIG_END
+
+static const char vs_pass_thru_text[] =
+ "#version 130\n"
+ "\n"
+ "in vec4 piglit_vertex;\n"
+ "void main() {\n"
+ " gl_Position = piglit_vertex;\n"
+ "}\n";
+
+static const char fs_source[] =
+ "#version 150\n"
+ "#extension GL_ARB_gpu_shader_fp64 : require\n"
+ "\n"
+ "out vec4 color;\n"
+ "\n"
+ "uniform dvec2 u0;\n"
+ "uniform dvec2 u1;\n"
+ "\n"
+ "void main() {\n"
+ " int cx = int(gl_FragCoord.x) / 31;\n"
+ " int cy = int(gl_FragCoord.y) / 31;\n"
+ " dvec2 rg;\n"
+ " if ((cx + cy) % 2 == 0) {\n"
+ " dvec2 tmp0 = 4.0lf * (floor(u0) - dvec2(0.75, 0.0lf));\n"
+ " tmp0.y = max(tmp0.y - 2, 0);\n"
+ " rg = tmp0;\n"
+ " } else {\n"
+ " double tmp0 = mod(u1.y, 4.0lf);\n"
+ " tmp0 += 3.0lf / 4.0lf + 0.25lf;\n"
+ " rg = dvec2(u1.x, tmp0 - 1.0);\n"
+ " }\n"
+ " color = vec4(rg, 0, 1);\n"
+ "}\n";
+
+GLuint prog, fbo;
+
+void
+piglit_init(int argc, char **argv)
+{
+ GLuint u0, u1;
+ double d0[2] = {1.4, 0.2};
+ double d1[2] = {0.0, 5.0};
+
+ piglit_require_extension("GL_ARB_gpu_shader_fp64");
+
+ piglit_require_GLSL_version(150);
+
+ prog = piglit_build_simple_program(vs_pass_thru_text, fs_source);
+
+ glUseProgram(prog);
+
+ u0 = glGetUniformLocation(prog, "u0");
+ u1 = glGetUniformLocation(prog, "u1");
+
+ glUniform2dv(u0, 1, d0);
+ glUniform2dv(u1, 1, d1);
+
+ glClearColor(0, 0, 0, 1);
+
+ if (!piglit_check_gl_error(GL_NO_ERROR))
+ piglit_report_result(PIGLIT_FAIL);
+}
+
+enum piglit_result piglit_display(void)
+{
+ bool pass = true;
+ const int num_pixels = piglit_width * piglit_height;
+ float *srcPixels = malloc(num_pixels * 4 * sizeof(float));
+ float expected[4];
+ int i, j;
+
+ glViewport(0, 0, piglit_width, piglit_height);
+ glUseProgram(prog);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ piglit_draw_rect(-1, -1, 2, 2);
+
+ glReadPixels(0, 0, piglit_width, piglit_height,
+ GL_RGBA, GL_FLOAT, srcPixels);
+
+ /* Verify */
+ for (i = 0; i < piglit_height; i++) {
+ for (j = 0; j < piglit_width; j++) {
+ int cx = j / 31;
+ int cy = i / 31;
+ int pos = (i * piglit_width + j) * 4;
+ if ((cx + cy) % 2 != 0) {
+ expected[0] = 0.0;
+ expected[1] = 1.0;
+ expected[2] = 0.0;
+ expected[3] = 1.0;
+ } else {
+ expected[0] = 1.0;
+ expected[1] = 0.0;
+ expected[2] = 0.0;
+ expected[3] = 1.0;
+ }
+
+ pass = piglit_compare_pixels(j, i, expected,
+ srcPixels + pos,
+ piglit_tolerance,
+ 4) && pass;
+ }
+ }
+ piglit_present_results();
+ free(srcPixels);
+
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
diff --git a/tests/spec/arb_gpu_shader_fp64/fs-non-uniform-control-flow-const.c b/tests/spec/arb_gpu_shader_fp64/fs-non-uniform-control-flow-const.c
new file mode 100644
index 0000000..f920dec
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/fs-non-uniform-control-flow-const.c
@@ -0,0 +1,129 @@
+/*
+ * 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 fs-non-uniform-control-flow-const.c
+ *
+ * Checks that constant writes to double type variables in GLSL
+ * work correctly when they are under non-uniform control flow.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+ config.window_width = 62;
+ config.window_height = 62;
+ config.supports_gl_compat_version = 32;
+ config.supports_gl_core_version = 32;
+ config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+PIGLIT_GL_TEST_CONFIG_END
+
+static const char vs_pass_thru_text[] =
+ "#version 130\n"
+ "\n"
+ "in vec4 piglit_vertex;\n"
+ "void main() {\n"
+ " gl_Position = piglit_vertex;\n"
+ "}\n";
+
+static const char fs_source[] =
+ "#version 150\n"
+ "#extension GL_ARB_gpu_shader_fp64 : require\n"
+ "\n"
+ "out vec4 color;\n"
+ "\n"
+ "void main() {\n"
+ " int cx = int(gl_FragCoord.x) / 31;\n"
+ " int cy = int(gl_FragCoord.y) / 31;\n"
+ " dvec2 colord;\n"
+ " if ((cx + cy) % 2 == 0)\n"
+ " colord = dvec2(1.0lf, 0.0lf);\n"
+ " else\n"
+ " colord = dvec2(0.0lf, 1.0lf);\n"
+ " color = vec4(colord, 0, 1);\n"
+ "}\n";
+
+GLuint prog;
+
+void
+piglit_init(int argc, char **argv)
+{
+ piglit_require_extension("GL_ARB_gpu_shader_fp64");
+
+ piglit_require_GLSL_version(150);
+
+ prog = piglit_build_simple_program(vs_pass_thru_text, fs_source);
+
+ glUseProgram(prog);
+
+ glClearColor(0, 0, 0, 1);
+
+ if (!piglit_check_gl_error(GL_NO_ERROR))
+ piglit_report_result(PIGLIT_FAIL);
+}
+
+enum piglit_result piglit_display(void)
+{
+ bool pass = true;
+ const int num_pixels = piglit_width * piglit_height;
+ float *srcPixels = malloc(num_pixels * 4 * sizeof(float));
+ float expected[4];
+ int i, j;
+
+ glViewport(0, 0, piglit_width, piglit_height);
+ glUseProgram(prog);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ piglit_draw_rect(-1, -1, 2, 2);
+
+ glReadPixels(0, 0, piglit_width, piglit_height,
+ GL_RGBA, GL_FLOAT, srcPixels);
+
+ /* Verify */
+ for (i = 0; i < piglit_height; i++) {
+ for (j = 0; j < piglit_width; j++) {
+ int cx = j / 31;
+ int cy = i / 31;
+ int pos = (i * piglit_width + j) * 4;
+ if ((cx + cy) % 2 != 0) {
+ expected[0] = 0.0;
+ expected[1] = 1.0;
+ expected[2] = 0.0;
+ expected[3] = 1.0;
+ } else {
+ expected[0] = 1.0;
+ expected[1] = 0.0;
+ expected[2] = 0.0;
+ expected[3] = 1.0;
+ }
+
+ pass = piglit_compare_pixels(j, i, expected,
+ srcPixels + pos,
+ piglit_tolerance,
+ 4) && pass;
+ }
+ }
+ piglit_present_results();
+ free(srcPixels);
+
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
diff --git a/tests/spec/arb_gpu_shader_fp64/fs-non-uniform-control-flow-packing.c b/tests/spec/arb_gpu_shader_fp64/fs-non-uniform-control-flow-packing.c
new file mode 100644
index 0000000..1be8067
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/fs-non-uniform-control-flow-packing.c
@@ -0,0 +1,147 @@
+/*
+ * 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 fs-non-uniform-control-flow-packing.c
+ *
+ * Test that checks the double packing ops work correctly when they are
+ * under non-uniform control flow.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+ config.window_width = 62;
+ config.window_height = 62;
+ config.supports_gl_compat_version = 32;
+ config.supports_gl_core_version = 32;
+ config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+PIGLIT_GL_TEST_CONFIG_END
+
+static const char vs_pass_thru_text[] =
+ "#version 130\n"
+ "\n"
+ "in vec4 piglit_vertex;\n"
+ "void main() {\n"
+ " gl_Position = piglit_vertex;\n"
+ "}\n";
+
+static const char fs_source[] =
+ "#version 150\n"
+ "#extension GL_ARB_gpu_shader_fp64 : require\n"
+ "\n"
+ "out vec4 color;\n"
+ "\n"
+ "uniform uvec2 u0;\n"
+ "uniform uvec2 u1;\n"
+ "\n"
+ "void main() {\n"
+ " int cx = int(gl_FragCoord.x) / 31;\n"
+ " int cy = int(gl_FragCoord.y) / 31;\n"
+ " dvec2 rg;\n"
+ " if ((cx + cy) % 2 == 0) {\n"
+ " double tmp0 = packDouble2x32(u0) - 2.0lf;\n"
+ " double tmp1 = packDouble2x32(u1);\n"
+ " rg = dvec2(tmp1, tmp0);\n"
+ " } else {\n"
+ " double tmp0 = packDouble2x32(u0) - 2.0lf;\n"
+ " double tmp1 = packDouble2x32(u1);\n"
+ " rg = dvec2(tmp0, tmp1);\n"
+ " }\n"
+ " color = vec4(rg, 0, 1);\n"
+ "}\n";
+
+GLuint prog;
+
+void
+piglit_init(int argc, char **argv)
+{
+ GLuint u0, u1;
+ uint d0[2] = {0x0, 0x40000000};
+ uint d1[2] = {0x0, 0x3FF00000};
+
+ piglit_require_extension("GL_ARB_gpu_shader_fp64");
+
+ piglit_require_GLSL_version(150);
+
+ prog = piglit_build_simple_program(vs_pass_thru_text, fs_source);
+
+ glUseProgram(prog);
+
+ u0 = glGetUniformLocation(prog, "u0");
+ u1 = glGetUniformLocation(prog, "u1");
+
+ glUniform2uiv(u0, 1, d0);
+ glUniform2uiv(u1, 1, d1);
+
+ glClearColor(0, 0, 0, 1);
+
+ if (!piglit_check_gl_error(GL_NO_ERROR))
+ piglit_report_result(PIGLIT_FAIL);
+}
+
+enum piglit_result piglit_display(void)
+{
+ bool pass = true;
+ const int num_pixels = piglit_width * piglit_height;
+ float *srcPixels = malloc(num_pixels * 4 * sizeof(float));
+ float expected[4];
+ int i, j;
+
+ glViewport(0, 0, piglit_width, piglit_height);
+ glUseProgram(prog);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ piglit_draw_rect(-1, -1, 2, 2);
+
+ glReadPixels(0, 0, piglit_width, piglit_height,
+ GL_RGBA, GL_FLOAT, srcPixels);
+
+ /* Verify */
+ for (i = 0; i < piglit_height; i++) {
+ for (j = 0; j < piglit_width; j++) {
+ int cx = j / 31;
+ int cy = i / 31;
+ int pos = (i * piglit_width + j) * 4;
+ if ((cx + cy) % 2 != 0) {
+ expected[0] = 0.0;
+ expected[1] = 1.0;
+ expected[2] = 0.0;
+ expected[3] = 1.0;
+ } else {
+ expected[0] = 1.0;
+ expected[1] = 0.0;
+ expected[2] = 0.0;
+ expected[3] = 1.0;
+ }
+
+ pass = piglit_compare_pixels(j, i, expected,
+ srcPixels + pos,
+ piglit_tolerance,
+ 4) && pass;
+ }
+ }
+ piglit_present_results();
+ free(srcPixels);
+
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
diff --git a/tests/spec/arb_gpu_shader_fp64/fs-non-uniform-control-flow-ssbo.c b/tests/spec/arb_gpu_shader_fp64/fs-non-uniform-control-flow-ssbo.c
new file mode 100644
index 0000000..5ab036a
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/fs-non-uniform-control-flow-ssbo.c
@@ -0,0 +1,149 @@
+/*
+ * 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 fs-non-uniform-control-flow-ssbo.c
+ *
+ * It checks that shader storage block writes to double type variables in GLSL
+ * works correctly when the writes are under non-uniform control flow.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+ config.window_width = 62;
+ config.window_height = 62;
+ config.supports_gl_compat_version = 32;
+ config.supports_gl_core_version = 32;
+ config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+PIGLIT_GL_TEST_CONFIG_END
+
+#define SSBO_SIZE 12
+
+static const char vs_pass_thru_text[] =
+ "#version 130\n"
+ "\n"
+ "in vec4 piglit_vertex;\n"
+ "void main() {\n"
+ " gl_Position = piglit_vertex;\n"
+ "}\n";
+
+static const char fs_source[] =
+ "#version 400\n"
+ "#extension GL_ARB_shader_storage_buffer_object : require\n"
+ "\n"
+ "out vec4 color;\n"
+ "\n"
+ "layout(std430, binding=2) buffer ssbo {\n"
+ " dvec2 color2[];\n"
+ "};\n"
+ "\n"
+ "void main() {\n"
+ " int cx = int(gl_FragCoord.x) / 31;\n"
+ " int cy = int(gl_FragCoord.y) / 31;\n"
+ " bool res = false;\n"
+ " if ((cx + cy) % 2 == 0) {\n"
+ " color2[0] = dvec2(1.0lf, 0.0lf);\n"
+ " } else {\n"
+ " color2[1] = dvec2(0.0lf, 1.0lf);\n"
+ " res = true;\n"
+ " }\n"
+ " dvec2 rg;\n"
+ " if (res)\n"
+ " rg = color2[1];\n"
+ " else\n"
+ " rg = color2[0];\n"
+ " color = vec4(rg, 0, 1);\n"
+ "}\n";
+
+GLuint prog, fbo;
+
+void
+piglit_init(int argc, char **argv)
+{
+ GLuint buffer;
+ double ssbo_values[SSBO_SIZE] = {0};
+
+ piglit_require_extension("GL_ARB_shader_storage_buffer_object");
+ piglit_require_GLSL_version(400);
+
+ prog = piglit_build_simple_program(vs_pass_thru_text, fs_source);
+
+ glUseProgram(prog);
+
+ glClearColor(0, 0, 0, 1);
+
+ glGenBuffers(1, &buffer);
+ glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2, buffer);
+ glBufferData(GL_SHADER_STORAGE_BUFFER, SSBO_SIZE*sizeof(GLdouble),
+ &ssbo_values[0], GL_DYNAMIC_DRAW);
+
+ if (!piglit_check_gl_error(GL_NO_ERROR))
+ piglit_report_result(PIGLIT_FAIL);
+}
+
+enum piglit_result piglit_display(void)
+{
+ bool pass = true;
+ const int num_pixels = piglit_width * piglit_height;
+ float *srcPixels = malloc(num_pixels * 4 * sizeof(float));
+ float expected[4];
+ int i, j;
+
+ glViewport(0, 0, piglit_width, piglit_height);
+ glUseProgram(prog);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ piglit_draw_rect(-1, -1, 2, 2);
+
+ glReadPixels(0, 0, piglit_width, piglit_height,
+ GL_RGBA, GL_FLOAT, srcPixels);
+
+ /* Verify */
+ for (i = 0; i < piglit_height; i++) {
+ for (j = 0; j < piglit_width; j++) {
+ int cx = j / 31;
+ int cy = i / 31;
+ int pos = (i * piglit_width + j) * 4;
+ if ((cx + cy) % 2 != 0) {
+ expected[0] = 0.0;
+ expected[1] = 1.0;
+ expected[2] = 0.0;
+ expected[3] = 1.0;
+ } else {
+ expected[0] = 1.0;
+ expected[1] = 0.0;
+ expected[2] = 0.0;
+ expected[3] = 1.0;
+ }
+
+ pass = piglit_compare_pixels(j, i, expected,
+ srcPixels + pos,
+ piglit_tolerance,
+ 4) && pass;
+ }
+ }
+ piglit_present_results();
+ free(srcPixels);
+
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
diff --git a/tests/spec/arb_gpu_shader_fp64/fs-non-uniform-control-flow-ubo.c b/tests/spec/arb_gpu_shader_fp64/fs-non-uniform-control-flow-ubo.c
new file mode 100644
index 0000000..c9b5633
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/fs-non-uniform-control-flow-ubo.c
@@ -0,0 +1,148 @@
+/*
+ * 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 fs-non-uniform-control-flow-ubo.c
+ *
+ * it checks that uniform block reads work correctly when they are
+ * under non-uniform control flow.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+ config.window_width = 62;
+ config.window_height = 62;
+ config.supports_gl_compat_version = 32;
+ config.supports_gl_core_version = 32;
+ config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+PIGLIT_GL_TEST_CONFIG_END
+
+#define UBO_SIZE 12
+
+static const char vs_pass_thru_text[] =
+ "#version 130\n"
+ "\n"
+ "in vec4 piglit_vertex;\n"
+ "void main() {\n"
+ " gl_Position = piglit_vertex;\n"
+ "}\n";
+
+static const char fs_source[] =
+ "#version 150\n"
+ "#extension GL_ARB_gpu_shader_fp64 : require\n"
+ "#extension GL_ARB_shading_language_420pack : require\n"
+ "\n"
+ "out vec4 color;\n"
+ "\n"
+ "layout(binding=2) uniform ubo {\n"
+ " dvec2 color2[];\n"
+ "};\n"
+ "\n"
+ "void main() {\n"
+ " int cx = int(gl_FragCoord.x) / 31;\n"
+ " int cy = int(gl_FragCoord.y) / 31;\n"
+ " dvec2 rg;\n"
+ " if ((cx + cy) % 2 == 0) {\n"
+ " rg = color2[0];\n"
+ " } else {\n"
+ " rg = color2[1];\n"
+ " }\n"
+ " color = vec4(rg, 0, 1);\n"
+ "}\n";
+
+GLuint prog, fbo;
+
+void
+piglit_init(int argc, char **argv)
+{
+ GLuint buffer;
+ double ubo_values[UBO_SIZE] = {1, 0, 0, 1,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0};
+
+ piglit_require_extension("GL_ARB_gpu_shader_fp64");
+ piglit_require_extension("GL_ARB_shading_language_420pack");
+
+ piglit_require_GLSL_version(150);
+
+ prog = piglit_build_simple_program(vs_pass_thru_text, fs_source);
+
+ glUseProgram(prog);
+
+ glClearColor(0, 0, 0, 1);
+
+ glGenBuffers(1, &buffer);
+ glBindBufferBase(GL_UNIFORM_BUFFER, 2, buffer);
+ glBufferData(GL_UNIFORM_BUFFER, UBO_SIZE*sizeof(GLdouble),
+ &ubo_values[0], GL_DYNAMIC_DRAW);
+
+ if (!piglit_check_gl_error(GL_NO_ERROR))
+ piglit_report_result(PIGLIT_FAIL);
+}
+
+enum piglit_result piglit_display(void)
+{
+ bool pass = true;
+ const int num_pixels = piglit_width * piglit_height;
+ float *srcPixels = malloc(num_pixels * 4 * sizeof(float));
+ float expected[4];
+ int i, j;
+
+ glViewport(0, 0, piglit_width, piglit_height);
+ glUseProgram(prog);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ piglit_draw_rect(-1, -1, 2, 2);
+
+ glReadPixels(0, 0, piglit_width, piglit_height,
+ GL_RGBA, GL_FLOAT, srcPixels);
+
+ /* Verify */
+ for (i = 0; i < piglit_height; i++) {
+ for (j = 0; j < piglit_width; j++) {
+ int cx = j / 31;
+ int cy = i / 31;
+ int pos = (i * piglit_width + j) * 4;
+ if ((cx + cy) % 2 != 0) {
+ expected[0] = 0.0;
+ expected[1] = 1.0;
+ expected[2] = 0.0;
+ expected[3] = 1.0;
+ } else {
+ expected[0] = 1.0;
+ expected[1] = 0.0;
+ expected[2] = 0.0;
+ expected[3] = 1.0;
+ }
+
+ pass = piglit_compare_pixels(j, i, expected,
+ srcPixels + pos,
+ piglit_tolerance,
+ 4) && pass;
+ }
+ }
+ piglit_present_results();
+ free(srcPixels);
+
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
diff --git a/tests/spec/arb_gpu_shader_fp64/vs-non-uniform-control-flow-alu.c b/tests/spec/arb_gpu_shader_fp64/vs-non-uniform-control-flow-alu.c
new file mode 100644
index 0000000..e83980f
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/vs-non-uniform-control-flow-alu.c
@@ -0,0 +1,179 @@
+/*
+ * 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 vs-non-uniform-control-flow-alu.c
+ *
+ * This test checks the double ALU ops work correctly when they are
+ * under non-uniform control flow.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+ config.window_width = 62;
+ config.window_height = 62;
+ config.supports_gl_compat_version = 32;
+ config.supports_gl_core_version = 32;
+ config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+PIGLIT_GL_TEST_CONFIG_END
+
+static const char vs_source[] =
+ "#version 330\n"
+ "#extension GL_ARB_gpu_shader_fp64 : require\n"
+ "\n"
+ "out vec4 color;\n"
+ "\n"
+ "uniform dvec2 u0;\n"
+ "uniform dvec2 u1;\n"
+ "\n"
+ "layout(location = 0) in vec3 inVertexPosition;\n"
+ "\n"
+ "void main() {\n"
+ " gl_Position = vec4(inVertexPosition, 1);\n"
+ " dvec2 rg;\n"
+ " if (inVertexPosition.x < 0 && inVertexPosition.y < 0) {\n"
+ " double tmp0 = mod(u1.y, 4.0lf);\n"
+ " tmp0 += 3.0lf / 4.0lf + 0.25lf;\n"
+ " rg = dvec2(u1.x, tmp0 - 1.0);\n"
+ " } else {\n"
+ " dvec2 tmp0 = 4.0lf * (floor(u0) - dvec2(0.75, 0.0lf));\n"
+ " tmp0.y = max(tmp0.y - 2, 0);\n"
+ " rg = tmp0;\n"
+ " }\n"
+ " color = vec4(rg, 0, 1);\n"
+ "}\n";
+
+static const char fs_source[] =
+ "#version 130\n"
+ "\n"
+ "in vec4 color;\n"
+ "out vec4 frag_color;\n"
+ "\n"
+ "void main() {\n"
+ " frag_color = color;\n"
+ "}\n";
+
+static GLuint prog, vertexArrayID;
+static GLuint fb, rb;
+
+void
+piglit_init(int argc, char **argv)
+{
+ GLuint vertexBuffer;
+ // Vertex data
+ static const GLfloat vertexData[4 * 3] = {
+ -1.0f, -1.0f, -1.0f,
+ 1.0f, -1.0f, -1.0f,
+ -1.0f, 1.0f, -1.0f,
+ 1.0f, 1.0f, -1.0f,
+ };
+ GLuint u0, u1;
+ double d0[2] = {1.4, 0.2};
+ double d1[2] = {0.0, 5.0};
+
+ piglit_require_extension("GL_ARB_gpu_shader_fp64");
+
+ piglit_require_GLSL_version(330);
+
+ prog = piglit_build_simple_program(vs_source, fs_source);
+ glUseProgram(prog);
+
+ glClearColor(0, 0, 0, 1);
+ glPointSize(10.0);
+
+ glGenRenderbuffers(1, &rb);
+ glBindRenderbuffer(GL_RENDERBUFFER, rb);
+ glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA,
+ piglit_width, piglit_height);
+
+ glGenFramebuffers(1, &fb);
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fb);
+ glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ GL_RENDERBUFFER, rb);
+
+ /* Uniform*/
+ u0 = glGetUniformLocation(prog, "u0");
+ u1 = glGetUniformLocation(prog, "u1");
+
+ glUniform2dv(u0, 1, d0);
+ glUniform2dv(u1, 1, d1);
+
+ // Record vertex data and attributes in a VAO
+ glGenVertexArrays(1, &vertexArrayID);
+ glBindVertexArray(vertexArrayID);
+ // Upload vertex position data to a VBO
+ glGenBuffers(1, &vertexBuffer);
+ glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);
+ glBufferData(GL_ARRAY_BUFFER, sizeof(vertexData),
+ vertexData, GL_STATIC_DRAW);
+
+ // Bind vertex position VBO to vertex shader attribute index 0
+ glEnableVertexAttribArray(0);
+ glVertexAttribPointer(
+ 0, // attribute index
+ 3, // size
+ GL_FLOAT, // type
+ GL_FALSE, // normalized?
+ 0, // stride
+ (void*)0 // buffer offset
+ );
+
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+ // Unbind VAO
+ glBindVertexArray(0);
+ // Disable attribute arrays
+ glDisableVertexAttribArray(0);
+
+ if (!piglit_check_gl_error(GL_NO_ERROR))
+ piglit_report_result(PIGLIT_FAIL);
+}
+
+enum piglit_result piglit_display(void)
+{
+ bool pass = true;
+ float red[4] = {1.0, 0.0, 0.0, 1.0};
+ float green[4] = {0.0, 1.0, 0.0, 1.0};
+
+ glUseProgram(prog);
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fb);
+ glViewport(0, 0, piglit_width, piglit_height);
+
+ glClear(GL_COLOR_BUFFER_BIT);
+ glBindVertexArray(vertexArrayID);
+ glDrawArrays(GL_POINTS, 0, 4);
+ glBindVertexArray(0);
+
+ glBindFramebuffer(GL_READ_FRAMEBUFFER, fb);
+
+ /* Verify */
+ pass = piglit_probe_pixel_rgba(0, 0, green) && pass;
+ pass = piglit_probe_pixel_rgba(0, piglit_height - 1, red) && pass;
+ pass = piglit_probe_pixel_rgba(piglit_width - 1,
+ piglit_height - 1, red) && pass;
+ pass = piglit_probe_pixel_rgba(piglit_width - 1, 0, red) && pass;
+
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
+ piglit_present_results();
+
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
diff --git a/tests/spec/arb_gpu_shader_fp64/vs-non-uniform-control-flow-const.c b/tests/spec/arb_gpu_shader_fp64/vs-non-uniform-control-flow-const.c
new file mode 100644
index 0000000..0d452af
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/vs-non-uniform-control-flow-const.c
@@ -0,0 +1,161 @@
+/*
+ * 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 vs-non-uniform-control-flow-const.c
+ *
+ * This test checks that constant writes to double type variables in GLSL
+ * work correctly when the writes are under non-uniform control flow.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+ config.window_width = 62;
+ config.window_height = 62;
+ config.supports_gl_compat_version = 32;
+ config.supports_gl_core_version = 32;
+ config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+PIGLIT_GL_TEST_CONFIG_END
+
+static const char vs_source[] =
+ "#version 330\n"
+ "#extension GL_ARB_gpu_shader_fp64 : require\n"
+ "\n"
+ "out vec4 color;\n"
+ "\n"
+ "layout(location = 0) in vec3 inVertexPosition;\n"
+ "\n"
+ "void main() {\n"
+ " gl_Position = vec4(inVertexPosition, 1);\n"
+ " dvec2 rg;\n"
+ " if (inVertexPosition.x < 0 && inVertexPosition.y < 0)\n"
+ " rg = dvec2(0.0lf, 1.0lf);\n"
+ " else\n"
+ " rg = dvec2(1.0lf, 0.0lf);\n"
+ " color = vec4(rg, 0, 1);\n"
+ "}\n";
+
+static const char fs_source[] =
+ "#version 130\n"
+ "\n"
+ "in vec4 color;\n"
+ "out vec4 frag_color;\n"
+ "\n"
+ "void main() {\n"
+ " frag_color = color;\n"
+ "}\n";
+
+static GLuint prog, vertexArrayID;
+static GLuint fb, rb;
+
+void
+piglit_init(int argc, char **argv)
+{
+ GLuint vertexBuffer;
+ // Vertex data
+ static const GLfloat vertexData[4 * 3] = {
+ -1.0f, -1.0f, -1.0f,
+ 1.0f, -1.0f, -1.0f,
+ -1.0f, 1.0f, -1.0f,
+ 1.0f, 1.0f, -1.0f,
+ };
+
+ piglit_require_extension("GL_ARB_gpu_shader_fp64");
+
+ piglit_require_GLSL_version(330);
+
+ prog = piglit_build_simple_program(vs_source, fs_source);
+ glUseProgram(prog);
+
+ glClearColor(0, 0, 0, 1);
+ glPointSize(10.0);
+
+ glGenRenderbuffers(1, &rb);
+ glBindRenderbuffer(GL_RENDERBUFFER, rb);
+ glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA,
+ piglit_width, piglit_height);
+
+ glGenFramebuffers(1, &fb);
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fb);
+ glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ GL_RENDERBUFFER, rb);
+
+ // Record vertex data and attributes in a VAO
+ glGenVertexArrays(1, &vertexArrayID);
+ glBindVertexArray(vertexArrayID);
+ // Upload vertex position data to a VBO
+ glGenBuffers(1, &vertexBuffer);
+ glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);
+ glBufferData(GL_ARRAY_BUFFER, sizeof(vertexData),
+ vertexData, GL_STATIC_DRAW);
+
+ // Bind vertex position VBO to vertex shader attribute index 0
+ glEnableVertexAttribArray(0);
+ glVertexAttribPointer(
+ 0, // attribute index
+ 3, // size
+ GL_FLOAT, // type
+ GL_FALSE, // normalized?
+ 0, // stride
+ (void*)0 // buffer offset
+ );
+
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+ // Unbind VAO
+ glBindVertexArray(0);
+ // Disable attribute arrays
+ glDisableVertexAttribArray(0);
+
+ if (!piglit_check_gl_error(GL_NO_ERROR))
+ piglit_report_result(PIGLIT_FAIL);
+}
+
+enum piglit_result piglit_display(void)
+{
+ bool pass = true;
+ float red[4] = {1.0, 0.0, 0.0, 1.0};
+ float green[4] = {0.0, 1.0, 0.0, 1.0};
+
+ glUseProgram(prog);
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fb);
+ glViewport(0, 0, piglit_width, piglit_height);
+
+ glClear(GL_COLOR_BUFFER_BIT);
+ glBindVertexArray(vertexArrayID);
+ glDrawArrays(GL_POINTS, 0, 4);
+ glBindVertexArray(0);
+
+ glBindFramebuffer(GL_READ_FRAMEBUFFER, fb);
+
+ /* Verify */
+ pass = piglit_probe_pixel_rgba(0, 0, green) && pass;
+ pass = piglit_probe_pixel_rgba(0, piglit_height - 1, red) && pass;
+ pass = piglit_probe_pixel_rgba(piglit_width - 1,
+ piglit_height - 1, red) && pass;
+ pass = piglit_probe_pixel_rgba(piglit_width - 1, 0, red) && pass;
+
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
+ piglit_present_results();
+
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
diff --git a/tests/spec/arb_gpu_shader_fp64/vs-non-uniform-control-flow-packing.c b/tests/spec/arb_gpu_shader_fp64/vs-non-uniform-control-flow-packing.c
new file mode 100644
index 0000000..b1891fb
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/vs-non-uniform-control-flow-packing.c
@@ -0,0 +1,179 @@
+/*
+ * 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 vs-non-uniform-control-flow-packing.c
+ *
+ * This test checks the double packing ops work correctly when they are
+ * under non-uniform control flow.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+ config.window_width = 62;
+ config.window_height = 62;
+ config.supports_gl_compat_version = 32;
+ config.supports_gl_core_version = 32;
+ config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+PIGLIT_GL_TEST_CONFIG_END
+
+static const char vs_source[] =
+ "#version 330\n"
+ "#extension GL_ARB_gpu_shader_fp64 : require\n"
+ "\n"
+ "out vec4 color;\n"
+ "\n"
+ "uniform uvec2 u0;\n"
+ "uniform uvec2 u1;\n"
+ "\n"
+ "layout(location = 0) in vec3 inVertexPosition;\n"
+ "\n"
+ "void main() {\n"
+ " gl_Position = vec4(inVertexPosition, 1);\n"
+ " dvec2 rg;\n"
+ " if (inVertexPosition.x < 0 && inVertexPosition.y < 0) {\n"
+ " double tmp0 = packDouble2x32(u0) - 2.0lf;\n"
+ " double tmp1 = packDouble2x32(u1);\n"
+ " rg = dvec2(tmp0, tmp1);\n"
+ " } else {\n"
+ " double tmp0 = packDouble2x32(u0) - 2.0lf;\n"
+ " double tmp1 = packDouble2x32(u1);\n"
+ " rg = dvec2(tmp1, tmp0);\n"
+ " }\n"
+ " color = vec4(rg, 0, 1);\n"
+ "}\n";
+
+static const char fs_source[] =
+ "#version 130\n"
+ "\n"
+ "in vec4 color;\n"
+ "out vec4 frag_color;\n"
+ "\n"
+ "void main() {\n"
+ " frag_color = color;\n"
+ "}\n";
+
+static GLuint prog, vertexArrayID;
+static GLuint fb, rb;
+
+void
+piglit_init(int argc, char **argv)
+{
+ GLuint vertexBuffer;
+ // Vertex data
+ static const GLfloat vertexData[4 * 3] = {
+ -1.0f, -1.0f, -1.0f,
+ 1.0f, -1.0f, -1.0f,
+ -1.0f, 1.0f, -1.0f,
+ 1.0f, 1.0f, -1.0f,
+ };
+ GLuint u0, u1;
+ uint d0[2] = {0x0, 0x40000000};
+ uint d1[2] = {0x0, 0x3FF00000};
+
+ piglit_require_extension("GL_ARB_gpu_shader_fp64");
+
+ piglit_require_GLSL_version(330);
+
+ prog = piglit_build_simple_program(vs_source, fs_source);
+ glUseProgram(prog);
+
+ glClearColor(0, 0, 0, 1);
+ glPointSize(10.0);
+
+ glGenRenderbuffers(1, &rb);
+ glBindRenderbuffer(GL_RENDERBUFFER, rb);
+ glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA,
+ piglit_width, piglit_height);
+
+ glGenFramebuffers(1, &fb);
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fb);
+ glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ GL_RENDERBUFFER, rb);
+
+ /* Uniform*/
+ u0 = glGetUniformLocation(prog, "u0");
+ u1 = glGetUniformLocation(prog, "u1");
+
+ glUniform2uiv(u0, 1, d0);
+ glUniform2uiv(u1, 1, d1);
+
+ // Record vertex data and attributes in a VAO
+ glGenVertexArrays(1, &vertexArrayID);
+ glBindVertexArray(vertexArrayID);
+ // Upload vertex position data to a VBO
+ glGenBuffers(1, &vertexBuffer);
+ glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);
+ glBufferData(GL_ARRAY_BUFFER, sizeof(vertexData),
+ vertexData, GL_STATIC_DRAW);
+
+ // Bind vertex position VBO to vertex shader attribute index 0
+ glEnableVertexAttribArray(0);
+ glVertexAttribPointer(
+ 0, // attribute index
+ 3, // size
+ GL_FLOAT, // type
+ GL_FALSE, // normalized?
+ 0, // stride
+ (void*)0 // buffer offset
+ );
+
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+ // Unbind VAO
+ glBindVertexArray(0);
+ // Disable attribute arrays
+ glDisableVertexAttribArray(0);
+
+ if (!piglit_check_gl_error(GL_NO_ERROR))
+ piglit_report_result(PIGLIT_FAIL);
+}
+
+enum piglit_result piglit_display(void)
+{
+ bool pass = true;
+ float red[4] = {1.0, 0.0, 0.0, 1.0};
+ float green[4] = {0.0, 1.0, 0.0, 1.0};
+
+ glUseProgram(prog);
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fb);
+ glViewport(0, 0, piglit_width, piglit_height);
+
+ glClear(GL_COLOR_BUFFER_BIT);
+ glBindVertexArray(vertexArrayID);
+ glDrawArrays(GL_POINTS, 0, 4);
+ glBindVertexArray(0);
+
+ glBindFramebuffer(GL_READ_FRAMEBUFFER, fb);
+
+ /* Verify */
+ pass = piglit_probe_pixel_rgba(0, 0, green) && pass;
+ pass = piglit_probe_pixel_rgba(0, piglit_height - 1, red) && pass;
+ pass = piglit_probe_pixel_rgba(piglit_width - 1,
+ piglit_height - 1, red) && pass;
+ pass = piglit_probe_pixel_rgba(piglit_width - 1, 0, red) && pass;
+
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
+ piglit_present_results();
+
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
diff --git a/tests/spec/arb_gpu_shader_fp64/vs-non-uniform-control-flow-ssbo.c b/tests/spec/arb_gpu_shader_fp64/vs-non-uniform-control-flow-ssbo.c
new file mode 100644
index 0000000..370d286
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/vs-non-uniform-control-flow-ssbo.c
@@ -0,0 +1,175 @@
+/*
+ * 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 vs-non-uniform-control-flow-ssbo.c
+ *
+ * This test checks that shader storage block writes to double type variables
+ * in GLSL works correctly when the writes are under non-uniform control flow.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+ config.window_width = 62;
+ config.window_height = 62;
+ config.supports_gl_compat_version = 32;
+ config.supports_gl_core_version = 32;
+ config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+PIGLIT_GL_TEST_CONFIG_END
+
+#define SSBO_SIZE 12
+
+static const char vs_source[] =
+ "#version 400\n"
+ "#extension GL_ARB_shader_storage_buffer_object : require\n"
+ "\n"
+ "out vec4 color;\n"
+ "\n"
+ "layout(std430, binding=2) buffer ssbo {\n"
+ " dvec2 color2[];\n"
+ "};\n"
+ "\n"
+ "layout(location = 0) in vec3 inVertexPosition;\n"
+ "\n"
+ "void main() {\n"
+ " gl_Position = vec4(inVertexPosition, 1);\n"
+ " dvec2 rg;\n"
+ " if (inVertexPosition.x < 0 && inVertexPosition.y < 0) {\n"
+ " color2[0] = dvec2(0.0lf, 1.0lf);\n"
+ " rg = color2[0];\n"
+ " } else {\n"
+ " color2[1] = dvec2(1.0lf, 0.0lf);\n"
+ " rg = color2[1];\n"
+ " }\n"
+ " color = vec4(rg, 0, 1);\n"
+ "}\n";
+
+static const char fs_source[] =
+ "#version 130\n"
+ "\n"
+ "in vec4 color;\n"
+ "out vec4 frag_color;\n"
+ "\n"
+ "void main() {\n"
+ " frag_color = color;\n"
+ "}\n";
+
+static GLuint prog, vertexArrayID;
+static GLuint fb, rb;
+
+void
+piglit_init(int argc, char **argv)
+{
+ GLuint buffer, vertexBuffer;
+ double ssbo_values[SSBO_SIZE] = {0};
+ // Vertex data
+ static const GLfloat vertexData[4 * 3] = {
+ -1.0f, -1.0f, -1.0f,
+ 1.0f, -1.0f, -1.0f,
+ -1.0f, 1.0f, -1.0f,
+ 1.0f, 1.0f, -1.0f,
+ };
+
+ piglit_require_extension("GL_ARB_shader_storage_buffer_object");
+ piglit_require_GLSL_version(400);
+
+ prog = piglit_build_simple_program(vs_source, fs_source);
+ glUseProgram(prog);
+
+ glClearColor(0, 0, 0, 1);
+ glPointSize(10.0);
+
+ glGenRenderbuffers(1, &rb);
+ glBindRenderbuffer(GL_RENDERBUFFER, rb);
+ glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA,
+ piglit_width, piglit_height);
+
+ glGenFramebuffers(1, &fb);
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fb);
+ glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ GL_RENDERBUFFER, rb);
+
+ glGenBuffers(1, &buffer);
+ glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2, buffer);
+ glBufferData(GL_SHADER_STORAGE_BUFFER, SSBO_SIZE*sizeof(GLdouble),
+ &ssbo_values[0], GL_DYNAMIC_DRAW);
+
+ // Record vertex data and attributes in a VAO
+ glGenVertexArrays(1, &vertexArrayID);
+ glBindVertexArray(vertexArrayID);
+ // Upload vertex position data to a VBO
+ glGenBuffers(1, &vertexBuffer);
+ glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);
+ glBufferData(GL_ARRAY_BUFFER, sizeof(vertexData),
+ vertexData, GL_STATIC_DRAW);
+
+ // Bind vertex position VBO to vertex shader attribute index 0
+ glEnableVertexAttribArray(0);
+ glVertexAttribPointer(
+ 0, // attribute index
+ 3, // size
+ GL_FLOAT, // type
+ GL_FALSE, // normalized?
+ 0, // stride
+ (void*)0 // buffer offset
+ );
+
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+ // Unbind VAO
+ glBindVertexArray(0);
+ // Disable attribute arrays
+ glDisableVertexAttribArray(0);
+
+ if (!piglit_check_gl_error(GL_NO_ERROR))
+ piglit_report_result(PIGLIT_FAIL);
+}
+
+enum piglit_result piglit_display(void)
+{
+ bool pass = true;
+ float red[4] = {1.0, 0.0, 0.0, 1.0};
+ float green[4] = {0.0, 1.0, 0.0, 1.0};
+
+ glUseProgram(prog);
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fb);
+ glViewport(0, 0, piglit_width, piglit_height);
+
+ glClear(GL_COLOR_BUFFER_BIT);
+ glBindVertexArray(vertexArrayID);
+ glDrawArrays(GL_POINTS, 0, 4);
+ glBindVertexArray(0);
+
+ glBindFramebuffer(GL_READ_FRAMEBUFFER, fb);
+
+ /* Verify */
+ pass = piglit_probe_pixel_rgba(0, 0, green) && pass;
+ pass = piglit_probe_pixel_rgba(0, piglit_height - 1, red) && pass;
+ pass = piglit_probe_pixel_rgba(piglit_width - 1,
+ piglit_height - 1, red) && pass;
+ pass = piglit_probe_pixel_rgba(piglit_width - 1, 0, red) && pass;
+
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
+ piglit_present_results();
+
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
diff --git a/tests/spec/arb_gpu_shader_fp64/vs-non-uniform-control-flow-ubo.c b/tests/spec/arb_gpu_shader_fp64/vs-non-uniform-control-flow-ubo.c
new file mode 100644
index 0000000..f122b5d
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/vs-non-uniform-control-flow-ubo.c
@@ -0,0 +1,176 @@
+/*
+ * 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 vs-non-uniform-control-flow-ubo.c
+ *
+ * This test checks that uniform block reads works correctly when they are
+ * under non-uniform control flow.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+ config.window_width = 62;
+ config.window_height = 62;
+ config.supports_gl_compat_version = 32;
+ config.supports_gl_core_version = 32;
+ config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+PIGLIT_GL_TEST_CONFIG_END
+
+#define UBO_SIZE 12
+
+static const char vs_source[] =
+ "#version 330\n"
+ "#extension GL_ARB_gpu_shader_fp64 : require\n"
+ "#extension GL_ARB_shading_language_420pack : require\n"
+ "\n"
+ "out vec4 color;\n"
+ "\n"
+ "layout(binding=2) uniform ubo {\n"
+ " dvec2 color2[];\n"
+ "};\n"
+ "\n"
+ "layout(location = 0) in vec3 inVertexPosition;\n"
+ "\n"
+ "void main() {\n"
+ " gl_Position = vec4(inVertexPosition, 1);\n"
+ " dvec2 rg;\n"
+ " if (inVertexPosition.x < 0 && inVertexPosition.y < 0)\n"
+ " rg = color2[0];\n"
+ " else\n"
+ " rg = color2[1];\n"
+ " color = vec4(rg, 0, 1);\n"
+ "}\n";
+
+static const char fs_source[] =
+ "#version 130\n"
+ "\n"
+ "in vec4 color;\n"
+ "out vec4 frag_color;\n"
+ "\n"
+ "void main() {\n"
+ " frag_color = color;\n"
+ "}\n";
+
+static GLuint prog, vertexArrayID;
+static GLuint fb, rb;
+
+void
+piglit_init(int argc, char **argv)
+{
+ GLuint vertexBuffer, buffer;
+ // Vertex data
+ static const GLfloat vertexData[4 * 3] = {
+ -1.0f, -1.0f, -1.0f,
+ 1.0f, -1.0f, -1.0f,
+ -1.0f, 1.0f, -1.0f,
+ 1.0f, 1.0f, -1.0f,
+ };
+ static double ubo_values[UBO_SIZE] = {0, 1, 1, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0};
+
+ piglit_require_extension("GL_ARB_gpu_shader_fp64");
+
+ piglit_require_GLSL_version(330);
+
+ prog = piglit_build_simple_program(vs_source, fs_source);
+ glUseProgram(prog);
+
+ glClearColor(0, 0, 0, 1);
+ glPointSize(10.0);
+
+ glGenRenderbuffers(1, &rb);
+ glBindRenderbuffer(GL_RENDERBUFFER, rb);
+ glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA,
+ piglit_width, piglit_height);
+
+ glGenFramebuffers(1, &fb);
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fb);
+ glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ GL_RENDERBUFFER, rb);
+
+ // Record vertex data and attributes in a VAO
+ glGenVertexArrays(1, &vertexArrayID);
+ glBindVertexArray(vertexArrayID);
+ // Upload vertex position data to a VBO
+ glGenBuffers(1, &vertexBuffer);
+ glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);
+ glBufferData(GL_ARRAY_BUFFER, sizeof(vertexData),
+ vertexData, GL_STATIC_DRAW);
+
+ // Bind vertex position VBO to vertex shader attribute index 0
+ glEnableVertexAttribArray(0);
+ glVertexAttribPointer(
+ 0, // attribute index
+ 3, // size
+ GL_FLOAT, // type
+ GL_FALSE, // normalized?
+ 0, // stride
+ (void*)0 // buffer offset
+ );
+
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+ // Unbind VAO
+ glBindVertexArray(0);
+ // Disable attribute arrays
+ glDisableVertexAttribArray(0);
+
+ glGenBuffers(1, &buffer);
+ glBindBufferBase(GL_UNIFORM_BUFFER, 2, buffer);
+ glBufferData(GL_UNIFORM_BUFFER, UBO_SIZE*sizeof(GLdouble),
+ &ubo_values[0], GL_DYNAMIC_DRAW);
+
+ if (!piglit_check_gl_error(GL_NO_ERROR))
+ piglit_report_result(PIGLIT_FAIL);
+}
+
+enum piglit_result piglit_display(void)
+{
+ bool pass = true;
+ float red[4] = {1.0, 0.0, 0.0, 1.0};
+ float green[4] = {0.0, 1.0, 0.0, 1.0};
+
+ glUseProgram(prog);
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fb);
+ glViewport(0, 0, piglit_width, piglit_height);
+
+ glClear(GL_COLOR_BUFFER_BIT);
+ glBindVertexArray(vertexArrayID);
+ glDrawArrays(GL_POINTS, 0, 4);
+ glBindVertexArray(0);
+
+ glBindFramebuffer(GL_READ_FRAMEBUFFER, fb);
+
+ /* Verify */
+ pass = piglit_probe_pixel_rgba(0, 0, green) && pass;
+ pass = piglit_probe_pixel_rgba(0, piglit_height - 1, red) && pass;
+ pass = piglit_probe_pixel_rgba(piglit_width - 1,
+ piglit_height - 1, red) && pass;
+ pass = piglit_probe_pixel_rgba(piglit_width - 1, 0, red) && pass;
+
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
+ piglit_present_results();
+
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}