[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 1/3] cmake: use proper WAYLAND_INCLUDE_DIRS variable

2018-12-06 Thread Burton, Ross
Ping.  Also CCing a few people who have touched this file in the past
and might be happy reviewing cmake code!

Ross
On Fri, 30 Nov 2018 at 10:45, Ross Burton  wrote:
>
> From: Pascal Bach 
>
> WAYLAND_wayland-client_INCLUDEDIR is an internal variable and is not correctly
> set when cross compiling. WAYLAND_INCLUDE_DIRS includes the correct path even
> when cross compiling.
>
> Signed-off-by: Pascal Bach 
> ---
>  tests/util/CMakeLists.txt | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tests/util/CMakeLists.txt b/tests/util/CMakeLists.txt
> index a5f080156..a303a9f58 100644
> --- a/tests/util/CMakeLists.txt
> +++ b/tests/util/CMakeLists.txt
> @@ -97,7 +97,7 @@ if(PIGLIT_USE_WAFFLE)
> piglit-framework-gl/piglit_wl_framework.c
> )
> list(APPEND UTIL_GL_INCLUDES
> -   ${WAYLAND_wayland-client_INCLUDEDIR}
> +   ${WAYLAND_INCLUDE_DIRS}
> )
> endif()
> if(PIGLIT_HAS_X11)
> --
> 2.11.0
>
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] arb_gl_spirv: simple test, use correct reference colors

2018-12-06 Thread Józef Kucia
On Thu, Dec 6, 2018 at 11:22 AM Alejandro Piñeiro  wrote:
>
> It was using the same color for the base color, drawing color and
> expected color.
>
> As we are here, we also remove the debug names, as the test should
> work without names.
> ---
>  .../execution/vs-ps-simple.shader_test| 23 +--
>  1 file changed, 6 insertions(+), 17 deletions(-)

Reviewed-by: Józef Kucia 

>
> diff --git a/tests/spec/arb_gl_spirv/execution/vs-ps-simple.shader_test 
> b/tests/spec/arb_gl_spirv/execution/vs-ps-simple.shader_test
> index 88e38540f..dcaf01eba 100644
> --- a/tests/spec/arb_gl_spirv/execution/vs-ps-simple.shader_test
> +++ b/tests/spec/arb_gl_spirv/execution/vs-ps-simple.shader_test
> @@ -10,7 +10,7 @@ GLSL >= 4.50
>  ; Automatically generated from the GLSL by shader_test_spirv.py. DO NOT EDIT
>  ; SPIR-V
>  ; Version: 1.0
> -; Generator: Khronos Glslang Reference Front End; 4
> +; Generator: Khronos Glslang Reference Front End; 7
>  ; Bound: 24
>  ; Schema: 0
> OpCapability Shader
> @@ -18,16 +18,7 @@ GLSL >= 4.50
> OpMemoryModel Logical GLSL450
> OpEntryPoint Vertex %main "main" %_ %piglit_vertex 
> %gl_VertexID %gl_InstanceID
> OpSource GLSL 450
> -   OpName %main "main"
> -   OpName %gl_PerVertex "gl_PerVertex"
> -   OpMemberName %gl_PerVertex 0 "gl_Position"
> -   OpMemberName %gl_PerVertex 1 "gl_PointSize"
> -   OpMemberName %gl_PerVertex 2 "gl_ClipDistance"
> -   OpMemberName %gl_PerVertex 3 "gl_CullDistance"
> OpName %_ ""
> -   OpName %piglit_vertex "piglit_vertex"
> -   OpName %gl_VertexID "gl_VertexID"
> -   OpName %gl_InstanceID "gl_InstanceID"
> OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
> OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
> OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
> @@ -75,7 +66,7 @@ void main() {
>  ; Automatically generated from the GLSL by shader_test_spirv.py. DO NOT EDIT
>  ; SPIR-V
>  ; Version: 1.0
> -; Generator: Khronos Glslang Reference Front End; 4
> +; Generator: Khronos Glslang Reference Front End; 7
>  ; Bound: 13
>  ; Schema: 0
> OpCapability Shader
> @@ -84,8 +75,6 @@ void main() {
> OpEntryPoint Fragment %main "main" %outcolor
> OpExecutionMode %main OriginLowerLeft
> OpSource GLSL 450
> -   OpName %main "main"
> -   OpName %outcolor "outcolor"
> OpDecorate %outcolor Location 0
> %void = OpTypeVoid
>%3 = OpTypeFunction %void
> @@ -93,9 +82,9 @@ void main() {
>  %v4float = OpTypeVector %float 4
>  %_ptr_Output_v4float = OpTypePointer Output %v4float
> %outcolor = OpVariable %_ptr_Output_v4float Output
> -%float_1 = OpConstant %float 1
>  %float_0 = OpConstant %float 0
> - %12 = OpConstantComposite %v4float %float_1 %float_0 %float_0 
> %float_0
> +%float_1 = OpConstant %float 1
> + %12 = OpConstantComposite %v4float %float_0 %float_1 %float_0 
> %float_1
> %main = OpFunction %void None %3
>%5 = OpLabel
> OpStore %outcolor %12
> @@ -108,7 +97,7 @@ void main() {
>  layout(location = 0) out vec4 outcolor;
>
>  void main() {
> -outcolor = vec4(1.0, 0.0, 0.0, 0.0);
> +outcolor = vec4(0.0, 1.0, 0.0, 1.0);
>  }
>
>  [test]
> @@ -116,4 +105,4 @@ clear color 1.0 0.0 0.0 0.0
>  clear
>
>  draw rect -1 -1 2 2
> -probe all rgba 1.0 0.0 0.0 0.0
> +probe all rgba 0.0 1.0 0.0 1.0
> --
> 2.19.1
>
> ___
> 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_gl_spirv: simple test, use correct reference colors

2018-12-06 Thread Alejandro Piñeiro
It was using the same color for the base color, drawing color and
expected color.

As we are here, we also remove the debug names, as the test should
work without names.
---
 .../execution/vs-ps-simple.shader_test| 23 +--
 1 file changed, 6 insertions(+), 17 deletions(-)

diff --git a/tests/spec/arb_gl_spirv/execution/vs-ps-simple.shader_test 
b/tests/spec/arb_gl_spirv/execution/vs-ps-simple.shader_test
index 88e38540f..dcaf01eba 100644
--- a/tests/spec/arb_gl_spirv/execution/vs-ps-simple.shader_test
+++ b/tests/spec/arb_gl_spirv/execution/vs-ps-simple.shader_test
@@ -10,7 +10,7 @@ GLSL >= 4.50
 ; Automatically generated from the GLSL by shader_test_spirv.py. DO NOT EDIT
 ; SPIR-V
 ; Version: 1.0
-; Generator: Khronos Glslang Reference Front End; 4
+; Generator: Khronos Glslang Reference Front End; 7
 ; Bound: 24
 ; Schema: 0
OpCapability Shader
@@ -18,16 +18,7 @@ GLSL >= 4.50
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %main "main" %_ %piglit_vertex %gl_VertexID 
%gl_InstanceID
OpSource GLSL 450
-   OpName %main "main"
-   OpName %gl_PerVertex "gl_PerVertex"
-   OpMemberName %gl_PerVertex 0 "gl_Position"
-   OpMemberName %gl_PerVertex 1 "gl_PointSize"
-   OpMemberName %gl_PerVertex 2 "gl_ClipDistance"
-   OpMemberName %gl_PerVertex 3 "gl_CullDistance"
OpName %_ ""
-   OpName %piglit_vertex "piglit_vertex"
-   OpName %gl_VertexID "gl_VertexID"
-   OpName %gl_InstanceID "gl_InstanceID"
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
@@ -75,7 +66,7 @@ void main() {
 ; Automatically generated from the GLSL by shader_test_spirv.py. DO NOT EDIT
 ; SPIR-V
 ; Version: 1.0
-; Generator: Khronos Glslang Reference Front End; 4
+; Generator: Khronos Glslang Reference Front End; 7
 ; Bound: 13
 ; Schema: 0
OpCapability Shader
@@ -84,8 +75,6 @@ void main() {
OpEntryPoint Fragment %main "main" %outcolor
OpExecutionMode %main OriginLowerLeft
OpSource GLSL 450
-   OpName %main "main"
-   OpName %outcolor "outcolor"
OpDecorate %outcolor Location 0
%void = OpTypeVoid
   %3 = OpTypeFunction %void
@@ -93,9 +82,9 @@ void main() {
 %v4float = OpTypeVector %float 4
 %_ptr_Output_v4float = OpTypePointer Output %v4float
%outcolor = OpVariable %_ptr_Output_v4float Output
-%float_1 = OpConstant %float 1
 %float_0 = OpConstant %float 0
- %12 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_0
+%float_1 = OpConstant %float 1
+ %12 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1
%main = OpFunction %void None %3
   %5 = OpLabel
OpStore %outcolor %12
@@ -108,7 +97,7 @@ void main() {
 layout(location = 0) out vec4 outcolor;
 
 void main() {
-outcolor = vec4(1.0, 0.0, 0.0, 0.0);
+outcolor = vec4(0.0, 1.0, 0.0, 1.0);
 }
 
 [test]
@@ -116,4 +105,4 @@ clear color 1.0 0.0 0.0 0.0
 clear
 
 draw rect -1 -1 2 2
-probe all rgba 1.0 0.0 0.0 0.0
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.19.1

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