[Piglit] [PATCH] arb_tessellation_shader: fix broken compat gl_ClipVertex test

2019-08-01 Thread Timothy Arceri
The expected projection wasn't being applied.
---
 .../tes-clip-vertex-different-from-position.shader_test  | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git 
a/tests/spec/arb_tessellation_shader/execution/compatibility/tes-clip-vertex-different-from-position.shader_test
 
b/tests/spec/arb_tessellation_shader/execution/compatibility/tes-clip-vertex-different-from-position.shader_test
index b96ac10e4..4a0483c35 100644
--- 
a/tests/spec/arb_tessellation_shader/execution/compatibility/tes-clip-vertex-different-from-position.shader_test
+++ 
b/tests/spec/arb_tessellation_shader/execution/compatibility/tes-clip-vertex-different-from-position.shader_test
@@ -27,12 +27,12 @@ void main(void)
 layout(quads) in;
 
 void main() {
-   gl_Position = vec4(gl_TessCoord.xy * 2 - 1, 0, 1);;
+   gl_Position = gl_ModelViewProjectionMatrix * vec4(gl_TessCoord.xy * 2 - 
1, 0, 1);
 
// Transform gl_ClipVertex in an arbitrary way so that
// we can verify it is being used for clipping instead of
// gl_Position.
-   gl_ClipVertex = gl_Position * vec4(10.0, 10.0, 1.0, 1.0);
+   gl_ClipVertex = vec4(gl_TessCoord.xy * 2 - 1, 0, 1) * vec4(10.0, 10.0, 
1.0, 1.0);
 }
 
 [fragment shader]
@@ -70,7 +70,6 @@ enable GL_CLIP_PLANE5
 
 patch parameter vertices 1
 draw arrays GL_PATCHES 0 1
-#draw rect 0.1 0.1 0.8 0.8
 
 # Test points inside each hexagon edge
 relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0)
-- 
2.21.0

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

[Piglit] [PATCH] arb_get_program_binary: test restore of SSO program

2019-07-10 Thread Timothy Arceri
This tests that a restored SSO doesn't fail validation once
restored. This was happening in Mesa because we weren't storing
the state of the program parameter PROGRAM_SEPARABLE.
---
 tests/opengl.py   |  2 +
 .../arb_get_program_binary/CMakeLists.gl.txt  |  2 +
 .../spec/arb_get_program_binary/gpb-common.c  | 39 
 .../spec/arb_get_program_binary/gpb-common.h  |  3 +
 .../restore-sso-program.c | 94 +++
 5 files changed, 140 insertions(+)
 create mode 100644 tests/spec/arb_get_program_binary/restore-sso-program.c

diff --git a/tests/opengl.py b/tests/opengl.py
index 6dd27e9d4..adf5a5312 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -1715,6 +1715,8 @@ with profile.test_list.group_manager(
   'xfb-varyings')
 g(['arb_get_program_binary-restore-implicit-use-program'],
   'restore-implicit-use-program')
+g(['arb_get_program_binary-restore-sso-program'],
+  'restore-sso-program')
 g(['arb_get_program_binary-reset-uniform'],
   'reset-uniform')
 
diff --git a/tests/spec/arb_get_program_binary/CMakeLists.gl.txt 
b/tests/spec/arb_get_program_binary/CMakeLists.gl.txt
index ea43ba9ae..3ef48dbe0 100644
--- a/tests/spec/arb_get_program_binary/CMakeLists.gl.txt
+++ b/tests/spec/arb_get_program_binary/CMakeLists.gl.txt
@@ -14,6 +14,8 @@ piglit_add_executable 
(arb_get_program_binary-retrievable_hint retrievable_hint.
 piglit_add_executable (arb_get_program_binary-reset-uniform reset-uniform.c 
gpb-common.c)
 piglit_add_executable (arb_get_program_binary-restore-implicit-use-program
restore-implicit-use-program.c gpb-common.c)
+piglit_add_executable (arb_get_program_binary-restore-sso-program
+   restore-sso-program.c gpb-common.c)
 piglit_add_executable (arb_get_program_binary-xfb-varyings xfb-varyings.c 
gpb-common.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_get_program_binary/gpb-common.c 
b/tests/spec/arb_get_program_binary/gpb-common.c
index 425b93673..438e4992d 100644
--- a/tests/spec/arb_get_program_binary/gpb-common.c
+++ b/tests/spec/arb_get_program_binary/gpb-common.c
@@ -127,3 +127,42 @@ gpb_save_restore(GLuint *prog)
 
return true;
 }
+
+bool
+gpb_save_restore_sso(GLuint *prog, GLuint pipeline, GLbitfield stage)
+{
+   GLsizei bin_length;
+   void *binary;
+   GLenum bin_format;
+   GLuint new_prog;
+
+   if (!gpb_save_program(*prog, , _length, _format)) {
+   fprintf(stderr,
+   "failed to save program with GetProgramBinary\n");
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   new_prog = glCreateProgram();
+   if (!piglit_check_gl_error(GL_NO_ERROR)) {
+   free(binary);
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   if (!gpb_restore_program(new_prog, binary, bin_length, bin_format)) {
+   free(binary);
+   fprintf(stderr, "failed to restore binary program\n");
+   piglit_report_result(PIGLIT_FAIL);
+   }
+   free(binary);
+
+   glUseProgramStages(pipeline, stage, new_prog);
+   if (!piglit_check_gl_error(GL_NO_ERROR))
+   piglit_report_result(PIGLIT_FAIL);
+
+   glDeleteProgram(*prog);
+   if (!piglit_check_gl_error(GL_NO_ERROR))
+   piglit_report_result(PIGLIT_FAIL);
+   *prog = new_prog;
+
+   return true;
+}
diff --git a/tests/spec/arb_get_program_binary/gpb-common.h 
b/tests/spec/arb_get_program_binary/gpb-common.h
index f471241aa..ae10f9e3a 100644
--- a/tests/spec/arb_get_program_binary/gpb-common.h
+++ b/tests/spec/arb_get_program_binary/gpb-common.h
@@ -34,4 +34,7 @@ gpb_restore_program(GLuint prog, void *binary, GLsizei 
length, GLenum format);
 bool
 gpb_save_restore(GLuint *prog);
 
+bool
+gpb_save_restore_sso(GLuint *prog, GLuint pipeline, GLbitfield stage);
+
 #endif
diff --git a/tests/spec/arb_get_program_binary/restore-sso-program.c 
b/tests/spec/arb_get_program_binary/restore-sso-program.c
new file mode 100644
index 0..23d9998c1
--- /dev/null
+++ b/tests/spec/arb_get_program_binary/restore-sso-program.c
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2019 Timothy Arceri
+ *
+ * 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, INC

Re: [Piglit] [PATCH] s3tc-errors: Fix GCC unused-function warning.

2019-05-06 Thread Timothy Arceri

Reviewed-by: Timothy Arceri 

On 7/5/19 3:02 am, Vinson Lee wrote:

s3tc-errors.c:155:1: warning: ‘check_gl_error2_’ defined but not used 
[-Wunused-function]
  check_gl_error2_(GLenum err1, GLenum err2, int line)
  ^~~~

Fixes: Fixes: d433792407e7 ("s3tc-errors: port to gles31")
Signed-off-by: Vinson Lee 
---
  tests/texturing/s3tc-errors.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/tests/texturing/s3tc-errors.c b/tests/texturing/s3tc-errors.c
index 6b2658c9a1d1..a356ea2149ce 100644
--- a/tests/texturing/s3tc-errors.c
+++ b/tests/texturing/s3tc-errors.c
@@ -147,6 +147,7 @@ check_rendering_(int width, int height, int line)
  #define check_rendering(w, h) check_rendering_(w, h, __LINE__)
  
  
+#ifdef PIGLIT_USE_OPENGL

  /**
   * Check for either of two expected GL errors.
   * XXX this could be a piglit util function
@@ -164,6 +165,7 @@ check_gl_error2_(GLenum err1, GLenum err2, int line)
  }
  
  #define check_gl_error2(err1, err2)  check_gl_error2_(err1, err2, __LINE__)

+#endif
  
  
  static bool



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

[Piglit] [PATCH] glx: make sure contexts are destroyed before we exit the test

2019-04-12 Thread Timothy Arceri
Without this the last two contexts that are created will not
have been destroyed when exiting the test. This creates a race
condition in Mesa between any threads that might be using
glsl_types and the atexit() callback that destroys these types.
---
 tests/glx/glx-multithread-shader-compile.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/glx/glx-multithread-shader-compile.c 
b/tests/glx/glx-multithread-shader-compile.c
index f24e1761f..1e428da22 100644
--- a/tests/glx/glx-multithread-shader-compile.c
+++ b/tests/glx/glx-multithread-shader-compile.c
@@ -87,6 +87,7 @@ thread_func(void *arg)
glUseProgram(program);
piglit_check_gl_error(GL_NO_ERROR);
 
+   glXMakeCurrent(dpy, None, None);
glXDestroyContext(dpy, ctx);
}
 
-- 
2.20.1

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

Re: [Piglit] [PATCH] arb_program_interface_query: corrected AoA's index variable expectation

2019-03-21 Thread Timothy Arceri

On 22/3/19 1:48 am, Andres Gomez wrote:

On Sat, 2019-02-16 at 10:05 +1100, Timothy Arceri wrote:

NAK.

The problem is this will end up making the test fail on the Nvidia blob.
Technically neither is incorrect, but the test does show Mesa's failure
to detect the unused element. Again this is not technically a failure of
the spec as it's dependent on the implementations ability to detect
active array elements. However I'd rather leave this than work around
our substandard detection of inactive elements.


I wonder if it's really worthy, then, to test something that is
implementation dependent.


See [1] for more information, and note I also rejected the Mesa solution
proposed by Andrii in the bug report because it was too much code for
something that didn't actually remove the unused components but just hid
them from the resource list.

I think if we actually want to fix this properly then we could do it by
making a NIR linker for GLSL.

[1] https://bugs.freedesktop.org/show_bug.cgi?id=92822


OK. Thanks for the thorough explanation! I'll drop this patch.


I also don't think we need a full NIR linker to pass this test. Just 
switching to the new nir_build_program_resource_list() once further 
support for ARB_gl_spirv lands (and we add any missing GL support) 
should do the trick.






On 9/2/19 3:59 am, Andres Gomez wrote:

Naming conventions, from the GL_ARB_program_interface_query extension:

   "   * For an active variable declared as an array of an aggregate
 data type (structures or arrays), a separate entry will be
 generated for each active array element, unless noted
 immediately below.  The name of each entry is formed by
 concatenating the name of the array, the "[" character, an
 integer identifying the element number, and the "]" character.
 These enumeration rules are applied recursively, treating each
 enumerated array element as a separate active variable."

Cc: Timothy Arceri 
Cc: Martin Peres 
Signed-off-by: Andres Gomez 
---
   .../spec/arb_program_interface_query/getprogramresourceindex.c  | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/spec/arb_program_interface_query/getprogramresourceindex.c 
b/tests/spec/arb_program_interface_query/getprogramresourceindex.c
index 16b38e2d5..2afc9eeb9 100755
--- a/tests/spec/arb_program_interface_query/getprogramresourceindex.c
+++ b/tests/spec/arb_program_interface_query/getprogramresourceindex.c
@@ -167,7 +167,7 @@ static const struct subtest_index_t index_subtests[] = {
{   vs_aofa,  GL_PROGRAM_INPUT,  "vs_input2", 
false, -1, GL_NO_ERROR },
{   vs_aofa,  GL_PROGRAM_INPUT,   "vs_input2[0]",  
true, -1, GL_NO_ERROR },
{   vs_aofa,  GL_PROGRAM_INPUT,"vs_input2[0][0]",  
true, -1, GL_NO_ERROR },
-   {   vs_aofa,  GL_PROGRAM_INPUT,"vs_input2[1][0]", 
false, -1, GL_NO_ERROR },
+   {   vs_aofa,  GL_PROGRAM_INPUT,"vs_input2[1][0]",  
true, -1, GL_NO_ERROR },
{   vs_aofa,  GL_PROGRAM_INPUT,"vs_input2[0][1]", 
false, -1, GL_NO_ERROR },
{vs_sub,  GL_VERTEX_SUBROUTINE,"vss",  
true, -1, GL_NO_ERROR },
{vs_sub,  GL_VERTEX_SUBROUTINE,   "vss2",  
true, -1, GL_NO_ERROR },


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

[Piglit] [PATCH] glsl-1.10: test unreachable code in a loop is not accessed

2019-03-20 Thread Timothy Arceri
---
 .../vs-loop-with-dead-code-unroll.shader_test | 43 +++
 1 file changed, 43 insertions(+)
 create mode 100644 
tests/spec/glsl-1.10/execution/vs-loop-with-dead-code-unroll.shader_test

diff --git 
a/tests/spec/glsl-1.10/execution/vs-loop-with-dead-code-unroll.shader_test 
b/tests/spec/glsl-1.10/execution/vs-loop-with-dead-code-unroll.shader_test
new file mode 100644
index 0..780dd6428
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/vs-loop-with-dead-code-unroll.shader_test
@@ -0,0 +1,43 @@
+# Tests that unreachable code in a loop doesn't get accessed.
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+uniform int loop_count;
+
+void main()
+{
+  vec4 colour_array[4];
+
+  colour_array[0] = vec4(0.25, 0.0, 0.0, 1.0);
+  colour_array[1] = vec4(0.5, 0.0, 0.0, 1.0);
+  colour_array[2] = vec4(0.75, 0.0, 0.0, 1.0);
+  colour_array[3] = vec4(1.0, 0.0, 0.0, 1.0);
+
+  gl_Position = gl_Vertex;
+
+  vec4 colour = vec4(0.0, 1.0, 0.0, 1.0);
+  for (int i = 0; i < 4; i++) {
+if (i < loop_count)
+   continue;
+else
+   break;
+
+colour = colour_array[i];
+  }
+
+  gl_FrontColor = colour;
+}
+
+[fragment shader]
+void main()
+{
+  gl_FragColor = gl_Color;
+}
+
+[test]
+clear color 0.5 0.5 0.5 0.5
+
+uniform int loop_count 4
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.20.1

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

Re: [Piglit] [PATCH 01/10] arb_enhanced_layouts: corrected multiple comments

2019-03-20 Thread Timothy Arceri



On 2/2/19 4:55 am, Andres Gomez wrote:

Cc: Timothy Arceri 
Signed-off-by: Andres Gomez 
---
  .../vs-gs-fs-double.shader_test   | 16 +++
  .../vs-tcs-tes-fs-double.shader_test  | 42 +--
  ...-fs-type-mismatch-double-float.shader_test |  4 +-
  ...-fs-type-mismatch-signed-float.shader_test |  4 +-
  ...-type-mismatch-signed-unsigned.shader_test |  4 +-
  ...s-type-mismatch-unsigned-float.shader_test |  4 +-
  6 files changed, 46 insertions(+), 28 deletions(-)

diff --git 
a/tests/spec/arb_enhanced_layouts/execution/component-layout/vs-gs-fs-double.shader_test
 
b/tests/spec/arb_enhanced_layouts/execution/component-layout/vs-gs-fs-double.shader_test
index bf5d6e8e6..1f753792a 100644
--- 
a/tests/spec/arb_enhanced_layouts/execution/component-layout/vs-gs-fs-double.shader_test
+++ 
b/tests/spec/arb_enhanced_layouts/execution/component-layout/vs-gs-fs-double.shader_test
@@ -12,10 +12,10 @@ GL_ARB_gpu_shader_fp64
  #extension GL_ARB_separate_shader_objects: require
  #extension GL_ARB_gpu_shader_fp64: require
  
-// consume X/Y/Z components

+// consume X/Y components in location 1


This should be:

   // consume X/Y/Z/W components in location 0
   // consume X/Y components in location 1


  layout(location = 0) flat out dvec3 a;
  
-// consumes W component

+// consume Z/W components
  layout(location = 1, component = 2) flat out double b;
  
  out vec4 vertex_to_gs;

@@ -39,18 +39,18 @@ void main()
  layout(triangles) in;
  layout(triangle_strip, max_vertices = 3) out;
  
-// consume X/Y/Z components

+// consume X/Y components in location 1


This should be:

   // consume X/Y/Z/W components in location 0
   // consume X/Y components in location 1


  layout(location = 0) flat in dvec3 a[3];
  
-// consumes W component

+// consume Z/W components
  layout(location = 1, component = 2) flat in double b[3];
  
  in vec4 vertex_to_gs[3];
  
-// consume X/Y/Z components

+// consume X/Y components in location 1
  layout(location = 0) flat out dvec3 a_to_fs;
  
-// consumes W component

+// consume Z/W components
  layout(location = 1, component = 2) flat out double b_to_fs;
  
  void main()

@@ -71,10 +71,10 @@ void main()
  
  out vec4 color;
  
-// consume X/Y/Z components

+// consume X/Y components in location 1


This should be:

   // consume X/Y/Z/W components in location 0
   // consume X/Y components in location 1


  layout(location = 0) flat in dvec3 a_to_fs;
  
-// consumes W component

+// consume Z/W components
  layout(location = 1, component = 2) flat in double b_to_fs;
  
  void main()

diff --git 
a/tests/spec/arb_enhanced_layouts/execution/component-layout/vs-tcs-tes-fs-double.shader_test
 
b/tests/spec/arb_enhanced_layouts/execution/component-layout/vs-tcs-tes-fs-double.shader_test
index 938d2703d..196729aab 100644
--- 
a/tests/spec/arb_enhanced_layouts/execution/component-layout/vs-tcs-tes-fs-double.shader_test
+++ 
b/tests/spec/arb_enhanced_layouts/execution/component-layout/vs-tcs-tes-fs-double.shader_test
@@ -15,13 +15,16 @@ GL_ARB_gpu_shader_fp64
  
  in vec4 vertex;
  
-// consume Y/Z/W components

+// consume also X/Y components in location 1


This should be:

   // consume X/Y/Z/W components in location 0
   // consume X/Y components in location 1


  layout(location = 0) flat out dvec3 a;
  
-// consumes X component

+// consume Z/W components
  layout(location = 1, component = 2) flat out double b;
  
+// consume X/Y components

  layout(location = 2, component = 0) flat out double c;
+
+// consume Z/W components
  layout(location = 2, component = 2) flat out double d;
  
  void main()

@@ -44,22 +47,28 @@ void main()
  
  layout(vertices = 3) out;
  
-// consume Y/Z/W components

+// consume also X/Y components in location 1


This should be:

   // consume X/Y/Z/W components in location 0
   // consume X/Y components in location 1



  layout(location = 0) flat in dvec3 a[];
  
-// consumes X component

+// consume Z/W components
  layout(location = 1, component = 2) flat in double b[];
  
+// consume X/Y components

  layout(location = 2, component = 0) flat in double c[];
+
+// consume Z/W components
  layout(location = 2, component = 2) flat in double d[];
  
-// consume Y/Z/W components

+// consume also X/Y components in location 1


This should be:

   // consume X/Y/Z/W components in location 0
   // consume X/Y components in location 1



  layout(location = 0) flat out dvec3 a_tcs[];
  
-// consumes X component

+// consume Z/W components
  layout(location = 1, component = 2) flat out double b_tcs[];
  
+// consume X/Y components

  layout(location = 2, component = 0) flat out double c_tcs[];
+
+// consume Z/W components
  layout(location = 2, component = 2) flat out double d_tcs[];
  
  void main() {

@@ -82,22 +91,28 @@ void main() {
  
  layout(triangles) in;
  
-// consume Y/Z/W components

+// consume also X/Y components in location 1


This should be:

   // consume X/Y/Z/W components in location 0
   // consume X/Y

Re: [Piglit] [PATCH 02/10] arb_enhanced_layouts: GL_ARB_gpu_shader_fp64 requires GLSL 1.50

2019-03-20 Thread Timothy Arceri

Reviewed-by: Timothy Arceri 

On 2/2/19 4:55 am, Andres Gomez wrote:

Cc: Timothy Arceri 
Signed-off-by: Andres Gomez 
---
  .../compiler/component-layout/double-component-1.vert | 4 ++--
  .../compiler/component-layout/double-component-3.vert | 4 ++--
  .../compiler/component-layout/dvec2.vert  | 4 ++--
  .../compiler/component-layout/dvec3.vert  | 4 ++--
  .../compiler/component-layout/dvec4.vert  | 4 ++--
  .../compiler/component-layout/overflow-double.vert| 4 ++--
  .../compiler/component-layout/overflow-dvec2.vert | 4 ++--
  .../component-layout/vs-fs-array-dvec3.shader_test| 6 +++---
  .../execution/component-layout/vs-fs-doubles.shader_test  | 6 +++---
  .../component-layout/vs-to-fs-double-overlap.shader_test  | 6 +++---
  .../vs-to-fs-type-mismatch-double-float.shader_test   | 8 
  11 files changed, 27 insertions(+), 27 deletions(-)

diff --git 
a/tests/spec/arb_enhanced_layouts/compiler/component-layout/double-component-1.vert
 
b/tests/spec/arb_enhanced_layouts/compiler/component-layout/double-component-1.vert
index c8da16566..f0fb1616b 100644
--- 
a/tests/spec/arb_enhanced_layouts/compiler/component-layout/double-component-1.vert
+++ 
b/tests/spec/arb_enhanced_layouts/compiler/component-layout/double-component-1.vert
@@ -1,6 +1,6 @@
  // [config]
  // expect_result: fail
-// glsl_version: 1.40
+// glsl_version: 1.50
  // require_extensions: GL_ARB_enhanced_layouts GL_ARB_gpu_shader_fp64 
GL_ARB_separate_shader_objects
  // [end config]
  //
@@ -9,7 +9,7 @@
  //   "It is a compile-time error to use component 1 or 3 as the beginning of a
  //   double or dvec2."
  
-#version 140

+#version 150
  #extension GL_ARB_enhanced_layouts: require
  #extension GL_ARB_gpu_shader_fp64: require
  #extension GL_ARB_separate_shader_objects: require
diff --git 
a/tests/spec/arb_enhanced_layouts/compiler/component-layout/double-component-3.vert
 
b/tests/spec/arb_enhanced_layouts/compiler/component-layout/double-component-3.vert
index d054cd2a5..3c0a197fc 100644
--- 
a/tests/spec/arb_enhanced_layouts/compiler/component-layout/double-component-3.vert
+++ 
b/tests/spec/arb_enhanced_layouts/compiler/component-layout/double-component-3.vert
@@ -1,6 +1,6 @@
  // [config]
  // expect_result: fail
-// glsl_version: 1.40
+// glsl_version: 1.50
  // require_extensions: GL_ARB_enhanced_layouts GL_ARB_gpu_shader_fp64 
GL_ARB_separate_shader_objects
  // [end config]
  //
@@ -9,7 +9,7 @@
  //   "It is a compile-time error to use component 1 or 3 as the beginning of a
  //   double or dvec2."
  
-#version 140

+#version 150
  #extension GL_ARB_enhanced_layouts: require
  #extension GL_ARB_gpu_shader_fp64: require
  #extension GL_ARB_separate_shader_objects: require
diff --git 
a/tests/spec/arb_enhanced_layouts/compiler/component-layout/dvec2.vert 
b/tests/spec/arb_enhanced_layouts/compiler/component-layout/dvec2.vert
index 090aac090..9cf96ea0d 100644
--- a/tests/spec/arb_enhanced_layouts/compiler/component-layout/dvec2.vert
+++ b/tests/spec/arb_enhanced_layouts/compiler/component-layout/dvec2.vert
@@ -1,6 +1,6 @@
  // [config]
  // expect_result: pass
-// glsl_version: 1.40
+// glsl_version: 1.50
  // require_extensions: GL_ARB_enhanced_layouts GL_ARB_gpu_shader_fp64 
GL_ARB_separate_shader_objects
  // [end config]
  //
@@ -10,7 +10,7 @@
  //   consume all four components available within a location. A dvec3 or dvec4
  //   can only be declared without specifying a component."
  
-#version 140

+#version 150
  #extension GL_ARB_enhanced_layouts: require
  #extension GL_ARB_gpu_shader_fp64: require
  #extension GL_ARB_separate_shader_objects: require
diff --git 
a/tests/spec/arb_enhanced_layouts/compiler/component-layout/dvec3.vert 
b/tests/spec/arb_enhanced_layouts/compiler/component-layout/dvec3.vert
index 192765809..84eaf3ef7 100644
--- a/tests/spec/arb_enhanced_layouts/compiler/component-layout/dvec3.vert
+++ b/tests/spec/arb_enhanced_layouts/compiler/component-layout/dvec3.vert
@@ -1,6 +1,6 @@
  // [config]
  // expect_result: fail
-// glsl_version: 1.40
+// glsl_version: 1.50
  // require_extensions: GL_ARB_enhanced_layouts GL_ARB_gpu_shader_fp64 
GL_ARB_separate_shader_objects
  // [end config]
  //
@@ -8,7 +8,7 @@
  //
  //   "A dvec3 or dvec4 can only be declared without specifying a component."
  
-#version 140

+#version 150
  #extension GL_ARB_enhanced_layouts: require
  #extension GL_ARB_gpu_shader_fp64: require
  #extension GL_ARB_separate_shader_objects: require
diff --git 
a/tests/spec/arb_enhanced_layouts/compiler/component-layout/dvec4.vert 
b/tests/spec/arb_enhanced_layouts/compiler/component-layout/dvec4.vert
index 35584170f..3c6216310 100644
--- a/tests/spec/arb_enhanced_layouts/compiler/component-layout/dvec4.vert
+++ b/tests/spec/arb_enhanced_layouts/compiler/component-layout/dvec4.vert
@@ -1,6 +1,6 @@
  // [config]
  // expect_result: fail
-// glsl_version: 1.40
+// glsl_ve

Re: [Piglit] [PATCH 03/10] arb_enhanced_layouts: correct interpolation qualifiers

2019-03-20 Thread Timothy Arceri

Reviewed-by: Timothy Arceri 

On 2/2/19 4:55 am, Andres Gomez wrote:

Corrected several component aliasing tests which shouldn't be failing
or were failing due to a different reason than the tested one:
interpolation qualifiers mismatch.

 From Section 4.4.1 (Input Layout Qualifiers) of the GLSL 4.50 spec:

   " Further, when location aliasing, the aliases sharing the location
 must have the same underlying numerical type (floating-point or
 integer) and the same auxiliary storage and interpolation
 qualification."

Cc: Timothy Arceri 
Signed-off-by: Andres Gomez 
---
  ...ned.shader_test => vs-to-fs-signed-unsigned.shader_test} | 6 +++---
  .../vs-to-fs-type-mismatch-double-float.shader_test | 4 ++--
  .../vs-to-fs-type-mismatch-unsigned-float.shader_test   | 4 ++--
  3 files changed, 7 insertions(+), 7 deletions(-)
  rename 
tests/spec/arb_enhanced_layouts/linker/component-layout/{vs-to-fs-type-mismatch-signed-unsigned.shader_test
 => vs-to-fs-signed-unsigned.shader_test} (93%)

diff --git 
a/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-type-mismatch-signed-unsigned.shader_test
 
b/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-signed-unsigned.shader_test
similarity index 93%
rename from 
tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-type-mismatch-signed-unsigned.shader_test
rename to 
tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-signed-unsigned.shader_test
index 34d1138cd..8fc9b54bf 100644
--- 
a/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-type-mismatch-signed-unsigned.shader_test
+++ 
b/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-signed-unsigned.shader_test
@@ -23,10 +23,10 @@ GL_ARB_separate_shader_objects
  #extension GL_ARB_separate_shader_objects: require
  
  // consume X/Y/Z components

-layout(location = 0) out ivec3 a;
+layout(location = 0) flat out ivec3 a;
  
  // consumes W component

-layout(location = 0, component = 3) out uint b;
+layout(location = 0, component = 3) flat out uint b;
  
  void main()

  {
@@ -53,4 +53,4 @@ void main()
  }
  
  [test]

-link error
+link success
diff --git 
a/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-type-mismatch-double-float.shader_test
 
b/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-type-mismatch-double-float.shader_test
index 8f11bf131..ed596b3dc 100644
--- 
a/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-type-mismatch-double-float.shader_test
+++ 
b/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-type-mismatch-double-float.shader_test
@@ -28,7 +28,7 @@ GL_ARB_separate_shader_objects
  layout(location = 7, component = 0) flat out double a;
  
  // consumes Z component

-layout(location = 7, component = 2) out float b;
+layout(location = 7, component = 2) flat out float b;
  
  void main()

  {
@@ -48,7 +48,7 @@ out vec4 color;
  layout(location = 7, component = 0) flat in double a;
  
  // consumes Z component

-layout(location = 7, component = 2) in float b;
+layout(location = 7, component = 2) flat in float b;
  
  void main()

  {
diff --git 
a/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-type-mismatch-unsigned-float.shader_test
 
b/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-type-mismatch-unsigned-float.shader_test
index 39c37f6ac..d22d91c57 100644
--- 
a/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-type-mismatch-unsigned-float.shader_test
+++ 
b/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-type-mismatch-unsigned-float.shader_test
@@ -23,10 +23,10 @@ GL_ARB_separate_shader_objects
  #extension GL_ARB_separate_shader_objects: require
  
  // consume X/Y/Z components

-layout(location = 0) out uvec3 a;
+layout(location = 0) flat out uvec3 a;
  
  // consumes W component

-layout(location = 0, component = 3) out float b;
+layout(location = 0, component = 3) flat out float b;
  
  void main()

  {


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

Re: [Piglit] [PATCH 04/10] arb_enhanced_layouts: add aliasing tests with mixed type widths

2019-03-20 Thread Timothy Arceri



On 20/3/19 7:58 pm, Juan A. Suarez Romero wrote:

For the 4 first patches in the series:

Reviewed-by: Juan A. Suarez 


On Fri, 2019-02-01 at 19:55 +0200, Andres Gomez wrote:

Added tests which check component aliasing between types that have
different bit widths.

 From Section 4.4.1 (Input Layout Qualifiers) of the GLSL 4.60 spec:

 "Further, when location aliasing, the aliases sharing the location
  must have the same underlying numerical type and bit
  width (floating-point or integer, 32-bit versus 64-bit, etc.)
  and the same auxiliary storage and interpolation
  qualification. The one exception where component aliasing is
  permitted is for two input variables (not block members) to a
  vertex shader, which are allowed to have component aliasing. This
  vertex-variable component aliasing is intended only to support
  vertex shaders where each execution path accesses at most one
  input per each aliased component. Implementations are permitted,
  but not required, to generate link-time errors if they detect
  that every path through the vertex shader executable accesses
  multiple inputs aliased to any single component."

Cc: Timothy Arceri 
Cc: Iago Toral Quiroga 
Cc: Ilia Mirkin 
Signed-off-by: Andres Gomez 
---
  .../type-mismatch-signed-double.vert  | 59 +++
  .../width-mismatch-float-double.vert  | 59 +++
  ...s-width-mismatch-double-float.shader_test} | 25 
  3 files changed, 131 insertions(+), 12 deletions(-)
  create mode 100644 
tests/spec/arb_enhanced_layouts/compiler/component-layout/type-mismatch-signed-double.vert
  create mode 100644 
tests/spec/arb_enhanced_layouts/compiler/component-layout/width-mismatch-float-double.vert
  rename 
tests/spec/arb_enhanced_layouts/linker/component-layout/{vs-to-fs-type-mismatch-double-float.shader_test
 => vs-to-fs-width-mismatch-double-float.shader_test} (56%)

diff --git 
a/tests/spec/arb_enhanced_layouts/compiler/component-layout/type-mismatch-signed-double.vert
 
b/tests/spec/arb_enhanced_layouts/compiler/component-layout/type-mismatch-signed-double.vert
new file mode 100644
index 0..01bfb0df1
--- /dev/null
+++ 
b/tests/spec/arb_enhanced_layouts/compiler/component-layout/type-mismatch-signed-double.vert
@@ -0,0 +1,59 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// check_link: true
+// require_extensions: GL_ARB_enhanced_layouts GL_ARB_explicit_attrib_location 
GL_ARB_gpu_shader_fp64 GL_ARB_vertex_attrib_64bit
+// [end config]
+//
+// From Section 4.4.1 (Input Layout Qualifiers) of the GLSL 4.50 spec:
+//
+//   "Further, when location aliasing, the aliases sharing the location must
+//   have the same underlying numerical type (floating-point or integer) and
+//   the same auxiliary storage and interpolation qualification"
+//
+//   ...
+//
+//   "The one exception where component aliasing is permitted is for two input
+//   variables (not block members) to a vertex shader, which are allowed to
+//   have component aliasing. This vertex-variable component aliasing is
+//   intended only to support vertex shaders where each execution path
+//   accesses at most one input per each aliased component.  Implementations
+//   are permitted, but not required, to generate link-time errors if they
+//   detect that every path through the vertex shader executable accesses
+//   multiple inputs aliased to any single component."
+//
+//   Issue 16 from the ARB_enhanced_layouts spec:
+//
+//   "We do allow this for vertex shader inputs, because we've supported
+//   "aliasing" behavior since OpenGL 2.0. This allows for an "uber-shader"
+//with variables like:
+//
+//  layout(location=3) in float var1;
+//  layout(location=3) in int var2;
+//
+//   where sometimes it uses  and sometimes .  Since we don't
+//   treat the code above (with overlapping components) as an error, it
+//   would be strange to treat non-overlapping component assignments as an
+//   error."
+
+#version 150
+#extension GL_ARB_enhanced_layouts: require
+#extension GL_ARB_explicit_attrib_location: require
+#extension GL_ARB_gpu_shader_fp64: require
+#extension GL_ARB_vertex_attrib_64bit: require
+
+uniform int i;
+
+// consume X/Y components
+layout(location = 0) in ivec2 a;
+
+// consume Z/W components
+layout(location = 0, component = 2) in double b;
+
+void main()
+{
+  if (i == 1)
+gl_Position = vec4(a, 1.0, 1.0);
+  else
+gl_Position = vec4(b);
+}
diff --git 
a/tests/spec/arb_enhanced_layouts/compiler/component-layout/width-mismatch-float-double.vert
 
b/tests/spec/arb_enhanced_layouts/compiler/component-layout/width-mismatch-float-double.vert
new file mode 100644
index 0..74926c1ea
--- /dev/null
+++ 
b/tests/spec/arb_enhanced_layouts/compiler/component-layout/width-mismatch-float-double.vert
@@ -0,0 +1,59 @@
+// [config]
+// expect_result: pass
+//

[Piglit] [PATCH] glsl-1.10: test for crash in loop analysis

2019-03-18 Thread Timothy Arceri
This test for a crash in Mesa seen in an Assasins Creed Odyssey shader.
---
 ...riable-iteration-limit-unroll4.shader_test | 88 +++
 1 file changed, 88 insertions(+)
 create mode 100644 
tests/spec/glsl-1.10/execution/vs-loop-variable-iteration-limit-unroll4.shader_test

diff --git 
a/tests/spec/glsl-1.10/execution/vs-loop-variable-iteration-limit-unroll4.shader_test
 
b/tests/spec/glsl-1.10/execution/vs-loop-variable-iteration-limit-unroll4.shader_test
new file mode 100644
index 0..38fdda4ca
--- /dev/null
+++ 
b/tests/spec/glsl-1.10/execution/vs-loop-variable-iteration-limit-unroll4.shader_test
@@ -0,0 +1,88 @@
+# This tests unrolling of a loop with a single exit point but where the
+# exact trip count is unknown, only the max iteration count (4) is known.
+#
+# Here we test all possible outcomes for the loop and also add some
+# unreachable code to make sure it is not accessible after unrolling.
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+uniform int loop_count;
+uniform int loop_count2;
+
+void main()
+{
+  gl_Position = gl_Vertex;
+
+  vec4 colour = vec4(1.0, 1.0, 1.0, 1.0);
+
+  int i = 0;
+  int j = 0;
+  int x = 0;
+
+  /* Here we add a second && and put the known limit i < 4 in parentheses in
+   * order to trigger a Mesa bug seen in a Assasins Creed Odyssey shader
+   */
+  while (x < loop_count && (i < 4 && j < loop_count2)) {
+if (x == 0 && i == 0)
+  colour = vec4(0.0, 0.25, 0.0, 1.0);
+
+if (x == 2 && i == 1 && j == 4)
+  colour = vec4(0.0, 0.5, 0.0, 1.0);
+
+if (x == 4 && i == 2 && j == 8)
+  colour = vec4(0.0, 0.75, 0.0, 1.0);
+
+if (x == 6 && i == 3 && j == 12)
+  colour = vec4(0.0, 1.0, 0.0, 1.0);
+
+/* This should be unreachable */
+if (x >= 8 || i >= 4)
+  colour = vec4(1.0, 0.0, 0.0, 1.0);
+
+i++;
+x+=2;
+j+=4;
+  }
+
+  gl_FrontColor = colour;
+}
+
+[fragment shader]
+void main()
+{
+  gl_FragColor = gl_Color;
+}
+
+[test]
+clear color 0.5 0.5 0.5 0.5
+
+uniform int loop_count 0
+uniform int loop_count2 16
+draw rect -1 -1 2 2
+probe all rgba 1.0 1.0 1.0 1.0
+
+uniform int loop_count 2
+uniform int loop_count2 16
+draw rect -1 -1 2 2
+probe all rgba 0.0 0.25 0.0 1.0
+
+uniform int loop_count 4
+uniform int loop_count2 16
+draw rect -1 -1 2 2
+probe all rgba 0.0 0.5 0.0 1.0
+
+uniform int loop_count 6
+uniform int loop_count2 16
+draw rect -1 -1 2 2
+probe all rgba 0.0 0.75 0.0 1.0
+
+uniform int loop_count 8
+uniform int loop_count2 16
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform int loop_count 10
+uniform int loop_count2 16
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.20.1

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

[Piglit] [PATCH] glsl-1.10: test unrolling another loop with variable iteration limits

2019-02-25 Thread Timothy Arceri
This tests unrolling of a loop with a single exit point but where the
exact trip count is unknown, only the max iteration count is known.

Here we make sure that the and condition won't be simplified into
a min() by another opt pass.
---
 ...riable-iteration-limit-unroll3.shader_test | 75 +++
 1 file changed, 75 insertions(+)
 create mode 100644 
tests/spec/glsl-1.10/execution/vs-loop-variable-iteration-limit-unroll3.shader_test

diff --git 
a/tests/spec/glsl-1.10/execution/vs-loop-variable-iteration-limit-unroll3.shader_test
 
b/tests/spec/glsl-1.10/execution/vs-loop-variable-iteration-limit-unroll3.shader_test
new file mode 100644
index 0..b21f43ad0
--- /dev/null
+++ 
b/tests/spec/glsl-1.10/execution/vs-loop-variable-iteration-limit-unroll3.shader_test
@@ -0,0 +1,75 @@
+# This tests unrolling of a loop with a single exit point but where the
+# exact trip count is unknown, only the max iteration count (4) is known.
+#
+# Here we test all possible outcomes for the loop and also add some
+# unreachable code to make sure it is not accessible after unrolling.
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+uniform int loop_count;
+
+void main()
+{
+  gl_Position = gl_Vertex;
+
+  vec4 colour = vec4(1.0, 1.0, 1.0, 1.0);
+
+  int i = 0;
+  int x = 0;
+  while (x < loop_count && i < 4) {
+if (x == 0 && i == 0)
+  colour = vec4(0.0, 0.25, 0.0, 1.0);
+
+if (x == 2 && i == 1)
+  colour = vec4(0.0, 0.5, 0.0, 1.0);
+
+if (x == 4 && i == 2)
+  colour = vec4(0.0, 0.75, 0.0, 1.0);
+
+if (x == 6 && i == 3)
+  colour = vec4(0.0, 1.0, 0.0, 1.0);
+
+/* This should be unreachable */
+if (x >= 8 || i >= 4)
+  colour = vec4(1.0, 0.0, 0.0, 1.0);
+
+i++;
+x+=2;
+  }
+
+  gl_FrontColor = colour;
+}
+
+[fragment shader]
+void main()
+{
+  gl_FragColor = gl_Color;
+}
+
+[test]
+clear color 0.5 0.5 0.5 0.5
+
+uniform int loop_count 0
+draw rect -1 -1 2 2
+probe all rgba 1.0 1.0 1.0 1.0
+
+uniform int loop_count 2
+draw rect -1 -1 2 2
+probe all rgba 0.0 0.25 0.0 1.0
+
+uniform int loop_count 4
+draw rect -1 -1 2 2
+probe all rgba 0.0 0.5 0.0 1.0
+
+uniform int loop_count 6
+draw rect -1 -1 2 2
+probe all rgba 0.0 0.75 0.0 1.0
+
+uniform int loop_count 8
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform int loop_count 10
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.20.1

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

Re: [Piglit] [PATCH 0/3] arb_enhanced_layouts: minor clean-up and one bugfix

2019-02-20 Thread Timothy Arceri

series:

Reviewed-by: Timothy Arceri 

Thanks!

On 21/2/19 3:06 am, Alejandro Piñeiro wrote:

We found this issues while working with ARB_gl_spirv, but all those
are independent of it, so we are sending independently.

Alejandro Piñeiro (2):
   arb_enhanced_layouts: don't call glLinkProgram twice
   arb_enhanced_layouts: use consistent test names

Antia Puentes (1):
   arb_enhanced_layouts: Fix error in subtest result reporting

  tests/opengl.py| 2 +-
  .../transform-feedback-layout-qualifiers.c | 3 ++-
  .../arb_enhanced_layouts/transform-feedback-layout-query-api.c | 2 +-
  3 files changed, 4 insertions(+), 3 deletions(-)


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

Re: [Piglit] [PATCH] arb_separate_shader_objects: add rendez-vous-by mismatch tests

2019-02-15 Thread Timothy Arceri

Thanks!

Reviewed-by: Timothy Arceri 
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit

Re: [Piglit] [PATCH 2/2] arb_program_interface_query: correct rendez-vous by name matching

2019-02-15 Thread Timothy Arceri
It would be great if you could run this test on the Nvidia binary blob 
to confirm the results. If everything works as expected the series is:


Reviewed-by: Timothy Arceri 

Thanks for fixing all this!

On 9/2/19 3:57 am, Andres Gomez wrote:

Previuosly, this was overlooked asuming that, since they were SSOs, no
inner interface matching check was needed.

 From the ARB_separate_shader_objects spec v.25:

   " With separable program objects, interfaces between shader stages
 may involve the outputs from one program object and the inputs
 from a second program object.  For such interfaces, it is not
 possible to detect mismatches at link time, because the programs
 are linked separately.  When each such program is linked, all
 inputs or outputs interfacing with another program stage are
 treated as active.  The linker will generate an executable that
 assumes the presence of a compatible program on the other side of
 the interface.  If a mismatch between programs occurs, no GL error
 will be generated, but some or all of the inputs on the interface
 will be undefined."

Cc: Timothy Arceri 
Cc: Tapani Pälli 
Cc: Ilia Mirkin 
Cc: Martin Peres 
Signed-off-by: Andres Gomez 
---
  .../spec/arb_program_interface_query/common.h | 61 ---
  .../getprogramresourceiv.c|  8 +--
  .../resource-query.c  | 48 +++
  3 files changed, 79 insertions(+), 38 deletions(-)

diff --git a/tests/spec/arb_program_interface_query/common.h 
b/tests/spec/arb_program_interface_query/common.h
index 371b0338b..c0a99ea64 100755
--- a/tests/spec/arb_program_interface_query/common.h
+++ b/tests/spec/arb_program_interface_query/common.h
@@ -74,9 +74,11 @@ static const char vs_std[] =
"uniform vs_struct sa[2];\n"
"in vec4 vs_input0;\n"
"in vec4 vs_input1;\n"
+   "out vec4 vs_output1;\n"
"void main() {\n"
"  gl_Position = vs_input0 * vs_test * vs_input1 + sa[0].a[1] +"
"sa[1].a[1];\n"
+   "  vs_output1 = vs_input0;\n"
"}";
  
  const char gs_std[] =

@@ -86,18 +88,38 @@ const char gs_std[] =
"uniform gs_uniform_block {\n"
"  vec4 gs_test;\n"
"};\n"
-   "in vec4 gs_input[3];\n"
-   "out vec4 gs_output0;\n"
+   "in vec4 vs_output1[3];\n"
+   "out vec4 fs_input1;\n"
"void main() {\n"
"  for (int i = 0; i < 6; i++) {\n"
-   "  gl_Position = gs_input[i % 3] *"
+   "  gl_Position = vs_output1[i % 3] *"
"gl_in[i % 3].gl_Position * gs_test;\n"
-   "  gs_output0 = gs_input[0];\n"
+   "  fs_input1 = vs_output1[0];\n"
"  EmitVertex();\n"
"  }\n"
"}\n";
  
  static const char fs_std[] =

+   "#version 150\n"
+   "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 vs_output1;\n"
+   "out vec4 fs_output0;\n"
+   "out vec4 fs_output1;\n"
+   "void main() {\n"
+   "fs_output0 = fs_color * vs_output1 * fs_array[2] * \n"
+   "faub[0].fs_array[2] * faub[2].fs_array[2];\n"
+   "fs_output1 = fs_color * vs_output1 * fs_array[3] * \n"
+   " faub[1].fs_array[3] * faub[3].fs_array[3];\n"
+   "}";
+
+static const char fs_in[] =
"#version 150\n"
"uniform fs_uniform_block {"
"  vec4 fs_color;\n"
@@ -296,8 +318,8 @@ static const char tcs_sub[] =
"uniform tcs_uniform_block {\n"
"  vec4 tcs_test;\n"
"};\n"
-   "out vec4 tcs_output[3];\n"
-   "in vec4 tcs_input[gl_MaxPatchVertices];\n"
+   "out vec4 tes_input1[3];\n"
+   "in vec4 vs_output1[gl_MaxPatchVertices];\n"
"patch out vec4 tcs_patch;\n"
"subroutine vec4 tcs_offset();\n"
"subroutine uniform tcs_offset TESS_CONTROL;\n"
@@ -306,7 +328,7 @@ static const char tcs_sub[] =
"  gl_out[gl_InvocationID].gl_Position = tcs_test +"
"gl_in[0].gl_Position *"
"TESS_CONTROL();\n"
-   "  tc

Re: [Piglit] [PATCH] arb_program_interface_query: corrected AoA's index variable expectation

2019-02-15 Thread Timothy Arceri

NAK.

The problem is this will end up making the test fail on the Nvidia blob.
Technically neither is incorrect, but the test does show Mesa's failure 
to detect the unused element. Again this is not technically a failure of 
the spec as it's dependent on the implementations ability to detect 
active array elements. However I'd rather leave this than work around 
our substandard detection of inactive elements.


See [1] for more information, and note I also rejected the Mesa solution 
proposed by Andrii in the bug report because it was too much code for 
something that didn't actually remove the unused components but just hid 
them from the resource list.


I think if we actually want to fix this properly then we could do it by 
making a NIR linker for GLSL.


[1] https://bugs.freedesktop.org/show_bug.cgi?id=92822

On 9/2/19 3:59 am, Andres Gomez wrote:

Naming conventions, from the GL_ARB_program_interface_query extension:

  "   * For an active variable declared as an array of an aggregate
data type (structures or arrays), a separate entry will be
generated for each active array element, unless noted
immediately below.  The name of each entry is formed by
concatenating the name of the array, the "[" character, an
integer identifying the element number, and the "]" character.
These enumeration rules are applied recursively, treating each
enumerated array element as a separate active variable."

Cc: Timothy Arceri 
Cc: Martin Peres 
Signed-off-by: Andres Gomez 
---
  .../spec/arb_program_interface_query/getprogramresourceindex.c  | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/spec/arb_program_interface_query/getprogramresourceindex.c 
b/tests/spec/arb_program_interface_query/getprogramresourceindex.c
index 16b38e2d5..2afc9eeb9 100755
--- a/tests/spec/arb_program_interface_query/getprogramresourceindex.c
+++ b/tests/spec/arb_program_interface_query/getprogramresourceindex.c
@@ -167,7 +167,7 @@ static const struct subtest_index_t index_subtests[] = {
{   vs_aofa,  GL_PROGRAM_INPUT,  "vs_input2", 
false, -1, GL_NO_ERROR },
{   vs_aofa,  GL_PROGRAM_INPUT,   "vs_input2[0]",  
true, -1, GL_NO_ERROR },
{   vs_aofa,  GL_PROGRAM_INPUT,"vs_input2[0][0]",  
true, -1, GL_NO_ERROR },
-   {   vs_aofa,  GL_PROGRAM_INPUT,"vs_input2[1][0]", 
false, -1, GL_NO_ERROR },
+   {   vs_aofa,  GL_PROGRAM_INPUT,"vs_input2[1][0]",  
true, -1, GL_NO_ERROR },
{   vs_aofa,  GL_PROGRAM_INPUT,"vs_input2[0][1]", 
false, -1, GL_NO_ERROR },
{vs_sub,  GL_VERTEX_SUBROUTINE,"vss",  
true, -1, GL_NO_ERROR },
{vs_sub,  GL_VERTEX_SUBROUTINE,   "vss2",  
true, -1, GL_NO_ERROR },


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

Re: [Piglit] [PATCH v2 10/10] arb_enhanced_layouts: add xfb_offset overlap test

2019-02-06 Thread Timothy Arceri

Reviewed-by: Timothy Arceri 

On 7/2/19 2:52 am, Andres Gomez wrote:

 From the GL_ARB_enhanced_layouts spec:

   " No aliasing in output buffers is allowed: It is a compile-time or
 link-time error to specify variables with overlapping transform
 feedback offsets."

v2: added forgotten check_link.

Cc: Timothy Arceri 
Signed-off-by: Andres Gomez 
---
  .../xfb_offset/invalid-overlap.vert   | 24 +++
  1 file changed, 24 insertions(+)
  create mode 100644 
tests/spec/arb_enhanced_layouts/compiler/transform-feedback-layout-qualifiers/xfb_offset/invalid-overlap.vert

diff --git 
a/tests/spec/arb_enhanced_layouts/compiler/transform-feedback-layout-qualifiers/xfb_offset/invalid-overlap.vert
 
b/tests/spec/arb_enhanced_layouts/compiler/transform-feedback-layout-qualifiers/xfb_offset/invalid-overlap.vert
new file mode 100644
index 0..5e8adc154
--- /dev/null
+++ 
b/tests/spec/arb_enhanced_layouts/compiler/transform-feedback-layout-qualifiers/xfb_offset/invalid-overlap.vert
@@ -0,0 +1,24 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.40
+// check_link: true
+// require_extensions: GL_ARB_enhanced_layouts
+// [end config]
+//
+// From the GL_ARB_enhanced_layouts spec:
+//
+//   " No aliasing in output buffers is allowed: It is a compile-time
+// or link-time error to specify variables with overlapping
+// transform feedback offsets."
+
+#version 140
+#extension GL_ARB_enhanced_layouts: require
+
+layout(xfb_offset = 0) out vec4 a;
+layout(xfb_offset = 0) out vec4 b;
+
+void main()
+{
+  a = vec4(1.0);
+  b = vec4(0.0);
+}


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


Re: [Piglit] [PATCH 09/10] arb_enhanced_layouts: add another xfb_stride overflow test

2019-02-02 Thread Timothy Arceri

On 3/2/19 7:30 am, Andres Gomez wrote:

On Sat, 2019-02-02 at 10:15 +1100, Timothy Arceri wrote:

On 2/2/19 4:55 am, Andres Gomez wrote:

Additional check to address a bug in mesa in which a stride which
is a divisor of the declared offset for an overflowing varying
won't fail.

  From the GL_ARB_enhanced_layouts spec:

" It is a compile-time or link-time error to have any *xfb_offset*
  that overflows *xfb_stride*, whether stated on declarations before
  or after the *xfb_stride*, or in different compilation units."

Cc: Timothy Arceri 
Signed-off-by: Andres Gomez 
---
   .../xfb_stride/variable-stride-overflow2.vert | 28 +++
   1 file changed, 28 insertions(+)
   create mode 100644 
tests/spec/arb_enhanced_layouts/compiler/transform-feedback-layout-qualifiers/xfb_stride/variable-stride-overflow2.vert

diff --git 
a/tests/spec/arb_enhanced_layouts/compiler/transform-feedback-layout-qualifiers/xfb_stride/variable-stride-overflow2.vert
 
b/tests/spec/arb_enhanced_layouts/compiler/transform-feedback-layout-qualifiers/xfb_stride/variable-stride-overflow2.vert
new file mode 100644
index 0..469c5e430
--- /dev/null
+++ 
b/tests/spec/arb_enhanced_layouts/compiler/transform-feedback-layout-qualifiers/xfb_stride/variable-stride-overflow2.vert
@@ -0,0 +1,28 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.40
+// check_link: true
+// require_extensions: GL_ARB_enhanced_layouts
+// [end config]
+//
+// Additional check to address a bug in mesa in which a stride which
+// is a divisor of the declared offset for an overflowing varying
+// won't fail.
+//
+// From the GL_ARB_enhanced_layouts spec:
+//
+//"It is a compile-time or link-time error to have any *xfb_offset*
+//that overflows *xfb_stride*, whether stated on declarations before or
+//after the *xfb_stride*, or in different compilation units."
+
+#version 140
+#extension GL_ARB_enhanced_layouts: require
+
+layout(xfb_stride = 16) out vec4 var;
+layout(xfb_offset = 16) out vec4 var2;


This test looks wrong to me. This looks like it *should* compile.

vec4 var uses bytes 0-15. So there is no issue with vec4 vec2 having an
offset of 16. Its been a long time since I worked on this but I think
this change is wrong. I see no reason this should fail compilation.


I believe I've answered now this in:
https://lists.freedesktop.org/archives/mesa-dev/2019-February/214457.html


After rereading the spec I think you are right.

Reviewed-by: Timothy Arceri 






+
+void main()
+{
+  var = vec4(1.0);
+  var2 = vec4(0.0);
+}


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


Re: [Piglit] [PATCH 05/10] arb_enhanced_layouts: correct component usage with dvec{3, 4} tests

2019-02-01 Thread Timothy Arceri

Reviewed-by: Timothy Arceri 

On 2/2/19 4:55 am, Andres Gomez wrote:

There was a pre-existing test using "component = 0" with dvec3 which
was not failing as it should. This was because the other tests
checking for the usage of the component keyword with dvec3 and dvec4
were failing due to a different restriction: the component sequence
was overflowing 3 and/or a double based type was using component 1 o
3.

Now we fix them by using "component = 0" when need to fail and
removing the keyword when need to succeed.

 From Section 4.4.1 (Input Layout Qualifiers) of the GLSL 4.50 spec:

   " It is a compile-time error if this sequence of components gets
 larger than 3. A scalar double will consume two of these
 components, and a dvec2 will consume all four components available
 within a location. A dvec3 or dvec4 can only be declared without
 specifying a component."

...

   " It is a compile-time error to use component 1 or 3 as the
 beginning of a double or dvec2."

Cc: Timothy Arceri 
Cc: Kenneth Graunke 
Signed-off-by: Andres Gomez 
---
  .../arb_enhanced_layouts/compiler/component-layout/dvec3.vert | 2 +-
  .../arb_enhanced_layouts/compiler/component-layout/dvec4.vert | 2 +-
  .../execution/component-layout/vs-fs-array-dvec3.shader_test  | 4 ++--
  3 files changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/tests/spec/arb_enhanced_layouts/compiler/component-layout/dvec3.vert 
b/tests/spec/arb_enhanced_layouts/compiler/component-layout/dvec3.vert
index 84eaf3ef7..fcb2a5284 100644
--- a/tests/spec/arb_enhanced_layouts/compiler/component-layout/dvec3.vert
+++ b/tests/spec/arb_enhanced_layouts/compiler/component-layout/dvec3.vert
@@ -13,7 +13,7 @@
  #extension GL_ARB_gpu_shader_fp64: require
  #extension GL_ARB_separate_shader_objects: require
  
-layout(location = 0, component = 1) out dvec3 b;

+layout(location = 0, component = 0) out dvec3 b;
  
  void main()

  {
diff --git 
a/tests/spec/arb_enhanced_layouts/compiler/component-layout/dvec4.vert 
b/tests/spec/arb_enhanced_layouts/compiler/component-layout/dvec4.vert
index 3c6216310..78696f18d 100644
--- a/tests/spec/arb_enhanced_layouts/compiler/component-layout/dvec4.vert
+++ b/tests/spec/arb_enhanced_layouts/compiler/component-layout/dvec4.vert
@@ -13,7 +13,7 @@
  #extension GL_ARB_gpu_shader_fp64: require
  #extension GL_ARB_separate_shader_objects: require
  
-layout(location = 0, component = 1) out dvec4 b;

+layout(location = 0, component = 0) out dvec4 b;
  
  void main()

  {
diff --git 
a/tests/spec/arb_enhanced_layouts/execution/component-layout/vs-fs-array-dvec3.shader_test
 
b/tests/spec/arb_enhanced_layouts/execution/component-layout/vs-fs-array-dvec3.shader_test
index de348cbb3..ebd18ad5d 100644
--- 
a/tests/spec/arb_enhanced_layouts/execution/component-layout/vs-fs-array-dvec3.shader_test
+++ 
b/tests/spec/arb_enhanced_layouts/execution/component-layout/vs-fs-array-dvec3.shader_test
@@ -13,7 +13,7 @@ GL_ARB_gpu_shader_fp64
  #extension GL_ARB_gpu_shader_fp64: require
  
  // XYZW components of 0 & 2, XY components of 1 & 3

-layout(location = 0, component = 0) flat out dvec3 a[2];
+layout(location = 0) flat out dvec3 a[2];
  
  // ZW component of 1

  layout(location = 1, component = 2) flat out double b;
@@ -38,7 +38,7 @@ void main()
  out vec4 color;
  
  // XYZW components of 0 & 2, XY components of 1 & 3

-layout(location = 0, component = 0) flat in dvec3 a[2];
+layout(location = 0) flat in dvec3 a[2];
  
  // ZW component of 1

  layout(location = 1, component = 2) flat in double b;


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


Re: [Piglit] [PATCH 06/10] arb_separate_shader_objects: add location overlapping tests

2019-02-01 Thread Timothy Arceri

Reviewed-by: Timothy Arceri 

On 2/2/19 4:55 am, Andres Gomez wrote:

New tests for location overlap with scalars, doubles and for
duplicated inputs which match the same output variable in the previous
stage.

 From the ARB_separate_shader_objects spec v.25:

   "   * An output variable is considered to match an input variable in
 the subequent shader if:

 * the two variables match in name, type, and qualification; or

 * the two variables are declared with the same location layout
   qualifier and match in type and qualification."

...

   " A program will fail to link if any two non-vertex shader input
 variables are assigned to the same location."

Cc: Timothy Arceri 
Cc: Iago Toral Quiroga 
Cc: Ilia Mirkin 
Signed-off-by: Andres Gomez 
---
  ...uplicated-input-overlap-double.shader_test | 58 +++
  ...ation-duplicated-input-overlap.shader_test | 55 ++
  ...plicit-location-overlap-double.shader_test | 49 
  ...o-fs-explicit-location-overlap.shader_test | 49 
  4 files changed, 211 insertions(+)
  create mode 100644 
tests/spec/arb_separate_shader_objects/linker/vs-to-fs-explicit-location-duplicated-input-overlap-double.shader_test
  create mode 100644 
tests/spec/arb_separate_shader_objects/linker/vs-to-fs-explicit-location-duplicated-input-overlap.shader_test
  create mode 100644 
tests/spec/arb_separate_shader_objects/linker/vs-to-fs-explicit-location-overlap-double.shader_test
  create mode 100644 
tests/spec/arb_separate_shader_objects/linker/vs-to-fs-explicit-location-overlap.shader_test

diff --git 
a/tests/spec/arb_separate_shader_objects/linker/vs-to-fs-explicit-location-duplicated-input-overlap-double.shader_test
 
b/tests/spec/arb_separate_shader_objects/linker/vs-to-fs-explicit-location-duplicated-input-overlap-double.shader_test
new file mode 100644
index 0..f0a966e6a
--- /dev/null
+++ 
b/tests/spec/arb_separate_shader_objects/linker/vs-to-fs-explicit-location-duplicated-input-overlap-double.shader_test
@@ -0,0 +1,58 @@
+// From the ARB_separate_shader_objects spec v.25:
+//
+//   "   * An output variable is considered to match an input variable
+// in the subequent shader if:
+//
+// * the two variables match in name, type, and qualification;
+//   or
+//
+// * the two variables are declared with the same location
+//   layout qualifier and match in type and qualification."
+//
+//   ...
+//
+//   " A program will fail to link if any two non-vertex shader input
+// variables are assigned to the same location."
+
+[require]
+GLSL >= 1.50
+GL_ARB_separate_shader_objects
+GL_ARB_gpu_shader_fp64
+
+[vertex shader]
+#version 150
+#extension GL_ARB_separate_shader_objects : require
+#extension GL_ARB_gpu_shader_fp64 : require
+
+in vec4 piglit_vertex;
+
+layout(location = 0) flat out dvec4 out1;
+
+void main()
+{
+   gl_Position = piglit_vertex;
+   out1 = dvec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[fragment shader]
+#version 150
+#extension GL_ARB_separate_shader_objects : require
+#extension GL_ARB_gpu_shader_fp64 : require
+
+uniform int i;
+
+layout(location = 0) flat in dvec4 in1;
+layout(location = 0) flat in dvec4 in2;
+
+out vec4 color;
+
+void main()
+{
+   if (i == 0)
+   color = vec4(in1);
+   else
+   color = vec4(in2);
+}
+
+[test]
+link error
diff --git 
a/tests/spec/arb_separate_shader_objects/linker/vs-to-fs-explicit-location-duplicated-input-overlap.shader_test
 
b/tests/spec/arb_separate_shader_objects/linker/vs-to-fs-explicit-location-duplicated-input-overlap.shader_test
new file mode 100644
index 0..d7e5769b3
--- /dev/null
+++ 
b/tests/spec/arb_separate_shader_objects/linker/vs-to-fs-explicit-location-duplicated-input-overlap.shader_test
@@ -0,0 +1,55 @@
+// From the ARB_separate_shader_objects spec v.25:
+//
+//   "   * An output variable is considered to match an input variable
+// in the subequent shader if:
+//
+// * the two variables match in name, type, and qualification;
+//   or
+//
+// * the two variables are declared with the same location
+//   layout qualifier and match in type and qualification."
+//
+//   ...
+//
+//   " A program will fail to link if any two non-vertex shader input
+// variables are assigned to the same location."
+
+[require]
+GLSL >= 1.40
+GL_ARB_separate_shader_objects
+
+[vertex shader]
+#version 140
+#extension GL_ARB_separate_shader_objects : require
+
+in vec4 piglit_vertex;
+
+layout(location = 0) out vec4 out1;
+
+void main()
+{
+   gl_Position = piglit_vertex;
+   out1 = vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[fragment shader]
+#version 140
+#extension GL_ARB_separate_shader_objects : require
+
+uniform int i;
+
+layout(location = 0) in vec4 in1;
+layout(location = 0) in vec4 in2;
+
+out vec4 color;
+
+void main()
+{
+   if (i == 

Re: [Piglit] [PATCH 08/10] arb_separate_shader_objects: add unused location qualified input test

2019-02-01 Thread Timothy Arceri

Reviewed-by: Timothy Arceri 

On 2/2/19 4:55 am, Andres Gomez wrote:

New tests to check that an unused input varying, which would be
matched based on its explicit location, won't cause a link failure if
there is no matching output variable.

 From the ARB_separate_shader_objects spec v.25:

   "   * An output variable is considered to match an input variable in
 the subequent shader if:

 * the two variables match in name, type, and qualification; or

 * the two variables are declared with the same location layout
   qualifier and match in type and qualification."

   ...

   " For program objects containing multiple shaders, LinkProgram will
 check for mismatches on interfaces between shader stages in the
 program being linked and generate a link error if a mismatch is
 detected.  A link error will be generated if any statically
 referenced input variable or block does not have a matching
 output."

Cc: Timothy Arceri 
Cc: Iago Toral Quiroga 
Cc: Samuel Iglesias Gonsálvez 
Cc: Tapani Pälli 
Cc: Ian Romanick 
Signed-off-by: Andres Gomez 
---
  ...explicit-location-unused-input.shader_test | 38 +++
  1 file changed, 38 insertions(+)
  create mode 100644 
tests/spec/arb_separate_shader_objects/linker/vs-to-fs-explicit-location-unused-input.shader_test

diff --git 
a/tests/spec/arb_separate_shader_objects/linker/vs-to-fs-explicit-location-unused-input.shader_test
 
b/tests/spec/arb_separate_shader_objects/linker/vs-to-fs-explicit-location-unused-input.shader_test
new file mode 100644
index 0..c39fd4033
--- /dev/null
+++ 
b/tests/spec/arb_separate_shader_objects/linker/vs-to-fs-explicit-location-unused-input.shader_test
@@ -0,0 +1,38 @@
+// From the ARB_separate_shader_objects spec v.25:
+//
+//   "   * An output variable is considered to match an input variable
+// in the subequent shader if:
+//
+// * the two variables match in name, type, and qualification;
+//   or
+//
+// * the two variables are declared with the same location
+//   layout qualifier and match in type and qualification."
+//
+//   ...
+//
+//   " For program objects containing multiple shaders, LinkProgram
+// will check for mismatches on interfaces between shader stages
+// in the program being linked and generate a link error if a
+// mismatch is detected.  A link error will be generated if any
+// statically referenced input variable or block does not have a
+// matching output."
+
+[require]
+GLSL >= 1.40
+GL_ARB_separate_shader_objects
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 140
+#extension GL_ARB_separate_shader_objects : require
+
+layout(location = 0) in vec4 in1;
+
+void main()
+{
+}
+
+[test]
+link success


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


[Piglit] [PATCH] arb_gpu_shader5: add more variants of the struct interpolateAt tests

2019-01-21 Thread Timothy Arceri
---
 ...ateAtCentroid-array-of-structs.shader_test | 63 +++
 ...-interpolateAtCentroid-struct2.shader_test | 59 +
 2 files changed, 122 insertions(+)
 create mode 100644 
tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtCentroid-array-of-structs.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtCentroid-struct2.shader_test

diff --git 
a/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtCentroid-array-of-structs.shader_test
 
b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtCentroid-array-of-structs.shader_test
new file mode 100644
index 0..ba958f3e3
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtCentroid-array-of-structs.shader_test
@@ -0,0 +1,63 @@
+# From Section 8.13.2 (Interpolation Functions) of the GLSL 4.60 spec:
+#
+#   "For all of the interpolation functions, interpolant must be an l-value
+#from an in declaration; this can include a variable, a block or
+#structure member, an array element, or some combination of these."
+#
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader]
+in vec4 piglit_vertex;
+
+struct S {
+   float b; /* second variable to test that varying packing doesn't break 
anything */
+   vec3 a;
+};
+
+out S vs2ps[2];
+
+void main()
+{
+   gl_Position = piglit_vertex;
+
+   vs2ps[0].a.xy = piglit_vertex.xy;
+   vs2ps[1].a.z = piglit_vertex.z;
+   vs2ps[0].b = 0.0;
+   vs2ps[1].b = 1.0;
+}
+
+[fragment shader]
+#extension GL_ARB_gpu_shader5 : enable
+
+struct S {
+   float b;
+   vec3 a;
+};
+
+in S vs2ps[2];
+
+out vec4 color;
+
+void main()
+{
+   /* All pixels are fully covered, so these should be the same. */
+   vec3 tmp = vs2ps[0].a - interpolateAtCentroid(vs2ps[0].a);
+   vec3 tmp2 = vs2ps[1].a - interpolateAtCentroid(vs2ps[1].a);
+   vec3 delta = vec3(tmp.xy, tmp2.z);
+
+   if (delta != vec3(0.0)) {
+  color = vec4(1.0, delta.x + 0.5, delta.y + 0.5, delta.z + 0.5);
+   } else {
+  color = vec4(vs2ps[0].b, vs2ps[1].b, 0.0, 1.0);
+   }
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git 
a/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtCentroid-struct2.shader_test
 
b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtCentroid-struct2.shader_test
new file mode 100644
index 0..afc1e33ca
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtCentroid-struct2.shader_test
@@ -0,0 +1,59 @@
+# From Section 8.13.2 (Interpolation Functions) of the GLSL 4.60 spec:
+#
+#   "For all of the interpolation functions, interpolant must be an l-value
+#from an in declaration; this can include a variable, a block or
+#structure member, an array element, or some combination of these."
+#
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader]
+in vec4 piglit_vertex;
+
+struct S {
+   vec2 b; /* second variable to test that varying packing doesn't break 
anything */
+   vec3 a;
+};
+
+out S vs2ps;
+
+void main()
+{
+   gl_Position = piglit_vertex;
+
+   vs2ps.a = piglit_vertex.xyz;
+   vs2ps.b = vec2(0.0, 1.0);
+}
+
+[fragment shader]
+#extension GL_ARB_gpu_shader5 : enable
+
+struct S {
+   vec2 b;
+   vec3 a;
+};
+
+in S vs2ps;
+
+out vec4 color;
+
+void main()
+{
+   /* All pixels are fully covered, so these should be the same. */
+   vec3 delta = vs2ps.a - interpolateAtCentroid(vs2ps.a);
+
+   if (delta != vec3(0.0)) {
+  color = vec4(1.0, delta.x + 0.5, delta.y + 0.5, delta.z + 0.5);
+   } else {
+  color = vec4(vs2ps.b.x, vs2ps.b.y, 0.0, 1.0);
+   }
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.20.1

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


Re: [Piglit] [PATCH] Test that ES frag shader with invariant outputs compiles

2019-01-09 Thread Timothy Arceri

On 10/1/19 4:35 am, Danylo Piliaiev wrote:

In all GLSL ES versions output variables in fragment shader are allowed
to be invariant.

  From Section 4.6.1 ("The Invariant Qualifier") GLSL ES 1.00 spec:
  "Only the following variables may be declared as invariant:
...
- Built-in special variables output from the fragment shader."

  From Section 4.6.1 ("The Invariant Qualifier") GLSL ES 3.00 spec:
  "Only variables output from a shader can be candidates for invariance."

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

Signed-off-by: Danylo Piliaiev 
---
  .../glslparsertest/shaders/invariant.V100.frag | 18 ++
  .../glslparsertest/shaders/invariant.V300.frag | 16 



New tests should not go in this dir. Please put them in

tests/spec/glsl-es-1.00/compiler/invariant.frag
tests/spec/glsl-es-3.00/compiler/invariant.frag


  2 files changed, 34 insertions(+)
  create mode 100644 tests/glslparsertest/shaders/invariant.V100.frag
  create mode 100644 tests/glslparsertest/shaders/invariant.V300.frag

diff --git a/tests/glslparsertest/shaders/invariant.V100.frag 
b/tests/glslparsertest/shaders/invariant.V100.frag
new file mode 100644
index 0..a6463d1dd
--- /dev/null
+++ b/tests/glslparsertest/shaders/invariant.V100.frag
@@ -0,0 +1,18 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.00
+//
+// [end config]
+
+/* From Section 4.6.1 ("The Invariant Qualifier") GLSL ES 1.00 spec:
+ *
+ * "Only the following variables may be declared as invariant:
+ *  Built-in special variables output from the fragment shader."
+ */
+
+#version 100
+
+invariant gl_FragColor;
+invariant gl_FragData;
+
+void main() { }
diff --git a/tests/glslparsertest/shaders/invariant.V300.frag 
b/tests/glslparsertest/shaders/invariant.V300.frag
new file mode 100644
index 0..8d7707d8c
--- /dev/null
+++ b/tests/glslparsertest/shaders/invariant.V300.frag
@@ -0,0 +1,16 @@
+// [config]
+// expect_result: pass
+// glsl_version: 3.00
+//
+// [end config]
+
+/* From Section 4.6.1 ("The Invariant Qualifier") GLSL ES 3.00 spec:
+ *
+ * "Only variables output from a shader can be candidates for invariance."
+ */
+
+#version 300 es
+
+invariant out highp vec4 test;
+
+void main() { }


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


[Piglit] [PATCH 1/2] glsl-1.10: test unrolling loops with variable iteration limits

2018-12-06 Thread Timothy Arceri
This tests unrolling of some loops with a single exit point but where the
exact trip count is unknown, only the max iteration count is known.
---
 ...ariable-iteration-limit-unroll.shader_test | 62 
 ...riable-iteration-limit-unroll2.shader_test | 73 +++
 2 files changed, 135 insertions(+)
 create mode 100644 
tests/spec/glsl-1.10/execution/vs-loop-variable-iteration-limit-unroll.shader_test
 create mode 100644 
tests/spec/glsl-1.10/execution/vs-loop-variable-iteration-limit-unroll2.shader_test

diff --git 
a/tests/spec/glsl-1.10/execution/vs-loop-variable-iteration-limit-unroll.shader_test
 
b/tests/spec/glsl-1.10/execution/vs-loop-variable-iteration-limit-unroll.shader_test
new file mode 100644
index 0..588abe011
--- /dev/null
+++ 
b/tests/spec/glsl-1.10/execution/vs-loop-variable-iteration-limit-unroll.shader_test
@@ -0,0 +1,62 @@
+# This tests unrolling of a loop with a single exit point but where the
+# exact trip count is unknown, only the max iteration count (4) is known.
+#
+# Here we test all possible outcomes for the loop and also add some
+# unreachable code to make sure it is not accessible after unrolling.
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+uniform int loop_count;
+
+void main()
+{
+  vec4 colour_array[4];
+
+  colour_array[0] = vec4(0.0, 0.25, 0.0, 1.0);
+  colour_array[1] = vec4(0.0, 0.5, 0.0, 1.0);
+  colour_array[2] = vec4(0.0, 0.75, 0.0, 1.0);
+  colour_array[3] = vec4(0.0, 1.0, 0.0, 1.0);
+
+  gl_Position = gl_Vertex;
+
+  vec4 colour = vec4(1.0, 1.0, 1.0, 1.0);
+  for (int i = 0; i < loop_count; i++) {
+colour = colour_array[i];
+  }
+
+  gl_FrontColor = colour;
+}
+
+[fragment shader]
+void main()
+{
+  gl_FragColor = gl_Color;
+}
+
+[test]
+clear color 0.5 0.5 0.5 0.5
+
+uniform int loop_count 0
+draw rect -1 -1 2 2
+probe all rgba 1.0 1.0 1.0 1.0
+
+uniform int loop_count 1
+draw rect -1 -1 2 2
+probe all rgba 0.0 0.25 0.0 1.0
+
+uniform int loop_count 2
+draw rect -1 -1 2 2
+probe all rgba 0.0 0.5 0.0 1.0
+
+uniform int loop_count 3
+draw rect -1 -1 2 2
+probe all rgba 0.0 0.75 0.0 1.0
+
+uniform int loop_count 4
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform int loop_count 5
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git 
a/tests/spec/glsl-1.10/execution/vs-loop-variable-iteration-limit-unroll2.shader_test
 
b/tests/spec/glsl-1.10/execution/vs-loop-variable-iteration-limit-unroll2.shader_test
new file mode 100644
index 0..b05bcb8ed
--- /dev/null
+++ 
b/tests/spec/glsl-1.10/execution/vs-loop-variable-iteration-limit-unroll2.shader_test
@@ -0,0 +1,73 @@
+# This tests unrolling of a loop with a single exit point but where the
+# exact trip count is unknown, only the max iteration count (4) is known.
+#
+# Here we test all possible outcomes for the loop and also add some
+# unreachable code to make sure it is not accessible after unrolling.
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+uniform int loop_count;
+
+void main()
+{
+  gl_Position = gl_Vertex;
+
+  vec4 colour = vec4(1.0, 1.0, 1.0, 1.0);
+
+  int i = 0;
+  while (i < loop_count && i < 4) {
+if (i == 0)
+  colour = vec4(0.0, 0.25, 0.0, 1.0);
+
+if (i == 1)
+  colour = vec4(0.0, 0.5, 0.0, 1.0);
+
+if (i == 2)
+  colour = vec4(0.0, 0.75, 0.0, 1.0);
+
+if (i == 3)
+  colour = vec4(0.0, 1.0, 0.0, 1.0);
+
+/* This should be unreachable */
+if (i >= 4)
+  colour = vec4(1.0, 0.0, 0.0, 1.0);
+
+i++;
+  }
+
+  gl_FrontColor = colour;
+}
+
+[fragment shader]
+void main()
+{
+  gl_FragColor = gl_Color;
+}
+
+[test]
+clear color 0.5 0.5 0.5 0.5
+
+uniform int loop_count 0
+draw rect -1 -1 2 2
+probe all rgba 1.0 1.0 1.0 1.0
+
+uniform int loop_count 1
+draw rect -1 -1 2 2
+probe all rgba 0.0 0.25 0.0 1.0
+
+uniform int loop_count 2
+draw rect -1 -1 2 2
+probe all rgba 0.0 0.5 0.0 1.0
+
+uniform int loop_count 3
+draw rect -1 -1 2 2
+probe all rgba 0.0 0.75 0.0 1.0
+
+uniform int loop_count 4
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform int loop_count 5
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.19.2

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


[Piglit] [PATCH 2/2] glsl-1.10: test unrolling of loop where max iteration count guessed

2018-12-06 Thread Timothy Arceri
This tests unrolling of a loop with a single exit point where the
exact trip count is unknown, but the max iteration count can be
guessed using the size of an array indexed via the induction
variable.
---
 .../vs-loop-array-index-unroll.shader_test| 58 +++
 1 file changed, 58 insertions(+)
 create mode 100644 
tests/spec/glsl-1.10/execution/vs-loop-array-index-unroll.shader_test

diff --git 
a/tests/spec/glsl-1.10/execution/vs-loop-array-index-unroll.shader_test 
b/tests/spec/glsl-1.10/execution/vs-loop-array-index-unroll.shader_test
new file mode 100644
index 0..f123ab664
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/vs-loop-array-index-unroll.shader_test
@@ -0,0 +1,58 @@
+# This tests unrolling of a loop with a single exit point where the exact trip
+# count is unknown, but the max iteration count can be guessed using the size
+# of an array indexed via the induction variable.
+#
+# Here we test all possible (defined) outcomes for the loop.
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+uniform int loop_count;
+
+void main()
+{
+  vec4 colour_array[4];
+
+  colour_array[0] = vec4(0.0, 0.25, 0.0, 1.0);
+  colour_array[1] = vec4(0.0, 0.5, 0.0, 1.0);
+  colour_array[2] = vec4(0.0, 0.75, 0.0, 1.0);
+  colour_array[3] = vec4(0.0, 1.0, 0.0, 1.0);
+
+  gl_Position = gl_Vertex;
+
+  vec4 colour = vec4(1.0, 1.0, 1.0, 1.0);
+  for (int i = 0; i < loop_count; i++) {
+colour = colour_array[i];
+  }
+
+  gl_FrontColor = colour;
+}
+
+[fragment shader]
+void main()
+{
+  gl_FragColor = gl_Color;
+}
+
+[test]
+clear color 0.5 0.5 0.5 0.5
+
+uniform int loop_count 0
+draw rect -1 -1 2 2
+probe all rgba 1.0 1.0 1.0 1.0
+
+uniform int loop_count 1
+draw rect -1 -1 2 2
+probe all rgba 0.0 0.25 0.0 1.0
+
+uniform int loop_count 2
+draw rect -1 -1 2 2
+probe all rgba 0.0 0.5 0.0 1.0
+
+uniform int loop_count 3
+draw rect -1 -1 2 2
+probe all rgba 0.0 0.75 0.0 1.0
+
+uniform int loop_count 4
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.19.2

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


Re: [Piglit] [PATCH] glsl-1.10: add tests for an array index on a swizzled vec lvalue

2018-10-07 Thread Timothy Arceri

Reviewed-by: Timothy Arceri 

On 6/10/18 10:58 am, Ilia Mirkin wrote:

Current mesa fails both of these (in different ways!).

Inspired by WebGL conformance test
conformance2/glsl3/vector-dynamic-indexing-swizzled-lvalue.html

Signed-off-by: Ilia Mirkin 
---
  .../swizzled-writemask-indexing-nonconst.shader_test| 17 +
  .../execution/swizzled-writemask-indexing.shader_test   | 15 +++
  2 files changed, 32 insertions(+)
  create mode 100644 
tests/spec/glsl-1.10/execution/swizzled-writemask-indexing-nonconst.shader_test
  create mode 100644 
tests/spec/glsl-1.10/execution/swizzled-writemask-indexing.shader_test

diff --git 
a/tests/spec/glsl-1.10/execution/swizzled-writemask-indexing-nonconst.shader_test
 
b/tests/spec/glsl-1.10/execution/swizzled-writemask-indexing-nonconst.shader_test
new file mode 100644
index 0..fa1f7df58
--- /dev/null
+++ 
b/tests/spec/glsl-1.10/execution/swizzled-writemask-indexing-nonconst.shader_test
@@ -0,0 +1,17 @@
+[require]
+GLSL >= 1.10
+
+[vertex shader passthrough]
+
+[fragment shader]
+uniform int zero;
+void main() {
+gl_FragColor = vec4(1, 0, 0, 1);
+gl_FragColor.wzyx[zero + 2] = 1.0;
+gl_FragColor.wzyx[zero + 3] = 0.0;
+}
+
+[test]
+uniform int zero 0
+draw rect -1 -1 2 2
+probe all rgba 0 1 0 1
diff --git 
a/tests/spec/glsl-1.10/execution/swizzled-writemask-indexing.shader_test 
b/tests/spec/glsl-1.10/execution/swizzled-writemask-indexing.shader_test
new file mode 100644
index 0..f61ebabb8
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/swizzled-writemask-indexing.shader_test
@@ -0,0 +1,15 @@
+[require]
+GLSL >= 1.10
+
+[vertex shader passthrough]
+
+[fragment shader]
+void main() {
+gl_FragColor = vec4(1, 0, 0, 1);
+gl_FragColor.wzyx[2] = 1.0;
+gl_FragColor.wzyx[3] = 0.0;
+}
+
+[test]
+draw rect -1 -1 2 2
+probe all rgba 0 1 0 1


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


Re: [Piglit] [PATCH piglit] idTech: fix extensions string list

2018-10-07 Thread Timothy Arceri

Reviewed-by: Timothy Arceri 

On 8/10/18 3:26 am, Eric Engestrom wrote:

From: Eric Engestrom 

CID: 1439995
Fixes: f787ad0b60869f969f02d "Add tests for GL_EXTENSION_STRING vs. old
   idTech2 / idTech3 games"
Cc: Ian Romanick 
Signed-off-by: Eric Engestrom 
---
  tests/general/idtech-extension-strings.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/general/idtech-extension-strings.c 
b/tests/general/idtech-extension-strings.c
index 83eaed8ce36a21ee5ecc..194ee5e144f1d105acef 100644
--- a/tests/general/idtech-extension-strings.c
+++ b/tests/general/idtech-extension-strings.c
@@ -79,7 +79,7 @@ const char *const q3demo_list[] = {
  const char *const star_trek_voyager_list[] = {
"GL_S3_s3tc",
"GL_EXT_texture_compression_s3tc",
-   "GL_EXT_texture_env_add"
+   "GL_EXT_texture_env_add",
"GL_EXT_texture_filter_anisotropic",
"GL_EXT_texture_edge_clamp",
"GL_ARB_multitexture",


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


Re: [Piglit] [PATCH 12/17] arb_gl_spirv: add ubo array test with different array_stride

2018-09-20 Thread Timothy Arceri

On 16/9/18 2:22 am, Alejandro Piñeiro wrote:

For more info, see the long explanation at the commit "arb_gl_spirv:
add ubo matrix test with different matrix_stride"
---
  .../array-different-array-stride-ubo.shader_test   | 147 +
  1 file changed, 147 insertions(+)
  create mode 100644 
tests/spec/arb_gl_spirv/execution/ubo/array-different-array-stride-ubo.shader_test

diff --git 
a/tests/spec/arb_gl_spirv/execution/ubo/array-different-array-stride-ubo.shader_test
 
b/tests/spec/arb_gl_spirv/execution/ubo/array-different-array-stride-ubo.shader_test
new file mode 100644
index 0..0638864b2
--- /dev/null
+++ 
b/tests/spec/arb_gl_spirv/execution/ubo/array-different-array-stride-ubo.shader_test
@@ -0,0 +1,147 @@
+# UBO test using two ubos, with an array with the same size and type,
+# but setting a different array stride for each one. Used to test that
+# the size is properly computed, and the content properly accessed in
+# both cases.
+
+[require]
+SPIRV ONLY
+GL >= 3.3
+GLSL >= 3.30
+
+[vertex shader passthrough]
+
+[fragment shader spirv]
+; Automatically generated from the GLSL by shader_test_spirv.py, and then 
edited by hand to set the proper array stride
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 47
+; Schema: 0
+   OpCapability Shader
+  %1 = OpExtInstImport "GLSL.std.450"
+   OpMemoryModel Logical GLSL450
+   OpEntryPoint Fragment %main "main" %color
+   OpExecutionMode %main OriginLowerLeft
+   OpSource GLSL 450
+   OpName %_ ""
+   OpName %__0 ""
+   OpDecorate %color Location 0
+   OpDecorate %_arr_v4float_uint_3 ArrayStride 16
+   OpMemberDecorate %block16 0 Offset 0
+   OpDecorate %block16 Block
+   OpDecorate %_ DescriptorSet 0
+   OpDecorate %_ Binding 5
+   OpDecorate %_arr_v4float_uint_3_0 ArrayStride 32
+   OpMemberDecorate %block32 0 Offset 0
+   OpDecorate %block32 Block
+   OpDecorate %__0 DescriptorSet 0
+   OpDecorate %__0 Binding 6
+   %void = OpTypeVoid
+  %3 = OpTypeFunction %void
+  %float = OpTypeFloat 32
+%v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+  %color = OpVariable %_ptr_Output_v4float Output
+   %uint = OpTypeInt 32 0
+ %uint_3 = OpConstant %uint 3
+%_arr_v4float_uint_3 = OpTypeArray %v4float %uint_3
+%block16 = OpTypeStruct %_arr_v4float_uint_3
+%_ptr_Uniform_block16 = OpTypePointer Uniform %block16
+  %_ = OpVariable %_ptr_Uniform_block16 Uniform
+%int = OpTypeInt 32 1
+  %int_0 = OpConstant %int 0
+%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
+  %int_1 = OpConstant %int 1
+  %int_2 = OpConstant %int 2
+%_arr_v4float_uint_3_0 = OpTypeArray %v4float %uint_3
+%block32 = OpTypeStruct %_arr_v4float_uint_3_0
+%_ptr_Uniform_block32 = OpTypePointer Uniform %block32
+%__0 = OpVariable %_ptr_Uniform_block32 Uniform
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+ %44 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_0
+   %main = OpFunction %void None %3
+  %5 = OpLabel
+ %19 = OpAccessChain %_ptr_Uniform_v4float %_ %int_0 %int_0
+ %20 = OpLoad %v4float %19
+ %22 = OpAccessChain %_ptr_Uniform_v4float %_ %int_0 %int_1
+ %23 = OpLoad %v4float %22
+ %24 = OpFAdd %v4float %20 %23
+ %26 = OpAccessChain %_ptr_Uniform_v4float %_ %int_0 %int_2
+ %27 = OpLoad %v4float %26
+ %28 = OpFAdd %v4float %24 %27
+ %33 = OpAccessChain %_ptr_Uniform_v4float %__0 %int_0 %int_0
+ %34 = OpLoad %v4float %33
+ %35 = OpFSub %v4float %28 %34
+ %36 = OpAccessChain %_ptr_Uniform_v4float %__0 %int_0 %int_1
+ %37 = OpLoad %v4float %36
+ %38 = OpFSub %v4float %35 %37
+ %39 = OpAccessChain %_ptr_Uniform_v4float %__0 %int_0 %int_2
+ %40 = OpLoad %v4float %39
+ %41 = OpFSub %v4float %38 %40
+   OpStore %color %41
+ %45 = OpLoad %v4float %color
+ %46 = OpFAdd %v4float %45 %44
+   OpStore %color %46
+   OpReturn
+   OpFunctionEnd
+
+[fragment shader]
+#version 450
+
+layout (location = 0) out vec4 color;
+
+layout (std140, binding = 5) uniform block16 {
+   vec4 arr16[3];
+};
+
+/*
+ * This array will have a array_stride of 32.
+ *
+ * Note that there is no way to set a explicit array_stride on GLSL. This GLSL
+ * was used initially to generate the SPIRV-V, and then array stride was 
tweaked.
+ * That's the reason this is a SPIRV ONLY test. GLSL here is just as reference.
+ */
+layout (std140, binding = 6) uniform block32 {
+   vec4 arr32[3];
+};
+
+
+void main()
+{
+   color = arr16[0] + arr16[1] + arr16[2] - arr32[0] - 

Re: [Piglit] [PATCH v2] glsl-1.10: add a 'initialization-incompatible-type-propagation' test

2018-09-19 Thread Timothy Arceri

Thanks for the update!

I've pushed this and the Mesa patches.

On 20/9/18 2:02 am, Danylo Piliaiev wrote:

These tests test the case when initialising with incompatible type
changed a type of the variable being initialized.
While main manifestation of the issue is overly verbose and incorrect
error message it did result in a crash in case of second test.

v2: Splitted the test in several ones (Timothy Arceri)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107547
Signed-off-by: Danylo Piliaiev 
---
  ...ation-incompatible-type-propagation-1.frag | 17 +++
  ...ation-incompatible-type-propagation-2.frag | 21 +++
  ...ation-incompatible-type-propagation-3.frag | 21 +++
  3 files changed, 59 insertions(+)
  create mode 100644 
tests/spec/glsl-1.10/compiler/initialization-incompatible-type-propagation-1.frag
  create mode 100644 
tests/spec/glsl-1.10/compiler/initialization-incompatible-type-propagation-2.frag
  create mode 100644 
tests/spec/glsl-1.10/compiler/initialization-incompatible-type-propagation-3.frag

diff --git 
a/tests/spec/glsl-1.10/compiler/initialization-incompatible-type-propagation-1.frag
 
b/tests/spec/glsl-1.10/compiler/initialization-incompatible-type-propagation-1.frag
new file mode 100644
index 0..df102c754
--- /dev/null
+++ 
b/tests/spec/glsl-1.10/compiler/initialization-incompatible-type-propagation-1.frag
@@ -0,0 +1,17 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.10
+// [end config]
+//
+// Initializing a variable using the variable with a wrong type
+// should not affect the type of the variable being initialized.
+// While we cannot check emitted error message the test at least
+// should not crash, see bug:
+// https://bugs.freedesktop.org/show_bug.cgi?id=107547
+
+#version 110
+
+void f() {
+vec4 a = vec2(0.0);
+a.w -= 1.0;
+}
diff --git 
a/tests/spec/glsl-1.10/compiler/initialization-incompatible-type-propagation-2.frag
 
b/tests/spec/glsl-1.10/compiler/initialization-incompatible-type-propagation-2.frag
new file mode 100644
index 0..2ca8df4a3
--- /dev/null
+++ 
b/tests/spec/glsl-1.10/compiler/initialization-incompatible-type-propagation-2.frag
@@ -0,0 +1,21 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.10
+// [end config]
+//
+// Initializing a variable using the variable with a wrong type
+// should not affect the type of the variable being initialized.
+// While we cannot check emitted error message the test at least
+// should not crash, see bug:
+// https://bugs.freedesktop.org/show_bug.cgi?id=107547
+
+#version 110
+
+uniform struct {
+float field;
+} data;
+
+void f() {
+vec2 a = data;
+a.x -= 1.0;
+}
diff --git 
a/tests/spec/glsl-1.10/compiler/initialization-incompatible-type-propagation-3.frag
 
b/tests/spec/glsl-1.10/compiler/initialization-incompatible-type-propagation-3.frag
new file mode 100644
index 0..449fab8cd
--- /dev/null
+++ 
b/tests/spec/glsl-1.10/compiler/initialization-incompatible-type-propagation-3.frag
@@ -0,0 +1,21 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.10
+// [end config]
+//
+// Initializing a variable using the variable with a wrong type
+// should not affect the type of the variable being initialized.
+// While we cannot check emitted error message the test at least
+// should not crash, see bug:
+// https://bugs.freedesktop.org/show_bug.cgi?id=107547
+
+#version 110
+
+struct Data {
+float field;
+};
+
+void f() {
+Data a = vec2(0.0);
+a.field -= 1.0;
+}


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


Re: [Piglit] [PATCH] glsl-1.10: add a 'initialization-incompatible-type-propagation' test

2018-09-17 Thread Timothy Arceri

On 17/9/18 7:56 pm, Danylo Piliaiev wrote:

On 9/17/18 12:28 PM, Timothy Arceri wrote:

On 16/8/18 12:23 am, Danylo Piliaiev wrote:

This tests the case when initialising with incompatible type
changed a type of the variable being initialized.

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

Signed-off-by: Danylo Piliaiev 
---
I'm not sure if it's a proper way to test this. The compilation is 
intended to
fail but the difference is in the error messages. The correct message 
is an
error in initialization line and no errors in accessing to the 
variables,

incorrect - additional errors where variables are accessed.
At the moment it tests only that compiler wouldn't crash which happened
in the mentioned bug and fix proposed in
https://patchwork.freedesktop.org/series/48256/

  ...ization-incompatible-type-propagation.frag | 27 +++
  1 file changed, 27 insertions(+)
  create mode 100644 
tests/spec/glsl-1.10/compiler/initialization-incompatible-type-propagation.frag 



diff --git 
a/tests/spec/glsl-1.10/compiler/initialization-incompatible-type-propagation.frag 
b/tests/spec/glsl-1.10/compiler/initialization-incompatible-type-propagation.frag 


new file mode 100644
index 0..0a1873489
--- /dev/null
+++ 
b/tests/spec/glsl-1.10/compiler/initialization-incompatible-type-propagation.frag 


@@ -0,0 +1,27 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.10
+// [end config]
+//
+// Initializing a variable using the variable with a wrong type
+// should not affect the type of the variable being initialized.
+// At least it should not crash, see bug:
+// https://bugs.freedesktop.org/show_bug.cgi?id=107547
+//
+// From section 5.8 of the GLSL 1.10 spec:
+// The assignment operator stores the value of expression into 
lvalue.
+// It will compile only if expression and lvalue have the same 
type.

+
+#version 110
+
+uniform struct {
+    float field;
+} data;
+
+int f() {
+    vec4 a = vec2(0.0);
+    a.w -= 1.0; > +
+    vec2 b = data;
+    b.x -= 1.0;


This looks like it should be split into two different tests. Is there 
any reason you included both tests together?
The reason was is that the only thing that is tested here is that Mesa 
doesn't crash when compiling the shader.
Testing whether the assignment of an incompatible type produces an error 
is on the other tests.
I'm not sure at this moment if that was a good reason. I can split it 
into two tests if you find it necessary.


Regardless of what you are testing you still have two tests here. If 
they can both trigger a segfault in different paths they should be spilt 
in two. If they both test the a segfault in the same place then we 
should probably simplify the test.





+}




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


Re: [Piglit] [PATCH] glsl-1.10: add a 'initialization-incompatible-type-propagation' test

2018-09-17 Thread Timothy Arceri

On 16/8/18 12:23 am, Danylo Piliaiev wrote:

This tests the case when initialising with incompatible type
changed a type of the variable being initialized.

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

Signed-off-by: Danylo Piliaiev 
---
I'm not sure if it's a proper way to test this. The compilation is intended to
fail but the difference is in the error messages. The correct message is an
error in initialization line and no errors in accessing to the variables,
incorrect - additional errors where variables are accessed.
At the moment it tests only that compiler wouldn't crash which happened
in the mentioned bug and fix proposed in
https://patchwork.freedesktop.org/series/48256/

  ...ization-incompatible-type-propagation.frag | 27 +++
  1 file changed, 27 insertions(+)
  create mode 100644 
tests/spec/glsl-1.10/compiler/initialization-incompatible-type-propagation.frag

diff --git 
a/tests/spec/glsl-1.10/compiler/initialization-incompatible-type-propagation.frag
 
b/tests/spec/glsl-1.10/compiler/initialization-incompatible-type-propagation.frag
new file mode 100644
index 0..0a1873489
--- /dev/null
+++ 
b/tests/spec/glsl-1.10/compiler/initialization-incompatible-type-propagation.frag
@@ -0,0 +1,27 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.10
+// [end config]
+//
+// Initializing a variable using the variable with a wrong type
+// should not affect the type of the variable being initialized.
+// At least it should not crash, see bug:
+// https://bugs.freedesktop.org/show_bug.cgi?id=107547
+//
+// From section 5.8 of the GLSL 1.10 spec:
+// The assignment operator stores the value of expression into lvalue.
+// It will compile only if expression and lvalue have the same type.
+
+#version 110
+
+uniform struct {
+float field;
+} data;
+
+int f() {
+vec4 a = vec2(0.0);
+a.w -= 1.0; > +
+vec2 b = data;
+b.x -= 1.0;


This looks like it should be split into two different tests. Is there 
any reason you included both tests together?



+}


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


Re: [Piglit] [PATCH 2/4] glsl-1.20/fs-deref-literal-array-of-structs-with-multiple-members-large-array: Fix it

2018-09-14 Thread Timothy Arceri
Whoops I probably did something silly like forgot to commit the rest of 
the changes to that test.


Reviewed-by: Timothy Arceri 

On 14/9/18 4:10 am, Nicolai Hähnle wrote:

From: Nicolai Hähnle 

Hard to believe that this was never noticed...
---
  ...f-structs-with-multiple-members-large-array.shader_test | 7 +++
  1 file changed, 3 insertions(+), 4 deletions(-)

diff --git 
a/tests/spec/glsl-1.20/execution/fs-deref-literal-array-of-structs-with-multiple-members-large-array.shader_test
 
b/tests/spec/glsl-1.20/execution/fs-deref-literal-array-of-structs-with-multiple-members-large-array.shader_test
index ff2b34da7..96cf0bfa6 100644
--- 
a/tests/spec/glsl-1.20/execution/fs-deref-literal-array-of-structs-with-multiple-members-large-array.shader_test
+++ 
b/tests/spec/glsl-1.20/execution/fs-deref-literal-array-of-structs-with-multiple-members-large-array.shader_test
@@ -12,21 +12,21 @@ GLSL >= 1.20
  [vertex shader]
  void main()
  {
gl_Position = gl_Vertex;
  }
  
  [fragment shader]

  struct Foo {
int value;
  
-  /* A second member of a differnt size ensures we calculate member offsets

+  /* A second member of a different size ensures we calculate member offsets
 * correctly.
 */
ivec2 value2;
  };
  
  uniform int i;

  uniform ivec2 expected_value;
  
  void main()

  {
@@ -40,18 +40,17 @@ void main()
  gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
  }
  
  [test]

  uniform int i 0
  uniform ivec2 expected_value 200 300
  draw rect -1 -1 1 1
  uniform int i 1
  uniform ivec2 expected_value 500 600
  draw rect 0 -1 1 1
-probe all rgba 0.0 1.0 0.0 1.0
-uniform int i 0
+uniform int i 2
  uniform ivec2 expected_value 800 900
  draw rect -1 0 1 1
-uniform int i 1
+uniform int i 3
  uniform ivec2 expected_value 1100 1200
  draw rect 0 0 1 1
  probe all rgba 0.0 1.0 0.0 1.0


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


Re: [Piglit] [PATCH 1/4] fbo-drawbuffers-maxtargets: fix a warning

2018-09-14 Thread Timothy Arceri

On 14/9/18 4:10 am, Nicolai Hähnle wrote:

From: Nicolai Hähnle 

Ensure that the allocated buffer is guaranteed to be big enough.
---
  tests/fbo/fbo-drawbuffers-maxtargets.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/fbo/fbo-drawbuffers-maxtargets.c 
b/tests/fbo/fbo-drawbuffers-maxtargets.c
index f5e2a48ed..5d5a09f62 100644
--- a/tests/fbo/fbo-drawbuffers-maxtargets.c
+++ b/tests/fbo/fbo-drawbuffers-maxtargets.c
@@ -137,21 +137,21 @@ generate_and_display_drawbuffers(int count)
  
  	glDrawBuffersARB(count, attachments);
  
  	/* Clear all to red so we see if the shader rendering happens. */

glClearColor(1.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
  
  	/* Build the shader that writes different color to each buffer. */

vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
  
-	fs_count_source = malloc(strlen(fs_source) + 5);

+   fs_count_source = malloc(strlen(fs_source) + 10);


max_targets is clamped to 16 so it's not really needed is it?

I guess it won't hurt though.

Acked-by: Timothy Arceri 


sprintf(fs_count_source, fs_source, count);
fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_count_source);
free(fs_count_source);
  
  	prog = piglit_link_simple_program(vs, fs);

glUseProgram(prog);
  
  	if (!piglit_check_gl_error(GL_NO_ERROR))

piglit_report_result(PIGLIT_FAIL);
  


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


Re: [Piglit] [PATCH] glsl-1.10: Put an if-statement in a macro in the false path of an ifdef

2018-08-31 Thread Timothy Arceri

Thanks!

I believe I have a fix I'm just running it in CI to confirm it doesn't 
cause any other issues.


Reviewed-by: Timothy Arceri 

On 01/09/18 03:49, Ian Romanick wrote:

From: Ian Romanick 

Signed-off-by: Ian Romanick 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107772
Cc: Timothy Arceri 
Cc: Eero Tamminen 
Cc: Mark Janes 
---
  .../if-statement-in-macro-in-false-ifdef.vert  | 18 ++
  1 file changed, 18 insertions(+)
  create mode 100644 
tests/spec/glsl-1.10/preprocessor/if-statement-in-macro-in-false-ifdef.vert

diff --git 
a/tests/spec/glsl-1.10/preprocessor/if-statement-in-macro-in-false-ifdef.vert 
b/tests/spec/glsl-1.10/preprocessor/if-statement-in-macro-in-false-ifdef.vert
new file mode 100644
index 0..938fe31f8
--- /dev/null
+++ 
b/tests/spec/glsl-1.10/preprocessor/if-statement-in-macro-in-false-ifdef.vert
@@ -0,0 +1,18 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.10
+// [end config]
+//
+// Reproduces https://bugs.freedesktop.org/show_bug.cgi?id=107772
+
+#version 110
+
+#ifdef NOT_DEFINED
+#define A_MACRO(x) \
+   if (x)
+#endif
+
+void main()
+{
+gl_Position = vec4(0);
+}


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


Re: [Piglit] [PATCH] glsl-1.30: add linker test for inter stage in/out vars usage

2018-08-29 Thread Timothy Arceri

On 28/08/18 17:19, Vadim Shovkoplias wrote:

Hi Timothy,

Thanks for the review! Can you please push this patch ?


Pushed. Thanks for the patch.



вт, 28 авг. 2018 г. в 3:45, Timothy Arceri <mailto:tarc...@itsqueeze.com>>:


Reviewed-by: Timothy Arceri mailto:tarc...@itsqueeze.com>>

On 27/08/18 22:19, Vadym Shovkoplias wrote:
 > This test exposes a Mesa GLSL linker bug. The test fails with the
 > following error message:
 >
 >     error: fragment shader input `foo' has no matching output in
the previous
 >            stage
 >
 > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105731
 > Signed-off-by: Vadym Shovkoplias
mailto:vadym.shovkopl...@globallogic.com>>
 > ---
 >   ...rstage-multiple-vertex-objects.shader_test | 33
+++
 >   1 file changed, 33 insertions(+)
 >   create mode 100644
tests/spec/glsl-1.30/linker/interstage-multiple-vertex-objects.shader_test
 >
 > diff --git
a/tests/spec/glsl-1.30/linker/interstage-multiple-vertex-objects.shader_test
b/tests/spec/glsl-1.30/linker/interstage-multiple-vertex-objects.shader_test
 > new file mode 100644
 > index 0..dd168d434
 > --- /dev/null
 > +++
b/tests/spec/glsl-1.30/linker/interstage-multiple-vertex-objects.shader_test
 > @@ -0,0 +1,33 @@
 > +# Exercises a Mesa GLSL linker bug.
 > +#
 > +# Output "foo" variable is not used in the "main" vertex shader
 > +# but used in fragment shader
 > +
 > +[require]
 > +GLSL >= 1.30
 > +
 > +[vertex shader]
 > +out vec4 foo;
 > +void unused()
 > +{
 > +    foo=vec4(1);
 > +}
 > +
 > +[vertex shader]
 > +in vec4 pos;
 > +void main()
 > +{
 > +    gl_Position = pos;
 > +}
 > +
 > +[fragment shader]
 > +in vec4 foo;
 > +out vec4 color;
 > +
 > +void main()
 > +{
 > +    gl_FragColor=foo;
 > +}
 > +
 > +[test]
 > +link success
 >


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


[Piglit] [PATCH] glsl-1.10: add some preprocessor stringification tests

2018-08-28 Thread Timothy Arceri
From Section 3.3. (Preprocessor) of the GLSL 4.60 spec:

"The following operators are also available:
defined
##
...

Any directive not listed above will cause a compile-time error."
---
 .../stringification-in-unreachable-branch.frag   | 12 
 .../compiler/preprocessor/stringification.frag   | 10 ++
 2 files changed, 22 insertions(+)
 create mode 100644 
tests/spec/glsl-1.10/compiler/preprocessor/stringification-in-unreachable-branch.frag
 create mode 100644 
tests/spec/glsl-1.10/compiler/preprocessor/stringification.frag

diff --git 
a/tests/spec/glsl-1.10/compiler/preprocessor/stringification-in-unreachable-branch.frag
 
b/tests/spec/glsl-1.10/compiler/preprocessor/stringification-in-unreachable-branch.frag
new file mode 100644
index 0..32b1798b8
--- /dev/null
+++ 
b/tests/spec/glsl-1.10/compiler/preprocessor/stringification-in-unreachable-branch.frag
@@ -0,0 +1,12 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.10
+// [end config]
+
+#version 110
+
+#ifdef this_is_undefined
+#define VEC4_STRING_PARAM(a, b, c, d) vec4(#a, #b, c, d)
+#endif
+
+void main() { }
diff --git a/tests/spec/glsl-1.10/compiler/preprocessor/stringification.frag 
b/tests/spec/glsl-1.10/compiler/preprocessor/stringification.frag
new file mode 100644
index 0..617ad102d
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/preprocessor/stringification.frag
@@ -0,0 +1,10 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.10
+// [end config]
+
+#version 110
+
+#define VEC4_STRING_PARAM(a, b, c, d) vec4(#a, #b, c, d)
+
+void main() { }
-- 
2.17.1

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


Re: [Piglit] [PATCH] glsl-1.30: add linker test for inter stage in/out vars usage

2018-08-27 Thread Timothy Arceri

Reviewed-by: Timothy Arceri 

On 27/08/18 22:19, Vadym Shovkoplias wrote:

This test exposes a Mesa GLSL linker bug. The test fails with the
following error message:

error: fragment shader input `foo' has no matching output in the previous
   stage

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105731
Signed-off-by: Vadym Shovkoplias 
---
  ...rstage-multiple-vertex-objects.shader_test | 33 +++
  1 file changed, 33 insertions(+)
  create mode 100644 
tests/spec/glsl-1.30/linker/interstage-multiple-vertex-objects.shader_test

diff --git 
a/tests/spec/glsl-1.30/linker/interstage-multiple-vertex-objects.shader_test 
b/tests/spec/glsl-1.30/linker/interstage-multiple-vertex-objects.shader_test
new file mode 100644
index 0..dd168d434
--- /dev/null
+++ b/tests/spec/glsl-1.30/linker/interstage-multiple-vertex-objects.shader_test
@@ -0,0 +1,33 @@
+# Exercises a Mesa GLSL linker bug.
+#
+# Output "foo" variable is not used in the "main" vertex shader
+# but used in fragment shader
+
+[require]
+GLSL >= 1.30
+
+[vertex shader]
+out vec4 foo;
+void unused()
+{
+foo=vec4(1);
+}
+
+[vertex shader]
+in vec4 pos;
+void main()
+{
+gl_Position = pos;
+}
+
+[fragment shader]
+in vec4 foo;
+out vec4 color;
+
+void main()
+{
+gl_FragColor=foo;
+}
+
+[test]
+link success


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


Re: [Piglit] [PATCH] arb_program_interface_query: fix array of arrays case

2018-08-21 Thread Timothy Arceri

On 21/08/18 21:38, asimiklit.w...@gmail.com wrote:


From: Andrii Simiklit 

According to spec:
"For an active variable declared as an array of an aggregate data type
 (structures or arrays), a separate entry will be generated for each
 active array element, unless noted immediately below ..."
Mesa should return valid index for 'vs_input2[1][0]' cases.
I believe the key word above is "active" yes they are separate but if 
I'm remembering this problem correctly they are not all active.


I believe this is a Mesa bug not a piglit bug, it was just tricky to fix and 
always a low priority.

See:https://bugs.freedesktop.org/show_bug.cgi?id=92822#c7



Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107639
Signed-off-by: Andrii Simiklit 
---
  tests/spec/arb_program_interface_query/getprogramresourceindex.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/spec/arb_program_interface_query/getprogramresourceindex.c 
b/tests/spec/arb_program_interface_query/getprogramresourceindex.c
index 16b38e2..92d9a90 100755
--- a/tests/spec/arb_program_interface_query/getprogramresourceindex.c
+++ b/tests/spec/arb_program_interface_query/getprogramresourceindex.c
@@ -167,8 +167,9 @@ static const struct subtest_index_t index_subtests[] = {
{   vs_aofa,  GL_PROGRAM_INPUT,  "vs_input2", 
false, -1, GL_NO_ERROR },
{   vs_aofa,  GL_PROGRAM_INPUT,   "vs_input2[0]",  
true, -1, GL_NO_ERROR },
{   vs_aofa,  GL_PROGRAM_INPUT,"vs_input2[0][0]",  
true, -1, GL_NO_ERROR },
-   {   vs_aofa,  GL_PROGRAM_INPUT,"vs_input2[1][0]", 
false, -1, GL_NO_ERROR },
+   {   vs_aofa,  GL_PROGRAM_INPUT,"vs_input2[1][0]",  
true, -1, GL_NO_ERROR },
{   vs_aofa,  GL_PROGRAM_INPUT,"vs_input2[0][1]", 
false, -1, GL_NO_ERROR },
+   {   vs_aofa,  GL_PROGRAM_INPUT,"vs_input2[1][1]", 
false, -1, GL_NO_ERROR },
{vs_sub,  GL_VERTEX_SUBROUTINE,"vss",  
true, -1, GL_NO_ERROR },
{vs_sub,  GL_VERTEX_SUBROUTINE,   "vss2",  
true, -1, GL_NO_ERROR },
{ vs_subidx,  GL_VERTEX_SUBROUTINE,"vss_idx",  
true,  5, GL_NO_ERROR },


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


Re: [Piglit] [PATCH 31/35] arb_gpu_shader5: Add support for testing spirv with XFB streams

2018-08-20 Thread Timothy Arceri

On 18/08/18 19:30, Alejandro Piñeiro wrote:

On 18/08/18 06:36, Timothy Arceri wrote:

On 18/08/18 14:32, Timothy Arceri wrote:

Won't this cause shader runner to needlessly parse the .shader_test
file?


True, good point. In any case, as the test lacks a [test] section, full
shader.py runs would just check if the test links (assuming that
ARB_gl_spirv are available). Having said so ...



The file extension is also confusing. Maybe we should name these type
of files .shader_source or something similar rather than .shader_test ???


... this makes sense. That name fits better, and would avoid the
previous issue. As that would be a small change, I will make the change
locally, while I wait for the review of the other patches.


I've skimmed over most of the series and I didn't see anything other 
than this that I had issue with. It's not very common to get a full 
review for a piglit series. The general rule is once its been on the 
list for a few weeks it's usually ok to push. After all it's better to 
have wrong tests that can be fixed later than to have no tests at all.


I understand the external dependency might have stopped you from just 
pushing but since its an optional dependency it's fine IMO.


Anyway for the series feel free to add:

Acked-by: Timothy Arceri 
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 31/35] arb_gpu_shader5: Add support for testing spirv with XFB streams

2018-08-17 Thread Timothy Arceri

On 18/08/18 14:32, Timothy Arceri wrote:

Won't this cause shader runner to needlessly parse the .shader_test file?


The file extension is also confusing. Maybe we should name these type of 
files .shader_source or something similar rather than .shader_test ???




On 09/08/18 21:36, Alejandro Piñeiro wrote:

From: Neil Roberts 

v2: use shader_test file with the spirv assembly, instead of include
 two SPIRV binaries (Alejandro Piñeiro)

Signed-off-by: Neil Roberts 
Signed-off-by: Alejandro Piñeiro 
---
  tests/opengl.py    |   1 +
  .../xfb_streams_without_invocations.shader_test    | 197 
+

  .../execution/xfb-streams-without-invocations.c    | 135 ++
  3 files changed, 300 insertions(+), 33 deletions(-)
  create mode 100644 
tests/spec/arb_gpu_shader5/execution/shader_test/xfb_streams_without_invocations.shader_test 



diff --git a/tests/opengl.py b/tests/opengl.py
index 064c43e08..9b1e09564 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -1969,6 +1969,7 @@ with profile.test_list.group_manager(
  g(['arb_gpu_shader5-emitstreamvertex_stream_too_large'])
  g(['arb_gpu_shader5-tf-wrong-stream-value'])
  g(['arb_gpu_shader5-xfb-streams-without-invocations'])
+    g(['arb_gpu_shader5-xfb-streams-without-invocations', 'spirv'])
  g(['arb_gpu_shader5-emitstreamvertex_nodraw'])
  g(['arb_gpu_shader5-interpolateAtCentroid'])
  g(['arb_gpu_shader5-interpolateAtCentroid-packing'])
diff --git 
a/tests/spec/arb_gpu_shader5/execution/shader_test/xfb_streams_without_invocations.shader_test 
b/tests/spec/arb_gpu_shader5/execution/shader_test/xfb_streams_without_invocations.shader_test 


new file mode 100644
index 0..6611e0bf8
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader5/execution/shader_test/xfb_streams_without_invocations.shader_test 


@@ -0,0 +1,197 @@
+[require]
+GLSL >= 4.50
+
+[vertex shader spirv]
+; Automatically generated from the GLSL by shader_test_spirv.py. DO 
NOT EDIT

+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 23
+; Schema: 0
+   OpCapability Shader
+  %1 = OpExtInstImport "GLSL.std.450"
+   OpMemoryModel Logical GLSL450
+   OpEntryPoint Vertex %main "main" %_ %gl_VertexID 
%gl_InstanceID

+   OpSource GLSL 450
+   OpName %_ ""
+   OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
+   OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
+   OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
+   OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance
+   OpDecorate %gl_PerVertex Block
+   OpDecorate %gl_VertexID BuiltIn VertexId
+   OpDecorate %gl_InstanceID BuiltIn InstanceId
+   %void = OpTypeVoid
+  %3 = OpTypeFunction %void
+  %float = OpTypeFloat 32
+    %v4float = OpTypeVector %float 4
+   %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_arr_float_uint_1 = OpTypeArray %float %uint_1
+%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 
%_arr_float_uint_1

+%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
+  %_ = OpVariable %_ptr_Output_gl_PerVertex Output
+    %int = OpTypeInt 32 1
+  %int_0 = OpConstant %int 0
+    %float_0 = OpConstant %float 0
+ %17 = OpConstantComposite %v4float %float_0 %float_0 
%float_0 %float_0

+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%_ptr_Input_int = OpTypePointer Input %int
+%gl_VertexID = OpVariable %_ptr_Input_int Input
+%gl_InstanceID = OpVariable %_ptr_Input_int Input
+   %main = OpFunction %void None %3
+  %5 = OpLabel
+ %19 = OpAccessChain %_ptr_Output_v4float %_ %int_0
+   OpStore %19 %17
+   OpReturn
+   OpFunctionEnd
+
+[vertex shader]
+#version 450
+
+void main() {
+ gl_Position = vec4(0.0);
+}
+
+
+[geometry shader spirv]
+; Automatically generated from the GLSL by shader_test_spirv.py. DO 
NOT EDIT

+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 41
+; Schema: 0
+   OpCapability Geometry
+   OpCapability TransformFeedback
+   OpCapability GeometryStreams
+  %1 = OpExtInstImport "GLSL.std.450"
+   OpMemoryModel Logical GLSL450
+   OpEntryPoint Geometry %main "main" %_ %gl_in 
%stream0_0_out %stream2_0_out %stream2_1_out %stream1_0_out

+   OpExecutionMode %main Xfb
+   OpExecutionMode %main InputPoints
+   OpExecutionMode %main Invocations 1
+   OpExecutionMode %main OutputPoints
+   OpExecutionMode %main OutputVertices 3
+   OpSource GLSL 450
+   OpName %_ ""
+   OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
+  

Re: [Piglit] [PATCH 31/35] arb_gpu_shader5: Add support for testing spirv with XFB streams

2018-08-17 Thread Timothy Arceri

Won't this cause shader runner to needlessly parse the .shader_test file?

On 09/08/18 21:36, Alejandro Piñeiro wrote:

From: Neil Roberts 

v2: use shader_test file with the spirv assembly, instead of include
 two SPIRV binaries (Alejandro Piñeiro)

Signed-off-by: Neil Roberts 
Signed-off-by: Alejandro Piñeiro 
---
  tests/opengl.py|   1 +
  .../xfb_streams_without_invocations.shader_test| 197 +
  .../execution/xfb-streams-without-invocations.c| 135 ++
  3 files changed, 300 insertions(+), 33 deletions(-)
  create mode 100644 
tests/spec/arb_gpu_shader5/execution/shader_test/xfb_streams_without_invocations.shader_test

diff --git a/tests/opengl.py b/tests/opengl.py
index 064c43e08..9b1e09564 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -1969,6 +1969,7 @@ with profile.test_list.group_manager(
  g(['arb_gpu_shader5-emitstreamvertex_stream_too_large'])
  g(['arb_gpu_shader5-tf-wrong-stream-value'])
  g(['arb_gpu_shader5-xfb-streams-without-invocations'])
+g(['arb_gpu_shader5-xfb-streams-without-invocations', 'spirv'])
  g(['arb_gpu_shader5-emitstreamvertex_nodraw'])
  g(['arb_gpu_shader5-interpolateAtCentroid'])
  g(['arb_gpu_shader5-interpolateAtCentroid-packing'])
diff --git 
a/tests/spec/arb_gpu_shader5/execution/shader_test/xfb_streams_without_invocations.shader_test
 
b/tests/spec/arb_gpu_shader5/execution/shader_test/xfb_streams_without_invocations.shader_test
new file mode 100644
index 0..6611e0bf8
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader5/execution/shader_test/xfb_streams_without_invocations.shader_test
@@ -0,0 +1,197 @@
+[require]
+GLSL >= 4.50
+
+[vertex shader spirv]
+; Automatically generated from the GLSL by shader_test_spirv.py. DO NOT EDIT
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 23
+; Schema: 0
+   OpCapability Shader
+  %1 = OpExtInstImport "GLSL.std.450"
+   OpMemoryModel Logical GLSL450
+   OpEntryPoint Vertex %main "main" %_ %gl_VertexID %gl_InstanceID
+   OpSource GLSL 450
+   OpName %_ ""
+   OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
+   OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
+   OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
+   OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance
+   OpDecorate %gl_PerVertex Block
+   OpDecorate %gl_VertexID BuiltIn VertexId
+   OpDecorate %gl_InstanceID BuiltIn InstanceId
+   %void = OpTypeVoid
+  %3 = OpTypeFunction %void
+  %float = OpTypeFloat 32
+%v4float = OpTypeVector %float 4
+   %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_arr_float_uint_1 = OpTypeArray %float %uint_1
+%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 
%_arr_float_uint_1
+%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
+  %_ = OpVariable %_ptr_Output_gl_PerVertex Output
+%int = OpTypeInt 32 1
+  %int_0 = OpConstant %int 0
+%float_0 = OpConstant %float 0
+ %17 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%_ptr_Input_int = OpTypePointer Input %int
+%gl_VertexID = OpVariable %_ptr_Input_int Input
+%gl_InstanceID = OpVariable %_ptr_Input_int Input
+   %main = OpFunction %void None %3
+  %5 = OpLabel
+ %19 = OpAccessChain %_ptr_Output_v4float %_ %int_0
+   OpStore %19 %17
+   OpReturn
+   OpFunctionEnd
+
+[vertex shader]
+#version 450
+
+void main() {
+ gl_Position = vec4(0.0);
+}
+
+
+[geometry shader spirv]
+; Automatically generated from the GLSL by shader_test_spirv.py. DO NOT EDIT
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 41
+; Schema: 0
+   OpCapability Geometry
+   OpCapability TransformFeedback
+   OpCapability GeometryStreams
+  %1 = OpExtInstImport "GLSL.std.450"
+   OpMemoryModel Logical GLSL450
+   OpEntryPoint Geometry %main "main" %_ %gl_in %stream0_0_out 
%stream2_0_out %stream2_1_out %stream1_0_out
+   OpExecutionMode %main Xfb
+   OpExecutionMode %main InputPoints
+   OpExecutionMode %main Invocations 1
+   OpExecutionMode %main OutputPoints
+   OpExecutionMode %main OutputVertices 3
+   OpSource GLSL 450
+   OpName %_ ""
+   OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
+   OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
+   OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
+   OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance
+   OpDecorate %gl_PerVertex Block
+   OpDecorate %gl_PerVertex 

Re: [Piglit] [PATCH] shaders: add a glslparsertest for bug 98699

2018-08-12 Thread Timothy Arceri

On 11/08/18 02:32, Dylan Baker wrote:

I thought we'd stopped adding tests with "bugX" in the name and tried to
give the test a descriptive name and we were trying not to add more
tests to tests/shaders, but put them in tests/spec/. So maybe rename
it to something like:
tests/spec/glsl-1.10/compiler/post-increment-in-array-size.shader_test


Yes I agree with Dylan on all points. With the move/rename this is:

Reviewed-by: Timothy Arceri 



Or whatever you think is better (I'm just reading the bug and trying to come up
with something).

Otherwise this test looks good, so with the rename:
Reviewed-by: Dylan Baker 

Quoting Tapani Pälli (2018-08-09 23:12:44)

Signed-off-by: Tapani Pälli 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98699
---
  tests/shaders/glsl-compiler-bug98699.vert | 9 +
  1 file changed, 9 insertions(+)
  create mode 100644 tests/shaders/glsl-compiler-bug98699.vert

diff --git a/tests/shaders/glsl-compiler-bug98699.vert 
b/tests/shaders/glsl-compiler-bug98699.vert
new file mode 100644
index 0..9bd219cf0
--- /dev/null
+++ b/tests/shaders/glsl-compiler-bug98699.vert
@@ -0,0 +1,9 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.10
+// [end config]
+
+void main()
+{
+float[a+++4 ? 1:1] f;
+}
--
2.14.4

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


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

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


Re: [Piglit] [PATCH] arb_gpu_shader_fp64: Test the sign() function with abs() and negation of its argument

2018-06-29 Thread Timothy Arceri

Reviewed-by: Timothy Arceri 

On 27/06/18 17:28, Ian Romanick wrote:

From: Ian Romanick 

The saturate version hits an assertion failure in the Mesa i965 driver:

src/intel/compiler/brw_fs.cpp:2377: bool fs_visitor::opt_algebraic(): Assertion 
`!"unimplemented: saturate mixed types"' failed.

Signed-off-by: Ian Romanick 
---
  .../built-in-functions/fs-sign-neg-abs.shader_test | 33 +
  .../built-in-functions/fs-sign-neg.shader_test | 31 
  .../fs-sign-sat-neg-abs.shader_test| 27 ++
  .../built-in-functions/vs-sign-neg-abs.shader_test | 43 ++
  .../built-in-functions/vs-sign-neg.shader_test | 41 +
  .../vs-sign-sat-neg-abs.shader_test| 37 +++
  6 files changed, 212 insertions(+)
  create mode 100644 
tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-sign-neg-abs.shader_test
  create mode 100644 
tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-sign-neg.shader_test
  create mode 100644 
tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-sign-sat-neg-abs.shader_test
  create mode 100644 
tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-sign-neg-abs.shader_test
  create mode 100644 
tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-sign-neg.shader_test
  create mode 100644 
tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-sign-sat-neg-abs.shader_test

diff --git 
a/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-sign-neg-abs.shader_test
 
b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-sign-neg-abs.shader_test
new file mode 100644
index 0..642bf3d78
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-sign-neg-abs.shader_test
@@ -0,0 +1,33 @@
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader_fp64
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_ARB_gpu_shader_fp64: require
+
+uniform dvec4 arg0;
+uniform dvec4 arg1;
+uniform dvec4 expect;
+
+out vec4 piglit_fragcolor;
+
+void main()
+{
+   if (sign(-abs(arg0)) != -sign(abs(arg1)))
+   piglit_fragcolor = vec4(1.0, 0.0, 0.0, 1.0);
+   else if (sign(-abs(arg0)) != -abs(sign(arg1)))
+   piglit_fragcolor = vec4(0.5, 0.0, 0.5, 1.0);
+   else if (sign(-abs(arg0)) != expect)
+   piglit_fragcolor = vec4(0.0, 0.0, 1.0, 1.0);
+   else
+   piglit_fragcolor = vec4(0.0, 1.0, 0.0, 1.0);
+}
+
+[test]
+uniform dvec4 arg0 -5.0 5.0 0.0 0.0
+uniform dvec4 arg1 -2.0 2.0 0.0 0.0
+uniform dvec4 expect -1.0 -1.0 0.0 0.0
+draw rect -1 -1 2 2
+probe rgb 1 1 0.0 1.0 0.0
diff --git 
a/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-sign-neg.shader_test
 
b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-sign-neg.shader_test
new file mode 100644
index 0..a8f49874e
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-sign-neg.shader_test
@@ -0,0 +1,31 @@
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader_fp64
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_ARB_gpu_shader_fp64: require
+
+uniform dvec4 arg0;
+uniform dvec4 arg1;
+uniform dvec4 expect;
+
+out vec4 piglit_fragcolor;
+
+void main()
+{
+   if (sign(-arg0) != -sign(arg1))
+   piglit_fragcolor = vec4(1.0, 0.0, 0.0, 1.0);
+   else if (sign(-arg0) != expect)
+   piglit_fragcolor = vec4(0.0, 0.0, 1.0, 1.0);
+   else
+   piglit_fragcolor = vec4(0.0, 1.0, 0.0, 1.0);
+}
+
+[test]
+uniform dvec4 arg0 -5.0 5.0 0.0 0.0
+uniform dvec4 arg1 -2.0 2.0 0.0 0.0
+uniform dvec4 expect 1.0 -1.0 0.0 0.0
+draw rect -1 -1 2 2
+probe rgb 1 1 0.0 1.0 0.0
diff --git 
a/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-sign-sat-neg-abs.shader_test
 
b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-sign-sat-neg-abs.shader_test
new file mode 100644
index 0..81ae2d441
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-sign-sat-neg-abs.shader_test
@@ -0,0 +1,27 @@
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader_fp64
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_ARB_gpu_shader_fp64: require
+
+uniform dvec4 arg0;
+uniform dvec4 expect;
+
+out vec4 piglit_fragcolor;
+
+void main()
+{
+   if (clamp(sign(-abs(arg0)), 0.0, 1.0) != expect)
+   piglit_fragcolor = vec4(1.0, 0.0, 0.0, 1.0);
+   else
+   piglit_fragcolor = vec4(0.0, 1.0, 0.0, 1.0);
+}
+
+[test]
+uniform dvec4 arg0 -5.0 5.0 0.0 0.0
+uniform dvec4 expect 0.0 0.0 0.0 0.0
+draw rect -1 -1 2 2
+probe rgb 1 1 0.0 1.0 0.0
diff --git 
a/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-sign-neg-abs.shader_test
 
b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-sign-neg-abs.shader_test
new file mode 100644
index 0..a292f2621
--- /dev/nul

[Piglit] [PATCH] arb_vertex_attrib_64bit: test display list interaction

2018-06-27 Thread Timothy Arceri
---
 tests/opengl.py   |   1 +
 .../execution/CMakeLists.gl.txt   |   1 +
 .../execution/double_attribs_dlist.c  | 297 ++
 3 files changed, 299 insertions(+)
 create mode 100644 
tests/spec/arb_vertex_attrib_64bit/execution/double_attribs_dlist.c

diff --git a/tests/opengl.py b/tests/opengl.py
index e99f4d135..9142f34e4 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -4701,6 +4701,7 @@ with profile.test_list.group_manager(
 grouptools.join('spec', 'arb_vertex_attrib_64bit')) as g:
 g(['attribs', 'GL_ARB_vertex_attrib_64bit'], 'attribs')
 g(['arb_vertex_attrib_64bit-double_attribs'], 'get_double_attribs')
+g(['arb_vertex_attrib_64bit-double_attribs_dlist'], 
'get_double_attribs-display-lists')
 g(['arb_vertex_attrib_64bit-check-explicit-location'], 
'check-explicit-location')
 g(['arb_vertex_attrib_64bit-getactiveattrib'], 'getactiveattrib')
 g(['arb_vertex_attrib_64bit-max-vertex-attrib'], 'max-vertex-attrib')
diff --git a/tests/spec/arb_vertex_attrib_64bit/execution/CMakeLists.gl.txt 
b/tests/spec/arb_vertex_attrib_64bit/execution/CMakeLists.gl.txt
index fecc769a0..fc63a82d9 100644
--- a/tests/spec/arb_vertex_attrib_64bit/execution/CMakeLists.gl.txt
+++ b/tests/spec/arb_vertex_attrib_64bit/execution/CMakeLists.gl.txt
@@ -9,6 +9,7 @@ link_libraries (
 )
 
 piglit_add_executable (arb_vertex_attrib_64bit-double_attribs double_attribs.c)
+piglit_add_executable (arb_vertex_attrib_64bit-double_attribs_dlist 
double_attribs_dlist.c)
 piglit_add_executable (arb_vertex_attrib_64bit-check-explicit-location 
check-explicit-location.c)
 piglit_add_executable (arb_vertex_attrib_64bit-getactiveattrib  
getactiveattrib.c)
 piglit_add_executable (arb_vertex_attrib_64bit-max-vertex-attrib 
max-vertex-attrib.c)
diff --git 
a/tests/spec/arb_vertex_attrib_64bit/execution/double_attribs_dlist.c 
b/tests/spec/arb_vertex_attrib_64bit/execution/double_attribs_dlist.c
new file mode 100644
index 0..92672992d
--- /dev/null
+++ b/tests/spec/arb_vertex_attrib_64bit/execution/double_attribs_dlist.c
@@ -0,0 +1,297 @@
+/*
+ * Copyright (c) 2010 VMware, Inc.
+ * Copyright (c) 2015 Red Hat Inc.
+ *
+ * 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
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, 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
+ * NON-INFRINGEMENT.  IN NO EVENT SHALL VMWARE AND/OR THEIR SUPPLIERS
+ * 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.
+ */
+
+/**
+ * Test GL_ARB_vertex_attrib_64bit vertex attributes.
+ * derived from Brian's gpu_shader4 tests.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 32;
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+   config.khr_no_error_support = PIGLIT_NO_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static const char *TestName = "double_attribs";
+static const GLuint Index = 3;
+static const GLdouble Zero = 0.0;
+static const GLdouble Zero_vals[4] = { 0.0, 0.0, 0.0, 0.0 };
+
+static GLuint list;
+
+static void
+gen_double_values(GLdouble values[4], GLuint size)
+{
+   assert(size >= 1 && size <=4 );
+
+   values[0] = 1.7976931348623157E+308;
+   values[1] = 0.0;
+   values[2] = -1.3;
+   values[3] = 9.8;
+}
+
+/* doubles don't get default values */
+static GLboolean
+check_double_attrib(const GLuint idx, const GLdouble expected[4],
+GLuint size, const char *func)
+{
+   GLdouble vals[4];
+   glGetVertexAttribLdv(idx, GL_CURRENT_VERTEX_ATTRIB_ARB, vals);
+
+   switch (size) {
+   case 4:
+  if (expected[3] != vals[3])
+goto fail_print;
+   case 3:
+  if (expected[2] != vals[2])
+goto fail_print;
+   case 2:
+  if (expected[1] != vals[1])
+goto fail_print;
+   case 1:
+  if (expected[0] != vals[0])
+goto fail_print;
+   }
+   return GL_TRUE;
+fail_print:
+
+   fprintf(stderr, "%s: %s failed\n", TestName, func);
+   fprintf(stderr, "  Expected: ");
+   for (unsigned i = 0; i < size; i++)
+  fprintf(stderr, " %g", expected[i]);
+   fprintf(stderr, "  Found: ");
+ 

[Piglit] [PATCH v3] arb_compute_shader: test dispatch functions with display lists

2018-06-27 Thread Timothy Arceri
   for (i = 0; i < NUM_ATOMIC_COUNTERS; i++) {
-   uint32_t found = p[i];
-   if (verbose)
-   printf("Atomic counter %d\n"
-  "  Reference: %u\n"
-  "  Observed:  %u\n"
-  "  Result: %s\n",
-  i, values[i], found,
-  values[i] == found ? "pass" : "fail");
-   if (values[i] != found) {
-   printf("Atomic counter test %d failed for (%d, %d, 
%d)\n",
-  i, xs, ys, zs);
-   printf("  Reference: %u\n", values[i]);
-   printf("  Observed:  %u\n", found);
-   pass = false;
-   break;
-   }
-   }
-
-   glUnmapBuffer(GL_ATOMIC_COUNTER_BUFFER);
-
-   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+   return compare_atomic_counters(values, xs, ys, zs);
 }
 
 
@@ -263,25 +278,34 @@ cs_ids_set_global_size(uint32_t x, uint32_t y, uint32_t z)
 }
 
 
-enum piglit_result
-cs_ids_run_test()
+void
+cs_ids_setup_atomics_for_test()
 {
-   enum piglit_result result;
uint32_t atomics_init[NUM_ATOMIC_COUNTERS] = { 0 };
 
+   glBindBufferBase(GL_ATOMIC_COUNTER_BUFFER, 0, atomics_bo);
+   glBufferData(GL_ATOMIC_COUNTER_BUFFER,
+sizeof(atomics_init),
+atomics_init, GL_STATIC_DRAW);
+}
+
+
+/* Running the test without checking the result is useful for creating display
+ * list tests.
+ */
+void
+cs_ids_run_test_without_check()
+{
if (verbose)
printf("Testing local dim = %dx%dx%d; "
   "global dim = %dx%dx%d\n",
   local_x, local_y, local_z,
   global_x, global_y, global_z);
 
-   if (local_x == 0 || local_y == 0 || local_z == 0)
-   return PIGLIT_FAIL;
-
-   glBindBufferBase(GL_ATOMIC_COUNTER_BUFFER, 0, atomics_bo);
-   glBufferData(GL_ATOMIC_COUNTER_BUFFER,
-sizeof(atomics_init),
-atomics_init, GL_STATIC_DRAW);
+   if (local_x == 0 || local_y == 0 || local_z == 0) {
+   fprintf(stderr, "Internal error: local size not set\n");
+   return;
+   }
 
glUseProgram(prog);
 
@@ -293,8 +317,18 @@ cs_ids_run_test()
glDispatchCompute(global_x, global_y, global_z);
}
glMemoryBarrier(GL_ALL_BARRIER_BITS);
+}
+
+
+enum piglit_result
+cs_ids_run_test()
+{
+   enum piglit_result result;
+
+   cs_ids_setup_atomics_for_test();
+   cs_ids_run_test_without_check();
 
-   result = confirm_size();
+   result = cs_ids_confirm_size();
if (result != PIGLIT_PASS)
piglit_report_result(result);
 
diff --git a/tests/spec/arb_compute_shader/cs-ids-common.h 
b/tests/spec/arb_compute_shader/cs-ids-common.h
index e7530e0d3..4879e855d 100644
--- a/tests/spec/arb_compute_shader/cs-ids-common.h
+++ b/tests/spec/arb_compute_shader/cs-ids-common.h
@@ -64,4 +64,16 @@ cs_ids_set_global_size(uint32_t x, uint32_t y, uint32_t z);
 enum piglit_result
 cs_ids_run_test();
 
+void
+cs_ids_run_test_without_check();
+
+void
+cs_ids_setup_atomics_for_test();
+
+enum piglit_result
+cs_ids_confirm_initial_atomic_counters();
+
+enum piglit_result
+cs_ids_confirm_size();
+
 #endif
diff --git a/tests/spec/arb_compute_shader/dlist.c 
b/tests/spec/arb_compute_shader/dlist.c
new file mode 100644
index 0..fe2262a3d
--- /dev/null
+++ b/tests/spec/arb_compute_shader/dlist.c
@@ -0,0 +1,189 @@
+/*
+ * Copyright (c) 2018 Timothy Arceri
+ *
+ * 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
+ *
+ * Tests dispatch of a comput

Re: [Piglit] [PATCH v2] glsl-1.10: test bug with lessThan() when the input expression has mixed sizes

2018-06-27 Thread Timothy Arceri

On 28/06/18 08:58, Ian Romanick wrote:

On 06/27/2018 03:44 PM, Timothy Arceri wrote:

On 28/06/18 08:28, Timothy Arceri wrote:

On 27/06/18 21:58, Tapani Pälli wrote:

On 06/27/2018 02:43 PM, Timothy Arceri wrote:

---

   V2: Fix some spelling typos and the commit description

   ...on-vec4-mixed-arithmetic-input.shader_test | 37
+++
   1 file changed, 37 insertions(+)
   create mode 100644
tests/spec/glsl-1.10/execution/comparision-vec4-mixed-arithmetic-input.shader_test


diff --git
a/tests/spec/glsl-1.10/execution/comparision-vec4-mixed-arithmetic-input.shader_test
b/tests/spec/glsl-1.10/execution/comparision-vec4-mixed-arithmetic-input.shader_test

new file mode 100644
index 0..78f0068a3
--- /dev/null
+++
b/tests/spec/glsl-1.10/execution/comparision-vec4-mixed-arithmetic-input.shader_test

@@ -0,0 +1,37 @@
+# This exerises a bug found in a Doom shader were the lessThan()
comparision
+# was only done againsts a single component of the mixed arithmetic
expression


here are some more typos to fix:

were -> where
exerises -> exercises
comparision -> comparison
againsts -> against


lol, thanks.



For me running this throws following assert:

shader_runner: ../src/compiler/glsl/ir.cpp:491:
ir_expression::ir_expression(int, ir_rvalue*, ir_rvalue*): Assertion
`op0->type == op1->type' failed.

Is this the issue?


Seems to be a bug with do_tree_grafting()


Either that or in opt_algebraic.  It's turning lessThan(a + b, 0) into a
< -b, but it's loosing all the swizzles and the sizes.



Ah yes you are right. It does seem to be opt_algebraic() that is the cause.
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH v2] glsl-1.10: test bug with lessThan() when the input expression has mixed sizes

2018-06-27 Thread Timothy Arceri



On 28/06/18 08:28, Timothy Arceri wrote:

On 27/06/18 21:58, Tapani Pälli wrote:

On 06/27/2018 02:43 PM, Timothy Arceri wrote:

---

  V2: Fix some spelling typos and the commit description

  ...on-vec4-mixed-arithmetic-input.shader_test | 37 +++
  1 file changed, 37 insertions(+)
  create mode 100644 
tests/spec/glsl-1.10/execution/comparision-vec4-mixed-arithmetic-input.shader_test 



diff --git 
a/tests/spec/glsl-1.10/execution/comparision-vec4-mixed-arithmetic-input.shader_test 
b/tests/spec/glsl-1.10/execution/comparision-vec4-mixed-arithmetic-input.shader_test 


new file mode 100644
index 0..78f0068a3
--- /dev/null
+++ 
b/tests/spec/glsl-1.10/execution/comparision-vec4-mixed-arithmetic-input.shader_test 


@@ -0,0 +1,37 @@
+# This exerises a bug found in a Doom shader were the lessThan() 
comparision
+# was only done againsts a single component of the mixed arithmetic 
expression


here are some more typos to fix:

were -> where
exerises -> exercises
comparision -> comparison
againsts -> against


lol, thanks.



For me running this throws following assert:

shader_runner: ../src/compiler/glsl/ir.cpp:491: 
ir_expression::ir_expression(int, ir_rvalue*, ir_rvalue*): Assertion 
`op0->type == op1->type' failed.


Is this the issue?


Seems to be a bug with do_tree_grafting()




Yes, and in release builds the test fails. It seems to be a broken opt 
somewhere:


   (declare (temporary ) bvec4 lessThan_retval)
   (declare (temporary ) vec4 x)
   (assign  (xyzw) (var_ref x)  (expression vec4 + (swiz w (var_ref 
b) )(swiz xyzw (var_ref a) )) )

   (declare (temporary ) vec4 y)
   (assign  (xyzw) (var_ref y)  (constant vec4 (0.00 0.00 
0.00 0.00)) )
   (assign  (xyzw) (var_ref lessThan_retval)  (expression bvec4 < 
(var_ref x) (var_ref y) ) )

   (declare (temporary ) bool any_retval)
   (declare (temporary ) bvec4 v)
   (assign  (xyzw) (var_ref v)  (var_ref lessThan_retval) )
   (assign  (x) (var_ref any_retval)  (expression bool any_nequal 
(var_ref v) (constant bvec4 (0 0 0 0)) ) )

   (if (var_ref any_retval) (
     (assign  (xyzw) (var_ref gl_FragColor)  (constant vec4 
(1.00 0.00 0.00 1.00)) )

   )
   ())

Turns into:


(if (expression bool any_nequal (swiz  (expression bool < (swiz w 
(var_ref b) )(expression vec4 neg (var_ref a) ) ) )(constant bvec4 (0 0 
0 0)) ) (
     (assign  (xyzw) (var_ref gl_FragColor)  (constant vec4 
(1.00 0.00 0.00 1.00)) )

   )





+# rather than all four components.
+
+[require]
+GLSL >= 1.10
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 110
+
+uniform vec4 a;
+uniform vec4 b;
+
+void main() {
+    gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
+
+    if (any(lessThan(b.w + a.xyzw, vec4(0.0
+    gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+clear color 0.1 0.1 0.1 0.1
+clear
+
+uniform vec4 a 0.5 0.5 0.5 -1.0
+uniform vec4 b 1.0 1.0 1.0 0.5
+draw rect -1 -1 2 2
+
+probe all rgba 1.0 0.0 0.0 1.0
+
+uniform vec4 a 0.5 0.5 0.5 -0.5
+uniform vec4 b 1.0 1.0 1.0 0.5
+draw rect -1 -1 2 2
+
+probe all rgba 0.0 1.0 0.0 1.0


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

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


Re: [Piglit] [PATCH v2] glsl-1.10: test bug with lessThan() when the input expression has mixed sizes

2018-06-27 Thread Timothy Arceri

On 27/06/18 21:58, Tapani Pälli wrote:

On 06/27/2018 02:43 PM, Timothy Arceri wrote:

---

  V2: Fix some spelling typos and the commit description

  ...on-vec4-mixed-arithmetic-input.shader_test | 37 +++
  1 file changed, 37 insertions(+)
  create mode 100644 
tests/spec/glsl-1.10/execution/comparision-vec4-mixed-arithmetic-input.shader_test 



diff --git 
a/tests/spec/glsl-1.10/execution/comparision-vec4-mixed-arithmetic-input.shader_test 
b/tests/spec/glsl-1.10/execution/comparision-vec4-mixed-arithmetic-input.shader_test 


new file mode 100644
index 0..78f0068a3
--- /dev/null
+++ 
b/tests/spec/glsl-1.10/execution/comparision-vec4-mixed-arithmetic-input.shader_test 


@@ -0,0 +1,37 @@
+# This exerises a bug found in a Doom shader were the lessThan() 
comparision
+# was only done againsts a single component of the mixed arithmetic 
expression


here are some more typos to fix:

were -> where
exerises -> exercises
comparision -> comparison
againsts -> against


lol, thanks.



For me running this throws following assert:

shader_runner: ../src/compiler/glsl/ir.cpp:491: 
ir_expression::ir_expression(int, ir_rvalue*, ir_rvalue*): Assertion 
`op0->type == op1->type' failed.


Is this the issue?


Yes, and in release builds the test fails. It seems to be a broken opt 
somewhere:


  (declare (temporary ) bvec4 lessThan_retval)
  (declare (temporary ) vec4 x)
  (assign  (xyzw) (var_ref x)  (expression vec4 + (swiz w (var_ref 
b) )(swiz xyzw (var_ref a) )) )

  (declare (temporary ) vec4 y)
  (assign  (xyzw) (var_ref y)  (constant vec4 (0.00 0.00 
0.00 0.00)) )
  (assign  (xyzw) (var_ref lessThan_retval)  (expression bvec4 < 
(var_ref x) (var_ref y) ) )

  (declare (temporary ) bool any_retval)
  (declare (temporary ) bvec4 v)
  (assign  (xyzw) (var_ref v)  (var_ref lessThan_retval) )
  (assign  (x) (var_ref any_retval)  (expression bool any_nequal 
(var_ref v) (constant bvec4 (0 0 0 0)) ) )

  (if (var_ref any_retval) (
(assign  (xyzw) (var_ref gl_FragColor)  (constant vec4 
(1.00 0.00 0.00 1.00)) )

  )
  ())

Turns into:


(if (expression bool any_nequal (swiz  (expression bool < (swiz w 
(var_ref b) )(expression vec4 neg (var_ref a) ) ) )(constant bvec4 (0 0 
0 0)) ) (
(assign  (xyzw) (var_ref gl_FragColor)  (constant vec4 
(1.00 0.00 0.00 1.00)) )

  )





+# rather than all four components.
+
+[require]
+GLSL >= 1.10
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 110
+
+uniform vec4 a;
+uniform vec4 b;
+
+void main() {
+    gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
+
+    if (any(lessThan(b.w + a.xyzw, vec4(0.0
+    gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+clear color 0.1 0.1 0.1 0.1
+clear
+
+uniform vec4 a 0.5 0.5 0.5 -1.0
+uniform vec4 b 1.0 1.0 1.0 0.5
+draw rect -1 -1 2 2
+
+probe all rgba 1.0 0.0 0.0 1.0
+
+uniform vec4 a 0.5 0.5 0.5 -0.5
+uniform vec4 b 1.0 1.0 1.0 0.5
+draw rect -1 -1 2 2
+
+probe all rgba 0.0 1.0 0.0 1.0


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


[Piglit] [PATCH v2] glsl-1.10: test bug with lessThan() when the input expression has mixed sizes

2018-06-27 Thread Timothy Arceri
---

 V2: Fix some spelling typos and the commit description

 ...on-vec4-mixed-arithmetic-input.shader_test | 37 +++
 1 file changed, 37 insertions(+)
 create mode 100644 
tests/spec/glsl-1.10/execution/comparision-vec4-mixed-arithmetic-input.shader_test

diff --git 
a/tests/spec/glsl-1.10/execution/comparision-vec4-mixed-arithmetic-input.shader_test
 
b/tests/spec/glsl-1.10/execution/comparision-vec4-mixed-arithmetic-input.shader_test
new file mode 100644
index 0..78f0068a3
--- /dev/null
+++ 
b/tests/spec/glsl-1.10/execution/comparision-vec4-mixed-arithmetic-input.shader_test
@@ -0,0 +1,37 @@
+# This exerises a bug found in a Doom shader were the lessThan() comparision
+# was only done againsts a single component of the mixed arithmetic expression
+# rather than all four components.
+
+[require]
+GLSL >= 1.10
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 110
+
+uniform vec4 a;
+uniform vec4 b;
+
+void main() {
+   gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
+
+   if (any(lessThan(b.w + a.xyzw, vec4(0.0
+   gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+clear color 0.1 0.1 0.1 0.1
+clear
+
+uniform vec4 a 0.5 0.5 0.5 -1.0
+uniform vec4 b 1.0 1.0 1.0 0.5
+draw rect -1 -1 2 2
+
+probe all rgba 1.0 0.0 0.0 1.0
+
+uniform vec4 a 0.5 0.5 0.5 -0.5
+uniform vec4 b 1.0 1.0 1.0 0.5
+draw rect -1 -1 2 2
+
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.17.1

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


[Piglit] [PATCH] glsl-1.10: test bug with lessThan() with input expression has mixed sizes

2018-06-27 Thread Timothy Arceri
---
 ...on-vec4-mixed-arithmetic-input.shader_test | 37 +++
 1 file changed, 37 insertions(+)
 create mode 100644 
tests/spec/glsl-1.10/execution/comparision-vec4-mixed-arithmetic-input.shader_test

diff --git 
a/tests/spec/glsl-1.10/execution/comparision-vec4-mixed-arithmetic-input.shader_test
 
b/tests/spec/glsl-1.10/execution/comparision-vec4-mixed-arithmetic-input.shader_test
new file mode 100644
index 0..78f0068a3
--- /dev/null
+++ 
b/tests/spec/glsl-1.10/execution/comparision-vec4-mixed-arithmetic-input.shader_test
@@ -0,0 +1,37 @@
+# This exerises a bug found in a Doom shader were the lessThan() comparision
+# was only done againsts a single component of the mixed arithmetic expression
+# rather than all four components.
+
+[require]
+GLSL >= 1.10
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 110
+
+uniform vec4 a;
+uniform vec4 b;
+
+void main() {
+   gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
+
+   if (any(lessThan(b.w + a.xyzw, vec4(0.0
+   gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+clear color 0.1 0.1 0.1 0.1
+clear
+
+uniform vec4 a 0.5 0.5 0.5 -1.0
+uniform vec4 b 1.0 1.0 1.0 0.5
+draw rect -1 -1 2 2
+
+probe all rgba 1.0 0.0 0.0 1.0
+
+uniform vec4 a 0.5 0.5 0.5 -0.5
+uniform vec4 b 1.0 1.0 1.0 0.5
+draw rect -1 -1 2 2
+
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.17.1

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


Re: [Piglit] [PATCH] tests/opengl.py: add couple missing arb_get_program_binary tests

2018-06-27 Thread Timothy Arceri

Thanks!

Reviewed-by: Timothy Arceri 

On 27/06/18 16:49, Tapani Pälli wrote:

Signed-off-by: Tapani Pälli 
---
  tests/opengl.py | 4 
  1 file changed, 4 insertions(+)

diff --git a/tests/opengl.py b/tests/opengl.py
index 2592fa404..cafda2576 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -1687,6 +1687,10 @@ with profile.test_list.group_manager(
'PROGRAM_BINARY_RETRIEVABLE_HINT')
  g(['arb_get_program_binary-xfb-varyings'],
'xfb-varyings')
+g(['arb_get_program_binary-restore-implicit-use-program'],
+  'restore-implicit-use-program')
+g(['arb_get_program_binary-reset-uniform'],
+  'reset-uniform')
  
  with profile.test_list.group_manager(

  PiglitGLTest, grouptools.join('spec', 'EXT_depth_bounds_test')) as g:


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


Re: [Piglit] [PATCH] Add a test for instanced GS inputs.

2018-06-26 Thread Timothy Arceri

On 22/06/18 18:36, andrii.simiklit wrote:

Hello,

It would be great If somebody could take a look this test)
This test against following bug:
https://bugs.freedesktop.org/show_bug.cgi?id=96354


I've clean up the description, removed some trailing spaces and pushed 
this test.


Thanks!



Regards,
Andrii.

On 05.06.18 16:33, Andrii Simiklit wrote:


    All of our other tests for instanced geometry shaders don't actually
    transfer the vertices to the geometry shader
    from the vertex shader using gl_Position.
    This used to be broken with the i965 driver's in Mesa 12.1.0
    on revision d10ae20b9678f1a5b8a81716c68e612662665277.
    This test should give us ability to detect
    such kind of bugs like 96354 bug in future.

Signed-off-by: Andrii Simiklit 
---
  .../instanced-inputs-built-in-variable.shader_test | 68 
++

  1 file changed, 68 insertions(+)
  create mode 100644 
tests/spec/arb_gpu_shader5/execution/instanced-inputs-built-in-variable.shader_test 



diff --git 
a/tests/spec/arb_gpu_shader5/execution/instanced-inputs-built-in-variable.shader_test 
b/tests/spec/arb_gpu_shader5/execution/instanced-inputs-built-in-variable.shader_test 


new file mode 100644
index 000..86b2bbd
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader5/execution/instanced-inputs-built-in-variable.shader_test 


@@ -0,0 +1,68 @@
+#It seems as duplicate of the "instanced-inputs.shader_test" test but 
it could not detect the bug 96354.

+#It could detect the 96354 bug if and only if vertices are transferred
+#from vertex shader into geometry shader through built-in variable 
gl_Position.

+#
+#Specification permits us to do it "11.3.4.4 Geometry Shader Inputs:
+#    Structure member gl_Position holds the per-vertex position, as 
written

+#    by the vertex shader to its built-in output variable gl_Position.
+#    Note that writing to gl_Position from either the vertex or 
geometry shader is
+#    optional (also see section 7.1(“Built-In Variables”) of the 
OpenGL Shading Language Specification)"

+
+[require]
+GL >= 2.0
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader]
+in vec4 vertex;
+
+void main()
+{
+   gl_Position = vertex;
+}
+
+[geometry shader]
+#extension GL_ARB_gpu_shader5 : require
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+layout(invocations = 4) in;
+
+void main()
+{
+   vec2 offset;
+   if (gl_InvocationID == 0)
+  offset.xy = vec2(-0.5, -0.5);
+   else if (gl_InvocationID == 1)
+  offset.xy = vec2( 0.5, -0.5);
+   else if (gl_InvocationID == 2)
+  offset.xy = vec2(-0.5,  0.5);
+   else if (gl_InvocationID == 3)
+  offset.xy = vec2( 0.5,  0.5);
+
+   for (int i = 0; i < 3; i++) {
+   gl_Position = gl_in[i].gl_Position;
+   gl_Position.xy += offset;
+   EmitVertex();
+   }
+}
+
+[fragment shader]
+void main()
+{
+   gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
+}
+
+[vertex data]
+vertex/float/2
+-0.5 -0.5
+ 0.5 -0.5
+-0.5  0.0
+ 0.5  0.0
+-0.5  0.5
+ 0.5  0.5
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+draw arrays GL_TRIANGLE_STRIP 0 6
+probe all rgba 0.0 1.0 0.0 1.0
\ No newline at end of file


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

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


Re: [Piglit] [PATCH v2] arb_compute_shader: test dispatch functions with display lists

2018-06-26 Thread Timothy Arceri
I'm going to hold this one back for the moment. I've filled a spec bug 
and I'm hoping the indirect call will just be made to generate an error 
inside display lists.


On 27/06/18 11:30, Marek Olšák wrote:

Acked-by: Marek Olšák 

Marek

On Sun, Jun 24, 2018 at 9:40 PM, Timothy Arceri  wrote:

This change also splits apart some of the compute test common
functions to make them easier to use with display lists.

V2: make sure we dereference the data for indirect dispatch at
 display list compile time rather than encoding the offset.
---
  tests/opengl.py   |   1 +
  .../spec/arb_compute_shader/CMakeLists.gl.txt |   1 +
  tests/spec/arb_compute_shader/cs-ids-common.c | 126 -
  tests/spec/arb_compute_shader/cs-ids-common.h |  12 ++
  tests/spec/arb_compute_shader/dlist.c | 170 ++
  5 files changed, 264 insertions(+), 46 deletions(-)
  create mode 100644 tests/spec/arb_compute_shader/dlist.c

diff --git a/tests/opengl.py b/tests/opengl.py
index 18ba228a1..669d9055b 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -4217,6 +4217,7 @@ with profile.test_list.group_manager(
override_class=BuiltInConstantsTest)
  g(['arb_compute_shader-work_group_size_too_large'],
grouptools.join('compiler', 'work_group_size_too_large'))
+g(['arb_compute_shader-dlist'], 'display-list')
  g(['arb_compute_shader-indirect-compute'], 'indirect-compute')
  g(['arb_compute_shader-local-id'], 'local-id' + '-explosion')
  g(['arb_compute_shader-render-and-compute'], 'render-and-compute')
diff --git a/tests/spec/arb_compute_shader/CMakeLists.gl.txt 
b/tests/spec/arb_compute_shader/CMakeLists.gl.txt
index d7b98123a..2258ae88e 100644
--- a/tests/spec/arb_compute_shader/CMakeLists.gl.txt
+++ b/tests/spec/arb_compute_shader/CMakeLists.gl.txt
@@ -14,6 +14,7 @@ piglit_add_executable (arb_compute_shader-minmax minmax.c)

  set(depends cs-ids-common.c common.c)

+piglit_add_executable (arb_compute_shader-dlist dlist.c ${depends})
  piglit_add_executable (arb_compute_shader-indirect-compute indirect-compute.c 
${depends})
  piglit_add_executable (arb_compute_shader-local-id local-id.c ${depends})
  piglit_add_executable (arb_compute_shader-render-and-compute 
render-and-compute.c ${depends})
diff --git a/tests/spec/arb_compute_shader/cs-ids-common.c 
b/tests/spec/arb_compute_shader/cs-ids-common.c
index fc25986fa..c07705b8a 100644
--- a/tests/spec/arb_compute_shader/cs-ids-common.c
+++ b/tests/spec/arb_compute_shader/cs-ids-common.c
@@ -104,14 +104,61 @@ clear_program()
  }

  static enum piglit_result
-confirm_size()
+compare_atomic_counters(uint32_t *values, uint32_t xs, uint32_t ys,
+uint32_t zs)
  {
+   bool pass = true;
 uint32_t *p;
+
+   glBindBufferBase(GL_ATOMIC_COUNTER_BUFFER, 0, atomics_bo);
+   p = glMapBufferRange(GL_ATOMIC_COUNTER_BUFFER,
+0,
+NUM_ATOMIC_COUNTERS * sizeof(uint32_t),
+GL_MAP_READ_BIT);
+
+   if (!p) {
+   printf("Couldn't map atomic counter to verify expected 
value.\n");
+   return PIGLIT_FAIL;
+   }
+
+   for (unsigned i = 0; i < NUM_ATOMIC_COUNTERS; i++) {
+   uint32_t found = p[i];
+   if (verbose)
+   printf("Atomic counter %d\n"
+  "  Reference: %u\n"
+  "  Observed:  %u\n"
+  "  Result: %s\n",
+  i, values[i], found,
+  values[i] == found ? "pass" : "fail");
+   if (values[i] != found) {
+   printf("Atomic counter test %d failed for (%d, %d, 
%d)\n",
+  i, xs, ys, zs);
+   printf("  Reference: %u\n", values[i]);
+   printf("  Observed:  %u\n", found);
+   pass = false;
+   break;
+   }
+   }
+
+   glUnmapBuffer(GL_ATOMIC_COUNTER_BUFFER);
+
+   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+enum piglit_result
+cs_ids_confirm_initial_atomic_counters()
+{
+   uint32_t atomics_init[NUM_ATOMIC_COUNTERS] = { 0 };
+   return compare_atomic_counters(atomics_init, 0, 0, 0);
+}
+
+enum piglit_result
+cs_ids_confirm_size()
+{
 uint32_t values[NUM_ATOMIC_COUNTERS];
 uint32_t i, x, y, z;
 uint32_t xs, ys, zs;
 uint32_t hx, hy, hz;
-   bool pass = true;

 xs = local_x;
 ys = local_y;
@@ -158,39 +205,7 @@ confirm_size()
 values[i] *= global_x * global_y * global_z;
 }

-   glBindBufferBase(GL_ATOMIC_COUNTER_BUFFER, 0, atomics_bo);
-   p = glMapBufferRange(GL_ATOMIC_COUNTER_BUF

Re: [Piglit] [PATCH] glsl-1.10: Test the sign() function with abs() and negation of its argument

2018-06-26 Thread Timothy Arceri



On 27/06/18 11:24, Ian Romanick wrote:

On 06/26/2018 05:15 PM, Timothy Arceri wrote:

On 27/06/18 07:44, Ian Romanick wrote:

From: Ian Romanick 

The fsign(-abs(x)) tests tickle a bug in the Mesa i965 driver that was
found by inspection.

Signed-off-by: Ian Romanick 
---
   .../execution/fs-sign-neg-abs.shader_test  | 28

   .../glsl-1.10/execution/fs-sign-neg.shader_test    | 26 +++
   .../execution/vs-sign-neg-abs.shader_test  | 38
++
   .../glsl-1.10/execution/vs-sign-neg.shader_test    | 36

   4 files changed, 128 insertions(+)
   create mode 100644
tests/spec/glsl-1.10/execution/fs-sign-neg-abs.shader_test
   create mode 100644
tests/spec/glsl-1.10/execution/fs-sign-neg.shader_test
   create mode 100644
tests/spec/glsl-1.10/execution/vs-sign-neg-abs.shader_test
   create mode 100644
tests/spec/glsl-1.10/execution/vs-sign-neg.shader_test

diff --git
a/tests/spec/glsl-1.10/execution/fs-sign-neg-abs.shader_test
b/tests/spec/glsl-1.10/execution/fs-sign-neg-abs.shader_test
new file mode 100644
index 0..285c6e749
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/fs-sign-neg-abs.shader_test
@@ -0,0 +1,28 @@
+[require]
+GLSL >= 1.10
+
+[vertex shader passthrough]
+
+[fragment shader]
+uniform vec4 arg0;
+uniform vec4 arg1;
+uniform vec4 expect;
+
+void main()
+{
+    if (sign(-abs(arg0)) != -sign(abs(arg1)))
+    gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+    else if (sign(-abs(arg0)) != -abs(sign(arg1)))
+    gl_FragColor = vec4(0.5, 0.0, 0.5, 1.0);
+    else if (sign(-abs(arg0)) != expect)
+    gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0);
+    else
+    gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
+}
+
+[test]
+uniform vec4 arg0 -5.0 5.0 0.0 0.0
+uniform vec4 arg1 -2.0 2.0 0.0 0.0
+uniform vec4 expect 1.0 -1.0 0.0 0.0


Shouldn't this be:

uniform vec4 expect -1.0 -1.0 0.0 0.0


You are correct.  I had just noticed that after running it through our
CI.  I think I've also discovered that we need fp64 versions of these,
and I was going to resend all of it at once.


Well if you fix these. You can have my r-b on this and the squashed 
part. I'll look at the fp64 patch when you send it out.






+draw rect -1 -1 2 2
+probe rgb 1 1 0.0 1.0 0.0
diff --git a/tests/spec/glsl-1.10/execution/fs-sign-neg.shader_test
b/tests/spec/glsl-1.10/execution/fs-sign-neg.shader_test
new file mode 100644
index 0..a881fc80f
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/fs-sign-neg.shader_test
@@ -0,0 +1,26 @@
+[require]
+GLSL >= 1.10
+
+[vertex shader passthrough]
+
+[fragment shader]
+uniform vec4 arg0;
+uniform vec4 arg1;
+uniform vec4 expect;
+
+void main()
+{
+    if (sign(-arg0) != -sign(arg1))
+    gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+    else if (sign(-arg0) != expect)
+    gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0);
+    else
+    gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
+}
+
+[test]
+uniform vec4 arg0 -5.0 5.0 0.0 0.0
+uniform vec4 arg1 -2.0 2.0 0.0 0.0
+uniform vec4 expect 1.0 -1.0 0.0 0.0
+draw rect -1 -1 2 2
+probe rgb 1 1 0.0 1.0 0.0
diff --git
a/tests/spec/glsl-1.10/execution/vs-sign-neg-abs.shader_test
b/tests/spec/glsl-1.10/execution/vs-sign-neg-abs.shader_test
new file mode 100644
index 0..e7f0546f3
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/vs-sign-neg-abs.shader_test
@@ -0,0 +1,38 @@
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+uniform vec4 arg0;
+uniform vec4 arg1;
+uniform vec4 expect;
+
+varying vec4 color;
+
+void main()
+{
+    if (sign(-abs(arg0)) != -sign(abs(arg1)))
+    color = vec4(1.0, 0.0, 0.0, 1.0);
+    else if (sign(-abs(arg0)) != -abs(sign(arg1)))
+    color = vec4(0.5, 0.0, 0.5, 1.0);
+    else if (sign(-abs(arg0)) != expect)
+    color = vec4(0.0, 0.0, 1.0, 1.0);
+    else
+    color = vec4(0.0, 1.0, 0.0, 1.0);
+
+    gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+varying vec4 color;
+
+void main()
+{
+    gl_FragColor = color;
+}
+
+[test]
+uniform vec4 arg0 -5.0 5.0 0.0 0.0
+uniform vec4 arg1 -2.0 2.0 0.0 0.0
+uniform vec4 expect 1.0 -1.0 0.0 0.0
+draw rect -1 -1 2 2
+probe rgb 1 1 0.0 1.0 0.0
diff --git a/tests/spec/glsl-1.10/execution/vs-sign-neg.shader_test
b/tests/spec/glsl-1.10/execution/vs-sign-neg.shader_test
new file mode 100644
index 0..0f7526d63
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/vs-sign-neg.shader_test
@@ -0,0 +1,36 @@
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+uniform vec4 arg0;
+uniform vec4 arg1;
+uniform vec4 expect;
+
+varying vec4 color;
+
+void main()
+{
+    if (sign(-arg0) != -sign(arg1))
+    color = vec4(1.0, 0.0, 0.0, 1.0);
+    else if (sign(-arg0) != expect)
+    color = vec4(0.0, 0.0, 1.0, 1.0);
+    else
+    color = vec4(0.0, 1.0, 0.0, 1.0);
+
+    gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+varying vec4 color;
+
+void main()
+{
+    gl_FragColor = color;
+}
+
+[test]
+uniform vec4 arg0 -5.0 5.0 0.0 0.0
+uniform vec4 arg1 -2.0 2.0 0.0 0.0
+

Re: [Piglit] [PATCH] glsl-1.10: Test the sign() function with abs() and negation of its argument

2018-06-26 Thread Timothy Arceri

On 27/06/18 07:44, Ian Romanick wrote:

From: Ian Romanick 

The fsign(-abs(x)) tests tickle a bug in the Mesa i965 driver that was
found by inspection.

Signed-off-by: Ian Romanick 
---
  .../execution/fs-sign-neg-abs.shader_test  | 28 
  .../glsl-1.10/execution/fs-sign-neg.shader_test| 26 +++
  .../execution/vs-sign-neg-abs.shader_test  | 38 ++
  .../glsl-1.10/execution/vs-sign-neg.shader_test| 36 
  4 files changed, 128 insertions(+)
  create mode 100644 tests/spec/glsl-1.10/execution/fs-sign-neg-abs.shader_test
  create mode 100644 tests/spec/glsl-1.10/execution/fs-sign-neg.shader_test
  create mode 100644 tests/spec/glsl-1.10/execution/vs-sign-neg-abs.shader_test
  create mode 100644 tests/spec/glsl-1.10/execution/vs-sign-neg.shader_test

diff --git a/tests/spec/glsl-1.10/execution/fs-sign-neg-abs.shader_test 
b/tests/spec/glsl-1.10/execution/fs-sign-neg-abs.shader_test
new file mode 100644
index 0..285c6e749
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/fs-sign-neg-abs.shader_test
@@ -0,0 +1,28 @@
+[require]
+GLSL >= 1.10
+
+[vertex shader passthrough]
+
+[fragment shader]
+uniform vec4 arg0;
+uniform vec4 arg1;
+uniform vec4 expect;
+
+void main()
+{
+   if (sign(-abs(arg0)) != -sign(abs(arg1)))
+   gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+   else if (sign(-abs(arg0)) != -abs(sign(arg1)))
+   gl_FragColor = vec4(0.5, 0.0, 0.5, 1.0);
+   else if (sign(-abs(arg0)) != expect)
+   gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0);
+   else
+   gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
+}
+
+[test]
+uniform vec4 arg0 -5.0 5.0 0.0 0.0
+uniform vec4 arg1 -2.0 2.0 0.0 0.0
+uniform vec4 expect 1.0 -1.0 0.0 0.0


Shouldn't this be:

uniform vec4 expect -1.0 -1.0 0.0 0.0


+draw rect -1 -1 2 2
+probe rgb 1 1 0.0 1.0 0.0
diff --git a/tests/spec/glsl-1.10/execution/fs-sign-neg.shader_test 
b/tests/spec/glsl-1.10/execution/fs-sign-neg.shader_test
new file mode 100644
index 0..a881fc80f
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/fs-sign-neg.shader_test
@@ -0,0 +1,26 @@
+[require]
+GLSL >= 1.10
+
+[vertex shader passthrough]
+
+[fragment shader]
+uniform vec4 arg0;
+uniform vec4 arg1;
+uniform vec4 expect;
+
+void main()
+{
+   if (sign(-arg0) != -sign(arg1))
+   gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+   else if (sign(-arg0) != expect)
+   gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0);
+   else
+   gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
+}
+
+[test]
+uniform vec4 arg0 -5.0 5.0 0.0 0.0
+uniform vec4 arg1 -2.0 2.0 0.0 0.0
+uniform vec4 expect 1.0 -1.0 0.0 0.0
+draw rect -1 -1 2 2
+probe rgb 1 1 0.0 1.0 0.0
diff --git a/tests/spec/glsl-1.10/execution/vs-sign-neg-abs.shader_test 
b/tests/spec/glsl-1.10/execution/vs-sign-neg-abs.shader_test
new file mode 100644
index 0..e7f0546f3
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/vs-sign-neg-abs.shader_test
@@ -0,0 +1,38 @@
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+uniform vec4 arg0;
+uniform vec4 arg1;
+uniform vec4 expect;
+
+varying vec4 color;
+
+void main()
+{
+   if (sign(-abs(arg0)) != -sign(abs(arg1)))
+   color = vec4(1.0, 0.0, 0.0, 1.0);
+   else if (sign(-abs(arg0)) != -abs(sign(arg1)))
+   color = vec4(0.5, 0.0, 0.5, 1.0);
+   else if (sign(-abs(arg0)) != expect)
+   color = vec4(0.0, 0.0, 1.0, 1.0);
+   else
+   color = vec4(0.0, 1.0, 0.0, 1.0);
+
+   gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+varying vec4 color;
+
+void main()
+{
+   gl_FragColor = color;
+}
+
+[test]
+uniform vec4 arg0 -5.0 5.0 0.0 0.0
+uniform vec4 arg1 -2.0 2.0 0.0 0.0
+uniform vec4 expect 1.0 -1.0 0.0 0.0
+draw rect -1 -1 2 2
+probe rgb 1 1 0.0 1.0 0.0
diff --git a/tests/spec/glsl-1.10/execution/vs-sign-neg.shader_test 
b/tests/spec/glsl-1.10/execution/vs-sign-neg.shader_test
new file mode 100644
index 0..0f7526d63
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/vs-sign-neg.shader_test
@@ -0,0 +1,36 @@
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+uniform vec4 arg0;
+uniform vec4 arg1;
+uniform vec4 expect;
+
+varying vec4 color;
+
+void main()
+{
+   if (sign(-arg0) != -sign(arg1))
+   color = vec4(1.0, 0.0, 0.0, 1.0);
+   else if (sign(-arg0) != expect)
+   color = vec4(0.0, 0.0, 1.0, 1.0);
+   else
+   color = vec4(0.0, 1.0, 0.0, 1.0);
+
+   gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+varying vec4 color;
+
+void main()
+{
+   gl_FragColor = color;
+}
+
+[test]
+uniform vec4 arg0 -5.0 5.0 0.0 0.0
+uniform vec4 arg1 -2.0 2.0 0.0 0.0
+uniform vec4 expect 1.0 -1.0 0.0 0.0
+draw rect -1 -1 2 2
+probe rgb 1 1 0.0 1.0 0.0


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


[Piglit] [PATCH v2] ARB_vertex_attrib_64bit: add doubles support to attributes test

2018-06-25 Thread Timothy Arceri
---

 V2: Add missing opengl.py entry.

 tests/general/attribs.c | 68 +++--
 tests/opengl.py |  3 +-
 2 files changed, 67 insertions(+), 4 deletions(-)

diff --git a/tests/general/attribs.c b/tests/general/attribs.c
index 05a0d4a1e..bf627dece 100644
--- a/tests/general/attribs.c
+++ b/tests/general/attribs.c
@@ -53,6 +53,7 @@ enum {
 };
 
 enum {
+   DOUBLE_TYPE,
FLOAT_TYPE,
INT_TYPE,
UINT_TYPE
@@ -120,12 +121,13 @@ static GLboolean test(int x, int y, const char 
*shaderfunc,
  const char *info)
 {
static const char *templ = {
+   "%s \n"
"%s \n"
"#extension GL_ARB_explicit_attrib_location : require \n"
"layout(location = 1) in %s attr; \n"
"void main() { \n"
"  gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; \n"
-   "  gl_FrontColor = (%s) * vec4(1.0, 1.0, 1.0, 0.5); \n"
+   "  gl_FrontColor = vec4(%s %s) * vec4(1.0, 1.0, 1.0, 0.5); \n"
"} \n"
};
GLuint prog, vs;
@@ -139,10 +141,56 @@ static GLboolean test(int x, int y, const char 
*shaderfunc,
{0.5, 0.3, 0.9, 0.2}
};
 
+   char *defaults;
+   char *type_string;
+
+   /* From Section 11.1.1 (Vertex Attributes) of the OpenGL 4.6
+* Compatibility Profile spec:
+*
+*"Scalar and vector vertex attribute types and VertexAttrib*
+*commands used to set the values of the corresponding generic
+*attribute. values are provided if the values of the vertex
+*attribute variable are specified with fewer components than
+*required for the attribute variable. For example, the fourth
+*component of a variable of type dvec4 will be undefined if
+*specified using VertexAttribL3dv, or using a vertex array
+*specified with VertexAttribLPointer and a size of three.
+*
+* TODO: We should probably also be doing this for attribute functions
+*   other than doubles.
+*/
+   if (type == DOUBLE_TYPE) {
+   switch (mask) {
+   case R:
+   type_string = "double";
+   defaults = ", dvec3(0.0, 0.0, 1.0)";
+   break;
+   case RG:
+   type_string = "dvec2";
+   defaults = ", dvec2(0.0, 1.0)";
+   break;
+   case RGB:
+   type_string = "dvec3";
+   defaults = ", 1.0";
+   break;
+   case RGBA:
+   type_string = "dvec4";
+   defaults = "";
+   break;
+   default:
+   assert(0);
+   }
+   } else {
+   defaults = "";
+   type_string =
+   type == INT_TYPE ? "ivec4" : type == UINT_TYPE ? 
"uvec4" : "vec4";
+   }
+
sprintf(vstext, templ,
type != FLOAT_TYPE ? "#version 130" : "",
-   type == INT_TYPE ? "ivec4" : type == UINT_TYPE ? "uvec4" : 
"vec4",
-   shaderfunc);
+   type == DOUBLE_TYPE ?
+   "#extension GL_ARB_gpu_shader_fp64: enable\n#extension 
GL_ARB_vertex_attrib_64bit: enable" : "",
+   type_string, shaderfunc, defaults);
 
/* Create the shader. */
vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vstext);
@@ -343,6 +391,19 @@ static test_func tests_GL3[] = {
test_glVertexAttribI4ui,
 };
 
+/* ARB_vertex_attrib_64bit */
+DEFINE_TEST(glVertexAttribL1d,,  (1, x),   "attr", R, DOUBLE_TYPE, 
"")
+DEFINE_TEST(glVertexAttribL2d,,  (1, x, y),"attr", RG, 
DOUBLE_TYPE, "")
+DEFINE_TEST(glVertexAttribL3d,,  (1, x, y, z), "attr", RGB, 
DOUBLE_TYPE, "")
+DEFINE_TEST(glVertexAttribL4d,,  (1, x, y, z, w),  "attr", RGBA, 
DOUBLE_TYPE, "")
+
+static test_func tests_GL_ARB_vertex_attrib_64bit[] = {
+   test_glVertexAttribL1d,
+   test_glVertexAttribL2d,
+   test_glVertexAttribL3d,
+   test_glVertexAttribL4d,
+};
+
 /* ARB_vertex_type_2_10_10_10_rev */
 /* Packing functions for a signed normalized 2-bit component.
  * These are based on equation 2.2 and 2.3 from the opengl specification, see:
@@ -503,6 +564,7 @@ struct test_set {
 } test_sets[] = {
{ TESTS(GL2) },
{ TESTS(GL3), 30 },
+   { TESTS(GL_ARB_vertex_attrib_64bit), 32 },
{ TESTS(GL_ARB_vertex_type_2_10_10_10_rev), 0, 
"GL_ARB_vertex_type_2_10_10_10_rev" },
 };
 
diff --git a/tests/opengl.py b/tests/opengl.py
index 669d9055b..3ed00e5b7 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -4697,7 +4697,8 @@ with profile.test_list.group_manager(
 with profile.test_list.group_manager(
 PiglitGLTest,
 grouptools.join('spec', 

[Piglit] [PATCH] ARB_vertex_attrib_64bit: add doubles support to attributes test

2018-06-25 Thread Timothy Arceri
---
 tests/general/attribs.c | 68 +++--
 1 file changed, 65 insertions(+), 3 deletions(-)

diff --git a/tests/general/attribs.c b/tests/general/attribs.c
index 05a0d4a1e..bf627dece 100644
--- a/tests/general/attribs.c
+++ b/tests/general/attribs.c
@@ -53,6 +53,7 @@ enum {
 };
 
 enum {
+   DOUBLE_TYPE,
FLOAT_TYPE,
INT_TYPE,
UINT_TYPE
@@ -120,12 +121,13 @@ static GLboolean test(int x, int y, const char 
*shaderfunc,
  const char *info)
 {
static const char *templ = {
+   "%s \n"
"%s \n"
"#extension GL_ARB_explicit_attrib_location : require \n"
"layout(location = 1) in %s attr; \n"
"void main() { \n"
"  gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; \n"
-   "  gl_FrontColor = (%s) * vec4(1.0, 1.0, 1.0, 0.5); \n"
+   "  gl_FrontColor = vec4(%s %s) * vec4(1.0, 1.0, 1.0, 0.5); \n"
"} \n"
};
GLuint prog, vs;
@@ -139,10 +141,56 @@ static GLboolean test(int x, int y, const char 
*shaderfunc,
{0.5, 0.3, 0.9, 0.2}
};
 
+   char *defaults;
+   char *type_string;
+
+   /* From Section 11.1.1 (Vertex Attributes) of the OpenGL 4.6
+* Compatibility Profile spec:
+*
+*"Scalar and vector vertex attribute types and VertexAttrib*
+*commands used to set the values of the corresponding generic
+*attribute. values are provided if the values of the vertex
+*attribute variable are specified with fewer components than
+*required for the attribute variable. For example, the fourth
+*component of a variable of type dvec4 will be undefined if
+*specified using VertexAttribL3dv, or using a vertex array
+*specified with VertexAttribLPointer and a size of three.
+*
+* TODO: We should probably also be doing this for attribute functions
+*   other than doubles.
+*/
+   if (type == DOUBLE_TYPE) {
+   switch (mask) {
+   case R:
+   type_string = "double";
+   defaults = ", dvec3(0.0, 0.0, 1.0)";
+   break;
+   case RG:
+   type_string = "dvec2";
+   defaults = ", dvec2(0.0, 1.0)";
+   break;
+   case RGB:
+   type_string = "dvec3";
+   defaults = ", 1.0";
+   break;
+   case RGBA:
+   type_string = "dvec4";
+   defaults = "";
+   break;
+   default:
+   assert(0);
+   }
+   } else {
+   defaults = "";
+   type_string =
+   type == INT_TYPE ? "ivec4" : type == UINT_TYPE ? 
"uvec4" : "vec4";
+   }
+
sprintf(vstext, templ,
type != FLOAT_TYPE ? "#version 130" : "",
-   type == INT_TYPE ? "ivec4" : type == UINT_TYPE ? "uvec4" : 
"vec4",
-   shaderfunc);
+   type == DOUBLE_TYPE ?
+   "#extension GL_ARB_gpu_shader_fp64: enable\n#extension 
GL_ARB_vertex_attrib_64bit: enable" : "",
+   type_string, shaderfunc, defaults);
 
/* Create the shader. */
vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vstext);
@@ -343,6 +391,19 @@ static test_func tests_GL3[] = {
test_glVertexAttribI4ui,
 };
 
+/* ARB_vertex_attrib_64bit */
+DEFINE_TEST(glVertexAttribL1d,,  (1, x),   "attr", R, DOUBLE_TYPE, 
"")
+DEFINE_TEST(glVertexAttribL2d,,  (1, x, y),"attr", RG, 
DOUBLE_TYPE, "")
+DEFINE_TEST(glVertexAttribL3d,,  (1, x, y, z), "attr", RGB, 
DOUBLE_TYPE, "")
+DEFINE_TEST(glVertexAttribL4d,,  (1, x, y, z, w),  "attr", RGBA, 
DOUBLE_TYPE, "")
+
+static test_func tests_GL_ARB_vertex_attrib_64bit[] = {
+   test_glVertexAttribL1d,
+   test_glVertexAttribL2d,
+   test_glVertexAttribL3d,
+   test_glVertexAttribL4d,
+};
+
 /* ARB_vertex_type_2_10_10_10_rev */
 /* Packing functions for a signed normalized 2-bit component.
  * These are based on equation 2.2 and 2.3 from the opengl specification, see:
@@ -503,6 +564,7 @@ struct test_set {
 } test_sets[] = {
{ TESTS(GL2) },
{ TESTS(GL3), 30 },
+   { TESTS(GL_ARB_vertex_attrib_64bit), 32 },
{ TESTS(GL_ARB_vertex_type_2_10_10_10_rev), 0, 
"GL_ARB_vertex_type_2_10_10_10_rev" },
 };
 
-- 
2.17.1

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


[Piglit] [PATCH v2] arb_compute_shader: test dispatch functions with display lists

2018-06-24 Thread Timothy Arceri
S; i++) {
-   uint32_t found = p[i];
-   if (verbose)
-   printf("Atomic counter %d\n"
-  "  Reference: %u\n"
-  "  Observed:  %u\n"
-  "  Result: %s\n",
-  i, values[i], found,
-  values[i] == found ? "pass" : "fail");
-   if (values[i] != found) {
-   printf("Atomic counter test %d failed for (%d, %d, 
%d)\n",
-  i, xs, ys, zs);
-   printf("  Reference: %u\n", values[i]);
-   printf("  Observed:  %u\n", found);
-   pass = false;
-   break;
-   }
-   }
-
-   glUnmapBuffer(GL_ATOMIC_COUNTER_BUFFER);
-
-   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+   return compare_atomic_counters(values, xs, ys, zs);
 }
 
 
@@ -263,25 +278,34 @@ cs_ids_set_global_size(uint32_t x, uint32_t y, uint32_t z)
 }
 
 
-enum piglit_result
-cs_ids_run_test()
+void
+cs_ids_setup_atomics_for_test()
 {
-   enum piglit_result result;
uint32_t atomics_init[NUM_ATOMIC_COUNTERS] = { 0 };
 
+   glBindBufferBase(GL_ATOMIC_COUNTER_BUFFER, 0, atomics_bo);
+   glBufferData(GL_ATOMIC_COUNTER_BUFFER,
+sizeof(atomics_init),
+atomics_init, GL_STATIC_DRAW);
+}
+
+
+/* Running the test without checking the result is useful for creating display
+ * list tests.
+ */
+void
+cs_ids_run_test_without_check()
+{
if (verbose)
printf("Testing local dim = %dx%dx%d; "
   "global dim = %dx%dx%d\n",
   local_x, local_y, local_z,
   global_x, global_y, global_z);
 
-   if (local_x == 0 || local_y == 0 || local_z == 0)
-   return PIGLIT_FAIL;
-
-   glBindBufferBase(GL_ATOMIC_COUNTER_BUFFER, 0, atomics_bo);
-   glBufferData(GL_ATOMIC_COUNTER_BUFFER,
-sizeof(atomics_init),
-atomics_init, GL_STATIC_DRAW);
+   if (local_x == 0 || local_y == 0 || local_z == 0) {
+   fprintf(stderr, "Internal error: local size not set\n");
+   return;
+   }
 
glUseProgram(prog);
 
@@ -293,8 +317,18 @@ cs_ids_run_test()
glDispatchCompute(global_x, global_y, global_z);
}
glMemoryBarrier(GL_ALL_BARRIER_BITS);
+}
+
+
+enum piglit_result
+cs_ids_run_test()
+{
+   enum piglit_result result;
+
+   cs_ids_setup_atomics_for_test();
+   cs_ids_run_test_without_check();
 
-   result = confirm_size();
+   result = cs_ids_confirm_size();
if (result != PIGLIT_PASS)
piglit_report_result(result);
 
diff --git a/tests/spec/arb_compute_shader/cs-ids-common.h 
b/tests/spec/arb_compute_shader/cs-ids-common.h
index e7530e0d3..4879e855d 100644
--- a/tests/spec/arb_compute_shader/cs-ids-common.h
+++ b/tests/spec/arb_compute_shader/cs-ids-common.h
@@ -64,4 +64,16 @@ cs_ids_set_global_size(uint32_t x, uint32_t y, uint32_t z);
 enum piglit_result
 cs_ids_run_test();
 
+void
+cs_ids_run_test_without_check();
+
+void
+cs_ids_setup_atomics_for_test();
+
+enum piglit_result
+cs_ids_confirm_initial_atomic_counters();
+
+enum piglit_result
+cs_ids_confirm_size();
+
 #endif
diff --git a/tests/spec/arb_compute_shader/dlist.c 
b/tests/spec/arb_compute_shader/dlist.c
new file mode 100644
index 0..0cbdea743
--- /dev/null
+++ b/tests/spec/arb_compute_shader/dlist.c
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2018 Timothy Arceri
+ *
+ * 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
+ *
+ * Tests dispatch of a compute shader via displa

[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


[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);
+   

[Piglit] [PATCH] compatibility: test vertex color clamping in geom and tess shaders

2018-06-22 Thread Timothy Arceri
---
 .../tes-clamp-vertex-color.shader_test| 76 +++
 .../gs-clamp-vertex-color.shader_test | 47 
 2 files changed, 123 insertions(+)
 create mode 100644 
tests/spec/arb_tessellation_shader/execution/compatibility/tes-clamp-vertex-color.shader_test
 create mode 100644 
tests/spec/glsl-1.50/execution/compatibility/gs-clamp-vertex-color.shader_test

diff --git 
a/tests/spec/arb_tessellation_shader/execution/compatibility/tes-clamp-vertex-color.shader_test
 
b/tests/spec/arb_tessellation_shader/execution/compatibility/tes-clamp-vertex-color.shader_test
new file mode 100644
index 0..9050bb1de
--- /dev/null
+++ 
b/tests/spec/arb_tessellation_shader/execution/compatibility/tes-clamp-vertex-color.shader_test
@@ -0,0 +1,76 @@
+# GL_ARB_color_buffer_float provides a way to disable vertex color clamping,
+# but without it, the vertex colors must be clamped.
+#
+[require]
+GL COMPAT >= 3.2
+GLSL >= 1.50
+GL_ARB_tessellation_shader
+
+[vertex shader]
+#version 150 compatibility
+
+in vec4 piglit_vertex;
+
+void main()
+{
+   gl_Position = piglit_vertex;
+}
+
+[tessellation control shader]
+#version 150 compatibility
+#extension GL_ARB_tessellation_shader: require
+
+layout(vertices = 3) out;
+
+out vec4 color[];
+
+void main() {
+   gl_out[gl_InvocationID].gl_Position = 
gl_in[gl_InvocationID].gl_Position;
+   gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 0.0);
+   gl_TessLevelInner = float[2](0.0, 0.0);
+   color[gl_InvocationID] = vec4(0, 1, 0, 1);
+}
+
+[tessellation evaluation shader]
+#version 150 compatibility
+#extension GL_ARB_tessellation_shader: require
+
+layout(triangles) in;
+
+in vec4 color[];
+
+void main() {
+   gl_Position = gl_in[0].gl_Position * gl_TessCoord[0]
+   + gl_in[1].gl_Position * gl_TessCoord[1]
+   + gl_in[2].gl_Position * gl_TessCoord[2];
+
+   gl_FrontColor = vec4(-2, -1, 0.5, 3); /* (0, 0,   0.5, 1) */
+   gl_FrontSecondaryColor = vec4(2, 0.5, 1.5, -0.5); /* (1, 0.5, 1,   0) */
+}
+
+[vertex data]
+piglit_vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+-1.0  1.0
+-1.0  1.0
+ 1.0 -1.0
+ 1.0  1.0
+
+[fragment shader]
+#version 150 compatibility
+
+uniform vec4 arg0;
+void main()
+{
+   gl_FragColor = (gl_Color + gl_SecondaryColor) * 0.5;
+}
+
+[test]
+clear color 0.1 0.1 0.1 0.1
+clear
+patch parameter vertices 3
+draw arrays GL_PATCHES 0 6
+#probe all rgba 0.0 1.0 0.0 1.0
+#draw rect -1 -1 2 2
+probe rgba 1 1 0.5 0.25 0.75 0.5
diff --git 
a/tests/spec/glsl-1.50/execution/compatibility/gs-clamp-vertex-color.shader_test
 
b/tests/spec/glsl-1.50/execution/compatibility/gs-clamp-vertex-color.shader_test
new file mode 100644
index 0..e7ba1d893
--- /dev/null
+++ 
b/tests/spec/glsl-1.50/execution/compatibility/gs-clamp-vertex-color.shader_test
@@ -0,0 +1,47 @@
+# GL_ARB_color_buffer_float provides a way to disable vertex color clamping,
+# but without it, the vertex colors must be clamped.
+#
+[require]
+GL COMPAT >= 3.2
+GLSL >= 1.50
+
+[vertex shader]
+#version 150 compatibility
+
+void main()
+{
+   gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+}
+
+[geometry shader]
+#version 150 compatibility
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+varying float v;
+
+void main()
+{
+   for (int i = 0; i < 3; i++) {
+   gl_Position = gl_in[i].gl_Position;
+
+   gl_FrontColor = vec4(-2, -1, 0.5, 3); /* (0, 0,   
0.5, 1) */
+   gl_FrontSecondaryColor = vec4(2, 0.5, 1.5, -0.5); /* (1, 0.5, 
1,   0) */
+
+   EmitVertex();
+   }
+}
+
+[fragment shader]
+#version 150 compatibility
+
+uniform vec4 arg0;
+void main()
+{
+   gl_FragColor = (gl_Color + gl_SecondaryColor) * 0.5;
+}
+
+[test]
+draw rect -1 -1 2 2
+probe rgba 1 1 0.5 0.25 0.75 0.5
-- 
2.17.1

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


[Piglit] [PATCH] arb_compute_shader: test dispatch functions with display lists

2018-06-21 Thread Timothy Arceri
Atomic counter %d\n"
-  "  Reference: %u\n"
-  "  Observed:  %u\n"
-  "  Result: %s\n",
-  i, values[i], found,
-  values[i] == found ? "pass" : "fail");
-   if (values[i] != found) {
-   printf("Atomic counter test %d failed for (%d, %d, 
%d)\n",
-  i, xs, ys, zs);
-   printf("  Reference: %u\n", values[i]);
-   printf("  Observed:  %u\n", found);
-   pass = false;
-   break;
-   }
-   }
-
-   glUnmapBuffer(GL_ATOMIC_COUNTER_BUFFER);
-
-   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+   return compare_atomic_counters(values, xs, ys, zs);
 }
 
 
@@ -263,25 +278,34 @@ cs_ids_set_global_size(uint32_t x, uint32_t y, uint32_t z)
 }
 
 
-enum piglit_result
-cs_ids_run_test()
+void
+cs_ids_setup_atomics_for_test()
 {
-   enum piglit_result result;
uint32_t atomics_init[NUM_ATOMIC_COUNTERS] = { 0 };
 
+   glBindBufferBase(GL_ATOMIC_COUNTER_BUFFER, 0, atomics_bo);
+   glBufferData(GL_ATOMIC_COUNTER_BUFFER,
+sizeof(atomics_init),
+atomics_init, GL_STATIC_DRAW);
+}
+
+
+/* Running the test without checking the result is useful for creating display
+ * list tests.
+ */
+void
+cs_ids_run_test_without_check()
+{
if (verbose)
printf("Testing local dim = %dx%dx%d; "
   "global dim = %dx%dx%d\n",
   local_x, local_y, local_z,
   global_x, global_y, global_z);
 
-   if (local_x == 0 || local_y == 0 || local_z == 0)
-   return PIGLIT_FAIL;
-
-   glBindBufferBase(GL_ATOMIC_COUNTER_BUFFER, 0, atomics_bo);
-   glBufferData(GL_ATOMIC_COUNTER_BUFFER,
-sizeof(atomics_init),
-atomics_init, GL_STATIC_DRAW);
+   if (local_x == 0 || local_y == 0 || local_z == 0) {
+   fprintf(stderr, "Internal error: local size not set\n");
+   return;
+   }
 
glUseProgram(prog);
 
@@ -293,8 +317,18 @@ cs_ids_run_test()
glDispatchCompute(global_x, global_y, global_z);
}
glMemoryBarrier(GL_ALL_BARRIER_BITS);
+}
+
+
+enum piglit_result
+cs_ids_run_test()
+{
+   enum piglit_result result;
+
+   cs_ids_setup_atomics_for_test();
+   cs_ids_run_test_without_check();
 
-   result = confirm_size();
+   result = cs_ids_confirm_size();
if (result != PIGLIT_PASS)
piglit_report_result(result);
 
diff --git a/tests/spec/arb_compute_shader/cs-ids-common.h 
b/tests/spec/arb_compute_shader/cs-ids-common.h
index e7530e0d3..4879e855d 100644
--- a/tests/spec/arb_compute_shader/cs-ids-common.h
+++ b/tests/spec/arb_compute_shader/cs-ids-common.h
@@ -64,4 +64,16 @@ cs_ids_set_global_size(uint32_t x, uint32_t y, uint32_t z);
 enum piglit_result
 cs_ids_run_test();
 
+void
+cs_ids_run_test_without_check();
+
+void
+cs_ids_setup_atomics_for_test();
+
+enum piglit_result
+cs_ids_confirm_initial_atomic_counters();
+
+enum piglit_result
+cs_ids_confirm_size();
+
 #endif
diff --git a/tests/spec/arb_compute_shader/dlist.c 
b/tests/spec/arb_compute_shader/dlist.c
new file mode 100644
index 0..5af82ab30
--- /dev/null
+++ b/tests/spec/arb_compute_shader/dlist.c
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2018 Timothy Arceri
+ *
+ * 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
+ *
+ * Tests dispatch of a compute shader via display lists
+ */
+
+#include "cs-ids-common.h"
+
+static struct piglit_gl_test_config *piglit_config;
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   

Re: [Piglit] [PATCH] arb_tessellation_shader: test GL_PATCHES with immediate mode

2018-06-20 Thread Timothy Arceri



On 21/06/18 14:05, Marek Olšák wrote:

On Mon, Jun 18, 2018 at 12:50 AM, Timothy Arceri  wrote:

---
  tests/opengl.py   |   1 +
  .../arb_tessellation_shader/CMakeLists.gl.txt |   1 +
  .../immediate-mode-draw-patches.c | 111 ++
  3 files changed, 113 insertions(+)
  create mode 100644 
tests/spec/arb_tessellation_shader/immediate-mode-draw-patches.c

diff --git a/tests/opengl.py b/tests/opengl.py
index 6a6d71fb4..d1f6b99e4 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -1517,6 +1517,7 @@ with profile.test_list.group_manager(
  g(['arb_tessellation_shader-get-tcs-params'])
  g(['arb_tessellation_shader-get-tes-params'])
  g(['arb_tessellation_shader-minmax'])
+g(['arb_tessellation_shader-immediate-mode-draw-patches'])
  g(['arb_tessellation_shader-invalid-get-program-params'])
  g(['arb_tessellation_shader-invalid-patch-vertices-range'])
  g(['arb_tessellation_shader-invalid-primitive'])
diff --git a/tests/spec/arb_tessellation_shader/CMakeLists.gl.txt 
b/tests/spec/arb_tessellation_shader/CMakeLists.gl.txt
index c87e0d57d..d70b00f3f 100644
--- a/tests/spec/arb_tessellation_shader/CMakeLists.gl.txt
+++ b/tests/spec/arb_tessellation_shader/CMakeLists.gl.txt
@@ -11,6 +11,7 @@ link_libraries (

  piglit_add_executable (arb_tessellation_shader-get-tcs-params 
get-tcs-params.c)
  piglit_add_executable (arb_tessellation_shader-get-tes-params 
get-tes-params.c)
+piglit_add_executable (arb_tessellation_shader-immediate-mode-draw-patches 
immediate-mode-draw-patches.c)
  piglit_add_executable (arb_tessellation_shader-invalid-get-program-params 
invalid-get-program-params.c)
  piglit_add_executable (arb_tessellation_shader-invalid-patch-vertices-range 
invalid-patch-vertices-range.c)
  piglit_add_executable (arb_tessellation_shader-invalid-primitive 
invalid-primitive.c)
diff --git a/tests/spec/arb_tessellation_shader/immediate-mode-draw-patches.c 
b/tests/spec/arb_tessellation_shader/immediate-mode-draw-patches.c
new file mode 100644
index 0..a2bdc5157
--- /dev/null
+++ b/tests/spec/arb_tessellation_shader/immediate-mode-draw-patches.c
@@ -0,0 +1,111 @@
+/*
+ * Copyright © 2018 Timothy Arceri
+ *
+ * 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.
+ */
+
+/**
+ * Test immediate mode can draw GL_PATCHES.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 32;
+   config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
+   config.khr_no_error_support = PIGLIT_NO_ERRORS;
+PIGLIT_GL_TEST_CONFIG_END
+
+unsigned int prog;
+
+static const char *const vs_source =
+"#version 150 compatibility\n"
+"in vec4 piglit_vertex;\n"
+"void main() { gl_Position = piglit_vertex; }\n";
+
+static const char *const tcs_source =
+"#version 150 compatibility\n"
+"#extension GL_ARB_tessellation_shader: require\n"
+"layout(vertices = 3) out;\n"
+"out vec4 color[];\n"
+"void main() {\n"
+"  gl_out[gl_InvocationID].gl_Position = 
gl_in[gl_InvocationID].gl_Position;\n"
+"  gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 0.0);\n"
+"  gl_TessLevelInner = float[2](0.0, 0.0);\n"


Does the test pass? As far as I know, if you put 0 into any of the
tess factors, the primitives are killed before the tessellator.


Hmmm. I'd just copied that bit from another test. Yes the test passes.



Marek


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


[Piglit] [PATCH] arb_viewport_array: test display list support

2018-06-20 Thread Timothy Arceri
---
 tests/opengl.py   |   1 +
 .../spec/arb_viewport_array/CMakeLists.gl.txt |   1 +
 tests/spec/arb_viewport_array/dlist.c | 355 ++
 3 files changed, 357 insertions(+)
 create mode 100644 tests/spec/arb_viewport_array/dlist.c

diff --git a/tests/opengl.py b/tests/opengl.py
index 98bfda71f..18ba228a1 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -2691,6 +2691,7 @@ with profile.test_list.group_manager(
 grouptools.join('spec', 'arb_viewport_array')) as g:
 g(['arb_viewport_array-viewport-indices'], 'viewport-indices')
 g(['arb_viewport_array-depthrange-indices'], 'depthrange-indices')
+g(['arb_viewport_array-dlist'], 'display-list')
 g(['arb_viewport_array-scissor-check'], 'scissor-check')
 g(['arb_viewport_array-scissor-indices'], 'scissor-indices')
 g(['arb_viewport_array-bounds'], 'bounds')
diff --git a/tests/spec/arb_viewport_array/CMakeLists.gl.txt 
b/tests/spec/arb_viewport_array/CMakeLists.gl.txt
index 85715774c..90f87ba87 100644
--- a/tests/spec/arb_viewport_array/CMakeLists.gl.txt
+++ b/tests/spec/arb_viewport_array/CMakeLists.gl.txt
@@ -11,6 +11,7 @@ link_libraries(
 piglit_add_executable(arb_viewport_array-clear clear.c)
 piglit_add_executable(arb_viewport_array-viewport-indices viewport_indices.c)
 piglit_add_executable(arb_viewport_array-depthrange-indices 
depth_range_indices.c)
+piglit_add_executable(arb_viewport_array-dlist dlist.c)
 piglit_add_executable(arb_viewport_array-scissor-check scissor_check.c)
 piglit_add_executable(arb_viewport_array-scissor-indices scissor_indices.c)
 piglit_add_executable(arb_viewport_array-bounds bounds.c)
diff --git a/tests/spec/arb_viewport_array/dlist.c 
b/tests/spec/arb_viewport_array/dlist.c
new file mode 100644
index 0..35f78ec0f
--- /dev/null
+++ b/tests/spec/arb_viewport_array/dlist.c
@@ -0,0 +1,355 @@
+/*
+ * Copyright © 2018 Timothy Arceri
+ *
+ * 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.
+ */
+
+/**
+ * Verify that commands added in ARB_viewport_array are compiled into display
+ * lists.
+ */
+
+#include "piglit-util-gl.h"
+#include 
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 32;
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+   config.khr_no_error_support = PIGLIT_NO_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+#define MIN_VP 16
+
+enum mode {
+   set_scalar,
+   set_vector,
+   set_array_of_vectors,
+   get_and_compare
+};
+
+enum function_type {
+   viewport,
+   scissor,
+   depth
+};
+
+#define GEN_BUFFERS(type, n, c, div)   \
+   type outbuf[n * c]; \
+   unsigned jjj;   \
+   \
+   for (jjj = 0; jjj < (n * c); jjj++) {   \
+   outbuf[jjj] = (type) value++;   \
+   outbuf[jjj] /= div; \
+   }
+
+#define SET_SCALAR_INDICES2(type, func, n, c)  \
+   do {\
+   /* depth values are clamped between 0 and 1.0   \
+* so we divide by 100. \
+*/ \
+   GEN_BUFFERS(type, n, c, 100.0); \
+   gl ## func  \
+   (i, \
+outbuf[0], \
+outbuf[1]);\
+   } while (0)
+
+#define SET_SCALAR_INDICES4(type, func, n, c)  \
+   do {\
+ 

[Piglit] [PATCH] arb_shader_subroutine: add simple display list test

2018-06-19 Thread Timothy Arceri
---
 .../simple-subroutine-dlist.shader_test   | 92 +++
 1 file changed, 92 insertions(+)
 create mode 100644 
tests/spec/arb_shader_subroutine/execution/simple-subroutine-dlist.shader_test

diff --git 
a/tests/spec/arb_shader_subroutine/execution/simple-subroutine-dlist.shader_test
 
b/tests/spec/arb_shader_subroutine/execution/simple-subroutine-dlist.shader_test
new file mode 100644
index 0..fb4926e6b
--- /dev/null
+++ 
b/tests/spec/arb_shader_subroutine/execution/simple-subroutine-dlist.shader_test
@@ -0,0 +1,92 @@
+# simple display list test using one shader subroutine.
+
+[require]
+GL COMPAT >= 3.2
+GLSL >= 1.50
+GL_ARB_shader_subroutine
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 150
+#extension GL_ARB_shader_subroutine: enable
+
+out vec4 color;
+
+subroutine vec4 getcolor();
+subroutine uniform getcolor GetColor;
+
+subroutine(getcolor)
+vec4 color_red()
+{
+   return vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+subroutine(getcolor)
+vec4 color_green()
+{
+   return vec4(0.0, 1.0, 0.0, 1.0);
+}
+
+subroutine(getcolor)
+vec4 color_blue()
+{
+   return vec4(0.0, 0.0, 1.0, 1.0);
+}
+
+void main()
+{
+   color = GetColor();
+}
+
+
+[test]
+clear color 0.1 0.1 0.1 0.1
+clear
+
+# Initialise subroutine to make sure call list is respected
+subuniform GL_FRAGMENT_SHADER GetColor color_blue
+draw rect -1 -1 2 2
+probe all rgba 0.0 0.0 1.0 1.0
+
+clear color 0.1 0.1 0.1 0.1
+clear
+
+newlist GL_COMPILE
+subuniform GL_FRAGMENT_SHADER GetColor color_red
+draw rect -1 -1 2 2
+endlist
+
+# make sure we haven't drawn anything yet
+probe all rgba 0.1 0.1 0.1 0.1
+
+# Set wrong subroutine to make sure the call list is respected
+subuniform GL_FRAGMENT_SHADER GetColor color_blue
+draw rect -1 -1 2 2
+probe all rgba 0.0 0.0 1.0 1.0
+
+calllist
+probe all rgba 1.0 0.0 0.0 1.0
+
+deletelist
+
+clear color 0.1 0.1 0.1 0.1
+clear
+
+newlist GL_COMPILE_AND_EXECUTE
+subuniform GL_FRAGMENT_SHADER GetColor color_green
+draw rect -1 -1 2 2
+endlist
+
+probe all rgba 0.0 1.0 0.0 1.0
+
+# Set wrong subroutine to make sure the call list is respected
+subuniform GL_FRAGMENT_SHADER GetColor color_blue
+draw rect -1 -1 2 2
+probe all rgba 0.0 0.0 1.0 1.0
+
+clear color 0.1 0.1 0.1 0.1
+clear
+
+calllist
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.17.1

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


[Piglit] [PATCH] arb_gpu_shader_fp64: test display list support

2018-06-19 Thread Timothy Arceri
---
 tests/opengl.py   |   1 +
 .../arb_gpu_shader_fp64/CMakeLists.gl.txt |   1 +
 .../arb_gpu_shader_fp64/dlist-fp64-uniforms.c | 406 ++
 3 files changed, 408 insertions(+)
 create mode 100644 tests/spec/arb_gpu_shader_fp64/dlist-fp64-uniforms.c

diff --git a/tests/opengl.py b/tests/opengl.py
index d1f6b99e4..98bfda71f 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -1988,6 +1988,7 @@ with profile.test_list.group_manager(
 g(['arb_gpu_shader_fp64-fs-getuniformdv'])
 g(['arb_gpu_shader_fp64-gs-getuniformdv'])
 g(['arb_gpu_shader_fp64-wrong-type-setter'])
+g(['arb_gpu_shader_fp64-dlist-uniforms'])
 g(['arb_gpu_shader_fp64-double_in_bool_uniform'])
 g(['arb_gpu_shader_fp64-uniform-invalid-operation'])
 g(['arb_gpu_shader_fp64-vs-non-uniform-control-flow-const'])
diff --git a/tests/spec/arb_gpu_shader_fp64/CMakeLists.gl.txt 
b/tests/spec/arb_gpu_shader_fp64/CMakeLists.gl.txt
index 209442f32..704da7f0e 100644
--- a/tests/spec/arb_gpu_shader_fp64/CMakeLists.gl.txt
+++ b/tests/spec/arb_gpu_shader_fp64/CMakeLists.gl.txt
@@ -8,6 +8,7 @@ link_libraries (
${OPENGL_gl_LIBRARY}
 )
 
+piglit_add_executable (arb_gpu_shader_fp64-dlist-uniforms 
dlist-fp64-uniforms.c)
 piglit_add_executable (arb_gpu_shader_fp64-double_in_bool_uniform 
double_in_bool_uniform.c)
 piglit_add_executable (arb_gpu_shader_fp64-fs-non-uniform-control-flow-ssbo 
fs-non-uniform-control-flow-ssbo.c)
 piglit_add_executable (arb_gpu_shader_fp64-vs-non-uniform-control-flow-ssbo 
vs-non-uniform-control-flow-ssbo.c)
diff --git a/tests/spec/arb_gpu_shader_fp64/dlist-fp64-uniforms.c 
b/tests/spec/arb_gpu_shader_fp64/dlist-fp64-uniforms.c
new file mode 100644
index 0..b4f07d709
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/dlist-fp64-uniforms.c
@@ -0,0 +1,406 @@
+/*
+ * Copyright © 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.
+ */
+
+/**
+ * Verify that unsigned glUniform* commands added in ARB_gpu_shader_fp64 are
+ * compiled into display lists.
+ *
+ * This test is adapted from tests/spec/arb_separate_shader_objects/dlist.c
+ */
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   /* No supports_gl_core_version setting because there are no display
+* lists in core profile.
+*/
+   config.supports_gl_compat_version = 32;
+   config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+   config.khr_no_error_support = PIGLIT_NO_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static bool Uniformd(void);
+static bool UniformMatrixd(void);
+
+void
+piglit_init(int argc, char **argv)
+{
+   bool pass = true;
+
+   piglit_require_extension("GL_ARB_gpu_shader_fp64");
+
+   pass = Uniformd() && pass;
+   pass = UniformMatrixd() && pass;
+
+   piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
+
+enum mode {
+   set_scalar,
+   set_vector,
+   get_and_compare
+};
+
+#define NONMATRIX_UNIFORM(type, n, suffix) \
+   do {\
+   type inbuf[n];  \
+   type outbuf[n]; \
+   unsigned jjj;   \
+   \
+   for (jjj = 0; jjj < n; jjj++)   \
+   outbuf[jjj] = (type) value++;   \
+   \
+   switch (m) {\
+   case set_scalar:\
+   switch (n) {\
+   case 1: \
+   glUniform1 ## suffix\
+   

Re: [Piglit] [PATCH] ARB_get_program_binary: Test that XFB varying info works on program reload

2018-06-18 Thread Timothy Arceri
   if (!gpb_restore_program(prog, binary, bin_length, bin_format)) {
+   free(binary);
+   fprintf(stderr, "failed to restore binary program\n");
+   piglit_report_result(PIGLIT_FAIL);
+   }
+   free(binary);
+
+   /* Query XFB varying information. */
+   if (!get_programiv(prog, GL_TRANSFORM_FEEDBACK_BUFFER_MODE,
+  GL_SEPARATE_ATTRIBS))
+   piglit_report_result(PIGLIT_FAIL);
+
+   if (!get_programiv(prog, GL_TRANSFORM_FEEDBACK_VARYINGS,
+  ARRAY_SIZE(varyings) - 1))
+   piglit_report_result(PIGLIT_FAIL);


It would be nice to actually compare the strings too. If you add that 
and add this test to tests/opengl.py then this is:


Reviewed-by: Timothy Arceri 


+
+   glDeleteProgram(prog);
+
+   piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
+
+enum piglit_result
+piglit_display(void)
+{
+   return PIGLIT_FAIL;
+}
--
2.14.4

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


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

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


[Piglit] [PATCH] arb_tessellation_shader: test GL_PATCHES with immediate mode

2018-06-17 Thread Timothy Arceri
---
 tests/opengl.py   |   1 +
 .../arb_tessellation_shader/CMakeLists.gl.txt |   1 +
 .../immediate-mode-draw-patches.c | 111 ++
 3 files changed, 113 insertions(+)
 create mode 100644 
tests/spec/arb_tessellation_shader/immediate-mode-draw-patches.c

diff --git a/tests/opengl.py b/tests/opengl.py
index 6a6d71fb4..d1f6b99e4 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -1517,6 +1517,7 @@ with profile.test_list.group_manager(
 g(['arb_tessellation_shader-get-tcs-params'])
 g(['arb_tessellation_shader-get-tes-params'])
 g(['arb_tessellation_shader-minmax'])
+g(['arb_tessellation_shader-immediate-mode-draw-patches'])
 g(['arb_tessellation_shader-invalid-get-program-params'])
 g(['arb_tessellation_shader-invalid-patch-vertices-range'])
 g(['arb_tessellation_shader-invalid-primitive'])
diff --git a/tests/spec/arb_tessellation_shader/CMakeLists.gl.txt 
b/tests/spec/arb_tessellation_shader/CMakeLists.gl.txt
index c87e0d57d..d70b00f3f 100644
--- a/tests/spec/arb_tessellation_shader/CMakeLists.gl.txt
+++ b/tests/spec/arb_tessellation_shader/CMakeLists.gl.txt
@@ -11,6 +11,7 @@ link_libraries (
 
 piglit_add_executable (arb_tessellation_shader-get-tcs-params get-tcs-params.c)
 piglit_add_executable (arb_tessellation_shader-get-tes-params get-tes-params.c)
+piglit_add_executable (arb_tessellation_shader-immediate-mode-draw-patches 
immediate-mode-draw-patches.c)
 piglit_add_executable (arb_tessellation_shader-invalid-get-program-params 
invalid-get-program-params.c)
 piglit_add_executable (arb_tessellation_shader-invalid-patch-vertices-range 
invalid-patch-vertices-range.c)
 piglit_add_executable (arb_tessellation_shader-invalid-primitive 
invalid-primitive.c)
diff --git a/tests/spec/arb_tessellation_shader/immediate-mode-draw-patches.c 
b/tests/spec/arb_tessellation_shader/immediate-mode-draw-patches.c
new file mode 100644
index 0..a2bdc5157
--- /dev/null
+++ b/tests/spec/arb_tessellation_shader/immediate-mode-draw-patches.c
@@ -0,0 +1,111 @@
+/*
+ * Copyright © 2018 Timothy Arceri
+ *
+ * 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.
+ */
+
+/**
+ * Test immediate mode can draw GL_PATCHES.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 32;
+   config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
+   config.khr_no_error_support = PIGLIT_NO_ERRORS;
+PIGLIT_GL_TEST_CONFIG_END
+
+unsigned int prog;
+
+static const char *const vs_source =
+"#version 150 compatibility\n"
+"in vec4 piglit_vertex;\n"
+"void main() { gl_Position = piglit_vertex; }\n";
+
+static const char *const tcs_source =
+"#version 150 compatibility\n"
+"#extension GL_ARB_tessellation_shader: require\n"
+"layout(vertices = 3) out;\n"
+"out vec4 color[];\n"
+"void main() {\n"
+"  gl_out[gl_InvocationID].gl_Position = 
gl_in[gl_InvocationID].gl_Position;\n"
+"  gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 0.0);\n"
+"  gl_TessLevelInner = float[2](0.0, 0.0);\n"
+"  color[gl_InvocationID] = vec4(0, 1, 0, 1);\n"
+"}\n";
+
+static const char *const tes_source =
+"#version 150 compatibility\n"
+"#extension GL_ARB_tessellation_shader: require\n"
+"layout(triangles) in;\n"
+"in vec4 color[];\n"
+"void main() { \n"
+"  gl_Position = gl_in[0].gl_Position * gl_TessCoord[0]\n"
+"  + gl_in[1].gl_Position * gl_TessCoord[1]\n"
+"  + gl_in[2].gl_Position * gl_TessCoord[2];\n"
+"\n"
+"  gl_FrontColor = color[0] * gl_TessCoord[0]\n"
+" + color[1] * gl_TessCoord[1]\n"
+" + c

[Piglit] [PATCH 1/2] glsl-1.50: test gs interaction with fixed function fragment shader

2018-06-17 Thread Timothy Arceri
---
 .../compatibility/gs-ff-frag.shader_test  | 42 ++
 .../compatibility/vs-gs-ff-frag.shader_test   | 43 +++
 2 files changed, 85 insertions(+)
 create mode 100644 
tests/spec/glsl-1.50/execution/compatibility/gs-ff-frag.shader_test
 create mode 100644 
tests/spec/glsl-1.50/execution/compatibility/vs-gs-ff-frag.shader_test

diff --git 
a/tests/spec/glsl-1.50/execution/compatibility/gs-ff-frag.shader_test 
b/tests/spec/glsl-1.50/execution/compatibility/gs-ff-frag.shader_test
new file mode 100644
index 0..6adbea828
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/compatibility/gs-ff-frag.shader_test
@@ -0,0 +1,42 @@
+[require]
+GL COMPAT >= 3.2
+GLSL >= 1.50
+
+[vertex shader]
+#version 150 compatibility
+
+void main()
+{
+   gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+}
+
+[geometry shader]
+#version 150 compatibility
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+varying float v;
+
+void main()
+{
+   for (int i = 0; i < 3; i++) {
+   gl_Position = gl_in[i].gl_Position;
+   gl_FrontColor = vec4(0.0, 1.0, 0.5, 1.0);
+
+   /* Verify that a geometry shader that writes a
+* non-fixed-function varying is compatible with
+* fixed-function fragment processing.
+*/
+   v = 0.0;
+
+   EmitVertex();
+   }
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+ortho
+draw rect 10 10 10 10
+probe rgb 15 15 0.0 1.0 0.5
diff --git 
a/tests/spec/glsl-1.50/execution/compatibility/vs-gs-ff-frag.shader_test 
b/tests/spec/glsl-1.50/execution/compatibility/vs-gs-ff-frag.shader_test
new file mode 100644
index 0..4622d6303
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/compatibility/vs-gs-ff-frag.shader_test
@@ -0,0 +1,43 @@
+[require]
+GL COMPAT >= 3.2
+GLSL >= 1.50
+
+[vertex shader]
+#version 150 compatibility
+
+void main()
+{
+   gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+   gl_FrontColor = vec4(0.0, 1.0, 0.0, 1.0);
+}
+
+[geometry shader]
+#version 150 compatibility
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+varying float v;
+
+void main()
+{
+   for (int i = 0; i < 3; i++) {
+   gl_Position = gl_in[i].gl_Position;
+   gl_FrontColor = gl_in[i].gl_FrontColor;
+
+   /* Verify that a geometry shader that writes a
+* non-fixed-function varying is compatible with
+* fixed-function fragment processing.
+*/
+   v = 0.0;
+
+   EmitVertex();
+   }
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+ortho
+draw rect 10 10 10 10
+probe rgb 15 15 0.0 1.0 0.0
-- 
2.17.1

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


[Piglit] [PATCH 2/2] arb_tessellation_shader: test tes interaction with fixed function fragment shader

2018-06-17 Thread Timothy Arceri
---
 .../compatibility/tcs-tes-ff-frag.shader_test | 63 +++
 1 file changed, 63 insertions(+)
 create mode 100644 
tests/spec/arb_tessellation_shader/execution/compatibility/tcs-tes-ff-frag.shader_test

diff --git 
a/tests/spec/arb_tessellation_shader/execution/compatibility/tcs-tes-ff-frag.shader_test
 
b/tests/spec/arb_tessellation_shader/execution/compatibility/tcs-tes-ff-frag.shader_test
new file mode 100644
index 0..94d1cebd8
--- /dev/null
+++ 
b/tests/spec/arb_tessellation_shader/execution/compatibility/tcs-tes-ff-frag.shader_test
@@ -0,0 +1,63 @@
+[require]
+GL COMPAT >= 3.2
+GLSL >= 1.50
+GL_ARB_tessellation_shader
+
+[vertex shader]
+#version 150 compatibility
+
+in vec4 piglit_vertex;
+
+void main()
+{
+   gl_Position = piglit_vertex;
+}
+
+[tessellation control shader]
+#version 150 compatibility
+#extension GL_ARB_tessellation_shader: require
+
+layout(vertices = 3) out;
+
+out vec4 color[];
+
+void main() {
+   gl_out[gl_InvocationID].gl_Position = 
gl_in[gl_InvocationID].gl_Position;
+   gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 0.0);
+   gl_TessLevelInner = float[2](0.0, 0.0);
+   color[gl_InvocationID] = vec4(0, 1, 0, 1);
+}
+
+[tessellation evaluation shader]
+#version 150 compatibility
+#extension GL_ARB_tessellation_shader: require
+
+layout(triangles) in;
+
+in vec4 color[];
+
+void main() {
+   gl_Position = gl_in[0].gl_Position * gl_TessCoord[0]
+   + gl_in[1].gl_Position * gl_TessCoord[1]
+   + gl_in[2].gl_Position * gl_TessCoord[2];
+
+   gl_FrontColor = color[0] * gl_TessCoord[0]
+  + color[1] * gl_TessCoord[1]
+  + color[2] * gl_TessCoord[2];
+}
+
+[vertex data]
+piglit_vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+-1.0  1.0
+-1.0  1.0
+ 1.0 -1.0
+ 1.0  1.0
+
+[test]
+clear color 0.1 0.1 0.1 0.1
+clear
+patch parameter vertices 3
+draw arrays GL_PATCHES 0 6
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.17.1

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


Re: [Piglit] [PATCH 9/9] ARB_get_program_binary: Test that restoring active program takes effect

2018-06-17 Thread Timothy Arceri

Looks like you forgot to add these to tests/opengl.py ?

On 09/06/18 15:48, Jordan Justen wrote:

Signed-off-by: Jordan Justen 
Cc: Timothy Arceri 
---
  .../arb_get_program_binary/CMakeLists.gl.txt  |   2 +
  .../restore-implicit-use-program.c| 145 ++
  2 files changed, 147 insertions(+)
  create mode 100644 
tests/spec/arb_get_program_binary/restore-implicit-use-program.c

diff --git a/tests/spec/arb_get_program_binary/CMakeLists.gl.txt 
b/tests/spec/arb_get_program_binary/CMakeLists.gl.txt
index 2f2b99aaa..0032d9f2a 100644
--- a/tests/spec/arb_get_program_binary/CMakeLists.gl.txt
+++ b/tests/spec/arb_get_program_binary/CMakeLists.gl.txt
@@ -12,5 +12,7 @@ piglit_add_executable (arb_get_program_binary-api-errors 
api-errors.c)
  piglit_add_executable (arb_get_program_binary-overrun overrun.c)
  piglit_add_executable (arb_get_program_binary-retrievable_hint 
retrievable_hint.c)
  piglit_add_executable (arb_get_program_binary-reset-uniform reset-uniform.c 
gpb-common.c)
+piglit_add_executable (arb_get_program_binary-restore-implicit-use-program
+   restore-implicit-use-program.c gpb-common.c)
  
  # vim: ft=cmake:

diff --git a/tests/spec/arb_get_program_binary/restore-implicit-use-program.c 
b/tests/spec/arb_get_program_binary/restore-implicit-use-program.c
new file mode 100644
index 0..51060c8e5
--- /dev/null
+++ b/tests/spec/arb_get_program_binary/restore-implicit-use-program.c
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2018 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 restore-implicit-use-program.c
+ *
+ * Ref: https://bugs.freedesktop.org/show_bug.cgi?id=106810
+ *
+ * From section 7.3 (Program Objects) of the OpenGL 4.5 spec:
+ *
+ *"If LinkProgram or ProgramBinary successfully re-links a program
+ * object that is active for any shader stage, then the newly generated
+ * executable code will be installed as part of the current rendering
+ * state for all shader stages where the program is active.
+ * Additionally, the newly generated executable code is made part of
+ * the state of any program pipeline for all stages where the program
+ * is attached."
+ */
+
+#include "piglit-util-gl.h"
+#include "gpb-common.h"
+#include 
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 30;
+   config.window_visual = PIGLIT_GL_VISUAL_RGB;
+   config.khr_no_error_support = PIGLIT_NO_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+void
+piglit_init(int argc, char **argv)
+{
+   GLsizei bin_length;
+   void *green_binary;
+   GLenum bin_format;
+   int num_formats = 0;
+   float red[] = { 1.0, 0.0, 0.0, 1.0 };
+   float green[] = { 0.0, 1.0, 0.0, 1.0 };
+   GLuint green_prog, red_then_green_prog;
+   bool pass = true;
+
+   static const char vs_source[] =
+   "void main()\n"
+   "{\n"
+   "gl_Position = gl_Vertex;\n"
+   "}\n";
+   static const char green_fs_source[] =
+   "#version 120\n"
+   "void main()\n"
+   "{\n"
+   "gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);\n"
+   "}\n";
+   static const char red_fs_source[] =
+   "#version 120\n"
+   "void main()\n"
+   "{\n"
+   "gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n"
+   "}\n";
+
+   piglit_require_extension("GL_ARB_get_program_binary");
+
+   glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, _formats);
+   if (num_formats == 0)
+   piglit_report_result(PIGLIT_SKIP);
+
+   green_prog = piglit_build_simple_pr

Re: [Piglit] [PATCH] glsl-4.60: backdate semicolon test to run from glsl 1.10

2018-06-13 Thread Timothy Arceri

Reviewed-by: Timothy Arceri 

On 14/06/18 10:24, Dave Airlie wrote:

From: Dave Airlie 

Since this was a bug fix and real world apps have the old behaviour
---
  .../glsl-4.60/compiler/extra-semilons-at-global-scope.frag   | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/spec/glsl-4.60/compiler/extra-semilons-at-global-scope.frag 
b/tests/spec/glsl-4.60/compiler/extra-semilons-at-global-scope.frag
index 9da6ade08..b4cb9adb4 100644
--- a/tests/spec/glsl-4.60/compiler/extra-semilons-at-global-scope.frag
+++ b/tests/spec/glsl-4.60/compiler/extra-semilons-at-global-scope.frag
@@ -1,9 +1,10 @@
  // [config]
  // expect_result: pass
-// glsl_version: 4.60
+// glsl_version: 1.10
  // [end config]
+// Although the fix is in GLSL 4.60 we should allows this across all GLSL 
versions.
  
-#version 460

+#version 110
  
  // From the GLSL 4.60 spec, section 1.2.1 (Summary of Changes from Revision 7

  // of GLSL Version 4.50):


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


Re: [Piglit] [PATCH 1/9] shader_runner: Support testing GL_NUM_PROGRAM_BINARY_FORMATS

2018-06-10 Thread Timothy Arceri

On 10/06/18 16:06, Jordan Justen wrote:

On 2018-06-09 21:56:33, Timothy Arceri wrote:

Small nit with patch 2. Patch 8 seems obsolete with patch 6 I'm a
missing something?


They are close. Patch 6 tests that the uniform is reset by examining
the result of drawing. Patch 8 tests by reading the uniform value via
the GL API.

I guess there is a small chance that restoring the program might
somehow cause a different result in the program state vs the GL API
state.

I wrote 6 and 8 last fall, and I can't remember if I saw an actual bug
that made me write the test in patch 8.


Ah ok. I'll admit I stopped looking to close when I thought they were 
the same thing, you can add my r-b to that one also.




-Jordan


Otherwise, this series looks great thanks for working on it :)

Reviewed-by: Timothy Arceri 

On 09/06/18 15:47, Jordan Justen wrote:

Signed-off-by: Jordan Justen 
---
   tests/shaders/shader_runner.c | 16 
   1 file changed, 16 insertions(+)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 794524e8f..c4e25a33d 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -98,6 +98,7 @@ static int gl_max_vertex_uniform_components;
   static int gl_max_vertex_attribs;
   static int gl_max_varying_components;
   static int gl_max_clip_planes;
+static int gl_num_program_binary_formats = 0;
   
   static const char *test_start = NULL;

   static unsigned test_start_line_num = 0;
@@ -768,6 +769,11 @@ process_requirement(const char *line)
   _max_varying_components,
   "varying components",
   },
+ {
+ "GL_NUM_PROGRAM_BINARY_FORMATS",
+ _num_program_binary_formats,
+ "num program binary formats",
+ },
   };
   unsigned i;
   
@@ -4090,6 +4096,16 @@ piglit_init(int argc, char **argv)

   read_width = render_width = piglit_width;
   read_height = render_height = piglit_height;
   
+#ifdef PIGLIT_USE_OPENGL

+ if (piglit_is_extension_supported("GL_ARB_get_program_binary"))
+ glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS,
+   _num_program_binary_formats);
+#else
+ if (piglit_is_extension_supported("GL_OES_get_program_binary"))
+ glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS_OES,
+   _num_program_binary_formats);
+#endif
+
   /* Automatic mode can run multiple tests per session. */
   if (report_subtests) {
   char testname[4096], *ext;


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


Re: [Piglit] [PATCH 1/9] shader_runner: Support testing GL_NUM_PROGRAM_BINARY_FORMATS

2018-06-09 Thread Timothy Arceri
Small nit with patch 2. Patch 8 seems obsolete with patch 6 I'm a 
missing something?


Otherwise, this series looks great thanks for working on it :)

Reviewed-by: Timothy Arceri 

On 09/06/18 15:47, Jordan Justen wrote:

Signed-off-by: Jordan Justen 
---
  tests/shaders/shader_runner.c | 16 
  1 file changed, 16 insertions(+)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 794524e8f..c4e25a33d 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -98,6 +98,7 @@ static int gl_max_vertex_uniform_components;
  static int gl_max_vertex_attribs;
  static int gl_max_varying_components;
  static int gl_max_clip_planes;
+static int gl_num_program_binary_formats = 0;
  
  static const char *test_start = NULL;

  static unsigned test_start_line_num = 0;
@@ -768,6 +769,11 @@ process_requirement(const char *line)
_max_varying_components,
"varying components",
},
+   {
+   "GL_NUM_PROGRAM_BINARY_FORMATS",
+   _num_program_binary_formats,
+   "num program binary formats",
+   },
};
unsigned i;
  
@@ -4090,6 +4096,16 @@ piglit_init(int argc, char **argv)

read_width = render_width = piglit_width;
read_height = render_height = piglit_height;
  
+#ifdef PIGLIT_USE_OPENGL

+   if (piglit_is_extension_supported("GL_ARB_get_program_binary"))
+   glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS,
+ _num_program_binary_formats);
+#else
+   if (piglit_is_extension_supported("GL_OES_get_program_binary"))
+   glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS_OES,
+ _num_program_binary_formats);
+#endif
+
/* Automatic mode can run multiple tests per session. */
if (report_subtests) {
char testname[4096], *ext;


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


Re: [Piglit] [PATCH 8/9] ARB_get_program_binary: Test that uniforms are reset on program reload (API)

2018-06-09 Thread Timothy Arceri

Isn't this exactly the same test as patch 6?

On 09/06/18 15:48, Jordan Justen wrote:

Signed-off-by: Jordan Justen 
---
  .../arb_get_program_binary/CMakeLists.gl.txt  |   1 +
  .../arb_get_program_binary/reset-uniform.c| 121 ++
  2 files changed, 122 insertions(+)
  create mode 100644 tests/spec/arb_get_program_binary/reset-uniform.c

diff --git a/tests/spec/arb_get_program_binary/CMakeLists.gl.txt 
b/tests/spec/arb_get_program_binary/CMakeLists.gl.txt
index 9e71ce010..2f2b99aaa 100644
--- a/tests/spec/arb_get_program_binary/CMakeLists.gl.txt
+++ b/tests/spec/arb_get_program_binary/CMakeLists.gl.txt
@@ -11,5 +11,6 @@ link_libraries (
  piglit_add_executable (arb_get_program_binary-api-errors api-errors.c)
  piglit_add_executable (arb_get_program_binary-overrun overrun.c)
  piglit_add_executable (arb_get_program_binary-retrievable_hint 
retrievable_hint.c)
+piglit_add_executable (arb_get_program_binary-reset-uniform reset-uniform.c 
gpb-common.c)
  
  # vim: ft=cmake:

diff --git a/tests/spec/arb_get_program_binary/reset-uniform.c 
b/tests/spec/arb_get_program_binary/reset-uniform.c
new file mode 100644
index 0..93defd378
--- /dev/null
+++ b/tests/spec/arb_get_program_binary/reset-uniform.c
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2017 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 reset-uniform.c
+ *
+ * From the ARB_get_program_binary extension spec:
+ *
+ * "A successful call to ProgramBinary will reset all uniform variables
+ *  to their initial values. The initial value is either the value of
+ *  the variable's initializer as specified in the original shader
+ *  source, or 0 if no initializer was present."
+ *
+ * Verify that a uniform value as read through the OpenGL API is
+ * restored to its initial value when glProgramBinary is used.
+ */
+
+#include "piglit-util-gl.h"
+#include "gpb-common.h"
+#include 
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 30;
+   config.window_visual = PIGLIT_GL_VISUAL_RGB;
+   config.khr_no_error_support = PIGLIT_NO_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static GLuint prog;
+
+static void
+check_color(const float *exp, const float *clr)
+{
+   if (exp[0] != clr[0] || exp[1] != clr[1] || exp[2] != clr[2] ||
+   exp[3] != clr[3]) {
+   fprintf(stderr, "uniform color didn't match expected color\n");
+   piglit_report_result(PIGLIT_FAIL);
+   }
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+   int num_formats = 0;
+   float red[] = { 1.0, 0.0, 0.0, 1.0 };
+   float green[] = { 0.0, 1.0, 0.0, 1.0 };
+   float clr[4];
+   GLint loc;
+
+   static const char vs_source[] =
+   "void main()\n"
+   "{\n"
+   "gl_Position = gl_Vertex;\n"
+   "}\n";
+   static const char fs_source[] =
+   "#version 120\n"
+   "uniform vec4 color = vec4(0.0, 1.0, 0.0, 1.0);\n"
+   "\n"
+   "void main()\n"
+   "{\n"
+   "gl_FragColor = color;\n"
+   "}\n";
+
+   piglit_require_extension("GL_ARB_get_program_binary");
+
+   glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, _formats);
+   if (num_formats == 0)
+   piglit_report_result(PIGLIT_SKIP);
+
+   prog = piglit_build_simple_program(vs_source, fs_source);
+   glUseProgram(prog);
+
+   loc = glGetUniformLocation(prog, "color");
+   if (loc < 0)
+   piglit_report_result(PIGLIT_FAIL);
+
+   glGetUniformfv(prog, loc, clr);
+   check_color(green, clr);
+
+   glUniform4fv(loc, 1, red);
+   glGetUniformfv(prog, loc, clr);
+   check_color(red, clr);
+
+   gpb_save_restore();
+
+   loc = glGetUniformLocation(prog, "color");
+   if (loc < 0)
+   piglit_report_result(PIGLIT_FAIL);
+
+   

Re: [Piglit] [PATCH 2/9] shader_runner: Add -get-program-binary parameter

2018-06-09 Thread Timothy Arceri



On 09/06/18 15:48, Jordan Justen wrote:

This parameter will test ARB_get_program_binary and
OES_get_program_binary with any shader runner test.

If -get-program-binary, then shader_runner will check to see if the
extension is supported, and if 1 or more binary formats are supported.
If the extensions are not supported, or 0 formats are supported, then
the test will result in a skip.

If the program binary extension is supported and 1 or more binary
formats are supported, then following a successful link of the shader
runner program:

1. GetProgramBinary will be used to get the program
2. A new program will be generated
3. ProgramBinary will be used on the new program with the previously
returned binary
4. The old program will be deleted
5. The shader runner will continue to run using the new program

Although this is not a focused test of the get_program_binary
extensions, it does allow any of the thousands of previously written
shader runner tests to be run while testing get_program_binary.

Signed-off-by: Jordan Justen 
---
  tests/shaders/shader_runner.c | 96 +++
  1 file changed, 96 insertions(+)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index c4e25a33d..b3f1b3deb 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -149,6 +149,8 @@ static GLuint draw_fbo, read_fbo;
  static GLint render_width, render_height;
  static GLint read_width, read_height;
  
+static bool use_get_program_binary = false;

+
  static bool report_subtests = false;
  
  static struct texture_binding {

@@ -580,6 +582,88 @@ compile_and_bind_program(GLenum target, const char *start, 
int len)
return PIGLIT_PASS;
  }
  
+static bool

+program_binary_save_restore()
+{
+   GLint binary_length;
+   void *binary;
+   GLenum binary_format;
+   GLint ok;
+   GLuint new_prog;
+
+   if (!use_get_program_binary)
+   return true;
+
+   glGetProgramiv(prog, GL_LINK_STATUS, );
+   if (!ok)
+   return true;
+
+#ifdef PIGLIT_USE_OPENGL
+   glGetProgramiv(prog, GL_PROGRAM_BINARY_LENGTH, _length);
+#else
+   glGetProgramiv(prog, GL_PROGRAM_BINARY_LENGTH_OES, _length);
+#endif
+   if (!piglit_check_gl_error(GL_NO_ERROR)) {
+   fprintf(stderr, "glGetProgramiv GL_PROGRAM_BINARY_LENGTH "
+   "error\n");
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   binary = malloc(binary_length);
+   if (!binary)
+   return false;


nit: maybe print and error here. If anyone (or the CI system) ever hit 
this it might be confusing to just see the test failed ... although it 
would seem they have bigger issues.



+
+#ifdef PIGLIT_USE_OPENGL
+   glGetProgramBinary(prog, binary_length, _length, _format,
+  binary);
+#else
+   glGetProgramBinaryOES(prog, binary_length, _length,
+ _format, binary);
+#endif
+   if (!piglit_check_gl_error(GL_NO_ERROR)) {
+   fprintf(stderr, "glGetProgramBinary error\n");
+   free(binary);
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   new_prog = glCreateProgram();
+   if (!piglit_check_gl_error(GL_NO_ERROR)) {
+   free(binary);
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+#ifdef PIGLIT_USE_OPENGL
+   glProgramBinary(new_prog, binary_format, binary, binary_length);
+#else
+   glProgramBinaryOES(new_prog, binary_format, binary, binary_length);
+#endif
+   free(binary);
+   if (!piglit_check_gl_error(GL_NO_ERROR)) {
+   fprintf(stderr, "glProgramBinary error "
+   "(should not happend according to spec.)\n");
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   glGetProgramiv(prog, GL_LINK_STATUS, );
+   if (!ok) {
+   fprintf(stderr, "link failure after glProgramBinary\n");
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   if (prog_in_use) {
+   glUseProgram(new_prog);
+   if (!piglit_check_gl_error(GL_NO_ERROR))
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   glDeleteProgram(prog);
+   if (!piglit_check_gl_error(GL_NO_ERROR))
+   piglit_report_result(PIGLIT_FAIL);
+   prog = new_prog;
+
+   return true;
+}
+
  static enum piglit_result
  link_sso(GLenum target)
  {
@@ -606,6 +690,9 @@ link_sso(GLenum target)
return PIGLIT_FAIL;
}
  
+	if (!program_binary_save_restore())

+   return PIGLIT_FAIL;
+
switch (target) {
case GL_VERTEX_SHADER:
sso_vertex_prog = prog;
@@ -1097,6 +1184,8 @@ link_and_use_shaders(void)
glLinkProgram(prog);
  
  	if (!sso_in_use) {

+   if (!program_binary_save_restore())
+   return PIGLIT_FAIL;
glGetProgramiv(prog, 

Re: [Piglit] [PATCH] general/draw: Test that checks propper render order in mixed draw setups.

2018-06-05 Thread Timothy Arceri

On 05/06/18 16:05, mathias.froehl...@gmx.net wrote:

From: Mathias Fröhlich 

Hi all,

The description below,
Please review!!

best
Mathias



The test checks for propper immediate mode flushes when array draws
are mixed with immediate mode draws.
The test abstracts out what went wrong in bugzilla #106594.

Signed-off-by: Mathias Fröhlich 
---
  tests/general/CMakeLists.gl.txt |   1 +
  tests/general/draw-flush-vertices.c | 111 
  2 files changed, 112 insertions(+)
  create mode 100644 tests/general/draw-flush-vertices.c

diff --git a/tests/general/CMakeLists.gl.txt b/tests/general/CMakeLists.gl.txt
index ceec9f0b6..7f530974e 100644
--- a/tests/general/CMakeLists.gl.txt
+++ b/tests/general/CMakeLists.gl.txt
@@ -40,6 +40,7 @@ piglit_add_executable (draw-batch draw-batch.c)
  piglit_add_executable (draw-copypixels-sync draw-copypixels-sync.c)
  piglit_add_executable (draw-elements draw-elements.c)
  piglit_add_executable (draw-elements-vs-inputs draw-elements-vs-inputs.c)
+piglit_add_executable (draw-flush-vertices draw-flush-vertices.c)
  piglit_add_executable (draw-pixel-with-texture draw-pixel-with-texture.c)
  piglit_add_executable (draw-sync draw-sync.c)
  piglit_add_executable (draw-pixels draw-pixels.c)
diff --git a/tests/general/draw-flush-vertices.c 
b/tests/general/draw-flush-vertices.c
new file mode 100644
index 0..9932a6bc0
--- /dev/null
+++ b/tests/general/draw-flush-vertices.c
@@ -0,0 +1,111 @@
+/*
+ * Copyright © 2018 Mathias Fröhlich 
+ *
+ * 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:
+ *Mathias Fröhlich 
+ */
+
+/* The test does mixes immediate mode and array draws, but does not
+ * not do an other draw setup past the immediate mode draw. By that
+ * it checks for the order of draws that may be inverted if the queued
+ * immediate mode draws are not properly flushed before the array draw.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 11;
+
+   config.window_width = 32;
+   config.window_height = 32;
+   config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
+   config.khr_no_error_support = PIGLIT_NO_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+void piglit_init(int argc, char **argv)
+{
+   piglit_require_gl_version(11);
+
+   piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
+
+   glDisable(GL_DEPTH_TEST);
+   glClearColor(0.0, 0.0, 0.0, 1.0);
+}


nit:

Normally we try to put piglit_init() at the bottom so we can get right 
into the interesting things first.


Otherwise this is:

Acked-by: Timothy Arceri 

Thanks for writing a piglit test to cover this!


+
+
+enum piglit_result
+piglit_display(void)
+{
+   const GLfloat Vertices[2*4] = {
+   0, 0,
+   piglit_width, 0,
+   piglit_width, piglit_height,
+   0, piglit_height
+   };
+   const GLfloat Colors[4*3] = {
+   1, 0, 0,
+   1, 0, 0,
+   1, 0, 0,
+   1, 0, 0
+   };
+
+   GLboolean pass = GL_TRUE;
+
+   glViewport(0, 0, piglit_width, piglit_height);
+
+   glEnableClientState(GL_VERTEX_ARRAY);
+   glVertexPointer(2, GL_FLOAT, sizeof(GLfloat)*2, Vertices);
+   glEnableClientState(GL_COLOR_ARRAY);
+   glColorPointer(3, GL_FLOAT, sizeof(GLfloat)*3, Colors);
+
+   glClear(GL_COLOR_BUFFER_BIT);
+
+   /* Draw a blue quad */
+   glBegin(GL_QUADS);
+   glColor3f(0, 0, 1);
+   glVertex2fv([0]);
+   glVertex2fv([2]);
+   glVertex2fv([4]);
+   glVertex2fv([6]);
+   glEnd();
+
+   /* OpenGL has to make sure that prior to the glDrawArrays call
+* all immediate mode rendering has landed.
+*/
+
+   /* Draw a red quad */
+   glDrawArrays(GL_QUADS, 0, 4);
+
+   if (!pig

[Piglit] [PATCH] glsl-1.10: test loop unrolling when induction variable is inside if branch

2018-06-03 Thread Timothy Arceri
---
 ...induction-variable-inside-if-branch.shader_test | 61 ++
 1 file changed, 61 insertions(+)
 create mode 100644 
tests/spec/glsl-1.10/execution/vs-loop-simple-unroll-induction-variable-inside-if-branch.shader_test

diff --git 
a/tests/spec/glsl-1.10/execution/vs-loop-simple-unroll-induction-variable-inside-if-branch.shader_test
 
b/tests/spec/glsl-1.10/execution/vs-loop-simple-unroll-induction-variable-inside-if-branch.shader_test
new file mode 100644
index 0..1990db8ea
--- /dev/null
+++ 
b/tests/spec/glsl-1.10/execution/vs-loop-simple-unroll-induction-variable-inside-if-branch.shader_test
@@ -0,0 +1,61 @@
+# This tests unrolling of a loop with a single exit point.
+#
+# Here we test that loop is correctly unrolled when the induction variable is
+# inside an if branch.
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+void main()
+{
+  gl_Position = gl_Vertex;
+
+  vec4 colour = vec4(1.0, 0.0, 0.0, 1.0);
+
+  int i = 1;
+  int j = 0; // we use this so the if doesn't get reduced to a series of bcsel
+  do {
+
+j++;
+
+if (i >= 3) {
+  if (i == 3) {
+ colour = vec4(0.0, 1.0, 0.0, 1.0);
+ j++;
+ if (j != 6)
+   colour = vec4(1.0, 0.0, 1.0, 1.0);
+  } else {
+colour = vec4(1.0, 1.0, 0.0, 1.0);
+  }
+  break;
+} else {
+  if (i != 1) {
+ j++;
+  }
+}
+
+   if (i >= 5) {
+  j++; // unreachable
+  break;
+} else {
+  if (i != 1) {
+ j++;
+  }
+  i++;
+}
+  } while (i < 4);
+
+  gl_FrontColor = colour;
+}
+
+[fragment shader]
+void main()
+{
+  gl_FragColor = gl_Color;
+}
+
+[test]
+clear color 0.5 0.5 0.5 0.5
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.14.3

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


Re: [Piglit] [PATCH] vertex-program-two-side: Fix GCC format-security warnings.

2018-05-31 Thread Timothy Arceri

Thanks. Are these warning not enabled by default?

Reviewed-by: Timothy Arceri 

On 01/06/18 07:46, Vinson Lee wrote:

vertex-program-two-side.c: In function ‘piglit_display’:
vertex-program-two-side.c:370:3: warning: format not a string literal and no 
format arguments [-Wformat-security]
piglit_report_subtest_result(PIGLIT_SKIP, tests[3]);
^~~~
vertex-program-two-side.c:371:3: warning: format not a string literal and no 
format arguments [-Wformat-security]
piglit_report_subtest_result(PIGLIT_SKIP, tests[4]);
^~~~
vertex-program-two-side.c:372:3: warning: format not a string literal and no 
format arguments [-Wformat-security]
piglit_report_subtest_result(PIGLIT_SKIP, tests[5]);
^~~~
vertex-program-two-side.c:375:3: warning: format not a string literal and no 
format arguments [-Wformat-security]
piglit_report_subtest_result(PIGLIT_SKIP, tests[1]);
^~~~
vertex-program-two-side.c:376:3: warning: format not a string literal and no 
format arguments [-Wformat-security]
piglit_report_subtest_result(PIGLIT_SKIP, tests[2]);
^~~~
vertex-program-two-side.c:377:3: warning: format not a string literal and no 
format arguments [-Wformat-security]
piglit_report_subtest_result(PIGLIT_SKIP, tests[3]);
^~~~
vertex-program-two-side.c:378:3: warning: format not a string literal and no 
format arguments [-Wformat-security]
piglit_report_subtest_result(PIGLIT_SKIP, tests[4]);
^~~~
vertex-program-two-side.c:379:3: warning: format not a string literal and no 
format arguments [-Wformat-security]
piglit_report_subtest_result(PIGLIT_SKIP, tests[5]);
^~~~

Fixes: 09b3a817d273 ("ARB_tessellation_shader: test gl_*Color built-ins with 
tessellation shaders")
Signed-off-by: Vinson Lee 
---
  tests/spec/gl-2.0/vertex-program-two-side.c | 16 
  1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tests/spec/gl-2.0/vertex-program-two-side.c 
b/tests/spec/gl-2.0/vertex-program-two-side.c
index a659e521ba5a..4623c70a65cd 100644
--- a/tests/spec/gl-2.0/vertex-program-two-side.c
+++ b/tests/spec/gl-2.0/vertex-program-two-side.c
@@ -367,16 +367,16 @@ piglit_display(void)
free(tcs_source);
free(tes_source);
} else {
-   piglit_report_subtest_result(PIGLIT_SKIP, tests[3]);
-   piglit_report_subtest_result(PIGLIT_SKIP, tests[4]);
-   piglit_report_subtest_result(PIGLIT_SKIP, tests[5]);
+   piglit_report_subtest_result(PIGLIT_SKIP, "%s", tests[3]);
+   piglit_report_subtest_result(PIGLIT_SKIP, "%s", tests[4]);
+   piglit_report_subtest_result(PIGLIT_SKIP, "%s", tests[5]);
}
} else {
-   piglit_report_subtest_result(PIGLIT_SKIP, tests[1]);
-   piglit_report_subtest_result(PIGLIT_SKIP, tests[2]);
-   piglit_report_subtest_result(PIGLIT_SKIP, tests[3]);
-   piglit_report_subtest_result(PIGLIT_SKIP, tests[4]);
-   piglit_report_subtest_result(PIGLIT_SKIP, tests[5]);
+   piglit_report_subtest_result(PIGLIT_SKIP, "%s", tests[1]);
+   piglit_report_subtest_result(PIGLIT_SKIP, "%s", tests[2]);
+   piglit_report_subtest_result(PIGLIT_SKIP, "%s", tests[3]);
+   piglit_report_subtest_result(PIGLIT_SKIP, "%s", tests[4]);
+   piglit_report_subtest_result(PIGLIT_SKIP, "%s", tests[5]);
}
  
  	return pass ? PIGLIT_PASS : PIGLIT_FAIL;



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


Re: [Piglit] [PATCH] gl-3.2-compat: Fix GCC format-security warnings.

2018-05-31 Thread Timothy Arceri

Reviewed-by: Timothy Arceri 

On 01/06/18 07:31, Vinson Lee wrote:

glsl-fs-fogscale.c: In function ‘piglit_display’:
glsl-fs-fogscale.c:140:3: warning: format not a string literal and no format 
arguments [-Wformat-security]
piglit_report_subtest_result(PIGLIT_SKIP, tests[1]);
^~~~
glsl-fs-fogscale.c:141:3: warning: format not a string literal and no format 
arguments [-Wformat-security]
piglit_report_subtest_result(PIGLIT_SKIP, tests[2]);
^~~~

Fixes: e28f602973f6 ("gl-3.2-compat: test gl_FogFragCoord built-in with geometry 
shaders")
Signed-off-by: Vinson Lee 
---
  tests/shaders/glsl-fs-fogscale.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/shaders/glsl-fs-fogscale.c b/tests/shaders/glsl-fs-fogscale.c
index 8945371bfc0b..ff682dc48150 100644
--- a/tests/shaders/glsl-fs-fogscale.c
+++ b/tests/shaders/glsl-fs-fogscale.c
@@ -137,8 +137,8 @@ piglit_display(void)
pass = pass && test_prog(prog, tests[2]);
  
  	} else {

-   piglit_report_subtest_result(PIGLIT_SKIP, tests[1]);
-   piglit_report_subtest_result(PIGLIT_SKIP, tests[2]);
+   piglit_report_subtest_result(PIGLIT_SKIP, "%s", tests[1]);
+   piglit_report_subtest_result(PIGLIT_SKIP, "%s", tests[2]);
}
  
  	return pass ? PIGLIT_PASS : PIGLIT_FAIL;



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


Re: [Piglit] [PATCH] gl-3.0: Remove unused variable.

2018-05-29 Thread Timothy Arceri

Thanks!

Reviewed-by: Timothy Arceri 

On 30/05/18 10:10, Vinson Lee wrote:

Fix build warning.

dlist-uint-uniforms.c: In function ‘piglit_init’:
dlist-uint-uniforms.c:48:11: warning: unused variable ‘glsl_version’ 
[-Wunused-variable]
   unsigned glsl_version;
^~~~

Fixes: 6ab75f7eb5e1 ("gl-3.0: test glUniform*ui{v} functions are compiled into 
display lists")
Signed-off-by: Vinson Lee 
---
  tests/spec/gl-3.0/dlist-uint-uniforms.c | 1 -
  1 file changed, 1 deletion(-)

diff --git a/tests/spec/gl-3.0/dlist-uint-uniforms.c 
b/tests/spec/gl-3.0/dlist-uint-uniforms.c
index b1f52c98c177..c2e7e481d2c6 100644
--- a/tests/spec/gl-3.0/dlist-uint-uniforms.c
+++ b/tests/spec/gl-3.0/dlist-uint-uniforms.c
@@ -45,7 +45,6 @@ static bool Uniformui(void);
  void
  piglit_init(int argc, char **argv)
  {
-   unsigned glsl_version;
bool pass = true;
  
  	pass = Uniformui() && pass;



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


Re: [Piglit] [PATCH 3/3] glsl-1.50: test compat built in constants

2018-05-28 Thread Timothy Arceri

I forgot to add this to OpenGL.py but I've fixed it locally.

On 29/05/18 10:52, Timothy Arceri wrote:

---
  tests/spec/glsl-1.50/minimum-maximums-compat.txt | 4 
  1 file changed, 4 insertions(+)
  create mode 100644 tests/spec/glsl-1.50/minimum-maximums-compat.txt

diff --git a/tests/spec/glsl-1.50/minimum-maximums-compat.txt 
b/tests/spec/glsl-1.50/minimum-maximums-compat.txt
new file mode 100644
index 0..5aee27634
--- /dev/null
+++ b/tests/spec/glsl-1.50/minimum-maximums-compat.txt
@@ -0,0 +1,4 @@
+150 compatibility
+gl_MaxClipPlanes 8
+gl_MaxTextureCoords 8
+gl_MaxTextureUnits 2


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


[Piglit] [PATCH 1/3] built-in-constants: add support for testing compatibility profile built ins

2018-05-28 Thread Timothy Arceri
---
 tests/shaders/built-in-constants.c | 18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/tests/shaders/built-in-constants.c 
b/tests/shaders/built-in-constants.c
index 32cd2638f..e1512a04c 100644
--- a/tests/shaders/built-in-constants.c
+++ b/tests/shaders/built-in-constants.c
@@ -39,6 +39,7 @@ unsigned num_tests = 0;
 int required_glsl_version = 0;
 char required_glsl_version_string[128];
 bool es_shader = false;
+bool compat_shader = false;
 GLenum shader_type = 0;
 
 /**
@@ -116,6 +117,8 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
config.supports_gl_es_version = 30;
break;
case 310:
+   config.supports_gl_es_version = 31;
+
/* It seems impossible that a desktop OpenGL implementation
 * would support GL_ARB_ES3_1_compatibility and not support at
 * least OpenGL 3.2.  Realistically, the compute shader
@@ -123,14 +126,15 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 * GL_ARB_ES3_1_compatibility implementations will be OpenGL
 * 4.2 or later.
 */
-   config.supports_gl_core_version = 32;
-   config.supports_gl_es_version = 31;
-   break;
+   if (!compat_shader) {
+   config.supports_gl_core_version = 32;
+   break;
+   }
default: {
const unsigned int gl_version
= 
required_gl_version_from_glsl_version(required_glsl_version);
config.supports_gl_compat_version = gl_version;
-   if (gl_version < 31)
+   if (gl_version < 31 || compat_shader)
config.supports_gl_core_version = 0;
else
config.supports_gl_core_version = gl_version;
@@ -208,7 +212,7 @@ parse_file(const char *filename)
 
/* The format of the test file is:
 *
-* version [es|core]
+* version [es|core|compatibility]
 * 
GL_VERTEX_SHADER|GL_GEOMETRY_SHADER|GL_FRAGMENT_SHADER|GL_COMPUTE_SHADER
 * GL_ARB_some_extension
 * gl_MaxFoo 8
@@ -232,11 +236,13 @@ parse_file(const char *filename)
required_glsl_version = strtol(line, , 10);
parse_whitespace(endptr, (const char **));
es_shader = strncmp("es\n", line, 3) == 0;
+   compat_shader = strncmp("compatibility\n", line, 7) == 0;
 
if (required_glsl_version <= 0 ||
(line != end_of_line &&
 strncmp("es\n", line, 3) != 0 &&
-strncmp("core\n", line, 5) != 0)) {
+strncmp("core\n", line, 5) != 0 &&
+strncmp("compatibility\n", line, 7) != 0)) {
fprintf(stderr, "Parse error in version line.\n");
piglit_report_result(PIGLIT_FAIL);
}
-- 
2.17.0

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


[Piglit] [PATCH 2/3] built-in-constants: fix desktop GL version check for geometry shaders

2018-05-28 Thread Timothy Arceri
The check is meant to compare GLSL version which for OpenGL 3.2 is
1.50.
---
 tests/shaders/built-in-constants.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/shaders/built-in-constants.c 
b/tests/shaders/built-in-constants.c
index e1512a04c..df5fa2a84 100644
--- a/tests/shaders/built-in-constants.c
+++ b/tests/shaders/built-in-constants.c
@@ -400,7 +400,7 @@ create_shader(GLenum type)
 * OpenGL 3.2.
 */
if (type == GL_GEOMETRY_SHADER &&
-   required_glsl_version < 320)
+   required_glsl_version < 150)
return 0;
}
/* Only create compute shaders when explicitly requested
-- 
2.17.0

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


[Piglit] [PATCH 3/3] glsl-1.50: test compat built in constants

2018-05-28 Thread Timothy Arceri
---
 tests/spec/glsl-1.50/minimum-maximums-compat.txt | 4 
 1 file changed, 4 insertions(+)
 create mode 100644 tests/spec/glsl-1.50/minimum-maximums-compat.txt

diff --git a/tests/spec/glsl-1.50/minimum-maximums-compat.txt 
b/tests/spec/glsl-1.50/minimum-maximums-compat.txt
new file mode 100644
index 0..5aee27634
--- /dev/null
+++ b/tests/spec/glsl-1.50/minimum-maximums-compat.txt
@@ -0,0 +1,4 @@
+150 compatibility
+gl_MaxClipPlanes 8
+gl_MaxTextureCoords 8
+gl_MaxTextureUnits 2
-- 
2.17.0

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


Re: [Piglit] [PATCH 2/3] arb_tessellation_shader: add basic display list test for glPatchParameteri()

2018-05-28 Thread Timothy Arceri

This and the following patch should have:

GL COMPAT >= 3.2

I've fixed this locally.

On 28/05/18 20:36, Timothy Arceri wrote:

---
  .../tcs-tes-vertex-dlist.shader_test  | 89 +++
  1 file changed, 89 insertions(+)
  create mode 100644 
tests/spec/arb_tessellation_shader/execution/tcs-tes-vertex-dlist.shader_test

diff --git 
a/tests/spec/arb_tessellation_shader/execution/tcs-tes-vertex-dlist.shader_test 
b/tests/spec/arb_tessellation_shader/execution/tcs-tes-vertex-dlist.shader_test
new file mode 100644
index 0..bcae48cd4
--- /dev/null
+++ 
b/tests/spec/arb_tessellation_shader/execution/tcs-tes-vertex-dlist.shader_test
@@ -0,0 +1,89 @@
+[require]
+GLSL >= 1.50
+GL_ARB_tessellation_shader
+
+
+[vertex shader passthrough]
+
+
+[tessellation control shader]
+#extension GL_ARB_tessellation_shader: require
+layout(vertices = 3) out;
+
+out vec4 color[];
+
+void main() {
+   gl_out[gl_InvocationID].gl_Position = 
gl_in[gl_InvocationID].gl_Position;
+   gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 0.0);
+   gl_TessLevelInner = float[2](0.0, 0.0);
+   color[gl_InvocationID] = vec4(0, 1, 0, 1);
+}
+
+
+[tessellation evaluation shader]
+#extension GL_ARB_tessellation_shader: require
+layout(triangles) in;
+
+in vec4 color[];
+out vec4 color_fs;
+
+void main() {
+   gl_Position = gl_in[0].gl_Position * gl_TessCoord[0]
+   + gl_in[1].gl_Position * gl_TessCoord[1]
+   + gl_in[2].gl_Position * gl_TessCoord[2];
+
+   color_fs = color[0] * gl_TessCoord[0]
+  + color[1] * gl_TessCoord[1]
+  + color[2] * gl_TessCoord[2];
+}
+
+
+[fragment shader]
+in vec4 color_fs;
+
+void main()
+{
+   gl_FragColor = color_fs;
+}
+
+[vertex data]
+piglit_vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+-1.0  1.0
+-1.0  1.0
+ 1.0 -1.0
+ 1.0  1.0
+
+[test]
+clear color 0.1 0.1 0.1 0.1
+clear
+
+newlist GL_COMPILE
+patch parameter vertices 3
+draw arrays GL_PATCHES 0 6
+endlist
+
+# make sure we haven't drawn anything yet
+probe all rgba 0.1 0.1 0.1 0.1
+
+# Set wrong patch param to make sure the call list is respected
+patch parameter vertices 4
+
+calllist
+probe all rgba 0.0 1.0 0.0 1.0
+
+deletelist
+
+clear color 0.1 0.1 0.1 0.1
+clear
+
+# make sure we haven't drawn anything yet
+probe all rgba 0.1 0.1 0.1 0.1
+
+newlist GL_COMPILE_AND_EXECUTE
+patch parameter vertices 3
+draw arrays GL_PATCHES 0 6
+endlist
+
+probe all rgba 0.0 1.0 0.0 1.0


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


[Piglit] [PATCH 1/3] shader_runner: add basic display list support

2018-05-28 Thread Timothy Arceri
---
 tests/shaders/shader_runner.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index c2b27ad20..794524e8f 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -2952,6 +2952,7 @@ piglit_display(void)
GLbitfield clear_bits = 0;
bool link_error_expected = false;
int ubo_array_index = 0;
+   unsigned list = 0;
 
if (test_start == NULL)
return PIGLIT_PASS;
@@ -3865,6 +3866,21 @@ piglit_display(void)
active_program_interface(rest);
} else if (parse_str(line, "vertex attrib ", )) {
set_vertex_attrib(rest);
+   } else if (parse_str(line, "newlist ", )) {
+   GLenum mode;
+
+   REQUIRE(parse_enum_gl(rest, , ),
+   "NewList mode command not understood at %s\n",
+   rest);
+
+   list = glGenLists(1);
+   glNewList(list, mode);
+   } else if (parse_str(line, "endlist", NULL)) {
+   glEndList();
+   } else if (parse_str(line, "calllist", NULL)) {
+   glCallList(list);
+   } else if (parse_str(line, "deletelist", NULL)) {
+   glDeleteLists(list, 1);
} else if ((line[0] != '\n') && (line[0] != '\0')
   && (line[0] != '#')) {
printf("unknown command \"%s\"\n", line);
-- 
2.17.0

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


[Piglit] [PATCH 3/3] arb_tessellation_shader: test display list support for glPatchParameterfv()

2018-05-28 Thread Timothy Arceri
---
 ...r-tessouter-inputs-quads-dlist.shader_test | 83 +++
 1 file changed, 83 insertions(+)
 create mode 100644 
tests/spec/arb_tessellation_shader/execution/vs-tes-tessinner-tessouter-inputs-quads-dlist.shader_test

diff --git 
a/tests/spec/arb_tessellation_shader/execution/vs-tes-tessinner-tessouter-inputs-quads-dlist.shader_test
 
b/tests/spec/arb_tessellation_shader/execution/vs-tes-tessinner-tessouter-inputs-quads-dlist.shader_test
new file mode 100644
index 0..249843dcd
--- /dev/null
+++ 
b/tests/spec/arb_tessellation_shader/execution/vs-tes-tessinner-tessouter-inputs-quads-dlist.shader_test
@@ -0,0 +1,83 @@
+[require]
+GLSL >= 1.50
+GL_ARB_tessellation_shader
+
+
+[vertex shader]
+in vec4 vertex;
+
+void main()
+{
+   gl_Position = vertex;
+}
+
+
+[tessellation evaluation shader]
+#extension GL_ARB_tessellation_shader: require
+layout(quads) in;
+
+out vec4 color;
+
+void main() {
+   gl_Position = vec4(gl_TessCoord.xy * 2 - 1, 0, 1);
+   color = gl_TessLevelOuter[0] == 2.0 &&
+   gl_TessLevelOuter[1] == 4.0 &&
+   gl_TessLevelOuter[2] == 7.0 &&
+   gl_TessLevelOuter[3] == 6.0 &&
+   gl_TessLevelInner[0] == 5.0 &&
+   gl_TessLevelInner[1] == 3.0 ?
+   vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+
+[fragment shader]
+in vec4 color;
+
+void main()
+{
+   gl_FragColor = color;
+}
+
+[vertex data]
+vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+-1.0  1.0
+-1.0  1.0
+ 1.0 -1.0
+ 1.0  1.0
+
+[test]
+clear color 0.1 0.1 0.1 0.1
+clear
+
+newlist GL_COMPILE
+patch parameter vertices 4
+patch parameter default level outer 2 4 7 6
+patch parameter default level inner 5 3
+draw arrays GL_PATCHES 0 6
+endlist
+
+# make sure we haven't drawn anything yet
+probe all rgba 0.1 0.1 0.1 0.1
+
+# Set wrong patch param to make sure the call list is respected
+patch parameter default level outer 1 3 5 2
+patch parameter default level inner 6 4
+
+calllist
+probe all rgba 0.0 1.0 0.0 1.0
+deletelist
+
+clear color 0.1 0.1 0.1 0.1
+clear
+
+newlist GL_COMPILE_AND_EXECUTE
+patch parameter vertices 4
+patch parameter default level outer 2 4 7 6
+patch parameter default level inner 5 3
+draw arrays GL_PATCHES 0 6
+endlist
+
+probe all rgba 0.0 1.0 0.0 1.0
+deletelist
-- 
2.17.0

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


[Piglit] [PATCH 2/3] arb_tessellation_shader: add basic display list test for glPatchParameteri()

2018-05-28 Thread Timothy Arceri
---
 .../tcs-tes-vertex-dlist.shader_test  | 89 +++
 1 file changed, 89 insertions(+)
 create mode 100644 
tests/spec/arb_tessellation_shader/execution/tcs-tes-vertex-dlist.shader_test

diff --git 
a/tests/spec/arb_tessellation_shader/execution/tcs-tes-vertex-dlist.shader_test 
b/tests/spec/arb_tessellation_shader/execution/tcs-tes-vertex-dlist.shader_test
new file mode 100644
index 0..bcae48cd4
--- /dev/null
+++ 
b/tests/spec/arb_tessellation_shader/execution/tcs-tes-vertex-dlist.shader_test
@@ -0,0 +1,89 @@
+[require]
+GLSL >= 1.50
+GL_ARB_tessellation_shader
+
+
+[vertex shader passthrough]
+
+
+[tessellation control shader]
+#extension GL_ARB_tessellation_shader: require
+layout(vertices = 3) out;
+
+out vec4 color[];
+
+void main() {
+   gl_out[gl_InvocationID].gl_Position = 
gl_in[gl_InvocationID].gl_Position;
+   gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 0.0);
+   gl_TessLevelInner = float[2](0.0, 0.0);
+   color[gl_InvocationID] = vec4(0, 1, 0, 1);
+}
+
+
+[tessellation evaluation shader]
+#extension GL_ARB_tessellation_shader: require
+layout(triangles) in;
+
+in vec4 color[];
+out vec4 color_fs;
+
+void main() {
+   gl_Position = gl_in[0].gl_Position * gl_TessCoord[0]
+   + gl_in[1].gl_Position * gl_TessCoord[1]
+   + gl_in[2].gl_Position * gl_TessCoord[2];
+
+   color_fs = color[0] * gl_TessCoord[0]
+  + color[1] * gl_TessCoord[1]
+  + color[2] * gl_TessCoord[2];
+}
+
+
+[fragment shader]
+in vec4 color_fs;
+
+void main()
+{
+   gl_FragColor = color_fs;
+}
+
+[vertex data]
+piglit_vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+-1.0  1.0
+-1.0  1.0
+ 1.0 -1.0
+ 1.0  1.0
+
+[test]
+clear color 0.1 0.1 0.1 0.1
+clear
+
+newlist GL_COMPILE
+patch parameter vertices 3
+draw arrays GL_PATCHES 0 6
+endlist
+
+# make sure we haven't drawn anything yet
+probe all rgba 0.1 0.1 0.1 0.1
+
+# Set wrong patch param to make sure the call list is respected
+patch parameter vertices 4
+
+calllist
+probe all rgba 0.0 1.0 0.0 1.0
+
+deletelist
+
+clear color 0.1 0.1 0.1 0.1
+clear
+
+# make sure we haven't drawn anything yet
+probe all rgba 0.1 0.1 0.1 0.1
+
+newlist GL_COMPILE_AND_EXECUTE
+patch parameter vertices 3
+draw arrays GL_PATCHES 0 6
+endlist
+
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.17.0

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


[Piglit] [PATCH 1/2] piglit-util-gl: add support for using patches with fixed function attributes

2018-05-27 Thread Timothy Arceri
---
 tests/util/piglit-util-gl.c | 20 
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index 2443be03e..ebd57d77b 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -684,10 +684,22 @@ piglit_draw_rect_from_arrays(const void *verts, const 
void *tex,
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
}
 
-   if (instance_count > 1)
-   glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, 
instance_count);
-   else
-   glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+   if (use_patches) {
+   GLint old_patch_vertices;
+
+   glGetIntegerv(GL_PATCH_VERTICES, _patch_vertices);
+   glPatchParameteri(GL_PATCH_VERTICES, 4);
+   if (instance_count > 1)
+   glDrawArraysInstanced(GL_PATCHES, 0, 4, 
instance_count);
+   else
+   glDrawArrays(GL_PATCHES, 0, 4);
+   glPatchParameteri(GL_PATCH_VERTICES, 
old_patch_vertices);
+   } else {
+   if (instance_count > 1)
+   glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, 
instance_count);
+   else
+   glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+   }
 
if (verts)
glDisableClientState(GL_VERTEX_ARRAY);
-- 
2.17.0

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


[Piglit] [PATCH 2/2] ARB_tessellation_shader: test gl_*Color built-ins with tessellation shaders

2018-05-27 Thread Timothy Arceri
---
 tests/spec/gl-2.0/vertex-program-two-side.c | 157 ++--
 1 file changed, 147 insertions(+), 10 deletions(-)

diff --git a/tests/spec/gl-2.0/vertex-program-two-side.c 
b/tests/spec/gl-2.0/vertex-program-two-side.c
index c53668124..a659e521b 100644
--- a/tests/spec/gl-2.0/vertex-program-two-side.c
+++ b/tests/spec/gl-2.0/vertex-program-two-side.c
@@ -66,9 +66,18 @@ static float secondary_frontcolor[4] = {0.0, 0.25, 0.0, 0.0};
 static float secondary_backcolor[4] = {0.0, 0.0, 0.25, 0.0};
 static int draw_secondary_loc;
 
+char *dummy_outputs[4] = {"", "", "", ""};
 char *vs_outputs[4] = {"", "", "", ""};
 char *gs_outputs[4] = {"", "", "", ""};
 char *gs_inputs_outputs[4] = {"", "", "", ""};
+char *tcs_outputs[4] = {"", "", "", ""};
+char *tcs_inputs_outputs[4] = {"", "", "", ""};
+char *tes_outputs[4] = {"", "", "", ""};
+char *tes_inputs_outputs[4] = {"", "", "", ""};
+
+const char * tests[7] = {"vs and fs", "gs-out and fs", "vs, gs and fs",
+"tes-out and fs", "tcs-out, tes and fs",
+"vs, tcs, tes and fs", NULL };
 
 static const char *dummy_vs_source =
"void main()\n"
@@ -130,7 +139,7 @@ probe_colors()
 }
 
 static bool
-test_prog(unsigned prog, const char *test_name)
+test_prog(unsigned prog, const char *test_name, bool use_patches)
 {
glUseProgram(prog);
draw_secondary_loc = glGetUniformLocation(prog, "draw_secondary");
@@ -144,12 +153,12 @@ test_prog(unsigned prog, const char *test_name)
glClear(GL_COLOR_BUFFER_BIT);
 
glUniform1i(draw_secondary_loc, false);
-   piglit_draw_rect(-1,  0,  1, 1); /* top left */
-   piglit_draw_rect( 1,  0, -1, 1); /* top right */
+   piglit_draw_rect_custom(-1,  0,  1, 1, use_patches, 1); /* top left */
+   piglit_draw_rect_custom( 1,  0, -1, 1, use_patches, 1); /* top right */
 
glUniform1i(draw_secondary_loc, true);
-   piglit_draw_rect(-1, -1,  1, 1); /* bot left */
-   piglit_draw_rect( 1, -1, -1, 1); /* bot right */
+   piglit_draw_rect_custom(-1, -1,  1, 1, use_patches, 1); /* bot left */
+   piglit_draw_rect_custom( 1, -1, -1, 1, use_patches, 1); /* bot right */
 
/* probe and report result */
bool pass = probe_colors();
@@ -183,6 +192,30 @@ setup_gs_vars(char **in_out, char **out, const char *name, 
float *values)
values[3]);
 }
 
+static void
+setup_tcs_vars(char **in_out, char **out, const char *name, float *values)
+{
+   (void)!asprintf(in_out, "   gl_out[gl_InvocationID].%s = 
gl_in[gl_InvocationID].%s;\n", name, name);
+   (void)!asprintf(out, "  gl_out[gl_InvocationID].%s = vec4(%f, %f, %f, 
%f);\n",
+   name,
+   values[0],
+   values[1],
+   values[2],
+   values[3]);
+}
+
+static void
+setup_tes_vars(char **in_out, char **out, const char *name, float *values)
+{
+   (void)!asprintf(in_out, "   INTERP_QUAD(gl_in[0].%s, %s);\n", name, 
name);
+   (void)!asprintf(out, "  INTERP_QUAD(vec4(%f, %f, %f, %f), %s);\n",
+   values[0],
+   values[1],
+   values[2],
+   values[3],
+   name);
+}
+
 static void
 create_gs_source(char **gs_source, char **builtins)
 {
@@ -205,12 +238,58 @@ create_gs_source(char **gs_source, char **builtins)
builtins[3]);
 }
 
+static void
+create_tess_source(char **tcs_source, char **tcs_builtins,
+   char **tes_source, char **tes_builtins)
+{
+   (void)!asprintf(tcs_source,
+   "#version 150 compatibility\n"
+   "#extension GL_ARB_tessellation_shader: require\n"
+   "layout(vertices = 4) out;\n"
+   "\n"
+   "void main()\n"
+   "{\n"
+   "   gl_out[gl_InvocationID].gl_Position = 
gl_in[gl_InvocationID].gl_Position;\n"
+   "   gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 1.0);\n"
+   "   gl_TessLevelInner = float[2](1.0, 1.0);\n"
+   "   %s%s%s%s\n"
+   "}\n",
+   tcs_builtins[0],
+   tcs_builtins[1],
+   tcs_builtins[2],
+   tcs_builtins[3]);
+
+   (void)!asprintf(tes_source,
+   "#version 150 compatibility\n"
+   "#extension GL_ARB_tessellation_shader: require\n"
+   "layout(quads) in;\n"
+   "\n"
+   "#define INTERP_QUAD(INi, OUT) do { \\\n"
+   "   vec4 v[4]; \\\n"
+   "   for (int i = 0; i < 4; i++) v[i] = INi; \\\n"
+   "   OUT = mix(mix(v[0], v[1], gl_TessCoord[0]), 
mix(v[2], v[3], \\\n"
+   " gl_TessCoord[0]), gl_TessCoord[1]); 
\\\n"
+   "} while(false);\n"
+   "\n"
+   "void main()\n"
+   "{\n"

[Piglit] [PATCH] gl-3.2-compat: test gl_FogFragCoord built-in with geometry shaders

2018-05-25 Thread Timothy Arceri
This extends the fogscale test to test a gl_FogFragCoord value
passed via a geometry shader.
---
 tests/shaders/glsl-fs-fogscale.c | 100 +--
 1 file changed, 82 insertions(+), 18 deletions(-)

diff --git a/tests/shaders/glsl-fs-fogscale.c b/tests/shaders/glsl-fs-fogscale.c
index e5f28eaf7..076092d07 100644
--- a/tests/shaders/glsl-fs-fogscale.c
+++ b/tests/shaders/glsl-fs-fogscale.c
@@ -39,13 +39,34 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
 PIGLIT_GL_TEST_CONFIG_END
 
-enum piglit_result
-piglit_display(void)
+static const char vs_source[] =
+   "void main()\n"
+   "{\n"
+   "   gl_Position = gl_Vertex;\n"
+   "   gl_FogFragCoord = gl_Position.x;\n"
+   "}\n";
+
+static const char *dummy_vs_source =
+   "void main()\n"
+   "{\n"
+   "   gl_Position = gl_Vertex;\n"
+   "}\n";
+
+static const char fs_source[] =
+   "void main()\n"
+   "{\n"
+   "   gl_FragColor = vec4(gl_FogFragCoord * gl_Fog.scale * vec2(1.0, 
-1.0), 0.0, 1.0);\n"
+   "}\n";
+
+static bool
+test_prog(unsigned prog, const char *test_name)
 {
static const float green[] = {0.0f, 1.0f, 0.0f, 1.0f};
static const float red[] = {1.0f, 0.0f, 0.0f, 1.0f};
bool pass = true;
 
+   glUseProgram(prog);
+
glClearColor(0.0, 0.0, 1.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
 
@@ -57,30 +78,73 @@ piglit_display(void)
  piglit_width / 2, piglit_height,
  red) && pass;
 
-   piglit_present_results();
+   piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL, "%s",
+test_name);
 
-   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+   return pass;
 }
 
-void
-piglit_init(int argc, char **argv)
+static void
+create_gs_source(char **gs_source, char *fogFragCoordValue)
 {
-   static const char vs_source[] =
+   (void)!asprintf(gs_source,
+   "#version 150 compatibility\n"
+   "layout(triangles) in;\n"
+   "layout(triangle_strip, max_vertices = 3) out;\n"
+   "\n"
"void main()\n"
"{\n"
-   "   gl_Position = gl_Vertex;\n"
-   "   gl_FogFragCoord = gl_Position.x;\n"
-   "}\n";
-   static const char fs_source[] =
-   "void main()\n"
-   "{\n"
-   "   gl_FragColor = vec4(gl_FogFragCoord * gl_Fog.scale * 
vec2(1.0, -1.0), 0.0, 1.0);\n"
-   "}\n";
-   GLuint prog;
+   "   for (int i = 0; i < 3; i++) {\n"
+   "   gl_Position = gl_in[i].gl_Position;\n"
+   "   gl_FogFragCoord = %s;\n"
+   "   EmitVertex();\n"
+   "   }\n"
+   "}\n",
+   fogFragCoordValue);
+}
+
+enum piglit_result
+piglit_display(void)
+{
+   bool pass = true;
+   char *gs_source;
+   char *gs_source2;
+
+   /* Test simple vs and fs program */
+   GLuint prog = piglit_build_simple_program(vs_source, fs_source);
+   test_prog(prog, "vs and fs");
+
+   /* Test passing gl_FogFragCoord via the Geometry Shader */
+   if (piglit_get_gl_version() >= 32) {
+   /* Test gl_FogFragCoord gs output only */
+   create_gs_source(_source, "gl_Position.x");
+   prog = piglit_build_simple_program_multiple_shaders(
+   GL_VERTEX_SHADER, dummy_vs_source,
+   GL_GEOMETRY_SHADER, gs_source,
+   GL_FRAGMENT_SHADER, fs_source,
+   0);
+   pass = pass && test_prog(prog, "gs-out and fs");
+
+   /* Test gl_FogFragCoord both as a gs output and input */
+   create_gs_source(_source2, "gl_in[i].gl_FogFragCoord");
+   prog = piglit_build_simple_program_multiple_shaders(
+   GL_VERTEX_SHADER, vs_source,
+   GL_GEOMETRY_SHADER, gs_source2,
+   GL_FRAGMENT_SHADER, fs_source,
+   0);
+   pass = pass && test_prog(prog, "vs, gs and fs");
 
-   prog = piglit_build_simple_program(vs_source, fs_source);
+   } else {
+   piglit_report_subtest_result(PIGLIT_SKIP, "gs-out and fs");
+   piglit_report_subtest_result(PIGLIT_SKIP, "vs, gs and fs");
+   }
 
+   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
glFogf(GL_FOG_START, 0.0f);
glFogf(GL_FOG_END, 0.0f);
-   glUseProgram(prog);
 }
-- 
2.17.0

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


Re: [Piglit] [PATCH 1/2] glslparsertest: support compatibility profile tests

2018-05-24 Thread Timothy Arceri

Reviewed-by: Timothy Arceri <tarc...@itsqueeze.com>

On 23/05/18 11:29, Marek Olšák wrote:

From: Marek Olšák <marek.ol...@amd.com>

---
  framework/test/glsl_parser_test.py|  5 +
  tests/glslparsertest/glslparsertest.c | 18 +-
  2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/framework/test/glsl_parser_test.py 
b/framework/test/glsl_parser_test.py
index 46344a8ab..8f2904eb1 100644
--- a/framework/test/glsl_parser_test.py
+++ b/framework/test/glsl_parser_test.py
@@ -58,20 +58,23 @@ def _is_gles_version(version):
  assert not isinstance(version, six.binary_type), \
  '{}({})'.format(version, type(version))
  
  if isinstance(version, six.text_type):

  # GLES 3+ versions should have "es" appended, even though
  # glslparsertest doesn't require them. If the version ends in "es" 
then
  # it is a GLES test for sure.
  if version.endswith('es'):
  return True
  
+if version.endswith('compatibility'):

+return False
+
  version = float(version)
  
  return version in [1.0, 3.0, 3.1, 3.2]
  
  
  class GLSLParserNoConfigError(exceptions.PiglitInternalError):

  pass
  
  
  class GLSLParserInternalError(exceptions.PiglitInternalError):

@@ -105,20 +108,22 @@ class Parser(object):
  raise exceptions.PiglitFatalError(
  'In file "{}":\n{}'.format(filepath, six.text_type(e)))
  
  self.set_skip_conditions()
  
  def set_skip_conditions(self):

  """Set OpenGL and OpenGL ES fast skipping conditions."""
  glsl = self.config['glsl_version']
  if _is_gles_version(glsl):
  self.glsl_es_version = float(glsl[:3])
+elif glsl.endswith('compatibility'):
+self.glsl_version = float(glsl[:3])
  else:
  self.glsl_version = float(glsl)
  
  req = self.config['require_extensions']

  self.gl_required = set(r for r in req.split() if not 
r.startswith('!'))
  
  # If GLES is requested, but piglit was not built with a gles version,

  # then ARB_ES3_compatibility is required. Add it to
  # self.gl_required
  if self.glsl_es_version and not _HAS_GLES_BIN:
diff --git a/tests/glslparsertest/glslparsertest.c 
b/tests/glslparsertest/glslparsertest.c
index 3ad0906b1..61ea46ce2 100644
--- a/tests/glslparsertest/glslparsertest.c
+++ b/tests/glslparsertest/glslparsertest.c
@@ -28,29 +28,33 @@
  /** @file glslparsertest.c
   *
   * Tests that compiling (but not linking or drawing with) a given
   * shader either succeeds or fails as expected.
   */
  
  #include 
  
  #include "piglit-util-gl.h"
  
+#define COMPAT_FLAG (1u << 31)

+
  static unsigned parse_glsl_version_number(const char *str);
  static int process_options(int argc, char **argv);
  
  PIGLIT_GL_TEST_CONFIG_BEGIN
  
  	argc = process_options(argc, argv);

if (argc > 3) {
-   const unsigned int int_version
+   const unsigned int version
= parse_glsl_version_number(argv[3]);
+   const bool compat = !!(version & COMPAT_FLAG);
+   const unsigned int int_version = version & ~COMPAT_FLAG;
switch (int_version) {
/* This is a hack to support es
 *
 * This works because version 1.00, 3.00, 3.10, 3.20 (even
 * though 3.x should include "es") are unique to GLES, there is
 * no desktop OpenGL shader language 1.00, 3.00, 3.10, or 3.20
 */
case 100:
config.supports_gl_compat_version = 10;
config.supports_gl_es_version = 20;
@@ -64,21 +68,21 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
config.supports_gl_es_version = 31;
break;
case 320:
config.supports_gl_compat_version = 10;
config.supports_gl_es_version = 32;
break;
default: {
const unsigned int gl_version
= 
required_gl_version_from_glsl_version(int_version);
config.supports_gl_compat_version = gl_version;
-   if (gl_version < 31)
+   if (gl_version < 31 || compat)
config.supports_gl_core_version = 0;
else
config.supports_gl_core_version = gl_version;
}
break;
}
} else {
config.supports_gl_compat_version = 10;
config.supports_gl_es_version = 20;
}
@@ -398,51 +402,55 @@ static void usage(char *name)
  /**
   * Process any options and rem

[Piglit] [PATCH] gl-3.2-compat: test gl_ClipVertex built-in with geometry shaders

2018-05-21 Thread Timothy Arceri
These tests have been adapted from the glsl-1.20 clipping tests.

This tests both setting gl_ClipVertex in the geometry shader and
using the gs to passthrough the gl_ClipVertex value from the
vertex shader.

I tested these on NVIDIA 384.111 binary driver but some of these
get a cryptic error message:

variable "gl_ClipVertex" domain conflicts with semantics "CLPV"

However I believe the tests are correct and this is a driver bug.
---
 .../gs-clip-vertex-const-accept.shader_test   |  68 +++
 .../gs-clip-vertex-const-reject.shader_test   |  58 ++
 ...vertex-different-from-position.shader_test |  79 
 .../gs-clip-vertex-enables.shader_test| 163 
 ...-clip-vertex-equal-to-position.shader_test |  73 
 .../gs-clip-vertex-homogeneity.shader_test|  86 +
 ...s-clip-vertex-primitives-lines.shader_test |  72 +++
 ...-clip-vertex-primitives-points.shader_test |  72 +++
 ...rtex-primitives-triangle-strip.shader_test |  72 +++
 ...vs-gs-clip-vertex-const-accept.shader_test |  70 +++
 ...vs-gs-clip-vertex-const-reject.shader_test |  70 +++
 ...vertex-different-from-position.shader_test |  90 +
 .../vs-gs-clip-vertex-enables.shader_test | 175 ++
 ...-clip-vertex-equal-to-position.shader_test |  85 +
 .../vs-gs-clip-vertex-homogeneity.shader_test |  97 ++
 ...rtex-primitives-triangle-strip.shader_test |  83 +
 16 files changed, 1413 insertions(+)
 create mode 100644 
tests/spec/glsl-1.50/execution/compatibility/clipping/gs-clip-vertex-const-accept.shader_test
 create mode 100644 
tests/spec/glsl-1.50/execution/compatibility/clipping/gs-clip-vertex-const-reject.shader_test
 create mode 100644 
tests/spec/glsl-1.50/execution/compatibility/clipping/gs-clip-vertex-different-from-position.shader_test
 create mode 100644 
tests/spec/glsl-1.50/execution/compatibility/clipping/gs-clip-vertex-enables.shader_test
 create mode 100644 
tests/spec/glsl-1.50/execution/compatibility/clipping/gs-clip-vertex-equal-to-position.shader_test
 create mode 100644 
tests/spec/glsl-1.50/execution/compatibility/clipping/gs-clip-vertex-homogeneity.shader_test
 create mode 100644 
tests/spec/glsl-1.50/execution/compatibility/clipping/gs-clip-vertex-primitives-lines.shader_test
 create mode 100644 
tests/spec/glsl-1.50/execution/compatibility/clipping/gs-clip-vertex-primitives-points.shader_test
 create mode 100644 
tests/spec/glsl-1.50/execution/compatibility/clipping/gs-clip-vertex-primitives-triangle-strip.shader_test
 create mode 100644 
tests/spec/glsl-1.50/execution/compatibility/clipping/vs-gs-clip-vertex-const-accept.shader_test
 create mode 100644 
tests/spec/glsl-1.50/execution/compatibility/clipping/vs-gs-clip-vertex-const-reject.shader_test
 create mode 100644 
tests/spec/glsl-1.50/execution/compatibility/clipping/vs-gs-clip-vertex-different-from-position.shader_test
 create mode 100644 
tests/spec/glsl-1.50/execution/compatibility/clipping/vs-gs-clip-vertex-enables.shader_test
 create mode 100644 
tests/spec/glsl-1.50/execution/compatibility/clipping/vs-gs-clip-vertex-equal-to-position.shader_test
 create mode 100644 
tests/spec/glsl-1.50/execution/compatibility/clipping/vs-gs-clip-vertex-homogeneity.shader_test
 create mode 100644 
tests/spec/glsl-1.50/execution/compatibility/clipping/vs-gs-clip-vertex-primitives-triangle-strip.shader_test

diff --git 
a/tests/spec/glsl-1.50/execution/compatibility/clipping/gs-clip-vertex-const-accept.shader_test
 
b/tests/spec/glsl-1.50/execution/compatibility/clipping/gs-clip-vertex-const-accept.shader_test
new file mode 100644
index 0..a59fbd98a
--- /dev/null
+++ 
b/tests/spec/glsl-1.50/execution/compatibility/clipping/gs-clip-vertex-const-accept.shader_test
@@ -0,0 +1,68 @@
+# From the GL 2.1 spec, section 2.17 (Clipping):
+#
+#   All points with eye coordinates (x_e y_e z_e w_e)^T that satisfy
+#
+#  (x_e)
+# (p_1' p_2' p_3' p_4')(y_e) >= 0
+#  (z_e)
+#  (w_e)
+#
+#   lie in the half-space defined by the plane; points that do not
+#   satisfy this condition do not lie in the half-space.
+#
+# This test checks that gl_ClipVertex works properly for the trivial
+# case where gl_ClipVertex is a constant value satisfying the above
+# inequality.
+
+[require]
+GL COMPAT >= 3.2
+GLSL >= 1.50
+
+[vertex shader]
+#version 150 compatibility
+
+out gl_PerVertex {
+   vec4 gl_Position;
+   vec4 gl_ClipVertex;
+};
+
+void main(void)
+{
+   gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+}
+
+[geometry shader]
+#version 150 compatibility
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+in gl_PerVertex {
+   vec4 gl_Position;
+   vec4 gl_ClipVertex;
+} gl_in[];
+
+void main()
+{
+   for (int i = 0; i < 3; i++) {
+   gl_Position = gl_in[i].gl_Position;
+   gl_ClipVertex = vec4(1.0, 0.0, 0.0, 0.0);
+
+   

[Piglit] [PATCH v2] gl-3.2-compat: test gl_TexCoord[] built-in with geometry shaders

2018-05-21 Thread Timothy Arceri
This tests both setting gl_TexCoord[] in the geometry shader and
using the gs to passthrough the gl_TexCoord[] values from the
vertex shader.
---
 .../gs-texcoord-array-2.shader_test   | 57 
 .../gs-texcoord-array.shader_test | 51 ++
 .../vs-gs-texcoord-array-2.shader_test| 65 ++
 .../vs-gs-texcoord-array.shader_test  | 66 +++
 4 files changed, 239 insertions(+)
 create mode 100644 
tests/spec/glsl-1.50/execution/compatibility/gs-texcoord-array-2.shader_test
 create mode 100644 
tests/spec/glsl-1.50/execution/compatibility/gs-texcoord-array.shader_test
 create mode 100644 
tests/spec/glsl-1.50/execution/compatibility/vs-gs-texcoord-array-2.shader_test
 create mode 100644 
tests/spec/glsl-1.50/execution/compatibility/vs-gs-texcoord-array.shader_test

diff --git 
a/tests/spec/glsl-1.50/execution/compatibility/gs-texcoord-array-2.shader_test 
b/tests/spec/glsl-1.50/execution/compatibility/gs-texcoord-array-2.shader_test
new file mode 100644
index 0..852bc10c0
--- /dev/null
+++ 
b/tests/spec/glsl-1.50/execution/compatibility/gs-texcoord-array-2.shader_test
@@ -0,0 +1,57 @@
+[require]
+GL COMPAT >= 3.2
+GLSL >= 1.50
+
+[vertex shader]
+#version 150 compatibility
+
+out gl_PerVertex {
+   vec4 gl_Position;
+   vec4 gl_TexCoord[5];
+};
+
+void main()
+{
+   gl_Position = gl_Vertex;
+}
+
+[geometry shader]
+#version 150 compatibility
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+out vec4 gl_TexCoord[5];
+
+void main()
+{
+   for (int i = 0; i < 3; i++) {
+   gl_Position = gl_in[i].gl_Position;
+
+   /* 0.05, 0.05, 0.10, 0.15, 0.20 */
+   for (int j = 0; j < 5; j++) {
+   gl_TexCoord[j] = vec4(float(j) * 0.05);
+   }
+
+   EmitVertex();
+   }
+}
+
+[fragment shader]
+#version 110
+
+varying vec4 gl_TexCoord[5];
+void main()
+{
+   vec4 result = vec4(0.0);
+
+   for (int i = 0; i < 4; i++)
+   result += gl_TexCoord[i];
+
+   /* 0.00 + 0.05 + 0.10 + 0.15 = 0.30 */
+   gl_FragColor = result;
+}
+
+[test]
+draw rect -1 -1 2 2
+probe rgba 1 1 0.3 0.3 0.3 0.3
diff --git 
a/tests/spec/glsl-1.50/execution/compatibility/gs-texcoord-array.shader_test 
b/tests/spec/glsl-1.50/execution/compatibility/gs-texcoord-array.shader_test
new file mode 100644
index 0..0ee316ef1
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/compatibility/gs-texcoord-array.shader_test
@@ -0,0 +1,51 @@
+[require]
+GL COMPAT >= 3.2
+GLSL >= 1.50
+
+[vertex shader]
+#version 150 compatibility
+
+void main()
+{
+   gl_Position = gl_Vertex;
+}
+
+[geometry shader]
+#version 150 compatibility
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+uniform int n;
+
+out vec4 gl_TexCoord[5];
+
+void main()
+{
+   for (int i = 0; i < 3; i++) {
+   gl_Position = gl_in[i].gl_Position;
+
+   for (int j = 0; j < n; j++) {
+   gl_TexCoord[j] = vec4(0.5, 0.5, 0.5, 0.5) * float(j);
+   }
+
+   EmitVertex();
+   }
+}
+
+[fragment shader]
+#version 150 compatibility
+
+uniform int index;
+in vec4 gl_TexCoord[5];
+
+void main()
+{
+   gl_FragColor = gl_TexCoord[index];
+}
+
+[test]
+uniform int index 1
+uniform int n 4
+draw rect -1 -1 2 2
+probe rgba 1 1 0.5 0.5 0.5 0.5
diff --git 
a/tests/spec/glsl-1.50/execution/compatibility/vs-gs-texcoord-array-2.shader_test
 
b/tests/spec/glsl-1.50/execution/compatibility/vs-gs-texcoord-array-2.shader_test
new file mode 100644
index 0..ec910524c
--- /dev/null
+++ 
b/tests/spec/glsl-1.50/execution/compatibility/vs-gs-texcoord-array-2.shader_test
@@ -0,0 +1,65 @@
+[require]
+GL COMPAT >= 3.2
+GLSL >= 1.50
+
+[vertex shader]
+#version 150 compatibility
+
+out gl_PerVertex {
+   vec4 gl_Position;
+   vec4 gl_TexCoord[5];
+};
+
+void main()
+{
+   /* 0.05, 0.05, 0.10, 0.15, 0.20 */
+   for (int i = 0; i < 5; i++)
+   gl_TexCoord[i] = vec4(float(i) * 0.05);
+
+   gl_Position = gl_Vertex;
+}
+
+[geometry shader]
+#version 150 compatibility
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+in gl_PerVertex {
+   vec4 gl_Position;
+   vec4 gl_TexCoord[5];
+} gl_in[];
+
+out vec4 gl_TexCoord[5];
+
+void main()
+{
+   for (int i = 0; i < 3; i++) {
+   gl_Position = gl_in[i].gl_Position;
+
+   for (int j = 0; j < 5; j++) {
+   gl_TexCoord[j] = gl_in[i].gl_TexCoord[j];
+   }
+
+   EmitVertex();
+   }
+}
+
+[fragment shader]
+#version 110
+
+varying vec4 gl_TexCoord[5];
+void main()
+{
+   vec4 result = vec4(0.0);
+
+   for (int i = 0; i < 4; i++)
+   result += gl_TexCoord[i];
+
+   /* 0.00 + 0.05 + 0.10 + 0.15 = 0.30 */
+   gl_FragColor = result;
+}
+
+[test]
+draw rect -1 -1 2 2
+probe rgba 1 1 0.3 0.3 

[Piglit] [PATCH] gl-3.2-compat: test gl_TexCoord[] built-in with geometry shaders

2018-05-21 Thread Timothy Arceri
---
 .../texcoord-array-2.shader_test  | 65 ++
 .../compatibility/texcoord-array.shader_test  | 66 +++
 2 files changed, 131 insertions(+)
 create mode 100644 
tests/spec/glsl-1.50/execution/compatibility/texcoord-array-2.shader_test
 create mode 100644 
tests/spec/glsl-1.50/execution/compatibility/texcoord-array.shader_test

diff --git 
a/tests/spec/glsl-1.50/execution/compatibility/texcoord-array-2.shader_test 
b/tests/spec/glsl-1.50/execution/compatibility/texcoord-array-2.shader_test
new file mode 100644
index 0..ec910524c
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/compatibility/texcoord-array-2.shader_test
@@ -0,0 +1,65 @@
+[require]
+GL COMPAT >= 3.2
+GLSL >= 1.50
+
+[vertex shader]
+#version 150 compatibility
+
+out gl_PerVertex {
+   vec4 gl_Position;
+   vec4 gl_TexCoord[5];
+};
+
+void main()
+{
+   /* 0.05, 0.05, 0.10, 0.15, 0.20 */
+   for (int i = 0; i < 5; i++)
+   gl_TexCoord[i] = vec4(float(i) * 0.05);
+
+   gl_Position = gl_Vertex;
+}
+
+[geometry shader]
+#version 150 compatibility
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+in gl_PerVertex {
+   vec4 gl_Position;
+   vec4 gl_TexCoord[5];
+} gl_in[];
+
+out vec4 gl_TexCoord[5];
+
+void main()
+{
+   for (int i = 0; i < 3; i++) {
+   gl_Position = gl_in[i].gl_Position;
+
+   for (int j = 0; j < 5; j++) {
+   gl_TexCoord[j] = gl_in[i].gl_TexCoord[j];
+   }
+
+   EmitVertex();
+   }
+}
+
+[fragment shader]
+#version 110
+
+varying vec4 gl_TexCoord[5];
+void main()
+{
+   vec4 result = vec4(0.0);
+
+   for (int i = 0; i < 4; i++)
+   result += gl_TexCoord[i];
+
+   /* 0.00 + 0.05 + 0.10 + 0.15 = 0.30 */
+   gl_FragColor = result;
+}
+
+[test]
+draw rect -1 -1 2 2
+probe rgba 1 1 0.3 0.3 0.3 0.3
diff --git 
a/tests/spec/glsl-1.50/execution/compatibility/texcoord-array.shader_test 
b/tests/spec/glsl-1.50/execution/compatibility/texcoord-array.shader_test
new file mode 100644
index 0..fae6cff63
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/compatibility/texcoord-array.shader_test
@@ -0,0 +1,66 @@
+[require]
+GL COMPAT >= 3.2
+GLSL >= 1.50
+
+[vertex shader]
+#version 150 compatibility
+
+uniform int n;
+
+out gl_PerVertex {
+   vec4 gl_Position;
+   vec4 gl_TexCoord[5];
+};
+
+void main()
+{
+   for (int i = 0; i < n; i++) {
+   gl_TexCoord[i] = vec4(0.5, 0.5, 0.5, 0.5) * float(i);
+   }
+   gl_Position = gl_Vertex;
+}
+
+[geometry shader]
+#version 150 compatibility
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+uniform int n;
+
+in gl_PerVertex {
+   vec4 gl_Position;
+   vec4 gl_TexCoord[5];
+} gl_in[];
+
+out vec4 gl_TexCoord[5];
+
+void main()
+{
+   for (int i = 0; i < 3; i++) {
+   gl_Position = gl_in[i].gl_Position;
+
+   for (int j = 0; j < n; j++) {
+   gl_TexCoord[j] = gl_in[i].gl_TexCoord[j];
+   }
+
+   EmitVertex();
+   }
+}
+
+[fragment shader]
+#version 150 compatibility
+
+uniform int index;
+in vec4 gl_TexCoord[5];
+
+void main()
+{
+   gl_FragColor = gl_TexCoord[index];
+}
+
+[test]
+uniform int index 1
+uniform int n 4
+draw rect -1 -1 2 2
+probe rgba 1 1 0.5 0.5 0.5 0.5
-- 
2.17.0

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


[Piglit] [PATCH] gl-3.2-compat: test gl_*Color built-ins with geometry shaders

2018-05-21 Thread Timothy Arceri
This updates the existing vertex shader test and makes it more
flexable.
---
 tests/spec/gl-2.0/vertex-program-two-side.c | 195 +++-
 1 file changed, 145 insertions(+), 50 deletions(-)

diff --git a/tests/spec/gl-2.0/vertex-program-two-side.c 
b/tests/spec/gl-2.0/vertex-program-two-side.c
index 81cf11d9d..c53668124 100644
--- a/tests/spec/gl-2.0/vertex-program-two-side.c
+++ b/tests/spec/gl-2.0/vertex-program-two-side.c
@@ -66,6 +66,16 @@ static float secondary_frontcolor[4] = {0.0, 0.25, 0.0, 0.0};
 static float secondary_backcolor[4] = {0.0, 0.0, 0.25, 0.0};
 static int draw_secondary_loc;
 
+char *vs_outputs[4] = {"", "", "", ""};
+char *gs_outputs[4] = {"", "", "", ""};
+char *gs_inputs_outputs[4] = {"", "", "", ""};
+
+static const char *dummy_vs_source =
+   "void main()\n"
+   "{\n"
+   "   gl_Position = gl_Vertex;\n"
+   "}\n";
+
 static const char *fs_source =
"uniform bool draw_secondary;\n"
"void main()\n"
@@ -76,24 +86,13 @@ static const char *fs_source =
"   gl_FragColor = gl_Color;\n"
"}\n";
 
-enum piglit_result
-piglit_display(void)
+static bool
+probe_colors()
 {
+   bool pass = true;
int x1 = 0, y1 = 0;
int w = piglit_width / 2, h = piglit_height / 2;
int x2 = piglit_width - w, y2 = piglit_height - h;
-   bool pass = true;
-
-   glClearColor(0.5, 0.5, 0.5, 0.5);
-   glClear(GL_COLOR_BUFFER_BIT);
-
-   glUniform1i(draw_secondary_loc, false);
-   piglit_draw_rect(-1,  0,  1, 1); /* top left */
-   piglit_draw_rect( 1,  0, -1, 1); /* top right */
-
-   glUniform1i(draw_secondary_loc, true);
-   piglit_draw_rect(-1, -1,  1, 1); /* bot left */
-   piglit_draw_rect( 1, -1, -1, 1); /* bot right */
 
if (front) {
pass = pass && piglit_probe_rect_rgba(x1, y2, w, h,
@@ -127,13 +126,41 @@ piglit_display(void)
}
}
 
-   piglit_present_results();
+   return pass;
+}
 
-   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+static bool
+test_prog(unsigned prog, const char *test_name)
+{
+   glUseProgram(prog);
+   draw_secondary_loc = glGetUniformLocation(prog, "draw_secondary");
+   assert(draw_secondary_loc != -1);
+
+   if (enabled)
+   glEnable(GL_VERTEX_PROGRAM_TWO_SIDE);
+
+   /* Draw */
+   glClearColor(0.5, 0.5, 0.5, 0.5);
+   glClear(GL_COLOR_BUFFER_BIT);
+
+   glUniform1i(draw_secondary_loc, false);
+   piglit_draw_rect(-1,  0,  1, 1); /* top left */
+   piglit_draw_rect( 1,  0, -1, 1); /* top right */
+
+   glUniform1i(draw_secondary_loc, true);
+   piglit_draw_rect(-1, -1,  1, 1); /* bot left */
+   piglit_draw_rect( 1, -1, -1, 1); /* bot right */
+
+   /* probe and report result */
+   bool pass = probe_colors();
+   piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL, "%s",
+test_name);
+
+   return pass;
 }
 
 static void
-setup_output(char **out, const char *name, float *values)
+setup_vs_output(char **out, const char *name, float *values)
 {
(void)!asprintf(out,
 "  %s = vec4(%f, %f, %f, %f);\n",
@@ -144,15 +171,94 @@ setup_output(char **out, const char *name, float *values)
 values[3]);
 }
 
-void
-piglit_init(int argc, char **argv)
+static void
+setup_gs_vars(char **in_out, char **out, const char *name, float *values)
+{
+   (void)!asprintf(in_out, "   %s = gl_in[i].%s;\n", name, name);
+   (void)!asprintf(out, "  %s = vec4(%f, %f, %f, %f);\n",
+   name,
+   values[0],
+   values[1],
+   values[2],
+   values[3]);
+}
+
+static void
+create_gs_source(char **gs_source, char **builtins)
+{
+   (void)!asprintf(gs_source,
+   "#version 150 compatibility\n"
+   "layout(triangles) in;\n"
+   "layout(triangle_strip, max_vertices = 3) out;\n"
+   "\n"
+   "void main()\n"
+   "{\n"
+   "   for (int i = 0; i < 3; i++) {\n"
+   "   gl_Position = gl_in[i].gl_Position;\n"
+   "   %s%s%s%s\n"
+   "   EmitVertex();\n"
+   "   }\n"
+   "}\n",
+   builtins[0],
+   builtins[1],
+   builtins[2],
+   builtins[3]);
+}
+
+enum piglit_result
+piglit_display(void)
 {
-   char *vs_outputs[4] = {"", "", "", ""};
char *vs_source;
-   int i;
+   char *gs_source;
+   char *gs_source2;
+   bool pass;
 
-   piglit_require_GLSL();
+   (void)!asprintf(_source,
+"void main()\n"
+"{\n"
+"  gl_Position = gl_Vertex;\n"
+"%s%s%s%s"
+"}\n",
+vs_outputs[0],
+

[Piglit] [PATCH] gl-3.0: test glUniform*ui{v} functions are compiled into display lists

2018-05-09 Thread Timothy Arceri
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78097
---
 tests/opengl.py |   2 +
 tests/spec/gl-3.0/CMakeLists.gl.txt |   1 +
 tests/spec/gl-3.0/dlist-uint-uniforms.c | 305 
 3 files changed, 308 insertions(+)
 create mode 100644 tests/spec/gl-3.0/dlist-uint-uniforms.c

diff --git a/tests/opengl.py b/tests/opengl.py
index 347e8c5d4..9c43d32c9 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -899,6 +899,8 @@ with profile.test_list.group_manager(
 g(['clearbuffer-invalid-buffer'])
 g(['clearbuffer-mixed-format'])
 g(['clearbuffer-stencil'])
+g(['gl-3.0-dlist-uint-uniforms'],
+  'dlist-uint-uniforms')
 g(['genmipmap-errors'])
 g(['getfragdatalocation'])
 g(['integer-errors'])
diff --git a/tests/spec/gl-3.0/CMakeLists.gl.txt 
b/tests/spec/gl-3.0/CMakeLists.gl.txt
index 6e9635c9c..e9bcb3627 100644
--- a/tests/spec/gl-3.0/CMakeLists.gl.txt
+++ b/tests/spec/gl-3.0/CMakeLists.gl.txt
@@ -9,6 +9,7 @@ link_libraries (
 )
 
 piglit_add_executable (gl-3.0-bound-resource-limits bound-resource-limits.c)
+piglit_add_executable (gl-3.0-dlist-uint-uniforms dlist-uint-uniforms.c)
 piglit_add_executable (gl-3.0-multidrawarrays-vertexid 
multidrawarrays-vertexid.c)
 piglit_add_executable (gl-3.0-minmax minmax.c)
 piglit_add_executable (gl-3.0-render-integer render-integer.c)
diff --git a/tests/spec/gl-3.0/dlist-uint-uniforms.c 
b/tests/spec/gl-3.0/dlist-uint-uniforms.c
new file mode 100644
index 0..b1f52c98c
--- /dev/null
+++ b/tests/spec/gl-3.0/dlist-uint-uniforms.c
@@ -0,0 +1,305 @@
+/*
+ * Copyright © 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.
+ */
+
+/**
+ * Verify that unsigned glUniform* commands added in GL 3.0 are compiled into
+ * display lists.
+ *
+ * This test is adapted from tests/spec/arb_separate_shader_objects/dlist.c
+ */
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   /* No supports_gl_core_version setting because there are no display
+* lists in core profile.
+*/
+   config.supports_gl_compat_version = 30;
+   config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+   config.khr_no_error_support = PIGLIT_NO_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static bool Uniformui(void);
+
+void
+piglit_init(int argc, char **argv)
+{
+   unsigned glsl_version;
+   bool pass = true;
+
+   pass = Uniformui() && pass;
+
+   piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
+
+enum mode {
+   set_scalar,
+   set_vector,
+   get_and_compare
+};
+
+#define UINT_UNIFORM(type, n, suffix)  \
+   do {\
+   type inbuf[n];  \
+   type outbuf[n]; \
+   unsigned jjj;   \
+   \
+   for (jjj = 0; jjj < n; jjj++)   \
+   outbuf[jjj] = (type) value++;   \
+   \
+   switch (m) {\
+   case set_scalar:\
+   switch (n) {\
+   case 1: \
+   glUniform1 ## suffix\
+   (loc,   \
+outbuf[0]);\
+   break;  \
+   case 2: \
+   glUniform2 ## suffix\
+   (loc,

[Piglit] [PATCH v2] ext_packed_float: Add a test that queries GL_RGBA_SIGNED_COMPONENTS_EXT

2018-05-09 Thread Timothy Arceri
From: Bruce Merry <bme...@gmail.com>

V2 (Timothy Arceri):
 - use piglit_get_gl_enum_name()
 - use ARRAY_SIZE()
 - set config.khr_no_error_support

Cc: Brian Paul <bri...@vmware.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73096
---
 tests/opengl.py   |   1 +
 tests/spec/ext_packed_float/CMakeLists.gl.txt |   1 +
 .../query-rgba-signed-components.c| 162 ++
 3 files changed, 164 insertions(+)
 create mode 100644 tests/spec/ext_packed_float/query-rgba-signed-components.c

diff --git a/tests/opengl.py b/tests/opengl.py
index 825e0bf83..347e8c5d4 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -3175,6 +3175,7 @@ with profile.test_list.group_manager(
 PiglitGLTest,
 grouptools.join('spec', 'ext_packed_float')) as g:
 g(['ext_packed_float-pack'], 'pack')
+g(['query-rgba-signed-components'], 'query-rgba-signed-components')
 g(['getteximage-invalid-format-for-packed-type'],
   'getteximage-invalid-format-for-packed-type')
 add_msaa_formats_tests(g, 'GL_EXT_packed_float')
diff --git a/tests/spec/ext_packed_float/CMakeLists.gl.txt 
b/tests/spec/ext_packed_float/CMakeLists.gl.txt
index 44a8818c8..b061cb6b2 100644
--- a/tests/spec/ext_packed_float/CMakeLists.gl.txt
+++ b/tests/spec/ext_packed_float/CMakeLists.gl.txt
@@ -10,5 +10,6 @@ link_libraries (
 
 piglit_add_executable (ext_packed_float-pack pack.c)
 piglit_add_executable (getteximage-invalid-format-for-packed-type 
getteximage-invalid-format-for-packed-type.c)
+piglit_add_executable (query-rgba-signed-components 
query-rgba-signed-components.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/ext_packed_float/query-rgba-signed-components.c 
b/tests/spec/ext_packed_float/query-rgba-signed-components.c
new file mode 100644
index 0..f5c0047fa
--- /dev/null
+++ b/tests/spec/ext_packed_float/query-rgba-signed-components.c
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2013 Bruce Merry
+ *
+ * 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
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, 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
+ * NON-INFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COYPRIGTH
+ * HOLDERS AND/OR THEIR SUPPLIERS 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"
+
+typedef struct {
+   GLenum format;
+   const char *extension;
+   int expected[4];
+   int buffer; /* Draw buffer to attach the renderbuffer to */
+} format_info;
+
+static const format_info formats[] = {
+   { GL_RGBA8, NULL, { 0, 0, 0, 0 } },
+   { GL_R8I, "GL_ARB_texture_rg", { 1, 0, 0, 0 } },
+   { GL_RG8I, "GL_ARB_texture_rg", { 1, 1, 0, 0 } },
+   { GL_R8_SNORM, "GL_EXT_texture_snorm", { 1, 0, 0, 0 } },
+   { GL_LUMINANCE8_SNORM, "GL_EXT_texture_snorm", { 1, 1, 1, 0 } },
+   { GL_RGBA8UI_EXT, "GL_EXT_texture_integer", { 0, 0, 0, 0 } },
+   { GL_RGBA16F_ARB, "GL_ARB_texture_float", { 1, 1, 1, 1 } },
+   { GL_LUMINANCE16F_ARB, "GL_ARB_texture_float", { 1, 1, 1, 0 } },
+   { GL_RGB9_E5_EXT, "GL_EXT_texture_shared_exponent", { 0, 0, 0, 0 } },
+   { GL_R11F_G11F_B10F_EXT, "GL_EXT_packed_float", { 0, 0, 0, 0 } },
+   { GL_RGBA16F_ARB, "GL_ARB_texture_float", { 0, 0, 0, 0 }, 1 }
+};
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 10;
+   config.window_visual = PIGLIT_GL_VISUAL_RGB;
+   config.khr_no_error_support = PIGLIT_NO_ERRORS;
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+   /* Should never be reached */
+   return PIGLIT_FAIL;
+}
+
+/* Queries GL_RGBA_SIGNED_COMPONENTS_EXT and compares to expected.
+ * If they do not match, prints an error. Returns true on match.
+ */
+static bool check_rgba_signed(const int *expected)
+{
+   int i;
+   /* Start with nonsense values, to ensure they are written */
+   GLint actual[4] = {2, 2, 2, 2};
+
+   glGetIntegerv(GL_RGBA_SIGNED_COMPONENTS_EXT, actual);
+   if (!pi

Re: [Piglit] [PATCH] ext_packed_float: Add a test that queries GL_RGBA_SIGNED_COMPONENTS_EXT

2018-05-09 Thread Timothy Arceri

On 10/05/18 03:36, Bruce Merry wrote:

Hi

I'm afraid it's been about 4 years since I last did any OpenGL work.
Realistically I don't think that rebasing this is going to make it to
the top of my priority stack any time soon. Apologies for abandoning
it.


Not a problem I'll get this over the line :) Thanks for writing test and 
reporting the bug.


Tim



Bruce

On 9 May 2018 at 18:44, Brian Paul <bri...@vmware.com> wrote:

Minor things below.

-Brian

On 05/09/2018 12:13 AM, Timothy Arceri wrote:


From: Bruce Merry <bme...@gmail.com>

Cc: Brian Paul <bri...@vmware.com>
Bugzilla:
https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.freedesktop.org_show-5Fbug.cgi-3Fid-3D73096=DwIBAQ=uilaK90D4TOVoH58JNXRgQ=Ie7_encNUsqxbSRbqbNgofw0ITcfE8JKfaUjIQhncGA=K7EzhJILOr1w_DQt9GuR7_BVUkIV83zFlObLq3eo-Rk=av-uP6XeQB05-iaIJnhRtBPNizb9NRb-1e_J5oSQu94=
---

   I came across this test when cleaning up bugzilla. Seems we fixed
   Mesa but never pushed the piglit test.

   tests/all.py  |   1 +
   tests/spec/ext_packed_float/CMakeLists.gl.txt |   1 +
   .../query-rgba-signed-components.c| 167 ++
   3 files changed, 169 insertions(+)
   create mode 100644
tests/spec/ext_packed_float/query-rgba-signed-components.c

diff --git a/tests/all.py b/tests/all.py
index 26638cd82..db85f172e 100644
--- a/tests/all.py
+++ b/tests/all.py



This will need to be rebased on ToT since all.py is gone.




@@ -3331,6 +3331,7 @@ with profile.test_list.group_manager(
   PiglitGLTest,
   grouptools.join('spec', 'ext_packed_float')) as g:
   g(['ext_packed_float-pack'], 'pack')
+g(['query-rgba-signed-components'], 'query-rgba-signed-components')
   g(['getteximage-invalid-format-for-packed-type'],
 'getteximage-invalid-format-for-packed-type')
   add_msaa_formats_tests(g, 'GL_EXT_packed_float')
diff --git a/tests/spec/ext_packed_float/CMakeLists.gl.txt
b/tests/spec/ext_packed_float/CMakeLists.gl.txt
index 44a8818c8..b061cb6b2 100644
--- a/tests/spec/ext_packed_float/CMakeLists.gl.txt
+++ b/tests/spec/ext_packed_float/CMakeLists.gl.txt
@@ -10,5 +10,6 @@ link_libraries (
 piglit_add_executable (ext_packed_float-pack pack.c)
   piglit_add_executable (getteximage-invalid-format-for-packed-type
getteximage-invalid-format-for-packed-type.c)
+piglit_add_executable (query-rgba-signed-components
query-rgba-signed-components.c)
 # vim: ft=cmake:
diff --git a/tests/spec/ext_packed_float/query-rgba-signed-components.c
b/tests/spec/ext_packed_float/query-rgba-signed-components.c
new file mode 100644
index 0..635d5bc5a
--- /dev/null
+++ b/tests/spec/ext_packed_float/query-rgba-signed-components.c
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 2013 Bruce Merry
+ *
+ * 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
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, 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
+ * NON-INFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COYPRIGTH
+ * HOLDERS AND/OR THEIR SUPPLIERS 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"
+
+#define MAKE_FORMAT_STR(x) x, #x
+
+typedef struct {
+   GLenum format;
+   const char *format_str;
+   const char *extension;
+   int expected[4];
+   int buffer; /* Draw buffer to attach the renderbuffer to */
+} format_info;
+
+static const format_info formats[] = {
+   { MAKE_FORMAT_STR(GL_RGBA8), NULL, { 0, 0, 0, 0 } },



We can rm the MAKE_FORMAT_STR stuff now and use piglit_get_gl_enum_name().




+   { MAKE_FORMAT_STR(GL_R8I), "GL_ARB_texture_rg", { 1, 0, 0, 0 } },
+   { MAKE_FORMAT_STR(GL_RG8I), "GL_ARB_texture_rg", { 1, 1, 0, 0 } },
+   { MAKE_FORMAT_STR(GL_R8_SNORM), "GL_EXT_texture_snorm", { 1, 0, 0,
0 } },
+   { MAKE_FORMAT_STR(GL_LUMINANCE8_SNORM), "GL_EXT_texture_snorm", {
1, 1, 1, 0 } },
+   { MAKE_FORMAT_STR(GL_RGBA8UI_EXT), "GL_EXT_texture_integer", { 0,
0, 0, 0 } },
+   { MAKE_FORMAT_STR(GL_RGBA16F_ARB), "GL_ARB_texture_float&q

  1   2   3   4   5   6   7   >