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

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

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

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


Re: [Piglit] [PATCH v2 4/4] getteximage-simple: Stress an i965 blitter path

2018-06-19 Thread Nanley Chery
On Tue, Jun 19, 2018 at 11:03:17AM +0100, Lionel Landwerlin wrote:
> On 18/06/18 19:57, Nanley Chery wrote:
> > Change the dimension of the texture to test how i965 handles having a
> > row pitch too large for the BLT engine.
> > 
> > v2: Query the maximum supported texture width (Ilia Mirkin)
> > ---
> >   tests/texturing/getteximage-simple.c | 25 +
> >   1 file changed, 17 insertions(+), 8 deletions(-)
> > 
> > diff --git a/tests/texturing/getteximage-simple.c 
> > b/tests/texturing/getteximage-simple.c
> > index 525e6a392..5b87b7ccd 100644
> > --- a/tests/texturing/getteximage-simple.c
> > +++ b/tests/texturing/getteximage-simple.c
> > @@ -8,6 +8,10 @@
> >* texture images is executed before the readback.
> >*
> >* This used to crash for R300+bufmgr.
> > + *
> > + * This also used to stress test the blit methods in i965. The BLT engine 
> > only
> > + * supports pitch sizes up to but not including 32768 dwords. BLORP 
> > supports
> > + * even larger sizes.
> >*/
> >   #include "piglit-util-gl.h"
> > @@ -21,10 +25,10 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
> >   PIGLIT_GL_TEST_CONFIG_END
> > -#define MAX_TYPE_VAL UINT8_MAX
> > -#define PIX_TYPE GLubyte
> > -#define TEX_TYPE GL_UNSIGNED_BYTE
> > -#define TEX_INT_FMT GL_RGBA8
> > +#define MAX_TYPE_VAL 1.0
> > +#define PIX_TYPE GLfloat
> > +#define TEX_TYPE GL_FLOAT
> > +#define TEX_INT_FMT GL_RGBA32F
> >   #define TEX_FMT GL_RGBA
> >   #define CHANNELS_PER_PIXEL 4
> 
> This is changing the format of the texture we're testing with.

Yes, a higher resolution format is needed to hit the row pitch of
interest on the older gens which have a max width of 8K.

> In patch 3 I thought you wanted to make this configurable (through arguments
> to the test maybe?), but this is just switching the format.

In patch 3, I attempted to make the test configurable via a group of
#defines.

> Why not add a command line parameter?
> 

I didn't want to add a command line parameter because there didn't seem
to be any benefit to doing so. By changing the format and width, we're
able to continue testing the issue in R300 as well as the teximage
upload and download paths of interest in i965. Thoughts?

-Nanley

> Thanks,
> 
> -
> Lionel
> 
> > @@ -42,8 +46,8 @@ static bool test_getteximage(PIX_TYPE *data, size_t 
> > data_size, GLint w, GLint h)
> > const unsigned pixel_channel = i % CHANNELS_PER_PIXEL;
> > printf("GetTexImage() returns incorrect data in element 
> > %i\n", i);
> > printf("corresponding to (%i,%i) channel %i\n", 
> > pixel % w, pixel / w, pixel_channel);
> > -   printf("expected: %i\n", data[i]);
> > -   printf("got: %i\n", compare[i]);
> > +   printf("expected: %f\n", data[i]);
> > +   printf("got: %f\n", compare[i]);
> > match = false;
> > break;
> > }
> > @@ -53,11 +57,13 @@ static bool test_getteximage(PIX_TYPE *data, size_t 
> > data_size, GLint w, GLint h)
> > return match;
> >   }
> > +
> >   enum piglit_result
> >   piglit_display(void)
> >   {
> > -   GLsizei height = 16;
> > -   GLsizei width = 64;
> > +   GLsizei height = 2;
> > +   GLsizei width;
> > +   glGetIntegerv(GL_MAX_TEXTURE_SIZE, &width);
> > /* Upload random data to a texture with the given dimensions */
> > const unsigned data_channels = width * height * CHANNELS_PER_PIXEL;
> > @@ -94,6 +100,9 @@ piglit_display(void)
> >   void piglit_init(int argc, char **argv)
> >   {
> > +   if (TEX_TYPE == GL_FLOAT)
> > +   piglit_require_extension("GL_ARB_texture_float");
> > +
> > GLuint tex;
> > glGenTextures(1, &tex);
> 
> 
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


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

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

diff --git a/tests/opengl.py b/tests/opengl.py
index d1f6b99e4..98bfda71f 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -1988,6 +1988,7 @@ with profile.test_list.group_manager(
 g(['arb_gpu_shader_fp64-fs-getuniformdv'])
 g(['arb_gpu_shader_fp64-gs-getuniformdv'])
 g(['arb_gpu_shader_fp64-wrong-type-setter'])
+g(['arb_gpu_shader_fp64-dlist-uniforms'])
 g(['arb_gpu_shader_fp64-double_in_bool_uniform'])
 g(['arb_gpu_shader_fp64-uniform-invalid-operation'])
 g(['arb_gpu_shader_fp64-vs-non-uniform-control-flow-const'])
diff --git a/tests/spec/arb_gpu_shader_fp64/CMakeLists.gl.txt 
b/tests/spec/arb_gpu_shader_fp64/CMakeLists.gl.txt
index 209442f32..704da7f0e 100644
--- a/tests/spec/arb_gpu_shader_fp64/CMakeLists.gl.txt
+++ b/tests/spec/arb_gpu_shader_fp64/CMakeLists.gl.txt
@@ -8,6 +8,7 @@ link_libraries (
${OPENGL_gl_LIBRARY}
 )
 
+piglit_add_executable (arb_gpu_shader_fp64-dlist-uniforms 
dlist-fp64-uniforms.c)
 piglit_add_executable (arb_gpu_shader_fp64-double_in_bool_uniform 
double_in_bool_uniform.c)
 piglit_add_executable (arb_gpu_shader_fp64-fs-non-uniform-control-flow-ssbo 
fs-non-uniform-control-flow-ssbo.c)
 piglit_add_executable (arb_gpu_shader_fp64-vs-non-uniform-control-flow-ssbo 
vs-non-uniform-control-flow-ssbo.c)
diff --git a/tests/spec/arb_gpu_shader_fp64/dlist-fp64-uniforms.c 
b/tests/spec/arb_gpu_shader_fp64/dlist-fp64-uniforms.c
new file mode 100644
index 0..b4f07d709
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/dlist-fp64-uniforms.c
@@ -0,0 +1,406 @@
+/*
+ * Copyright © 2014 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+/**
+ * Verify that unsigned glUniform* commands added in ARB_gpu_shader_fp64 are
+ * compiled into display lists.
+ *
+ * This test is adapted from tests/spec/arb_separate_shader_objects/dlist.c
+ */
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   /* No supports_gl_core_version setting because there are no display
+* lists in core profile.
+*/
+   config.supports_gl_compat_version = 32;
+   config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+   config.khr_no_error_support = PIGLIT_NO_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static bool Uniformd(void);
+static bool UniformMatrixd(void);
+
+void
+piglit_init(int argc, char **argv)
+{
+   bool pass = true;
+
+   piglit_require_extension("GL_ARB_gpu_shader_fp64");
+
+   pass = Uniformd() && pass;
+   pass = UniformMatrixd() && pass;
+
+   piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
+
+enum mode {
+   set_scalar,
+   set_vector,
+   get_and_compare
+};
+
+#define NONMATRIX_UNIFORM(type, n, suffix) \
+   do {\
+   type inbuf[n];  \
+   type outbuf[n]; \
+   unsigned jjj;   \
+   \
+   for (jjj = 0; jjj < n; jjj++)   \
+   outbuf[jjj] = (type) value++;   \
+   \
+   switch (m) {\
+   case set_scalar:\
+   switch (n) {\
+   case 1: \
+   glUniform1 ## suffix\
+   

Re: [Piglit] [PATCH v2 4/4] getteximage-simple: Stress an i965 blitter path

2018-06-19 Thread Lionel Landwerlin

On 18/06/18 19:57, Nanley Chery wrote:

Change the dimension of the texture to test how i965 handles having a
row pitch too large for the BLT engine.

v2: Query the maximum supported texture width (Ilia Mirkin)
---
  tests/texturing/getteximage-simple.c | 25 +
  1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/tests/texturing/getteximage-simple.c 
b/tests/texturing/getteximage-simple.c
index 525e6a392..5b87b7ccd 100644
--- a/tests/texturing/getteximage-simple.c
+++ b/tests/texturing/getteximage-simple.c
@@ -8,6 +8,10 @@
   * texture images is executed before the readback.
   *
   * This used to crash for R300+bufmgr.
+ *
+ * This also used to stress test the blit methods in i965. The BLT engine only
+ * supports pitch sizes up to but not including 32768 dwords. BLORP supports
+ * even larger sizes.
   */
  
  #include "piglit-util-gl.h"

@@ -21,10 +25,10 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
  
  PIGLIT_GL_TEST_CONFIG_END
  
-#define MAX_TYPE_VAL UINT8_MAX

-#define PIX_TYPE GLubyte
-#define TEX_TYPE GL_UNSIGNED_BYTE
-#define TEX_INT_FMT GL_RGBA8
+#define MAX_TYPE_VAL 1.0
+#define PIX_TYPE GLfloat
+#define TEX_TYPE GL_FLOAT
+#define TEX_INT_FMT GL_RGBA32F
  #define TEX_FMT GL_RGBA
  #define CHANNELS_PER_PIXEL 4


This is changing the format of the texture we're testing with.
In patch 3 I thought you wanted to make this configurable (through 
arguments to the test maybe?), but this is just switching the format.

Why not add a command line parameter?

Thanks,

-
Lionel

  
@@ -42,8 +46,8 @@ static bool test_getteximage(PIX_TYPE *data, size_t data_size, GLint w, GLint h)

const unsigned pixel_channel = i % CHANNELS_PER_PIXEL;
printf("GetTexImage() returns incorrect data in element 
%i\n", i);
printf("corresponding to (%i,%i) channel %i\n", 
pixel % w, pixel / w, pixel_channel);
-   printf("expected: %i\n", data[i]);
-   printf("got: %i\n", compare[i]);
+   printf("expected: %f\n", data[i]);
+   printf("got: %f\n", compare[i]);
match = false;
break;
}
@@ -53,11 +57,13 @@ static bool test_getteximage(PIX_TYPE *data, size_t 
data_size, GLint w, GLint h)
return match;
  }
  
+

  enum piglit_result
  piglit_display(void)
  {
-   GLsizei height = 16;
-   GLsizei width = 64;
+   GLsizei height = 2;
+   GLsizei width;
+   glGetIntegerv(GL_MAX_TEXTURE_SIZE, &width);
  
  	/* Upload random data to a texture with the given dimensions */

const unsigned data_channels = width * height * CHANNELS_PER_PIXEL;
@@ -94,6 +100,9 @@ piglit_display(void)
  
  void piglit_init(int argc, char **argv)

  {
+   if (TEX_TYPE == GL_FLOAT)
+   piglit_require_extension("GL_ARB_texture_float");
+
GLuint tex;
  
  	glGenTextures(1, &tex);



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


Re: [Piglit] [PATCH v2 0/4] Stress an i965 blitter path

2018-06-19 Thread Lionel Landwerlin

Patches 1 to 3 are :

Reviewed-by: Lionel Landwerlin 

On 18/06/18 19:57, Nanley Chery wrote:

This series modifies getteximage-simple to work on a texture of maximum
width. This enables us to test an existing fallback path for i965 which
changes the texture's tiling to linear. It also enables us to test an
alternative fallback path [1] which keeps the texture's tiling.

This works on all GEN hardware, but on gen4 we run into the floating
point texture values being a tad off. This isn't a new problem as that
platform also fails another floating point teximage test. This test
passes on gen4 if I change the texture to be an integer format. We lose
the interesting pattern if I do so, however. I don't mind changing the
format if people prefer.

1. https://patchwork.freedesktop.org/patch/226092/

Nanley Chery (4):
   getteximage-simple: Fix the coordinate printf
   getteximage-simple: Switch to parameter passing
   getteximage-simple: Allow configurable texture parameters
   getteximage-simple: Stress an i965 blitter path

  tests/texturing/getteximage-simple.c | 64 +++-
  1 file changed, 45 insertions(+), 19 deletions(-)



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