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

2019-01-10 Thread Danylo Piliaiev
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."

v2: moved new tests to tests/spec/glsl-es folders

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

Signed-off-by: Danylo Piliaiev 
---
 tests/spec/glsl-es-1.00/compiler/invariant.frag | 17 +
 tests/spec/glsl-es-3.00/compiler/invariant.frag | 15 +++
 2 files changed, 32 insertions(+)
 create mode 100644 tests/spec/glsl-es-1.00/compiler/invariant.frag
 create mode 100644 tests/spec/glsl-es-3.00/compiler/invariant.frag

diff --git a/tests/spec/glsl-es-1.00/compiler/invariant.frag 
b/tests/spec/glsl-es-1.00/compiler/invariant.frag
new file mode 100644
index 0..440d3dfb5
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/invariant.frag
@@ -0,0 +1,17 @@
+// [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/spec/glsl-es-3.00/compiler/invariant.frag 
b/tests/spec/glsl-es-3.00/compiler/invariant.frag
new file mode 100644
index 0..0b5002f9d
--- /dev/null
+++ b/tests/spec/glsl-es-3.00/compiler/invariant.frag
@@ -0,0 +1,15 @@
+// [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() { }
-- 
2.20.1

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


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

2019-01-09 Thread Danylo Piliaiev
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 
 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() { }
-- 
2.20.1

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


Re: [Piglit] [PATCH v3] arb_blend_func_extended: Test dual src blending without second color output

2019-01-03 Thread Danylo Piliaiev

Hi,

Just making sure this test won't be forgotten.
Thanks!

On 11/9/18 9:19 PM, Ilia Mirkin wrote:

Sorry, I don't have time to review now, and may not for a bit. No
reason that I have to though...
On Fri, Nov 9, 2018 at 12:22 PM Dylan Baker  wrote:

I'm okay with merging this version, Ilia?

Quoting Danylo Piliaiev (2018-11-09 05:27:05)

Hi,

Since the fix for the underlying issue was pushed to Mesa in
eca4a6548d0702a7768edb397bad7b72cfc2
could this test be also pushed?

- Danil

On 7/9/18 11:54 AM, Danylo Piliaiev wrote:

Using fragment shader without second color output should not hang gpu
when dual source blending is enabled.
It hanged Intel gen8+ GPUs when discarding fragments and depth test
being enabled.
There is also safeguard against lack of second color output in radeonsi.

v2: by Ilia Mirkin
  - Set supports_gl_compat_version = 30
  - Moved drawing to piglit_display
  - Change drawing sequence to: clear red -> draw -> clear green

v3: by Dylan Baker
  - Removed run_concurrent=False

Signed-off-by: Danylo Piliaiev 
---
   tests/opengl.py   |   2 +
   .../execution/CMakeLists.gl.txt   |   1 +
   .../execution/CMakeLists.gles3.txt|   1 +
   .../dual-src-blending-discard-without-src1.c  | 126 ++
   4 files changed, 130 insertions(+)
   create mode 100644 
tests/spec/arb_blend_func_extended/execution/dual-src-blending-discard-without-src1.c

diff --git a/tests/opengl.py b/tests/opengl.py
index 02110ff86..1b088b75f 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -4114,6 +4114,7 @@ with profile.test_list.group_manager(
   g(['arb_blend_func_extended-fbo-extended-blend'])
   g(['arb_blend_func_extended-fbo-extended-blend-explicit'])
   g(['arb_blend_func_extended-fbo-extended-blend-pattern'])
+g(['arb_blend_func_extended-dual-src-blending-discard-without-src1'])
   g(['arb_blend_func_extended-blend-api_gles2'])
   g(['arb_blend_func_extended-builtins_gles2'])
   
g(['arb_blend_func_extended-bindfragdataindexed-invalid-parameters_gles3'])
@@ -4123,6 +4124,7 @@ with profile.test_list.group_manager(
   g(['arb_blend_func_extended-fbo-extended-blend-pattern_gles3'])
   g(['arb_blend_func_extended-fbo-extended-blend_gles3'])
   g(['arb_blend_func_extended-fbo-extended-blend-explicit_gles3'])
+g(['arb_blend_func_extended-dual-src-blending-discard-without-src1_gles3'])

   with profile.test_list.group_manager(
   PiglitGLTest,
diff --git a/tests/spec/arb_blend_func_extended/execution/CMakeLists.gl.txt 
b/tests/spec/arb_blend_func_extended/execution/CMakeLists.gl.txt
index f48c352e1..09d45b72c 100644
--- a/tests/spec/arb_blend_func_extended/execution/CMakeLists.gl.txt
+++ b/tests/spec/arb_blend_func_extended/execution/CMakeLists.gl.txt
@@ -12,4 +12,5 @@ link_libraries (
   piglit_add_executable (arb_blend_func_extended-fbo-extended-blend 
fbo-extended-blend.c)
   piglit_add_executable (arb_blend_func_extended-fbo-extended-blend-explicit 
fbo-extended-blend-explicit.c)
   piglit_add_executable (arb_blend_func_extended-fbo-extended-blend-pattern 
fbo-extended-blend-pattern.c)
+piglit_add_executable 
(arb_blend_func_extended-dual-src-blending-discard-without-src1 
dual-src-blending-discard-without-src1.c)
   # vim: ft=cmake:
diff --git a/tests/spec/arb_blend_func_extended/execution/CMakeLists.gles3.txt 
b/tests/spec/arb_blend_func_extended/execution/CMakeLists.gles3.txt
index a70e9fa5e..fd41622bd 100644
--- a/tests/spec/arb_blend_func_extended/execution/CMakeLists.gles3.txt
+++ b/tests/spec/arb_blend_func_extended/execution/CMakeLists.gles3.txt
@@ -3,4 +3,5 @@ link_libraries(piglitutil_${piglit_target_api})
   piglit_add_executable 
(arb_blend_func_extended-fbo-extended-blend_${piglit_target_api} 
fbo-extended-blend.c)
   piglit_add_executable 
(arb_blend_func_extended-fbo-extended-blend-explicit_${piglit_target_api} 
fbo-extended-blend-explicit.c)
   piglit_add_executable 
(arb_blend_func_extended-fbo-extended-blend-pattern_${piglit_target_api} 
fbo-extended-blend-pattern.c)
+piglit_add_executable 
(arb_blend_func_extended-dual-src-blending-discard-without-src1_${piglit_target_api}
 dual-src-blending-discard-without-src1.c)
   # vim: ft=cmake:
diff --git 
a/tests/spec/arb_blend_func_extended/execution/dual-src-blending-discard-without-src1.c
 
b/tests/spec/arb_blend_func_extended/execution/dual-src-blending-discard-without-src1.c
new file mode 100644
index 0..a0a45cd79
--- /dev/null
+++ 
b/tests/spec/arb_blend_func_extended/execution/dual-src-blending-discard-without-src1.c
@@ -0,0 +1,126 @@
+/* Copyright © 2018 Danylo Piliaiev
+ *
+ * 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,
+ * an

[Piglit] [PATCH v2] arb_tessellation_shader: Test unmatched TCS output usage

2019-01-03 Thread Danylo Piliaiev
Test that TCS per-vertex outputs which are used only in
TCS stage are not converted to local variables and indeed
share data within the patch.

v2: Add GL_ARB_shader_atomic_counters to [require] section.
Format shaders.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104297
Signed-off-by: Danylo Piliaiev 
---
 .../tcs-output-unmatched.shader_test  | 67 +++
 1 file changed, 67 insertions(+)
 create mode 100644 
tests/spec/arb_tessellation_shader/execution/tcs-output-unmatched.shader_test

diff --git 
a/tests/spec/arb_tessellation_shader/execution/tcs-output-unmatched.shader_test 
b/tests/spec/arb_tessellation_shader/execution/tcs-output-unmatched.shader_test
new file mode 100644
index 0..dd3b5ce09
--- /dev/null
+++ 
b/tests/spec/arb_tessellation_shader/execution/tcs-output-unmatched.shader_test
@@ -0,0 +1,67 @@
+# Test that TCS per-vertex outputs which are used only in
+# TCS stage are not converted to local variables
+# and indeed share data within the patch.
+
+[require]
+GLSL >= 1.50
+GL_ARB_tessellation_shader
+GL_ARB_separate_shader_objects
+GL_ARB_shader_atomic_counters
+
+[vertex shader passthrough]
+
+
+[tessellation control shader]
+#extension GL_ARB_tessellation_shader: require
+#extension GL_ARB_separate_shader_objects: require
+#extension GL_ARB_shader_atomic_counters: require
+layout(vertices = 3) out;
+
+layout(location = 0) out vec4 out_unused_in_tes[];
+
+layout(binding = 0) uniform atomic_uint mismatches;
+
+void main()
+{
+   out_unused_in_tes[gl_InvocationID] = gl_in[gl_InvocationID].gl_Position;
+
+   barrier();
+
+   if (out_unused_in_tes[0] != gl_in[0].gl_Position ||
+   out_unused_in_tes[1] != gl_in[1].gl_Position ||
+   out_unused_in_tes[2] != gl_in[2].gl_Position) {
+   atomicCounterIncrement(mismatches);
+   }
+}
+
+
+[tessellation evaluation shader]
+#extension GL_ARB_tessellation_shader: require
+layout(triangles) in;
+
+void main()
+{
+   gl_Position = vec4(0);
+}
+
+
+[fragment shader]
+
+void main()
+{
+   gl_FragColor = vec4(1.0);
+}
+
+[vertex data]
+piglit_vertex/float/4
+1 1 1 1
+2 2 2 2
+3 3 3 3
+
+[test]
+atomic counters 1
+
+patch parameter vertices 3
+draw arrays GL_PATCHES 0 3
+
+probe atomic counter 0 == 0
-- 
2.20.1

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


[Piglit] [PATCH] arb_tessellation_shader: Test unmatched TCS output usage

2019-01-02 Thread Danylo Piliaiev
Test that TCS per-vertex outputs which are used only in
TCS stage are not converted to local variables and indeed
share data within the patch.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104297
Signed-off-by: Danylo Piliaiev 
---
 .../tcs-output-unmatched.shader_test  | 65 +++
 1 file changed, 65 insertions(+)
 create mode 100644 
tests/spec/arb_tessellation_shader/execution/tcs-output-unmatched.shader_test

diff --git 
a/tests/spec/arb_tessellation_shader/execution/tcs-output-unmatched.shader_test 
b/tests/spec/arb_tessellation_shader/execution/tcs-output-unmatched.shader_test
new file mode 100644
index 0..de1b0143b
--- /dev/null
+++ 
b/tests/spec/arb_tessellation_shader/execution/tcs-output-unmatched.shader_test
@@ -0,0 +1,65 @@
+# Test that TCS per-vertex outputs which are used only in
+# TCS stage are not converted to local variables
+# and indeed share data within the patch.
+
+[require]
+GLSL >= 1.50
+GL_ARB_tessellation_shader
+GL_ARB_separate_shader_objects
+
+[vertex shader passthrough]
+
+
+[tessellation control shader]
+#extension GL_ARB_tessellation_shader: require
+#extension GL_ARB_separate_shader_objects: require
+#extension GL_ARB_shader_atomic_counters: require
+#extension GL_ARB_shader_atomic_counter_ops: require
+layout(vertices = 3) out;
+
+layout(location=0) out vec4 out_unused_in_tes[];
+
+layout(binding = 0) uniform atomic_uint mismatches;
+
+void main() {
+   out_unused_in_tes[gl_InvocationID] = gl_in[gl_InvocationID].gl_Position;
+
+   barrier();
+
+   if(out_unused_in_tes[0] != gl_in[0].gl_Position ||
+  out_unused_in_tes[1] != gl_in[1].gl_Position ||
+  out_unused_in_tes[2] != gl_in[2].gl_Position) {
+   atomicCounterIncrement(mismatches);
+ }
+}
+
+
+[tessellation evaluation shader]
+#extension GL_ARB_tessellation_shader: require
+layout(triangles) in;
+
+void main() {
+   gl_Position = vec4(0);
+}
+
+
+[fragment shader]
+
+void main()
+{
+   gl_FragColor = vec4(1.0);
+}
+
+[vertex data]
+piglit_vertex/float/4
+1 1 1 1
+2 2 2 2
+3 3 3 3
+
+[test]
+atomic counters 1
+
+patch parameter vertices 3
+draw arrays GL_PATCHES 0 3
+
+probe atomic counter 0 == 0
-- 
2.20.1

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


Re: [Piglit] [PATCH] arb_texture_view: Test interaction with ARB_shader_image_load_store

2018-11-16 Thread Danylo Piliaiev

Hello,

Since the patch which fixes the issue got pushed in
f9fd0cf4790cb2a530e75d1a2206dbb9d8af7cb2
could this test be reviewed/pushed?

Thanks!

On 10/24/18 2:17 PM, Danylo Piliaiev wrote:

Tests that binding texture view to image unit results in a correct
calculation of layers:
- Correct layer should be read
- Image should have correct layers count

Exercises the bug:
https://bugs.freedesktop.org/show_bug.cgi?id=107856

Signed-off-by: Danylo Piliaiev 
---
  tests/opengl.py   |   1 +
  tests/spec/arb_texture_view/CMakeLists.gl.txt |   1 +
  .../arb_texture_view/rendering-layers-image.c | 211 ++
  3 files changed, 213 insertions(+)
  create mode 100644 tests/spec/arb_texture_view/rendering-layers-image.c

diff --git a/tests/opengl.py b/tests/opengl.py
index f7e408cd5..caa0d2813 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -2461,6 +2461,7 @@ with profile.test_list.group_manager(
  g(['arb_texture_view-rendering-target'], 'rendering-target')
  g(['arb_texture_view-rendering-levels'], 'rendering-levels')
  g(['arb_texture_view-rendering-layers'], 'rendering-layers')
+g(['arb_texture_view-rendering-layers-image'], 'rendering-layers-image')
  g(['arb_texture_view-rendering-formats'], 'rendering-formats')
  g(['arb_texture_view-rendering-r32ui'], 'rendering-r32ui')
  g(['arb_texture_view-lifetime-format'], 'lifetime-format')
diff --git a/tests/spec/arb_texture_view/CMakeLists.gl.txt 
b/tests/spec/arb_texture_view/CMakeLists.gl.txt
index 39330dad7..eca0c18a5 100644
--- a/tests/spec/arb_texture_view/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_view/CMakeLists.gl.txt
@@ -21,6 +21,7 @@ piglit_add_executable(arb_texture_view-mipgen mipgen.c)
  piglit_add_executable(arb_texture_view-params params.c)
  piglit_add_executable(arb_texture_view-queries queries.c)
  piglit_add_executable(arb_texture_view-rendering-formats rendering-formats.c)
+piglit_add_executable(arb_texture_view-rendering-layers-image 
rendering-layers-image.c common.c)
  piglit_add_executable(arb_texture_view-rendering-layers rendering_layers.c 
common.c)
  piglit_add_executable(arb_texture_view-rendering-levels rendering_levels.c 
common.c)
  piglit_add_executable(arb_texture_view-rendering-r32ui rendering-r32ui.c)
diff --git a/tests/spec/arb_texture_view/rendering-layers-image.c 
b/tests/spec/arb_texture_view/rendering-layers-image.c
new file mode 100644
index 0..415b01657
--- /dev/null
+++ b/tests/spec/arb_texture_view/rendering-layers-image.c
@@ -0,0 +1,211 @@
+/* Copyright © 2018 Danylo Piliaiev
+ *
+ * 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.
+ */
+
+/**
+ * Tests GL_ARB_texture_view interaction with ARB_shader_image_load_store.
+ * Creates texture maps with different solid colors for each layer,
+ * reads the framebuffer to ensure the rendered color is correct
+ * and verifies that image has expected layers count.
+ */
+
+#include "piglit-util-gl.h"
+#include "common.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_core_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
+
+struct test_info
+{
+   GLenum target;
+   const char* uniform_type;
+   const char* img_layers_dimension;
+   const char* img_access;
+   int program;
+};
+
+struct test_info tests[] = {
+   {GL_TEXTURE_1D_ARRAY, "image1DArray", "y", "ivec2(0, tex_layer)", -1},
+   {GL_TEXTURE_2D_ARRAY, "image2DArray", "z", "ivec3(0, 0, tex_layer)", 
-1},
+   {GL_TEXTURE_CUBE_MAP_ARRAY, "imageCubeArray", "z * 6", "ivec3(0, 0, 
tex_layer)", -1},
+};
+
+static bool
+test_render_layers(const struct test_info *test)
+{
+   GLuint tex;
+ 

Re: [Piglit] [PATCH v3] arb_blend_func_extended: Test dual src blending without second color output

2018-11-09 Thread Danylo Piliaiev

Hi,

Since the fix for the underlying issue was pushed to Mesa in 
eca4a6548d0702a7768edb397bad7b72cfc2

could this test be also pushed?

- Danil

On 7/9/18 11:54 AM, Danylo Piliaiev wrote:

Using fragment shader without second color output should not hang gpu
when dual source blending is enabled.
It hanged Intel gen8+ GPUs when discarding fragments and depth test
being enabled.
There is also safeguard against lack of second color output in radeonsi.

v2: by Ilia Mirkin
 - Set supports_gl_compat_version = 30
 - Moved drawing to piglit_display
 - Change drawing sequence to: clear red -> draw -> clear green

v3: by Dylan Baker
 - Removed run_concurrent=False

Signed-off-by: Danylo Piliaiev 
---
  tests/opengl.py   |   2 +
  .../execution/CMakeLists.gl.txt   |   1 +
  .../execution/CMakeLists.gles3.txt|   1 +
  .../dual-src-blending-discard-without-src1.c  | 126 ++
  4 files changed, 130 insertions(+)
  create mode 100644 
tests/spec/arb_blend_func_extended/execution/dual-src-blending-discard-without-src1.c

diff --git a/tests/opengl.py b/tests/opengl.py
index 02110ff86..1b088b75f 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -4114,6 +4114,7 @@ with profile.test_list.group_manager(
  g(['arb_blend_func_extended-fbo-extended-blend'])
  g(['arb_blend_func_extended-fbo-extended-blend-explicit'])
  g(['arb_blend_func_extended-fbo-extended-blend-pattern'])
+g(['arb_blend_func_extended-dual-src-blending-discard-without-src1'])
  g(['arb_blend_func_extended-blend-api_gles2'])
  g(['arb_blend_func_extended-builtins_gles2'])
  
g(['arb_blend_func_extended-bindfragdataindexed-invalid-parameters_gles3'])
@@ -4123,6 +4124,7 @@ with profile.test_list.group_manager(
  g(['arb_blend_func_extended-fbo-extended-blend-pattern_gles3'])
  g(['arb_blend_func_extended-fbo-extended-blend_gles3'])
  g(['arb_blend_func_extended-fbo-extended-blend-explicit_gles3'])
+g(['arb_blend_func_extended-dual-src-blending-discard-without-src1_gles3'])
  
  with profile.test_list.group_manager(

  PiglitGLTest,
diff --git a/tests/spec/arb_blend_func_extended/execution/CMakeLists.gl.txt 
b/tests/spec/arb_blend_func_extended/execution/CMakeLists.gl.txt
index f48c352e1..09d45b72c 100644
--- a/tests/spec/arb_blend_func_extended/execution/CMakeLists.gl.txt
+++ b/tests/spec/arb_blend_func_extended/execution/CMakeLists.gl.txt
@@ -12,4 +12,5 @@ link_libraries (
  piglit_add_executable (arb_blend_func_extended-fbo-extended-blend 
fbo-extended-blend.c)
  piglit_add_executable (arb_blend_func_extended-fbo-extended-blend-explicit 
fbo-extended-blend-explicit.c)
  piglit_add_executable (arb_blend_func_extended-fbo-extended-blend-pattern 
fbo-extended-blend-pattern.c)
+piglit_add_executable 
(arb_blend_func_extended-dual-src-blending-discard-without-src1 
dual-src-blending-discard-without-src1.c)
  # vim: ft=cmake:
diff --git a/tests/spec/arb_blend_func_extended/execution/CMakeLists.gles3.txt 
b/tests/spec/arb_blend_func_extended/execution/CMakeLists.gles3.txt
index a70e9fa5e..fd41622bd 100644
--- a/tests/spec/arb_blend_func_extended/execution/CMakeLists.gles3.txt
+++ b/tests/spec/arb_blend_func_extended/execution/CMakeLists.gles3.txt
@@ -3,4 +3,5 @@ link_libraries(piglitutil_${piglit_target_api})
  piglit_add_executable 
(arb_blend_func_extended-fbo-extended-blend_${piglit_target_api} 
fbo-extended-blend.c)
  piglit_add_executable 
(arb_blend_func_extended-fbo-extended-blend-explicit_${piglit_target_api} 
fbo-extended-blend-explicit.c)
  piglit_add_executable 
(arb_blend_func_extended-fbo-extended-blend-pattern_${piglit_target_api} 
fbo-extended-blend-pattern.c)
+piglit_add_executable 
(arb_blend_func_extended-dual-src-blending-discard-without-src1_${piglit_target_api}
 dual-src-blending-discard-without-src1.c)
  # vim: ft=cmake:
diff --git 
a/tests/spec/arb_blend_func_extended/execution/dual-src-blending-discard-without-src1.c
 
b/tests/spec/arb_blend_func_extended/execution/dual-src-blending-discard-without-src1.c
new file mode 100644
index 0..a0a45cd79
--- /dev/null
+++ 
b/tests/spec/arb_blend_func_extended/execution/dual-src-blending-discard-without-src1.c
@@ -0,0 +1,126 @@
+/* Copyright © 2018 Danylo Piliaiev
+ *
+ * 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"

[Piglit] [PATCH] arb_texture_view: Test interaction with ARB_shader_image_load_store

2018-10-24 Thread Danylo Piliaiev
Tests that binding texture view to image unit results in a correct
calculation of layers:
- Correct layer should be read
- Image should have correct layers count

Exercises the bug:
https://bugs.freedesktop.org/show_bug.cgi?id=107856

Signed-off-by: Danylo Piliaiev 
---
 tests/opengl.py   |   1 +
 tests/spec/arb_texture_view/CMakeLists.gl.txt |   1 +
 .../arb_texture_view/rendering-layers-image.c | 211 ++
 3 files changed, 213 insertions(+)
 create mode 100644 tests/spec/arb_texture_view/rendering-layers-image.c

diff --git a/tests/opengl.py b/tests/opengl.py
index f7e408cd5..caa0d2813 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -2461,6 +2461,7 @@ with profile.test_list.group_manager(
 g(['arb_texture_view-rendering-target'], 'rendering-target')
 g(['arb_texture_view-rendering-levels'], 'rendering-levels')
 g(['arb_texture_view-rendering-layers'], 'rendering-layers')
+g(['arb_texture_view-rendering-layers-image'], 'rendering-layers-image')
 g(['arb_texture_view-rendering-formats'], 'rendering-formats')
 g(['arb_texture_view-rendering-r32ui'], 'rendering-r32ui')
 g(['arb_texture_view-lifetime-format'], 'lifetime-format')
diff --git a/tests/spec/arb_texture_view/CMakeLists.gl.txt 
b/tests/spec/arb_texture_view/CMakeLists.gl.txt
index 39330dad7..eca0c18a5 100644
--- a/tests/spec/arb_texture_view/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_view/CMakeLists.gl.txt
@@ -21,6 +21,7 @@ piglit_add_executable(arb_texture_view-mipgen mipgen.c)
 piglit_add_executable(arb_texture_view-params params.c)
 piglit_add_executable(arb_texture_view-queries queries.c)
 piglit_add_executable(arb_texture_view-rendering-formats rendering-formats.c)
+piglit_add_executable(arb_texture_view-rendering-layers-image 
rendering-layers-image.c common.c)
 piglit_add_executable(arb_texture_view-rendering-layers rendering_layers.c 
common.c)
 piglit_add_executable(arb_texture_view-rendering-levels rendering_levels.c 
common.c)
 piglit_add_executable(arb_texture_view-rendering-r32ui rendering-r32ui.c)
diff --git a/tests/spec/arb_texture_view/rendering-layers-image.c 
b/tests/spec/arb_texture_view/rendering-layers-image.c
new file mode 100644
index 0..415b01657
--- /dev/null
+++ b/tests/spec/arb_texture_view/rendering-layers-image.c
@@ -0,0 +1,211 @@
+/* Copyright © 2018 Danylo Piliaiev
+ *
+ * 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.
+ */
+
+/**
+ * Tests GL_ARB_texture_view interaction with ARB_shader_image_load_store.
+ * Creates texture maps with different solid colors for each layer,
+ * reads the framebuffer to ensure the rendered color is correct
+ * and verifies that image has expected layers count.
+ */
+
+#include "piglit-util-gl.h"
+#include "common.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_core_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
+
+struct test_info
+{
+   GLenum target;
+   const char* uniform_type;
+   const char* img_layers_dimension;
+   const char* img_access;
+   int program;
+};
+
+struct test_info tests[] = {
+   {GL_TEXTURE_1D_ARRAY, "image1DArray", "y", "ivec2(0, tex_layer)", -1},
+   {GL_TEXTURE_2D_ARRAY, "image2DArray", "z", "ivec3(0, 0, tex_layer)", 
-1},
+   {GL_TEXTURE_CUBE_MAP_ARRAY, "imageCubeArray", "z * 6", "ivec3(0, 0, 
tex_layer)", -1},
+};
+
+static bool
+test_render_layers(const struct test_info *test)
+{
+   GLuint tex;
+   const GLint width = 16, height = 16, layers = 12;
+   const GLint num_layers[] = {7, 11, 2, 4};
+   bool pass = true;
+
+   glUseProgram(test->program);
+
+   const GLint expected_layers

Re: [Piglit] [PATCH v3] arb_shader_image_load_store: Test format incompatible texture buffer

2018-10-09 Thread Danylo Piliaiev



On 10/8/18 7:41 PM, Nanley Chery wrote:

On Mon, Jul 23, 2018 at 03:13:34PM +0300, Danylo Piliaiev wrote:

Test for the regression which happened when GL_TEXTURE_BUFFER was
allowed to have incompatible format.

v2: Removed unnecessary code duplication - use upload_image instead
  of init_level. (Francisco Jerez)
v3: Removed upload_image call because image is already called
  by init_image. (Francisco Jerez)

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

Signed-off-by: Danylo Piliaiev 
Reviewed-by: Francisco Jerez 

I noticed that this test has a reviewed-by, but isn't upstream. Does
someone just need to push it?

-Nanley

Indeed, thank you for noticing it. I need someone to push the test.

- Danil

---
  .../arb_shader_image_load_store/invalid.c | 19 ++-
  1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/tests/spec/arb_shader_image_load_store/invalid.c 
b/tests/spec/arb_shader_image_load_store/invalid.c
index ed4b6c064..719304237 100644
--- a/tests/spec/arb_shader_image_load_store/invalid.c
+++ b/tests/spec/arb_shader_image_load_store/invalid.c
@@ -268,13 +268,11 @@ invalidate_incompatible_format(const struct image_info 
img, GLuint prog)
  GLenum base_format = image_base_internal_format(img.format);
  /* Pick an incompatible texture format with a compatible base
   * type. */
-bool ret = init_level(img, 0, (base_format == GL_RGBA32F ?
-   GL_RGBA8 : GL_RG32UI), W, H);
-
  glBindImageTexture(0, get_texture(0), 0, GL_TRUE, 0,
-   GL_READ_WRITE, img.format->format);
+   GL_READ_WRITE, (base_format == GL_RGBA32F ?
+   GL_RGBA8 : GL_RG32UI));
  
-return ret && piglit_check_gl_error(GL_NO_ERROR);

+return piglit_check_gl_error(GL_NO_ERROR);
  }
  
  static bool

@@ -346,6 +344,8 @@ piglit_init(int argc, char **argv)
  for (op = image_ops; op->name; ++op) {
  const struct image_info def_img = image_info(
  GL_TEXTURE_2D, op->formats[0].format, W, H);
+const struct image_info def_img_buffer = image_info(
+GL_TEXTURE_BUFFER, op->formats[0].format, W, H);
  
  /*

   * According to the spec, an access is considered
@@ -399,6 +399,15 @@ piglit_init(int argc, char **argv)
   invalidate_incompatible_format, false),
  "%s/incompatible format test", op->name);
  
+/* Test for the regression which happened when

+ * GL_TEXTURE_BUFFER was allowed to have incompatible format.
+ */
+subtest(, true,
+run_test(op, def_img_buffer, def_img_buffer,
+ invalidate_incompatible_format, false),
+"%s/incompatible format test/image%s",
+op->name, def_img_buffer.target->name);
+
  /*
   * " * the texture bound to the image unit has layers,
   * and the selected layer or cube map face doesn't
--
2.17.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 v2] glsl-1.10: add a 'initialization-incompatible-type-propagation' test

2018-09-19 Thread Danylo Piliaiev
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;
+}
-- 
2.18.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 Danylo Piliaiev



On 9/17/18 1:01 PM, Timothy Arceri wrote:

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.


Understood, I'll split it in to two tests. Only one case is causing 
segfault, other one just has a potential.



+}





___
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 Danylo Piliaiev



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.



+}



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


[Piglit] [PATCH] glsl-1.20: test 'invariant' propagation influence on globals matching

2018-09-04 Thread Danylo Piliaiev
Global variable defined in several shaders of one stage should not cause
"mismatched qualifiers" linking error when invariance is being propagated
on it in one shader.

Signed-off-by: Danylo Piliaiev 
---
 .../invariant-propagation-globals.shader_test | 29 +++
 1 file changed, 29 insertions(+)
 create mode 100644 
tests/spec/glsl-1.20/linker/invariant-propagation-globals.shader_test

diff --git 
a/tests/spec/glsl-1.20/linker/invariant-propagation-globals.shader_test 
b/tests/spec/glsl-1.20/linker/invariant-propagation-globals.shader_test
new file mode 100644
index 0..d49fa3c3e
--- /dev/null
+++ b/tests/spec/glsl-1.20/linker/invariant-propagation-globals.shader_test
@@ -0,0 +1,29 @@
+[require]
+GLSL >= 1.20
+
+# This test exercises a Mesa GLSL bug where 'invariant' qualifier
+# propagates on one definition of the global variable defined in several
+# shaders of one stage, causing linking error due to qualifier mismatch.
+
+[vertex shader]
+#version 120
+float x;
+
+[vertex shader]
+#version 120
+float x;
+invariant gl_Position;
+
+void main()
+{
+  gl_Position = vec4(x);
+}
+
+[fragment shader]
+#version 120
+void main()
+{
+}
+
+[test]
+link success
-- 
2.18.0

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


[Piglit] [PATCH] glsl-1.20: test that 'invariant' qualifier does not propagate on uniforms

2018-08-22 Thread Danylo Piliaiev
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100316

Signed-off-by: Danylo Piliaiev 
---
 .../linker/invariant-propagation.shader_test  | 25 +++
 1 file changed, 25 insertions(+)
 create mode 100644 
tests/spec/glsl-1.20/linker/invariant-propagation.shader_test

diff --git a/tests/spec/glsl-1.20/linker/invariant-propagation.shader_test 
b/tests/spec/glsl-1.20/linker/invariant-propagation.shader_test
new file mode 100644
index 0..fc4096833
--- /dev/null
+++ b/tests/spec/glsl-1.20/linker/invariant-propagation.shader_test
@@ -0,0 +1,25 @@
+[require]
+GLSL >= 1.20
+
+# This test exercises a Mesa GLSL bug where 'invariant' qualifier
+# propagated on uniforms causing a linker failure due to mismatch
+# of uniforms declaration between stages.
+
+[vertex shader]
+#version 120
+uniform float t;
+invariant gl_Position;
+void main()
+{
+  gl_Position = vec4(t);
+}
+
+[fragment shader]
+#version 120
+uniform float t;
+void main()
+{
+}
+
+[test]
+link success
-- 
2.18.0

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


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

2018-08-15 Thread Danylo Piliaiev
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;
+}
-- 
2.18.0

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


[Piglit] [PATCH] crucible: Fix all format-security issues

2018-07-25 Thread Danylo Piliaiev
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107374

Signed-off-by: Danylo Piliaiev 
---
 src/framework/test/t_dump.c| 2 +-
 src/framework/test/t_result.c  | 6 +++---
 src/tests/self/concurrent-output.c | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/framework/test/t_dump.c b/src/framework/test/t_dump.c
index 04f55c3..edfb3fa 100644
--- a/src/framework/test/t_dump.c
+++ b/src/framework/test/t_dump.c
@@ -71,7 +71,7 @@ t_dump_image_fv(cru_image_t *image, const char *format, 
va_list va)
 return;
 
 string_t filename = STRING_INIT;
-string_appendf(, t_name);
+string_append_cstr(, t_name);
 string_append_char(, '.');
 string_vappendf(, format, va);
 
diff --git a/src/framework/test/t_result.c b/src/framework/test/t_result.c
index 80ab731..209d6b2 100644
--- a/src/framework/test/t_result.c
+++ b/src/framework/test/t_result.c
@@ -78,7 +78,7 @@ __t_skipfv(const char *file, int line, const char *format, 
va_list va)
 string_vappendf(, format, va);
 }
 
-logi(string_data());
+logi("%s", string_data());
 string_finish();
 
 __t_skip_silent();
@@ -127,7 +127,7 @@ __t_failfv(const char *file, int line, const char *format, 
va_list va)
 string_vappendf(, format, va);
 }
 
-loge(string_data());
+loge("%s", string_data());
 string_finish();
 
 __t_fail_silent();
@@ -179,7 +179,7 @@ __t_assertfv(const char *file, int line, bool cond, const 
char *cond_string,
 string_t s = STRING_INIT;
 string_appendf(, "%s:%d: ", file, line);
 string_vappendf(, format, va);
-loge(string_data());
+loge("%s", string_data());
 string_finish();
 }
 
diff --git a/src/tests/self/concurrent-output.c 
b/src/tests/self/concurrent-output.c
index 002d4ed..4114af6 100644
--- a/src/tests/self/concurrent-output.c
+++ b/src/tests/self/concurrent-output.c
@@ -45,7 +45,7 @@ test_logi_a(void)
 char *a = mk_big_str('a');
 
 for (int i = 0; i < 1024; ++i) {
-logi(a);
+logi("%s", a);
 }
 }
 
@@ -61,7 +61,7 @@ test_logi_b(void)
 char *b = mk_big_str('b');
 
 for (int i = 0; i < 1024; ++i) {
-logi(b);
+logi("%s", b);
 }
 }
 
-- 
2.17.1

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


[Piglit] [PATCH] crucible/ssbo/interleave: Fix incorrect verification of the result

2018-07-25 Thread Danylo Piliaiev
Fix out of bounds access to map_out which has only 1024 uint32_t.
Fix assert condition which was exact oposite of the correct one.

As a result test now is expected to fail until
https://github.com/KhronosGroup/glslang/issues/94 is resolved.

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

Signed-off-by: Danylo Piliaiev 
---
 src/tests/func/ssbo/interleave.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/tests/func/ssbo/interleave.c b/src/tests/func/ssbo/interleave.c
index 6b42e75..282effa 100644
--- a/src/tests/func/ssbo/interleave.c
+++ b/src/tests/func/ssbo/interleave.c
@@ -201,11 +201,11 @@ test(void)
 qoQueueWaitIdle(t_queue);
 
 uint32_t *map_out = qoMapMemory(t_device, mem_out, 0, 4096, 0);
-for (unsigned i = 0; i < 1024; i++) {
-t_assertf(map_out[i * 4 + 0] != i * 4 + 0 ||
-  map_out[i * 4 + 1] != i * 4 + 2 ||
-  map_out[i * 4 + 2] != i * 4 + 1 ||
-  map_out[i * 4 + 3] != i * 4 + 3,
+for (unsigned i = 0; i < 256; i++) {
+t_assertf(map_out[i * 4 + 0] == i * 4 + 0 &&
+  map_out[i * 4 + 1] == i * 4 + 2 &&
+  map_out[i * 4 + 2] == i * 4 + 1 &&
+  map_out[i * 4 + 3] == i * 4 + 3,
   "buffer mismatch at uvec4 %d: found (%u, %u, %u, %u), "
   "expected (%u, %u, %u, %u)", i,
   map_out[i * 4 + 0], map_out[i * 4 + 1],
-- 
2.17.1

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


Re: [Piglit] [PATCH v2] arb_shader_image_load_store: Test format incompatible texture buffer

2018-07-23 Thread Danylo Piliaiev



On 20.07.18 23:19, Francisco Jerez wrote:

Danylo Piliaiev  writes:


On 20.07.18 17:04, Danylo Piliaiev wrote:


On 20.07.18 02:26, Francisco Jerez wrote:

Danylo Piliaiev  writes:


Test for the regression which happened when GL_TEXTURE_BUFFER was
allowed to have incompatible format.

v2: Removed unnecessary code duplication - use upload_image instead
   of init_level. (Francisco Jerez)

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

Signed-off-by: Danylo Piliaiev 
---
   .../arb_shader_image_load_store/invalid.c | 23
+++
   1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/tests/spec/arb_shader_image_load_store/invalid.c
b/tests/spec/arb_shader_image_load_store/invalid.c
index ed4b6c064..99f6703a4 100644
--- a/tests/spec/arb_shader_image_load_store/invalid.c
+++ b/tests/spec/arb_shader_image_load_store/invalid.c
@@ -266,13 +266,17 @@ static bool
   invalidate_incompatible_format(const struct image_info img, GLuint
prog)
   {
   GLenum base_format = image_base_internal_format(img.format);
+    uint32_t pixels[4 * N];
+    init_pixels(img, pixels, 1, 1, 1, 1);
+
+    /* upload_image instead of init_level to support
GL_TEXTURE_BUFFER */
+    bool ret = upload_image(img, 0, pixels);
+

I don't think you actually need to call upload_image() here, it should
have been called already by init_image().

I don't know where I'm looking... You are right. Only
glBindImageTexture will be left
and it's enough for the test.

   /* Pick an incompatible texture format with a compatible base
    * type. */
-    bool ret = init_level(img, 0, (base_format == GL_RGBA32F ?
-   GL_RGBA8 : GL_RG32UI), W, H);
-
   glBindImageTexture(0, get_texture(0), 0, GL_TRUE, 0,
-   GL_READ_WRITE, img.format->format);
+   GL_READ_WRITE, (base_format == GL_RGBA32F ?
+   GL_RGBA8 : GL_RG32UI));
     return ret && piglit_check_gl_error(GL_NO_ERROR);
   }
@@ -346,6 +350,8 @@ piglit_init(int argc, char **argv)
   for (op = image_ops; op->name; ++op) {
   const struct image_info def_img = image_info(
   GL_TEXTURE_2D, op->formats[0].format, W, H);
+    const struct image_info def_img_buffer = image_info(
+    GL_TEXTURE_BUFFER, op->formats[0].format,
W, H);
     /*
    * According to the spec, an access is considered
@@ -399,6 +405,15 @@ piglit_init(int argc, char **argv)
invalidate_incompatible_format, false),
   "%s/incompatible format test", op->name);
   +    /* Test for the regression which happened when
+ * GL_TEXTURE_BUFFER was allowed to have
incompatible format.
+ */

FTR, did you confirm whether this test-case causes a crash after
re-applying the mesa patch that led to the regression?

Thanks.

This test-case doesn't crash with that patch. I picked the first
format from the array
(same as the other tests) which appears to be GL_RGBA32F, but
unfortunately it's a
format with which we cannot go out of bounds. Picking the format which
will result in crash
would be better (already tested and crash occurred). I'll do this in
my hopefully final version of the patch.


Please, disregard this part, it doesn't crash regardless of format, test
just fails - nothing more.

But I get that the test runs successfully after reverting the offending
commit?  In that case patch is:

Reviewed-by: Francisco Jerez 
Yes, tests pass after reverting the offending commit and fail when 
applying it.

Thank you for reviewing these embarrassing patches.

No worries you're fine :)


+    subtest(, true,
+    run_test(op, def_img_buffer, def_img_buffer,
+ invalidate_incompatible_format, false),
+    "%s/incompatible format test/image%s",
+    op->name, def_img_buffer.target->name);
+
   /*
    * " * the texture bound to the image unit has
layers,
    * and the selected layer or cube map face
doesn't
--
2.17.1


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


[Piglit] [PATCH v3] arb_shader_image_load_store: Test format incompatible texture buffer

2018-07-23 Thread Danylo Piliaiev
Test for the regression which happened when GL_TEXTURE_BUFFER was
allowed to have incompatible format.

v2: Removed unnecessary code duplication - use upload_image instead
 of init_level. (Francisco Jerez)
v3: Removed upload_image call because image is already called
 by init_image. (Francisco Jerez)

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

Signed-off-by: Danylo Piliaiev 
Reviewed-by: Francisco Jerez 
---
 .../arb_shader_image_load_store/invalid.c | 19 ++-
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/tests/spec/arb_shader_image_load_store/invalid.c 
b/tests/spec/arb_shader_image_load_store/invalid.c
index ed4b6c064..719304237 100644
--- a/tests/spec/arb_shader_image_load_store/invalid.c
+++ b/tests/spec/arb_shader_image_load_store/invalid.c
@@ -268,13 +268,11 @@ invalidate_incompatible_format(const struct image_info 
img, GLuint prog)
 GLenum base_format = image_base_internal_format(img.format);
 /* Pick an incompatible texture format with a compatible base
  * type. */
-bool ret = init_level(img, 0, (base_format == GL_RGBA32F ?
-   GL_RGBA8 : GL_RG32UI), W, H);
-
 glBindImageTexture(0, get_texture(0), 0, GL_TRUE, 0,
-   GL_READ_WRITE, img.format->format);
+   GL_READ_WRITE, (base_format == GL_RGBA32F ?
+   GL_RGBA8 : GL_RG32UI));
 
-return ret && piglit_check_gl_error(GL_NO_ERROR);
+return piglit_check_gl_error(GL_NO_ERROR);
 }
 
 static bool
@@ -346,6 +344,8 @@ piglit_init(int argc, char **argv)
 for (op = image_ops; op->name; ++op) {
 const struct image_info def_img = image_info(
 GL_TEXTURE_2D, op->formats[0].format, W, H);
+const struct image_info def_img_buffer = image_info(
+GL_TEXTURE_BUFFER, op->formats[0].format, W, H);
 
 /*
  * According to the spec, an access is considered
@@ -399,6 +399,15 @@ piglit_init(int argc, char **argv)
  invalidate_incompatible_format, false),
 "%s/incompatible format test", op->name);
 
+/* Test for the regression which happened when
+ * GL_TEXTURE_BUFFER was allowed to have incompatible format.
+ */
+subtest(, true,
+run_test(op, def_img_buffer, def_img_buffer,
+ invalidate_incompatible_format, false),
+"%s/incompatible format test/image%s",
+op->name, def_img_buffer.target->name);
+
 /*
  * " * the texture bound to the image unit has layers,
  * and the selected layer or cube map face doesn't
-- 
2.17.1

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


Re: [Piglit] [PATCH v2] arb_shader_image_load_store: Test format incompatible texture buffer

2018-07-20 Thread Danylo Piliaiev



On 20.07.18 17:04, Danylo Piliaiev wrote:



On 20.07.18 02:26, Francisco Jerez wrote:

Danylo Piliaiev  writes:


Test for the regression which happened when GL_TEXTURE_BUFFER was
allowed to have incompatible format.

v2: Removed unnecessary code duplication - use upload_image instead
  of init_level. (Francisco Jerez)

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

Signed-off-by: Danylo Piliaiev 
---
  .../arb_shader_image_load_store/invalid.c | 23 
+++

  1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/tests/spec/arb_shader_image_load_store/invalid.c 
b/tests/spec/arb_shader_image_load_store/invalid.c

index ed4b6c064..99f6703a4 100644
--- a/tests/spec/arb_shader_image_load_store/invalid.c
+++ b/tests/spec/arb_shader_image_load_store/invalid.c
@@ -266,13 +266,17 @@ static bool
  invalidate_incompatible_format(const struct image_info img, GLuint 
prog)

  {
  GLenum base_format = image_base_internal_format(img.format);
+    uint32_t pixels[4 * N];
+    init_pixels(img, pixels, 1, 1, 1, 1);
+
+    /* upload_image instead of init_level to support 
GL_TEXTURE_BUFFER */

+    bool ret = upload_image(img, 0, pixels);
+

I don't think you actually need to call upload_image() here, it should
have been called already by init_image().
I don't know where I'm looking... You are right. Only 
glBindImageTexture will be left

and it's enough for the test.

  /* Pick an incompatible texture format with a compatible base
   * type. */
-    bool ret = init_level(img, 0, (base_format == GL_RGBA32F ?
-   GL_RGBA8 : GL_RG32UI), W, H);
-
  glBindImageTexture(0, get_texture(0), 0, GL_TRUE, 0,
-   GL_READ_WRITE, img.format->format);
+   GL_READ_WRITE, (base_format == GL_RGBA32F ?
+   GL_RGBA8 : GL_RG32UI));
    return ret && piglit_check_gl_error(GL_NO_ERROR);
  }
@@ -346,6 +350,8 @@ piglit_init(int argc, char **argv)
  for (op = image_ops; op->name; ++op) {
  const struct image_info def_img = image_info(
  GL_TEXTURE_2D, op->formats[0].format, W, H);
+    const struct image_info def_img_buffer = image_info(
+    GL_TEXTURE_BUFFER, op->formats[0].format, 
W, H);

    /*
   * According to the spec, an access is considered
@@ -399,6 +405,15 @@ piglit_init(int argc, char **argv)
invalidate_incompatible_format, false),
  "%s/incompatible format test", op->name);
  +    /* Test for the regression which happened when
+ * GL_TEXTURE_BUFFER was allowed to have 
incompatible format.

+ */

FTR, did you confirm whether this test-case causes a crash after
re-applying the mesa patch that led to the regression?

Thanks.
This test-case doesn't crash with that patch. I picked the first 
format from the array
(same as the other tests) which appears to be GL_RGBA32F, but 
unfortunately it's a
format with which we cannot go out of bounds. Picking the format which 
will result in crash
would be better (already tested and crash occurred). I'll do this in 
my hopefully final version of the patch.


Please, disregard this part, it doesn't crash regardless of format, test 
just fails - nothing more.

Thank you for reviewing these embarrassing patches.

+    subtest(, true,
+    run_test(op, def_img_buffer, def_img_buffer,
+ invalidate_incompatible_format, false),
+    "%s/incompatible format test/image%s",
+    op->name, def_img_buffer.target->name);
+
  /*
   * " * the texture bound to the image unit has 
layers,
   * and the selected layer or cube map face 
doesn't

--
2.17.1




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


Re: [Piglit] [PATCH v2] arb_shader_image_load_store: Test format incompatible texture buffer

2018-07-20 Thread Danylo Piliaiev



On 20.07.18 02:26, Francisco Jerez wrote:

Danylo Piliaiev  writes:


Test for the regression which happened when GL_TEXTURE_BUFFER was
allowed to have incompatible format.

v2: Removed unnecessary code duplication - use upload_image instead
  of init_level. (Francisco Jerez)

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

Signed-off-by: Danylo Piliaiev 
---
  .../arb_shader_image_load_store/invalid.c | 23 +++
  1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/tests/spec/arb_shader_image_load_store/invalid.c 
b/tests/spec/arb_shader_image_load_store/invalid.c
index ed4b6c064..99f6703a4 100644
--- a/tests/spec/arb_shader_image_load_store/invalid.c
+++ b/tests/spec/arb_shader_image_load_store/invalid.c
@@ -266,13 +266,17 @@ static bool
  invalidate_incompatible_format(const struct image_info img, GLuint prog)
  {
  GLenum base_format = image_base_internal_format(img.format);
+uint32_t pixels[4 * N];
+init_pixels(img, pixels, 1, 1, 1, 1);
+
+/* upload_image instead of init_level to support GL_TEXTURE_BUFFER */
+bool ret = upload_image(img, 0, pixels);
+

I don't think you actually need to call upload_image() here, it should
have been called already by init_image().
I don't know where I'm looking... You are right. Only glBindImageTexture 
will be left

and it's enough for the test.

  /* Pick an incompatible texture format with a compatible base
   * type. */
-bool ret = init_level(img, 0, (base_format == GL_RGBA32F ?
-   GL_RGBA8 : GL_RG32UI), W, H);
-
  glBindImageTexture(0, get_texture(0), 0, GL_TRUE, 0,
-   GL_READ_WRITE, img.format->format);
+   GL_READ_WRITE, (base_format == GL_RGBA32F ?
+   GL_RGBA8 : GL_RG32UI));
  
  return ret && piglit_check_gl_error(GL_NO_ERROR);

  }
@@ -346,6 +350,8 @@ piglit_init(int argc, char **argv)
  for (op = image_ops; op->name; ++op) {
  const struct image_info def_img = image_info(
  GL_TEXTURE_2D, op->formats[0].format, W, H);
+const struct image_info def_img_buffer = image_info(
+GL_TEXTURE_BUFFER, op->formats[0].format, W, H);
  
  /*

   * According to the spec, an access is considered
@@ -399,6 +405,15 @@ piglit_init(int argc, char **argv)
   invalidate_incompatible_format, false),
  "%s/incompatible format test", op->name);
  
+/* Test for the regression which happened when

+ * GL_TEXTURE_BUFFER was allowed to have incompatible format.
+ */

FTR, did you confirm whether this test-case causes a crash after
re-applying the mesa patch that led to the regression?

Thanks.
This test-case doesn't crash with that patch. I picked the first format 
from the array
(same as the other tests) which appears to be GL_RGBA32F, but 
unfortunately it's a
format with which we cannot go out of bounds. Picking the format which 
will result in crash
would be better (already tested and crash occurred). I'll do this in my 
hopefully final version of the patch.


Thank you for reviewing these embarrassing patches.

+subtest(, true,
+run_test(op, def_img_buffer, def_img_buffer,
+ invalidate_incompatible_format, false),
+"%s/incompatible format test/image%s",
+op->name, def_img_buffer.target->name);
+
  /*
   * " * the texture bound to the image unit has layers,
   * and the selected layer or cube map face doesn't
--
2.17.1


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


[Piglit] [PATCH v2] arb_shader_image_load_store: Test format incompatible texture buffer

2018-07-19 Thread Danylo Piliaiev
Test for the regression which happened when GL_TEXTURE_BUFFER was
allowed to have incompatible format.

v2: Removed unnecessary code duplication - use upload_image instead
 of init_level. (Francisco Jerez)

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

Signed-off-by: Danylo Piliaiev 
---
 .../arb_shader_image_load_store/invalid.c | 23 +++
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/tests/spec/arb_shader_image_load_store/invalid.c 
b/tests/spec/arb_shader_image_load_store/invalid.c
index ed4b6c064..99f6703a4 100644
--- a/tests/spec/arb_shader_image_load_store/invalid.c
+++ b/tests/spec/arb_shader_image_load_store/invalid.c
@@ -266,13 +266,17 @@ static bool
 invalidate_incompatible_format(const struct image_info img, GLuint prog)
 {
 GLenum base_format = image_base_internal_format(img.format);
+uint32_t pixels[4 * N];
+init_pixels(img, pixels, 1, 1, 1, 1);
+
+/* upload_image instead of init_level to support GL_TEXTURE_BUFFER */
+bool ret = upload_image(img, 0, pixels);
+
 /* Pick an incompatible texture format with a compatible base
  * type. */
-bool ret = init_level(img, 0, (base_format == GL_RGBA32F ?
-   GL_RGBA8 : GL_RG32UI), W, H);
-
 glBindImageTexture(0, get_texture(0), 0, GL_TRUE, 0,
-   GL_READ_WRITE, img.format->format);
+   GL_READ_WRITE, (base_format == GL_RGBA32F ?
+   GL_RGBA8 : GL_RG32UI));
 
 return ret && piglit_check_gl_error(GL_NO_ERROR);
 }
@@ -346,6 +350,8 @@ piglit_init(int argc, char **argv)
 for (op = image_ops; op->name; ++op) {
 const struct image_info def_img = image_info(
 GL_TEXTURE_2D, op->formats[0].format, W, H);
+const struct image_info def_img_buffer = image_info(
+GL_TEXTURE_BUFFER, op->formats[0].format, W, H);
 
 /*
  * According to the spec, an access is considered
@@ -399,6 +405,15 @@ piglit_init(int argc, char **argv)
  invalidate_incompatible_format, false),
 "%s/incompatible format test", op->name);
 
+/* Test for the regression which happened when
+ * GL_TEXTURE_BUFFER was allowed to have incompatible format.
+ */
+subtest(, true,
+run_test(op, def_img_buffer, def_img_buffer,
+ invalidate_incompatible_format, false),
+"%s/incompatible format test/image%s",
+op->name, def_img_buffer.target->name);
+
 /*
  * " * the texture bound to the image unit has layers,
  * and the selected layer or cube map face doesn't
-- 
2.17.1

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


Re: [Piglit] [PATCH] arb_shader_image_load_store: Test format incompatible texture buffer

2018-07-19 Thread Danylo Piliaiev



On 18.07.18 22:08, Francisco Jerez wrote:

Danylo Piliaiev  writes:


On 18.07.18 00:01, Francisco Jerez wrote:

Danylo Piliaiev  writes:


Test for the regression which happened when GL_TEXTURE_BUFFER was
allowed to have incompatible format.

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

Signed-off-by: Danylo Piliaiev 
---
   .../arb_shader_image_load_store/invalid.c | 54 +--
   1 file changed, 49 insertions(+), 5 deletions(-)

diff --git a/tests/spec/arb_shader_image_load_store/invalid.c 
b/tests/spec/arb_shader_image_load_store/invalid.c
index ed4b6c064..adab56ffc 100644
--- a/tests/spec/arb_shader_image_load_store/invalid.c
+++ b/tests/spec/arb_shader_image_load_store/invalid.c
@@ -172,12 +172,45 @@ init_level(const struct image_info img, unsigned level,
  GLenum format, unsigned w, unsigned h)
   {
   uint32_t pixels[4 * N];
-
   init_pixels(img, pixels, 1, 1, 1, 1);
-glBindTexture(GL_TEXTURE_2D, get_texture(0));
-glTexImage2D(GL_TEXTURE_2D, level, format,
- w, h, 0, img.format->pixel_format,
- image_base_type(img.format), pixels);
+
+glBindTexture(img.target->target, get_texture(0));
+
+switch (img.target->target) {
+case GL_TEXTURE_2D: {
+glTexImage2D(GL_TEXTURE_2D, level, format,
+w, h, 0, img.format->pixel_format,
+image_base_type(img.format), pixels);
+break;
+}
+case GL_TEXTURE_BUFFER: {
+const struct image_extent grid = 
image_optimal_extent(img.size);
+GLuint packed_tex;
+
+assert(level == 0);
+
+glBindBuffer(GL_PIXEL_PACK_BUFFER, get_buffer(0));
+glBufferData(GL_PIXEL_PACK_BUFFER,
+ img.size.x * image_pixel_size(img.format) / 8,
+ NULL, GL_STATIC_DRAW);
+
+glGenTextures(1, _tex);
+glBindTexture(GL_TEXTURE_2D, packed_tex);
+
+glTexImage2D(GL_TEXTURE_2D, 0, format,
+ grid.x, grid.y, 0, img.format->pixel_format,
+ image_base_type(img.format), pixels);
+glGetTexImage(GL_TEXTURE_2D, 0, img.format->pixel_format,
+  img.format->pixel_type, NULL);
+glDeleteTextures(1, _tex);
+glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
+
+glTexBuffer(GL_TEXTURE_BUFFER, format, get_buffer(0));
+break;

Can't you call upload_image() instead of reimplementing these hacks here
in order to pack the pixels into a PBO?  Texture buffers only have one
level anyway so it shouldn't hurt to recreate the whole texture.


I cannot use upload_image() from common.c as is since there is a subtle
difference:
I need to pass custom internalFormat to glTexImage2D which is the point
of this test
(same reason init_level existed before).
But yes, it looks like code duplication, an alternative is to extend
upload_image_levels()
which also doesn't look good for me.

I believe that for this purpose you could possibly reuse upload_image()
as-is, but change invalidate_incompatible_format() *not* to call
upload_level() and instead call glBindImageTexture() with the
incompatible format.

Indeed, now I see it, thanks!

+}
+default:
+abort();
+}
   
   return piglit_check_gl_error(GL_NO_ERROR);

   }
@@ -346,6 +379,8 @@ piglit_init(int argc, char **argv)
   for (op = image_ops; op->name; ++op) {
   const struct image_info def_img = image_info(
   GL_TEXTURE_2D, op->formats[0].format, W, H);
+const struct image_info def_img_buffer = image_info(
+GL_TEXTURE_BUFFER, op->formats[0].format, W, H);
   
   /*

* According to the spec, an access is considered
@@ -399,6 +434,15 @@ piglit_init(int argc, char **argv)
invalidate_incompatible_format, false),
   "%s/incompatible format test", op->name);
   
+/* Test for the regression which happened when

+ * GL_TEXTURE_BUFFER was allowed to have incompatible format.
+ */
+subtest(, true,
+run_test(op, def_img_buffer, def_img_buffer,
+ invalidate_incompatible_format, false),
+"%s/incompatible format test/image%s",
+op->name, def_img_buffer.target->name);
+
   /*
* " * the texture bound to the image unit has layers,
* and the selected layer or cube map face doesn't
--
2.17.1


__

Re: [Piglit] [PATCH] arb_shader_image_load_store: Test format incompatible texture buffer

2018-07-18 Thread Danylo Piliaiev



On 18.07.18 00:01, Francisco Jerez wrote:

Danylo Piliaiev  writes:


Test for the regression which happened when GL_TEXTURE_BUFFER was
allowed to have incompatible format.

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

Signed-off-by: Danylo Piliaiev 
---
  .../arb_shader_image_load_store/invalid.c | 54 +--
  1 file changed, 49 insertions(+), 5 deletions(-)

diff --git a/tests/spec/arb_shader_image_load_store/invalid.c 
b/tests/spec/arb_shader_image_load_store/invalid.c
index ed4b6c064..adab56ffc 100644
--- a/tests/spec/arb_shader_image_load_store/invalid.c
+++ b/tests/spec/arb_shader_image_load_store/invalid.c
@@ -172,12 +172,45 @@ init_level(const struct image_info img, unsigned level,
 GLenum format, unsigned w, unsigned h)
  {
  uint32_t pixels[4 * N];
-
  init_pixels(img, pixels, 1, 1, 1, 1);
-glBindTexture(GL_TEXTURE_2D, get_texture(0));
-glTexImage2D(GL_TEXTURE_2D, level, format,
- w, h, 0, img.format->pixel_format,
- image_base_type(img.format), pixels);
+
+glBindTexture(img.target->target, get_texture(0));
+
+switch (img.target->target) {
+case GL_TEXTURE_2D: {
+glTexImage2D(GL_TEXTURE_2D, level, format,
+w, h, 0, img.format->pixel_format,
+image_base_type(img.format), pixels);
+break;
+}
+case GL_TEXTURE_BUFFER: {
+const struct image_extent grid = 
image_optimal_extent(img.size);
+GLuint packed_tex;
+
+assert(level == 0);
+
+glBindBuffer(GL_PIXEL_PACK_BUFFER, get_buffer(0));
+glBufferData(GL_PIXEL_PACK_BUFFER,
+ img.size.x * image_pixel_size(img.format) / 8,
+ NULL, GL_STATIC_DRAW);
+
+glGenTextures(1, _tex);
+glBindTexture(GL_TEXTURE_2D, packed_tex);
+
+glTexImage2D(GL_TEXTURE_2D, 0, format,
+ grid.x, grid.y, 0, img.format->pixel_format,
+ image_base_type(img.format), pixels);
+glGetTexImage(GL_TEXTURE_2D, 0, img.format->pixel_format,
+  img.format->pixel_type, NULL);
+glDeleteTextures(1, _tex);
+glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
+
+glTexBuffer(GL_TEXTURE_BUFFER, format, get_buffer(0));
+break;

Can't you call upload_image() instead of reimplementing these hacks here
in order to pack the pixels into a PBO?  Texture buffers only have one
level anyway so it shouldn't hurt to recreate the whole texture.

I cannot use upload_image() from common.c as is since there is a subtle 
difference:
I need to pass custom internalFormat to glTexImage2D which is the point 
of this test

(same reason init_level existed before).
But yes, it looks like code duplication, an alternative is to extend 
upload_image_levels()

which also doesn't look good for me.

+}
+default:
+abort();
+}
  
  return piglit_check_gl_error(GL_NO_ERROR);

  }
@@ -346,6 +379,8 @@ piglit_init(int argc, char **argv)
  for (op = image_ops; op->name; ++op) {
  const struct image_info def_img = image_info(
  GL_TEXTURE_2D, op->formats[0].format, W, H);
+const struct image_info def_img_buffer = image_info(
+GL_TEXTURE_BUFFER, op->formats[0].format, W, H);
  
  /*

   * According to the spec, an access is considered
@@ -399,6 +434,15 @@ piglit_init(int argc, char **argv)
   invalidate_incompatible_format, false),
  "%s/incompatible format test", op->name);
  
+/* Test for the regression which happened when

+ * GL_TEXTURE_BUFFER was allowed to have incompatible format.
+ */
+subtest(, true,
+run_test(op, def_img_buffer, def_img_buffer,
+ invalidate_incompatible_format, false),
+"%s/incompatible format test/image%s",
+op->name, def_img_buffer.target->name);
+
  /*
   * " * the texture bound to the image unit has layers,
   * and the selected layer or cube map face doesn't
--
2.17.1


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


[Piglit] [PATCH] arb_shader_image_load_store: Test format incompatible texture buffer

2018-07-17 Thread Danylo Piliaiev
Test for the regression which happened when GL_TEXTURE_BUFFER was
allowed to have incompatible format.

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

Signed-off-by: Danylo Piliaiev 
---
 .../arb_shader_image_load_store/invalid.c | 54 +--
 1 file changed, 49 insertions(+), 5 deletions(-)

diff --git a/tests/spec/arb_shader_image_load_store/invalid.c 
b/tests/spec/arb_shader_image_load_store/invalid.c
index ed4b6c064..adab56ffc 100644
--- a/tests/spec/arb_shader_image_load_store/invalid.c
+++ b/tests/spec/arb_shader_image_load_store/invalid.c
@@ -172,12 +172,45 @@ init_level(const struct image_info img, unsigned level,
GLenum format, unsigned w, unsigned h)
 {
 uint32_t pixels[4 * N];
-
 init_pixels(img, pixels, 1, 1, 1, 1);
-glBindTexture(GL_TEXTURE_2D, get_texture(0));
-glTexImage2D(GL_TEXTURE_2D, level, format,
- w, h, 0, img.format->pixel_format,
- image_base_type(img.format), pixels);
+
+glBindTexture(img.target->target, get_texture(0));
+
+switch (img.target->target) {
+case GL_TEXTURE_2D: {
+glTexImage2D(GL_TEXTURE_2D, level, format,
+w, h, 0, img.format->pixel_format,
+image_base_type(img.format), pixels);
+break;
+}
+case GL_TEXTURE_BUFFER: {
+const struct image_extent grid = 
image_optimal_extent(img.size);
+GLuint packed_tex;
+
+assert(level == 0);
+
+glBindBuffer(GL_PIXEL_PACK_BUFFER, get_buffer(0));
+glBufferData(GL_PIXEL_PACK_BUFFER,
+ img.size.x * image_pixel_size(img.format) / 8,
+ NULL, GL_STATIC_DRAW);
+
+glGenTextures(1, _tex);
+glBindTexture(GL_TEXTURE_2D, packed_tex);
+
+glTexImage2D(GL_TEXTURE_2D, 0, format,
+ grid.x, grid.y, 0, img.format->pixel_format,
+ image_base_type(img.format), pixels);
+glGetTexImage(GL_TEXTURE_2D, 0, img.format->pixel_format,
+  img.format->pixel_type, NULL);
+glDeleteTextures(1, _tex);
+glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
+
+glTexBuffer(GL_TEXTURE_BUFFER, format, get_buffer(0));
+break;
+}
+default:
+abort();
+}
 
 return piglit_check_gl_error(GL_NO_ERROR);
 }
@@ -346,6 +379,8 @@ piglit_init(int argc, char **argv)
 for (op = image_ops; op->name; ++op) {
 const struct image_info def_img = image_info(
 GL_TEXTURE_2D, op->formats[0].format, W, H);
+const struct image_info def_img_buffer = image_info(
+GL_TEXTURE_BUFFER, op->formats[0].format, W, H);
 
 /*
  * According to the spec, an access is considered
@@ -399,6 +434,15 @@ piglit_init(int argc, char **argv)
  invalidate_incompatible_format, false),
 "%s/incompatible format test", op->name);
 
+/* Test for the regression which happened when
+ * GL_TEXTURE_BUFFER was allowed to have incompatible format.
+ */
+subtest(, true,
+run_test(op, def_img_buffer, def_img_buffer,
+ invalidate_incompatible_format, false),
+"%s/incompatible format test/image%s",
+op->name, def_img_buffer.target->name);
+
 /*
  * " * the texture bound to the image unit has layers,
  * and the selected layer or cube map face doesn't
-- 
2.17.1

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


[Piglit] [PATCH v3] arb_blend_func_extended: Test dual src blending without second color output

2018-07-09 Thread Danylo Piliaiev
Using fragment shader without second color output should not hang gpu
when dual source blending is enabled.
It hanged Intel gen8+ GPUs when discarding fragments and depth test
being enabled.
There is also safeguard against lack of second color output in radeonsi.

v2: by Ilia Mirkin
- Set supports_gl_compat_version = 30
- Moved drawing to piglit_display
- Change drawing sequence to: clear red -> draw -> clear green

v3: by Dylan Baker
- Removed run_concurrent=False

Signed-off-by: Danylo Piliaiev 
---
 tests/opengl.py   |   2 +
 .../execution/CMakeLists.gl.txt   |   1 +
 .../execution/CMakeLists.gles3.txt|   1 +
 .../dual-src-blending-discard-without-src1.c  | 126 ++
 4 files changed, 130 insertions(+)
 create mode 100644 
tests/spec/arb_blend_func_extended/execution/dual-src-blending-discard-without-src1.c

diff --git a/tests/opengl.py b/tests/opengl.py
index 02110ff86..1b088b75f 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -4114,6 +4114,7 @@ with profile.test_list.group_manager(
 g(['arb_blend_func_extended-fbo-extended-blend'])
 g(['arb_blend_func_extended-fbo-extended-blend-explicit'])
 g(['arb_blend_func_extended-fbo-extended-blend-pattern'])
+g(['arb_blend_func_extended-dual-src-blending-discard-without-src1'])
 g(['arb_blend_func_extended-blend-api_gles2'])
 g(['arb_blend_func_extended-builtins_gles2'])
 g(['arb_blend_func_extended-bindfragdataindexed-invalid-parameters_gles3'])
@@ -4123,6 +4124,7 @@ with profile.test_list.group_manager(
 g(['arb_blend_func_extended-fbo-extended-blend-pattern_gles3'])
 g(['arb_blend_func_extended-fbo-extended-blend_gles3'])
 g(['arb_blend_func_extended-fbo-extended-blend-explicit_gles3'])
+g(['arb_blend_func_extended-dual-src-blending-discard-without-src1_gles3'])
 
 with profile.test_list.group_manager(
 PiglitGLTest,
diff --git a/tests/spec/arb_blend_func_extended/execution/CMakeLists.gl.txt 
b/tests/spec/arb_blend_func_extended/execution/CMakeLists.gl.txt
index f48c352e1..09d45b72c 100644
--- a/tests/spec/arb_blend_func_extended/execution/CMakeLists.gl.txt
+++ b/tests/spec/arb_blend_func_extended/execution/CMakeLists.gl.txt
@@ -12,4 +12,5 @@ link_libraries (
 piglit_add_executable (arb_blend_func_extended-fbo-extended-blend 
fbo-extended-blend.c)
 piglit_add_executable (arb_blend_func_extended-fbo-extended-blend-explicit 
fbo-extended-blend-explicit.c)
 piglit_add_executable (arb_blend_func_extended-fbo-extended-blend-pattern 
fbo-extended-blend-pattern.c)
+piglit_add_executable 
(arb_blend_func_extended-dual-src-blending-discard-without-src1 
dual-src-blending-discard-without-src1.c)
 # vim: ft=cmake:
diff --git a/tests/spec/arb_blend_func_extended/execution/CMakeLists.gles3.txt 
b/tests/spec/arb_blend_func_extended/execution/CMakeLists.gles3.txt
index a70e9fa5e..fd41622bd 100644
--- a/tests/spec/arb_blend_func_extended/execution/CMakeLists.gles3.txt
+++ b/tests/spec/arb_blend_func_extended/execution/CMakeLists.gles3.txt
@@ -3,4 +3,5 @@ link_libraries(piglitutil_${piglit_target_api})
 piglit_add_executable 
(arb_blend_func_extended-fbo-extended-blend_${piglit_target_api} 
fbo-extended-blend.c)
 piglit_add_executable 
(arb_blend_func_extended-fbo-extended-blend-explicit_${piglit_target_api} 
fbo-extended-blend-explicit.c)
 piglit_add_executable 
(arb_blend_func_extended-fbo-extended-blend-pattern_${piglit_target_api} 
fbo-extended-blend-pattern.c)
+piglit_add_executable 
(arb_blend_func_extended-dual-src-blending-discard-without-src1_${piglit_target_api}
 dual-src-blending-discard-without-src1.c)
 # vim: ft=cmake:
diff --git 
a/tests/spec/arb_blend_func_extended/execution/dual-src-blending-discard-without-src1.c
 
b/tests/spec/arb_blend_func_extended/execution/dual-src-blending-discard-without-src1.c
new file mode 100644
index 0..a0a45cd79
--- /dev/null
+++ 
b/tests/spec/arb_blend_func_extended/execution/dual-src-blending-discard-without-src1.c
@@ -0,0 +1,126 @@
+/* Copyright © 2018 Danylo Piliaiev
+ *
+ * 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

[Piglit] [PATCH v2] arb_blend_func_extended: Test dual src blending without second color output

2018-07-06 Thread Danylo Piliaiev
Using fragment shader without second color output should not hang gpu
when dual source blending is enabled.
It hanged Intel gen8+ GPUs when discarding fragments and depth test
being enabled.
There is also safeguard against lack of second color output in radeonsi.

v2: by Ilia Mirkin
- Set supports_gl_compat_version = 30
- Moved drawing to piglit_display
- Change drawing sequence to: clear red -> draw -> clear green

Signed-off-by: Danylo Piliaiev 
---
 tests/opengl.py   |   2 +
 .../execution/CMakeLists.gl.txt   |   1 +
 .../execution/CMakeLists.gles3.txt|   1 +
 .../dual-src-blending-discard-without-src1.c  | 126 ++
 4 files changed, 130 insertions(+)
 create mode 100644 
tests/spec/arb_blend_func_extended/execution/dual-src-blending-discard-without-src1.c

diff --git a/tests/opengl.py b/tests/opengl.py
index 02110ff86..61aa197b7 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -4114,6 +4114,7 @@ with profile.test_list.group_manager(
 g(['arb_blend_func_extended-fbo-extended-blend'])
 g(['arb_blend_func_extended-fbo-extended-blend-explicit'])
 g(['arb_blend_func_extended-fbo-extended-blend-pattern'])
+g(['arb_blend_func_extended-dual-src-blending-discard-without-src1'], 
run_concurrent=False)
 g(['arb_blend_func_extended-blend-api_gles2'])
 g(['arb_blend_func_extended-builtins_gles2'])
 g(['arb_blend_func_extended-bindfragdataindexed-invalid-parameters_gles3'])
@@ -4123,6 +4124,7 @@ with profile.test_list.group_manager(
 g(['arb_blend_func_extended-fbo-extended-blend-pattern_gles3'])
 g(['arb_blend_func_extended-fbo-extended-blend_gles3'])
 g(['arb_blend_func_extended-fbo-extended-blend-explicit_gles3'])
+
g(['arb_blend_func_extended-dual-src-blending-discard-without-src1_gles3'], 
run_concurrent=False)
 
 with profile.test_list.group_manager(
 PiglitGLTest,
diff --git a/tests/spec/arb_blend_func_extended/execution/CMakeLists.gl.txt 
b/tests/spec/arb_blend_func_extended/execution/CMakeLists.gl.txt
index f48c352e1..09d45b72c 100644
--- a/tests/spec/arb_blend_func_extended/execution/CMakeLists.gl.txt
+++ b/tests/spec/arb_blend_func_extended/execution/CMakeLists.gl.txt
@@ -12,4 +12,5 @@ link_libraries (
 piglit_add_executable (arb_blend_func_extended-fbo-extended-blend 
fbo-extended-blend.c)
 piglit_add_executable (arb_blend_func_extended-fbo-extended-blend-explicit 
fbo-extended-blend-explicit.c)
 piglit_add_executable (arb_blend_func_extended-fbo-extended-blend-pattern 
fbo-extended-blend-pattern.c)
+piglit_add_executable 
(arb_blend_func_extended-dual-src-blending-discard-without-src1 
dual-src-blending-discard-without-src1.c)
 # vim: ft=cmake:
diff --git a/tests/spec/arb_blend_func_extended/execution/CMakeLists.gles3.txt 
b/tests/spec/arb_blend_func_extended/execution/CMakeLists.gles3.txt
index a70e9fa5e..fd41622bd 100644
--- a/tests/spec/arb_blend_func_extended/execution/CMakeLists.gles3.txt
+++ b/tests/spec/arb_blend_func_extended/execution/CMakeLists.gles3.txt
@@ -3,4 +3,5 @@ link_libraries(piglitutil_${piglit_target_api})
 piglit_add_executable 
(arb_blend_func_extended-fbo-extended-blend_${piglit_target_api} 
fbo-extended-blend.c)
 piglit_add_executable 
(arb_blend_func_extended-fbo-extended-blend-explicit_${piglit_target_api} 
fbo-extended-blend-explicit.c)
 piglit_add_executable 
(arb_blend_func_extended-fbo-extended-blend-pattern_${piglit_target_api} 
fbo-extended-blend-pattern.c)
+piglit_add_executable 
(arb_blend_func_extended-dual-src-blending-discard-without-src1_${piglit_target_api}
 dual-src-blending-discard-without-src1.c)
 # vim: ft=cmake:
diff --git 
a/tests/spec/arb_blend_func_extended/execution/dual-src-blending-discard-without-src1.c
 
b/tests/spec/arb_blend_func_extended/execution/dual-src-blending-discard-without-src1.c
new file mode 100644
index 0..a0a45cd79
--- /dev/null
+++ 
b/tests/spec/arb_blend_func_extended/execution/dual-src-blending-discard-without-src1.c
@@ -0,0 +1,126 @@
+/* Copyright © 2018 Danylo Piliaiev
+ *
+ * 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 HOLDE

Re: [Piglit] [PATCH] arb_blend_func_extended: Test dual src blending without second color output

2018-07-06 Thread Danylo Piliaiev

Thank you for the feedback, I'll send fixed version soon.


On 06.07.18 16:48, Ilia Mirkin wrote:

On Fri, Jul 6, 2018 at 4:51 AM, Danylo Piliaiev
 wrote:

Using fragment shader without second color output should not hang gpu
when dual source blending is enabled.
It hanged Intel gen8+ GPUs when discarding fragments and depth test
being enabled.
There is also safeguard against lack of second color output in radeonsi.

Signed-off-by: Danylo Piliaiev 
---
To not hang hang on Intel gen8+ GPUs this patch depends on
https://patchwork.freedesktop.org/patch/235939/
The hang itself is around 2 - 5 seconds and test produces FAIL.

  tests/opengl.py   |   2 +
  .../execution/CMakeLists.gl.txt   |   1 +
  .../execution/CMakeLists.gles3.txt|   1 +
  .../dual-src-blending-discard-without-src1.c  | 120 ++
  4 files changed, 124 insertions(+)
  create mode 100644 
tests/spec/arb_blend_func_extended/execution/dual-src-blending-discard-without-src1.c

diff --git a/tests/opengl.py b/tests/opengl.py
index 02110ff86..61aa197b7 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -4114,6 +4114,7 @@ with profile.test_list.group_manager(
  g(['arb_blend_func_extended-fbo-extended-blend'])
  g(['arb_blend_func_extended-fbo-extended-blend-explicit'])
  g(['arb_blend_func_extended-fbo-extended-blend-pattern'])
+g(['arb_blend_func_extended-dual-src-blending-discard-without-src1'], 
run_concurrent=False)

Why run_concurrent=False?
I set it because this test may hang which can affect other tests but if 
it won't an issue I can remove it.



  g(['arb_blend_func_extended-blend-api_gles2'])
  g(['arb_blend_func_extended-builtins_gles2'])
  
g(['arb_blend_func_extended-bindfragdataindexed-invalid-parameters_gles3'])
@@ -4123,6 +4124,7 @@ with profile.test_list.group_manager(
  g(['arb_blend_func_extended-fbo-extended-blend-pattern_gles3'])
  g(['arb_blend_func_extended-fbo-extended-blend_gles3'])
  g(['arb_blend_func_extended-fbo-extended-blend-explicit_gles3'])
+
g(['arb_blend_func_extended-dual-src-blending-discard-without-src1_gles3'], 
run_concurrent=False)

  with profile.test_list.group_manager(
  PiglitGLTest,
diff --git a/tests/spec/arb_blend_func_extended/execution/CMakeLists.gl.txt 
b/tests/spec/arb_blend_func_extended/execution/CMakeLists.gl.txt
index f48c352e1..09d45b72c 100644
--- a/tests/spec/arb_blend_func_extended/execution/CMakeLists.gl.txt
+++ b/tests/spec/arb_blend_func_extended/execution/CMakeLists.gl.txt
@@ -12,4 +12,5 @@ link_libraries (
  piglit_add_executable (arb_blend_func_extended-fbo-extended-blend 
fbo-extended-blend.c)
  piglit_add_executable (arb_blend_func_extended-fbo-extended-blend-explicit 
fbo-extended-blend-explicit.c)
  piglit_add_executable (arb_blend_func_extended-fbo-extended-blend-pattern 
fbo-extended-blend-pattern.c)
+piglit_add_executable 
(arb_blend_func_extended-dual-src-blending-discard-without-src1 
dual-src-blending-discard-without-src1.c)
  # vim: ft=cmake:
diff --git a/tests/spec/arb_blend_func_extended/execution/CMakeLists.gles3.txt 
b/tests/spec/arb_blend_func_extended/execution/CMakeLists.gles3.txt
index a70e9fa5e..fd41622bd 100644
--- a/tests/spec/arb_blend_func_extended/execution/CMakeLists.gles3.txt
+++ b/tests/spec/arb_blend_func_extended/execution/CMakeLists.gles3.txt
@@ -3,4 +3,5 @@ link_libraries(piglitutil_${piglit_target_api})
  piglit_add_executable 
(arb_blend_func_extended-fbo-extended-blend_${piglit_target_api} 
fbo-extended-blend.c)
  piglit_add_executable 
(arb_blend_func_extended-fbo-extended-blend-explicit_${piglit_target_api} 
fbo-extended-blend-explicit.c)
  piglit_add_executable 
(arb_blend_func_extended-fbo-extended-blend-pattern_${piglit_target_api} 
fbo-extended-blend-pattern.c)
+piglit_add_executable 
(arb_blend_func_extended-dual-src-blending-discard-without-src1_${piglit_target_api}
 dual-src-blending-discard-without-src1.c)
  # vim: ft=cmake:
diff --git 
a/tests/spec/arb_blend_func_extended/execution/dual-src-blending-discard-without-src1.c
 
b/tests/spec/arb_blend_func_extended/execution/dual-src-blending-discard-without-src1.c
new file mode 100644
index 0..881a21421
--- /dev/null
+++ 
b/tests/spec/arb_blend_func_extended/execution/dual-src-blending-discard-without-src1.c
@@ -0,0 +1,120 @@
+/* Copyright © 2018 Danylo Piliaiev
+ *
+ * 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 substantia

[Piglit] [PATCH] arb_blend_func_extended: Test dual src blending without second color output

2018-07-06 Thread Danylo Piliaiev
Using fragment shader without second color output should not hang gpu
when dual source blending is enabled.
It hanged Intel gen8+ GPUs when discarding fragments and depth test
being enabled.
There is also safeguard against lack of second color output in radeonsi.

Signed-off-by: Danylo Piliaiev 
---
To not hang hang on Intel gen8+ GPUs this patch depends on
https://patchwork.freedesktop.org/patch/235939/
The hang itself is around 2 - 5 seconds and test produces FAIL.

 tests/opengl.py   |   2 +
 .../execution/CMakeLists.gl.txt   |   1 +
 .../execution/CMakeLists.gles3.txt|   1 +
 .../dual-src-blending-discard-without-src1.c  | 120 ++
 4 files changed, 124 insertions(+)
 create mode 100644 
tests/spec/arb_blend_func_extended/execution/dual-src-blending-discard-without-src1.c

diff --git a/tests/opengl.py b/tests/opengl.py
index 02110ff86..61aa197b7 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -4114,6 +4114,7 @@ with profile.test_list.group_manager(
 g(['arb_blend_func_extended-fbo-extended-blend'])
 g(['arb_blend_func_extended-fbo-extended-blend-explicit'])
 g(['arb_blend_func_extended-fbo-extended-blend-pattern'])
+g(['arb_blend_func_extended-dual-src-blending-discard-without-src1'], 
run_concurrent=False)
 g(['arb_blend_func_extended-blend-api_gles2'])
 g(['arb_blend_func_extended-builtins_gles2'])
 g(['arb_blend_func_extended-bindfragdataindexed-invalid-parameters_gles3'])
@@ -4123,6 +4124,7 @@ with profile.test_list.group_manager(
 g(['arb_blend_func_extended-fbo-extended-blend-pattern_gles3'])
 g(['arb_blend_func_extended-fbo-extended-blend_gles3'])
 g(['arb_blend_func_extended-fbo-extended-blend-explicit_gles3'])
+
g(['arb_blend_func_extended-dual-src-blending-discard-without-src1_gles3'], 
run_concurrent=False)
 
 with profile.test_list.group_manager(
 PiglitGLTest,
diff --git a/tests/spec/arb_blend_func_extended/execution/CMakeLists.gl.txt 
b/tests/spec/arb_blend_func_extended/execution/CMakeLists.gl.txt
index f48c352e1..09d45b72c 100644
--- a/tests/spec/arb_blend_func_extended/execution/CMakeLists.gl.txt
+++ b/tests/spec/arb_blend_func_extended/execution/CMakeLists.gl.txt
@@ -12,4 +12,5 @@ link_libraries (
 piglit_add_executable (arb_blend_func_extended-fbo-extended-blend 
fbo-extended-blend.c)
 piglit_add_executable (arb_blend_func_extended-fbo-extended-blend-explicit 
fbo-extended-blend-explicit.c)
 piglit_add_executable (arb_blend_func_extended-fbo-extended-blend-pattern 
fbo-extended-blend-pattern.c)
+piglit_add_executable 
(arb_blend_func_extended-dual-src-blending-discard-without-src1 
dual-src-blending-discard-without-src1.c)
 # vim: ft=cmake:
diff --git a/tests/spec/arb_blend_func_extended/execution/CMakeLists.gles3.txt 
b/tests/spec/arb_blend_func_extended/execution/CMakeLists.gles3.txt
index a70e9fa5e..fd41622bd 100644
--- a/tests/spec/arb_blend_func_extended/execution/CMakeLists.gles3.txt
+++ b/tests/spec/arb_blend_func_extended/execution/CMakeLists.gles3.txt
@@ -3,4 +3,5 @@ link_libraries(piglitutil_${piglit_target_api})
 piglit_add_executable 
(arb_blend_func_extended-fbo-extended-blend_${piglit_target_api} 
fbo-extended-blend.c)
 piglit_add_executable 
(arb_blend_func_extended-fbo-extended-blend-explicit_${piglit_target_api} 
fbo-extended-blend-explicit.c)
 piglit_add_executable 
(arb_blend_func_extended-fbo-extended-blend-pattern_${piglit_target_api} 
fbo-extended-blend-pattern.c)
+piglit_add_executable 
(arb_blend_func_extended-dual-src-blending-discard-without-src1_${piglit_target_api}
 dual-src-blending-discard-without-src1.c)
 # vim: ft=cmake:
diff --git 
a/tests/spec/arb_blend_func_extended/execution/dual-src-blending-discard-without-src1.c
 
b/tests/spec/arb_blend_func_extended/execution/dual-src-blending-discard-without-src1.c
new file mode 100644
index 0..881a21421
--- /dev/null
+++ 
b/tests/spec/arb_blend_func_extended/execution/dual-src-blending-discard-without-src1.c
@@ -0,0 +1,120 @@
+/* Copyright © 2018 Danylo Piliaiev
+ *
+ * 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 

Re: [Piglit] [PATCH v2] arb_provoking_vertex: Test flat shading with clipped geometry

2018-06-14 Thread danylo
I took a second look at 'clipflat' test and it doesn't test edge case in 
question. 'clipflat' test doesn't fail on i965/gen9 while my test fails 
(and passes on Radeon/sw), the difference is the necessity for my test 
to have at least three vertices out of screen which have distinct color 
from vertices left on screen.


-Danil

On 14.06.18 15:35, Brian Paul wrote:
Does this test do anything that isn't already done by the existing 
clipflat.c test?


-Brian

On 06/14/2018 03:41 AM, Danylo Piliaiev wrote:

There is a hardware bug in i965/gen9+ with provoking vertices.
Test if workaround works correctly.

Ref: 
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugs.freedesktop.org%2Fshow_bug.cgi%3Fid%3D103047=02%7C01%7Cbrianp%40vmware.com%7Cf6ec4bfb4928411d446708d5d1db05bf%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C1%7C1%7C636645660990175348=1XPX5QNMBxDkNPHQnH9ydaq5NjCqBdDmWId5pl0vnb8%3D=0


v2: - Vertices now have distinctive color
 - Update  message to reflect a nature of the bug which was
   clarified by Kenneth. He will also provide workaround later.

Signed-off-by: Danylo Piliaiev 
---
  tests/opengl.py    |  1 +
  tests/spec/arb_provoking_vertex/CMakeLists.gl.txt  |  1 +
  .../clipped-geometry-flatshading.c | 81 
++

  3 files changed, 83 insertions(+)
  create mode 100644 
tests/spec/arb_provoking_vertex/clipped-geometry-flatshading.c


diff --git a/tests/opengl.py b/tests/opengl.py
index 3109a5e..313b22b 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -2205,6 +2205,7 @@ with profile.test_list.group_manager(
  g(['arb-provoking-vertex-control'], run_concurrent=False)
  g(['arb-provoking-vertex-initial'], run_concurrent=False)
  g(['arb-provoking-vertex-render'], run_concurrent=False)
+    g(['arb-provoking-vertex-clipped-geometry-flatshading'], 
run_concurrent=False)

  g(['arb-quads-follow-provoking-vertex'], run_concurrent=False)
  g(['arb-xfb-before-flatshading'], run_concurrent=False)
  diff --git a/tests/spec/arb_provoking_vertex/CMakeLists.gl.txt 
b/tests/spec/arb_provoking_vertex/CMakeLists.gl.txt

index 6dd15bb..3acffc6 100644
--- a/tests/spec/arb_provoking_vertex/CMakeLists.gl.txt
+++ b/tests/spec/arb_provoking_vertex/CMakeLists.gl.txt
@@ -11,6 +11,7 @@ link_libraries (
  piglit_add_executable (arb-provoking-vertex-control 
provoking-vertex-control.c)
  piglit_add_executable (arb-provoking-vertex-initial 
provoking-vertex-initial.c)

  piglit_add_executable (arb-provoking-vertex-render render.c)
+piglit_add_executable 
(arb-provoking-vertex-clipped-geometry-flatshading 
clipped-geometry-flatshading.c)
  piglit_add_executable (arb-quads-follow-provoking-vertex 
quads-follow-provoking-vertex.c)
  piglit_add_executable (arb-xfb-before-flatshading 
xfb-before-flatshading.c)
  diff --git 
a/tests/spec/arb_provoking_vertex/clipped-geometry-flatshading.c 
b/tests/spec/arb_provoking_vertex/clipped-geometry-flatshading.c

new file mode 100644
index 000..72acb4d
--- /dev/null
+++ b/tests/spec/arb_provoking_vertex/clipped-geometry-flatshading.c
@@ -0,0 +1,81 @@
+/*
+ * Copyright © 2018 Danylo Piliaiev
+ *
+ * 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 that provoking vertex works as expected when part of the 
geometry

+ * is clipped when flat shading is enabled.
+ *
+ * 
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugs.freedesktop.org%2Fshow_bug.cgi%3Fid%3D103047=02%7C01%7Cbrianp%40vmware.com%7Cf6ec4bfb4928411d446708d5d1db05bf%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C1%7C1%7C636645660990175348=1XPX5QNMBxDkNPHQnH9ydaq5NjCqBdDmWId5pl0vnb8%3D=0

+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+    config.supports_gl_compat_version = 10;
+    config.khr_no_error_support = PIGLIT_NO_ERRORS;
+PIGLIT_GL_TEST_CONFIG_END
+
+void
+pig

[Piglit] [PATCH v2] arb_provoking_vertex: Test flat shading with clipped geometry

2018-06-14 Thread Danylo Piliaiev
There is a hardware bug in i965/gen9+ with provoking vertices.
Test if workaround works correctly.

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

v2: - Vertices now have distinctive color
- Update  message to reflect a nature of the bug which was
  clarified by Kenneth. He will also provide workaround later.

Signed-off-by: Danylo Piliaiev 
---
 tests/opengl.py|  1 +
 tests/spec/arb_provoking_vertex/CMakeLists.gl.txt  |  1 +
 .../clipped-geometry-flatshading.c | 81 ++
 3 files changed, 83 insertions(+)
 create mode 100644 
tests/spec/arb_provoking_vertex/clipped-geometry-flatshading.c

diff --git a/tests/opengl.py b/tests/opengl.py
index 3109a5e..313b22b 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -2205,6 +2205,7 @@ with profile.test_list.group_manager(
 g(['arb-provoking-vertex-control'], run_concurrent=False)
 g(['arb-provoking-vertex-initial'], run_concurrent=False)
 g(['arb-provoking-vertex-render'], run_concurrent=False)
+g(['arb-provoking-vertex-clipped-geometry-flatshading'], 
run_concurrent=False)
 g(['arb-quads-follow-provoking-vertex'], run_concurrent=False)
 g(['arb-xfb-before-flatshading'], run_concurrent=False)
 
diff --git a/tests/spec/arb_provoking_vertex/CMakeLists.gl.txt 
b/tests/spec/arb_provoking_vertex/CMakeLists.gl.txt
index 6dd15bb..3acffc6 100644
--- a/tests/spec/arb_provoking_vertex/CMakeLists.gl.txt
+++ b/tests/spec/arb_provoking_vertex/CMakeLists.gl.txt
@@ -11,6 +11,7 @@ link_libraries (
 piglit_add_executable (arb-provoking-vertex-control provoking-vertex-control.c)
 piglit_add_executable (arb-provoking-vertex-initial provoking-vertex-initial.c)
 piglit_add_executable (arb-provoking-vertex-render render.c)
+piglit_add_executable (arb-provoking-vertex-clipped-geometry-flatshading 
clipped-geometry-flatshading.c)
 piglit_add_executable (arb-quads-follow-provoking-vertex 
quads-follow-provoking-vertex.c)
 piglit_add_executable (arb-xfb-before-flatshading xfb-before-flatshading.c)
 
diff --git a/tests/spec/arb_provoking_vertex/clipped-geometry-flatshading.c 
b/tests/spec/arb_provoking_vertex/clipped-geometry-flatshading.c
new file mode 100644
index 000..72acb4d
--- /dev/null
+++ b/tests/spec/arb_provoking_vertex/clipped-geometry-flatshading.c
@@ -0,0 +1,81 @@
+/*
+ * Copyright © 2018 Danylo Piliaiev
+ *
+ * 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 that provoking vertex works as expected when part of the geometry
+ * is clipped when flat shading is enabled.
+ *
+ * https://bugs.freedesktop.org/show_bug.cgi?id=103047
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 10;
+   config.khr_no_error_support = PIGLIT_NO_ERRORS;
+PIGLIT_GL_TEST_CONFIG_END
+
+void
+piglit_init(int argc, char **argv)
+{
+   piglit_require_extension("GL_EXT_provoking_vertex");
+   piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
+
+   glShadeModel(GL_FLAT);
+}
+
+enum piglit_result
+piglit_display(void)
+{
+   static const float red[3] = {1, 0, 0},
+   green[3] = {0, 1, 0},
+   blue[3] = {0, 0, 1},
+   yellow[3] = {1, 1, 0},
+   cyan[3] = {0, 1, 1};
+
+   bool pass = true;
+
+   glClear(GL_COLOR_BUFFER_BIT);
+   glProvokingVertexEXT(GL_LAST_VERTEX_CONVENTION_EXT);
+
+   const int y1 = piglit_height / 3;
+
+   glBegin(GL_TRIANGLE_STRIP);
+   glColor3fv(cyan);
+   glVertex3i(piglit_width + 1, y1, 0);
+   glColor3fv(yellow);
+   glVertex3i(piglit_width + 2, y1, 0);
+   glColor3fv(blue);
+   glVertex3i(piglit_width + 3, y1, 0);
+   glColor3fv(green);
+   glVertex3i(piglit_width / 2, y1 * 2, 0);
+   glC

[Piglit] [PATCH] arb_provoking_vertex: Test flat shading with clipped geometry

2018-06-13 Thread danylo . piliaiev
From: Danylo Piliaiev 

Clipper can mess up provoking vertex.
Ref: https://bugs.freedesktop.org/show_bug.cgi?id=103047

Signed-off-by: Danylo Piliaiev 
---
 tests/opengl.py|  1 +
 tests/spec/arb_provoking_vertex/CMakeLists.gl.txt  |  1 +
 .../clipped-geometry-flatshading.c | 78 ++
 3 files changed, 80 insertions(+)
 create mode 100644 
tests/spec/arb_provoking_vertex/clipped-geometry-flatshading.c

diff --git a/tests/opengl.py b/tests/opengl.py
index 3109a5e..313b22b 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -2205,6 +2205,7 @@ with profile.test_list.group_manager(
 g(['arb-provoking-vertex-control'], run_concurrent=False)
 g(['arb-provoking-vertex-initial'], run_concurrent=False)
 g(['arb-provoking-vertex-render'], run_concurrent=False)
+g(['arb-provoking-vertex-clipped-geometry-flatshading'], 
run_concurrent=False)
 g(['arb-quads-follow-provoking-vertex'], run_concurrent=False)
 g(['arb-xfb-before-flatshading'], run_concurrent=False)
 
diff --git a/tests/spec/arb_provoking_vertex/CMakeLists.gl.txt 
b/tests/spec/arb_provoking_vertex/CMakeLists.gl.txt
index 6dd15bb..3acffc6 100644
--- a/tests/spec/arb_provoking_vertex/CMakeLists.gl.txt
+++ b/tests/spec/arb_provoking_vertex/CMakeLists.gl.txt
@@ -11,6 +11,7 @@ link_libraries (
 piglit_add_executable (arb-provoking-vertex-control provoking-vertex-control.c)
 piglit_add_executable (arb-provoking-vertex-initial provoking-vertex-initial.c)
 piglit_add_executable (arb-provoking-vertex-render render.c)
+piglit_add_executable (arb-provoking-vertex-clipped-geometry-flatshading 
clipped-geometry-flatshading.c)
 piglit_add_executable (arb-quads-follow-provoking-vertex 
quads-follow-provoking-vertex.c)
 piglit_add_executable (arb-xfb-before-flatshading xfb-before-flatshading.c)
 
diff --git a/tests/spec/arb_provoking_vertex/clipped-geometry-flatshading.c 
b/tests/spec/arb_provoking_vertex/clipped-geometry-flatshading.c
new file mode 100644
index 000..97af48b
--- /dev/null
+++ b/tests/spec/arb_provoking_vertex/clipped-geometry-flatshading.c
@@ -0,0 +1,78 @@
+/*
+ * Copyright © 2018 Danylo Piliaiev
+ *
+ * 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 that provoking vertex works as expected when part of the geometry
+ * is clipped when flat shading is enabled.
+ *
+ * https://bugs.freedesktop.org/show_bug.cgi?id=103047
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 10;
+   config.khr_no_error_support = PIGLIT_NO_ERRORS;
+PIGLIT_GL_TEST_CONFIG_END
+
+void
+piglit_init(int argc, char **argv)
+{
+   piglit_require_extension("GL_EXT_provoking_vertex");
+   piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
+
+   glShadeModel(GL_FLAT);
+}
+
+enum piglit_result
+piglit_display(void)
+{
+   static const float red[3] = {1, 0, 0};
+   static const float green[3] = {0, 1, 0};
+
+   bool pass = true;
+
+   glClear(GL_COLOR_BUFFER_BIT);
+   glProvokingVertexEXT(GL_LAST_VERTEX_CONVENTION_EXT);
+
+   const int y1 = piglit_height / 3;
+
+   glBegin(GL_TRIANGLE_STRIP);
+   glColor3fv(green);
+   glVertex3i(piglit_width + 1, y1, 0);
+   glColor3fv(green);
+   glVertex3i(piglit_width + 2, y1, 0);
+   glColor3fv(green);
+   glVertex3i(piglit_width + 3, y1, 0);
+   glColor3fv(green);
+   glVertex3i(piglit_width / 2, y1 * 2, 0);
+   glColor3fv(red);
+   glVertex3i(piglit_width - 1, y1 * 2, 0);
+   glEnd();
+
+   pass = pass && piglit_probe_pixel_rgb(piglit_width - 2, y1 * 3 / 2, 
red);
+
+   piglit_present_results();
+
+   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
-- 
2.7.4

__