Re: [Piglit] [PATCH 1/2] textureSize: add ability to test tess eval stage

2018-01-03 Thread Roland Scheidegger
Thanks for the review, I've added the tests to all.py. And good thing I
did, because from the ~40 tests the 3 with bufferSamplers didn't
actually work on my newest r600 patch version in a test run :-).

Roland

Am 03.01.2018 um 23:08 schrieb Fabian Bieler:
> I think the new tes-texture-size test should be added to all.py (in
> multiple places).
> 
> Other than that, series is
> Reviewed-by: Fabian Bieler 
> 
> On 2018-01-01 06:41, srol...@vmware.com wrote:
>> From: Roland Scheidegger 
>>
>> This is a problem of all texturing tests, they cannot exercise the 
>> tesselation
>> stages. (But I'm too lazy to fix the others, and too lazy to hack something 
>> up
>> for tcs stage, I only need it to verify a bug/fix with r600 buffer textures.)
>> ---
>>  tests/texturing/shaders/common.c  |  3 ++
>>  tests/texturing/shaders/common.h  |  3 +-
>>  tests/texturing/shaders/textureSize.c | 76 
>> ---
>>  3 files changed, 75 insertions(+), 7 deletions(-)
>>
>> diff --git a/tests/texturing/shaders/common.c 
>> b/tests/texturing/shaders/common.c
>> index b377bbcae..bda149971 100644
>> --- a/tests/texturing/shaders/common.c
>> +++ b/tests/texturing/shaders/common.c
>> @@ -378,6 +378,9 @@ require_GL_features(enum shader_target test_stage)
>>  glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, _units);
>>  if (test_stage == VS && tex_units <= 0)
>>  piglit_report_result(PIGLIT_SKIP);
>> +
>> +if (test_stage == TES)
>> +piglit_require_extension("GL_ARB_tessellation_shader");
>>  }
>>  
>>  /**
>> diff --git a/tests/texturing/shaders/common.h 
>> b/tests/texturing/shaders/common.h
>> index 49f38e8b5..3edc68bff 100644
>> --- a/tests/texturing/shaders/common.h
>> +++ b/tests/texturing/shaders/common.h
>> @@ -91,7 +91,8 @@ enum shader_target {
>>  UNKNOWN,
>>  VS,
>>  FS,
>> -GS
>> +GS,
>> +TES,
>>  };
>>  
>>  float max2(float x, float y);
>> diff --git a/tests/texturing/shaders/textureSize.c 
>> b/tests/texturing/shaders/textureSize.c
>> index 2693633fb..3035e0505 100644
>> --- a/tests/texturing/shaders/textureSize.c
>> +++ b/tests/texturing/shaders/textureSize.c
>> @@ -60,7 +60,7 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
>>  piglit_gl_process_args(, argv, );
>>  
>>  parse_args(argc, argv);
>> -if (test_stage == GS) {
>> +if (test_stage == GS || test_stage == TES) {
>>  config.supports_gl_compat_version = 32;
>>  config.supports_gl_core_version = 32;
>>  } else {
>> @@ -154,7 +154,7 @@ piglit_display()
>>  
>>  glUniform1i(lod_location, l);
>>  glViewport(x, 10, 10, 10);
>> -glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
>> +glDrawArrays(test_stage == TES ? GL_PATCHES : GL_TRIANGLE_FAN, 
>> 0, 4);
>>  
>>  pass &= piglit_probe_rect_rgba(x, 10, 10, 10, expected_color);
>>  }
>> @@ -248,12 +248,14 @@ has_lod(void)
>>  int
>>  generate_GLSL(enum shader_target test_stage)
>>  {
>> -int vs, gs = 0, fs;
>> +int vs, gs = 0, tes = 0, tcs = 0, fs;
>>  int prog;
>>  
>>  static char *vs_code;
>>  static char *gs_code = NULL;
>>  static char *fs_code;
>> +static char *tes_code = NULL;
>> +static char *tcs_code = NULL;
>>  char *lod_arg;
>>  static const char *zeroes[3] = { "", "0, ", "0, 0, " };
>>  
>> @@ -357,6 +359,55 @@ generate_GLSL(enum shader_target test_stage)
>>   shader_version, extension, sampler.name, size, lod_arg,
>>   zeroes[3 - size]);
>>  break;
>> +case TES:
>> +(void)!asprintf(_code,
>> + "#version %d\n"
>> + "in vec4 vertex;\n"
>> + "void main()\n"
>> + "{\n"
>> + "gl_Position = vertex;\n"
>> + "}\n",
>> + shader_version);
>> +(void)!asprintf(_code,
>> + "#version %d\n%s"
>> + "#extension GL_ARB_tessellation_shader: require\n"
>> + "#define ivec1 int\n"
>> + "uniform int lod;\n"
>> + "uniform %s tex;\n"
>> + "layout(quads) in;\n"
>> + "flat out ivec%d size;\n"
>> + "void main()\n"
>> + "{\n"
>> + "gl_Position = vec4(gl_TessCoord.x * 2 - 1, 
>> gl_TessCoord.y * 2 - 1, 0, 1);\n"
>> + "size = textureSize(tex%s);\n"
>> + "}\n",
>> + shader_version, extension, sampler.name, size, 
>> lod_arg);
>> +(void)!asprintf(_code,
>> + "#version %d\n"
>> + "#extension GL_ARB_tessellation_shader: require\n"
>> + "layout(vertices = 4) out;\n"
>> + "void main()\n"
>> + "{\n"
>> 

[Piglit] [PATCH] arb_texture_buffer_object/indexed: test indexed samplers with tbo

2018-01-03 Thread sroland
From: Roland Scheidegger 

This just verifies that sampler arrays indexed with a uniform work with TBOs.
(Broken on r600 evergreen pending a fix.)

v2: fix compiler warnings, directly assign index uniform in shader
---
 tests/all.py   |   1 +
 .../arb_texture_buffer_object/CMakeLists.gl.txt|   1 +
 tests/spec/arb_texture_buffer_object/indexed.c | 110 +
 3 files changed, 112 insertions(+)
 create mode 100644 tests/spec/arb_texture_buffer_object/indexed.c

diff --git a/tests/all.py b/tests/all.py
index ac1947ca4..0a1a65ef4 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -2483,6 +2483,7 @@ with profile.test_list.group_manager(
 g(['arb_texture_buffer_object-subdata-sync'], 'subdata-sync')
 g(['arb_texture_buffer_object-unused-name'], 'unused-name')
 g(['arb_texture_buffer_object-render-no-bo'], 'render-no-bo')
+g(['arb_texture_buffer_object-indexed'], 'indexed')
 
 with profile.test_list.group_manager(
 PiglitGLTest,
diff --git a/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt 
b/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
index ec0d0b463..959ca0c2f 100644
--- a/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
@@ -24,3 +24,4 @@ piglit_add_executable (arb_texture_buffer_object-render-no-bo 
render-no-bo.c)
 piglit_add_executable (arb_texture_buffer_object-subdata-sync subdata-sync.c)
 piglit_add_executable (arb_texture_buffer_object-unused-name unused-name.c)
 piglit_add_executable (arb_texture_buffer_object-fetch-outside-bounds 
fetch-outside-bounds.c)
+piglit_add_executable (arb_texture_buffer_object-indexed indexed.c)
diff --git a/tests/spec/arb_texture_buffer_object/indexed.c 
b/tests/spec/arb_texture_buffer_object/indexed.c
new file mode 100644
index 0..e62c246f3
--- /dev/null
+++ b/tests/spec/arb_texture_buffer_object/indexed.c
@@ -0,0 +1,110 @@
+/* Copyright © 2015 Ilia Mirkin
+ * Copyright © 2017 VMware, Inc.
+ *
+ * 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.
+ */
+
+/** @file indexed.c
+ *
+ * Tests that we can sample texture buffers with sampler indexing.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_core_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
+
+enum piglit_result
+piglit_display(void)
+{
+   static const float green[4] = {0, 1, 0, 0};
+   bool pass;
+
+   glViewport(0, 0, piglit_width, piglit_height);
+   glClearColor(0.2, 0.2, 0.2, 0.2);
+   glClear(GL_COLOR_BUFFER_BIT);
+
+   piglit_draw_rect(-1, -1, 2, 2);
+
+   pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height, green);
+
+   piglit_present_results();
+
+   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+   static const char *vs_source =
+   "#version 150\n"
+   "in vec4 piglit_vertex;\n"
+   "void main()\n"
+   "{\n"
+   "   gl_Position = piglit_vertex;\n"
+   "}\n";
+
+   static const char *fs_source =
+   "#version 150\n"
+   "#extension GL_ARB_gpu_shader5: require\n"
+   "uniform samplerBuffer s[2];\n"
+   "uniform int offset;\n"
+   "uniform int index = 1;\n"
+   "void main()\n"
+   "{\n"
+   "   gl_FragColor = texelFetch(s[index], offset);\n"
+   "}\n";
+
+   GLuint tex[2], tbo[2];
+   GLint indices[2] = { 0, 1 };
+   static const uint8_t datag[4] = {0x00, 0xff, 0x00, 0x00};
+   static const uint8_t datar[4] = {0xff, 0x00, 0x00, 0x00};
+   GLuint prog;
+   GLint size = 4;
+   

Re: [Piglit] [PATCH 0/3] cleanups for ATI_fs tests

2018-01-03 Thread Eric Anholt
Miklós Máté  writes:

> Please do so. These are nice cleanups.
>
> MM

I finally got around to pushing these.  Once again, thanks for your work
on this!


signature.asc
Description: PGP signature
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/2] textureSize: add ability to test tess eval stage

2018-01-03 Thread Fabian Bieler
I think the new tes-texture-size test should be added to all.py (in
multiple places).

Other than that, series is
Reviewed-by: Fabian Bieler 

On 2018-01-01 06:41, srol...@vmware.com wrote:
> From: Roland Scheidegger 
> 
> This is a problem of all texturing tests, they cannot exercise the tesselation
> stages. (But I'm too lazy to fix the others, and too lazy to hack something up
> for tcs stage, I only need it to verify a bug/fix with r600 buffer textures.)
> ---
>  tests/texturing/shaders/common.c  |  3 ++
>  tests/texturing/shaders/common.h  |  3 +-
>  tests/texturing/shaders/textureSize.c | 76 
> ---
>  3 files changed, 75 insertions(+), 7 deletions(-)
> 
> diff --git a/tests/texturing/shaders/common.c 
> b/tests/texturing/shaders/common.c
> index b377bbcae..bda149971 100644
> --- a/tests/texturing/shaders/common.c
> +++ b/tests/texturing/shaders/common.c
> @@ -378,6 +378,9 @@ require_GL_features(enum shader_target test_stage)
>   glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, _units);
>   if (test_stage == VS && tex_units <= 0)
>   piglit_report_result(PIGLIT_SKIP);
> +
> + if (test_stage == TES)
> + piglit_require_extension("GL_ARB_tessellation_shader");
>  }
>  
>  /**
> diff --git a/tests/texturing/shaders/common.h 
> b/tests/texturing/shaders/common.h
> index 49f38e8b5..3edc68bff 100644
> --- a/tests/texturing/shaders/common.h
> +++ b/tests/texturing/shaders/common.h
> @@ -91,7 +91,8 @@ enum shader_target {
>   UNKNOWN,
>   VS,
>   FS,
> - GS
> + GS,
> + TES,
>  };
>  
>  float max2(float x, float y);
> diff --git a/tests/texturing/shaders/textureSize.c 
> b/tests/texturing/shaders/textureSize.c
> index 2693633fb..3035e0505 100644
> --- a/tests/texturing/shaders/textureSize.c
> +++ b/tests/texturing/shaders/textureSize.c
> @@ -60,7 +60,7 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
>   piglit_gl_process_args(, argv, );
>  
>   parse_args(argc, argv);
> - if (test_stage == GS) {
> + if (test_stage == GS || test_stage == TES) {
>   config.supports_gl_compat_version = 32;
>   config.supports_gl_core_version = 32;
>   } else {
> @@ -154,7 +154,7 @@ piglit_display()
>  
>   glUniform1i(lod_location, l);
>   glViewport(x, 10, 10, 10);
> - glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
> + glDrawArrays(test_stage == TES ? GL_PATCHES : GL_TRIANGLE_FAN, 
> 0, 4);
>  
>   pass &= piglit_probe_rect_rgba(x, 10, 10, 10, expected_color);
>   }
> @@ -248,12 +248,14 @@ has_lod(void)
>  int
>  generate_GLSL(enum shader_target test_stage)
>  {
> - int vs, gs = 0, fs;
> + int vs, gs = 0, tes = 0, tcs = 0, fs;
>   int prog;
>  
>   static char *vs_code;
>   static char *gs_code = NULL;
>   static char *fs_code;
> + static char *tes_code = NULL;
> + static char *tcs_code = NULL;
>   char *lod_arg;
>   static const char *zeroes[3] = { "", "0, ", "0, 0, " };
>  
> @@ -357,6 +359,55 @@ generate_GLSL(enum shader_target test_stage)
>shader_version, extension, sampler.name, size, lod_arg,
>zeroes[3 - size]);
>   break;
> + case TES:
> + (void)!asprintf(_code,
> +  "#version %d\n"
> +  "in vec4 vertex;\n"
> +  "void main()\n"
> +  "{\n"
> +  "gl_Position = vertex;\n"
> +  "}\n",
> +  shader_version);
> + (void)!asprintf(_code,
> +  "#version %d\n%s"
> +  "#extension GL_ARB_tessellation_shader: require\n"
> +  "#define ivec1 int\n"
> +  "uniform int lod;\n"
> +  "uniform %s tex;\n"
> +  "layout(quads) in;\n"
> +  "flat out ivec%d size;\n"
> +  "void main()\n"
> +  "{\n"
> +  "gl_Position = vec4(gl_TessCoord.x * 2 - 1, 
> gl_TessCoord.y * 2 - 1, 0, 1);\n"
> +  "size = textureSize(tex%s);\n"
> +  "}\n",
> +  shader_version, extension, sampler.name, size, 
> lod_arg);
> + (void)!asprintf(_code,
> +  "#version %d\n"
> +  "#extension GL_ARB_tessellation_shader: require\n"
> +  "layout(vertices = 4) out;\n"
> +  "void main()\n"
> +  "{\n"
> +  "gl_TessLevelInner[0] = 1.0;\n"
> +  "gl_TessLevelInner[1] = 1.0;\n"
> +  "gl_TessLevelOuter[0] = 1.0;\n"
> +  "gl_TessLevelOuter[1] = 1.0;\n"
> +  "gl_TessLevelOuter[2] = 1.0;\n"
> +  "