Re: [Piglit] [PATCH] Add test for external sampler with 2D tex

2019-02-02 Thread Mark Janes
FWIW, the skqp test is run constantly in mesa ci:

https://mesa-ci.01.org/mesa_master/builds/15138/results/174306816


Aditya Swarup  writes:

> Commit 649c149dbb96ac367 removed the test for intel external sampler
> with dma only because of failure due to commit a5c39ed974402c -
> ("i965: Lift restriction in external textures for EGLImage support").
> Since, there is no test coverage for external sampler with 2D tex,
> adding the test with modifications to pass for external sampler using
> EGLImage with 2D tex.
>
> Signed-off-by: Aditya Swarup 
> Cc: Tapani Pälli 
> Cc: Kenneth Graunke 
> ---
> This test case covers the scenario of binding a texture ID of type 
> GL_TEXTURE_EXTERNAL with EGLImage created using 2D texture. 
>
> This test is not covered in deqp but in CTS SKQP test - CtsSkQPTestCases 
> "#unitTest_EGLImageTest". Explanation in 
> https://bugs.freedesktop.org/show_bug.cgi?id=105301.
>
> It would be nice to have test coverage in piglit as well, so that we come to 
> know if this scenario is broken in near future. 
>
>  tests/opengl.py   |   2 +
>  .../CMakeLists.gles2.txt  |   1 +
>  .../intel_external_sampler_with_2D_tex.c  | 103 ++
>  3 files changed, 106 insertions(+)
>  create mode 100644 
> tests/spec/ext_image_dma_buf_import/intel_external_sampler_with_2D_tex.c
>
> diff --git a/tests/opengl.py b/tests/opengl.py
> index af68560bf..926af2036 100644
> --- a/tests/opengl.py
> +++ b/tests/opengl.py
> @@ -3017,6 +3017,8 @@ with profile.test_list.group_manager(
>  g(['ext_image_dma_buf_import-unsupported_format'], run_concurrent=False)
>  g(['ext_image_dma_buf_import-intel_external_sampler_only'],
>run_concurrent=False)
> +g(['ext_image_dma_buf_import-intel_external_sampler_with_2D_tex'],
> +  run_concurrent=False)
>  g(['ext_image_dma_buf_import-refcount'])
>  g(['ext_image_dma_buf_import-sample_rgb', '-fmt=AR24'],
>'ext_image_dma_buf_import-sample_argb', run_concurrent=False)
> diff --git a/tests/spec/ext_image_dma_buf_import/CMakeLists.gles2.txt 
> b/tests/spec/ext_image_dma_buf_import/CMakeLists.gles2.txt
> index f99a5d800..c22aeed73 100644
> --- a/tests/spec/ext_image_dma_buf_import/CMakeLists.gles2.txt
> +++ b/tests/spec/ext_image_dma_buf_import/CMakeLists.gles2.txt
> @@ -19,6 +19,7 @@ if(PIGLIT_BUILD_DMA_BUF_TESTS)
>   piglit_add_executable(ext_image_dma_buf_import-refcount refcount.c 
> sample_common.c image_common.c)
>   piglit_add_executable(ext_image_dma_buf_import-sample_yuv sample_yuv.c 
> sample_common.c image_common.c)
>   piglit_add_executable(ext_image_dma_buf_import-sample_rgb sample_rgb.c 
> sample_common.c image_common.c)
> + 
> piglit_add_executable(ext_image_dma_buf_import-intel_external_sampler_with_2D_tex
>  intel_external_sampler_with_2D_tex.c image_common.c)
>   
> piglit_add_executable(ext_image_dma_buf_import-transcode-nv12-as-r8-gr88 
> transcode-nv12-as-r8-gr88.c image_common.c)
>  endif()
>  
> diff --git 
> a/tests/spec/ext_image_dma_buf_import/intel_external_sampler_with_2D_tex.c 
> b/tests/spec/ext_image_dma_buf_import/intel_external_sampler_with_2D_tex.c
> new file mode 100644
> index 0..82e6a201e
> --- /dev/null
> +++ b/tests/spec/ext_image_dma_buf_import/intel_external_sampler_with_2D_tex.c
> @@ -0,0 +1,103 @@
> +/*
> + * Copyright © 2013 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
> DEALINGS
> + * IN THE SOFTWARE.
> + */
> +
> +#include "image_common.h"
> +
> +/**
> + * @file intel_external_sampler_with_2D_tex.c
> + *
> + * Intel driver allows image external sampler to be used with regular 
> 2D-texutre
> + * and imported dma buffers. This test creates an egl image based on a 
> 2D-texture,
> + * attempts to use the image as target for an external texture, and should 
> pass.
> + *
> + */
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> + 

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

2019-02-02 Thread Timothy Arceri

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

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

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

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

  From the GL_ARB_enhanced_layouts spec:

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

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

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


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

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


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


After rereading the spec I think you are right.

Reviewed-by: Timothy Arceri 






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


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


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

2019-02-02 Thread Andres Gomez
On Sat, 2019-02-02 at 10:15 +1100, Timothy Arceri wrote:
> On 2/2/19 4:55 am, Andres Gomez wrote:
> > Additional check to address a bug in mesa in which a stride which
> > is a divisor of the declared offset for an overflowing varying
> > won't fail.
> > 
> >  From the GL_ARB_enhanced_layouts spec:
> > 
> >" It is a compile-time or link-time error to have any *xfb_offset*
> >  that overflows *xfb_stride*, whether stated on declarations before
> >  or after the *xfb_stride*, or in different compilation units."
> > 
> > Cc: Timothy Arceri 
> > Signed-off-by: Andres Gomez 
> > ---
> >   .../xfb_stride/variable-stride-overflow2.vert | 28 +++
> >   1 file changed, 28 insertions(+)
> >   create mode 100644 
> > tests/spec/arb_enhanced_layouts/compiler/transform-feedback-layout-qualifiers/xfb_stride/variable-stride-overflow2.vert
> > 
> > diff --git 
> > a/tests/spec/arb_enhanced_layouts/compiler/transform-feedback-layout-qualifiers/xfb_stride/variable-stride-overflow2.vert
> >  
> > b/tests/spec/arb_enhanced_layouts/compiler/transform-feedback-layout-qualifiers/xfb_stride/variable-stride-overflow2.vert
> > new file mode 100644
> > index 0..469c5e430
> > --- /dev/null
> > +++ 
> > b/tests/spec/arb_enhanced_layouts/compiler/transform-feedback-layout-qualifiers/xfb_stride/variable-stride-overflow2.vert
> > @@ -0,0 +1,28 @@
> > +// [config]
> > +// expect_result: fail
> > +// glsl_version: 1.40
> > +// check_link: true
> > +// require_extensions: GL_ARB_enhanced_layouts
> > +// [end config]
> > +//
> > +// Additional check to address a bug in mesa in which a stride which
> > +// is a divisor of the declared offset for an overflowing varying
> > +// won't fail.
> > +//
> > +// From the GL_ARB_enhanced_layouts spec:
> > +//
> > +//"It is a compile-time or link-time error to have any *xfb_offset*
> > +//that overflows *xfb_stride*, whether stated on declarations before or
> > +//after the *xfb_stride*, or in different compilation units."
> > +
> > +#version 140
> > +#extension GL_ARB_enhanced_layouts: require
> > +
> > +layout(xfb_stride = 16) out vec4 var;
> > +layout(xfb_offset = 16) out vec4 var2;
> 
> This test looks wrong to me. This looks like it *should* compile.
> 
> vec4 var uses bytes 0-15. So there is no issue with vec4 vec2 having an 
> offset of 16. Its been a long time since I worked on this but I think 
> this change is wrong. I see no reason this should fail compilation.

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

> 
> > +
> > +void main()
> > +{
> > +  var = vec4(1.0);
> > +  var2 = vec4(0.0);
> > +}
> > 
-- 
Br,

Andres

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


[Piglit] [PATCH] shader_runner: skip GLSL version check when running SPIR-V shaders

2019-02-02 Thread Alejandro Piñeiro
Because after all, you are not running GLSL shaders in that
case. SPIR-V requirements are OpenGL version >= 3.30 and having
ARB_gl_spirv available.

About why this is needed: most SPIR-V tests include the GLSL used to
generate the SPIR-V, so the SPIR-V could be regenerated easily if we
test needs any fix, and also to run the test on GLSL mode, that was
found to be useful for debug. For the latter, it is needed to keep the
GLSL version required, that is usually 4.50 (ARB_gl_spirv is written
against GLSL 4.50, without requiring it, so it is easier to just use
4.50 GLSL shaders).

Without this change, on systems with OpenGL 3.30, the SPIR-V shader
will not run for not fullfilling the GLSL version required.
---
 tests/shaders/shader_runner.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 6df8bd860..285f83944 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -1130,7 +1130,7 @@ process_requirement(const char *line)
   parse_word_copy(line, buffer, sizeof(buffer), )) {
if (piglit_is_extension_supported(buffer))
return PIGLIT_SKIP;
-   } else if (parse_str(line, "GLSL", )) {
+   } else if (parse_str(line, "GLSL", ) && !spirv_replaces_glsl) {
enum comparison cmp;
 
parse_version_comparison(line, , _req_version,
-- 
2.19.1

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


[Piglit] [PATCH] Add test for external sampler with 2D tex

2019-02-02 Thread Aditya Swarup
Commit 649c149dbb96ac367 removed the test for intel external sampler
with dma only because of failure due to commit a5c39ed974402c -
("i965: Lift restriction in external textures for EGLImage support").
Since, there is no test coverage for external sampler with 2D tex,
adding the test with modifications to pass for external sampler using
EGLImage with 2D tex.

Signed-off-by: Aditya Swarup 
Cc: Tapani Pälli 
Cc: Kenneth Graunke 
---
This test case covers the scenario of binding a texture ID of type 
GL_TEXTURE_EXTERNAL with EGLImage created using 2D texture. 

This test is not covered in deqp but in CTS SKQP test - CtsSkQPTestCases 
"#unitTest_EGLImageTest". Explanation in 
https://bugs.freedesktop.org/show_bug.cgi?id=105301.

It would be nice to have test coverage in piglit as well, so that we come to 
know if this scenario is broken in near future. 

 tests/opengl.py   |   2 +
 .../CMakeLists.gles2.txt  |   1 +
 .../intel_external_sampler_with_2D_tex.c  | 103 ++
 3 files changed, 106 insertions(+)
 create mode 100644 
tests/spec/ext_image_dma_buf_import/intel_external_sampler_with_2D_tex.c

diff --git a/tests/opengl.py b/tests/opengl.py
index af68560bf..926af2036 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -3017,6 +3017,8 @@ with profile.test_list.group_manager(
 g(['ext_image_dma_buf_import-unsupported_format'], run_concurrent=False)
 g(['ext_image_dma_buf_import-intel_external_sampler_only'],
   run_concurrent=False)
+g(['ext_image_dma_buf_import-intel_external_sampler_with_2D_tex'],
+  run_concurrent=False)
 g(['ext_image_dma_buf_import-refcount'])
 g(['ext_image_dma_buf_import-sample_rgb', '-fmt=AR24'],
   'ext_image_dma_buf_import-sample_argb', run_concurrent=False)
diff --git a/tests/spec/ext_image_dma_buf_import/CMakeLists.gles2.txt 
b/tests/spec/ext_image_dma_buf_import/CMakeLists.gles2.txt
index f99a5d800..c22aeed73 100644
--- a/tests/spec/ext_image_dma_buf_import/CMakeLists.gles2.txt
+++ b/tests/spec/ext_image_dma_buf_import/CMakeLists.gles2.txt
@@ -19,6 +19,7 @@ if(PIGLIT_BUILD_DMA_BUF_TESTS)
piglit_add_executable(ext_image_dma_buf_import-refcount refcount.c 
sample_common.c image_common.c)
piglit_add_executable(ext_image_dma_buf_import-sample_yuv sample_yuv.c 
sample_common.c image_common.c)
piglit_add_executable(ext_image_dma_buf_import-sample_rgb sample_rgb.c 
sample_common.c image_common.c)
+   
piglit_add_executable(ext_image_dma_buf_import-intel_external_sampler_with_2D_tex
 intel_external_sampler_with_2D_tex.c image_common.c)

piglit_add_executable(ext_image_dma_buf_import-transcode-nv12-as-r8-gr88 
transcode-nv12-as-r8-gr88.c image_common.c)
 endif()
 
diff --git 
a/tests/spec/ext_image_dma_buf_import/intel_external_sampler_with_2D_tex.c 
b/tests/spec/ext_image_dma_buf_import/intel_external_sampler_with_2D_tex.c
new file mode 100644
index 0..82e6a201e
--- /dev/null
+++ b/tests/spec/ext_image_dma_buf_import/intel_external_sampler_with_2D_tex.c
@@ -0,0 +1,103 @@
+/*
+ * Copyright © 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include "image_common.h"
+
+/**
+ * @file intel_external_sampler_with_2D_tex.c
+ *
+ * Intel driver allows image external sampler to be used with regular 
2D-texutre
+ * and imported dma buffers. This test creates an egl image based on a 
2D-texture,
+ * attempts to use the image as target for an external texture, and should 
pass.
+ *
+ */
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_es_version = 10;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static EGLImageKHR
+create_tex_based_egl_image(unsigned w, unsigned h, const unsigned char *pixels)
+{
+   GLuint tex;
+   EGLImageKHR img;
+
+   glGenTextures(1, );
+   glBindTexture(GL_TEXTURE_2D, tex);
+
+   glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w,