[Piglit] [PATCH 2/2] arb_shader_storage_buffer_object: add AoA test for std430 layout

2015-10-06 Thread Samuel Iglesias Gonsalvez
Signed-off-by: Samuel Iglesias Gonsalvez <sigles...@igalia.com>
---
 tests/all.py   |   1 +
 .../CMakeLists.gl.txt  |   1 +
 .../layout-std430-arrays-of-arrays-write-shader.c  | 229 +
 3 files changed, 231 insertions(+)
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/layout-std430-arrays-of-arrays-write-shader.c

diff --git a/tests/all.py b/tests/all.py
index a9b3baa..a42308c 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4089,6 +4089,7 @@ with profile.group_manager(
 g(['arb_shader_storage_buffer_object-layout-std140-write-shader'], 
'layout-std140-write-shader')
 g(['arb_shader_storage_buffer_object-program_interface_query'], 
'program-interface-query')
 
g(['arb_shader_storage_buffer_object-layout-std140-arrays-of-arrays-write-shader'],
 'layout-std140-arrays-of-arrays-write-shader')
+
g(['arb_shader_storage_buffer_object-layout-std430-arrays-of-arrays-write-shader'],
 'layout-std430-arrays-of-arrays-write-shader')
 
 with profile.group_manager(
 PiglitGLTest,
diff --git a/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt 
b/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
index e425df7..0d2331b 100644
--- a/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
+++ b/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
@@ -20,5 +20,6 @@ piglit_add_executable 
(arb_shader_storage_buffer_object-layout-std430-write-shad
 piglit_add_executable 
(arb_shader_storage_buffer_object-layout-std140-write-shader 
layout-std140-write-shader.c)
 piglit_add_executable 
(arb_shader_storage_buffer_object-program_interface_query 
program-interface-query.c)
 piglit_add_executable 
(arb_shader_storage_buffer_object-layout-std140-arrays-of-arrays-write-shader 
layout-std140-arrays-of-arrays-write-shader.c)
+piglit_add_executable 
(arb_shader_storage_buffer_object-layout-std430-arrays-of-arrays-write-shader 
layout-std430-arrays-of-arrays-write-shader.c)
 
 # vim: ft=cmake:
diff --git 
a/tests/spec/arb_shader_storage_buffer_object/layout-std430-arrays-of-arrays-write-shader.c
 
b/tests/spec/arb_shader_storage_buffer_object/layout-std430-arrays-of-arrays-write-shader.c
new file mode 100644
index 000..d7ed42a
--- /dev/null
+++ 
b/tests/spec/arb_shader_storage_buffer_object/layout-std430-arrays-of-arrays-write-shader.c
@@ -0,0 +1,229 @@
+/*
+ * Copyright © 2015 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 layout-std430-arrays-of-arrays-write-shader.c
+ *
+ * Tests that shader storage block writes in GLSL works correctly (offsets and
+ * values) when interface packing qualifier is std140 and row_major.
+ * This test includes some buffer variables defined as arrays of arrays.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.window_width = 100;
+   config.window_height = 100;
+   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 728
+#define NUM_QUERIES 11
+
+static const char vs_pass_thru_text[] =
+   "#version 130\n"
+   "#extension GL_ARB_shader_storage_buffer_object : require\n"
+   "#extension GL_ARB_arrays_of_arrays : require\n"
+   "#extension GL_ARB_uniform_buffer_object : require\n"
+   "\n"
+   "struct A {\n"
+   "   float a1;\n"
+   "   vec2 a2_2[2][2];\n"
+   "   mat3x4 a34_2[2][2];\n"
+   "};\n"
+   "layout(std430, binding=2) buffer ssbo {\n"
+   "   vec4 v;\n"
+   "   float f;\n"
+   "   A s[2]

[Piglit] [PATCH 1/2] arb_shader_storage_buffer_object: add AoA test for std140 layout

2015-10-06 Thread Samuel Iglesias Gonsalvez
Signed-off-by: Samuel Iglesias Gonsalvez <sigles...@igalia.com>
---
 tests/all.py   |   1 +
 .../CMakeLists.gl.txt  |   1 +
 .../layout-std140-arrays-of-arrays-write-shader.c  | 229 +
 3 files changed, 231 insertions(+)
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/layout-std140-arrays-of-arrays-write-shader.c

diff --git a/tests/all.py b/tests/all.py
index 0db54ac..a9b3baa 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4088,6 +4088,7 @@ with profile.group_manager(
 g(['arb_shader_storage_buffer_object-layout-std430-write-shader'], 
'layout-std430-write-shader')
 g(['arb_shader_storage_buffer_object-layout-std140-write-shader'], 
'layout-std140-write-shader')
 g(['arb_shader_storage_buffer_object-program_interface_query'], 
'program-interface-query')
+
g(['arb_shader_storage_buffer_object-layout-std140-arrays-of-arrays-write-shader'],
 'layout-std140-arrays-of-arrays-write-shader')
 
 with profile.group_manager(
 PiglitGLTest,
diff --git a/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt 
b/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
index 592d8a3..e425df7 100644
--- a/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
+++ b/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
@@ -19,5 +19,6 @@ piglit_add_executable 
(arb_shader_storage_buffer_object-array-ssbo-binding array
 piglit_add_executable 
(arb_shader_storage_buffer_object-layout-std430-write-shader 
layout-std430-write-shader.c)
 piglit_add_executable 
(arb_shader_storage_buffer_object-layout-std140-write-shader 
layout-std140-write-shader.c)
 piglit_add_executable 
(arb_shader_storage_buffer_object-program_interface_query 
program-interface-query.c)
+piglit_add_executable 
(arb_shader_storage_buffer_object-layout-std140-arrays-of-arrays-write-shader 
layout-std140-arrays-of-arrays-write-shader.c)
 
 # vim: ft=cmake:
diff --git 
a/tests/spec/arb_shader_storage_buffer_object/layout-std140-arrays-of-arrays-write-shader.c
 
b/tests/spec/arb_shader_storage_buffer_object/layout-std140-arrays-of-arrays-write-shader.c
new file mode 100644
index 000..4ca29be
--- /dev/null
+++ 
b/tests/spec/arb_shader_storage_buffer_object/layout-std140-arrays-of-arrays-write-shader.c
@@ -0,0 +1,229 @@
+/*
+ * Copyright © 2015 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 layout-std140-arrays-of-arrays-write-shader.c
+ *
+ * Tests that shader storage block writes in GLSL works correctly (offsets and
+ * values) when interface packing qualifier is std140 and row_major.
+ * This test includes some buffer variables defined as arrays of arrays.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.window_width = 100;
+   config.window_height = 100;
+   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 1016
+#define NUM_QUERIES 11
+
+static const char vs_pass_thru_text[] =
+   "#version 130\n"
+   "#extension GL_ARB_shader_storage_buffer_object : require\n"
+   "#extension GL_ARB_arrays_of_arrays : require\n"
+   "#extension GL_ARB_uniform_buffer_object : require\n"
+   "\n"
+   "struct A {\n"
+   "   float a1;\n"
+   "   vec2 a2_2[2][2];\n"
+   "   mat3x4 a34_2[2][2];\n"
+   "};\n"
+   "layout(std140, row_major, binding=2) buffer ssbo {\n"
+   "   vec4 v;\n"
+   "   float f;\n"
+   "   A s[2][3];\n"
+   "   A unsized_array[][3];\n&qu

[Piglit] [PATCH v2 1/2] shader_runner: make active_uniforms's all_types variable be global

2015-09-23 Thread Samuel Iglesias Gonsalvez
Signed-off-by: Samuel Iglesias Gonsalvez <sigles...@igalia.com>
---
 tests/shaders/shader_runner.c | 156 +-
 1 file changed, 78 insertions(+), 78 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 0614c7f..7a647a1 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -158,6 +158,84 @@ enum comparison {
less_equal
 };
 
+static const struct string_to_enum all_types[] = {
+   ENUM_STRING(GL_FLOAT),
+   ENUM_STRING(GL_FLOAT_VEC2),
+   ENUM_STRING(GL_FLOAT_VEC3),
+   ENUM_STRING(GL_FLOAT_VEC4),
+   ENUM_STRING(GL_DOUBLE),
+   ENUM_STRING(GL_DOUBLE_VEC2),
+   ENUM_STRING(GL_DOUBLE_VEC3),
+   ENUM_STRING(GL_DOUBLE_VEC4),
+   ENUM_STRING(GL_INT),
+   ENUM_STRING(GL_INT_VEC2),
+   ENUM_STRING(GL_INT_VEC3),
+   ENUM_STRING(GL_INT_VEC4),
+   ENUM_STRING(GL_UNSIGNED_INT),
+   ENUM_STRING(GL_UNSIGNED_INT_VEC2),
+   ENUM_STRING(GL_UNSIGNED_INT_VEC3),
+   ENUM_STRING(GL_UNSIGNED_INT_VEC4),
+   ENUM_STRING(GL_BOOL),
+   ENUM_STRING(GL_BOOL_VEC2),
+   ENUM_STRING(GL_BOOL_VEC3),
+   ENUM_STRING(GL_BOOL_VEC4),
+   ENUM_STRING(GL_FLOAT_MAT2),
+   ENUM_STRING(GL_FLOAT_MAT3),
+   ENUM_STRING(GL_FLOAT_MAT4),
+   ENUM_STRING(GL_FLOAT_MAT2x3),
+   ENUM_STRING(GL_FLOAT_MAT2x4),
+   ENUM_STRING(GL_FLOAT_MAT3x2),
+   ENUM_STRING(GL_FLOAT_MAT3x4),
+   ENUM_STRING(GL_FLOAT_MAT4x2),
+   ENUM_STRING(GL_FLOAT_MAT4x3),
+   ENUM_STRING(GL_DOUBLE_MAT2),
+   ENUM_STRING(GL_DOUBLE_MAT3),
+   ENUM_STRING(GL_DOUBLE_MAT4),
+   ENUM_STRING(GL_DOUBLE_MAT2x3),
+   ENUM_STRING(GL_DOUBLE_MAT2x4),
+   ENUM_STRING(GL_DOUBLE_MAT3x2),
+   ENUM_STRING(GL_DOUBLE_MAT3x4),
+   ENUM_STRING(GL_DOUBLE_MAT4x2),
+   ENUM_STRING(GL_DOUBLE_MAT4x3),
+   ENUM_STRING(GL_SAMPLER_1D),
+   ENUM_STRING(GL_SAMPLER_2D),
+   ENUM_STRING(GL_SAMPLER_3D),
+   ENUM_STRING(GL_SAMPLER_CUBE),
+   ENUM_STRING(GL_SAMPLER_1D_SHADOW),
+   ENUM_STRING(GL_SAMPLER_2D_SHADOW),
+   ENUM_STRING(GL_SAMPLER_1D_ARRAY),
+   ENUM_STRING(GL_SAMPLER_2D_ARRAY),
+   ENUM_STRING(GL_SAMPLER_1D_ARRAY_SHADOW),
+   ENUM_STRING(GL_SAMPLER_2D_ARRAY_SHADOW),
+   ENUM_STRING(GL_SAMPLER_2D_MULTISAMPLE),
+   ENUM_STRING(GL_SAMPLER_2D_MULTISAMPLE_ARRAY),
+   ENUM_STRING(GL_SAMPLER_CUBE_SHADOW),
+   ENUM_STRING(GL_SAMPLER_BUFFER),
+   ENUM_STRING(GL_SAMPLER_2D_RECT),
+   ENUM_STRING(GL_SAMPLER_2D_RECT_SHADOW),
+   ENUM_STRING(GL_INT_SAMPLER_1D),
+   ENUM_STRING(GL_INT_SAMPLER_2D),
+   ENUM_STRING(GL_INT_SAMPLER_3D),
+   ENUM_STRING(GL_INT_SAMPLER_CUBE),
+   ENUM_STRING(GL_INT_SAMPLER_1D_ARRAY),
+   ENUM_STRING(GL_INT_SAMPLER_2D_ARRAY),
+   ENUM_STRING(GL_INT_SAMPLER_2D_MULTISAMPLE),
+   ENUM_STRING(GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY),
+   ENUM_STRING(GL_INT_SAMPLER_BUFFER),
+   ENUM_STRING(GL_INT_SAMPLER_2D_RECT),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_1D),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_2D),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_3D),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_CUBE),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_1D_ARRAY),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_2D_ARRAY),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_BUFFER),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_2D_RECT),
+   { NULL, 0 }
+};
+
 GLenum
 lookup_enum_string(const struct string_to_enum *table, const char **line,
   const char *error_desc)
@@ -1860,84 +1938,6 @@ active_uniform(const char *line)
{ NULL, 0 }
};
 
-   static const struct string_to_enum all_types[] = {
-   ENUM_STRING(GL_FLOAT),
-   ENUM_STRING(GL_FLOAT_VEC2),
-   ENUM_STRING(GL_FLOAT_VEC3),
-   ENUM_STRING(GL_FLOAT_VEC4),
-   ENUM_STRING(GL_DOUBLE),
-   ENUM_STRING(GL_DOUBLE_VEC2),
-   ENUM_STRING(GL_DOUBLE_VEC3),
-   ENUM_STRING(GL_DOUBLE_VEC4),
-   ENUM_STRING(GL_INT),
-   ENUM_STRING(GL_INT_VEC2),
-   ENUM_STRING(GL_INT_VEC3),
-   ENUM_STRING(GL_INT_VEC4),
-   ENUM_STRING(GL_UNSIGNED_INT),
-   ENUM_STRING(GL_UNSIGNED_INT_VEC2),
-   ENUM_STRING(GL_UNSIGNED_INT_VEC3),
-   ENUM_STRING(GL_UNSIGNED_INT_VEC4),
-   ENUM_STRING(GL_BOOL),
-   ENUM_STRING(GL_BOOL_VEC2),
-   ENUM_STRING(GL_BOOL_VEC3),
-   ENUM_STRING(GL_BOOL_VEC4),
-   ENUM_STRING(GL_FLOAT_MAT2),
-   ENUM_STRING(GL_FLOAT_MAT3),
-   ENUM_STRING(GL_FLOAT_MAT4),
-   ENUM_STRING(GL_FLOAT_MAT2x3),
-   ENUM_STRING(GL_FLOAT_

[Piglit] [PATCH 1/2] shader_runner: make active_uniforms's all_types variable be global

2015-09-16 Thread Samuel Iglesias Gonsalvez
Signed-off-by: Samuel Iglesias Gonsalvez <sigles...@igalia.com>
---
 tests/shaders/shader_runner.c | 156 +-
 1 file changed, 78 insertions(+), 78 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 0614c7f..7a647a1 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -158,6 +158,84 @@ enum comparison {
less_equal
 };
 
+static const struct string_to_enum all_types[] = {
+   ENUM_STRING(GL_FLOAT),
+   ENUM_STRING(GL_FLOAT_VEC2),
+   ENUM_STRING(GL_FLOAT_VEC3),
+   ENUM_STRING(GL_FLOAT_VEC4),
+   ENUM_STRING(GL_DOUBLE),
+   ENUM_STRING(GL_DOUBLE_VEC2),
+   ENUM_STRING(GL_DOUBLE_VEC3),
+   ENUM_STRING(GL_DOUBLE_VEC4),
+   ENUM_STRING(GL_INT),
+   ENUM_STRING(GL_INT_VEC2),
+   ENUM_STRING(GL_INT_VEC3),
+   ENUM_STRING(GL_INT_VEC4),
+   ENUM_STRING(GL_UNSIGNED_INT),
+   ENUM_STRING(GL_UNSIGNED_INT_VEC2),
+   ENUM_STRING(GL_UNSIGNED_INT_VEC3),
+   ENUM_STRING(GL_UNSIGNED_INT_VEC4),
+   ENUM_STRING(GL_BOOL),
+   ENUM_STRING(GL_BOOL_VEC2),
+   ENUM_STRING(GL_BOOL_VEC3),
+   ENUM_STRING(GL_BOOL_VEC4),
+   ENUM_STRING(GL_FLOAT_MAT2),
+   ENUM_STRING(GL_FLOAT_MAT3),
+   ENUM_STRING(GL_FLOAT_MAT4),
+   ENUM_STRING(GL_FLOAT_MAT2x3),
+   ENUM_STRING(GL_FLOAT_MAT2x4),
+   ENUM_STRING(GL_FLOAT_MAT3x2),
+   ENUM_STRING(GL_FLOAT_MAT3x4),
+   ENUM_STRING(GL_FLOAT_MAT4x2),
+   ENUM_STRING(GL_FLOAT_MAT4x3),
+   ENUM_STRING(GL_DOUBLE_MAT2),
+   ENUM_STRING(GL_DOUBLE_MAT3),
+   ENUM_STRING(GL_DOUBLE_MAT4),
+   ENUM_STRING(GL_DOUBLE_MAT2x3),
+   ENUM_STRING(GL_DOUBLE_MAT2x4),
+   ENUM_STRING(GL_DOUBLE_MAT3x2),
+   ENUM_STRING(GL_DOUBLE_MAT3x4),
+   ENUM_STRING(GL_DOUBLE_MAT4x2),
+   ENUM_STRING(GL_DOUBLE_MAT4x3),
+   ENUM_STRING(GL_SAMPLER_1D),
+   ENUM_STRING(GL_SAMPLER_2D),
+   ENUM_STRING(GL_SAMPLER_3D),
+   ENUM_STRING(GL_SAMPLER_CUBE),
+   ENUM_STRING(GL_SAMPLER_1D_SHADOW),
+   ENUM_STRING(GL_SAMPLER_2D_SHADOW),
+   ENUM_STRING(GL_SAMPLER_1D_ARRAY),
+   ENUM_STRING(GL_SAMPLER_2D_ARRAY),
+   ENUM_STRING(GL_SAMPLER_1D_ARRAY_SHADOW),
+   ENUM_STRING(GL_SAMPLER_2D_ARRAY_SHADOW),
+   ENUM_STRING(GL_SAMPLER_2D_MULTISAMPLE),
+   ENUM_STRING(GL_SAMPLER_2D_MULTISAMPLE_ARRAY),
+   ENUM_STRING(GL_SAMPLER_CUBE_SHADOW),
+   ENUM_STRING(GL_SAMPLER_BUFFER),
+   ENUM_STRING(GL_SAMPLER_2D_RECT),
+   ENUM_STRING(GL_SAMPLER_2D_RECT_SHADOW),
+   ENUM_STRING(GL_INT_SAMPLER_1D),
+   ENUM_STRING(GL_INT_SAMPLER_2D),
+   ENUM_STRING(GL_INT_SAMPLER_3D),
+   ENUM_STRING(GL_INT_SAMPLER_CUBE),
+   ENUM_STRING(GL_INT_SAMPLER_1D_ARRAY),
+   ENUM_STRING(GL_INT_SAMPLER_2D_ARRAY),
+   ENUM_STRING(GL_INT_SAMPLER_2D_MULTISAMPLE),
+   ENUM_STRING(GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY),
+   ENUM_STRING(GL_INT_SAMPLER_BUFFER),
+   ENUM_STRING(GL_INT_SAMPLER_2D_RECT),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_1D),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_2D),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_3D),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_CUBE),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_1D_ARRAY),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_2D_ARRAY),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_BUFFER),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_2D_RECT),
+   { NULL, 0 }
+};
+
 GLenum
 lookup_enum_string(const struct string_to_enum *table, const char **line,
   const char *error_desc)
@@ -1860,84 +1938,6 @@ active_uniform(const char *line)
{ NULL, 0 }
};
 
-   static const struct string_to_enum all_types[] = {
-   ENUM_STRING(GL_FLOAT),
-   ENUM_STRING(GL_FLOAT_VEC2),
-   ENUM_STRING(GL_FLOAT_VEC3),
-   ENUM_STRING(GL_FLOAT_VEC4),
-   ENUM_STRING(GL_DOUBLE),
-   ENUM_STRING(GL_DOUBLE_VEC2),
-   ENUM_STRING(GL_DOUBLE_VEC3),
-   ENUM_STRING(GL_DOUBLE_VEC4),
-   ENUM_STRING(GL_INT),
-   ENUM_STRING(GL_INT_VEC2),
-   ENUM_STRING(GL_INT_VEC3),
-   ENUM_STRING(GL_INT_VEC4),
-   ENUM_STRING(GL_UNSIGNED_INT),
-   ENUM_STRING(GL_UNSIGNED_INT_VEC2),
-   ENUM_STRING(GL_UNSIGNED_INT_VEC3),
-   ENUM_STRING(GL_UNSIGNED_INT_VEC4),
-   ENUM_STRING(GL_BOOL),
-   ENUM_STRING(GL_BOOL_VEC2),
-   ENUM_STRING(GL_BOOL_VEC3),
-   ENUM_STRING(GL_BOOL_VEC4),
-   ENUM_STRING(GL_FLOAT_MAT2),
-   ENUM_STRING(GL_FLOAT_MAT3),
-   ENUM_STRING(GL_FLOAT_MAT4),
-   ENUM_STRING(GL_FLOAT_MAT2x3),
-   ENUM_STRING(GL_FLOAT_

[Piglit] [PATCH 0/2] shader_runner: Add ARB_program_interface_query support

2015-09-16 Thread Samuel Iglesias Gonsalvez
Hello,

Following my idea described here [0], I modified shader_runner to accept
other program interfaces.

The format of the command is:

 active program_interface GL_INTERFACE_TYPE_ENUM var_name GL_PROPS_ENUM integer
 
or, if we include the GL type enum:

 active program_interface GL_INTERFACE_TYPE_ENUM var_name GL_PROPS_ENUM 
GL_TYPE_ENUM

Some examples:

active program_interface GL_UNIFORM i1 GL_MATRIX_STRIDE 0
active program_interface GL_UNIFORM i1 GL_IS_ROW_MAJOR 0
active program_interface GL_PROGRAM_OUTPUT piglit_fragcolor GL_TYPE 
GL_FLOAT_VEC4
active program_interface GL_PROGRAM_INPUT piglit_vertex GL_TYPE GL_FLOAT_VEC4

What do you think?

Thanks,

Sam

[0] http://lists.freedesktop.org/archives/piglit/2015-September/017080.html 

Samuel Iglesias Gonsalvez (2):
  shader_runner: make active_uniforms's all_types variable be global
  shader_runner: Add ARB_program_interface_query support

 tests/shaders/shader_runner.c | 322 --
 1 file changed, 244 insertions(+), 78 deletions(-)

-- 
2.1.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 2/2] shader_runner: Add ARB_program_interface_query support

2015-09-16 Thread Samuel Iglesias Gonsalvez
Signed-off-by: Samuel Iglesias Gonsalvez <sigles...@igalia.com>
---
 tests/shaders/shader_runner.c | 166 ++
 1 file changed, 166 insertions(+)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 7a647a1..814db33 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -2046,6 +2046,170 @@ active_uniform(const char *line)
return;
 }
 
+/**
+ * Query a uniform using glGetActiveUniformsiv
+ *
+ * Format of the command:
+ *
+ *  active program_interface GL_INTERFACE_TYPE_ENUM name GL_PNAME_ENUM integer
+ *
+ * or
+ *
+ *  active program_interface GL_INTERFACE_TYPE_ENUM name GL_PNAME_ENUM 
GL_TYPE_ENUM
+ */
+void
+active_program_interface(const char *line)
+{
+   static const struct string_to_enum all_props[] = {
+   ENUM_STRING(GL_TYPE),
+   ENUM_STRING(GL_ARRAY_SIZE),
+   ENUM_STRING(GL_NAME_LENGTH),
+   ENUM_STRING(GL_BLOCK_INDEX),
+   ENUM_STRING(GL_OFFSET),
+   ENUM_STRING(GL_ARRAY_STRIDE),
+   ENUM_STRING(GL_MATRIX_STRIDE),
+   ENUM_STRING(GL_IS_ROW_MAJOR),
+   ENUM_STRING(GL_ATOMIC_COUNTER_BUFFER_INDEX),
+   ENUM_STRING(GL_BUFFER_BINDING),
+   ENUM_STRING(GL_BUFFER_DATA_SIZE),
+   ENUM_STRING(GL_NUM_ACTIVE_VARIABLES),
+   ENUM_STRING(GL_REFERENCED_BY_VERTEX_SHADER),
+   ENUM_STRING(GL_REFERENCED_BY_TESS_CONTROL_SHADER),
+   ENUM_STRING(GL_REFERENCED_BY_TESS_EVALUATION_SHADER),
+   ENUM_STRING(GL_REFERENCED_BY_GEOMETRY_SHADER),
+   ENUM_STRING(GL_REFERENCED_BY_FRAGMENT_SHADER),
+   ENUM_STRING(GL_REFERENCED_BY_COMPUTE_SHADER),
+   ENUM_STRING(GL_TOP_LEVEL_ARRAY_SIZE),
+   ENUM_STRING(GL_TOP_LEVEL_ARRAY_STRIDE),
+   ENUM_STRING(GL_LOCATION),
+   ENUM_STRING(GL_LOCATION_INDEX),
+   ENUM_STRING(GL_IS_PER_PATCH),
+   ENUM_STRING(GL_NUM_COMPATIBLE_SUBROUTINES),
+   ENUM_STRING(GL_COMPATIBLE_SUBROUTINES),
+   { NULL, 0 }
+   };
+
+   static const struct string_to_enum all_program_interface[] = {
+   ENUM_STRING(GL_UNIFORM),
+   ENUM_STRING(GL_UNIFORM_BLOCK),
+   ENUM_STRING(GL_PROGRAM_INPUT),
+   ENUM_STRING(GL_PROGRAM_OUTPUT),
+   ENUM_STRING(GL_BUFFER_VARIABLE),
+   ENUM_STRING(GL_SHADER_STORAGE_BUFFER),
+   ENUM_STRING(GL_ATOMIC_COUNTER_BUFFER),
+   ENUM_STRING(GL_VERTEX_SUBROUTINE),
+   ENUM_STRING(GL_TESS_CONTROL_SUBROUTINE),
+   ENUM_STRING(GL_TESS_EVALUATION_SUBROUTINE),
+   ENUM_STRING(GL_GEOMETRY_SUBROUTINE),
+   ENUM_STRING(GL_FRAGMENT_SUBROUTINE),
+   ENUM_STRING(GL_COMPUTE_SUBROUTINE),
+   ENUM_STRING(GL_VERTEX_SUBROUTINE_UNIFORM),
+   ENUM_STRING(GL_TESS_CONTROL_SUBROUTINE_UNIFORM),
+   ENUM_STRING(GL_TESS_EVALUATION_SUBROUTINE_UNIFORM),
+   ENUM_STRING(GL_GEOMETRY_SUBROUTINE_UNIFORM),
+   ENUM_STRING(GL_FRAGMENT_SUBROUTINE_UNIFORM),
+   ENUM_STRING(GL_COMPUTE_SUBROUTINE_UNIFORM),
+   ENUM_STRING(GL_TRANSFORM_FEEDBACK_VARYING),
+   { NULL, 0 }
+   };
+
+   char name[512];
+   char name_buf[512];
+   char prop_string[512];
+   char interface_type_string[512];
+   GLenum prop, interface_type;
+   GLint expected;
+   int i;
+   int num_active_buffers;
+
+   if (!piglit_is_extension_supported("GL_ARB_program_interface_query") &&
+   piglit_get_gl_version() < 43) {
+   fprintf(stderr,
+   "GL_ARB_program_interface_query not supported or "
+   "OpenGL version < 4.3\n");
+   return;
+   }
+
+   strcpy_to_space(interface_type_string, eat_whitespace(line));
+   interface_type = lookup_enum_string(all_program_interface, ,
+   "glGetProgramResourceiv "
+   "programInterface");
+   line = strcpy_to_space(name, eat_whitespace(line));
+
+   strcpy_to_space(prop_string, eat_whitespace(line));
+   prop = lookup_enum_string(all_props, ,
+ "glGetProgramResourceiv pname");
+
+   line = eat_whitespace(line);
+   if (isdigit(line[0])) {
+   expected = strtol(line, NULL, 0);
+   } else {
+   expected = lookup_enum_string(all_types, , "type enum");
+   }
+
+   glGetProgramInterfaceiv(prog, interface_type,
+   GL_ACTIVE_RESOURCES, _active_buffers);
+   for (i = 0; i < num_active_buffers; i++) {
+   GLint got;
+  

[Piglit] [PATCH] arb_shader_image_load_store/compiler: Add memoryBarrier() tests

2015-09-15 Thread Samuel Iglesias Gonsalvez
Signed-off-by: Samuel Iglesias Gonsalvez <sigles...@igalia.com>
---
 generated_tests/gen_shader_image_load_store_tests.py | 8 
 1 file changed, 8 insertions(+)

diff --git a/generated_tests/gen_shader_image_load_store_tests.py 
b/generated_tests/gen_shader_image_load_store_tests.py
index 00c4f27..296cae3 100644
--- a/generated_tests/gen_shader_image_load_store_tests.py
+++ b/generated_tests/gen_shader_image_load_store_tests.py
@@ -819,3 +819,11 @@ gen('builtin-qualifier-mismatch-writeonly', """\
 }
 """, product(image_load_builtin + image_atomic_builtins,
  image_types[:1], shader_stages))
+
+gen('memory-barrier', """\
+${header('pass')}
+void main()
+{
+memoryBarrier();
+}
+""", shader_stages)
-- 
2.1.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [RFC PATCH 1/2] shader_runner: make active_uniforms's all_types variable be global

2015-09-11 Thread Samuel Iglesias Gonsalvez
Signed-off-by: Samuel Iglesias Gonsalvez <sigles...@igalia.com>
---
 tests/shaders/shader_runner.c | 156 +-
 1 file changed, 78 insertions(+), 78 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 0614c7f..7a647a1 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -158,6 +158,84 @@ enum comparison {
less_equal
 };
 
+static const struct string_to_enum all_types[] = {
+   ENUM_STRING(GL_FLOAT),
+   ENUM_STRING(GL_FLOAT_VEC2),
+   ENUM_STRING(GL_FLOAT_VEC3),
+   ENUM_STRING(GL_FLOAT_VEC4),
+   ENUM_STRING(GL_DOUBLE),
+   ENUM_STRING(GL_DOUBLE_VEC2),
+   ENUM_STRING(GL_DOUBLE_VEC3),
+   ENUM_STRING(GL_DOUBLE_VEC4),
+   ENUM_STRING(GL_INT),
+   ENUM_STRING(GL_INT_VEC2),
+   ENUM_STRING(GL_INT_VEC3),
+   ENUM_STRING(GL_INT_VEC4),
+   ENUM_STRING(GL_UNSIGNED_INT),
+   ENUM_STRING(GL_UNSIGNED_INT_VEC2),
+   ENUM_STRING(GL_UNSIGNED_INT_VEC3),
+   ENUM_STRING(GL_UNSIGNED_INT_VEC4),
+   ENUM_STRING(GL_BOOL),
+   ENUM_STRING(GL_BOOL_VEC2),
+   ENUM_STRING(GL_BOOL_VEC3),
+   ENUM_STRING(GL_BOOL_VEC4),
+   ENUM_STRING(GL_FLOAT_MAT2),
+   ENUM_STRING(GL_FLOAT_MAT3),
+   ENUM_STRING(GL_FLOAT_MAT4),
+   ENUM_STRING(GL_FLOAT_MAT2x3),
+   ENUM_STRING(GL_FLOAT_MAT2x4),
+   ENUM_STRING(GL_FLOAT_MAT3x2),
+   ENUM_STRING(GL_FLOAT_MAT3x4),
+   ENUM_STRING(GL_FLOAT_MAT4x2),
+   ENUM_STRING(GL_FLOAT_MAT4x3),
+   ENUM_STRING(GL_DOUBLE_MAT2),
+   ENUM_STRING(GL_DOUBLE_MAT3),
+   ENUM_STRING(GL_DOUBLE_MAT4),
+   ENUM_STRING(GL_DOUBLE_MAT2x3),
+   ENUM_STRING(GL_DOUBLE_MAT2x4),
+   ENUM_STRING(GL_DOUBLE_MAT3x2),
+   ENUM_STRING(GL_DOUBLE_MAT3x4),
+   ENUM_STRING(GL_DOUBLE_MAT4x2),
+   ENUM_STRING(GL_DOUBLE_MAT4x3),
+   ENUM_STRING(GL_SAMPLER_1D),
+   ENUM_STRING(GL_SAMPLER_2D),
+   ENUM_STRING(GL_SAMPLER_3D),
+   ENUM_STRING(GL_SAMPLER_CUBE),
+   ENUM_STRING(GL_SAMPLER_1D_SHADOW),
+   ENUM_STRING(GL_SAMPLER_2D_SHADOW),
+   ENUM_STRING(GL_SAMPLER_1D_ARRAY),
+   ENUM_STRING(GL_SAMPLER_2D_ARRAY),
+   ENUM_STRING(GL_SAMPLER_1D_ARRAY_SHADOW),
+   ENUM_STRING(GL_SAMPLER_2D_ARRAY_SHADOW),
+   ENUM_STRING(GL_SAMPLER_2D_MULTISAMPLE),
+   ENUM_STRING(GL_SAMPLER_2D_MULTISAMPLE_ARRAY),
+   ENUM_STRING(GL_SAMPLER_CUBE_SHADOW),
+   ENUM_STRING(GL_SAMPLER_BUFFER),
+   ENUM_STRING(GL_SAMPLER_2D_RECT),
+   ENUM_STRING(GL_SAMPLER_2D_RECT_SHADOW),
+   ENUM_STRING(GL_INT_SAMPLER_1D),
+   ENUM_STRING(GL_INT_SAMPLER_2D),
+   ENUM_STRING(GL_INT_SAMPLER_3D),
+   ENUM_STRING(GL_INT_SAMPLER_CUBE),
+   ENUM_STRING(GL_INT_SAMPLER_1D_ARRAY),
+   ENUM_STRING(GL_INT_SAMPLER_2D_ARRAY),
+   ENUM_STRING(GL_INT_SAMPLER_2D_MULTISAMPLE),
+   ENUM_STRING(GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY),
+   ENUM_STRING(GL_INT_SAMPLER_BUFFER),
+   ENUM_STRING(GL_INT_SAMPLER_2D_RECT),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_1D),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_2D),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_3D),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_CUBE),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_1D_ARRAY),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_2D_ARRAY),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_BUFFER),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_2D_RECT),
+   { NULL, 0 }
+};
+
 GLenum
 lookup_enum_string(const struct string_to_enum *table, const char **line,
   const char *error_desc)
@@ -1860,84 +1938,6 @@ active_uniform(const char *line)
{ NULL, 0 }
};
 
-   static const struct string_to_enum all_types[] = {
-   ENUM_STRING(GL_FLOAT),
-   ENUM_STRING(GL_FLOAT_VEC2),
-   ENUM_STRING(GL_FLOAT_VEC3),
-   ENUM_STRING(GL_FLOAT_VEC4),
-   ENUM_STRING(GL_DOUBLE),
-   ENUM_STRING(GL_DOUBLE_VEC2),
-   ENUM_STRING(GL_DOUBLE_VEC3),
-   ENUM_STRING(GL_DOUBLE_VEC4),
-   ENUM_STRING(GL_INT),
-   ENUM_STRING(GL_INT_VEC2),
-   ENUM_STRING(GL_INT_VEC3),
-   ENUM_STRING(GL_INT_VEC4),
-   ENUM_STRING(GL_UNSIGNED_INT),
-   ENUM_STRING(GL_UNSIGNED_INT_VEC2),
-   ENUM_STRING(GL_UNSIGNED_INT_VEC3),
-   ENUM_STRING(GL_UNSIGNED_INT_VEC4),
-   ENUM_STRING(GL_BOOL),
-   ENUM_STRING(GL_BOOL_VEC2),
-   ENUM_STRING(GL_BOOL_VEC3),
-   ENUM_STRING(GL_BOOL_VEC4),
-   ENUM_STRING(GL_FLOAT_MAT2),
-   ENUM_STRING(GL_FLOAT_MAT3),
-   ENUM_STRING(GL_FLOAT_MAT4),
-   ENUM_STRING(GL_FLOAT_MAT2x3),
-   ENUM_STRING(GL_FLOAT_

[Piglit] [RFC PATCH 0/2] Add ARB_program_interface_query support to shader_runner

2015-09-11 Thread Samuel Iglesias Gonsalvez
Hello,

Recently, I have been working on enabling std430 support to Mesa. During the
review of the patches, I have been told to take a look at Ian's Stochastic
Search-Based Testing for Uniform Block Layouts [0] to improve the testing of
the std430 changes

Thanks Ian for your work! I found some bugs in my std430 code with this
testing :-)

I did some quick changes [1] to have it working for shader storage buffers and
std430. During that process, I found that we don't support
ARB_program_interface_query extension [2] queries in shader_runner.
Shader runner supports similar queries but only for uniforms.

These patches are the result of implementing buffer variable support to
that queries, but I think it is interesting to have a more generic API that
includes the rest of program interfaces (GL_UNIFORM, GL_PROGRAM_INPUT...).

So, I would like to reach a consensus with piglit community about the
format of the commands. My idea is to take the uniform queries as an example
but adapting the format to our needs. For example:

- Format of the command:
 active program_interface GL_INTERFACE_TYPE_ENUM var_name GL_PROPS_ENUM integer
 
or, if we include the GL type enum:

 active program_interface GL_INTERFACE_TYPE_ENUM var_name GL_PROPS_ENUM 
GL_TYPE_ENUM

So in practice you would add to the [test] section some code like this:

active program_interface GL_BUFFER_VARIABLE foo_name GL_ARRAY_SIZE 1
active program_interface GL_UNIFORM bar_name GL_TYPE GL_FLOAT_VEC4

What do you think?

Sam

[0] 
http://www.paranormal-entertainment.com/idr/blog/posts/2014-10-08T13:28:09Z-Stochastic_Search-Based_Testing_for_Uniform_Block_Layouts/
[1] Repo with latest code: g...@github.com:Igalia/piglit.git
Branch: ssbo-random-tests-std430-v2
[2] https://www.opengl.org/registry/specs/ARB/program_interface_query.txt


Samuel Iglesias Gonsalvez (2):
  shader_runner: make active_uniforms's all_types variable be global
  shader_runner: Add ARB_program_interface_query support to buffer
variables

 tests/shaders/shader_runner.c | 292 +++---
 1 file changed, 214 insertions(+), 78 deletions(-)

-- 
2.1.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [RFC PATCH 2/2] shader_runner: Add ARB_program_interface_query support to buffer variables

2015-09-11 Thread Samuel Iglesias Gonsalvez
Signed-off-by: Samuel Iglesias Gonsalvez <sigles...@igalia.com>
---
 tests/shaders/shader_runner.c | 136 ++
 1 file changed, 136 insertions(+)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 7a647a1..81d694c 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -2046,6 +2046,140 @@ active_uniform(const char *line)
return;
 }
 
+/**
+ * Query a uniform using glGetActiveUniformsiv
+ *
+ * Format of the command:
+ *
+ * active buffer_variable buffer_var_name GL_PNAME_ENUM integer
+ *
+ * or
+ *
+ * active buffer_variable buffer_var_name GL_PNAME_ENUM GL_TYPE_ENUM
+ */
+void
+active_buffer_variable(const char *line)
+{
+   static const struct string_to_enum all_props[] = {
+   ENUM_STRING(GL_TYPE),
+   ENUM_STRING(GL_ARRAY_SIZE),
+   ENUM_STRING(GL_NAME_LENGTH),
+   ENUM_STRING(GL_BLOCK_INDEX),
+   ENUM_STRING(GL_OFFSET),
+   ENUM_STRING(GL_ARRAY_STRIDE),
+   ENUM_STRING(GL_MATRIX_STRIDE),
+   ENUM_STRING(GL_IS_ROW_MAJOR),
+   ENUM_STRING(GL_ATOMIC_COUNTER_BUFFER_INDEX),
+   ENUM_STRING(GL_BUFFER_BINDING),
+   ENUM_STRING(GL_BUFFER_DATA_SIZE),
+   ENUM_STRING(GL_NUM_ACTIVE_VARIABLES),
+   ENUM_STRING(GL_REFERENCED_BY_VERTEX_SHADER),
+   ENUM_STRING(GL_REFERENCED_BY_TESS_CONTROL_SHADER),
+   ENUM_STRING(GL_REFERENCED_BY_TESS_EVALUATION_SHADER),
+   ENUM_STRING(GL_REFERENCED_BY_GEOMETRY_SHADER),
+   ENUM_STRING(GL_REFERENCED_BY_FRAGMENT_SHADER),
+   ENUM_STRING(GL_REFERENCED_BY_COMPUTE_SHADER),
+   ENUM_STRING(GL_TOP_LEVEL_ARRAY_SIZE),
+   ENUM_STRING(GL_TOP_LEVEL_ARRAY_STRIDE),
+   ENUM_STRING(GL_LOCATION),
+   ENUM_STRING(GL_LOCATION_INDEX),
+   ENUM_STRING(GL_IS_PER_PATCH),
+   ENUM_STRING(GL_NUM_COMPATIBLE_SUBROUTINES),
+   ENUM_STRING(GL_COMPATIBLE_SUBROUTINES),
+   { NULL, 0 }
+   };
+
+   char name[512];
+   char name_buf[512];
+   char prop_string[512];
+   GLenum prop;
+   GLint expected;
+   int i;
+   int num_active_buffers;
+
+   if (!piglit_is_extension_supported("GL_ARB_program_interface_query") &&
+   piglit_get_gl_version() < 43) {
+   fprintf(stderr,
+   "GL_ARB_program_interface_query not supported or "
+   "OpenGL version < 4.3\n")
+   return;
+   }
+
+   line = strcpy_to_space(name, eat_whitespace(line));
+
+   strcpy_to_space(prop_string, eat_whitespace(line));
+   prop = lookup_enum_string(all_props, , "glGetProgramResourceiv 
pname");
+
+   line = eat_whitespace(line);
+   if (isdigit(line[0])) {
+   expected = strtol(line, NULL, 0);
+   } else {
+   expected = lookup_enum_string(all_types, , "type enum");
+   }
+
+   glGetProgramInterfaceiv(prog, GL_BUFFER_VARIABLE,
+   GL_ACTIVE_RESOURCES, _active_buffers);
+   for (i = 0; i < num_active_buffers; i++) {
+   GLint got;
+   GLint length;
+   GLsizei name_len;
+   bool pass = true;
+
+   glGetProgramResourceName(prog, GL_BUFFER_VARIABLE,
+i, 512, _len, name_buf);
+
+   if (!piglit_check_gl_error(GL_NO_ERROR)) {
+   fprintf(stderr, "glGetProgramResourceName error\n");
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   if (strcmp(name, name_buf) != 0)
+   continue;
+
+   if (prop == GL_NAME_LENGTH && name_len != expected) {
+   fprintf(stderr,
+   "glGetProgramResourceName(%s, %s): "
+   "expected %d (0x%04x), got %d (0x%04x)\n",
+   name, prop_string,
+   expected, expected, got, got);
+   pass = false;
+   }
+
+   /* Set 'got' to some value in case glGetActiveUniformsiv
+* doesn't write to it.  That should only be able to occur
+* when the function raises a GL error, but "should" is kind
+* of a funny word.
+*/
+   got = ~expected;
+   glGetProgramResourceiv(prog, GL_BUFFER_VARIABLE,
+  i, 1, , 1,
+  , );
+
+   if (!piglit_check_gl_error(GL_NO_ERROR)) {
+   fprintf(stderr, "glGetProgramResourceiv

[Piglit] [PATCH] arb_shader_storage_buffer_object: fix TOP_LEVEL_ARRAY_STRIDE expected value for std430 case

2015-09-09 Thread Samuel Iglesias Gonsalvez
struct B has a size of 52. Interface packing layout qualifier std430 says that
the array of structures are not rounded up a multiple of the base alignment of
a vec4 but to the next multiple of the base alignment of the structure.

The base alignment of a structure is N, where N is the largest base
alignment value of any of its members.

In this case the largest base alignment is 8 (which is mat2's base alignment
following std430 rules), so 52 is rounded up to 56, not to 64.

Tested on NVIDIA proprietary driver version 352.21.

Signed-off-by: Samuel Iglesias Gonsalvez <sigles...@igalia.com>
---
 tests/spec/arb_shader_storage_buffer_object/program-interface-query.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/tests/spec/arb_shader_storage_buffer_object/program-interface-query.c 
b/tests/spec/arb_shader_storage_buffer_object/program-interface-query.c
index 2044898..68cbbff 100644
--- a/tests/spec/arb_shader_storage_buffer_object/program-interface-query.c
+++ b/tests/spec/arb_shader_storage_buffer_object/program-interface-query.c
@@ -110,7 +110,7 @@ piglit_init(int argc, char **argv)
const int expected_std140[NUM_QUERIES] =
{ 0, 112, GL_FLOAT_MAT2, 3, 0, 16, 32, 16, 1, 1, 0 };
const int expected_std430[NUM_QUERIES] =
-   { 2, 64, GL_FLOAT_MAT2, 3, 2, 16, 16, 8, 0, 0, 1 };
+   { 2, 56, GL_FLOAT_MAT2, 3, 2, 16, 16, 8, 0, 0, 1 };
int i;
 
piglit_require_extension("GL_ARB_shader_storage_buffer_object");
-- 
2.1.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] arb_shader_storage_buffer_object: modify tests to use gl_core_version = 32

2015-07-24 Thread Samuel Iglesias Gonsalvez
Recently, some of them were returning errors on glGetIntegerv() calls for
shader storage buffer constants in Mesa because they used GL compat 1.0
version.

Some shaders were modified to avoid GL_INVALID_OPERATION in
glDrawArray(No VAO bound) Mesa errors when calling piglit_draw_rect() with
this config.

Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
---
 .../arb_shader_storage_buffer_object/array-ssbo-binding.c|  4 ++--
 tests/spec/arb_shader_storage_buffer_object/deletebuffers.c  |  3 ++-
 tests/spec/arb_shader_storage_buffer_object/getintegeri_v.c  |  3 ++-
 .../layout-std140-write-shader.c |  4 ++--
 .../layout-std430-write-shader.c |  4 ++--
 tests/spec/arb_shader_storage_buffer_object/max-ssbo-size.c  | 12 
 tests/spec/arb_shader_storage_buffer_object/maxblocks.c  |  9 ++---
 .../program-interface-query.c|  4 ++--
 tests/spec/arb_shader_storage_buffer_object/rendering.c  |  7 +--
 tests/spec/arb_shader_storage_buffer_object/ssbo-binding.c   |  4 ++--
 10 files changed, 33 insertions(+), 21 deletions(-)

diff --git a/tests/spec/arb_shader_storage_buffer_object/array-ssbo-binding.c 
b/tests/spec/arb_shader_storage_buffer_object/array-ssbo-binding.c
index 14787f1..f3c7d15 100644
--- a/tests/spec/arb_shader_storage_buffer_object/array-ssbo-binding.c
+++ b/tests/spec/arb_shader_storage_buffer_object/array-ssbo-binding.c
@@ -33,8 +33,8 @@
 PIGLIT_GL_TEST_CONFIG_BEGIN
config.window_width = 100;
config.window_height = 100;
-   config.supports_gl_compat_version = 10;
-   config.supports_gl_core_version = 31;
+   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
diff --git a/tests/spec/arb_shader_storage_buffer_object/deletebuffers.c 
b/tests/spec/arb_shader_storage_buffer_object/deletebuffers.c
index ff8783f..947bca9 100644
--- a/tests/spec/arb_shader_storage_buffer_object/deletebuffers.c
+++ b/tests/spec/arb_shader_storage_buffer_object/deletebuffers.c
@@ -32,7 +32,8 @@
 
 PIGLIT_GL_TEST_CONFIG_BEGIN
 
-   config.supports_gl_compat_version = 10;
+   config.supports_gl_compat_version = 32;
+   config.supports_gl_core_version = 32;
config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
 
 PIGLIT_GL_TEST_CONFIG_END
diff --git a/tests/spec/arb_shader_storage_buffer_object/getintegeri_v.c 
b/tests/spec/arb_shader_storage_buffer_object/getintegeri_v.c
index 05c8d0e..9e7617f 100644
--- a/tests/spec/arb_shader_storage_buffer_object/getintegeri_v.c
+++ b/tests/spec/arb_shader_storage_buffer_object/getintegeri_v.c
@@ -41,7 +41,8 @@
 
 PIGLIT_GL_TEST_CONFIG_BEGIN
 
-   config.supports_gl_compat_version = 10;
+   config.supports_gl_compat_version = 32;
+   config.supports_gl_core_version = 32;
config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
 
 PIGLIT_GL_TEST_CONFIG_END
diff --git 
a/tests/spec/arb_shader_storage_buffer_object/layout-std140-write-shader.c 
b/tests/spec/arb_shader_storage_buffer_object/layout-std140-write-shader.c
index bcddce5..1eaba37 100644
--- a/tests/spec/arb_shader_storage_buffer_object/layout-std140-write-shader.c
+++ b/tests/spec/arb_shader_storage_buffer_object/layout-std140-write-shader.c
@@ -32,8 +32,8 @@
 PIGLIT_GL_TEST_CONFIG_BEGIN
config.window_width = 100;
config.window_height = 100;
-   config.supports_gl_compat_version = 10;
-   config.supports_gl_core_version = 31;
+   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
diff --git 
a/tests/spec/arb_shader_storage_buffer_object/layout-std430-write-shader.c 
b/tests/spec/arb_shader_storage_buffer_object/layout-std430-write-shader.c
index 75d7b09..c25e921 100644
--- a/tests/spec/arb_shader_storage_buffer_object/layout-std430-write-shader.c
+++ b/tests/spec/arb_shader_storage_buffer_object/layout-std430-write-shader.c
@@ -40,8 +40,8 @@
 PIGLIT_GL_TEST_CONFIG_BEGIN
config.window_width = 100;
config.window_height = 100;
-   config.supports_gl_compat_version = 10;
-   config.supports_gl_core_version = 31;
+   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
diff --git a/tests/spec/arb_shader_storage_buffer_object/max-ssbo-size.c 
b/tests/spec/arb_shader_storage_buffer_object/max-ssbo-size.c
index ac33fac..4595349 100644
--- a/tests/spec/arb_shader_storage_buffer_object/max-ssbo-size.c
+++ b/tests/spec/arb_shader_storage_buffer_object/max-ssbo-size.c
@@ -33,8 +33,8 @@
 
 PIGLIT_GL_TEST_CONFIG_BEGIN

[Piglit] [PATCH] arb_shader_storage_buffer_object/maxblocks: fail test if glGetIntegerv() gives an error

2015-07-10 Thread Samuel Iglesias Gonsalvez
Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
---
 tests/spec/arb_shader_storage_buffer_object/maxblocks.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/spec/arb_shader_storage_buffer_object/maxblocks.c 
b/tests/spec/arb_shader_storage_buffer_object/maxblocks.c
index 74c95fe..d87b58c 100644
--- a/tests/spec/arb_shader_storage_buffer_object/maxblocks.c
+++ b/tests/spec/arb_shader_storage_buffer_object/maxblocks.c
@@ -284,6 +284,9 @@ piglit_display(void)
glGetIntegerv(GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS, max_combined);
glGetIntegerv(GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES, 
max_combined_out);
 
+   if (!piglit_check_gl_error(GL_NO_ERROR))
+ return PIGLIT_FAIL;
+
printf(Max VS shader storage blocks: %d\n, max_vs);
printf(Max FS shader storage blocks: %d\n, max_fs);
printf(Max combined shader storage blocks: %d\n, max_combined);
-- 
2.1.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH v2] program_interface_query: add new subtest for getprogramresourceiv

2015-05-20 Thread Samuel Iglesias Gonsalvez
Test that uniforms inside arrays of uniform blocks with instance name are
queried properly.

Tested on NVIDIA's proprietary driver version 340.65

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90397

Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
---

V2:

  * Change instance name for the array of uniform blocks
  * Delete modification of an unrelated test.

 tests/spec/arb_program_interface_query/common.h   | 12 +---
 .../getprogramresourceiv.c| 19 +++
 .../spec/arb_program_interface_query/resource-query.c | 16 
 3 files changed, 40 insertions(+), 7 deletions(-)

diff --git a/tests/spec/arb_program_interface_query/common.h 
b/tests/spec/arb_program_interface_query/common.h
index 55f0358..e083a6e 100755
--- a/tests/spec/arb_program_interface_query/common.h
+++ b/tests/spec/arb_program_interface_query/common.h
@@ -102,13 +102,19 @@ static const char fs_std[] =
uniform fs_uniform_block {
   vec4 fs_color;\n
   float fs_array[4];\n
-   };
+   };\n
+   uniform fs_array_uniform_block {\n
+  vec4 fs_color;\n
+  float fs_array[4];\n
+   } faub[4];\n
in vec4 fs_input1;\n
out vec4 fs_output0;\n
out vec4 fs_output1;\n
void main() {\n
-   fs_output0 = fs_color * fs_input1 * fs_array[2];\n
-   fs_output1 = fs_color * fs_input1 * fs_array[3];\n
+   fs_output0 = fs_color * fs_input1 * fs_array[2] * \n
+faub[0].fs_array[2] * faub[2].fs_array[2];\n
+   fs_output1 = fs_color * fs_input1 * fs_array[3] * \n
+faub[1].fs_array[3] * faub[3].fs_array[3];\n
};
 
 static const char vs_stor[] =
diff --git a/tests/spec/arb_program_interface_query/getprogramresourceiv.c 
b/tests/spec/arb_program_interface_query/getprogramresourceiv.c
index da9751a..03f2fc6 100755
--- a/tests/spec/arb_program_interface_query/getprogramresourceiv.c
+++ b/tests/spec/arb_program_interface_query/getprogramresourceiv.c
@@ -454,6 +454,25 @@ static const struct subtest_t subtests[] = {
{ GL_REFERENCED_BY_COMPUTE_SHADER, 1, { 0 } },
{ 0, 0, { 0 } }}
  },
+ { prog_std, GL_UNIFORM, fs_array_uniform_block.fs_array, 
fs_array_uniform_block[0], {
+   { GL_NAME_LENGTH, 1, { 35 } },
+   { GL_TYPE, 1, { GL_FLOAT } },
+   { GL_ARRAY_SIZE, 1, { 4 } },
+   { GL_OFFSET, 1, { 0 } }, /* valid index == anything but -1 */
+   { GL_BLOCK_INDEX, 1, { 2 } }, /* compared to 
fs_array_uniform_block[0]'s idx */
+   { GL_ARRAY_STRIDE, 1, { 0 } }, /* valid index == anything but -1 */
+   { GL_MATRIX_STRIDE, 1, { 0 } },
+   { GL_IS_ROW_MAJOR, 1, { 0 } },
+   { GL_ATOMIC_COUNTER_BUFFER_INDEX, 1, { -1 } }, /* valid index == 
anything but -1 */
+   { GL_REFERENCED_BY_VERTEX_SHADER, 1, { 0 } },
+   { GL_REFERENCED_BY_TESS_CONTROL_SHADER, 1, { 0 } },
+   { GL_REFERENCED_BY_TESS_EVALUATION_SHADER, 1, { 0 } },
+   { GL_REFERENCED_BY_GEOMETRY_SHADER, 1, { 0 } },
+   { GL_REFERENCED_BY_FRAGMENT_SHADER, 1, { 1 } },
+   { GL_REFERENCED_BY_COMPUTE_SHADER, 1, { 0 } },
+   { GL_LOCATION, 1, { -1 } }, /* valid index == anything but -1 */
+   { 0, 0, { 0 } }}
+ },
  { prog_stor, GL_BUFFER_VARIABLE, gs_buf_var, gs_buffer_block, {
{ GL_NAME_LENGTH, 1, { 11 } },
{ GL_TYPE, 1, { GL_FLOAT_VEC4 } },
diff --git a/tests/spec/arb_program_interface_query/resource-query.c 
b/tests/spec/arb_program_interface_query/resource-query.c
index 92b8cd8..1db5585 100755
--- a/tests/spec/arb_program_interface_query/resource-query.c
+++ b/tests/spec/arb_program_interface_query/resource-query.c
@@ -189,13 +189,21 @@ PIGLIT_GL_TEST_CONFIG_END
  * white space anywhere in the string.
  */
 static const char *st_r_uniform[] = {vs_test, gs_test, fs_color,
-fs_array[0], sa[0].a[0], sa[1].a[0],
+fs_array[0],
+fs_array_uniform_block.fs_color,
+fs_array_uniform_block.fs_array[0],
+sa[0].a[0], sa[1].a[0],
 NULL};
 static const char *st_r_tess_uniform[] = {tcs_test, tes_test, NULL};
 static const char *st_r_cs_uniform[] = {cs_test, tex, NULL};
 static const char *st_r_uniform_block[] = {vs_uniform_block,
   gs_uniform_block,
-  fs_uniform_block, NULL};
+  fs_uniform_block,
+  fs_array_uniform_block[0],
+  fs_array_uniform_block[1],
+  fs_array_uniform_block[2],
+  fs_array_uniform_block[3],
+  NULL

[Piglit] [PATCH] arb_uniform_buffer_object: fix UNIFORM_BUFFER_START and UNIFORM_BUFFER_SIZE queries when no buffer object is bound

2015-05-14 Thread Samuel Iglesias Gonsalvez
According to ARB_uniform_buffer_object spec:

If the parameter (starting offset or size) was not specified when the
 buffer object was bound (e.g. if bound with BindBufferBase), or if no
 buffer object is bound to index, zero is returned.

Tested on NVIDIA's proprietary driver version 340.65 and ATI proprietary
driver version 13.35.1005.

Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
---
 tests/spec/arb_uniform_buffer_object/getintegeri_v.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/spec/arb_uniform_buffer_object/getintegeri_v.c 
b/tests/spec/arb_uniform_buffer_object/getintegeri_v.c
index d1b685f..9ed5fcc 100644
--- a/tests/spec/arb_uniform_buffer_object/getintegeri_v.c
+++ b/tests/spec/arb_uniform_buffer_object/getintegeri_v.c
@@ -79,7 +79,7 @@ piglit_init(int argc, char **argv)
 
piglit_require_extension(GL_ARB_uniform_buffer_object);
 
-   test_range(__LINE__, 0, 0, -1, -1);
+   test_range(__LINE__, 0, 0, 0, 0);
 
glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, alignment);
 
@@ -117,7 +117,7 @@ piglit_init(int argc, char **argv)
 * of the GL API, including glBindBuffer(), to allow it
 */
glBindBufferBase(GL_UNIFORM_BUFFER, 0, 0);
-   test_range(__LINE__, 0, 0, -1, -1);
+   test_range(__LINE__, 0, 0, 0, 0);
 
/* Test the error condition. */
glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, max_bindings);
-- 
2.1.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 07/13] arb_shader_storage_buffer_object: Add new test for glDeleteBuffers() behavior

2015-05-14 Thread Samuel Iglesias Gonsalvez
Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
---
 tests/all.py   |   1 +
 .../CMakeLists.gl.txt  |   1 +
 .../deletebuffers.c| 105 +
 3 files changed, 107 insertions(+)
 create mode 100644 tests/spec/arb_shader_storage_buffer_object/deletebuffers.c

diff --git a/tests/all.py b/tests/all.py
index 3475ecb..5698543 100755
--- a/tests/all.py
+++ b/tests/all.py
@@ -4037,6 +4037,7 @@ with profile.group_manager(
 g(['arb_shader_storage_buffer_object-rendering'], 'rendering')
 g(['arb_shader_storage_buffer_object-maxshaderstorageblocksize '], 
'maxshaderstorageblocksize')
 g(['arb_shader_storage_buffer_object-getintegeri_v'], 'getintegeri_v')
+g(['arb_shader_storage_buffer_object-deletebuffers'], 'deletebuffers')
 
 with profile.group_manager(
 PiglitGLTest,
diff --git a/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt 
b/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
index a3cc175..e2b716b 100644
--- a/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
+++ b/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
@@ -12,5 +12,6 @@ piglit_add_executable 
(arb_shader_storage_buffer_object-minmax minmax.c)
 piglit_add_executable (arb_shader_storage_buffer_object-rendering rendering.c)
 piglit_add_executable 
(arb_shader_storage_buffer_object-maxshaderstorageblocksize 
maxshaderstorageblocksize.c)
 piglit_add_executable (arb_shader_storage_buffer_object-getintegeri_v 
getintegeri_v.c)
+piglit_add_executable (arb_shader_storage_buffer_object-deletebuffers 
deletebuffers.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_shader_storage_buffer_object/deletebuffers.c 
b/tests/spec/arb_shader_storage_buffer_object/deletebuffers.c
new file mode 100644
index 000..ff8783f
--- /dev/null
+++ b/tests/spec/arb_shader_storage_buffer_object/deletebuffers.c
@@ -0,0 +1,105 @@
+/*
+ * Copyright © 2015 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 deletebuffers.c
+ *
+ * Tests that glDeleteBuffers() also removes the
+ * glBindBufferBase()/glBindBufferRange() bindings along with the
+ * usual glBindBuffer() binding.
+ */
+
+#include piglit-util-gl.h
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 10;
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+void
+piglit_init(int argc, char **argv)
+{
+   bool pass = true;
+   GLuint bo[2];
+   GLint binding;
+
+   piglit_require_extension(GL_ARB_shader_storage_buffer_object);
+
+   glGetIntegeri_v(GL_SHADER_STORAGE_BUFFER_BINDING, 0, binding);
+   if (binding != 0) {
+   fprintf(stderr, Default SSBO binding should be 0, was %d\n,
+   binding);
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   glGenBuffers(2, bo);
+
+   glBindBuffer(GL_SHADER_STORAGE_BUFFER, bo[0]);
+   glBufferData(GL_SHADER_STORAGE_BUFFER, 4, NULL, GL_STATIC_DRAW);
+   glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, bo[0]);
+
+   glBindBuffer(GL_SHADER_STORAGE_BUFFER, bo[1]);
+   glBufferData(GL_SHADER_STORAGE_BUFFER, 4, NULL, GL_STATIC_DRAW);
+   glBindBufferRange(GL_SHADER_STORAGE_BUFFER, 1, bo[1], 0, 4);
+
+   glDeleteBuffers(2, bo);
+
+   if (glIsBuffer(bo[0]) || glIsBuffer(bo[1])) {
+   fprintf(stderr, Failed to delete buffers\n);
+   pass = false;
+   }
+
+   glGetIntegerv(GL_SHADER_STORAGE_BUFFER_BINDING, binding);
+   if (binding != 0) {
+   printf(111 Failed to unbind glBindBuffer() buffer %d:\n
+binding set to %d, should be 0\n,
+  bo[1], binding);
+   pass = false;
+   }
+
+   glGetIntegeri_v

[Piglit] [PATCH 09/13] arb_shader_storage_buffer_object: New test for setting/getting block bindings.

2015-05-14 Thread Samuel Iglesias Gonsalvez
Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
---
 tests/all.py   |   1 +
 .../CMakeLists.gl.txt  |   1 +
 .../shaderstorageblockbinding.c| 125 +
 3 files changed, 127 insertions(+)
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/shaderstorageblockbinding.c

diff --git a/tests/all.py b/tests/all.py
index 4515f7b..ed7336d 100755
--- a/tests/all.py
+++ b/tests/all.py
@@ -4039,6 +4039,7 @@ with profile.group_manager(
 g(['arb_shader_storage_buffer_object-getintegeri_v'], 'getintegeri_v')
 g(['arb_shader_storage_buffer_object-deletebuffers'], 'deletebuffers')
 g(['arb_shader_storage_buffer_object-maxblocks'], 'maxblocks')
+g(['arb_shader_storage_buffer_object-shaderstorageblockbinding'], 
'shaderstorageblockbinding')
 
 with profile.group_manager(
 PiglitGLTest,
diff --git a/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt 
b/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
index 509c937..27ba399 100644
--- a/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
+++ b/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
@@ -14,5 +14,6 @@ piglit_add_executable 
(arb_shader_storage_buffer_object-maxshaderstorageblocksiz
 piglit_add_executable (arb_shader_storage_buffer_object-getintegeri_v 
getintegeri_v.c)
 piglit_add_executable (arb_shader_storage_buffer_object-deletebuffers 
deletebuffers.c)
 piglit_add_executable (arb_shader_storage_buffer_object-maxblocks maxblocks.c)
+piglit_add_executable 
(arb_shader_storage_buffer_object-shaderstorageblockbinding 
shaderstorageblockbinding.c)
 
 # vim: ft=cmake:
diff --git 
a/tests/spec/arb_shader_storage_buffer_object/shaderstorageblockbinding.c 
b/tests/spec/arb_shader_storage_buffer_object/shaderstorageblockbinding.c
new file mode 100644
index 000..17c99cd
--- /dev/null
+++ b/tests/spec/arb_shader_storage_buffer_object/shaderstorageblockbinding.c
@@ -0,0 +1,125 @@
+/*
+ * Copyright © 2015 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 shaderstorageblockbinding.c
+ *
+ * From GL_ARB_shader_storage_buffer_object:
+ * After a program is linked, the command
+ *
+ * void ShaderStorageBlockBinding(uint program, uint storageBlockIndex,
+ *uint storageBlockBinding);
+ *
+ *   changes the active shader storage block with an assigned index of
+ *   storageBlockIndex in program object program.  The error INVALID_VALUE
+ *   is generated if storageBlockIndex is not an active shader storage block
+ *   index in program, or if storageBlockBinding is greater than or equal
+ *   to the value of MAX_SHADER_STORAGE_BUFFER_BINDINGS. If successful,
+ *   ShaderStorageBlockBinding specifies that program will use the data
+ *   store of the buffer object bound to the binding point
+ *   storageBlockBinding to read and write the values of the buffer
+ *   variables in the shader storage block identified by storageBlockIndex.
+ */
+
+#include piglit-util-gl.h
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 10;
+
+   config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static GLuint prog;
+
+static const char frag_shader_text[] =
+   #extension GL_ARB_shader_storage_buffer_object : require\n
+   \n
+   buffer ssbo_a { vec4 a; };\n
+   \n
+   void main()\n
+   {\n
+  gl_FragColor = a;\n
+   }\n;
+
+void
+piglit_init(int argc, char **argv)
+{
+   bool pass = true;
+   int max_binding;
+   int index;
+
+   piglit_require_extension(GL_ARB_shader_storage_buffer_object);
+   piglit_require_extension(GL_ARB_program_interface_query);
+
+   prog = piglit_build_simple_program(NULL, frag_shader_text

[Piglit] [PATCH 05/13] arb_shader_storage_buffer_object: add test for GL_MAX_SHADER_STORAGE_BUFFER_SIZE

2015-05-14 Thread Samuel Iglesias Gonsalvez
Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
---
 tests/all.py   |  12 ++
 .../CMakeLists.gl.txt  |   1 +
 .../maxshaderstorageblocksize.c| 240 +
 3 files changed, 253 insertions(+)
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/maxshaderstorageblocksize.c

diff --git a/tests/all.py b/tests/all.py
index 2c1664e..a0b26fd 100755
--- a/tests/all.py
+++ b/tests/all.py
@@ -4035,6 +4035,18 @@ with profile.group_manager(
 grouptools.join('spec', 'arb_shader_storage_buffer_object')) as g:
 g(['arb_shader_storage_buffer_object-minmax'], 'minmax')
 g(['arb_shader_storage_buffer_object-rendering'], 'rendering')
+g(['arb_shader_storage_buffer_object-maxshaderstorageblocksize '], 
'maxshaderstorageblocksize')
+
+with profile.group_manager(
+PiglitGLTest,
+grouptools.join('spec', 'arb_shader_storage_buffer_object',
+'maxshaderstorageblocksize')) as g:
+g(['arb_shader_storage_buffer_object-maxshaderstorageblocksize', 'vs'], 
'vs')
+g(['arb_shader_storage_buffer_object-maxshaderstorageblocksize', 
'vsexceed'],
+  'vsexceed')
+g(['arb_shader_storage_buffer_object-maxshaderstorageblocksize', 'fs'], 
'fs')
+g(['arb_shader_storage_buffer_object-maxshaderstorageblocksize', 
'fsexceed'],
+  'fsexceed')
 
 with profile.group_manager(
 PiglitGLTest,
diff --git a/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt 
b/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
index 7f38b4b..ee2f51a 100644
--- a/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
+++ b/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
@@ -10,5 +10,6 @@ link_libraries (
 
 piglit_add_executable (arb_shader_storage_buffer_object-minmax minmax.c)
 piglit_add_executable (arb_shader_storage_buffer_object-rendering rendering.c)
+piglit_add_executable 
(arb_shader_storage_buffer_object-maxshaderstorageblocksize 
maxshaderstorageblocksize.c)
 
 # vim: ft=cmake:
diff --git 
a/tests/spec/arb_shader_storage_buffer_object/maxshaderstorageblocksize.c 
b/tests/spec/arb_shader_storage_buffer_object/maxshaderstorageblocksize.c
new file mode 100644
index 000..90f4a8d
--- /dev/null
+++ b/tests/spec/arb_shader_storage_buffer_object/maxshaderstorageblocksize.c
@@ -0,0 +1,240 @@
+/*
+ * Copyright © 2015 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 maxshaderstorageblocksize.c
+ *
+ * Tests linking and drawing with shader storage buffer objects of size
+ * MAX_SHADER_STORAGE_BLOCK_SIZE.
+ *
+ * Based on ARB_uniform_buffer_object's maxuniformblocksize.c
+ */
+
+#include piglit-util-gl.h
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 20;
+
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static enum {
+   VS,
+   VS_EXCEED,
+   FS,
+   FS_EXCEED,
+} mode;
+
+static void
+usage(const char *name)
+{
+   fprintf(stderr, usage: %s vs | vsexceed | fs | fsexceed\n,
+   name);
+   piglit_report_result(PIGLIT_FAIL);
+}
+
+enum piglit_result
+piglit_display(void)
+{
+   const char *vs_ssbo_template =
+   #extension GL_ARB_shader_storage_buffer_object : enable\n
+   #extension GL_ARB_uniform_buffer_object : enable\n
+   \n
+   varying vec4 vary;
+   \n
+   layout(std140) buffer ssbo {\n
+  vec4 v[%d];\n
+   };\n
+   uniform int i;\n
+   \n
+   void main() {\n
+  gl_Position = gl_Vertex;\n
+  vary = v[i];\n
+   }\n;
+
+   const char *fs_template =
+   #extension

[Piglit] [PATCH 10/13] arb_shader_storage_buffer_object: Add test for setting binding point to an array of SSBOs

2015-05-14 Thread Samuel Iglesias Gonsalvez
Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
---
 tests/all.py   |   1 +
 .../CMakeLists.gl.txt  |   1 +
 .../array-ssbo-binding.c   | 149 +
 3 files changed, 151 insertions(+)
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/array-ssbo-binding.c

diff --git a/tests/all.py b/tests/all.py
index ed7336d..149e4bb 100755
--- a/tests/all.py
+++ b/tests/all.py
@@ -4040,6 +4040,7 @@ with profile.group_manager(
 g(['arb_shader_storage_buffer_object-deletebuffers'], 'deletebuffers')
 g(['arb_shader_storage_buffer_object-maxblocks'], 'maxblocks')
 g(['arb_shader_storage_buffer_object-shaderstorageblockbinding'], 
'shaderstorageblockbinding')
+g(['arb_shader_storage_buffer_object-array-ssbo-binding'], 
'array-ssbo-binding')
 
 with profile.group_manager(
 PiglitGLTest,
diff --git a/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt 
b/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
index 27ba399..4bd5adc 100644
--- a/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
+++ b/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
@@ -15,5 +15,6 @@ piglit_add_executable 
(arb_shader_storage_buffer_object-getintegeri_v getinteger
 piglit_add_executable (arb_shader_storage_buffer_object-deletebuffers 
deletebuffers.c)
 piglit_add_executable (arb_shader_storage_buffer_object-maxblocks maxblocks.c)
 piglit_add_executable 
(arb_shader_storage_buffer_object-shaderstorageblockbinding 
shaderstorageblockbinding.c)
+piglit_add_executable (arb_shader_storage_buffer_object-array-ssbo-binding 
array-ssbo-binding.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_shader_storage_buffer_object/array-ssbo-binding.c 
b/tests/spec/arb_shader_storage_buffer_object/array-ssbo-binding.c
new file mode 100644
index 000..14787f1
--- /dev/null
+++ b/tests/spec/arb_shader_storage_buffer_object/array-ssbo-binding.c
@@ -0,0 +1,149 @@
+/*
+ * Copyright © 2015 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 array-ssbo-binding.c
+ *
+ * Tests that modifying the binding point of an array of shader
+ * storage block works correctly, i.e., former attached buffer is not
+ * modified and the other is.
+ */
+
+#include piglit-util-gl.h
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.window_width = 100;
+   config.window_height = 100;
+   config.supports_gl_compat_version = 10;
+   config.supports_gl_core_version = 31;
+   config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+#define SSBO_SIZE 4
+
+static const char vs_pass_thru_text[] =
+   #version 330\n
+   #extension GL_ARB_shader_storage_buffer_object : require\n
+   \n
+   layout(std140, binding=2) buffer ssbo {\n
+  vec4 v;\n
+   } a[2];\n
+   \n
+   in vec4 piglit_vertex;\n
+   \n
+   void main() {\n
+  gl_Position = piglit_vertex;\n
+  a[0].v = a[0].v + 1.0;\n
+  a[1].v = a[1].v + 10.0;\n
+}\n;
+
+static const char fs_source[] =
+   #version 330\n
+   #extension GL_ARB_shader_storage_buffer_object : require\n
+   \n
+   out vec4 color;\n
+   \n
+   layout(std140, binding=2) buffer ssbo {\n
+  vec4 v;\n
+   } a[2];\n
+   \n
+   void main() {\n
+  color = a[0].v;\n
+   }\n;
+
+GLuint prog;
+
+void
+piglit_init(int argc, char **argv)
+{
+   bool pass = true;
+   GLuint buffer[2];
+   unsigned int i;
+   float ssbo_values[SSBO_SIZE] = {0};
+   float *map;
+   int index;
+
+   piglit_require_extension(GL_ARB_shader_storage_buffer_object);
+   piglit_require_extension(GL_ARB_program_interface_query);
+
+   prog = piglit_build_simple_program

[Piglit] [PATCH 12/13] arb_shader_storage_buffer_object: add test to check SSBO writes with layout(std140)

2015-05-14 Thread Samuel Iglesias Gonsalvez
Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
---
 tests/all.py   |   1 +
 .../CMakeLists.gl.txt  |   1 +
 .../layout-std140-write-shader.c   | 161 +
 3 files changed, 163 insertions(+)
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/layout-std140-write-shader.c

diff --git a/tests/all.py b/tests/all.py
index 4d3d29e..d718030 100755
--- a/tests/all.py
+++ b/tests/all.py
@@ -4042,6 +4042,7 @@ with profile.group_manager(
 g(['arb_shader_storage_buffer_object-shaderstorageblockbinding'], 
'shaderstorageblockbinding')
 g(['arb_shader_storage_buffer_object-array-ssbo-binding'], 
'array-ssbo-binding')
 g(['arb_shader_storage_buffer_object-layout-std430-write-shader'], 
'layout-std430-write-shader')
+g(['arb_shader_storage_buffer_object-layout-std140-write-shader'], 
'layout-std140-write-shader')
 
 with profile.group_manager(
 PiglitGLTest,
diff --git a/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt 
b/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
index 100fbcd..43fa604 100644
--- a/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
+++ b/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
@@ -17,5 +17,6 @@ piglit_add_executable 
(arb_shader_storage_buffer_object-maxblocks maxblocks.c)
 piglit_add_executable 
(arb_shader_storage_buffer_object-shaderstorageblockbinding 
shaderstorageblockbinding.c)
 piglit_add_executable (arb_shader_storage_buffer_object-array-ssbo-binding 
array-ssbo-binding.c)
 piglit_add_executable 
(arb_shader_storage_buffer_object-layout-std430-write-shader 
layout-std430-write-shader.c)
+piglit_add_executable 
(arb_shader_storage_buffer_object-layout-std140-write-shader 
layout-std140-write-shader.c)
 
 # vim: ft=cmake:
diff --git 
a/tests/spec/arb_shader_storage_buffer_object/layout-std140-write-shader.c 
b/tests/spec/arb_shader_storage_buffer_object/layout-std140-write-shader.c
new file mode 100644
index 000..bcddce5
--- /dev/null
+++ b/tests/spec/arb_shader_storage_buffer_object/layout-std140-write-shader.c
@@ -0,0 +1,161 @@
+/*
+ * Copyright © 2015 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 layout-std140-write-shader.c
+ *
+ * Tests that shader storage block writes in GLSL works correctly (offsets and
+ * values) when interface packing qualifier is std140 and row_major.
+ */
+
+#include piglit-util-gl.h
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.window_width = 100;
+   config.window_height = 100;
+   config.supports_gl_compat_version = 10;
+   config.supports_gl_core_version = 31;
+   config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+#define SSBO_SIZE 44
+
+static const char vs_pass_thru_text[] =
+   #version 130\n
+   #extension GL_ARB_shader_storage_buffer_object : require\n
+#extension GL_ARB_uniform_buffer_object : require\n
+   \n
+   struct A {\n
+  float a1;\n
+  vec2 a2[2];\n
+  mat2 a4;\n
+   };\n
+   layout(std140, row_major, binding=2) buffer ssbo {\n
+  vec4 v;\n
+  float f;\n
+  A s;\n
+  float unsized_array[];\n
+   };\n
+   in vec4 piglit_vertex;\n
+   void main() {\n
+  gl_Position = piglit_vertex;\n
+  f = 4.0;\n
+  s.a2[0] = vec2(6.0, 7.0); \n
+  int index = int(v.x); // index should be zero\n
+  unsized_array[index + gl_VertexID] = unsized_array.length();\n
+}\n;
+
+static const char fs_source[] =
+   #version 130\n
+   #extension GL_ARB_shader_storage_buffer_object : require\n
+#extension GL_ARB_uniform_buffer_object : require\n
+   \n
+   struct A {\n
+  float

[Piglit] [PATCH 08/13] arb_shader_storage_buffer_object: Add test to check maximum number of allowed SSBOs

2015-05-14 Thread Samuel Iglesias Gonsalvez
Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
---
 tests/all.py   |   1 +
 .../CMakeLists.gl.txt  |   1 +
 .../arb_shader_storage_buffer_object/maxblocks.c   | 358 +
 3 files changed, 360 insertions(+)
 create mode 100644 tests/spec/arb_shader_storage_buffer_object/maxblocks.c

diff --git a/tests/all.py b/tests/all.py
index 5698543..4515f7b 100755
--- a/tests/all.py
+++ b/tests/all.py
@@ -4038,6 +4038,7 @@ with profile.group_manager(
 g(['arb_shader_storage_buffer_object-maxshaderstorageblocksize '], 
'maxshaderstorageblocksize')
 g(['arb_shader_storage_buffer_object-getintegeri_v'], 'getintegeri_v')
 g(['arb_shader_storage_buffer_object-deletebuffers'], 'deletebuffers')
+g(['arb_shader_storage_buffer_object-maxblocks'], 'maxblocks')
 
 with profile.group_manager(
 PiglitGLTest,
diff --git a/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt 
b/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
index e2b716b..509c937 100644
--- a/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
+++ b/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
@@ -13,5 +13,6 @@ piglit_add_executable 
(arb_shader_storage_buffer_object-rendering rendering.c)
 piglit_add_executable 
(arb_shader_storage_buffer_object-maxshaderstorageblocksize 
maxshaderstorageblocksize.c)
 piglit_add_executable (arb_shader_storage_buffer_object-getintegeri_v 
getintegeri_v.c)
 piglit_add_executable (arb_shader_storage_buffer_object-deletebuffers 
deletebuffers.c)
+piglit_add_executable (arb_shader_storage_buffer_object-maxblocks maxblocks.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_shader_storage_buffer_object/maxblocks.c 
b/tests/spec/arb_shader_storage_buffer_object/maxblocks.c
new file mode 100644
index 000..74c95fe
--- /dev/null
+++ b/tests/spec/arb_shader_storage_buffer_object/maxblocks.c
@@ -0,0 +1,358 @@
+/*
+ * Copyright © 2015 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 maxblocks.c
+ *
+ * From the GL_ARB_shader_storage_buffer_object spec:
+ *
+ *  If the number of active shader storage blocks referenced by the shaders in
+ *   a program exceeds implementation-dependent limits, the program will fail
+ *   to link.  The limits for vertex, tessellation control, tessellation
+ *   evaluation, geometry, fragment, and compute shaders can be obtained by
+ *   calling GetIntegerv with pname values of MAX_VERTEX_SHADER_STORAGE_BLOCKS,
+ *   MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS,
+ *   MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS,
+ *   MAX_GEOMETRY_SHADER_STORAGE_BLOCKS, MAX_FRAGMENT_SHADER_STORAGE_BLOCKS,
+ *   and MAX_COMPUTE_SHADER_STORAGE_BLOCKS, respectively.  Additionally, a
+ *   program will fail to link if the sum of the number of active shader
+ *   storage blocks referenced by each shader stage in a program exceeds the
+ *   value of the implementation-dependent limit
+ *   MAX_COMBINED_SHADER_STORAGE_BLOCKS.  If a shader storage block in a
+ *   program is referenced by multiple shaders, each such reference counts
+ *   separately against this combined limit.
+ */
+
+#include piglit-util-gl.h
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.window_width = 800;
+   config.window_height = 200;
+   config.supports_gl_compat_version = 10;
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static char *
+get_shader(GLenum target, const char *block_prefix, int blocks)
+{
+   char *shader = NULL;
+   const char *vs_source =
+   #extension GL_ARB_shader_storage_buffer_object : enable\n
+   #extension GL_ARB_uniform_buffer_object : enable\n
+   \n
+   varying vec4 v;
+   \n
+   %s
+   \n
+   void main() {\n

[Piglit] [PATCH 11/13] arb_shader_storage_buffer_object: add test to check SSBO writes with layout(std430)

2015-05-14 Thread Samuel Iglesias Gonsalvez
Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
---
 tests/all.py   |   1 +
 .../CMakeLists.gl.txt  |   1 +
 .../layout-std430-write-shader.c   | 185 +
 3 files changed, 187 insertions(+)
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/layout-std430-write-shader.c

diff --git a/tests/all.py b/tests/all.py
index 149e4bb..4d3d29e 100755
--- a/tests/all.py
+++ b/tests/all.py
@@ -4041,6 +4041,7 @@ with profile.group_manager(
 g(['arb_shader_storage_buffer_object-maxblocks'], 'maxblocks')
 g(['arb_shader_storage_buffer_object-shaderstorageblockbinding'], 
'shaderstorageblockbinding')
 g(['arb_shader_storage_buffer_object-array-ssbo-binding'], 
'array-ssbo-binding')
+g(['arb_shader_storage_buffer_object-layout-std430-write-shader'], 
'layout-std430-write-shader')
 
 with profile.group_manager(
 PiglitGLTest,
diff --git a/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt 
b/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
index 4bd5adc..100fbcd 100644
--- a/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
+++ b/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
@@ -16,5 +16,6 @@ piglit_add_executable 
(arb_shader_storage_buffer_object-deletebuffers deletebuff
 piglit_add_executable (arb_shader_storage_buffer_object-maxblocks maxblocks.c)
 piglit_add_executable 
(arb_shader_storage_buffer_object-shaderstorageblockbinding 
shaderstorageblockbinding.c)
 piglit_add_executable (arb_shader_storage_buffer_object-array-ssbo-binding 
array-ssbo-binding.c)
+piglit_add_executable 
(arb_shader_storage_buffer_object-layout-std430-write-shader 
layout-std430-write-shader.c)
 
 # vim: ft=cmake:
diff --git 
a/tests/spec/arb_shader_storage_buffer_object/layout-std430-write-shader.c 
b/tests/spec/arb_shader_storage_buffer_object/layout-std430-write-shader.c
new file mode 100644
index 000..75d7b09
--- /dev/null
+++ b/tests/spec/arb_shader_storage_buffer_object/layout-std430-write-shader.c
@@ -0,0 +1,185 @@
+/*
+ * Copyright © 2015 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 layout-std430-write-shader.c
+ *
+ * Tests that shader storage block writes in GLSL works correctly (offsets and
+ * values) when interface packing qualifier is std430.
+ * 
+ * From GL_ARB_shader_storage_buffer_object:
+ * 
+ *  When using the std430 storage layout, shader storage
+ *   blocks will be laid out in buffer storage identically to uniform and
+ *   shader storage blocks using the std140 layout, except that the base
+ *   alignment of arrays of scalars and vectors in rule (4) and of structures
+ *   in rule (9) are not rounded up a multiple of the base alignment of a 
vec4.
+ */
+
+#include piglit-util-gl.h
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.window_width = 100;
+   config.window_height = 100;
+   config.supports_gl_compat_version = 10;
+   config.supports_gl_core_version = 31;
+   config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+#define SSBO_SIZE 48
+
+static const char vs_pass_thru_text[] =
+   #version 130\n
+   #extension GL_ARB_shader_storage_buffer_object : require\n
+#extension GL_ARB_uniform_buffer_object : require\n
+   \n
+   struct B { float b1[3]; };\n
+   struct A {\n
+  float a1;\n
+  vec3 a2;\n
+  mat2 a4[2];\n
+  B sb[2];\n
+   };\n
+   layout(std430, binding=2) buffer ssbo {\n
+  vec4 v;\n
+  float f;\n
+  A s;\n
+  mat3x4 m;\n
+  float unsized_array[];\n
+   };\n
+   in vec4 piglit_vertex;\n
+   void main() {\n
+  gl_Position = piglit_vertex;\n
+  v.yz = vec2(1.0, 2.0);\n

[Piglit] [PATCH 13/13] arb_shader_storage_buffer_object: Add test for buffer variable queries

2015-05-14 Thread Samuel Iglesias Gonsalvez
These are ARB_program_interface_query's queries specific for shader storage
buffer variables, like TOP_LEVEL_ARRAY_SIZE and TOP_LEVEL_ARRAY_STRIDE
properties.

Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
---
 tests/all.py   |   1 +
 .../CMakeLists.gl.txt  |   1 +
 .../program-interface-query.c  | 166 +
 3 files changed, 168 insertions(+)
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/program-interface-query.c

diff --git a/tests/all.py b/tests/all.py
index d718030..a7c9d14 100755
--- a/tests/all.py
+++ b/tests/all.py
@@ -4043,6 +4043,7 @@ with profile.group_manager(
 g(['arb_shader_storage_buffer_object-array-ssbo-binding'], 
'array-ssbo-binding')
 g(['arb_shader_storage_buffer_object-layout-std430-write-shader'], 
'layout-std430-write-shader')
 g(['arb_shader_storage_buffer_object-layout-std140-write-shader'], 
'layout-std140-write-shader')
+g(['arb_shader_storage_buffer_object-program_interface_query'], 
'program-interface-query')
 
 with profile.group_manager(
 PiglitGLTest,
diff --git a/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt 
b/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
index 43fa604..8722b04 100644
--- a/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
+++ b/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
@@ -18,5 +18,6 @@ piglit_add_executable 
(arb_shader_storage_buffer_object-shaderstorageblockbindin
 piglit_add_executable (arb_shader_storage_buffer_object-array-ssbo-binding 
array-ssbo-binding.c)
 piglit_add_executable 
(arb_shader_storage_buffer_object-layout-std430-write-shader 
layout-std430-write-shader.c)
 piglit_add_executable 
(arb_shader_storage_buffer_object-layout-std140-write-shader 
layout-std140-write-shader.c)
+piglit_add_executable 
(arb_shader_storage_buffer_object-program_interface_query 
program-interface-query.c)
 
 # vim: ft=cmake:
diff --git 
a/tests/spec/arb_shader_storage_buffer_object/program-interface-query.c 
b/tests/spec/arb_shader_storage_buffer_object/program-interface-query.c
new file mode 100644
index 000..b1818b5
--- /dev/null
+++ b/tests/spec/arb_shader_storage_buffer_object/program-interface-query.c
@@ -0,0 +1,166 @@
+/*
+ * Copyright © 2015 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 program-interface-query.c
+ *
+ * Test that checks the proper implementation of GL_ARB_program_interface_query
+ * implementation for shader storage buffers
+ */
+
+#include piglit-util-gl.h
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.window_width = 100;
+   config.window_height = 100;
+   config.supports_gl_compat_version = 10;
+   config.supports_gl_core_version = 31;
+   config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+#define SSBO_SIZE 4
+#define NUM_QUERIES 11
+
+static const char vs_pass_thru_text[] =
+   #version 330\n
+   #extension GL_ARB_shader_storage_buffer_object : require\n
+   \n
+   struct B {mat2 b[3]; float c;};\n
+   layout(row_major, std140, binding=2) buffer ssbo_std140 {\n
+  vec4 v;\n
+  B s[];\n
+   } a_std140[2];\n
+   \n
+   in vec4 piglit_vertex;\n
+   \n
+   void main() {\n
+  gl_Position = piglit_vertex;\n
+  a_std140[0].s[0].b[0] = mat2(1.0, 2.0, 3.0, 4.0);\n
+}\n;
+
+static const char fs_source[] =
+   #version 330\n
+   #extension GL_ARB_shader_storage_buffer_object : require\n
+   \n
+   out vec4 color;\n
+   \n
+   struct B {mat2 b[3]; float c;};\n
+   \n
+   layout(std430, column_major, binding=2) buffer ssbo_std430 {\n
+  vec4 v;\n
+  B s[2];\n
+   } a_std430[2];\n
+   \n
+   void main

[Piglit] [PATCH 00/13] Add more arb_shader_storage_buffer_object tests

2015-05-14 Thread Samuel Iglesias Gonsalvez
This patchset adds piglit tests for arb_shader_storage_buffer_object
extension.

They are also available on this repository:

$ git clone -b arb_shader_storage_buffer_object-v1 \
  https://github.com/Igalia/piglit.git

Thanks,

Sam

Samuel Iglesias Gonsalvez (13):
  arb_shader_storage_buffer_object: Add preprocessor tests
  arb_shader_storage_buffer_object: add compiler tests
  arb_shader_storage_buffer_object: Add linker tests
  arb_shader_storage_buffer: Add rendering test
  arb_shader_storage_buffer_object: add test for
GL_MAX_SHADER_STORAGE_BUFFER_SIZE
  arb_shader_storage_buffer_object: add test to check glGetIntegeri_v()
queries
  arb_shader_storage_buffer_object: Add new test for glDeleteBuffers()
behavior
  arb_shader_storage_buffer_object: Add test to check maximum number of
allowed SSBOs
  arb_shader_storage_buffer_object: New test for setting/getting block
bindings.
  arb_shader_storage_buffer_object: Add test for setting binding point
to an array of SSBOs
  arb_shader_storage_buffer_object: add test to check SSBO writes with
layout(std430)
  arb_shader_storage_buffer_object: add test to check SSBO writes with
layout(std140)
  arb_shader_storage_buffer_object: Add test for buffer variable queries

 tests/all.py   |  21 ++
 .../CMakeLists.gl.txt  |  10 +
 .../array-ssbo-binding.c   | 149 +
 .../extension-disabled-shader-storage-block.frag   |  15 +
 .../compiler/extension-disabled-std430.frag|  13 +
 .../compiler/layout-std430-non-shader-storage.frag |  24 ++
 .../compiler/layout-std430-within-block.frag   |  22 ++
 .../compiler/shader-storage-block-initializer.frag |  21 ++
 .../compiler/shader-storage-block-sampler.frag |  23 ++
 .../compiler/shader-storage-outside-block.frag |  20 ++
 .../compiler/unsized-array-argument-function.frag  |  29 ++
 .../unsized-array-not-in-last-position.frag|  24 ++
 .../deletebuffers.c| 105 ++
 .../getintegeri_v.c| 120 +++
 .../layout-std140-write-shader.c   | 161 +
 .../layout-std430-write-shader.c   | 185 +++
 ...hader-storage-block-different-def-2.shader_test |  40 +++
 ...hader-storage-block-different-def-3.shader_test |  40 +++
 .../shader-storage-block-different-def.shader_test |  38 +++
 ...shader-storage-block-different-size.shader_test |  41 +++
 .../arb_shader_storage_buffer_object/maxblocks.c   | 358 +
 .../maxshaderstorageblocksize.c| 240 ++
 .../preprocessor/define.frag   |  19 ++
 .../preprocessor/define.vert   |  19 ++
 .../program-interface-query.c  | 166 ++
 .../arb_shader_storage_buffer_object/rendering.c   | 232 +
 .../shaderstorageblockbinding.c| 125 +++
 27 files changed, 2260 insertions(+)
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/array-ssbo-binding.c
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/compiler/extension-disabled-shader-storage-block.frag
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/compiler/extension-disabled-std430.frag
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/compiler/layout-std430-non-shader-storage.frag
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/compiler/layout-std430-within-block.frag
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/compiler/shader-storage-block-initializer.frag
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/compiler/shader-storage-block-sampler.frag
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/compiler/shader-storage-outside-block.frag
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/compiler/unsized-array-argument-function.frag
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/compiler/unsized-array-not-in-last-position.frag
 create mode 100644 tests/spec/arb_shader_storage_buffer_object/deletebuffers.c
 create mode 100644 tests/spec/arb_shader_storage_buffer_object/getintegeri_v.c
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/layout-std140-write-shader.c
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/layout-std430-write-shader.c
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/linker/shader-storage-block-different-def-2.shader_test
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/linker/shader-storage-block-different-def-3.shader_test
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/linker/shader-storage-block-different-def.shader_test
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/linker/shader-storage-block-different-size.shader_test
 create mode 100644 tests/spec

[Piglit] [PATCH 02/13] arb_shader_storage_buffer_object: add compiler tests

2015-05-14 Thread Samuel Iglesias Gonsalvez
Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
---
 .../extension-disabled-shader-storage-block.frag   | 15 +++
 .../compiler/extension-disabled-std430.frag| 13 ++
 .../compiler/layout-std430-non-shader-storage.frag | 24 ++
 .../compiler/layout-std430-within-block.frag   | 22 
 .../compiler/shader-storage-block-initializer.frag | 21 
 .../compiler/shader-storage-block-sampler.frag | 23 +
 .../compiler/shader-storage-outside-block.frag | 20 +++
 .../compiler/unsized-array-argument-function.frag  | 29 ++
 .../unsized-array-not-in-last-position.frag| 24 ++
 9 files changed, 191 insertions(+)
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/compiler/extension-disabled-shader-storage-block.frag
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/compiler/extension-disabled-std430.frag
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/compiler/layout-std430-non-shader-storage.frag
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/compiler/layout-std430-within-block.frag
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/compiler/shader-storage-block-initializer.frag
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/compiler/shader-storage-block-sampler.frag
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/compiler/shader-storage-outside-block.frag
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/compiler/unsized-array-argument-function.frag
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/compiler/unsized-array-not-in-last-position.frag

diff --git 
a/tests/spec/arb_shader_storage_buffer_object/compiler/extension-disabled-shader-storage-block.frag
 
b/tests/spec/arb_shader_storage_buffer_object/compiler/extension-disabled-shader-storage-block.frag
new file mode 100644
index 000..de19757
--- /dev/null
+++ 
b/tests/spec/arb_shader_storage_buffer_object/compiler/extension-disabled-shader-storage-block.frag
@@ -0,0 +1,15 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.20
+// require_extensions: GL_ARB_shader_storage_buffer_object
+// [end config]
+
+#version 120
+#extension GL_ARB_shader_storage_buffer_object: disable
+
+buffer ssbo {
+   vec4 a;
+};
+
+void foo(void) {
+}
diff --git 
a/tests/spec/arb_shader_storage_buffer_object/compiler/extension-disabled-std430.frag
 
b/tests/spec/arb_shader_storage_buffer_object/compiler/extension-disabled-std430.frag
new file mode 100644
index 000..3ac7a58
--- /dev/null
+++ 
b/tests/spec/arb_shader_storage_buffer_object/compiler/extension-disabled-std430.frag
@@ -0,0 +1,13 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.20
+// require_extensions: GL_ARB_shader_storage_buffer_object
+// [end config]
+
+#version 120
+#extension GL_ARB_shader_storage_buffer_object: disable
+
+layout(std430) buffer;
+
+void foo(void) {
+}
diff --git 
a/tests/spec/arb_shader_storage_buffer_object/compiler/layout-std430-non-shader-storage.frag
 
b/tests/spec/arb_shader_storage_buffer_object/compiler/layout-std430-non-shader-storage.frag
new file mode 100644
index 000..309a18f
--- /dev/null
+++ 
b/tests/spec/arb_shader_storage_buffer_object/compiler/layout-std430-non-shader-storage.frag
@@ -0,0 +1,24 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.20
+// require_extensions: GL_ARB_shader_storage_buffer_object 
GL_ARB_uniform_buffer_object
+// [end config]
+
+/* From the GL_ARB_shader_storage_buffer_object:
+ *
+ * The std430 qualifier is supported only for shader storage blocks;
+ *  a shader using the std430 qualifier on a uniform block will fail to
+ *  compile.
+ */
+
+#version 120
+#extension GL_ARB_shader_storage_buffer_object: require
+#extension GL_ARB_uniform_buffer_object: require
+
+layout(std430) uniform Ubo {
+   vec4 b;
+};
+
+vec4 foo(void) {
+   return b;
+}
diff --git 
a/tests/spec/arb_shader_storage_buffer_object/compiler/layout-std430-within-block.frag
 
b/tests/spec/arb_shader_storage_buffer_object/compiler/layout-std430-within-block.frag
new file mode 100644
index 000..1161248
--- /dev/null
+++ 
b/tests/spec/arb_shader_storage_buffer_object/compiler/layout-std430-within-block.frag
@@ -0,0 +1,22 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.20
+// require_extensions: GL_ARB_shader_storage_buffer_object
+// [end config]
+
+/* From the GL_ARB_shader_storage_buffer_object:
+ *
+ * Layout qualifiers on member declarations cannot use the shared,
+ *  packed, std140, or std430 qualifiers.
+ */
+
+#version 120
+#extension GL_ARB_shader_storage_buffer_object: require
+
+buffer ssbo {
+   layout(std430) vec4 a;
+};
+
+vec4 foo(void) {
+   return a;
+}
diff --git 
a/tests/spec/arb_shader_storage_buffer_object/compiler/shader-storage-block-initializer.frag
 
b/tests/spec

[Piglit] [PATCH 01/13] arb_shader_storage_buffer_object: Add preprocessor tests

2015-05-14 Thread Samuel Iglesias Gonsalvez
Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
---
 .../preprocessor/define.frag  | 19 +++
 .../preprocessor/define.vert  | 19 +++
 2 files changed, 38 insertions(+)
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/preprocessor/define.frag
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/preprocessor/define.vert

diff --git 
a/tests/spec/arb_shader_storage_buffer_object/preprocessor/define.frag 
b/tests/spec/arb_shader_storage_buffer_object/preprocessor/define.frag
new file mode 100644
index 000..ca9fc6d
--- /dev/null
+++ b/tests/spec/arb_shader_storage_buffer_object/preprocessor/define.frag
@@ -0,0 +1,19 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.10
+// require_extensions: GL_ARB_shader_storage_buffer_object
+// [end config]
+
+#version 110
+#extension GL_ARB_shader_storage_buffer_object: require
+
+#if !defined GL_ARB_shader_storage_buffer_object
+#  error GL_ARB_shader_storage_buffer_object is not defined
+#elif GL_ARB_shader_storage_buffer_object != 1
+#  error GL_ARB_shader_storage_buffer_object is not equal to 1
+#endif
+
+/* Some compilers generate spurious errors if a shader does not contain
+ * any code or declarations.
+ */
+int foo(void) { return 1; }
diff --git 
a/tests/spec/arb_shader_storage_buffer_object/preprocessor/define.vert 
b/tests/spec/arb_shader_storage_buffer_object/preprocessor/define.vert
new file mode 100644
index 000..ca9fc6d
--- /dev/null
+++ b/tests/spec/arb_shader_storage_buffer_object/preprocessor/define.vert
@@ -0,0 +1,19 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.10
+// require_extensions: GL_ARB_shader_storage_buffer_object
+// [end config]
+
+#version 110
+#extension GL_ARB_shader_storage_buffer_object: require
+
+#if !defined GL_ARB_shader_storage_buffer_object
+#  error GL_ARB_shader_storage_buffer_object is not defined
+#elif GL_ARB_shader_storage_buffer_object != 1
+#  error GL_ARB_shader_storage_buffer_object is not equal to 1
+#endif
+
+/* Some compilers generate spurious errors if a shader does not contain
+ * any code or declarations.
+ */
+int foo(void) { return 1; }
-- 
2.1.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 03/13] arb_shader_storage_buffer_object: Add linker tests

2015-05-14 Thread Samuel Iglesias Gonsalvez
Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
---
 ...hader-storage-block-different-def-2.shader_test | 40 +
 ...hader-storage-block-different-def-3.shader_test | 40 +
 .../shader-storage-block-different-def.shader_test | 38 
 ...shader-storage-block-different-size.shader_test | 41 ++
 4 files changed, 159 insertions(+)
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/linker/shader-storage-block-different-def-2.shader_test
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/linker/shader-storage-block-different-def-3.shader_test
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/linker/shader-storage-block-different-def.shader_test
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/linker/shader-storage-block-different-size.shader_test

diff --git 
a/tests/spec/arb_shader_storage_buffer_object/linker/shader-storage-block-different-def-2.shader_test
 
b/tests/spec/arb_shader_storage_buffer_object/linker/shader-storage-block-different-def-2.shader_test
new file mode 100644
index 000..093aae9
--- /dev/null
+++ 
b/tests/spec/arb_shader_storage_buffer_object/linker/shader-storage-block-different-def-2.shader_test
@@ -0,0 +1,40 @@
+# From the GL_ARB_shader_storage_buffer_object spec:
+#
+#   The compiler/linker will ensure that multiple programs and
+#programmable stages containing this definition will share the same memory
+#layout for this block, as long as all arrays are declared with explicit
+#sizes and all matrices have matching row_major and/or column_major
+#qualifications (which may come from a declaration outside the block
+#definition)
+
+[require]
+GLSL = 1.50
+GL_ARB_shader_storage_buffer_object
+
+[vertex shader]
+#version 150
+#extension GL_ARB_shader_storage_buffer_object: require
+
+layout(std140) buffer a {
+   float s[3];
+};
+
+void main(void) {
+   s[0] = 0.0;
+}
+
+[fragment shader]
+
+#version 150
+#extension GL_ARB_shader_storage_buffer_object: require
+
+layout(std430) buffer a {
+   float s[3];
+};
+
+void main(void) {
+   s[1] = 1.0;
+}
+
+[test]
+link error
\ No newline at end of file
diff --git 
a/tests/spec/arb_shader_storage_buffer_object/linker/shader-storage-block-different-def-3.shader_test
 
b/tests/spec/arb_shader_storage_buffer_object/linker/shader-storage-block-different-def-3.shader_test
new file mode 100644
index 000..bf7a230
--- /dev/null
+++ 
b/tests/spec/arb_shader_storage_buffer_object/linker/shader-storage-block-different-def-3.shader_test
@@ -0,0 +1,40 @@
+# From the GL_ARB_shader_storage_buffer_object spec:
+#
+#   The compiler/linker will ensure that multiple programs and
+#programmable stages containing this definition will share the same memory
+#layout for this block, as long as all arrays are declared with explicit
+#sizes and all matrices have matching row_major and/or column_major
+#qualifications (which may come from a declaration outside the block
+#definition)
+
+[require]
+GLSL = 1.50
+GL_ARB_shader_storage_buffer_object
+
+[vertex shader]
+#version 150
+#extension GL_ARB_shader_storage_buffer_object: require
+
+layout(row_major, std430) buffer a {
+   mat4 s;
+};
+
+void main(void) {
+
+}
+
+[fragment shader]
+
+#version 150
+#extension GL_ARB_shader_storage_buffer_object: require
+
+layout(column_major, std430) buffer a {
+   mat4 s;
+};
+
+void main(void) {
+
+}
+
+[test]
+link error
\ No newline at end of file
diff --git 
a/tests/spec/arb_shader_storage_buffer_object/linker/shader-storage-block-different-def.shader_test
 
b/tests/spec/arb_shader_storage_buffer_object/linker/shader-storage-block-different-def.shader_test
new file mode 100644
index 000..6cb2d27
--- /dev/null
+++ 
b/tests/spec/arb_shader_storage_buffer_object/linker/shader-storage-block-different-def.shader_test
@@ -0,0 +1,38 @@
+# From the GL_ARB_shader_storage_buffer_object spec:
+#
+#  If multiple shaders are linked together, then they will share a single
+#   global buffer variable name space, including within a language as well as
+#   across languages.  Hence, the types of buffer variables with the same name
+#   must match across all shaders that are linked into a single program.
+
+[require]
+GLSL = 1.50
+GL_ARB_shader_storage_buffer_object
+
+[vertex shader]
+#version 150
+#extension GL_ARB_shader_storage_buffer_object: require
+
+buffer a {
+   vec4 s;
+};
+
+void main(void) {
+
+}
+
+[fragment shader]
+
+#version 150
+#extension GL_ARB_shader_storage_buffer_object: require
+
+buffer a {
+   vec3 s;
+};
+
+void main(void) {
+
+}
+
+[test]
+link error
\ No newline at end of file
diff --git 
a/tests/spec/arb_shader_storage_buffer_object/linker/shader-storage-block-different-size.shader_test
 
b/tests/spec/arb_shader_storage_buffer_object/linker/shader-storage-block-different-size.shader_test
new file mode 100644
index 000..10d7e92
--- /dev/null

[Piglit] [PATCH 04/13] arb_shader_storage_buffer: Add rendering test

2015-05-14 Thread Samuel Iglesias Gonsalvez
Add a test that actually draws something with shader storage buffer
objects.

Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
---
 tests/all.py   |   1 +
 .../CMakeLists.gl.txt  |   1 +
 .../arb_shader_storage_buffer_object/rendering.c   | 232 +
 3 files changed, 234 insertions(+)
 create mode 100644 tests/spec/arb_shader_storage_buffer_object/rendering.c

diff --git a/tests/all.py b/tests/all.py
index 63a6cf8..2c1664e 100755
--- a/tests/all.py
+++ b/tests/all.py
@@ -4034,6 +4034,7 @@ with profile.group_manager(
 PiglitGLTest,
 grouptools.join('spec', 'arb_shader_storage_buffer_object')) as g:
 g(['arb_shader_storage_buffer_object-minmax'], 'minmax')
+g(['arb_shader_storage_buffer_object-rendering'], 'rendering')
 
 with profile.group_manager(
 PiglitGLTest,
diff --git a/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt 
b/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
index d0ba641..7f38b4b 100644
--- a/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
+++ b/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
@@ -9,5 +9,6 @@ link_libraries (
 )
 
 piglit_add_executable (arb_shader_storage_buffer_object-minmax minmax.c)
+piglit_add_executable (arb_shader_storage_buffer_object-rendering rendering.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_shader_storage_buffer_object/rendering.c 
b/tests/spec/arb_shader_storage_buffer_object/rendering.c
new file mode 100644
index 000..9b1ab8d
--- /dev/null
+++ b/tests/spec/arb_shader_storage_buffer_object/rendering.c
@@ -0,0 +1,232 @@
+/*
+ * Copyright (c) 2015 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 rendering.c
+ *
+ * Test rendering with SSBOs.  We draw four squares with different positions,
+ * sizes, rotations and colors where those parameters come from SSBOs.
+ *
+ * Based on GL_ARB_uniform_buffer_object's rendering.c
+ */
+
+#include piglit-util-gl.h
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 10;
+   config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static const char vert_shader_text[] =
+   #extension GL_ARB_shader_storage_buffer_object : require\n
+   \n
+   buffer ssbo_pos_size { vec2 pos; float size; };\n
+   buffer ssbo_rot {float rotation; };\n
+   \n
+   void main()\n
+   {\n
+  mat2 m;\n
+  m[0][0] = m[1][1] = cos(rotation); \n
+  m[0][1] = sin(rotation); \n
+  m[1][0] = -m[0][1]; \n
+  gl_Position.xy = m * gl_Vertex.xy * vec2(size) + pos;\n
+  gl_Position.zw = vec2(0, 1);\n
+   }\n;
+
+static const char frag_shader_text[] =
+   #extension GL_ARB_shader_storage_buffer_object : require\n
+   \n
+   buffer ssbo_color { vec4 color; float color_scale; };\n
+   \n
+   void main()\n
+   {\n
+  gl_FragColor = color * color_scale;\n
+   }\n;
+
+#define NUM_SQUARES 4
+#define NUM_SSBOS 3
+
+/* Square positions and sizes */
+static const float pos_size[NUM_SQUARES][3] = {
+   { -0.5, -0.5, 0.1 },
+   {  0.5, -0.5, 0.2 },
+   { -0.5, 0.5, 0.3 },
+   {  0.5, 0.5, 0.4 }
+};
+
+/* Square color and color_scales */
+static const float color[NUM_SQUARES][8] = {
+   { 2.0, 0.0, 0.0, 1.0,   0.50, 0.0, 0.0, 0.0 },
+   { 0.0, 4.0, 0.0, 1.0,   0.25, 0.0, 0.0, 0.0 },
+   { 0.0, 0.0, 5.0, 1.0,   0.20, 0.0, 0.0, 0.0 },
+   { 0.2, 0.2, 0.2, 0.2,   5.00, 0.0, 0.0, 0.0 }
+};
+
+/* Square rotations */
+static const float rotation[NUM_SQUARES] = {
+   0.0,
+   0.1,
+   0.2,
+   0.3
+};
+
+static GLuint prog;
+static GLuint buffers[NUM_SSBOS];
+static GLint alignment;
+static bool test_buffer_offset = false;
+
+
+static void
+setup_ubos(void

[Piglit] [PATCH 06/13] arb_shader_storage_buffer_object: add test to check glGetIntegeri_v() queries

2015-05-14 Thread Samuel Iglesias Gonsalvez
Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
---
 tests/all.py   |   1 +
 .../CMakeLists.gl.txt  |   1 +
 .../getintegeri_v.c| 120 +
 3 files changed, 122 insertions(+)
 create mode 100644 tests/spec/arb_shader_storage_buffer_object/getintegeri_v.c

diff --git a/tests/all.py b/tests/all.py
index a0b26fd..3475ecb 100755
--- a/tests/all.py
+++ b/tests/all.py
@@ -4036,6 +4036,7 @@ with profile.group_manager(
 g(['arb_shader_storage_buffer_object-minmax'], 'minmax')
 g(['arb_shader_storage_buffer_object-rendering'], 'rendering')
 g(['arb_shader_storage_buffer_object-maxshaderstorageblocksize '], 
'maxshaderstorageblocksize')
+g(['arb_shader_storage_buffer_object-getintegeri_v'], 'getintegeri_v')
 
 with profile.group_manager(
 PiglitGLTest,
diff --git a/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt 
b/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
index ee2f51a..a3cc175 100644
--- a/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
+++ b/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
@@ -11,5 +11,6 @@ link_libraries (
 piglit_add_executable (arb_shader_storage_buffer_object-minmax minmax.c)
 piglit_add_executable (arb_shader_storage_buffer_object-rendering rendering.c)
 piglit_add_executable 
(arb_shader_storage_buffer_object-maxshaderstorageblocksize 
maxshaderstorageblocksize.c)
+piglit_add_executable (arb_shader_storage_buffer_object-getintegeri_v 
getintegeri_v.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_shader_storage_buffer_object/getintegeri_v.c 
b/tests/spec/arb_shader_storage_buffer_object/getintegeri_v.c
new file mode 100644
index 000..05c8d0e
--- /dev/null
+++ b/tests/spec/arb_shader_storage_buffer_object/getintegeri_v.c
@@ -0,0 +1,120 @@
+/*
+ * Copyright © 2015 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 getintegeri_v.c
+ *
+ * From the GL_ARB_shader_storage_buffer_object spec:
+ *
+ *   To query the starting offset or size of the range of each buffer object
+ *binding used for shader storage buffers, call GetInteger64i_v with 
param
+ *set to SHADER_STORAGE_BUFFER_START or SHADER_STORAGE_BUFFER_SIZE
+ *respectively.  index must be in the range zero to the value of
+ *MAX_SHADER_STORAGE_BUFFER_BINDINGS-1.  If the parameter (starting offset
+ *or size) was not specified when the buffer object was bound (e.g.  if
+ *bound with BindBufferBase), or if no buffer object is bound to index, 
zero
+ *is returned.
+ *
+ * Based on ARB_uniform_buffer_object's getintegeri_v.c
+ */
+
+#include piglit-util-gl.h
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 10;
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static bool pass = true;
+
+static void
+test_index(int line, GLenum e, int index, int expected)
+{
+   GLint val;
+
+   glGetIntegeri_v(e, index, val);
+   if (val != expected) {
+   printf(%s:%d: %s[%d] was %d, expected %d\n,
+  __FILE__, line, piglit_get_gl_enum_name(e), index,
+  val, expected);
+   pass = false;
+   }
+}
+
+void
+test_range(int line, int index, int bo, int offset, int size)
+{
+   test_index(line, GL_SHADER_STORAGE_BUFFER_BINDING, index, bo);
+   test_index(line, GL_SHADER_STORAGE_BUFFER_START, index, offset);
+   test_index(line, GL_SHADER_STORAGE_BUFFER_SIZE, index, size);
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+   GLuint bo[2];
+   int size = 1024;
+   GLint max_bindings;
+   GLint junk;
+   GLint alignment;
+
+   piglit_require_extension(GL_ARB_shader_storage_buffer_object);
+
+/* If no buffer object is bound

[Piglit] [PATCH] glsl-1.50: don't do link check in gs-also-uses-smooth-flat-noperspective.geom

2015-03-27 Thread Samuel Iglesias Gonsalvez
From GLSL 1.50 spec, section 4.3.4 Inputs:

  Only the input variables that are actually read need to be written by the
   previous stage
   [...]
  Geometry shader input variables get the per-vertex values written
   out by vertex shader output variables of the same names.

As there is not vertex shader that defines the respective output
variables, this test should fail when linking. However, as it is checking
that smooth and flat interpolation qualifiers are allowed in geometry
shaders, this patch disables link checking.

Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
---
 .../spec/glsl-1.50/compiler/gs-also-uses-smooth-flat-noperspective.geom | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/tests/spec/glsl-1.50/compiler/gs-also-uses-smooth-flat-noperspective.geom 
b/tests/spec/glsl-1.50/compiler/gs-also-uses-smooth-flat-noperspective.geom
index f1ab41e..9eb0d7a 100644
--- a/tests/spec/glsl-1.50/compiler/gs-also-uses-smooth-flat-noperspective.geom
+++ b/tests/spec/glsl-1.50/compiler/gs-also-uses-smooth-flat-noperspective.geom
@@ -1,7 +1,7 @@
 // [config]
 // expect_result: pass
 // glsl_version: 1.50
-// check_link: true
+// check_link: false
 // [end config]
 
 #version 150
-- 
2.1.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH v2 2/2] shaders: add test to check (x+y cmp 0) optimization

2015-03-01 Thread Samuel Iglesias Gonsalvez
Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
---

v2:
* Implement it as shader_runner test

 tests/shaders/glsl-opt-xy-cmp-0.shader_test | 33 +
 1 file changed, 33 insertions(+)
 create mode 100644 tests/shaders/glsl-opt-xy-cmp-0.shader_test

diff --git a/tests/shaders/glsl-opt-xy-cmp-0.shader_test 
b/tests/shaders/glsl-opt-xy-cmp-0.shader_test
new file mode 100644
index 000..97aa1fe
--- /dev/null
+++ b/tests/shaders/glsl-opt-xy-cmp-0.shader_test
@@ -0,0 +1,33 @@
+/* Test (x+y cmp 0) optimization. */
+
+[require]
+GLSL = 1.10
+
+[vertex shader]
+
+void main()
+{
+   gl_Position = ftransform();
+}
+
+[fragment shader]
+
+uniform float a;
+
+void main()
+{
+   if ((a - 1.0) = 0.0)
+   gl_FragColor = vec4(0, 1, 0, 1);
+   else
+   gl_FragColor = vec4(1, 0, 0, 1);
+}
+
+[test]
+clear color 0.5 0.5 0.5 0.5
+clear
+uniform float a 0
+draw rect -1 -1 1 2
+uniform float a 2
+draw rect 0 -1 1 2
+probe rgb 125 0 0.0 1.0 0.0
+probe rgb 0 0 1.0 0.0 0.0
-- 
2.1.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 1/2] shaders: add test to check (0 cmp x+y) optimization

2015-02-25 Thread Samuel Iglesias Gonsalvez
---
 tests/all.py  |   1 +
 tests/shaders/CMakeLists.gl.txt   |   1 +
 tests/shaders/glsl-opt-0-cmp-xy.c | 130 ++
 3 files changed, 132 insertions(+)
 create mode 100644 tests/shaders/glsl-opt-0-cmp-xy.c

diff --git a/tests/all.py b/tests/all.py
index 40f38cf..d07ae35 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -506,6 +506,7 @@ add_concurrent_test(shaders, ['glsl-link-bug30552'])
 add_concurrent_test(shaders, ['glsl-link-bug38015'])
 add_concurrent_test(shaders, ['glsl-link-empty-prog-01'])
 add_concurrent_test(shaders, ['glsl-link-empty-prog-02'])
+add_concurrent_test(shaders, ['glsl-opt-0-cmp-xy'])
 shaders['GLSL link single global initializer, 2 shaders'] = \
 PiglitGLTest(['glsl-link-test',
   os.path.join('shaders', 'glsl-link-initializer-01a.vert'),
diff --git a/tests/shaders/CMakeLists.gl.txt b/tests/shaders/CMakeLists.gl.txt
index 3efc6bf..521282b 100644
--- a/tests/shaders/CMakeLists.gl.txt
+++ b/tests/shaders/CMakeLists.gl.txt
@@ -145,6 +145,7 @@ piglit_add_executable (glsl-routing glsl-routing.c)
 piglit_add_executable (shader_runner shader_runner.c parser_utils.c)
 piglit_add_executable (glsl-vs-point-size glsl-vs-point-size.c)
 piglit_add_executable (glsl-sin glsl-sin.c)
+piglit_add_executable (glsl-opt-0-cmp-xy glsl-opt-0-cmp-xy.c)
 IF (UNIX)
target_link_libraries(glsl-sin m)
 ENDIF (UNIX)
diff --git a/tests/shaders/glsl-opt-0-cmp-xy.c 
b/tests/shaders/glsl-opt-0-cmp-xy.c
new file mode 100644
index 000..65cb555
--- /dev/null
+++ b/tests/shaders/glsl-opt-0-cmp-xy.c
@@ -0,0 +1,130 @@
+/*
+ * Copyright © 2015 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.
+ *
+ * Authors:
+ *Samuel Iglesias Gonsalvez sigles...@igalia.com
+ *
+ */
+
+/** @file glsl-opt-0-cmp-xy.c
+ *
+ * It checks (0 cmp x+y) optimization (if any) works fine.
+ *
+ * Test renders two rectangles: left rect's color is green, right rect's color
+ * is red. Left rectangle's width is one pixel larger than right rectangle's.
+ *
+ */
+
+#include piglit-util-gl.h
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+config.supports_gl_compat_version = 10;
+config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
+config.window_width = 50;
+config.window_height = 50;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static char vs_code[] =
+uniform float a;\n
+
+void main()\n
+{\n
+gl_Position = ftransform();\n
+}\n;
+
+static char fs_code[] =
+uniform float a;\n
+
+void main()\n
+{\n
+if (0.0 = (a - 1.0))\n
+gl_FragColor = vec4(0, 1, 0, 1);\n
+else\n
+gl_FragColor = vec4(1, 0, 0, 1);\n
+}\n;
+
+static GLuint setup_shaders()
+{
+GLuint vs, fs, prog;
+
+vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_code);
+fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_code);
+prog = piglit_link_simple_program(vs, fs);
+
+glUseProgram(prog);
+return prog;
+}
+
+static GLboolean test()
+{
+GLint prog, location;
+GLboolean pass = GL_TRUE;
+int i;
+float color[4] = {0, 0, 0, 1};
+
+prog = setup_shaders();
+location = glGetUniformLocation(prog, a);
+
+for (i = 0; i  49; i++) {
+glUniform1f(location, (i - 25));
+piglit_draw_rect(i, 0, i+1, 50);
+}
+if (!piglit_check_gl_error(GL_NO_ERROR))
+piglit_report_result(PIGLIT_FAIL);
+
+for (i = 0; i  50; i++) {
+float val = i - 25;
+if (0.0f = (val - 1.0)) {
+color[1] = 1.0f;
+color[0] = color[2] = 0.0f;
+} else {
+color[0] = 1.0f;
+color[1] = color[2] = 0.0f;
+}
+pass = piglit_probe_pixel_rgb(i, 0, color)  pass;
+}
+
+return pass;
+}
+
+enum piglit_result piglit_display(void)
+{
+GLboolean pass;
+
+piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE

[Piglit] [PATCH 2/2] shaders: add test to check (x+y cmp 0) optimization

2015-02-25 Thread Samuel Iglesias Gonsalvez
---
 tests/all.py  |   1 +
 tests/shaders/CMakeLists.gl.txt   |   1 +
 tests/shaders/glsl-opt-xy-cmp-0.c | 130 ++
 3 files changed, 132 insertions(+)
 create mode 100644 tests/shaders/glsl-opt-xy-cmp-0.c

diff --git a/tests/all.py b/tests/all.py
index d07ae35..7797756 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -507,6 +507,7 @@ add_concurrent_test(shaders, ['glsl-link-bug38015'])
 add_concurrent_test(shaders, ['glsl-link-empty-prog-01'])
 add_concurrent_test(shaders, ['glsl-link-empty-prog-02'])
 add_concurrent_test(shaders, ['glsl-opt-0-cmp-xy'])
+add_concurrent_test(shaders, ['glsl-opt-xy-cmp-0'])
 shaders['GLSL link single global initializer, 2 shaders'] = \
 PiglitGLTest(['glsl-link-test',
   os.path.join('shaders', 'glsl-link-initializer-01a.vert'),
diff --git a/tests/shaders/CMakeLists.gl.txt b/tests/shaders/CMakeLists.gl.txt
index 521282b..11e5f20 100644
--- a/tests/shaders/CMakeLists.gl.txt
+++ b/tests/shaders/CMakeLists.gl.txt
@@ -146,6 +146,7 @@ piglit_add_executable (shader_runner shader_runner.c 
parser_utils.c)
 piglit_add_executable (glsl-vs-point-size glsl-vs-point-size.c)
 piglit_add_executable (glsl-sin glsl-sin.c)
 piglit_add_executable (glsl-opt-0-cmp-xy glsl-opt-0-cmp-xy.c)
+piglit_add_executable (glsl-opt-xy-cmp-0 glsl-opt-xy-cmp-0.c)
 IF (UNIX)
target_link_libraries(glsl-sin m)
 ENDIF (UNIX)
diff --git a/tests/shaders/glsl-opt-xy-cmp-0.c 
b/tests/shaders/glsl-opt-xy-cmp-0.c
new file mode 100644
index 000..c48bb7d
--- /dev/null
+++ b/tests/shaders/glsl-opt-xy-cmp-0.c
@@ -0,0 +1,130 @@
+/*
+ * Copyright © 2015 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.
+ *
+ * Authors:
+ *Samuel Iglesias Gonsalvez sigles...@igalia.com
+ *
+ */
+
+/** @file glsl-opt-xy-cmp-0.c
+ *
+ * It checks (x+y cmp 0) optimization (if any) works fine.
+ *
+ * Test renders two rectangles: left rect's color is red, right rect's color
+ * is green. Left rectangle's width is one pixel larger than right rectangle's.
+ *
+ */
+
+#include piglit-util-gl.h
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+config.supports_gl_compat_version = 10;
+config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
+config.window_width = 50;
+config.window_height = 50;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static char vs_code[] =
+uniform float a;\n
+
+void main()\n
+{\n
+gl_Position = ftransform();\n
+}\n;
+
+static char fs_code[] =
+uniform float a;\n
+
+void main()\n
+{\n
+if ((a - 1.0) = 0.0)\n
+gl_FragColor = vec4(0, 1, 0, 1);\n
+else\n
+gl_FragColor = vec4(1, 0, 0, 1);\n
+}\n;
+
+static GLuint setup_shaders()
+{
+GLuint vs, fs, prog;
+
+vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_code);
+fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_code);
+prog = piglit_link_simple_program(vs, fs);
+
+glUseProgram(prog);
+return prog;
+}
+
+static GLboolean test()
+{
+GLint prog, location;
+GLboolean pass = GL_TRUE;
+int i;
+float color[4] = {0, 0, 0, 1};
+
+prog = setup_shaders();
+location = glGetUniformLocation(prog, a);
+
+for (i = 0; i  49; i++) {
+glUniform1f(location, (i - 25));
+piglit_draw_rect(i, 0, i+1, 50);
+}
+if (!piglit_check_gl_error(GL_NO_ERROR))
+piglit_report_result(PIGLIT_FAIL);
+
+for (i = 0; i  50; i++) {
+float val = i - 25;
+if ((val - 1.0) = 0.0f) {
+color[1] = 1.0f;
+color[0] = color[2] = 0.0f;
+} else {
+color[0] = 1.0f;
+color[1] = color[2] = 0.0f;
+}
+pass = piglit_probe_pixel_rgb(i, 0, color)  pass;
+}
+
+return pass;
+}
+
+enum piglit_result piglit_display(void)
+{
+GLboolean pass;
+
+piglit_ortho_projection(piglit_width

[Piglit] [PATCH] glean/pixelformats: restrict GL_ABGR_EXT format test to the types in the spec

2015-01-13 Thread Samuel Iglesias Gonsalvez
Packed types are not explicitly allowed to work with GL_ABGR_EXT format in
the OpenGL spec nor GL_EXT_abgr spec.

NVIDIA allows it but AMD doesn't and Intel driver hasn't allowed it with
UNSIGNED_SHORT_5_5_5_1 and UNSIGNED_INT_10_10_10_2 as of c471b09bf4.

Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
---
 tests/glean/tpixelformats.cpp | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/tests/glean/tpixelformats.cpp b/tests/glean/tpixelformats.cpp
index 27881bf..b040957 100644
--- a/tests/glean/tpixelformats.cpp
+++ b/tests/glean/tpixelformats.cpp
@@ -612,6 +612,12 @@ PixelFormatsTest::CompatibleFormatAndType(GLenum format, 
GLenum datatype) const
if (format == GL_ABGR_EXT  !haveABGR)
return false;
 
+   // Special case: GL_ABGR_EXT can't be used with packed types
+   // because they are not explicitely allowed by GL_ABGR_EXT spec or
+   // OpenGL spec.
+   if (format == GL_ABGR_EXT  IsPackedType(datatype))
+   return false;
+
if (format == GL_RG  !haveRG)
return false;
 
-- 
2.1.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] tests: restrict use of the GL_ABGR_EXT format to the types in the spec

2015-01-12 Thread Samuel Iglesias Gonsalvez
GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_INT_10_10_10_2,
GL_UNSIGNED_SHORT_1_5_5_5_REV and GL_UNSIGNED_SHORT_5_5_5_1 types
are not explicitly allowed to work with GL_ABGR_EXT format in
the GL spec nor GL_EXT_abgr spec.

Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
---
 tests/glean/tpixelformats.cpp| 7 +++
 tests/texturing/texture-packed-formats.c | 4 
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/tests/glean/tpixelformats.cpp b/tests/glean/tpixelformats.cpp
index 27881bf..80d926a 100644
--- a/tests/glean/tpixelformats.cpp
+++ b/tests/glean/tpixelformats.cpp
@@ -618,6 +618,13 @@ PixelFormatsTest::CompatibleFormatAndType(GLenum format, 
GLenum datatype) const
if (datatype == GL_UNSIGNED_INT_5_9_9_9_REV  !haveTexSharedExp)
return false;
 
+   if (format == GL_ABGR_EXT 
+   (datatype == GL_UNSIGNED_INT_2_10_10_10_REV ||
+datatype == GL_UNSIGNED_INT_10_10_10_2 ||
+datatype == GL_UNSIGNED_SHORT_1_5_5_5_REV ||
+datatype == GL_UNSIGNED_SHORT_5_5_5_1))
+   return false;
+
const int formatComps = NumberOfComponentsInFormat(format);
const int typeComps = NumberOfComponentsInPackedType(datatype);
return formatComps == typeComps || typeComps == 0;
diff --git a/tests/texturing/texture-packed-formats.c 
b/tests/texturing/texture-packed-formats.c
index 1c92b1c..f63e5c2 100644
--- a/tests/texturing/texture-packed-formats.c
+++ b/tests/texturing/texture-packed-formats.c
@@ -97,10 +97,6 @@ static const struct pixel_format Formats[] = {
  GL_ABGR_EXT, GL_UNSIGNED_SHORT_4_4_4_4, 2, 0x800f, 0x80f0 },
{ GL_ABGR_EXT/GL_UNSIGNED_SHORT_4_4_4_4_REV,
  GL_ABGR_EXT, GL_UNSIGNED_SHORT_4_4_4_4_REV, 2, 0xf008, 0x0f08 },
-   { GL_ABGR_EXT/GL_UNSIGNED_SHORT_5_5_5_1,
- GL_ABGR_EXT, GL_UNSIGNED_SHORT_5_5_5_1, 2, 0xf801, 0xf83e },
-   { GL_ABGR_EXT/GL_UNSIGNED_SHORT_1_5_5_5_REV,
- GL_ABGR_EXT, GL_UNSIGNED_SHORT_1_5_5_5_REV, 2, 0x800f, 0x7c0f },
 
{ GL_RGB/GL_UNSIGNED_SHORT_5_6_5,
  GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 2, 0xf800, 0x7e0 },
-- 
2.1.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] glsl-1.50-geometry-primitive-id-restart: Add workaround for Intel SandyBrige

2014-09-17 Thread Samuel Iglesias Gonsalvez
Intel SandyBridge is not handling GL_TRIANGLE_STRIP_ADJACENCY with
repeating vertex indices correctly, so there is a GPU hang when
running:

bin/glsl-1.50-geometry-primitive-id-restart \
GL_TRIANGLE_STRIP_ADJACENCY ffs

This patch provides a workaround for this issue as it seems to be a HW
bug in SandyBrigde. More information:

http://lists.freedesktop.org/archives/mesa-dev/2014-July/064221.html

Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
---

If there is no objections, we plan to push this patch next week because
it is needed to avoid GPU hangs when testing GS support patches for SNB.

Before pushing it, we will send a reminder to the mailing list, just in
case.

 .../execution/geometry/primitive-id-restart.c | 19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/tests/spec/glsl-1.50/execution/geometry/primitive-id-restart.c 
b/tests/spec/glsl-1.50/execution/geometry/primitive-id-restart.c
index 9f1a8ef..1e748c3 100644
--- a/tests/spec/glsl-1.50/execution/geometry/primitive-id-restart.c
+++ b/tests/spec/glsl-1.50/execution/geometry/primitive-id-restart.c
@@ -218,11 +218,22 @@ piglit_init(int argc, char **argv)
num_elements = 0;
for (i = 1; i = LONGEST_INPUT_SEQUENCE; i++) {
for (j = 0; j  i; j++) {
-   /* Every element that isn't the primitive
-* restart index can just be element 0, since
-* we don't care about the actual vertex data.
+   /* Every element that isn't the primitive restart index
+* can have any value as far as it is not the primitive
+* restart index since we don't care about the actual
+* vertex data.
+*
+* NOTE: repeating the indices for all elements but the
+* primitive restart index causes a GPU hang in Intel's
+* Sandy Bridge platform, likely due to a hardware bug,
+* so make sure that we do not repeat the indices.
+*
+* More information:
+*
+* 
http://lists.freedesktop.org/archives/mesa-dev/2014-July/064221.html
 */
-   elements[num_elements++] = 0;
+   elements[num_elements++] =
+   j != prim_restart_index ? j : j + 1;
}
elements[num_elements++] = prim_restart_index;
}
-- 
2.1.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH v3 4/5] arb_gpu_shader5: Add new test emitstreamvertex_nodraw

2014-08-20 Thread Samuel Iglesias Gonsalvez
It checks that a vertex emitted in stream !=0 is not
processed in the fragment shader.

Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
---
 tests/all.py   |   1 +
 .../arb_gpu_shader5/execution/CMakeLists.gl.txt|   1 +
 .../execution/emitstreamvertex_nodraw.c| 171 +
 3 files changed, 173 insertions(+)
 create mode 100644 
tests/spec/arb_gpu_shader5/execution/emitstreamvertex_nodraw.c

diff --git a/tests/all.py b/tests/all.py
index e76a2b7..da5122c 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1873,6 +1873,7 @@ add_concurrent_test(arb_gpu_shader5, 
'arb_gpu_shader5-stream_value_too_large')
 add_concurrent_test(arb_gpu_shader5, 
'arb_gpu_shader5-emitstreamvertex_stream_too_large')
 add_concurrent_test(arb_gpu_shader5, 'arb_gpu_shader5-tf-wrong-stream-value')
 add_concurrent_test(arb_gpu_shader5, 
'arb_gpu_shader5-xfb-streams-without-invocations')
+add_concurrent_test(arb_gpu_shader5, 'arb_gpu_shader5-emitstreamvertex_nodraw')
 
 arb_shader_subroutine = {}
 spec['ARB_shader_subroutine'] = arb_shader_subroutine
diff --git a/tests/spec/arb_gpu_shader5/execution/CMakeLists.gl.txt 
b/tests/spec/arb_gpu_shader5/execution/CMakeLists.gl.txt
index fcd271f..0b743d9 100644
--- a/tests/spec/arb_gpu_shader5/execution/CMakeLists.gl.txt
+++ b/tests/spec/arb_gpu_shader5/execution/CMakeLists.gl.txt
@@ -12,3 +12,4 @@ link_libraries (
 piglit_add_executable (arb_gpu_shader5-invocation-id invocation-id.c)
 piglit_add_executable (arb_gpu_shader5-xfb-streams xfb-streams.c)
 piglit_add_executable (arb_gpu_shader5-xfb-streams-without-invocations 
xfb-streams-without-invocations.c)
+piglit_add_executable (arb_gpu_shader5-emitstreamvertex_nodraw 
emitstreamvertex_nodraw.c)
diff --git a/tests/spec/arb_gpu_shader5/execution/emitstreamvertex_nodraw.c 
b/tests/spec/arb_gpu_shader5/execution/emitstreamvertex_nodraw.c
new file mode 100644
index 000..f581d22
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/execution/emitstreamvertex_nodraw.c
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2014 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 emitstreamvertex_no_draw.c
+ *
+ * Test that a vertex emitted in stream 1 is not processed by fragment
+ * shader.
+ */
+
+#include piglit-util-gl.h
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 32;
+   config.supports_gl_core_version = 32;
+   config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB;
+   config.window_width = 100;
+   config.window_height = 100;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+GLuint vertexbuffer;
+GLint program;
+
+static const GLfloat g_vertex_buffer_data[] = {
+   -0.5f, -0.5f, 0.0f,
+   0.5f, -0.5f, 0.0f,
+   0.0f,  0.50f, 0.0f,
+};
+
+enum piglit_result
+piglit_display(void)
+{
+   int pass;
+   float c[3] = {1.0, 0.0 , 0.0};
+   float c_clear[3] = {0.0, 0.0 , 0.0};
+
+   glUseProgram(program);
+
+   /*
+* Workaround: if define glPointSize == 1, piglit_probe_pixel_rgb()
+* will fail unless the window is resized.
+*/
+   glPointSize(2);
+
+   glViewport(0, 0, piglit_width, piglit_height);
+   /* Clear the back buffer to black */
+   glClearColor(0, 0, 0, 0);
+   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+   glEnableVertexAttribArray(0);
+   glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
+   glVertexAttribPointer(
+   0,
+   3,
+   GL_FLOAT,
+   GL_FALSE,
+   0,
+   (void*)0);
+
+   glDrawArrays(GL_POINTS, 0, 3);
+   glDisableVertexAttribArray(0);
+
+   /* Probe that the point in stream=1 is not drawn. */
+   pass = piglit_probe_pixel_rgb(piglit_width/2, piglit_height/2, c_clear);
+   /* Probe that the rest

[Piglit] [PATCH v3 0/5] arb_gpu_shader5: tests to verify 'stream' layout qualifier

2014-08-20 Thread Samuel Iglesias Gonsalvez
Hello,

This is the third version of the patch series. I resend them to the
mailing list as the second version got unreviewed for weeks and they
needed to be rebased to master, fixed some issues (piglit-gl-util.h
renaming) and other minor things.

This version includes the following changes:

* Fix coding style issues in every patch.
* Use piglit-gl-util.h instead of piglit-gl-util-common.h
* Add a new patch (last one of the series) that modifies a printf
message output which was wrong in xfb-streams.c.

Best regards,

Sam

P.S: I don't have push rights to piglit repository.

Samuel Iglesias Gonsalvez (5):
  arb_gpu_shader5: add some compiler tests for stream qualifier
  arb_gpu_shader5: Add linker tests to verify 'stream' layout qualifier
  arb_gpu_shader5: Add execution test to verify 'stream' layout
qualifier
  arb_gpu_shader5: Add new test emitstreamvertex_nodraw
  arb_gpu_shade5: fix output message in xfb-streams.c

 tests/all.py   |   5 +
 tests/spec/arb_gpu_shader5/CMakeLists.txt  |   3 +-
 tests/spec/arb_gpu_shader5/compiler/CMakeLists.txt |   3 +-
 .../compiler/stream-qualifier/CMakeLists.gl.txt|  12 +
 .../compiler/stream-qualifier/CMakeLists.txt   |   1 +
 .../correct-multiple-layout-qualifier-stream.geom  |  40 
 .../incorrect-in-layout-qualifier-stream.geom  |  19 ++
 ...ect-multiple-block-layout-qualifier-stream.geom |  32 +++
 ...incorrect-negative-layout-qualifier-stream.geom |  24 ++
 .../stream-qualifier/stream_value_too_large.c  | 192 
 .../arb_gpu_shader5/execution/CMakeLists.gl.txt|   2 +
 .../execution/emitstreamvertex_nodraw.c| 171 ++
 .../execution/xfb-streams-without-invocations.c| 250 +
 tests/spec/arb_gpu_shader5/execution/xfb-streams.c |   4 +-
 .../spec/arb_gpu_shader5/linker/CMakeLists.gl.txt  |  13 ++
 tests/spec/arb_gpu_shader5/linker/CMakeLists.txt   |   1 +
 .../linker/emitstreamvertex_stream_too_large.c | 133 +++
 .../linker/stream-different-zero-gs-fs.shader_test |  50 +
 .../linker/stream-invalid-prim-output.shader_test  |  54 +
 .../linker/stream-negative-value.shader_test   |  38 
 .../arb_gpu_shader5/linker/tf-wrong-stream-value.c | 116 ++
 21 files changed, 1159 insertions(+), 4 deletions(-)
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/CMakeLists.gl.txt
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/CMakeLists.txt
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/correct-multiple-layout-qualifier-stream.geom
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/incorrect-in-layout-qualifier-stream.geom
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/incorrect-multiple-block-layout-qualifier-stream.geom
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/incorrect-negative-layout-qualifier-stream.geom
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/stream_value_too_large.c
 create mode 100644 
tests/spec/arb_gpu_shader5/execution/emitstreamvertex_nodraw.c
 create mode 100644 
tests/spec/arb_gpu_shader5/execution/xfb-streams-without-invocations.c
 create mode 100644 tests/spec/arb_gpu_shader5/linker/CMakeLists.gl.txt
 create mode 100644 tests/spec/arb_gpu_shader5/linker/CMakeLists.txt
 create mode 100644 
tests/spec/arb_gpu_shader5/linker/emitstreamvertex_stream_too_large.c
 create mode 100644 
tests/spec/arb_gpu_shader5/linker/stream-different-zero-gs-fs.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader5/linker/stream-invalid-prim-output.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader5/linker/stream-negative-value.shader_test
 create mode 100644 tests/spec/arb_gpu_shader5/linker/tf-wrong-stream-value.c

-- 
2.1.0.rc1

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH v3 2/5] arb_gpu_shader5: Add linker tests to verify 'stream' layout qualifier

2014-08-20 Thread Samuel Iglesias Gonsalvez
Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
---
 tests/all.py   |   2 +
 tests/spec/arb_gpu_shader5/CMakeLists.txt  |   3 +-
 .../spec/arb_gpu_shader5/linker/CMakeLists.gl.txt  |  13 ++
 tests/spec/arb_gpu_shader5/linker/CMakeLists.txt   |   1 +
 .../linker/emitstreamvertex_stream_too_large.c | 133 +
 .../linker/stream-different-zero-gs-fs.shader_test |  50 
 .../linker/stream-invalid-prim-output.shader_test  |  54 +
 .../linker/stream-negative-value.shader_test   |  38 ++
 .../arb_gpu_shader5/linker/tf-wrong-stream-value.c | 116 ++
 9 files changed, 409 insertions(+), 1 deletion(-)
 create mode 100644 tests/spec/arb_gpu_shader5/linker/CMakeLists.gl.txt
 create mode 100644 tests/spec/arb_gpu_shader5/linker/CMakeLists.txt
 create mode 100644 
tests/spec/arb_gpu_shader5/linker/emitstreamvertex_stream_too_large.c
 create mode 100644 
tests/spec/arb_gpu_shader5/linker/stream-different-zero-gs-fs.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader5/linker/stream-invalid-prim-output.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader5/linker/stream-negative-value.shader_test
 create mode 100644 tests/spec/arb_gpu_shader5/linker/tf-wrong-stream-value.c

diff --git a/tests/all.py b/tests/all.py
index 69cedd5..e25a6a3 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1870,6 +1870,8 @@ add_concurrent_test(arb_gpu_shader5, 
'arb_gpu_shader5-invocation-id')
 add_concurrent_test(arb_gpu_shader5, 
'arb_gpu_shader5-invocations_count_too_large')
 add_concurrent_test(arb_gpu_shader5, 'arb_gpu_shader5-xfb-streams')
 add_concurrent_test(arb_gpu_shader5, 'arb_gpu_shader5-stream_value_too_large')
+add_concurrent_test(arb_gpu_shader5, 
'arb_gpu_shader5-emitstreamvertex_stream_too_large')
+add_concurrent_test(arb_gpu_shader5, 'arb_gpu_shader5-tf-wrong-stream-value')
 
 arb_shader_subroutine = {}
 spec['ARB_shader_subroutine'] = arb_shader_subroutine
diff --git a/tests/spec/arb_gpu_shader5/CMakeLists.txt 
b/tests/spec/arb_gpu_shader5/CMakeLists.txt
index f41c000..60d83cb 100644
--- a/tests/spec/arb_gpu_shader5/CMakeLists.txt
+++ b/tests/spec/arb_gpu_shader5/CMakeLists.txt
@@ -1,3 +1,4 @@
 add_subdirectory (compiler)
 add_subdirectory (execution)
-piglit_include_target_api()
\ No newline at end of file
+add_subdirectory (linker)
+piglit_include_target_api()
diff --git a/tests/spec/arb_gpu_shader5/linker/CMakeLists.gl.txt 
b/tests/spec/arb_gpu_shader5/linker/CMakeLists.gl.txt
new file mode 100644
index 000..f955e83
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/linker/CMakeLists.gl.txt
@@ -0,0 +1,13 @@
+include_directories(
+   ${GLEXT_INCLUDE_DIR}
+   ${OPENGL_INCLUDE_PATH}
+)
+
+link_libraries (
+   piglitutil_${piglit_target_api}
+   ${OPENGL_gl_LIBRARY}
+   ${OPENGL_glu_LIBRARY}
+)
+
+piglit_add_executable (arb_gpu_shader5-emitstreamvertex_stream_too_large 
emitstreamvertex_stream_too_large.c)
+piglit_add_executable (arb_gpu_shader5-tf-wrong-stream-value 
tf-wrong-stream-value.c)
diff --git a/tests/spec/arb_gpu_shader5/linker/CMakeLists.txt 
b/tests/spec/arb_gpu_shader5/linker/CMakeLists.txt
new file mode 100644
index 000..144a306
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/linker/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git 
a/tests/spec/arb_gpu_shader5/linker/emitstreamvertex_stream_too_large.c 
b/tests/spec/arb_gpu_shader5/linker/emitstreamvertex_stream_too_large.c
new file mode 100644
index 000..cd2626f
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/linker/emitstreamvertex_stream_too_large.c
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2014 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 emitstreamvertex_stream_too_large.c
+ *
+ * Test that exceeding the implementation's maximum streams
+ * value (GL_MAX_VERTEX_STREAMS) when calling

[Piglit] [PATCH v3 3/5] arb_gpu_shader5: Add execution test to verify 'stream' layout qualifier

2014-08-20 Thread Samuel Iglesias Gonsalvez
Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
---
 tests/all.py   |   1 +
 .../arb_gpu_shader5/execution/CMakeLists.gl.txt|   1 +
 .../execution/xfb-streams-without-invocations.c| 250 +
 3 files changed, 252 insertions(+)
 create mode 100644 
tests/spec/arb_gpu_shader5/execution/xfb-streams-without-invocations.c

diff --git a/tests/all.py b/tests/all.py
index e25a6a3..e76a2b7 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1872,6 +1872,7 @@ add_concurrent_test(arb_gpu_shader5, 
'arb_gpu_shader5-xfb-streams')
 add_concurrent_test(arb_gpu_shader5, 'arb_gpu_shader5-stream_value_too_large')
 add_concurrent_test(arb_gpu_shader5, 
'arb_gpu_shader5-emitstreamvertex_stream_too_large')
 add_concurrent_test(arb_gpu_shader5, 'arb_gpu_shader5-tf-wrong-stream-value')
+add_concurrent_test(arb_gpu_shader5, 
'arb_gpu_shader5-xfb-streams-without-invocations')
 
 arb_shader_subroutine = {}
 spec['ARB_shader_subroutine'] = arb_shader_subroutine
diff --git a/tests/spec/arb_gpu_shader5/execution/CMakeLists.gl.txt 
b/tests/spec/arb_gpu_shader5/execution/CMakeLists.gl.txt
index 18e9ad8..fcd271f 100644
--- a/tests/spec/arb_gpu_shader5/execution/CMakeLists.gl.txt
+++ b/tests/spec/arb_gpu_shader5/execution/CMakeLists.gl.txt
@@ -11,3 +11,4 @@ link_libraries (
 
 piglit_add_executable (arb_gpu_shader5-invocation-id invocation-id.c)
 piglit_add_executable (arb_gpu_shader5-xfb-streams xfb-streams.c)
+piglit_add_executable (arb_gpu_shader5-xfb-streams-without-invocations 
xfb-streams-without-invocations.c)
diff --git 
a/tests/spec/arb_gpu_shader5/execution/xfb-streams-without-invocations.c 
b/tests/spec/arb_gpu_shader5/execution/xfb-streams-without-invocations.c
new file mode 100644
index 000..e2a3455
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/execution/xfb-streams-without-invocations.c
@@ -0,0 +1,250 @@
+/*
+ * Copyright (c) 2014 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.
+ */
+
+#include piglit-util-gl.h
+
+/**
+ * @file xfb-streams-without-invocations.c
+ *
+ * This test uses geometry shader multiple stream support from
+ * GL_ARB_gpu_shader5 and GL_ARB_transform_feedback3 to capture
+ * transform feedback from 3 streams into 2 buffers.
+ *
+ * Based on the work of Jordan's work in xfb-streams.c.
+ */
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 32;
+   config.supports_gl_core_version = 32;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static const char vs_pass_thru_text[] =
+   #version 150\n
+   void main() {\n
+ gl_Position = vec4(0.0);\n
+   }\n;
+
+static const char gs_text[] =
+   #version 150\n
+   #extension GL_ARB_gpu_shader5 : enable\n
+   layout(points) in;\n
+   layout(points, max_vertices = 3) out;\n
+   layout(stream = 0) out float stream0_0_out;\n
+   layout(stream = 1) out vec2 stream1_0_out;\n
+   layout(stream = 2) out float stream2_0_out;\n
+   layout(stream = 2) out vec4 stream2_1_out;\n
+   void main() {\n
+ gl_Position = gl_in[0].gl_Position;\n
+ stream0_0_out = 0.0;\n
+ EmitStreamVertex(0);\n
+ EndStreamPrimitive(0);\n
+
+ stream2_0_out = 0.0;\n
+ stream2_1_out = vec4(1.0, 2.0, 3.0, 4.0);\n
+ EmitStreamVertex(2);\n
+ EndStreamPrimitive(2);\n
+
+ stream1_0_out = vec2(0.0, 1.0);\n
+ EmitStreamVertex(1);\n
+ EndStreamPrimitive(1);\n
+   };
+
+int stream_float_counts[] = { 1, 2, 5, 0 };
+
+#define STREAMS 4
+
+static const char *varyings[] = {
+   stream0_0_out, gl_NextBuffer,
+   stream1_0_out, gl_NextBuffer,
+   stream2_0_out, stream2_1_out
+};
+
+static void
+build_and_use_program()
+{
+   GLuint prog;
+
+   prog = piglit_build_simple_program_multiple_shaders(
+   GL_VERTEX_SHADER, vs_pass_thru_text

[Piglit] [PATCH v3 1/5] arb_gpu_shader5: add some compiler tests for stream qualifier

2014-08-20 Thread Samuel Iglesias Gonsalvez
Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
---
 tests/all.py   |   1 +
 tests/spec/arb_gpu_shader5/compiler/CMakeLists.txt |   3 +-
 .../compiler/stream-qualifier/CMakeLists.gl.txt|  12 ++
 .../compiler/stream-qualifier/CMakeLists.txt   |   1 +
 .../correct-multiple-layout-qualifier-stream.geom  |  40 +
 .../incorrect-in-layout-qualifier-stream.geom  |  19 ++
 ...ect-multiple-block-layout-qualifier-stream.geom |  32 
 ...incorrect-negative-layout-qualifier-stream.geom |  24 +++
 .../stream-qualifier/stream_value_too_large.c  | 192 +
 9 files changed, 323 insertions(+), 1 deletion(-)
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/CMakeLists.gl.txt
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/CMakeLists.txt
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/correct-multiple-layout-qualifier-stream.geom
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/incorrect-in-layout-qualifier-stream.geom
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/incorrect-multiple-block-layout-qualifier-stream.geom
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/incorrect-negative-layout-qualifier-stream.geom
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/stream_value_too_large.c

diff --git a/tests/all.py b/tests/all.py
index 33b1e28..69cedd5 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1869,6 +1869,7 @@ add_concurrent_test(arb_gpu_shader5, 
'arb_gpu_shader5-minmax')
 add_concurrent_test(arb_gpu_shader5, 'arb_gpu_shader5-invocation-id')
 add_concurrent_test(arb_gpu_shader5, 
'arb_gpu_shader5-invocations_count_too_large')
 add_concurrent_test(arb_gpu_shader5, 'arb_gpu_shader5-xfb-streams')
+add_concurrent_test(arb_gpu_shader5, 'arb_gpu_shader5-stream_value_too_large')
 
 arb_shader_subroutine = {}
 spec['ARB_shader_subroutine'] = arb_shader_subroutine
diff --git a/tests/spec/arb_gpu_shader5/compiler/CMakeLists.txt 
b/tests/spec/arb_gpu_shader5/compiler/CMakeLists.txt
index 4a012b9..ec80122 100644
--- a/tests/spec/arb_gpu_shader5/compiler/CMakeLists.txt
+++ b/tests/spec/arb_gpu_shader5/compiler/CMakeLists.txt
@@ -1 +1,2 @@
-piglit_include_target_api()
\ No newline at end of file
+add_subdirectory (stream-qualifier)
+piglit_include_target_api()
diff --git 
a/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/CMakeLists.gl.txt 
b/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/CMakeLists.gl.txt
new file mode 100644
index 000..11b3110
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/CMakeLists.gl.txt
@@ -0,0 +1,12 @@
+include_directories(
+   ${GLEXT_INCLUDE_DIR}
+   ${OPENGL_INCLUDE_PATH}
+)
+
+link_libraries (
+   piglitutil_${piglit_target_api}
+   ${OPENGL_gl_LIBRARY}
+   ${OPENGL_glu_LIBRARY}
+)
+
+piglit_add_executable (arb_gpu_shader5-stream_value_too_large 
stream_value_too_large.c)
diff --git 
a/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/CMakeLists.txt 
b/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/CMakeLists.txt
new file mode 100644
index 000..144a306
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git 
a/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/correct-multiple-layout-qualifier-stream.geom
 
b/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/correct-multiple-layout-qualifier-stream.geom
new file mode 100644
index 000..46c0644
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/correct-multiple-layout-qualifier-stream.geom
@@ -0,0 +1,40 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// check_link: false
+// [end config]
+//
+// ARB_gpu_shader5 spec says:
+//   A default stream number may be declared at global
+//scope by qualifying interface qualifier out as in this example:
+//
+//  layout(stream = 1) out;
+//
+//The stream number specified in such a declaration replaces any previous
+//default and applies to all subsequent block and variable declarations
+//until a new default is established.  The initial default stream number is
+//zero.
+//
+// Tests for multiple declarations of layout qualifier 'stream'.
+//
+
+#version 150
+#extension GL_ARB_gpu_shader5 : enable
+
+layout(points) in;
+layout(points) out;
+
+out vec4 var1;
+layout(stream=1) out;
+out vec4 var2;
+layout(stream=2) out vec3 var3;
+
+layout(stream=3) out Block1 {
+   float var4;
+   layout(stream=3) vec4 var5;
+};
+
+void main()
+{
+}
diff --git 
a/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/incorrect-in-layout-qualifier-stream.geom
 
b/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/incorrect-in-layout-qualifier-stream.geom
new file mode 100644
index 000

[Piglit] [PATCH v3 5/5] arb_gpu_shade5: fix output message in xfb-streams.c

2014-08-20 Thread Samuel Iglesias Gonsalvez
This test had the primitives generated and transform feedback primitives
written message output saying the opposite.

Cc: Jordan Justen jordan.l.jus...@intel.com
Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
---
 tests/spec/arb_gpu_shader5/execution/xfb-streams.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/spec/arb_gpu_shader5/execution/xfb-streams.c 
b/tests/spec/arb_gpu_shader5/execution/xfb-streams.c
index 000c361..eb14856 100644
--- a/tests/spec/arb_gpu_shader5/execution/xfb-streams.c
+++ b/tests/spec/arb_gpu_shader5/execution/xfb-streams.c
@@ -134,13 +134,13 @@ probe_buffers(const GLuint *xfb, const GLuint *queries, 
unsigned primitive_n)
for (i = 0; i  STREAMS; i++) {
glGetQueryObjectuiv(queries[i], GL_QUERY_RESULT, query_result);
if (query_result != primitive_n) {
-   printf(Expected %u primitives written, got %u\n,
+   printf(Expected %u primitives generated, got %u\n,
   primitive_n, query_result);
piglit_report_result(PIGLIT_FAIL);
}
glGetQueryObjectuiv(queries[STREAMS+i], GL_QUERY_RESULT, 
query_result);
if (query_result != primitive_n) {
-   printf(Expected %u primitives generated, got %u\n,
+   printf(Expected %u TF primitives written, got %u\n,
   primitive_n, query_result);
piglit_report_result(PIGLIT_FAIL);
}
-- 
2.1.0.rc1

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH v2 0/4] arb_gpu_shader5: tests to verify 'stream' layout qualifier

2014-06-27 Thread Samuel Iglesias Gonsalvez
This is the second version of the patch series. This version includes
the following changes:

* Remove a trailing whitespace from patch 1.
* Added a new test (patch 4) that  checks that a vertex emitted in
stream !=0 is not processed by the fragment shader, following the
suggestion of Chris Forbes in:

  http://lists.freedesktop.org/archives/mesa-dev/2014-June/062117.html

Thanks,

Sam

P.S: I don't have commit access to the repository

Samuel Iglesias Gonsalvez (4):
  arb_gpu_shader5: add some compiler tests for stream qualifier
  arb_gpu_shader5: Add linker tests to verify 'stream' layout qualifier
  arb_gpu_shader5: Add execution test to verify 'stream' layout
qualifier
  arb_gpu_shader5: Add new test emitstreamvertex_nodraw

 tests/all.py   |   5 +
 tests/spec/arb_gpu_shader5/CMakeLists.txt  |   3 +-
 tests/spec/arb_gpu_shader5/compiler/CMakeLists.txt |   3 +-
 .../compiler/stream-qualifier/CMakeLists.gl.txt|  12 +
 .../compiler/stream-qualifier/CMakeLists.txt   |   1 +
 .../correct-multiple-layout-qualifier-stream.geom  |  40 
 .../incorrect-in-layout-qualifier-stream.geom  |  19 ++
 ...ect-multiple-block-layout-qualifier-stream.geom |  32 +++
 ...incorrect-negative-layout-qualifier-stream.geom |  24 ++
 .../stream-qualifier/stream_value_too_large.c  | 193 
 .../arb_gpu_shader5/execution/CMakeLists.gl.txt|   2 +
 .../execution/emitstreamvertex_nodraw.c| 170 ++
 .../execution/xfb-streams-without-invocations.c| 248 +
 .../spec/arb_gpu_shader5/linker/CMakeLists.gl.txt  |  13 ++
 tests/spec/arb_gpu_shader5/linker/CMakeLists.txt   |   1 +
 .../linker/emitstreamvertex_stream_too_large.c | 133 +++
 .../linker/stream-different-zero-gs-fs.shader_test |  50 +
 .../linker/stream-invalid-prim-output.shader_test  |  54 +
 .../linker/stream-negative-value.shader_test   |  38 
 .../arb_gpu_shader5/linker/tf-wrong-stream-value.c | 116 ++
 20 files changed, 1155 insertions(+), 2 deletions(-)
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/CMakeLists.gl.txt
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/CMakeLists.txt
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/correct-multiple-layout-qualifier-stream.geom
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/incorrect-in-layout-qualifier-stream.geom
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/incorrect-multiple-block-layout-qualifier-stream.geom
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/incorrect-negative-layout-qualifier-stream.geom
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/stream_value_too_large.c
 create mode 100644 
tests/spec/arb_gpu_shader5/execution/emitstreamvertex_nodraw.c
 create mode 100644 
tests/spec/arb_gpu_shader5/execution/xfb-streams-without-invocations.c
 create mode 100644 tests/spec/arb_gpu_shader5/linker/CMakeLists.gl.txt
 create mode 100644 tests/spec/arb_gpu_shader5/linker/CMakeLists.txt
 create mode 100644 
tests/spec/arb_gpu_shader5/linker/emitstreamvertex_stream_too_large.c
 create mode 100644 
tests/spec/arb_gpu_shader5/linker/stream-different-zero-gs-fs.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader5/linker/stream-invalid-prim-output.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader5/linker/stream-negative-value.shader_test
 create mode 100644 tests/spec/arb_gpu_shader5/linker/tf-wrong-stream-value.c

-- 
2.0.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH v2 1/4] arb_gpu_shader5: add some compiler tests for stream qualifier

2014-06-27 Thread Samuel Iglesias Gonsalvez
Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
---

v2: Remove trailing whitespace

 tests/all.py   |   1 +
 tests/spec/arb_gpu_shader5/compiler/CMakeLists.txt |   3 +-
 .../compiler/stream-qualifier/CMakeLists.gl.txt|  12 ++
 .../compiler/stream-qualifier/CMakeLists.txt   |   1 +
 .../correct-multiple-layout-qualifier-stream.geom  |  40 +
 .../incorrect-in-layout-qualifier-stream.geom  |  19 ++
 ...ect-multiple-block-layout-qualifier-stream.geom |  32 
 ...incorrect-negative-layout-qualifier-stream.geom |  24 +++
 .../stream-qualifier/stream_value_too_large.c  | 193 +
 9 files changed, 324 insertions(+), 1 deletion(-)
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/CMakeLists.gl.txt
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/CMakeLists.txt
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/correct-multiple-layout-qualifier-stream.geom
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/incorrect-in-layout-qualifier-stream.geom
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/incorrect-multiple-block-layout-qualifier-stream.geom
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/incorrect-negative-layout-qualifier-stream.geom
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/stream_value_too_large.c

diff --git a/tests/all.py b/tests/all.py
index 17d5d9b..7734929 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1698,6 +1698,7 @@ add_concurrent_test(arb_gpu_shader5, 
'arb_gpu_shader5-minmax')
 add_concurrent_test(arb_gpu_shader5, 'arb_gpu_shader5-invocation-id')
 add_concurrent_test(arb_gpu_shader5, 
'arb_gpu_shader5-invocations_count_too_large')
 add_concurrent_test(arb_gpu_shader5, 'arb_gpu_shader5-xfb-streams')
+add_concurrent_test(arb_gpu_shader5, 'arb_gpu_shader5-stream_value_too_large')
 
 arb_texture_query_levels = {}
 spec['ARB_texture_query_levels'] = arb_texture_query_levels
diff --git a/tests/spec/arb_gpu_shader5/compiler/CMakeLists.txt 
b/tests/spec/arb_gpu_shader5/compiler/CMakeLists.txt
index 4a012b9..ec80122 100644
--- a/tests/spec/arb_gpu_shader5/compiler/CMakeLists.txt
+++ b/tests/spec/arb_gpu_shader5/compiler/CMakeLists.txt
@@ -1 +1,2 @@
-piglit_include_target_api()
\ No newline at end of file
+add_subdirectory (stream-qualifier)
+piglit_include_target_api()
diff --git 
a/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/CMakeLists.gl.txt 
b/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/CMakeLists.gl.txt
new file mode 100644
index 000..11b3110
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/CMakeLists.gl.txt
@@ -0,0 +1,12 @@
+include_directories(
+   ${GLEXT_INCLUDE_DIR}
+   ${OPENGL_INCLUDE_PATH}
+)
+
+link_libraries (
+   piglitutil_${piglit_target_api}
+   ${OPENGL_gl_LIBRARY}
+   ${OPENGL_glu_LIBRARY}
+)
+
+piglit_add_executable (arb_gpu_shader5-stream_value_too_large 
stream_value_too_large.c)
diff --git 
a/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/CMakeLists.txt 
b/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/CMakeLists.txt
new file mode 100644
index 000..144a306
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git 
a/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/correct-multiple-layout-qualifier-stream.geom
 
b/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/correct-multiple-layout-qualifier-stream.geom
new file mode 100644
index 000..46c0644
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/correct-multiple-layout-qualifier-stream.geom
@@ -0,0 +1,40 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// check_link: false
+// [end config]
+//
+// ARB_gpu_shader5 spec says:
+//   A default stream number may be declared at global
+//scope by qualifying interface qualifier out as in this example:
+//
+//  layout(stream = 1) out;
+//
+//The stream number specified in such a declaration replaces any previous
+//default and applies to all subsequent block and variable declarations
+//until a new default is established.  The initial default stream number is
+//zero.
+//
+// Tests for multiple declarations of layout qualifier 'stream'.
+//
+
+#version 150
+#extension GL_ARB_gpu_shader5 : enable
+
+layout(points) in;
+layout(points) out;
+
+out vec4 var1;
+layout(stream=1) out;
+out vec4 var2;
+layout(stream=2) out vec3 var3;
+
+layout(stream=3) out Block1 {
+   float var4;
+   layout(stream=3) vec4 var5;
+};
+
+void main()
+{
+}
diff --git 
a/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/incorrect-in-layout-qualifier-stream.geom
 
b/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/incorrect-in-layout-qualifier

[Piglit] [PATCH v2 3/4] arb_gpu_shader5: Add execution test to verify 'stream' layout qualifier

2014-06-27 Thread Samuel Iglesias Gonsalvez
Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
---
 tests/all.py   |   1 +
 .../arb_gpu_shader5/execution/CMakeLists.gl.txt|   1 +
 .../execution/xfb-streams-without-invocations.c| 248 +
 3 files changed, 250 insertions(+)
 create mode 100644 
tests/spec/arb_gpu_shader5/execution/xfb-streams-without-invocations.c

diff --git a/tests/all.py b/tests/all.py
index fac9488..8667fa4 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1701,6 +1701,7 @@ add_concurrent_test(arb_gpu_shader5, 
'arb_gpu_shader5-xfb-streams')
 add_concurrent_test(arb_gpu_shader5, 'arb_gpu_shader5-stream_value_too_large')
 add_concurrent_test(arb_gpu_shader5, 
'arb_gpu_shader5-emitstreamvertex_stream_too_large')
 add_concurrent_test(arb_gpu_shader5, 'arb_gpu_shader5-tf-wrong-stream-value')
+add_concurrent_test(arb_gpu_shader5, 
'arb_gpu_shader5-xfb-streams-without-invocations')
 
 arb_texture_query_levels = {}
 spec['ARB_texture_query_levels'] = arb_texture_query_levels
diff --git a/tests/spec/arb_gpu_shader5/execution/CMakeLists.gl.txt 
b/tests/spec/arb_gpu_shader5/execution/CMakeLists.gl.txt
index 18e9ad8..fcd271f 100644
--- a/tests/spec/arb_gpu_shader5/execution/CMakeLists.gl.txt
+++ b/tests/spec/arb_gpu_shader5/execution/CMakeLists.gl.txt
@@ -11,3 +11,4 @@ link_libraries (
 
 piglit_add_executable (arb_gpu_shader5-invocation-id invocation-id.c)
 piglit_add_executable (arb_gpu_shader5-xfb-streams xfb-streams.c)
+piglit_add_executable (arb_gpu_shader5-xfb-streams-without-invocations 
xfb-streams-without-invocations.c)
diff --git 
a/tests/spec/arb_gpu_shader5/execution/xfb-streams-without-invocations.c 
b/tests/spec/arb_gpu_shader5/execution/xfb-streams-without-invocations.c
new file mode 100644
index 000..aee8ded
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/execution/xfb-streams-without-invocations.c
@@ -0,0 +1,248 @@
+/*
+ * Copyright (c) 2014 Igalia S.L.
+ *
+ * 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.
+ */
+
+#include piglit-util-gl-common.h
+
+/**
+ * @file xfb-streams-without-invocations.c
+ *
+ * This test uses geometry shader multiple stream support from
+ * GL_ARB_gpu_shader5 and GL_ARB_transform_feedback3 to capture
+ * transform feedback from 3 streams into 2 buffers.
+ *
+ * Based on the work of Jordan's work in xfb-streams.c.
+ */
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 32;
+   config.supports_gl_core_version = 32;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static const char vs_pass_thru_text[] =
+   #version 150\n
+   void main() {\n
+ gl_Position = vec4(0.0);\n
+   }\n;
+
+static const char gs_text[] =
+   #version 150\n
+   #extension GL_ARB_gpu_shader5 : enable\n
+   layout(points) in;\n
+   layout(points, max_vertices = 3) out;\n
+   layout(stream = 0) out float stream0_0_out;\n
+   layout(stream = 1) out vec2 stream1_0_out;\n
+   layout(stream = 2) out float stream2_0_out;\n
+   layout(stream = 2) out vec4 stream2_1_out;\n
+   void main() {\n
+ gl_Position = gl_in[0].gl_Position;\n
+ stream0_0_out = 0.0;\n
+ EmitStreamVertex(0);\n
+ EndStreamPrimitive(0);\n
+
+ stream2_0_out = 0.0;\n
+ stream2_1_out = vec4(1.0, 2.0, 3.0, 4.0);\n
+ EmitStreamVertex(2);\n
+ EndStreamPrimitive(2);\n
+
+ stream1_0_out = vec2(0.0, 1.0);\n
+ EmitStreamVertex(1);\n
+ EndStreamPrimitive(1);\n
+   };
+
+int stream_float_counts[] = { 1, 2, 5, 0 };
+
+#define STREAMS 4
+
+static const char *varyings[] = {
+   stream0_0_out, gl_NextBuffer,
+   stream1_0_out, gl_NextBuffer,
+   stream2_0_out, stream2_1_out
+};
+
+static void
+build_and_use_program()
+{
+   GLuint prog;
+
+   prog = piglit_build_simple_program_multiple_shaders(
+   GL_VERTEX_SHADER, vs_pass_thru_text

[Piglit] [PATCH v2 2/4] arb_gpu_shader5: Add linker tests to verify 'stream' layout qualifier

2014-06-27 Thread Samuel Iglesias Gonsalvez
Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
---
 tests/all.py   |   2 +
 tests/spec/arb_gpu_shader5/CMakeLists.txt  |   3 +-
 .../spec/arb_gpu_shader5/linker/CMakeLists.gl.txt  |  13 ++
 tests/spec/arb_gpu_shader5/linker/CMakeLists.txt   |   1 +
 .../linker/emitstreamvertex_stream_too_large.c | 133 +
 .../linker/stream-different-zero-gs-fs.shader_test |  50 
 .../linker/stream-invalid-prim-output.shader_test  |  54 +
 .../linker/stream-negative-value.shader_test   |  38 ++
 .../arb_gpu_shader5/linker/tf-wrong-stream-value.c | 116 ++
 9 files changed, 409 insertions(+), 1 deletion(-)
 create mode 100644 tests/spec/arb_gpu_shader5/linker/CMakeLists.gl.txt
 create mode 100644 tests/spec/arb_gpu_shader5/linker/CMakeLists.txt
 create mode 100644 
tests/spec/arb_gpu_shader5/linker/emitstreamvertex_stream_too_large.c
 create mode 100644 
tests/spec/arb_gpu_shader5/linker/stream-different-zero-gs-fs.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader5/linker/stream-invalid-prim-output.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader5/linker/stream-negative-value.shader_test
 create mode 100644 tests/spec/arb_gpu_shader5/linker/tf-wrong-stream-value.c

diff --git a/tests/all.py b/tests/all.py
index 7734929..fac9488 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1699,6 +1699,8 @@ add_concurrent_test(arb_gpu_shader5, 
'arb_gpu_shader5-invocation-id')
 add_concurrent_test(arb_gpu_shader5, 
'arb_gpu_shader5-invocations_count_too_large')
 add_concurrent_test(arb_gpu_shader5, 'arb_gpu_shader5-xfb-streams')
 add_concurrent_test(arb_gpu_shader5, 'arb_gpu_shader5-stream_value_too_large')
+add_concurrent_test(arb_gpu_shader5, 
'arb_gpu_shader5-emitstreamvertex_stream_too_large')
+add_concurrent_test(arb_gpu_shader5, 'arb_gpu_shader5-tf-wrong-stream-value')
 
 arb_texture_query_levels = {}
 spec['ARB_texture_query_levels'] = arb_texture_query_levels
diff --git a/tests/spec/arb_gpu_shader5/CMakeLists.txt 
b/tests/spec/arb_gpu_shader5/CMakeLists.txt
index f41c000..60d83cb 100644
--- a/tests/spec/arb_gpu_shader5/CMakeLists.txt
+++ b/tests/spec/arb_gpu_shader5/CMakeLists.txt
@@ -1,3 +1,4 @@
 add_subdirectory (compiler)
 add_subdirectory (execution)
-piglit_include_target_api()
\ No newline at end of file
+add_subdirectory (linker)
+piglit_include_target_api()
diff --git a/tests/spec/arb_gpu_shader5/linker/CMakeLists.gl.txt 
b/tests/spec/arb_gpu_shader5/linker/CMakeLists.gl.txt
new file mode 100644
index 000..f955e83
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/linker/CMakeLists.gl.txt
@@ -0,0 +1,13 @@
+include_directories(
+   ${GLEXT_INCLUDE_DIR}
+   ${OPENGL_INCLUDE_PATH}
+)
+
+link_libraries (
+   piglitutil_${piglit_target_api}
+   ${OPENGL_gl_LIBRARY}
+   ${OPENGL_glu_LIBRARY}
+)
+
+piglit_add_executable (arb_gpu_shader5-emitstreamvertex_stream_too_large 
emitstreamvertex_stream_too_large.c)
+piglit_add_executable (arb_gpu_shader5-tf-wrong-stream-value 
tf-wrong-stream-value.c)
diff --git a/tests/spec/arb_gpu_shader5/linker/CMakeLists.txt 
b/tests/spec/arb_gpu_shader5/linker/CMakeLists.txt
new file mode 100644
index 000..144a306
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/linker/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git 
a/tests/spec/arb_gpu_shader5/linker/emitstreamvertex_stream_too_large.c 
b/tests/spec/arb_gpu_shader5/linker/emitstreamvertex_stream_too_large.c
new file mode 100644
index 000..a478055
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/linker/emitstreamvertex_stream_too_large.c
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2014 Igalia S.L.
+ *
+ * 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 emitstreamvertex_stream_too_large.c
+ *
+ * Test that exceeding the implementation's maximum streams
+ * value (GL_MAX_VERTEX_STREAMS) when calling

[Piglit] [PATCH v2 4/4] arb_gpu_shader5: Add new test emitstreamvertex_nodraw

2014-06-27 Thread Samuel Iglesias Gonsalvez
It checks that a vertex emitted in stream !=0 is not
processed by the fragment shader.

Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
---
 tests/all.py   |   1 +
 .../arb_gpu_shader5/execution/CMakeLists.gl.txt|   1 +
 .../execution/emitstreamvertex_nodraw.c| 170 +
 3 files changed, 172 insertions(+)
 create mode 100644 
tests/spec/arb_gpu_shader5/execution/emitstreamvertex_nodraw.c

diff --git a/tests/all.py b/tests/all.py
index 8667fa4..4b0caf0 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1702,6 +1702,7 @@ add_concurrent_test(arb_gpu_shader5, 
'arb_gpu_shader5-stream_value_too_large')
 add_concurrent_test(arb_gpu_shader5, 
'arb_gpu_shader5-emitstreamvertex_stream_too_large')
 add_concurrent_test(arb_gpu_shader5, 'arb_gpu_shader5-tf-wrong-stream-value')
 add_concurrent_test(arb_gpu_shader5, 
'arb_gpu_shader5-xfb-streams-without-invocations')
+add_concurrent_test(arb_gpu_shader5, 'arb_gpu_shader5-emitstreamvertex_nodraw')
 
 arb_texture_query_levels = {}
 spec['ARB_texture_query_levels'] = arb_texture_query_levels
diff --git a/tests/spec/arb_gpu_shader5/execution/CMakeLists.gl.txt 
b/tests/spec/arb_gpu_shader5/execution/CMakeLists.gl.txt
index fcd271f..0b743d9 100644
--- a/tests/spec/arb_gpu_shader5/execution/CMakeLists.gl.txt
+++ b/tests/spec/arb_gpu_shader5/execution/CMakeLists.gl.txt
@@ -12,3 +12,4 @@ link_libraries (
 piglit_add_executable (arb_gpu_shader5-invocation-id invocation-id.c)
 piglit_add_executable (arb_gpu_shader5-xfb-streams xfb-streams.c)
 piglit_add_executable (arb_gpu_shader5-xfb-streams-without-invocations 
xfb-streams-without-invocations.c)
+piglit_add_executable (arb_gpu_shader5-emitstreamvertex_nodraw 
emitstreamvertex_nodraw.c)
diff --git a/tests/spec/arb_gpu_shader5/execution/emitstreamvertex_nodraw.c 
b/tests/spec/arb_gpu_shader5/execution/emitstreamvertex_nodraw.c
new file mode 100644
index 000..777cdc3
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/execution/emitstreamvertex_nodraw.c
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2014 Igalia S.L.
+ *
+ * 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 emitstreamvertex_no_draw.c
+ *
+ * Test that a vertex emitted in stream 1 is not processed by fragment
+ * shader.
+ */
+
+#include piglit-util-gl-common.h
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 32;
+   config.supports_gl_core_version = 32;
+   config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB;
+   config.window_width = 100;
+   config.window_height = 100;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+GLuint vertexbuffer;
+GLint program;
+
+static const GLfloat g_vertex_buffer_data[] = {
+   -0.5f, -0.5f, 0.0f,
+   0.5f, -0.5f, 0.0f,
+   0.0f,  0.50f, 0.0f,
+};
+
+enum piglit_result
+piglit_display(void)
+{
+   int pass;
+   float c[3] = {1.0, 0.0 , 0.0};
+   float c_clear[3] = {0.0, 0.0 , 0.0};
+
+   glUseProgram(program);
+
+   /*
+* Workaround: if define glPointSize == 1, piglit_probe_pixel_rgb()
+* will fail unless the window is resized.
+*/
+   glPointSize(2);
+
+   glViewport(0, 0, piglit_width, piglit_height);
+   /* Clear the back buffer to black */
+   glClearColor(0, 0, 0, 0);
+   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+   glEnableVertexAttribArray(0);
+   glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
+   glVertexAttribPointer(
+   0,
+   3,
+   GL_FLOAT,
+   GL_FALSE,
+   0,
+   (void*)0);
+
+   glDrawArrays(GL_POINTS, 0, 3);
+   glDisableVertexAttribArray(0);
+
+   /* Probe that the point in stream=1 is not drawn. */
+   pass = piglit_probe_pixel_rgb(piglit_width/2, piglit_height/2, c_clear

[Piglit] [PATCH 2/3] arb_gpu_shader5: Add linker tests to verify 'stream' layout qualifier

2014-06-20 Thread Samuel Iglesias Gonsalvez
Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
---
 tests/all.py   |   2 +
 tests/spec/arb_gpu_shader5/CMakeLists.txt  |   3 +-
 .../spec/arb_gpu_shader5/linker/CMakeLists.gl.txt  |  13 ++
 tests/spec/arb_gpu_shader5/linker/CMakeLists.txt   |   1 +
 .../linker/emitstreamvertex_stream_too_large.c | 133 +
 .../linker/stream-different-zero-gs-fs.shader_test |  50 
 .../linker/stream-invalid-prim-output.shader_test  |  54 +
 .../linker/stream-negative-value.shader_test   |  38 ++
 .../arb_gpu_shader5/linker/tf-wrong-stream-value.c | 116 ++
 9 files changed, 409 insertions(+), 1 deletion(-)
 create mode 100644 tests/spec/arb_gpu_shader5/linker/CMakeLists.gl.txt
 create mode 100644 tests/spec/arb_gpu_shader5/linker/CMakeLists.txt
 create mode 100644 
tests/spec/arb_gpu_shader5/linker/emitstreamvertex_stream_too_large.c
 create mode 100644 
tests/spec/arb_gpu_shader5/linker/stream-different-zero-gs-fs.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader5/linker/stream-invalid-prim-output.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader5/linker/stream-negative-value.shader_test
 create mode 100644 tests/spec/arb_gpu_shader5/linker/tf-wrong-stream-value.c

diff --git a/tests/all.py b/tests/all.py
index 30e0e83..a40998b 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1693,6 +1693,8 @@ add_concurrent_test(arb_gpu_shader5, 
'arb_gpu_shader5-invocation-id')
 add_concurrent_test(arb_gpu_shader5, 
'arb_gpu_shader5-invocations_count_too_large')
 add_concurrent_test(arb_gpu_shader5, 'arb_gpu_shader5-xfb-streams')
 add_concurrent_test(arb_gpu_shader5, 'arb_gpu_shader5-stream_value_too_large')
+add_concurrent_test(arb_gpu_shader5, 
'arb_gpu_shader5-emitstreamvertex_stream_too_large')
+add_concurrent_test(arb_gpu_shader5, 'arb_gpu_shader5-tf-wrong-stream-value')
 
 arb_texture_query_levels = {}
 spec['ARB_texture_query_levels'] = arb_texture_query_levels
diff --git a/tests/spec/arb_gpu_shader5/CMakeLists.txt 
b/tests/spec/arb_gpu_shader5/CMakeLists.txt
index f41c000..60d83cb 100644
--- a/tests/spec/arb_gpu_shader5/CMakeLists.txt
+++ b/tests/spec/arb_gpu_shader5/CMakeLists.txt
@@ -1,3 +1,4 @@
 add_subdirectory (compiler)
 add_subdirectory (execution)
-piglit_include_target_api()
\ No newline at end of file
+add_subdirectory (linker)
+piglit_include_target_api()
diff --git a/tests/spec/arb_gpu_shader5/linker/CMakeLists.gl.txt 
b/tests/spec/arb_gpu_shader5/linker/CMakeLists.gl.txt
new file mode 100644
index 000..f955e83
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/linker/CMakeLists.gl.txt
@@ -0,0 +1,13 @@
+include_directories(
+   ${GLEXT_INCLUDE_DIR}
+   ${OPENGL_INCLUDE_PATH}
+)
+
+link_libraries (
+   piglitutil_${piglit_target_api}
+   ${OPENGL_gl_LIBRARY}
+   ${OPENGL_glu_LIBRARY}
+)
+
+piglit_add_executable (arb_gpu_shader5-emitstreamvertex_stream_too_large 
emitstreamvertex_stream_too_large.c)
+piglit_add_executable (arb_gpu_shader5-tf-wrong-stream-value 
tf-wrong-stream-value.c)
diff --git a/tests/spec/arb_gpu_shader5/linker/CMakeLists.txt 
b/tests/spec/arb_gpu_shader5/linker/CMakeLists.txt
new file mode 100644
index 000..144a306
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/linker/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git 
a/tests/spec/arb_gpu_shader5/linker/emitstreamvertex_stream_too_large.c 
b/tests/spec/arb_gpu_shader5/linker/emitstreamvertex_stream_too_large.c
new file mode 100644
index 000..a478055
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/linker/emitstreamvertex_stream_too_large.c
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2014 Igalia S.L.
+ *
+ * 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 emitstreamvertex_stream_too_large.c
+ *
+ * Test that exceeding the implementation's maximum streams
+ * value (GL_MAX_VERTEX_STREAMS) when calling

[Piglit] [PATCH 1/3] arb_gpu_shader5: add some compiler tests for stream qualifier

2014-06-20 Thread Samuel Iglesias Gonsalvez
Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
---
 tests/all.py   |   1 +
 tests/spec/arb_gpu_shader5/compiler/CMakeLists.txt |   3 +-
 .../compiler/stream-qualifier/CMakeLists.gl.txt|  12 ++
 .../compiler/stream-qualifier/CMakeLists.txt   |   1 +
 .../correct-multiple-layout-qualifier-stream.geom  |  40 +
 .../incorrect-in-layout-qualifier-stream.geom  |  19 ++
 ...ect-multiple-block-layout-qualifier-stream.geom |  32 
 ...incorrect-negative-layout-qualifier-stream.geom |  24 +++
 .../stream-qualifier/stream_value_too_large.c  | 193 +
 9 files changed, 324 insertions(+), 1 deletion(-)
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/CMakeLists.gl.txt
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/CMakeLists.txt
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/correct-multiple-layout-qualifier-stream.geom
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/incorrect-in-layout-qualifier-stream.geom
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/incorrect-multiple-block-layout-qualifier-stream.geom
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/incorrect-negative-layout-qualifier-stream.geom
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/stream_value_too_large.c

diff --git a/tests/all.py b/tests/all.py
index 9dd5379..30e0e83 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1692,6 +1692,7 @@ add_concurrent_test(arb_gpu_shader5, 
'arb_gpu_shader5-minmax')
 add_concurrent_test(arb_gpu_shader5, 'arb_gpu_shader5-invocation-id')
 add_concurrent_test(arb_gpu_shader5, 
'arb_gpu_shader5-invocations_count_too_large')
 add_concurrent_test(arb_gpu_shader5, 'arb_gpu_shader5-xfb-streams')
+add_concurrent_test(arb_gpu_shader5, 'arb_gpu_shader5-stream_value_too_large')
 
 arb_texture_query_levels = {}
 spec['ARB_texture_query_levels'] = arb_texture_query_levels
diff --git a/tests/spec/arb_gpu_shader5/compiler/CMakeLists.txt 
b/tests/spec/arb_gpu_shader5/compiler/CMakeLists.txt
index 4a012b9..ec80122 100644
--- a/tests/spec/arb_gpu_shader5/compiler/CMakeLists.txt
+++ b/tests/spec/arb_gpu_shader5/compiler/CMakeLists.txt
@@ -1 +1,2 @@
-piglit_include_target_api()
\ No newline at end of file
+add_subdirectory (stream-qualifier)
+piglit_include_target_api()
diff --git 
a/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/CMakeLists.gl.txt 
b/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/CMakeLists.gl.txt
new file mode 100644
index 000..11b3110
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/CMakeLists.gl.txt
@@ -0,0 +1,12 @@
+include_directories(
+   ${GLEXT_INCLUDE_DIR}
+   ${OPENGL_INCLUDE_PATH}
+)
+
+link_libraries (
+   piglitutil_${piglit_target_api}
+   ${OPENGL_gl_LIBRARY}
+   ${OPENGL_glu_LIBRARY}
+)
+
+piglit_add_executable (arb_gpu_shader5-stream_value_too_large 
stream_value_too_large.c)
diff --git 
a/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/CMakeLists.txt 
b/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/CMakeLists.txt
new file mode 100644
index 000..144a306
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git 
a/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/correct-multiple-layout-qualifier-stream.geom
 
b/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/correct-multiple-layout-qualifier-stream.geom
new file mode 100644
index 000..46c0644
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/correct-multiple-layout-qualifier-stream.geom
@@ -0,0 +1,40 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// check_link: false
+// [end config]
+//
+// ARB_gpu_shader5 spec says:
+//   A default stream number may be declared at global
+//scope by qualifying interface qualifier out as in this example:
+//
+//  layout(stream = 1) out;
+//
+//The stream number specified in such a declaration replaces any previous
+//default and applies to all subsequent block and variable declarations
+//until a new default is established.  The initial default stream number is
+//zero.
+//
+// Tests for multiple declarations of layout qualifier 'stream'.
+//
+
+#version 150
+#extension GL_ARB_gpu_shader5 : enable
+
+layout(points) in;
+layout(points) out;
+
+out vec4 var1;
+layout(stream=1) out;
+out vec4 var2;
+layout(stream=2) out vec3 var3;
+
+layout(stream=3) out Block1 {
+   float var4;
+   layout(stream=3) vec4 var5;
+};
+
+void main()
+{
+}
diff --git 
a/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/incorrect-in-layout-qualifier-stream.geom
 
b/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/incorrect-in-layout-qualifier-stream.geom
new file mode 100644
index