[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] glsl-1.10: test for crash in loop analysis

2019-03-20 Thread Andres Gomez
This is:

Reviewed-by: Andres Gomez 

On Tue, 2019-03-19 at 14:29 +1100, Timothy Arceri wrote:
> 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
-- 
Br,

Andres

___
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 Andres Gomez
On Wed, 2019-03-20 at 20:56 +1100, Timothy Arceri wrote:
> 
> 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

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_version: 1.50
  // require_extensions: 

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
+// glsl_version: 1.50
+// check_link: true
+// require_extensions: 

Re: [Piglit] [PATCH 07/10] arb_enhanced_layouts: add component aliasing tests

2019-03-20 Thread Juan A. Suarez Romero
On Fri, 2019-02-01 at 19:55 +0200, Andres Gomez wrote:
> New tests for component aliasing with duplicated inputs which match
> the same output variable in the previous stage.
> 
> From Section 4.4.1 (Input Layout Qualifiers) of the GLSL 4.60 spec:
> 
>   " Location aliasing is causing two variables or block members to
> have the same location number. Component aliasing is assigning the
> same (or overlapping) component numbers for two location
> aliases. (Recall if component is not used, components are assigned
> starting with 0.) With one exception, location aliasing is allowed
> only if it does not cause component aliasing; it is a compile-time
> or link-time error to cause component aliasing."
> 
> From Section 7.4.1 (Shader Interface Matching) of the OpenGL 4.60 spec:
> 
>   "   * An output variable is considered to match an input variable in
> the subsequent shader if:
> 
> – the two variables match in name, type, and qualification,
>   and neither has a location qualifier, or
> 
> – the two variables are declared with the same location and
>   component layout qualifiers and match in type and
>   qualification."
> 
> Cc: Timothy Arceri 
> Cc: Iago Toral Quiroga 
> Cc: Ilia Mirkin 
> Signed-off-by: Andres Gomez 

Reviewed-by: Juan A. Suarez 


> ---
>  ...uplicated-input-overlap-double.shader_test | 62 +++
>  ...to-fs-duplicated-input-overlap.shader_test | 59 ++
>  2 files changed, 121 insertions(+)
>  create mode 100644 
> tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-duplicated-input-overlap-double.shader_test
>  create mode 100644 
> tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-duplicated-input-overlap.shader_test
> 
> diff --git 
> a/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-duplicated-input-overlap-double.shader_test
>  
> b/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-duplicated-input-overlap-double.shader_test
> new file mode 100644
> index 0..1c9117b9b
> --- /dev/null
> +++ 
> b/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-duplicated-input-overlap-double.shader_test
> @@ -0,0 +1,62 @@
> +// From Section 4.4.1 (Input Layout Qualifiers) of the GLSL 4.60 spec:
> +//
> +//   " Location aliasing is causing two variables or block members to
> +// have the same location number. Component aliasing is assigning
> +// the same (or overlapping) component numbers for two location
> +// aliases. (Recall if component is not used, components are
> +// assigned starting with 0.) With one exception, location
> +// aliasing is allowed only if it does not cause component
> +// aliasing; it is a compile-time or link-time error to cause
> +// component aliasing."
> +//
> +// From Section 7.4.1 (Shader Interface Matching) of the OpenGL 4.60 spec:
> +//
> +//   "   * An output variable is considered to match an input variable
> +// in the subsequent shader if:
> +//
> +// – the two variables match in name, type, and qualification,
> +//   and neither has a location qualifier, or
> +//
> +// – the two variables are declared with the same location and
> +//   component layout qualifiers and match in type and
> +//   qualification."
> +
> +[require]
> +GLSL >= 1.50
> +GL_ARB_enhanced_layouts
> +GL_ARB_gpu_shader_fp64
> +GL_ARB_separate_shader_objects
> +
> +[vertex shader]
> +#version 150
> +#extension GL_ARB_enhanced_layouts: require
> +#extension GL_ARB_gpu_shader_fp64: require
> +#extension GL_ARB_separate_shader_objects: require
> +
> +// consumes Z/W components
> +layout(location = 0, component = 2) flat out double a;
> +
> +void main()
> +{
> +  a = 1.0;
> +}
> +
> +[fragment shader]
> +#version 150
> +#extension GL_ARB_enhanced_layouts: require
> +#extension GL_ARB_gpu_shader_fp64: require
> +#extension GL_ARB_separate_shader_objects: require
> +
> +out vec4 color;
> +
> +// consumes Z/W components
> +layout(location = 0, component = 2) flat in double b;
> +layout(location = 0, component = 2) flat in double c;
> +
> +void main()
> +{
> +  color = vec4(c, b, 0.0, 1.0);
> +}
> +
> +[test]
> +link error
> diff --git 
> a/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-duplicated-input-overlap.shader_test
>  
> b/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-duplicated-input-overlap.shader_test
> new file mode 100644
> index 0..3dea88a51
> --- /dev/null
> +++ 
> b/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-duplicated-input-overlap.shader_test
> @@ -0,0 +1,59 @@
> +// From Section 4.4.1 (Input Layout Qualifiers) of the GLSL 4.60 spec:
> +//
> +//   " Location aliasing is causing two variables or block members to
> +// have the same location number. Component aliasing is assigning
> +// the same (or overlapping) component numbers for two location
> +// 

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

2019-03-20 Thread Juan A. Suarez Romero
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
> +++ 
>