[Piglit] [PATCH] general: better test display lists in attribute test

2018-06-23 Thread Timothy Arceri
We weren't really testing that the displays list worked since
the calls could have just been executed immediately.
---
 tests/general/attribs.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/tests/general/attribs.c b/tests/general/attribs.c
index 05a0d4a1e..ddb0b060a 100644
--- a/tests/general/attribs.c
+++ b/tests/general/attribs.c
@@ -107,6 +107,18 @@ static void draw_quad(unsigned mode, float *v,
}
glEnd();
glEndList();
+
+   /* Clear to make sure the calls didn't get executed
+* immediately.
+*/
+   glBegin(GL_QUADS);
+   for (i = 0; i < 4; i++) {
+   attrib(0.1, 0.1, 0.1, 0.1);
+   glVertex2fv([i*2]);
+   }
+   glEnd();
+
+   /* Now call the display list */
glCallList(1);
break;
default:
-- 
2.17.1

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


Re: [Piglit] [PATCH 03/24] framework: add --glsl option

2018-06-23 Thread Alejandro Piñeiro
On 22/06/18 19:14, Dylan Baker wrote:
> Quoting Alejandro Piñeiro (2018-06-20 05:40:38)
>> So when executing shader tests, they will be executed with -glsl. This
>> is the force GLSL mode, that is only relevant if the shader test
>> includes SPIR-V shaders.
> I'm not sure I understand what you're doing. It looks like you're planning to
> build tests that can be run in either SPIRV or GLSL mode, that they can be
> forced into GLSL mode using a switch, or use SPIRV mode if available. Is that
> correct?

Yes. Perhaps the commit message is not really clear, as all the details
are included on the previous commit "shader_runner/spirv: support
loading SPIR-V shaders". On that commit we explain that we add a -glsl
option to shader_runner, that is mostly a debugging option. What this
commits adds is adding the -glsl option when running the tests in a
batch. With this series, the -glsl option would only make sense with the
ARB_gl_spirv tests we are adding.

Do you think that I should update the commit message to be more clear?

BR



signature.asc
Description: OpenPGP digital signature
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH v4] unsized_array_member: It should expect link success instead of link error

2018-06-23 Thread Eleni Maria Stea
Modified the unsized_array_member.shader_test to expect successful
linking instead of linker error.

Section 4.2 (Scoping) of the OpenGL Shading Language Specification says:
"An array implicitly sized in one shader can be explicitly sized by
another shader in the same stage. If no shader in a stage has an explicit
size for the array, the largest implicit size (one more than the largest
index used) in that stage is used. There is no cross-stage array sizing.
If there is no static access to an implicitly sized array within the stage
declaring it, then the array is given a size of 1, which is relevant when
the array is declared within an interface block that is shared with other
stages or the application (other unused arrays might be eliminated by the
optimizer)."

This means that the unused array s of the following shader block in the
unsized_array_member.shader_test:
buffer a {
vec4 s[];
vec4 a[];
} b;
should be an array of size 1 and not an unsized array, and so no linker
error should be generated.

Ref: https://bugs.freedesktop.org/show_bug.cgi?id=106915

v2:
  - replaces the comment at the top with the relevant part of the spec
v3:
  - fixes in the quoted part of the spec (Ian Romanick)
v4:
  - updates the commit message accordingly (Dylan Baker)
---
 .../linker/unsized_array_member.shader_test   | 20 ++-
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git 
a/tests/spec/arb_shader_storage_buffer_object/linker/unsized_array_member.shader_test
 
b/tests/spec/arb_shader_storage_buffer_object/linker/unsized_array_member.shader_test
index 47d0483ac..946bf1cb2 100644
--- 
a/tests/spec/arb_shader_storage_buffer_object/linker/unsized_array_member.shader_test
+++ 
b/tests/spec/arb_shader_storage_buffer_object/linker/unsized_array_member.shader_test
@@ -1,12 +1,14 @@
-# From ARB_program_interface_query spec:
+# Section 4.2 (Scoping) of the OpenGL Shading Language Specification says:
 #
-#"For the property of BUFFER_DATA_SIZE, then the implementation-dependent
-#minimum total buffer object size, in basic machine units, required to
-#hold all active variables associated with an active uniform block, shader
-#storage block, or atomic counter buffer is written to .  If the
-#final member of an active shader storage block is array with no declared
-#size, the minimum buffer size is computed assuming the array was declared
-#as an array with one element."
+#"An array implicitly sized in one shader can be explicitly sized by
+#another shader in the same stage. If no shader in a stage has an
+#explicit size for the array, the largest implicit size (one more than
+#the largest index used) in that stage is used. There is no cross-stage
+#array sizing. If there is no static access to an implicitly sized array
+#within the stage declaring it, then the array is given a size of 1,
+#which is relevant when the array is declared within an interface block
+#that is shared with other stages or the application (other unused arrays
+#might be eliminated by the optimizer)."
 
 [require]
 GLSL >= 1.50
@@ -31,4 +33,4 @@ void main(void) {
 }
 
 [test]
-link error
+link success
-- 
2.17.1

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


[Piglit] [PATCH] arb_draw_indirect: test when 0 bound to DRAW_INDIRECT_BUFFER in compat

2018-06-23 Thread Timothy Arceri
From the ARB_draw_indirect spec:

"Initially zero is bound to DRAW_INDIRECT_BUFFER. In the
compatibility profile, this indicates that DrawArraysIndirect and
DrawElementsIndirect are to source their arguments directly from the
pointer passed as their  parameters."
---
 tests/opengl.py   |   2 +
 .../spec/arb_draw_indirect/CMakeLists.gl.txt  |   2 +
 .../arb_draw_indirect/draw-arrays-compat.c| 120 
 .../arb_draw_indirect/draw-elements-compat.c  | 130 ++
 4 files changed, 254 insertions(+)
 create mode 100644 tests/spec/arb_draw_indirect/draw-arrays-compat.c
 create mode 100644 tests/spec/arb_draw_indirect/draw-elements-compat.c

diff --git a/tests/opengl.py b/tests/opengl.py
index 669d9055b..2460b0a88 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -1728,8 +1728,10 @@ with profile.test_list.group_manager(
 grouptools.join('spec', 'ARB_draw_indirect')) as g:
 g(['arb_draw_indirect-api-errors'])
 g(['arb_draw_indirect-draw-arrays'])
+g(['arb_draw_indirect-draw-arrays-compat'])
 g(['arb_draw_indirect-draw-arrays-prim-restart'])
 g(['arb_draw_indirect-draw-elements'])
+g(['arb_draw_indirect-draw-elements-compat'])
 g(['arb_draw_indirect-draw-arrays-base-instance'])
 g(['arb_draw_indirect-draw-elements-base-instance'])
 g(['arb_draw_indirect-draw-elements-prim-restart'])
diff --git a/tests/spec/arb_draw_indirect/CMakeLists.gl.txt 
b/tests/spec/arb_draw_indirect/CMakeLists.gl.txt
index 977911140..6e038d403 100644
--- a/tests/spec/arb_draw_indirect/CMakeLists.gl.txt
+++ b/tests/spec/arb_draw_indirect/CMakeLists.gl.txt
@@ -10,8 +10,10 @@ link_libraries (
 
 piglit_add_executable (arb_draw_indirect-api-errors api-errors.c)
 piglit_add_executable (arb_draw_indirect-draw-arrays draw-arrays.c)
+piglit_add_executable (arb_draw_indirect-draw-arrays-compat 
draw-arrays-compat.c)
 piglit_add_executable (arb_draw_indirect-draw-arrays-prim-restart 
draw-arrays-prim-restart.c)
 piglit_add_executable (arb_draw_indirect-draw-elements draw-elements.c)
+piglit_add_executable (arb_draw_indirect-draw-elements-compat 
draw-elements-compat.c)
 piglit_add_executable (arb_draw_indirect-draw-arrays-base-instance 
draw-arrays-base-instance.c)
 piglit_add_executable (arb_draw_indirect-draw-elements-base-instance 
draw-elements-base-instance.c)
 piglit_add_executable (arb_draw_indirect-draw-elements-prim-restart 
draw-elements-prim-restart.c)
diff --git a/tests/spec/arb_draw_indirect/draw-arrays-compat.c 
b/tests/spec/arb_draw_indirect/draw-arrays-compat.c
new file mode 100644
index 0..fd906fe2f
--- /dev/null
+++ b/tests/spec/arb_draw_indirect/draw-arrays-compat.c
@@ -0,0 +1,120 @@
+/*
+ * Copyright © 2013 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.
+ *
+ */
+
+/* Basic test of glDrawArraysIndirect for compat profile. Test that indirect
+ * data can be passed directly when GL_DRAW_INDIRECT_BUFFER is 0 (the default
+ * value).
+ *
+ * This test is adapted from draw-arrays.c
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 31;
+
+   config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB;
+   config.khr_no_error_support = PIGLIT_NO_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+GLuint vao;
+GLint prog;
+
+float red[] = {1,0,0};
+float blue[] = {0,0,1};
+
+float vertices_data[] = {
+   -1, -1,
+1, -1,
+   -1,  1,
+};
+
+GLuint indirect_data[] = {
+   3,  /* count */
+   1,  /* primcount */
+   0,  /* first vertex */
+   0,  /* mbz */
+};
+
+enum piglit_result
+piglit_display(void)
+{
+   bool pass = true;
+
+   glViewport(0, 0, 128, 128);
+
+   glClearColor(0,0,1,1);
+   glClear(GL_COLOR_BUFFER_BIT);
+
+   glBindVertexArray(vao);
+