[Piglit] [PATCH 3/3] arb_bindless_texture: rename vertex uniform test and add vertex attrib test

2018-04-08 Thread Karol Herbst
Signed-off-by: Karol Herbst 
---
 .../sampler-vertex-attrib-input-output.shader_test | 41 ++
 ...ampler-vertex-uniform-input-output.shader_test} |  0
 2 files changed, 41 insertions(+)
 create mode 100644 
tests/spec/arb_bindless_texture/execution/samplers/sampler-vertex-attrib-input-output.shader_test
 rename 
tests/spec/arb_bindless_texture/execution/samplers/{sampler-input-output.shader_test
 => sampler-vertex-uniform-input-output.shader_test} (100%)

diff --git 
a/tests/spec/arb_bindless_texture/execution/samplers/sampler-vertex-attrib-input-output.shader_test
 
b/tests/spec/arb_bindless_texture/execution/samplers/sampler-vertex-attrib-input-output.shader_test
new file mode 100644
index 0..5187b
--- /dev/null
+++ 
b/tests/spec/arb_bindless_texture/execution/samplers/sampler-vertex-attrib-input-output.shader_test
@@ -0,0 +1,41 @@
+# In this test, the sampler to use is selected in a vertex shader, passed
+# to the fragment shader as a (flat) input, and then used for a texture
+# lookup.
+[require]
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_bindless_texture
+
+[vertex shader]
+#version 330
+#extension GL_ARB_bindless_texture: require
+
+in sampler2D tex;
+in vec4 piglit_vertex;
+
+flat out sampler2D sampler_vs;
+
+void main()
+{
+   gl_Position = piglit_vertex;
+   sampler_vs = tex;
+}
+
+[fragment shader]
+#version 330
+#extension GL_ARB_bindless_texture: require
+
+flat in sampler2D sampler_vs;
+out vec4 color;
+
+void main()
+{
+   color = texture2D(sampler_vs, vec2(0, 0));
+}
+
+[test]
+texture rgbw 0 (16, 16)
+resident texture 0
+vertex attrib handle tex 0
+draw rect -1 -1 2 2
+relative probe rgb (0.0, 0.0) (1.0, 0.0, 0.0)
diff --git 
a/tests/spec/arb_bindless_texture/execution/samplers/sampler-input-output.shader_test
 
b/tests/spec/arb_bindless_texture/execution/samplers/sampler-vertex-uniform-input-output.shader_test
similarity index 100%
rename from 
tests/spec/arb_bindless_texture/execution/samplers/sampler-input-output.shader_test
rename to 
tests/spec/arb_bindless_texture/execution/samplers/sampler-vertex-uniform-input-output.shader_test
-- 
2.14.3

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


[Piglit] [PATCH 1/3] shader_runner: add vertex attrib command for setting bindless texture handles

2018-04-08 Thread Karol Herbst
Signed-off-by: Karol Herbst 
---
 tests/shaders/shader_runner.c | 42 ++
 1 file changed, 42 insertions(+)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 700b11327..e07e7b3ca 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -1964,6 +1964,46 @@ set_uniform(const char *line, int ubo_array_index)
return;
 }
 
+static void
+set_vertex_attrib(const char *line)
+{
+   char name[512], type[512];
+   uint64_t uint64s[16];
+   GLint loc;
+
+   REQUIRE(parse_word_copy(line, type, sizeof(type), ) &&
+   parse_word_copy(line, name, sizeof(name), ),
+   "Invalid set vertex attrib command at: %s\n", line);
+
+   if (isdigit(name[0])) {
+   loc = strtol(name, NULL, 0);
+   } else {
+   GLuint prog;
+
+   glGetIntegerv(GL_CURRENT_PROGRAM, (GLint *) );
+   loc = glGetAttribLocation(prog, name);
+   if (loc < 0) {
+   printf("cannot get location of vertex attrib \"%s\"\n",
+  name);
+   piglit_report_result(PIGLIT_FAIL);
+   }
+}
+
+   if (parse_str(type, "handle", NULL)) {
+   check_unsigned_support();
+   check_texture_handle_support();
+   parse_uint64s(line, uint64s, 1, NULL);
+   glVertexAttribL1ui64ARB(loc, 
get_resident_handle(uint64s[0])->handle);
+   return;
+   }
+
+   printf("unknown vertex attrib type \"%s\"\n", type);
+   printf("use [vertex data] instead if possible\n");
+   piglit_report_result(PIGLIT_FAIL);
+
+   return;
+}
+
 static GLenum lookup_shader_type(GLuint idx)
 {
switch (idx) {
@@ -3817,6 +3857,8 @@ piglit_display(void)
active_uniform(rest);
} else if (parse_str(line, "verify program_interface_query ", 
)) {
active_program_interface(rest);
+   } else if (parse_str(line, "vertex attrib ", )) {
+   set_vertex_attrib(rest);
} else if ((line[0] != '\n') && (line[0] != '\0')
   && (line[0] != '#')) {
printf("unknown command \"%s\"\n", line);
-- 
2.14.3

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


[Piglit] [PATCH 2/3] arb_bindless_texture: add some uvec2 arithmetic test

2018-04-08 Thread Karol Herbst
Signed-off-by: Karol Herbst 
---
 .../basic-arithmetic-uvec2-texture2D.shader_test   | 37 ++
 1 file changed, 37 insertions(+)
 create mode 100644 
tests/spec/arb_bindless_texture/execution/samplers/basic-arithmetic-uvec2-texture2D.shader_test

diff --git 
a/tests/spec/arb_bindless_texture/execution/samplers/basic-arithmetic-uvec2-texture2D.shader_test
 
b/tests/spec/arb_bindless_texture/execution/samplers/basic-arithmetic-uvec2-texture2D.shader_test
new file mode 100644
index 0..4d644b044
--- /dev/null
+++ 
b/tests/spec/arb_bindless_texture/execution/samplers/basic-arithmetic-uvec2-texture2D.shader_test
@@ -0,0 +1,37 @@
+# Same as basic-texture2D.shader_test, but with some math on the handle
+[require]
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_bindless_texture
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 330
+#extension GL_ARB_bindless_texture: require
+
+layout (bindless_sampler) uniform sampler2D tex;
+uniform uvec2 handleOffset;
+
+out vec4 finalColor;
+
+void main()
+{
+   sampler2D fixedTex;
+
+   uvec2 handle = uvec2(tex);
+   handle.x -= 0x12345678u;
+   handle.y -= 0x9abcdef0u;
+
+   fixedTex = sampler2D(handle + handleOffset);
+
+   finalColor = texture2D(fixedTex, vec2(0, 0));
+}
+
+[test]
+texture rgbw 0 (16, 16)
+resident texture 0
+uniform uvec2 handleOffset 0x12345678 0x9abcdef0
+uniform handle tex 0
+draw rect -1 -1 2 2
+relative probe rgb (0.0, 0.0) (1.0, 0.0, 0.0)
-- 
2.14.3

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


Re: [Piglit] [PATCH 3/3] arb_get_texture_sub_image: update cube map tests to complete the cube map

2018-04-08 Thread Anthony Pesch
Hey Juan,

Good catch - I'd only been focusing on the errors test.

I've updated the patch to also fix the errors in arb_get_texture_sub_image-get:

Author: Anthony Pesch 
Date:   Thu Mar 22 13:11:22 2018 -0400

arb_get_texture_sub_image: update cube map tests to make textures cube 
complete

Update cube map tests to ensure cube map textures are cube complete before 
querying
them. Querying a cube map which is not cube complete should set 
INVALID_OPERATION
as per the OpenGL 4.6 Core spec:

"An INVALID_OPERATION error is generated if the effective target is
TEXTURE_CUBE_MAP or TEXTURE_CUBE_MAP_ARRAY, and the texture object
is not cube complete or cube array complete, respectively."

diff --git a/tests/spec/arb_get_texture_sub_image/errors.c 
b/tests/spec/arb_get_texture_sub_image/errors.c
index 1e7b17115..4b99d1cc2 100644
--- a/tests/spec/arb_get_texture_sub_image/errors.c
+++ b/tests/spec/arb_get_texture_sub_image/errors.c
@@ -253,16 +253,20 @@ test_cubemap_faces(void)
 0, GL_RGBA, 8, 8, 0, GL_RGBA, GL_FLOAT, NULL);
 }
 
-/* try to get all six cube faces, should fail */
+/* try to query incomplete cube map, should fail */
 glGetTextureSubImage(tex, 0,
  0, 0, 0,
- 8, 8, 6,
+ 8, 8, 5,
  GL_RGBA, GL_UNSIGNED_BYTE,
  sizeof(results), results);
if (!piglit_check_gl_error(GL_INVALID_OPERATION))
pass = false;
 
-/* try to get five cube faces, should pass */
+   /* upload final face */
+   glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + 5,
+0, GL_RGBA, 8, 8, 0, GL_RGBA, GL_FLOAT, NULL);
+
+/* try to query complete cube map, should now pass */
 glGetTextureSubImage(tex, 0,
  0, 0, 0,
  8, 8, 5,
diff --git a/tests/spec/arb_get_texture_sub_image/get.c 
b/tests/spec/arb_get_texture_sub_image/get.c
index 8aa4c92e1..fc8f9f8e1 100644
--- a/tests/spec/arb_get_texture_sub_image/get.c
+++ b/tests/spec/arb_get_texture_sub_image/get.c
@@ -157,12 +157,16 @@ test_getsubimage(GLenum target,
 GL_RGBA, GL_UNSIGNED_BYTE, texData);
break;
case GL_TEXTURE_CUBE_MAP:
-   /* only set +Y face */
-   glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y,
-level, intFormat,
-mip_width, mip_height, 0,
-GL_RGBA, GL_UNSIGNED_BYTE,
-texData);
+   /* specify dimensions and format for all faces to make 
texture cube complete,
+  but specify data for only the +Y face as it is the 
only one read back */
+   for (i = 0; i < 6; i++) {
+   GLubyte *faceData = i == 2 ? texData : NULL;
+   glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i,
+level, intFormat,
+mip_width, mip_height, 0,
+GL_RGBA, GL_UNSIGNED_BYTE,
+faceData);
+   }
break;
}
}


 - Anthony


From: Piglit  on behalf of Juan A. Suarez 
Romero 
Sent: Thursday, April 5, 2018 4:43 AM
To: Anthony Pesch; piglit@lists.freedesktop.org
Subject: Re: [Piglit] [PATCH 3/3] arb_get_texture_sub_image: update cube map 
tests to complete the cube map

On Thu, 2018-04-05 at 10:19 +0200, Juan A. Suarez Romero wrote:
> On Wed, 2018-03-28 at 11:15 -0400, Anthony Pesch wrote:
> > From: Anthony Pesch 
> >
> > Update cube map tests to complete the cube map before performing the final
> > query. This final query is expected to succeed, however, querying a cube map
> > which is not cube complete should set INVALID_OPERATION as per the OpenGL 
> > 4.6
> > Core spec:
> >
> > "An INVALID_OPERATION error is generated if the effective target is
> > TEXTURE_CUBE_MAP or TEXTURE_CUBE_MAP_ARRAY, and the texture object
> > is not cube complete or cube array complete, respectively."
> > ---
>
>
> Isn't there a similar problem in tests/spec/arb_get_texture_sub_image/get.c,
> when invoking test_getsubimage() with a GL_TEXTURE_CUBE_MAP  ?
>

More specifically, the test is only setting one face of the cube, so the cube is
 incomplete. It should set all the faces.

This change can be included within this patch.

J.A.

>
>   J.A.
>
> >  tests/spec/arb_get_texture_sub_image/errors.c | 10 +++---
> >  1 file changed, 7 

Re: [Piglit] [PATCH 1/3] arb_get_texture_sub_image: fix expected error when querying a level which hasn't been explicitly defined

2018-04-08 Thread Anthony Pesch
Hey Juan,

I've updated the patch to include the OpenGL spec references:

Author: Anthony Pesch 
Date:   Thu Mar 22 11:06:13 2018 -0400

arb_get_texture_sub_image: fix expected error when querying a level which 
hasn't
been explicitly defined

Change expected error from INVALID_OPERATION to INVALID_VALUE when querying 
a
level which hasn't been explicitly defined. The level is valid, however, the
level hasn't been explicitly defined so it should have a default width and
height of 0, making the 8x8 query produce an INVALID_VALUE.

From the OpenGL 4.6 spec, 8.22 Texture State and Proxy State:
"Each initial texture image is null. It has zero width, height, and depth,
internal format RGBA, or R8 for buffer textures, component sizes set to 
zero and
component types set to NONE, the compressed flag set to FALSE, a zero 
compressed
size, and the bound buffer object name is zero."

From the GetTextureSubImage errors in 8.11.4:
"An INVALID_VALUE error is generated if xoffset + width is greater than the
texture’s width, yoffset + height is greater than the texture’s height, or
zoffset + depth is greater than the texture’s depth."

diff --git a/tests/spec/arb_get_texture_sub_image/errors.c 
b/tests/spec/arb_get_texture_sub_image/errors.c
index 34fec4a95..57875fa6a 100644
--- a/tests/spec/arb_get_texture_sub_image/errors.c
+++ b/tests/spec/arb_get_texture_sub_image/errors.c
@@ -200,7 +200,7 @@ test_invalid_values(void)
 8, 8, 1, /* size */
 GL_RGBA, GL_FLOAT,  /* bad enum */
 sizeof(buffer), buffer);
-   if (!piglit_check_gl_error(GL_INVALID_OPERATION))
+   if (!piglit_check_gl_error(GL_INVALID_VALUE))
pass = false;
 
/* Test getting invalid offset */

 - Anthony


From: Juan A. Suarez Romero 
Sent: Wednesday, April 4, 2018 1:17 PM
To: Anthony Pesch; Anthony Pesch; piglit@lists.freedesktop.org
Subject: Re: [Piglit] [PATCH 1/3] arb_get_texture_sub_image: fix expected error 
when querying a level which hasn't been explicitly defined

On Wed, 2018-04-04 at 15:04 +, Anthony Pesch wrote:
> Hey Juan,
>
> The change from INVALID_OPERATION to INVALID_VALUE isn't because the level 
> value is invalid.
>
> The level is valid, however, the level hasn't been explicitly defined so it 
> should have a default width and height of 0, making the 8x8 query invalid.
>
> From the OpenGL 4.6 spec, 8.22 Texture State and Proxy State:
> "Each initial texture image is null. It has zero width, height, and depth,  
> internal format RGBA, or R8 for buffer textures, component sizes set to zero 
> and component types set to NONE, the compressed flag set to FALSE, a zero 
> compressed size, and the bound buffer object name is zero."
>
> From the GetTextureSubImage errors in 8.11.4:
> "An INVALID_VALUE error is generated if xoffset + width is greater than the  
> texture’s  width, yoffset + height is  greater  than  the  texture’s  height, 
>  or zoffset + depth is greater than the texture’s depth."
>


Thanks for the info!

I think your assumption is correct: all non-defined levels have an empty
initialized empty.

Do you mind to include such OpenGL reference in the commit message?

With that,

Reviewed-by: Juan A. Suarez 

>  - Anthony
>
> 
> From: Piglit  on behalf of Juan A. 
> Suarez Romero 
> Sent: Wednesday, April 4, 2018 7:12 AM
> To: Anthony Pesch; piglit@lists.freedesktop.org
> Subject: Re: [Piglit] [PATCH 1/3] arb_get_texture_sub_image: fix expected 
> error when querying a level which hasn't been explicitly defined
>
> On Wed, 2018-03-28 at 11:15 -0400, Anthony Pesch wrote:
> > From: Anthony Pesch 
> >
> > Change expected error from INVALID_OPERATION to INVALID_VALUE when querying
> > a level which hasn't been explicitly defined. This is a valid operation, the
> > error set should be due to the requested width and height being greater than
> > the default width and height of zero.
>
> I have some doubts with this patch. I've been checking OpenGL 4.5 spec, 
> section
> 8.11.4 Texture Image Queries, and this is what I found:
>
> "An INVALID_VALUE error is generated if level is negative or larger than the
> maximum allowable level."
>
>
> In this case, level is 4, so we aren't in this case, as the level is not
> negative, and it is smaller than the maximum allowable level (15, the
> implementation I use).
>
>
> So really don't know what should be the expected error, INVALID_OPERATION or
> INVALID_VALUE.
>
>
> J.A.
>
>
>
> >  tests/spec/arb_get_texture_sub_image/errors.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tests/spec/arb_get_texture_sub_image/errors.c 
> > 

Re: [Piglit] [PATCH] cl: Add test for CSR VGPRs caused by SGPR spilling

2018-04-08 Thread Jan Vesely
On Fri, 2018-04-06 at 00:49 -0400, Matt Arsenault wrote:
> ping

I'll need to setup the rocm stack to test this. It will take some time.
It should work with clover as well (modulo bugs; asm parser, function
calls, ...), right?

Jan

> 
> > On Mar 29, 2018, at 11:29, Matt Arsenault  wrote:
> > 
> > Make sure if a CSR VGPR is needed for SGPR spilling, it is
> > properly saved and restored.
> > ---
> > .../execute/amdgcn-callee-saved-registers.cl   | 52 
> > ++
> > 1 file changed, 52 insertions(+)
> > create mode 100644 tests/cl/program/execute/amdgcn-callee-saved-registers.cl
> > 
> > diff --git a/tests/cl/program/execute/amdgcn-callee-saved-registers.cl 
> > b/tests/cl/program/execute/amdgcn-callee-saved-registers.cl
> > new file mode 100644
> > index 0..8b8db2783
> > --- /dev/null
> > +++ b/tests/cl/program/execute/amdgcn-callee-saved-registers.cl
> > @@ -0,0 +1,52 @@
> > +/*!
> > +
> > +[config]
> > +name: amdgcn call clobbers
> > +clc_version_min: 10
> > +device_regex: gfx[\d]*
> > +
> > +[test]
> > +name: CSR VGPR for SGPR spilling
> > +kernel_name: kernel_call_need_spill_vgpr_for_csr_sgpr_spills_no_calls
> > +dimensions: 1
> > +global_size: 1 0 0
> > +arg_out: 0 buffer int[2] \
> > +  0x1337  0xabcd1234
> > +
> > +!*/
> > +
> > +#ifndef __AMDGCN__
> > +#error This test is only for amdgcn
> > +#endif
> > +
> > +__attribute__((noinline))
> > +int need_spill_vgpr_for_csr_sgpr_spills_no_calls()
> > +{
> > +int sgpr_val;
> > +__asm volatile("s_mov_b32 %0, 0x1337" : "=s"(sgpr_val));
> > +
> > +__asm volatile(
> > +"s_nop 1" :::
> > +"v0","v1","v2","v3","v4","v5","v6","v7",
> > +"v8","v9","v10","v11","v12","v13","v14","v15",
> > +"v16","v17","v18","v19","v20","v21","v22","v23",
> > +"v24","v25","v26","v27","v28","v29","v30","v31",
> > +
> > +"s0","s1","s2","s3","s4","s5","s6","s7",
> > +"s8","s9","s10","s11","s12","s13","s14","s15",
> > +"s16","s17","s18","s19","s20","s21","s22","s23",
> > +"s24","s25","s26","s27","s28","s29","s30","s31",
> > +   "s32", "s33", "s34", "s35", "s36", "s37", "s38");
> > +
> > +return sgpr_val;
> > +}
> > +
> > +
> > +kernel void 
> > kernel_call_need_spill_vgpr_for_csr_sgpr_spills_no_calls(global int* ret)
> > +{
> > +int v32;
> > +__asm volatile("v_mov_b32 %0, 0xabcd1234" : "={v32}"(v32));
> > +ret[0] = need_spill_vgpr_for_csr_sgpr_spills_no_calls();
> > +__asm volatile ("s_nop 0" :: "{v32}"(v32));
> > +ret[1] = v32;
> > +}
> > -- 
> > 2.14.1
> > 
> 
> 

-- 
Jan Vesely 

signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] cl: Add test for call stack realignment

2018-04-08 Thread Jan Vesely
On Fri, 2018-04-06 at 00:28 -0400, Matt Arsenault wrote:
> > On Apr 4, 2018, at 15:52, Jan Vesely  wrote:
> > 
> > redundant newline
> 
> Not sure what you mean by this. Do you mean the newline to put the
> single array element on its own line? I was trying to be consistent
> with buffer formatting as most tests do

most test don't. out of 200+ tests (not counting the generated ones,
which don't use it) only 26 put buffer initializer on a new line, 23 of
those were submitted by you.
while I didn't mind that much doing it for large arrays, using it for a
single element is ridiculous.

Jan

-- 
Jan Vesely 

signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit