Re: [Piglit] [PATCH] arb_enhanced_layouts: tests for duplicate layout identifiers

2016-01-19 Thread Matt Turner
On Thu, Jan 14, 2016 at 6:32 PM, Timothy Arceri
 wrote:
> Test results:
> Nvidia GeForce 840M - NVIDIA 352.41
>
> The results from the Nvidia binary are a little all over the place with these
> tests, most of the tests with arb_enhanced_layouts enabled fail but
> if the GLSL version is changed to 4.20 they pass.
> The only tests that pass with arb_enhanced_layouts enabled are the
> global tests but that seems to be because they do not detect the duplicates
> and fail the negative tests.
>
> Cc: Matt Turner 

Reviewed-by: Matt Turner 
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 2/2] Add glsl-fs-discard-only.shader_test

2016-01-19 Thread Ilia Mirkin
On Tue, Jan 19, 2016 at 3:33 PM, Nicolai Hähnle  wrote:
> On 19.01.2016 15:25, Ilia Mirkin wrote:
>>
>> On Tue, Jan 19, 2016 at 3:22 PM, Ilia Mirkin  wrote:
>>>
>>> On Tue, Jan 19, 2016 at 3:20 PM, Nicolai Hähnle 
>>> wrote:

 From: Nicolai Hähnle 

 Test a pure depth write with conditional discard in the fragment shader.
 This currently fails in radeonsi.

 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93761
 ---
   tests/shaders/glsl-fs-discard-only.shader_test | 26
 ++
   1 file changed, 26 insertions(+)
   create mode 100644 tests/shaders/glsl-fs-discard-only.shader_test

 diff --git a/tests/shaders/glsl-fs-discard-only.shader_test
 b/tests/shaders/glsl-fs-discard-only.shader_test
 new file mode 100644
 index 000..5585922
 --- /dev/null
 +++ b/tests/shaders/glsl-fs-discard-only.shader_test
 @@ -0,0 +1,26 @@
 +[require]
 +GLSL >= 1.10
 +depthbuffer
 +
 +[vertex shader]
>>>
>>>
>>> [vertex shader passthrough]
>
>
> Good point.
>
>> Oh, and this should probably go into tests/spec/glsl-1.10
>>
>> (hm, seems like piglit only has tests for discard starting glsl
>> 1.30... but I assume it was a feature in 1.10 too? odd.)
>
>
> There are more discard tests in tests/shaders, which is why I put that here.
> But sure, I can put this in tests/spec/glsl-1.10. Probably makes sense to
> move the others as well while I'm at it, what do you think?

Definitely not in this commit :) I don't really care, I just have
heard that there's a desire to avoid the tests/bunch-o-random-tests/
style directories, and am echo'ing it again. Categorizing those big
dirs sounds good to me too.

>
> Cheers,
> Nicolai
>
>
>>
>>>
 +void main()
 +{
 +   gl_Position = gl_Vertex;
 +}
 +
 +[fragment shader]
 +void main()
 +{
 +   if (gl_FragCoord.x < 10.0)
 +   discard;
 +}
 +
 +[test]
 +clear depth 1.0
 +clear
 +enable GL_DEPTH_TEST
 +draw rect -1 -1 2 2
 +probe depth 0 0 1.0
 +probe depth 9 0 1.0
 +probe depth 10 0 0.5
 +probe depth 11 0 0.5
 --
 2.5.0

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


Re: [Piglit] [PATCH 2/2] Add glsl-fs-discard-only.shader_test

2016-01-19 Thread Ilia Mirkin
On Tue, Jan 19, 2016 at 3:20 PM, Nicolai Hähnle  wrote:
> From: Nicolai Hähnle 
>
> Test a pure depth write with conditional discard in the fragment shader.
> This currently fails in radeonsi.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93761
> ---
>  tests/shaders/glsl-fs-discard-only.shader_test | 26 
> ++
>  1 file changed, 26 insertions(+)
>  create mode 100644 tests/shaders/glsl-fs-discard-only.shader_test
>
> diff --git a/tests/shaders/glsl-fs-discard-only.shader_test 
> b/tests/shaders/glsl-fs-discard-only.shader_test
> new file mode 100644
> index 000..5585922
> --- /dev/null
> +++ b/tests/shaders/glsl-fs-discard-only.shader_test
> @@ -0,0 +1,26 @@
> +[require]
> +GLSL >= 1.10
> +depthbuffer
> +
> +[vertex shader]

[vertex shader passthrough]

> +void main()
> +{
> +   gl_Position = gl_Vertex;
> +}
> +
> +[fragment shader]
> +void main()
> +{
> +   if (gl_FragCoord.x < 10.0)
> +   discard;
> +}
> +
> +[test]
> +clear depth 1.0
> +clear
> +enable GL_DEPTH_TEST
> +draw rect -1 -1 2 2
> +probe depth 0 0 1.0
> +probe depth 9 0 1.0
> +probe depth 10 0 0.5
> +probe depth 11 0 0.5
> --
> 2.5.0
>
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 2/2] Add glsl-fs-discard-only.shader_test

2016-01-19 Thread Nicolai Hähnle

On 19.01.2016 15:25, Ilia Mirkin wrote:

On Tue, Jan 19, 2016 at 3:22 PM, Ilia Mirkin  wrote:

On Tue, Jan 19, 2016 at 3:20 PM, Nicolai Hähnle  wrote:

From: Nicolai Hähnle 

Test a pure depth write with conditional discard in the fragment shader.
This currently fails in radeonsi.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93761
---
  tests/shaders/glsl-fs-discard-only.shader_test | 26 ++
  1 file changed, 26 insertions(+)
  create mode 100644 tests/shaders/glsl-fs-discard-only.shader_test

diff --git a/tests/shaders/glsl-fs-discard-only.shader_test 
b/tests/shaders/glsl-fs-discard-only.shader_test
new file mode 100644
index 000..5585922
--- /dev/null
+++ b/tests/shaders/glsl-fs-discard-only.shader_test
@@ -0,0 +1,26 @@
+[require]
+GLSL >= 1.10
+depthbuffer
+
+[vertex shader]


[vertex shader passthrough]


Good point.


Oh, and this should probably go into tests/spec/glsl-1.10

(hm, seems like piglit only has tests for discard starting glsl
1.30... but I assume it was a feature in 1.10 too? odd.)


There are more discard tests in tests/shaders, which is why I put that 
here. But sure, I can put this in tests/spec/glsl-1.10. Probably makes 
sense to move the others as well while I'm at it, what do you think?


Cheers,
Nicolai






+void main()
+{
+   gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+void main()
+{
+   if (gl_FragCoord.x < 10.0)
+   discard;
+}
+
+[test]
+clear depth 1.0
+clear
+enable GL_DEPTH_TEST
+draw rect -1 -1 2 2
+probe depth 0 0 1.0
+probe depth 9 0 1.0
+probe depth 10 0 0.5
+probe depth 11 0 0.5
--
2.5.0

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

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


Re: [Piglit] [PATCH 2/2] Add glsl-fs-discard-only.shader_test

2016-01-19 Thread Ilia Mirkin
On Tue, Jan 19, 2016 at 3:22 PM, Ilia Mirkin  wrote:
> On Tue, Jan 19, 2016 at 3:20 PM, Nicolai Hähnle  wrote:
>> From: Nicolai Hähnle 
>>
>> Test a pure depth write with conditional discard in the fragment shader.
>> This currently fails in radeonsi.
>>
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93761
>> ---
>>  tests/shaders/glsl-fs-discard-only.shader_test | 26 
>> ++
>>  1 file changed, 26 insertions(+)
>>  create mode 100644 tests/shaders/glsl-fs-discard-only.shader_test
>>
>> diff --git a/tests/shaders/glsl-fs-discard-only.shader_test 
>> b/tests/shaders/glsl-fs-discard-only.shader_test
>> new file mode 100644
>> index 000..5585922
>> --- /dev/null
>> +++ b/tests/shaders/glsl-fs-discard-only.shader_test
>> @@ -0,0 +1,26 @@
>> +[require]
>> +GLSL >= 1.10
>> +depthbuffer
>> +
>> +[vertex shader]
>
> [vertex shader passthrough]

Oh, and this should probably go into tests/spec/glsl-1.10

(hm, seems like piglit only has tests for discard starting glsl
1.30... but I assume it was a feature in 1.10 too? odd.)

>
>> +void main()
>> +{
>> +   gl_Position = gl_Vertex;
>> +}
>> +
>> +[fragment shader]
>> +void main()
>> +{
>> +   if (gl_FragCoord.x < 10.0)
>> +   discard;
>> +}
>> +
>> +[test]
>> +clear depth 1.0
>> +clear
>> +enable GL_DEPTH_TEST
>> +draw rect -1 -1 2 2
>> +probe depth 0 0 1.0
>> +probe depth 9 0 1.0
>> +probe depth 10 0 0.5
>> +probe depth 11 0 0.5
>> --
>> 2.5.0
>>
>> ___
>> Piglit mailing list
>> Piglit@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 1/2] shader_runner: add basic depthbuffer testing support

2016-01-19 Thread Nicolai Hähnle
From: Nicolai Hähnle 

This commit adds an optional 'depthbuffer' line to the [require]
section as well as the possibility of enabling/disabling GL_DEPTH_TEST
and probing depth values.
---
 tests/shaders/shader_runner.c | 21 -
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 431aa2a..6783b6f 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -1210,6 +1210,7 @@ struct requirement_parse_results {
bool found_gl;
bool found_glsl;
bool found_size;
+   bool found_depthbuffer;
struct component_version gl_version;
struct component_version glsl_version;
unsigned size[2];
@@ -1227,6 +1228,7 @@ parse_required_config(struct requirement_parse_results 
*results,
results->found_gl = false;
results->found_glsl = false;
results->found_size = false;
+   results->found_depthbuffer = false;
 
if (line == NULL) {
printf("could not read file \"%s\"\n", script_name);
@@ -1274,6 +1276,8 @@ parse_required_config(struct requirement_parse_results 
*results,
} else if (string_match("SIZE", line)) {
results->found_size = true;
get_uints(line+4, results->size, 2);
+   } else if (string_match("depthbuffer", line)) {
+   results->found_depthbuffer = true;
}
}
 
@@ -1330,7 +1334,7 @@ choose_required_gl_version(struct 
requirement_parse_results *parse_results,
  *
  * The requirements section can't be fully processed until after the context
  * is created, but the context can't be created until after the requirements
- * section is processed.  Do a quick can over the requirements section to find
+ * section is processed.  Do a quick scan over the requirements section to find
  * the GL and GLSL version requirements.  Use these to guide context creation.
  */
 void
@@ -1357,6 +1361,10 @@ get_required_config(const char *script_name,
} else {
config->supports_gl_compat_version = 10;
}
+
+   if (parse_results.found_depthbuffer) {
+   config->window_visual |= PIGLIT_GL_VISUAL_DEPTH;
+   }
 }
 
 void
@@ -2396,6 +2404,7 @@ static const struct string_to_enum enable_table[] = {
{ "GL_CLIP_PLANE7", GL_CLIP_PLANE0+7 },
{ "GL_VERTEX_PROGRAM_TWO_SIDE", GL_VERTEX_PROGRAM_TWO_SIDE },
{ "GL_PROGRAM_POINT_SIZE", GL_PROGRAM_POINT_SIZE },
+   { "GL_DEPTH_TEST", GL_DEPTH_TEST },
{ NULL, 0 }
 };
 
@@ -2759,6 +2768,10 @@ piglit_display(void)
get_floats(line + 11, c, 4);
glClearColor(c[0], c[1], c[2], c[3]);
clear_bits |= GL_COLOR_BUFFER_BIT;
+   } else if (string_match("clear depth", line)) {
+   get_floats(line + 11, c, 1);
+   glClearDepth(c[0]);
+   clear_bits |= GL_DEPTH_BUFFER_BIT;
} else if (string_match("clear", line)) {
glClear(clear_bits);
} else if (sscanf(line,
@@ -2933,6 +2946,12 @@ piglit_display(void)
& c[2])) {
pass = false;
}
+   } else if (string_match("probe depth", line)) {
+   get_floats(line + 11, c, 3);
+   if (!piglit_probe_pixel_depth((int) c[0], (int) c[1],
+ c[2])) {
+   pass = false;
+   }
} else if (sscanf(line,
  "probe atomic counter %d %s %d",
  , s, ) == 3) {
-- 
2.5.0

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


[Piglit] [PATCH 2/2] Add glsl-fs-discard-only.shader_test

2016-01-19 Thread Nicolai Hähnle
From: Nicolai Hähnle 

Test a pure depth write with conditional discard in the fragment shader.
This currently fails in radeonsi.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93761
---
 tests/shaders/glsl-fs-discard-only.shader_test | 26 ++
 1 file changed, 26 insertions(+)
 create mode 100644 tests/shaders/glsl-fs-discard-only.shader_test

diff --git a/tests/shaders/glsl-fs-discard-only.shader_test 
b/tests/shaders/glsl-fs-discard-only.shader_test
new file mode 100644
index 000..5585922
--- /dev/null
+++ b/tests/shaders/glsl-fs-discard-only.shader_test
@@ -0,0 +1,26 @@
+[require]
+GLSL >= 1.10
+depthbuffer
+
+[vertex shader]
+void main()
+{
+   gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+void main()
+{
+   if (gl_FragCoord.x < 10.0)
+   discard;
+}
+
+[test]
+clear depth 1.0
+clear
+enable GL_DEPTH_TEST
+draw rect -1 -1 2 2
+probe depth 0 0 1.0
+probe depth 9 0 1.0
+probe depth 10 0 0.5
+probe depth 11 0 0.5
-- 
2.5.0

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


Re: [Piglit] [PATCH 1/3 v2] arb_shader_subroutine: Compile a shader that calls a subroutine with a parameter

2016-01-19 Thread Ian Romanick
On 01/14/2016 11:27 PM, Dave Airlie wrote:
> On 15 January 2016 at 10:57, Ian Romanick  wrote:
>> From: Ian Romanick 
>>
>> NOTE: This test segfaults on Mesa.
> 
> btw does
> 
> http://cgit.freedesktop.org/~airlied/mesa/commit/?h=arb_gpu_shader_fp64-fixes=a183d4f5d0dd191f4c11a6f30c8850f2dbf11df3
> 
> help with it? I've had it sitting in my tree for ages, just haven't
> been motivated to send it yet.

Yes.  That makes this test pass.

For the sake of avoiding code duplication, I think it's better to make a
new overload of ir_call::clone that takes the callee parameter.  Then
implement the existing clone() as this->clone(mem_ctx, ht, this->callee).

> Dave.
> 
>> v2: Fix bad assignment to piglit_fragcolor that would have cause the
>> shader to not compile... if it didn't already segfault.  Noticed by
>> Ilia.  Also fix the type of func_type to match the functions and make
>> the test .frag (as originally intended).
>>
>> Signed-off-by: Ian Romanick 
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93722
>> Reviewed-by: Ilia Mirkin  [v1]
>> Cc: Dave Airlie 
>> Cc: Nicolas Koch 
>> ---
>>  .../compiler/call-param-match.frag | 29 
>> ++
>>  1 file changed, 29 insertions(+)
>>  create mode 100644 
>> tests/spec/arb_shader_subroutine/compiler/call-param-match.frag
>>
>> diff --git a/tests/spec/arb_shader_subroutine/compiler/call-param-match.frag 
>> b/tests/spec/arb_shader_subroutine/compiler/call-param-match.frag
>> new file mode 100644
>> index 000..a698d61
>> --- /dev/null
>> +++ b/tests/spec/arb_shader_subroutine/compiler/call-param-match.frag
>> @@ -0,0 +1,29 @@
>> +// [config]
>> +// expect_result: pass
>> +// glsl_version: 1.50
>> +// require_extensions: GL_ARB_shader_subroutine
>> +// [end config]
>> +
>> +#version 150
>> +#extension GL_ARB_shader_subroutine: require
>> +
>> +uniform vec4 u;
>> +out vec4 piglit_fragcolor;
>> +subroutine float func_type(vec4 color);
>> +
>> +subroutine uniform func_type f;
>> +
>> +subroutine(func_type) float R(vec4 p)
>> +{
>> +return p.r;
>> +}
>> +
>> +subroutine(func_type) float G(vec4 p)
>> +{
>> +return p.g;
>> +}
>> +
>> +void main()
>> +{
>> +piglit_fragcolor = vec4(f(u));
>> +}
>> --
>> 2.5.0
>>
>> ___
>> Piglit mailing list
>> Piglit@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/piglit
> 

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


Re: [Piglit] [PATCH v5 0/4] Use subprocess32 to provide thread safe timeouts

2016-01-19 Thread Dylan Baker
Quoting baker.dyla...@gmail.com (2015-12-16 16:52:48)
> From: Dylan Baker 
> 
> This is a pretty minor update to the v4. It adds a few comments, and
> fixes a (pretty serious) but that caused test classes with no timeout
> set to have a timeout of 0 seconds, instead of an unlimited timeout.
> 
> This is available at my github:
> https://github.com/dcbaker/piglit submit/subprocess32
> 
> Dylan Baker (4):
>   framework/tests: add helper for checking for 3rd party modules
>   framework/tests/base_tests.py: fix descriptions of two timeout tests
>   framework/tests/base_tests.py: use utils helper to simplify test
>   framework/test/base.py: use subprocess32 for timeouts.
> 
>  framework/test/base.py  | 144 
> ++--
>  framework/tests/base_tests.py   | 135 +++---
>  framework/tests/junit_backends_tests.py |   3 +-
>  framework/tests/utils.py|   9 ++
>  tox.ini |   2 +
>  5 files changed, 196 insertions(+), 97 deletions(-)
> 
> -- 
> 2.6.4
> 

I'm planning to push this in the next couple of days unless someone has
more comments.

Dylan


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


Re: [Piglit] [PATCH 3/8] texsubimage-depth-formats: add PBO option

2016-01-19 Thread Anuj Phogat
On Mon, Jan 18, 2016 at 1:40 PM, Nicolai Hähnle  wrote:
> From: Nicolai Hähnle 
>
> ---
>  tests/all.py|  1 +
>  tests/texturing/texsubimage-depth-formats.c | 37 
> +
>  2 files changed, 34 insertions(+), 4 deletions(-)
>
> diff --git a/tests/all.py b/tests/all.py
> index 1db8062..56b57fe 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -2289,6 +2289,7 @@ with profile.group_manager(
>  g(['texsubimage', 'pbo'])
>  g(['texsubimage', 'array', 'pbo'])
>  g(['texsubimage', 'cube_map_array', 'pbo'])
> +g(['texsubimage-depth-formats', 'pbo'])
>  g(['texsubimage-unpack', 'pbo'])
>
>  # Group ARB_provoking_vertex
> diff --git a/tests/texturing/texsubimage-depth-formats.c 
> b/tests/texturing/texsubimage-depth-formats.c
> index b6d9416..35263cb 100644
> --- a/tests/texturing/texsubimage-depth-formats.c
> +++ b/tests/texturing/texsubimage-depth-formats.c
> @@ -35,6 +35,8 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
>
>  PIGLIT_GL_TEST_CONFIG_END
>
> +static bool use_pbo = false;
> +
>  static GLuint tex[4];
>  struct size {
> int width, height;
> @@ -69,6 +71,7 @@ load_texture(int formats_idx, int tex_size_idx)
> unsigned n_pixels = w_by_2 * h_by_2;
> unsigned buffer_size = n_pixels * formats[formats_idx].size;
> void* texDepthData[4];
> +   GLuint buffer;
>
> for (i = 0; i < 4; i++)
> texDepthData[i] = malloc(buffer_size);
> @@ -127,18 +130,37 @@ load_texture(int formats_idx, int tex_size_idx)
> else
> glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
>
> +   if (use_pbo) {
> +   glGenBuffers(1, );
> +   glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffer);
> +   }
> +
> +   if (use_pbo)
> +   glBufferData(GL_PIXEL_UNPACK_BUFFER, buffer_size, 
> texDepthData[0], GL_STATIC_DRAW);
> glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w_by_2, h_by_2,
> formats[formats_idx].format, 
> formats[formats_idx].type,
> -   texDepthData[0]);
> +   use_pbo ? NULL : texDepthData[0]);
> +
> +   if (use_pbo)
> +   glBufferData(GL_PIXEL_UNPACK_BUFFER, buffer_size, 
> texDepthData[1], GL_STATIC_DRAW);
> glTexSubImage2D(GL_TEXTURE_2D, 0, w_by_2, 0, w_by_2, h_by_2,
> formats[formats_idx].format, 
> formats[formats_idx].type,
> -   texDepthData[1]);
> +   use_pbo ? NULL : texDepthData[1]);
> +
> +   if (use_pbo)
> +   glBufferData(GL_PIXEL_UNPACK_BUFFER, buffer_size, 
> texDepthData[2], GL_STATIC_DRAW);
> glTexSubImage2D(GL_TEXTURE_2D, 0, 0, h_by_2, w_by_2, h_by_2,
> formats[formats_idx].format, 
> formats[formats_idx].type,
> -   texDepthData[2]);
> +   use_pbo ? NULL : texDepthData[2]);
> +
> +   if (use_pbo)
> +   glBufferData(GL_PIXEL_UNPACK_BUFFER, buffer_size, 
> texDepthData[3], GL_STATIC_DRAW);
> glTexSubImage2D(GL_TEXTURE_2D, 0, w_by_2, h_by_2, w_by_2, h_by_2,
> formats[formats_idx].format, 
> formats[formats_idx].type,
> -   texDepthData[3]);
> +   use_pbo ? NULL : texDepthData[3]);
> +
> +   if (use_pbo)
> +   glDeleteBuffers(1, );
>
> for (i = 0; i < 4; i++)
> free(texDepthData[i]);
> @@ -147,6 +169,13 @@ load_texture(int formats_idx, int tex_size_idx)
>  void
>  piglit_init(int argc, char **argv)
>  {
> +   for (int i = 1; i < argc; ++i) {
> +   if (!strcmp(argv[i], "pbo")) {
> +   
> piglit_require_extension("GL_ARB_pixel_buffer_object");
> +   use_pbo = true;
> +   }
> +   }
> +
> piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
> glClearColor(0.0, 0.0, 0.0, 1.0);
>  }
> --
> 2.5.0
>
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit

Patches 3-8 are:
Reviewed-by: Anuj Phogat 
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] arb_shader_image_load_store: test duplicate format qualifier more thoroughly

2016-01-19 Thread Timothy Arceri
From the ARB_shader_image_load_store spec:

   "Only one format qualifier may be specified for any image variable
declaration."
---
 .../gen_shader_image_load_store_tests.py   | 15 +++
 ...aration-format-qualifier-duplicate-420pack.frag | 28 +
 ...aration-format-qualifier-duplicate-420pack.vert | 28 +
 ...ormat-qualifier-duplicate-enhanced-layouts.frag | 29 ++
 ...ormat-qualifier-duplicate-enhanced-layouts.vert | 29 ++
 5 files changed, 129 insertions(+)
 create mode 100644 
tests/spec/arb_shader_image_load_store/compiler/declaration-format-qualifier-duplicate-420pack.frag
 create mode 100644 
tests/spec/arb_shader_image_load_store/compiler/declaration-format-qualifier-duplicate-420pack.vert
 create mode 100644 
tests/spec/arb_shader_image_load_store/compiler/declaration-format-qualifier-duplicate-enhanced-layouts.frag
 create mode 100644 
tests/spec/arb_shader_image_load_store/compiler/declaration-format-qualifier-duplicate-enhanced-layouts.vert

diff --git a/generated_tests/gen_shader_image_load_store_tests.py 
b/generated_tests/gen_shader_image_load_store_tests.py
index 8d6be9c..ee27808 100644
--- a/generated_tests/gen_shader_image_load_store_tests.py
+++ b/generated_tests/gen_shader_image_load_store_tests.py
@@ -473,6 +473,21 @@ gen('declaration-format-qualifier-duplicate', """\
 }
 """, shader_stages)
 
+gen('declaration-format-qualifier-duplicate-within-layout', """\
+${header('fail')}
+/*
+ * From the ARB_shader_image_load_store spec:
+ *
+ * "Only one format qualifier may be specified for any image variable
+ *  declaration."
+ */
+layout(rgba32f, rgba32f) uniform image2D img;
+
+void main()
+{
+}
+""", shader_stages)
+
 gen('declaration-format-qualifier-missing', """\
 ${header(status)}
 /*
diff --git 
a/tests/spec/arb_shader_image_load_store/compiler/declaration-format-qualifier-duplicate-420pack.frag
 
b/tests/spec/arb_shader_image_load_store/compiler/declaration-format-qualifier-duplicate-420pack.frag
new file mode 100644
index 000..1ea3749
--- /dev/null
+++ 
b/tests/spec/arb_shader_image_load_store/compiler/declaration-format-qualifier-duplicate-420pack.frag
@@ -0,0 +1,28 @@
+/*
+ * [config]
+ * expect_result: fail
+ * glsl_version: 1.50
+ * require_extensions: GL_ARB_shader_image_load_store 
GL_ARB_shading_language_420pack
+ * [end config]
+ */
+#version 150
+#extension GL_ARB_shader_image_load_store: require
+#extension GL_ARB_shading_language_420pack: require
+
+/*
+ * From the ARB_shader_image_load_store spec:
+ *
+ *   "Only one format qualifier may be specified for any image variable
+ *declaration."
+ *
+ * From the ARB_shading_language_420pack spec:
+ *
+ *   "More than one layout qualifier may appear in a single declaration. If
+ *   the same layout-qualifier-name occurs in multiple layout qualifiers for
+ *   the same declaration, the last one overrides the former ones."
+ */
+layout(rgba32f) layout(rgba32f) uniform image2D img;
+
+void main()
+{
+}
diff --git 
a/tests/spec/arb_shader_image_load_store/compiler/declaration-format-qualifier-duplicate-420pack.vert
 
b/tests/spec/arb_shader_image_load_store/compiler/declaration-format-qualifier-duplicate-420pack.vert
new file mode 100644
index 000..1ea3749
--- /dev/null
+++ 
b/tests/spec/arb_shader_image_load_store/compiler/declaration-format-qualifier-duplicate-420pack.vert
@@ -0,0 +1,28 @@
+/*
+ * [config]
+ * expect_result: fail
+ * glsl_version: 1.50
+ * require_extensions: GL_ARB_shader_image_load_store 
GL_ARB_shading_language_420pack
+ * [end config]
+ */
+#version 150
+#extension GL_ARB_shader_image_load_store: require
+#extension GL_ARB_shading_language_420pack: require
+
+/*
+ * From the ARB_shader_image_load_store spec:
+ *
+ *   "Only one format qualifier may be specified for any image variable
+ *declaration."
+ *
+ * From the ARB_shading_language_420pack spec:
+ *
+ *   "More than one layout qualifier may appear in a single declaration. If
+ *   the same layout-qualifier-name occurs in multiple layout qualifiers for
+ *   the same declaration, the last one overrides the former ones."
+ */
+layout(rgba32f) layout(rgba32f) uniform image2D img;
+
+void main()
+{
+}
diff --git 
a/tests/spec/arb_shader_image_load_store/compiler/declaration-format-qualifier-duplicate-enhanced-layouts.frag
 
b/tests/spec/arb_shader_image_load_store/compiler/declaration-format-qualifier-duplicate-enhanced-layouts.frag
new file mode 100644
index 000..f1bb73d
--- /dev/null
+++ 
b/tests/spec/arb_shader_image_load_store/compiler/declaration-format-qualifier-duplicate-enhanced-layouts.frag
@@ -0,0 +1,29 @@
+/*
+ * [config]
+ * expect_result: fail
+ * glsl_version: 1.50
+ * require_extensions: GL_ARB_shader_image_load_store GL_ARB_enhanced_layouts
+ * [end config]
+ */
+#version 150
+#extension GL_ARB_shader_image_load_store: require
+#extension GL_ARB_enhanced_layouts: require
+

[Piglit] [PATCH V2] arb_shader_image_load_store: fix syntax error in execution tests

2016-01-19 Thread Timothy Arceri
In GLSL 1.50 layout qualifiers must come before the storage
qualifier. A recent fix in Mesa exposed this issue.

V2: rename IMAGE_T -> IMAGE_UNIFORM_T, fix DST/SRC_IMAGE_T miss in V1

Cc: Francisco Jerez 
---
 tests/spec/arb_shader_image_load_store/atomicity.c  | 2 +-
 tests/spec/arb_shader_image_load_store/bitcast.c| 2 +-
 tests/spec/arb_shader_image_load_store/coherency.c  | 4 ++--
 tests/spec/arb_shader_image_load_store/common.c | 8 
 tests/spec/arb_shader_image_load_store/dead-fragments.c | 2 +-
 tests/spec/arb_shader_image_load_store/early-z.c| 2 +-
 tests/spec/arb_shader_image_load_store/grid.c   | 6 +++---
 tests/spec/arb_shader_image_load_store/host-mem-barrier.c   | 4 ++--
 tests/spec/arb_shader_image_load_store/indexing.c   | 2 +-
 tests/spec/arb_shader_image_load_store/invalid.c| 2 +-
 tests/spec/arb_shader_image_load_store/layer.c  | 2 +-
 tests/spec/arb_shader_image_load_store/level.c  | 2 +-
 tests/spec/arb_shader_image_load_store/max-images.c | 2 +-
 tests/spec/arb_shader_image_load_store/max-size.c   | 4 ++--
 tests/spec/arb_shader_image_load_store/restrict.c   | 4 ++--
 tests/spec/arb_shader_image_load_store/semantics.c  | 4 ++--
 tests/spec/arb_shader_image_load_store/shader-mem-barrier.c | 2 +-
 tests/spec/arb_shader_image_load_store/state.c  | 2 +-
 tests/spec/arb_shader_image_load_store/unused.c | 2 +-
 19 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/tests/spec/arb_shader_image_load_store/atomicity.c 
b/tests/spec/arb_shader_image_load_store/atomicity.c
index 92e3afa..fe6bdb3 100644
--- a/tests/spec/arb_shader_image_load_store/atomicity.c
+++ b/tests/spec/arb_shader_image_load_store/atomicity.c
@@ -128,7 +128,7 @@ run_test(uint32_t init_value, unsigned check_sz, uint32_t 
check_value,
 GLuint prog = generate_program(
 grid, GL_FRAGMENT_SHADER,
 concat(image_hunk(img, ""),
-   hunk("volatile uniform IMAGE_T img;\n"),
+   hunk("volatile IMAGE_UNIFORM_T img;\n"),
hunk(op), NULL));
 bool ret = prog &&
 init_fb(grid) &&
diff --git a/tests/spec/arb_shader_image_load_store/bitcast.c 
b/tests/spec/arb_shader_image_load_store/bitcast.c
index ab04ca1..9180e79 100644
--- a/tests/spec/arb_shader_image_load_store/bitcast.c
+++ b/tests/spec/arb_shader_image_load_store/bitcast.c
@@ -126,7 +126,7 @@ run_test(const struct image_format_info *src_format,
 GLuint prog = generate_program(
 grid, GL_FRAGMENT_SHADER,
 concat(image_hunk(dst_img, ""),
-   hunk("uniform IMAGE_T img;\n"
+   hunk("IMAGE_UNIFORM_T img;\n"
 "\n"
 "GRID_T op(ivec2 idx, GRID_T x) {\n"
 "return imageLoad(img, IMAGE_ADDR(idx));\n"
diff --git a/tests/spec/arb_shader_image_load_store/coherency.c 
b/tests/spec/arb_shader_image_load_store/coherency.c
index 5a5bbdd..365e3ec 100644
--- a/tests/spec/arb_shader_image_load_store/coherency.c
+++ b/tests/spec/arb_shader_image_load_store/coherency.c
@@ -142,7 +142,7 @@ run_test(const struct image_qualifier_info *qual,
 stage_w->stage,
 concat(qualifier_hunk(qual),
image_hunk(img, ""),
-   hunk("IMAGE_Q uniform IMAGE_T img;\n"
+   hunk("IMAGE_Q IMAGE_UNIFORM_T img;\n"
 "\n"
 "GRID_T op(ivec2 idx, GRID_T x) {\n"
 "   imageStore(img, idx, DATA_T(11, 22, 33, 
44));"
@@ -158,7 +158,7 @@ run_test(const struct image_qualifier_info *qual,
 stage_r->stage,
 concat(qualifier_hunk(qual),
image_hunk(img, ""),
-   hunk("IMAGE_Q uniform IMAGE_T img;\n"
+   hunk("IMAGE_Q IMAGE_UNIFORM_T img;\n"
 "\n"
 "GRID_T op(ivec2 idx, GRID_T x) {\n"
 "   DATA_T v = imageLoad(img, idx);"
diff --git a/tests/spec/arb_shader_image_load_store/common.c 
b/tests/spec/arb_shader_image_load_store/common.c
index 3e56c22..f5a387a 100644
--- a/tests/spec/arb_shader_image_load_store/common.c
+++ b/tests/spec/arb_shader_image_load_store/common.c
@@ -286,8 +286,8 @@ upload_image_levels(const struct image_info img, unsigned 
num_levels,
 grid, GL_FRAGMENT_SHADER,
 concat(image_hunk(image_info_for_grid(grid), "SRC_"),
image_hunk(img, "DST_"),
-   hunk("readonly uniform SRC_IMAGE_T src_img;\n"
-"writeonly uniform DST_IMAGE_T 

[Piglit] [PATCH] arb_shader_image_load_store: fix syntax error in execution tests

2016-01-19 Thread Timothy Arceri
In GLSL 1.50 layout qualifiers must come before the storage
qualifier. A recent fix in Mesa exposed this issue.

Cc: Francisco Jerez 
---
 tests/spec/arb_shader_image_load_store/atomicity.c  | 2 +-
 tests/spec/arb_shader_image_load_store/bitcast.c| 2 +-
 tests/spec/arb_shader_image_load_store/coherency.c  | 4 ++--
 tests/spec/arb_shader_image_load_store/dead-fragments.c | 2 +-
 tests/spec/arb_shader_image_load_store/early-z.c| 2 +-
 tests/spec/arb_shader_image_load_store/grid.c   | 6 +++---
 tests/spec/arb_shader_image_load_store/host-mem-barrier.c   | 4 ++--
 tests/spec/arb_shader_image_load_store/indexing.c   | 2 +-
 tests/spec/arb_shader_image_load_store/invalid.c| 2 +-
 tests/spec/arb_shader_image_load_store/layer.c  | 2 +-
 tests/spec/arb_shader_image_load_store/level.c  | 2 +-
 tests/spec/arb_shader_image_load_store/max-images.c | 2 +-
 tests/spec/arb_shader_image_load_store/max-size.c   | 4 ++--
 tests/spec/arb_shader_image_load_store/restrict.c   | 4 ++--
 tests/spec/arb_shader_image_load_store/semantics.c  | 4 ++--
 tests/spec/arb_shader_image_load_store/shader-mem-barrier.c | 2 +-
 tests/spec/arb_shader_image_load_store/state.c  | 2 +-
 tests/spec/arb_shader_image_load_store/unused.c | 2 +-
 18 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/tests/spec/arb_shader_image_load_store/atomicity.c 
b/tests/spec/arb_shader_image_load_store/atomicity.c
index 92e3afa..577804d 100644
--- a/tests/spec/arb_shader_image_load_store/atomicity.c
+++ b/tests/spec/arb_shader_image_load_store/atomicity.c
@@ -128,7 +128,7 @@ run_test(uint32_t init_value, unsigned check_sz, uint32_t 
check_value,
 GLuint prog = generate_program(
 grid, GL_FRAGMENT_SHADER,
 concat(image_hunk(img, ""),
-   hunk("volatile uniform IMAGE_T img;\n"),
+   hunk("volatile IMAGE_T img;\n"),
hunk(op), NULL));
 bool ret = prog &&
 init_fb(grid) &&
diff --git a/tests/spec/arb_shader_image_load_store/bitcast.c 
b/tests/spec/arb_shader_image_load_store/bitcast.c
index ab04ca1..650e51c 100644
--- a/tests/spec/arb_shader_image_load_store/bitcast.c
+++ b/tests/spec/arb_shader_image_load_store/bitcast.c
@@ -126,7 +126,7 @@ run_test(const struct image_format_info *src_format,
 GLuint prog = generate_program(
 grid, GL_FRAGMENT_SHADER,
 concat(image_hunk(dst_img, ""),
-   hunk("uniform IMAGE_T img;\n"
+   hunk("IMAGE_T img;\n"
 "\n"
 "GRID_T op(ivec2 idx, GRID_T x) {\n"
 "return imageLoad(img, IMAGE_ADDR(idx));\n"
diff --git a/tests/spec/arb_shader_image_load_store/coherency.c 
b/tests/spec/arb_shader_image_load_store/coherency.c
index 5a5bbdd..e693452 100644
--- a/tests/spec/arb_shader_image_load_store/coherency.c
+++ b/tests/spec/arb_shader_image_load_store/coherency.c
@@ -142,7 +142,7 @@ run_test(const struct image_qualifier_info *qual,
 stage_w->stage,
 concat(qualifier_hunk(qual),
image_hunk(img, ""),
-   hunk("IMAGE_Q uniform IMAGE_T img;\n"
+   hunk("IMAGE_Q IMAGE_T img;\n"
 "\n"
 "GRID_T op(ivec2 idx, GRID_T x) {\n"
 "   imageStore(img, idx, DATA_T(11, 22, 33, 
44));"
@@ -158,7 +158,7 @@ run_test(const struct image_qualifier_info *qual,
 stage_r->stage,
 concat(qualifier_hunk(qual),
image_hunk(img, ""),
-   hunk("IMAGE_Q uniform IMAGE_T img;\n"
+   hunk("IMAGE_Q IMAGE_T img;\n"
 "\n"
 "GRID_T op(ivec2 idx, GRID_T x) {\n"
 "   DATA_T v = imageLoad(img, idx);"
diff --git a/tests/spec/arb_shader_image_load_store/dead-fragments.c 
b/tests/spec/arb_shader_image_load_store/dead-fragments.c
index d33fa02..e5cee28 100644
--- a/tests/spec/arb_shader_image_load_store/dead-fragments.c
+++ b/tests/spec/arb_shader_image_load_store/dead-fragments.c
@@ -183,7 +183,7 @@ run_test(const struct image_op_info *op,
 GLuint prog = generate_program(
 grid, GL_FRAGMENT_SHADER,
 concat(image_hunk(img, ""),
-   hunk("uniform IMAGE_T img;\n"),
+   hunk("IMAGE_T img;\n"),
hunk(op->hunk),
hunk(body), NULL));
 bool ret = prog &&
diff --git a/tests/spec/arb_shader_image_load_store/early-z.c 
b/tests/spec/arb_shader_image_load_store/early-z.c
index 2485602..29e1cb4 100644
--- 

Re: [Piglit] [PATCH] arb_shader_image_load_store: test duplicate format qualifier more thoroughly

2016-01-19 Thread Timothy Arceri
On Tue, 2016-01-19 at 18:08 -0800, Francisco Jerez wrote:
> Timothy Arceri  writes:
> 
> > From the ARB_shader_image_load_store spec:
> > 
> >"Only one format qualifier may be specified for any image
> > variable
> > declaration."
> > ---
> >  .../gen_shader_image_load_store_tests.py   | 15
> > +++
> >  ...aration-format-qualifier-duplicate-420pack.frag | 28
> > +
> >  ...aration-format-qualifier-duplicate-420pack.vert | 28
> > +
> >  ...ormat-qualifier-duplicate-enhanced-layouts.frag | 29
> > ++
> >  ...ormat-qualifier-duplicate-enhanced-layouts.vert | 29
> > ++
> 
> Can you comment on the usefulness of these last four tests?  At first
> glance it doesn't seem obvious why they provide any value over
> declaration-format-qualifier-duplicate or
> declaration-format-qualifier-duplicate-within-layout.

Sure.

ARB_enhanced_layouts

 Allows duplicates within a single layout qualifier e.g.

 layout(location = 0, location = 1) out vec4 a;

ARB_shading_language_420pack

 Allows multiple layout qualifiers e.g.

 layout(location = 0) layout(location = 2) out vec4 b;

However

layout(rgba32f, rgba32f) uniform image2D img;

and

layout(rgba32f) layout(rgba32f) uniform image2D img;

Should still fail when these extensions are enabled according to the
spec.

I can add this to the commit message if you like.

> 
> >  5 files changed, 129 insertions(+)
> >  create mode 100644
> > tests/spec/arb_shader_image_load_store/compiler/declaration-format
> > -qualifier-duplicate-420pack.frag
> >  create mode 100644
> > tests/spec/arb_shader_image_load_store/compiler/declaration-format
> > -qualifier-duplicate-420pack.vert
> >  create mode 100644
> > tests/spec/arb_shader_image_load_store/compiler/declaration-format
> > -qualifier-duplicate-enhanced-layouts.frag
> >  create mode 100644
> > tests/spec/arb_shader_image_load_store/compiler/declaration-format
> > -qualifier-duplicate-enhanced-layouts.vert
> > 
> > diff --git a/generated_tests/gen_shader_image_load_store_tests.py
> > b/generated_tests/gen_shader_image_load_store_tests.py
> > index 8d6be9c..ee27808 100644
> > --- a/generated_tests/gen_shader_image_load_store_tests.py
> > +++ b/generated_tests/gen_shader_image_load_store_tests.py
> > @@ -473,6 +473,21 @@ gen('declaration-format-qualifier-duplicate',
> > """\
> >  }
> >  """, shader_stages)
> >  
> > +gen('declaration-format-qualifier-duplicate-within-layout', """\
> > +${header('fail')}
> > +/*
> > + * From the ARB_shader_image_load_store spec:
> > + *
> > + * "Only one format qualifier may be specified for any image
> > variable
> > + *  declaration."
> > + */
> > +layout(rgba32f, rgba32f) uniform image2D img;
> > +
> > +void main()
> > +{
> > +}
> > +""", shader_stages)
> > +
> >  gen('declaration-format-qualifier-missing', """\
> >  ${header(status)}
> >  /*
> > diff --git
> > a/tests/spec/arb_shader_image_load_store/compiler/declaration
> > -format-qualifier-duplicate-420pack.frag
> > b/tests/spec/arb_shader_image_load_store/compiler/declaration
> > -format-qualifier-duplicate-420pack.frag
> > new file mode 100644
> > index 000..1ea3749
> > --- /dev/null
> > +++ b/tests/spec/arb_shader_image_load_store/compiler/declaration
> > -format-qualifier-duplicate-420pack.frag
> > @@ -0,0 +1,28 @@
> > +/*
> > + * [config]
> > + * expect_result: fail
> > + * glsl_version: 1.50
> > + * require_extensions: GL_ARB_shader_image_load_store
> > GL_ARB_shading_language_420pack
> > + * [end config]
> > + */
> > +#version 150
> > +#extension GL_ARB_shader_image_load_store: require
> > +#extension GL_ARB_shading_language_420pack: require
> > +
> > +/*
> > + * From the ARB_shader_image_load_store spec:
> > + *
> > + *   "Only one format qualifier may be specified for any image
> > variable
> > + *declaration."
> > + *
> > + * From the ARB_shading_language_420pack spec:
> > + *
> > + *   "More than one layout qualifier may appear in a single
> > declaration. If
> > + *   the same layout-qualifier-name occurs in multiple layout
> > qualifiers for
> > + *   the same declaration, the last one overrides the former
> > ones."
> > + */
> > +layout(rgba32f) layout(rgba32f) uniform image2D img;
> > +
> > +void main()
> > +{
> > +}
> > diff --git
> > a/tests/spec/arb_shader_image_load_store/compiler/declaration
> > -format-qualifier-duplicate-420pack.vert
> > b/tests/spec/arb_shader_image_load_store/compiler/declaration
> > -format-qualifier-duplicate-420pack.vert
> > new file mode 100644
> > index 000..1ea3749
> > --- /dev/null
> > +++ b/tests/spec/arb_shader_image_load_store/compiler/declaration
> > -format-qualifier-duplicate-420pack.vert
> > @@ -0,0 +1,28 @@
> > +/*
> > + * [config]
> > + * expect_result: fail
> > + * glsl_version: 1.50
> > + * require_extensions: GL_ARB_shader_image_load_store
> > GL_ARB_shading_language_420pack
> > + * [end 

Re: [Piglit] [PATCH] arb_shader_image_load_store: test duplicate format qualifier more thoroughly

2016-01-19 Thread Francisco Jerez
Timothy Arceri  writes:

> On Tue, 2016-01-19 at 18:08 -0800, Francisco Jerez wrote:
>> Timothy Arceri  writes:
>> 
>> > From the ARB_shader_image_load_store spec:
>> > 
>> >"Only one format qualifier may be specified for any image
>> > variable
>> > declaration."
>> > ---
>> >  .../gen_shader_image_load_store_tests.py   | 15
>> > +++
>> >  ...aration-format-qualifier-duplicate-420pack.frag | 28
>> > +
>> >  ...aration-format-qualifier-duplicate-420pack.vert | 28
>> > +
>> >  ...ormat-qualifier-duplicate-enhanced-layouts.frag | 29
>> > ++
>> >  ...ormat-qualifier-duplicate-enhanced-layouts.vert | 29
>> > ++
>> 
>> Can you comment on the usefulness of these last four tests?  At first
>> glance it doesn't seem obvious why they provide any value over
>> declaration-format-qualifier-duplicate or
>> declaration-format-qualifier-duplicate-within-layout.
>
> Sure.
>
> ARB_enhanced_layouts
>
>  Allows duplicates within a single layout qualifier e.g.
>
>  layout(location = 0, location = 1) out vec4 a;
>
> ARB_shading_language_420pack
>
>  Allows multiple layout qualifiers e.g.
>
>  layout(location = 0) layout(location = 2) out vec4 b;
>
> However
>
> layout(rgba32f, rgba32f) uniform image2D img;
>
> and
>
> layout(rgba32f) layout(rgba32f) uniform image2D img;
>
> Should still fail when these extensions are enabled according to the
> spec.
>
> I can add this to the commit message if you like.
>
That means that declaration-format-qualifier-duplicate-420pack.vert and
.frag are exactly the same as
declaration-format-qualifier-duplicate.vert and .frag except for the
additional extension enable, and the same goes for
declaration-format-qualifier-duplicate-enhanced-layouts.* vs
declaration-format-qualifier-duplicate-within-layout.*.  It would be
really nice in order to keep the source code size under control if you
could do this as is done in other image load/store compiler tests by
adding an '${extra_extensions}' placeholder right after the header in
the templates for declaration-format-qualifier-duplicate(-within-layout)
and then pass the two alternatives to the cartesian product.  It may
also be useful to explain in a comment above the placeholder why it's
interesting to test with and without the additional extension.

>> 
>> >  5 files changed, 129 insertions(+)
>> >  create mode 100644
>> > tests/spec/arb_shader_image_load_store/compiler/declaration-format
>> > -qualifier-duplicate-420pack.frag
>> >  create mode 100644
>> > tests/spec/arb_shader_image_load_store/compiler/declaration-format
>> > -qualifier-duplicate-420pack.vert
>> >  create mode 100644
>> > tests/spec/arb_shader_image_load_store/compiler/declaration-format
>> > -qualifier-duplicate-enhanced-layouts.frag
>> >  create mode 100644
>> > tests/spec/arb_shader_image_load_store/compiler/declaration-format
>> > -qualifier-duplicate-enhanced-layouts.vert
>> > 
>> > diff --git a/generated_tests/gen_shader_image_load_store_tests.py
>> > b/generated_tests/gen_shader_image_load_store_tests.py
>> > index 8d6be9c..ee27808 100644
>> > --- a/generated_tests/gen_shader_image_load_store_tests.py
>> > +++ b/generated_tests/gen_shader_image_load_store_tests.py
>> > @@ -473,6 +473,21 @@ gen('declaration-format-qualifier-duplicate',
>> > """\
>> >  }
>> >  """, shader_stages)
>> >  
>> > +gen('declaration-format-qualifier-duplicate-within-layout', """\
>> > +${header('fail')}
>> > +/*
>> > + * From the ARB_shader_image_load_store spec:
>> > + *
>> > + * "Only one format qualifier may be specified for any image
>> > variable
>> > + *  declaration."
>> > + */
>> > +layout(rgba32f, rgba32f) uniform image2D img;
>> > +
>> > +void main()
>> > +{
>> > +}
>> > +""", shader_stages)
>> > +
>> >  gen('declaration-format-qualifier-missing', """\
>> >  ${header(status)}
>> >  /*
>> > diff --git
>> > a/tests/spec/arb_shader_image_load_store/compiler/declaration
>> > -format-qualifier-duplicate-420pack.frag
>> > b/tests/spec/arb_shader_image_load_store/compiler/declaration
>> > -format-qualifier-duplicate-420pack.frag
>> > new file mode 100644
>> > index 000..1ea3749
>> > --- /dev/null
>> > +++ b/tests/spec/arb_shader_image_load_store/compiler/declaration
>> > -format-qualifier-duplicate-420pack.frag
>> > @@ -0,0 +1,28 @@
>> > +/*
>> > + * [config]
>> > + * expect_result: fail
>> > + * glsl_version: 1.50
>> > + * require_extensions: GL_ARB_shader_image_load_store
>> > GL_ARB_shading_language_420pack
>> > + * [end config]
>> > + */
>> > +#version 150
>> > +#extension GL_ARB_shader_image_load_store: require
>> > +#extension GL_ARB_shading_language_420pack: require
>> > +
>> > +/*
>> > + * From the ARB_shader_image_load_store spec:
>> > + *
>> > + *   "Only one format qualifier may be specified for any image
>> > variable
>> > + *declaration."
>> > + *
>> > + * 

Re: [Piglit] [PATCH] arb_shader_image_load_store: test duplicate format qualifier more thoroughly

2016-01-19 Thread Francisco Jerez
Timothy Arceri  writes:

> From the ARB_shader_image_load_store spec:
>
>"Only one format qualifier may be specified for any image variable
> declaration."
> ---
>  .../gen_shader_image_load_store_tests.py   | 15 +++
>  ...aration-format-qualifier-duplicate-420pack.frag | 28 +
>  ...aration-format-qualifier-duplicate-420pack.vert | 28 +
>  ...ormat-qualifier-duplicate-enhanced-layouts.frag | 29 
> ++
>  ...ormat-qualifier-duplicate-enhanced-layouts.vert | 29 
> ++

Can you comment on the usefulness of these last four tests?  At first
glance it doesn't seem obvious why they provide any value over
declaration-format-qualifier-duplicate or
declaration-format-qualifier-duplicate-within-layout.

>  5 files changed, 129 insertions(+)
>  create mode 100644 
> tests/spec/arb_shader_image_load_store/compiler/declaration-format-qualifier-duplicate-420pack.frag
>  create mode 100644 
> tests/spec/arb_shader_image_load_store/compiler/declaration-format-qualifier-duplicate-420pack.vert
>  create mode 100644 
> tests/spec/arb_shader_image_load_store/compiler/declaration-format-qualifier-duplicate-enhanced-layouts.frag
>  create mode 100644 
> tests/spec/arb_shader_image_load_store/compiler/declaration-format-qualifier-duplicate-enhanced-layouts.vert
>
> diff --git a/generated_tests/gen_shader_image_load_store_tests.py 
> b/generated_tests/gen_shader_image_load_store_tests.py
> index 8d6be9c..ee27808 100644
> --- a/generated_tests/gen_shader_image_load_store_tests.py
> +++ b/generated_tests/gen_shader_image_load_store_tests.py
> @@ -473,6 +473,21 @@ gen('declaration-format-qualifier-duplicate', """\
>  }
>  """, shader_stages)
>  
> +gen('declaration-format-qualifier-duplicate-within-layout', """\
> +${header('fail')}
> +/*
> + * From the ARB_shader_image_load_store spec:
> + *
> + * "Only one format qualifier may be specified for any image variable
> + *  declaration."
> + */
> +layout(rgba32f, rgba32f) uniform image2D img;
> +
> +void main()
> +{
> +}
> +""", shader_stages)
> +
>  gen('declaration-format-qualifier-missing', """\
>  ${header(status)}
>  /*
> diff --git 
> a/tests/spec/arb_shader_image_load_store/compiler/declaration-format-qualifier-duplicate-420pack.frag
>  
> b/tests/spec/arb_shader_image_load_store/compiler/declaration-format-qualifier-duplicate-420pack.frag
> new file mode 100644
> index 000..1ea3749
> --- /dev/null
> +++ 
> b/tests/spec/arb_shader_image_load_store/compiler/declaration-format-qualifier-duplicate-420pack.frag
> @@ -0,0 +1,28 @@
> +/*
> + * [config]
> + * expect_result: fail
> + * glsl_version: 1.50
> + * require_extensions: GL_ARB_shader_image_load_store 
> GL_ARB_shading_language_420pack
> + * [end config]
> + */
> +#version 150
> +#extension GL_ARB_shader_image_load_store: require
> +#extension GL_ARB_shading_language_420pack: require
> +
> +/*
> + * From the ARB_shader_image_load_store spec:
> + *
> + *   "Only one format qualifier may be specified for any image variable
> + *declaration."
> + *
> + * From the ARB_shading_language_420pack spec:
> + *
> + *   "More than one layout qualifier may appear in a single declaration. If
> + *   the same layout-qualifier-name occurs in multiple layout qualifiers for
> + *   the same declaration, the last one overrides the former ones."
> + */
> +layout(rgba32f) layout(rgba32f) uniform image2D img;
> +
> +void main()
> +{
> +}
> diff --git 
> a/tests/spec/arb_shader_image_load_store/compiler/declaration-format-qualifier-duplicate-420pack.vert
>  
> b/tests/spec/arb_shader_image_load_store/compiler/declaration-format-qualifier-duplicate-420pack.vert
> new file mode 100644
> index 000..1ea3749
> --- /dev/null
> +++ 
> b/tests/spec/arb_shader_image_load_store/compiler/declaration-format-qualifier-duplicate-420pack.vert
> @@ -0,0 +1,28 @@
> +/*
> + * [config]
> + * expect_result: fail
> + * glsl_version: 1.50
> + * require_extensions: GL_ARB_shader_image_load_store 
> GL_ARB_shading_language_420pack
> + * [end config]
> + */
> +#version 150
> +#extension GL_ARB_shader_image_load_store: require
> +#extension GL_ARB_shading_language_420pack: require
> +
> +/*
> + * From the ARB_shader_image_load_store spec:
> + *
> + *   "Only one format qualifier may be specified for any image variable
> + *declaration."
> + *
> + * From the ARB_shading_language_420pack spec:
> + *
> + *   "More than one layout qualifier may appear in a single declaration. If
> + *   the same layout-qualifier-name occurs in multiple layout qualifiers for
> + *   the same declaration, the last one overrides the former ones."
> + */
> +layout(rgba32f) layout(rgba32f) uniform image2D img;
> +
> +void main()
> +{
> +}
> diff --git 
> a/tests/spec/arb_shader_image_load_store/compiler/declaration-format-qualifier-duplicate-enhanced-layouts.frag
>  
> 

Re: [Piglit] [PATCH V2] arb_shader_image_load_store: fix syntax error in execution tests

2016-01-19 Thread Francisco Jerez
Timothy Arceri  writes:

> In GLSL 1.50 layout qualifiers must come before the storage
> qualifier. A recent fix in Mesa exposed this issue.
>
> V2: rename IMAGE_T -> IMAGE_UNIFORM_T, fix DST/SRC_IMAGE_T miss in V1
>
> Cc: Francisco Jerez 

Reviewed-by: Francisco Jerez 

> ---
>  tests/spec/arb_shader_image_load_store/atomicity.c  | 2 +-
>  tests/spec/arb_shader_image_load_store/bitcast.c| 2 +-
>  tests/spec/arb_shader_image_load_store/coherency.c  | 4 ++--
>  tests/spec/arb_shader_image_load_store/common.c | 8 
>  tests/spec/arb_shader_image_load_store/dead-fragments.c | 2 +-
>  tests/spec/arb_shader_image_load_store/early-z.c| 2 +-
>  tests/spec/arb_shader_image_load_store/grid.c   | 6 +++---
>  tests/spec/arb_shader_image_load_store/host-mem-barrier.c   | 4 ++--
>  tests/spec/arb_shader_image_load_store/indexing.c   | 2 +-
>  tests/spec/arb_shader_image_load_store/invalid.c| 2 +-
>  tests/spec/arb_shader_image_load_store/layer.c  | 2 +-
>  tests/spec/arb_shader_image_load_store/level.c  | 2 +-
>  tests/spec/arb_shader_image_load_store/max-images.c | 2 +-
>  tests/spec/arb_shader_image_load_store/max-size.c   | 4 ++--
>  tests/spec/arb_shader_image_load_store/restrict.c   | 4 ++--
>  tests/spec/arb_shader_image_load_store/semantics.c  | 4 ++--
>  tests/spec/arb_shader_image_load_store/shader-mem-barrier.c | 2 +-
>  tests/spec/arb_shader_image_load_store/state.c  | 2 +-
>  tests/spec/arb_shader_image_load_store/unused.c | 2 +-
>  19 files changed, 29 insertions(+), 29 deletions(-)
>
> diff --git a/tests/spec/arb_shader_image_load_store/atomicity.c 
> b/tests/spec/arb_shader_image_load_store/atomicity.c
> index 92e3afa..fe6bdb3 100644
> --- a/tests/spec/arb_shader_image_load_store/atomicity.c
> +++ b/tests/spec/arb_shader_image_load_store/atomicity.c
> @@ -128,7 +128,7 @@ run_test(uint32_t init_value, unsigned check_sz, uint32_t 
> check_value,
>  GLuint prog = generate_program(
>  grid, GL_FRAGMENT_SHADER,
>  concat(image_hunk(img, ""),
> -   hunk("volatile uniform IMAGE_T img;\n"),
> +   hunk("volatile IMAGE_UNIFORM_T img;\n"),
> hunk(op), NULL));
>  bool ret = prog &&
>  init_fb(grid) &&
> diff --git a/tests/spec/arb_shader_image_load_store/bitcast.c 
> b/tests/spec/arb_shader_image_load_store/bitcast.c
> index ab04ca1..9180e79 100644
> --- a/tests/spec/arb_shader_image_load_store/bitcast.c
> +++ b/tests/spec/arb_shader_image_load_store/bitcast.c
> @@ -126,7 +126,7 @@ run_test(const struct image_format_info *src_format,
>  GLuint prog = generate_program(
>  grid, GL_FRAGMENT_SHADER,
>  concat(image_hunk(dst_img, ""),
> -   hunk("uniform IMAGE_T img;\n"
> +   hunk("IMAGE_UNIFORM_T img;\n"
>  "\n"
>  "GRID_T op(ivec2 idx, GRID_T x) {\n"
>  "return imageLoad(img, 
> IMAGE_ADDR(idx));\n"
> diff --git a/tests/spec/arb_shader_image_load_store/coherency.c 
> b/tests/spec/arb_shader_image_load_store/coherency.c
> index 5a5bbdd..365e3ec 100644
> --- a/tests/spec/arb_shader_image_load_store/coherency.c
> +++ b/tests/spec/arb_shader_image_load_store/coherency.c
> @@ -142,7 +142,7 @@ run_test(const struct image_qualifier_info *qual,
>  stage_w->stage,
>  concat(qualifier_hunk(qual),
> image_hunk(img, ""),
> -   hunk("IMAGE_Q uniform IMAGE_T img;\n"
> +   hunk("IMAGE_Q IMAGE_UNIFORM_T img;\n"
>  "\n"
>  "GRID_T op(ivec2 idx, GRID_T x) {\n"
>  "   imageStore(img, idx, DATA_T(11, 22, 33, 
> 44));"
> @@ -158,7 +158,7 @@ run_test(const struct image_qualifier_info *qual,
>  stage_r->stage,
>  concat(qualifier_hunk(qual),
> image_hunk(img, ""),
> -   hunk("IMAGE_Q uniform IMAGE_T img;\n"
> +   hunk("IMAGE_Q IMAGE_UNIFORM_T img;\n"
>  "\n"
>  "GRID_T op(ivec2 idx, GRID_T x) {\n"
>  "   DATA_T v = imageLoad(img, idx);"
> diff --git a/tests/spec/arb_shader_image_load_store/common.c 
> b/tests/spec/arb_shader_image_load_store/common.c
> index 3e56c22..f5a387a 100644
> --- a/tests/spec/arb_shader_image_load_store/common.c
> +++ b/tests/spec/arb_shader_image_load_store/common.c
> @@ -286,8 +286,8 @@ upload_image_levels(const struct image_info img, unsigned 
> num_levels,
>  grid, GL_FRAGMENT_SHADER,
> 

Re: [Piglit] [PATCH] arb_shader_image_load_store: fix syntax error in execution tests

2016-01-19 Thread Francisco Jerez
Timothy Arceri  writes:

> In GLSL 1.50 layout qualifiers must come before the storage
> qualifier. A recent fix in Mesa exposed this issue.
>
Seems unfortunate that in order to work around that restriction you had
to hardcode the uniform storage qualifier in the IMAGE_T macro, because
images are allowed to be declared in contexts other than uniform
declarations and the macro was expected to be useful in such cases too.
Could you rename it to IMAGE_UNIFORM_T as part of this commit to make it
clear that it's no longer useful to declare non-uniform images?

> Cc: Francisco Jerez 
> ---
>  tests/spec/arb_shader_image_load_store/atomicity.c  | 2 +-
>  tests/spec/arb_shader_image_load_store/bitcast.c| 2 +-
>  tests/spec/arb_shader_image_load_store/coherency.c  | 4 ++--
>  tests/spec/arb_shader_image_load_store/dead-fragments.c | 2 +-
>  tests/spec/arb_shader_image_load_store/early-z.c| 2 +-
>  tests/spec/arb_shader_image_load_store/grid.c   | 6 +++---
>  tests/spec/arb_shader_image_load_store/host-mem-barrier.c   | 4 ++--
>  tests/spec/arb_shader_image_load_store/indexing.c   | 2 +-
>  tests/spec/arb_shader_image_load_store/invalid.c| 2 +-
>  tests/spec/arb_shader_image_load_store/layer.c  | 2 +-
>  tests/spec/arb_shader_image_load_store/level.c  | 2 +-
>  tests/spec/arb_shader_image_load_store/max-images.c | 2 +-
>  tests/spec/arb_shader_image_load_store/max-size.c   | 4 ++--
>  tests/spec/arb_shader_image_load_store/restrict.c   | 4 ++--
>  tests/spec/arb_shader_image_load_store/semantics.c  | 4 ++--
>  tests/spec/arb_shader_image_load_store/shader-mem-barrier.c | 2 +-
>  tests/spec/arb_shader_image_load_store/state.c  | 2 +-
>  tests/spec/arb_shader_image_load_store/unused.c | 2 +-
>  18 files changed, 25 insertions(+), 25 deletions(-)
>
> diff --git a/tests/spec/arb_shader_image_load_store/atomicity.c 
> b/tests/spec/arb_shader_image_load_store/atomicity.c
> index 92e3afa..577804d 100644
> --- a/tests/spec/arb_shader_image_load_store/atomicity.c
> +++ b/tests/spec/arb_shader_image_load_store/atomicity.c
> @@ -128,7 +128,7 @@ run_test(uint32_t init_value, unsigned check_sz, uint32_t 
> check_value,
>  GLuint prog = generate_program(
>  grid, GL_FRAGMENT_SHADER,
>  concat(image_hunk(img, ""),
> -   hunk("volatile uniform IMAGE_T img;\n"),
> +   hunk("volatile IMAGE_T img;\n"),
> hunk(op), NULL));
>  bool ret = prog &&
>  init_fb(grid) &&
> diff --git a/tests/spec/arb_shader_image_load_store/bitcast.c 
> b/tests/spec/arb_shader_image_load_store/bitcast.c
> index ab04ca1..650e51c 100644
> --- a/tests/spec/arb_shader_image_load_store/bitcast.c
> +++ b/tests/spec/arb_shader_image_load_store/bitcast.c
> @@ -126,7 +126,7 @@ run_test(const struct image_format_info *src_format,
>  GLuint prog = generate_program(
>  grid, GL_FRAGMENT_SHADER,
>  concat(image_hunk(dst_img, ""),
> -   hunk("uniform IMAGE_T img;\n"
> +   hunk("IMAGE_T img;\n"
>  "\n"
>  "GRID_T op(ivec2 idx, GRID_T x) {\n"
>  "return imageLoad(img, 
> IMAGE_ADDR(idx));\n"
> diff --git a/tests/spec/arb_shader_image_load_store/coherency.c 
> b/tests/spec/arb_shader_image_load_store/coherency.c
> index 5a5bbdd..e693452 100644
> --- a/tests/spec/arb_shader_image_load_store/coherency.c
> +++ b/tests/spec/arb_shader_image_load_store/coherency.c
> @@ -142,7 +142,7 @@ run_test(const struct image_qualifier_info *qual,
>  stage_w->stage,
>  concat(qualifier_hunk(qual),
> image_hunk(img, ""),
> -   hunk("IMAGE_Q uniform IMAGE_T img;\n"
> +   hunk("IMAGE_Q IMAGE_T img;\n"
>  "\n"
>  "GRID_T op(ivec2 idx, GRID_T x) {\n"
>  "   imageStore(img, idx, DATA_T(11, 22, 33, 
> 44));"
> @@ -158,7 +158,7 @@ run_test(const struct image_qualifier_info *qual,
>  stage_r->stage,
>  concat(qualifier_hunk(qual),
> image_hunk(img, ""),
> -   hunk("IMAGE_Q uniform IMAGE_T img;\n"
> +   hunk("IMAGE_Q IMAGE_T img;\n"
>  "\n"
>  "GRID_T op(ivec2 idx, GRID_T x) {\n"
>  "   DATA_T v = imageLoad(img, idx);"
> diff --git a/tests/spec/arb_shader_image_load_store/dead-fragments.c 
> b/tests/spec/arb_shader_image_load_store/dead-fragments.c
> index d33fa02..e5cee28 100644
> --- a/tests/spec/arb_shader_image_load_store/dead-fragments.c

Re: [Piglit] [PATCH] arb_shader_image_load_store: test duplicate format qualifier more thoroughly

2016-01-19 Thread Timothy Arceri
On Wed, 2016-01-20 at 13:27 +1100, Timothy Arceri wrote:
> On Tue, 2016-01-19 at 18:08 -0800, Francisco Jerez wrote:
> > Timothy Arceri  writes:
> > 
> > > From the ARB_shader_image_load_store spec:
> > > 
> > >"Only one format qualifier may be specified for any image
> > > variable
> > > declaration."
> > > ---
> > >  .../gen_shader_image_load_store_tests.py   | 15
> > > +++
> > >  ...aration-format-qualifier-duplicate-420pack.frag | 28
> > > +
> > >  ...aration-format-qualifier-duplicate-420pack.vert | 28
> > > +
> > >  ...ormat-qualifier-duplicate-enhanced-layouts.frag | 29
> > > ++
> > >  ...ormat-qualifier-duplicate-enhanced-layouts.vert | 29
> > > ++
> > 
> > Can you comment on the usefulness of these last four tests?  At
> > first
> > glance it doesn't seem obvious why they provide any value over
> > declaration-format-qualifier-duplicate or
> > declaration-format-qualifier-duplicate-within-layout.
> 
> Sure.
> 
> ARB_enhanced_layouts
> 
>  Allows duplicates within a single layout qualifier e.g.
> 
>  layout(location = 0, location = 1) out vec4 a;
> 
> ARB_shading_language_420pack
> 
>  Allows multiple layout qualifiers e.g.
> 
>  layout(location = 0) layout(location = 2) out vec4 b;
> 
> However
> 
> layout(rgba32f, rgba32f) uniform image2D img;
> 
> and
> 
> layout(rgba32f) layout(rgba32f) uniform image2D img;
> 
> Should still fail when these extensions are enabled according to the
> spec.
> 
> I can add this to the commit message if you like.

It might also help if I change:

From the ARB_shader_image_load_store spec: ->
From Section .. of the GLSL 4.50 spec:

In these tests.


> 
> > 
> > >  5 files changed, 129 insertions(+)
> > >  create mode 100644
> > > tests/spec/arb_shader_image_load_store/compiler/declaration
> > > -format
> > > -qualifier-duplicate-420pack.frag
> > >  create mode 100644
> > > tests/spec/arb_shader_image_load_store/compiler/declaration
> > > -format
> > > -qualifier-duplicate-420pack.vert
> > >  create mode 100644
> > > tests/spec/arb_shader_image_load_store/compiler/declaration
> > > -format
> > > -qualifier-duplicate-enhanced-layouts.frag
> > >  create mode 100644
> > > tests/spec/arb_shader_image_load_store/compiler/declaration
> > > -format
> > > -qualifier-duplicate-enhanced-layouts.vert
> > > 
> > > diff --git a/generated_tests/gen_shader_image_load_store_tests.py
> > > b/generated_tests/gen_shader_image_load_store_tests.py
> > > index 8d6be9c..ee27808 100644
> > > --- a/generated_tests/gen_shader_image_load_store_tests.py
> > > +++ b/generated_tests/gen_shader_image_load_store_tests.py
> > > @@ -473,6 +473,21 @@ gen('declaration-format-qualifier
> > > -duplicate',
> > > """\
> > >  }
> > >  """, shader_stages)
> > >  
> > > +gen('declaration-format-qualifier-duplicate-within-layout', """\
> > > +${header('fail')}
> > > +/*
> > > + * From the ARB_shader_image_load_store spec:
> > > + *
> > > + * "Only one format qualifier may be specified for any image
> > > variable
> > > + *  declaration."
> > > + */
> > > +layout(rgba32f, rgba32f) uniform image2D img;
> > > +
> > > +void main()
> > > +{
> > > +}
> > > +""", shader_stages)
> > > +
> > >  gen('declaration-format-qualifier-missing', """\
> > >  ${header(status)}
> > >  /*
> > > diff --git
> > > a/tests/spec/arb_shader_image_load_store/compiler/declaration
> > > -format-qualifier-duplicate-420pack.frag
> > > b/tests/spec/arb_shader_image_load_store/compiler/declaration
> > > -format-qualifier-duplicate-420pack.frag
> > > new file mode 100644
> > > index 000..1ea3749
> > > --- /dev/null
> > > +++ b/tests/spec/arb_shader_image_load_store/compiler/declaration
> > > -format-qualifier-duplicate-420pack.frag
> > > @@ -0,0 +1,28 @@
> > > +/*
> > > + * [config]
> > > + * expect_result: fail
> > > + * glsl_version: 1.50
> > > + * require_extensions: GL_ARB_shader_image_load_store
> > > GL_ARB_shading_language_420pack
> > > + * [end config]
> > > + */
> > > +#version 150
> > > +#extension GL_ARB_shader_image_load_store: require
> > > +#extension GL_ARB_shading_language_420pack: require
> > > +
> > > +/*
> > > + * From the ARB_shader_image_load_store spec:
> > > + *
> > > + *   "Only one format qualifier may be specified for any image
> > > variable
> > > + *declaration."
> > > + *
> > > + * From the ARB_shading_language_420pack spec:
> > > + *
> > > + *   "More than one layout qualifier may appear in a single
> > > declaration. If
> > > + *   the same layout-qualifier-name occurs in multiple layout
> > > qualifiers for
> > > + *   the same declaration, the last one overrides the former
> > > ones."
> > > + */
> > > +layout(rgba32f) layout(rgba32f) uniform image2D img;
> > > +
> > > +void main()
> > > +{
> > > +}
> > > diff --git
> > > a/tests/spec/arb_shader_image_load_store/compiler/declaration
> > > 

[Piglit] [PATCH] arb_shader_image_load_store: test duplicate format qualifier more thoroughly

2016-01-19 Thread Timothy Arceri
From the ARB_shader_image_load_store spec:

   "Only one format qualifier may be specified for any image variable
declaration."

ARB_enhanced_layouts

  Allows duplicates within a single layout qualifier e.g.

  layout(location = 0, location = 1) out vec4 a;

ARB_shading_language_420pack

  Allows multiple layout qualifiers e.g.

  layout(location = 0) layout(location = 2) out vec4 b;

However layout(rgba32f, rgba32f) uniform image2D img;
and layout(rgba32f) layout(rgba32f) uniform image2D img;

Should still fail when these extensions are enabled according to the
spec GLSL 4.5 spec.

Cc: Francisco Jerez 
---
 .../gen_shader_image_load_store_tests.py   | 39 ++
 1 file changed, 32 insertions(+), 7 deletions(-)

diff --git a/generated_tests/gen_shader_image_load_store_tests.py 
b/generated_tests/gen_shader_image_load_store_tests.py
index 8d6be9c..d52070c 100644
--- a/generated_tests/gen_shader_image_load_store_tests.py
+++ b/generated_tests/gen_shader_image_load_store_tests.py
@@ -29,24 +29,28 @@ from textwrap import dedent
 from modules import utils
 
 
-def gen_header(status):
+def gen_header(status, extra_extension=''):
 """
 Generate a GLSL program header.
 
 Generate header code for ARB_shader_image_load_store GLSL parser
 tests that are expected to give status as result.
 """
+extra_extension_s = ''
+if extra_extension != '':
+extra_extension_s = "#extension {0}: require".format(extra_extension)
 return dedent("""\
 /*
  * [config]
  * expect_result: {0}
  * glsl_version: 1.50
- * require_extensions: GL_ARB_shader_image_load_store
+ * require_extensions: GL_ARB_shader_image_load_store {1}
  * [end config]
  */
 #version 150
 #extension GL_ARB_shader_image_load_store: require
-""".format(status))
+{2}
+""".format(status, extra_extension, extra_extension_s))
 
 
 def gen_vector_type(scalar, dim):
@@ -458,20 +462,41 @@ gen('declaration-format-qualifier', """\
  'prefix': ''}
 ]))
 
-gen('declaration-format-qualifier-duplicate', """\
-${header('fail')}
+gen('declaration-format-qualifier', """\
+${header('fail', extra_extension)}
+${description}
 /*
  * From the ARB_shader_image_load_store spec:
  *
  * "Only one format qualifier may be specified for any image variable
  *  declaration."
  */
-layout(rgba32f) layout(rgba32f) uniform image2D img;
+${layout_qualifier} uniform image2D img;
 
 void main()
 {
 }
-""", shader_stages)
+""", product(shader_stages, [
+{'name': 'duplicate',
+ 'extra_extension': '',
+ 'description': '',
+ 'layout_qualifier': 'layout(rgba32f) layout(rgba32f)'},
+{'name': 'duplicate-420pack',
+ 'extra_extension': 'GL_ARB_shading_language_420pack',
+ 'description': '/* Check duplicates still fail with '
+ 'GL_ARB_shading_language_420pack \n * which allows multiple layout '
+ 'qualifers\n */',
+ 'layout_qualifier': 'layout(rgba32f) layout(rgba32f)'},
+{'name': 'duplicate-within-layout',
+ 'extra_extension': '',
+ 'description': '',
+ 'layout_qualifier': 'layout(rgba32f, rgba32f)'},
+{'name': 'duplicate-within-layout-enhanced-layouts',
+ 'extra_extension': 'GL_ARB_enhanced_layouts',
+ 'description': '/* Check duplicates still fail with ARB_enhanced_layouts'
+ ' \n * which allows duplicates in a single layout\n */',
+ 'layout_qualifier': 'layout(rgba32f, rgba32f)'}
+]))
 
 gen('declaration-format-qualifier-missing', """\
 ${header(status)}
-- 
2.4.3

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


Re: [Piglit] [PATCH] arb_shader_image_load_store: test duplicate format qualifier more thoroughly

2016-01-19 Thread Francisco Jerez
Timothy Arceri  writes:

> From the ARB_shader_image_load_store spec:
>
>"Only one format qualifier may be specified for any image variable
> declaration."
>
> ARB_enhanced_layouts
>
>   Allows duplicates within a single layout qualifier e.g.
>
>   layout(location = 0, location = 1) out vec4 a;
>
> ARB_shading_language_420pack
>
>   Allows multiple layout qualifiers e.g.
>
>   layout(location = 0) layout(location = 2) out vec4 b;
>
> However layout(rgba32f, rgba32f) uniform image2D img;
> and layout(rgba32f) layout(rgba32f) uniform image2D img;
>
> Should still fail when these extensions are enabled according to the
> spec GLSL 4.5 spec.
>
> Cc: Francisco Jerez 
> ---
>  .../gen_shader_image_load_store_tests.py   | 39 
> ++
>  1 file changed, 32 insertions(+), 7 deletions(-)
>
> diff --git a/generated_tests/gen_shader_image_load_store_tests.py 
> b/generated_tests/gen_shader_image_load_store_tests.py
> index 8d6be9c..d52070c 100644
> --- a/generated_tests/gen_shader_image_load_store_tests.py
> +++ b/generated_tests/gen_shader_image_load_store_tests.py
> @@ -29,24 +29,28 @@ from textwrap import dedent
>  from modules import utils
>  
>  
> -def gen_header(status):
> +def gen_header(status, extra_extension=''):
>  """
>  Generate a GLSL program header.
>  
>  Generate header code for ARB_shader_image_load_store GLSL parser
>  tests that are expected to give status as result.
>  """
> +extra_extension_s = ''
> +if extra_extension != '':
> +extra_extension_s = "#extension {0}: require".format(extra_extension)
>  return dedent("""\
>  /*
>   * [config]
>   * expect_result: {0}
>   * glsl_version: 1.50
> - * require_extensions: GL_ARB_shader_image_load_store
> + * require_extensions: GL_ARB_shader_image_load_store {1}
>   * [end config]
>   */
>  #version 150
>  #extension GL_ARB_shader_image_load_store: require
> -""".format(status))
> +{2}
> +""".format(status, extra_extension, extra_extension_s))
>  
>  

You can probably achieve the same more generally and readably by doing
something like:

| def gen_header(status, extra_extensions=[]):
[...]
| extensions = ['GL_ARB_shader_image_load_store'] + extra_extensions
| extension_enables = ['#extension {0}: require'.format(x) for x in 
extensions]
|
| return dedent("""\
| /*
|  * [config]
|  * expect_result: {0}
|  * glsl_version: 1.50
|  * require_extensions: {1}
|  * [end config]
|  */
|  #version 150
|  {2}
|  """).format(status, ' '.join(extensions), '\n'.join(extension_enables))

(note that I've swapped the order of application of dedent() with
respect to format() because the join of extension enables is not going
to give you indented text as result)

>  def gen_vector_type(scalar, dim):
> @@ -458,20 +462,41 @@ gen('declaration-format-qualifier', """\
>   'prefix': ''}
>  ]))
>  
> -gen('declaration-format-qualifier-duplicate', """\
> -${header('fail')}
> +gen('declaration-format-qualifier', """\
> +${header('fail', extra_extension)}
> +${description}

I wouldn't bother to pass a different description for each generated
subtest, it makes it kind of difficult to read the rationale from the
generator source.  I'd simply mention in the comment below that the same
test is repeated with different extension enables which have an
influence on whether duplicate layout qualifiers are considered valid...

>  /*
>   * From the ARB_shader_image_load_store spec:
>   *
>   * "Only one format qualifier may be specified for any image variable
>   *  declaration."
>   */
> -layout(rgba32f) layout(rgba32f) uniform image2D img;
> +${layout_qualifier} uniform image2D img;
>  
>  void main()
>  {
>  }
> -""", shader_stages)
> +""", product(shader_stages, [
> +{'name': 'duplicate',
> + 'extra_extension': '',
> + 'description': '',
> + 'layout_qualifier': 'layout(rgba32f) layout(rgba32f)'},
> +{'name': 'duplicate-420pack',
> + 'extra_extension': 'GL_ARB_shading_language_420pack',
> + 'description': '/* Check duplicates still fail with '
> + 'GL_ARB_shading_language_420pack \n * which allows multiple layout '
> + 'qualifers\n */',
> + 'layout_qualifier': 'layout(rgba32f) layout(rgba32f)'},
> +{'name': 'duplicate-within-layout',
> + 'extra_extension': '',
> + 'description': '',
> + 'layout_qualifier': 'layout(rgba32f, rgba32f)'},
> +{'name': 'duplicate-within-layout-enhanced-layouts',
> + 'extra_extension': 'GL_ARB_enhanced_layouts',
> + 'description': '/* Check duplicates still fail with 
> ARB_enhanced_layouts'
> + ' \n * which allows duplicates in a single layout\n */',
> + 'layout_qualifier': 'layout(rgba32f, rgba32f)'}
> +]))
>
You're 

[Piglit] [PATCH 06/21] arb_internalformat_query2: test for INTERNALFORMAT_{X}_TYPE pnames

2016-01-19 Thread Alejandro Piñeiro
From spec:

" INTERNALFORMAT_RED_TYPE
  INTERNALFORMAT_GREEN_TYPE
  INTERNALFORMAT_BLUE_TYPE
  INTERNALFORMAT_ALPHA_TYPE
  INTERNALFORMAT_DEPTH_TYPE
  INTERNALFORMAT_STENCIL_TYPE

  For uncompressed internal formats, queries for these values return
  the data type used to store the component.  For compressed internal
  formats the types returned specify how components are interpreted
  after decompression.  For textures this query returns the same
  information as querying GetTexLevelParameter{if}v for TEXTURE_*TYPE
  would return.  Possible values return include, NONE,
  SIGNED_NORMALIZED, UNSIGNED_NORMALIZED, FLOAT, INT, UNSIGNED_INT,
  representing missing, signed normalized fixed point, unsigned
  normalized fixed point, floating-point, signed unnormalized integer
  and unsigned unnormalized integer components. NONE is returned for
  all component types if the format is unsupported."

So this test calls GetInternalformat with INTERNALFORMAT_SUPPORTED:
  * If it is false, checks that the returned value is zero
  * If it is true, checks that all returned values are from that
specific set of values
  * If it is true, checks that all the values are the same that
GetTexLevelParameter

Tested on NVIDIA GeForce GTX 950 - NVIDIA 352.55: fails for the
same reasons that for INTERNALFORMAT_{X}_SIZE tests.
---
 tests/all.py   |   1 +
 .../arb_internalformat_query2/CMakeLists.gl.txt|   1 +
 .../internalformat-type-checks.c   | 212 +
 3 files changed, 214 insertions(+)
 create mode 100644 
tests/spec/arb_internalformat_query2/internalformat-type-checks.c

diff --git a/tests/all.py b/tests/all.py
index 53c268a..fc7cac3 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -3623,6 +3623,7 @@ with profile.group_manager(
 g(['arb_internalformat_query2-generic-pname-checks'], 'Individual most 
generic pname checks')
 g(['arb_internalformat_query2-samples-pnames'], 'SAMPLES and 
NUM_SAMPLE_COUNTS pname checks')
 g(['arb_internalformat_query2-internalformat-size-checks'], 'All 
INTERNALFORMAT__SIZE pname checks')
+g(['arb_internalformat_query2-internalformat-type-checks'], 'All 
INTERNALFORMAT__TYPE pname checks')
 
 with profile.group_manager(
 PiglitGLTest, grouptools.join('spec', 'arb_map_buffer_range')) as g:
diff --git a/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt 
b/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
index 465501b..d2f368d 100644
--- a/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
+++ b/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
@@ -12,5 +12,6 @@ piglit_add_executable (arb_internalformat_query2-api-errors 
api-errors.c)
 piglit_add_executable (arb_internalformat_query2-generic-pname-checks 
generic-pname-checks.c common.c)
 piglit_add_executable (arb_internalformat_query2-samples-pnames 
samples-pnames.c common.c)
 piglit_add_executable (arb_internalformat_query2-internalformat-size-checks 
internalformat-size-checks.c common.c)
+piglit_add_executable (arb_internalformat_query2-internalformat-type-checks 
internalformat-type-checks.c common.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_internalformat_query2/internalformat-type-checks.c 
b/tests/spec/arb_internalformat_query2/internalformat-type-checks.c
new file mode 100644
index 000..3fd3323
--- /dev/null
+++ b/tests/spec/arb_internalformat_query2/internalformat-type-checks.c
@@ -0,0 +1,212 @@
+/*
+ * Copyright © 2015 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.
+ */
+
+/**
+ * \file internalformat-type-checks.c
+ * Verify a handful of conditions required by the following pnames:
+ *   - INTERNALFORMAT_RED_TYPE
+ *   - INTERNALFORMAT_GREEN_TYPE
+ *   - INTERNALFORMAT_BLUE_TYPE
+ *   - INTERNALFORMAT_ALPHA_TYPE
+ *   - INTERNALFORMAT_DEPTH_TYPE
+ *   - INTERNALFORMAT_STENCIL_TYPE
+ */
+
+#include "common.h"
+

[Piglit] [PATCH 09/21] arb_internalformat_query2: check returned max-dimensions values against GetInteger

2016-01-19 Thread Alejandro Piñeiro
In addition to the previous checks, this checks that the returned
values when supported are the same that the ones you receive calling
GetIntegerv with equivalent pnames like GL_MAX_TEXTURE_SIZE,
GL_MAX_3D_TEXTURE_SIZE, etc.

All those are internal format-independent, meanwhile GetInternalformat
allows to specify the internal format. So in theory there is the
possibility of being different for some internal format. But in
practice, this is not happening on any driver at this moment. Query2
spec mentions this case:

"7) There some  which it makes no sense to be qualified by
 a per-format/target scope, how should we handle them?
 e.g. MAX_WIDTH and MAX_HEIGHT might be the same for all formats.
 e.g. properties like AUTO_GENERATE_MIPMAP and
 MANUAL_GENERATE_MIPMAP might depend only on the GL version.

 

 A) Just use this entry point as is, if there are no per-format or
 target differences, it is perfectly acceptable to have the
 implementation return the same information for all valid
 parameters. This does allow implementations to report caveats
 that may exist for some formats but not others, even though all
 formats/targets may be supported."

So at this point, taking into account the current implementation, it
makes sense to check against those values. Probably in the future this
check needs to be removed.

Tested on NVIDIA GeForce GTX 950 - NVIDIA 352.55: pass

Tested on 4.5.13399 on AMD Radeon (TM) R9 380 Series: fails:
  * For MAX_WIDTH:
* For 3d textures is returning MAX_TEXTURE_SIZE
* For texture buffers is returning crap. Different values for
  each internalformat, including negative values.
  * For MAX_HEIGHT:
* Ditto for 3d textures.
* For RENDERBUFFER and TEXTURE_2D_MULTISAMPLE_ARRAY is returning
  0 even for supported values.

Anyway, take into account that even the basic dimension test (0 for
unsupported) was failing on ATI proprietary drivers.
---
 .../arb_internalformat_query2/max-dimensions.c | 140 -
 1 file changed, 134 insertions(+), 6 deletions(-)

diff --git a/tests/spec/arb_internalformat_query2/max-dimensions.c 
b/tests/spec/arb_internalformat_query2/max-dimensions.c
index 08ce651..e74fd28 100644
--- a/tests/spec/arb_internalformat_query2/max-dimensions.c
+++ b/tests/spec/arb_internalformat_query2/max-dimensions.c
@@ -39,6 +39,33 @@
  *   the same as the MAX_HEIGHT. For 2D and cube array targets, the
  *   value returned is the same as the MAX_DEPTH."
  *
+ * Additionally it also checks that the returned values are the same
+ * that the ones you receive calling GetIntegerv with equivalent
+ * pnames like GL_MAX_TEXTURE_SIZE, GL_MAX_3D_TEXTURE_SIZE, etc.
+ *
+ * All those are internal format-independent, meanwhile
+ * GetInternalformat allows to specify the internal format. So in
+ * theory there is the possibility of being different for some
+ * internal format. But in practice, this is not happening on any
+ * driver at this moment. Query2 spec mentions this case:
+ *
+ *   "7) There some  which it makes no sense to be qualified
+ *by a per-format/target scope, how should we handle them?
+ *e.g. MAX_WIDTH and MAX_HEIGHT might be the same for all formats.
+ *e.g. properties like AUTO_GENERATE_MIPMAP and
+ *MANUAL_GENERATE_MIPMAP might depend only on the GL version.
+ *
+ *
+ *
+ *A) Just use this entry point as is, if there are no per-format
+ *or target differences, it is perfectly acceptable to have the
+ *implementation return the same information for all valid
+ *parameters. This does allow implementations to report caveats
+ *that may exist for some formats but not others, even though all
+ *formats/targets may be supported."
+ *
+ * So at this point, taking into account the current implementation,
+ * it makes sense to check against those values.
  */
 
 #include "common.h"
@@ -56,6 +83,84 @@ piglit_display(void)
return PIGLIT_FAIL;
 }
 
+/* Returns the equivalent GetInteger pname for a Getinternalformat
+ * pname/target combination. Values 0 due number of dimensions should
+ * be already filtered out */
+static GLenum
+equivalentPname(GLenum target,
+GLenum pname)
+{
+   switch (target) {
+   case GL_TEXTURE_1D:
+   case GL_TEXTURE_2D:
+case GL_TEXTURE_2D_MULTISAMPLE:
+   return GL_MAX_TEXTURE_SIZE;
+   case GL_TEXTURE_3D:
+   return GL_MAX_3D_TEXTURE_SIZE;
+   case GL_TEXTURE_CUBE_MAP_ARB:
+   return GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB;
+   case GL_TEXTURE_RECTANGLE:
+   return GL_MAX_RECTANGLE_TEXTURE_SIZE;
+   case GL_RENDERBUFFER_EXT:
+   return GL_MAX_RENDERBUFFER_SIZE_EXT;
+case GL_TEXTURE_1D_ARRAY:
+if (pname == GL_MAX_HEIGHT)
+return GL_MAX_ARRAY_TEXTURE_LAYERS;
+else
+return GL_MAX_TEXTURE_SIZE;
+case GL_TEXTURE_2D_ARRAY:

[Piglit] [PATCH 08/21] arb_internalformat_query2: max dimensions related checks

2016-01-19 Thread Alejandro Piñeiro
Add a check for the following pnames (a subtest for each one)

* MAX_WIDTH. From spec:
   "The maximum supported width for the resource is returned in
. For resources with only one-dimension, this one
dimension is considered the width. If the resource is unsupported,
zero is returned."

It is only tested that returns zero if not supported. It makes
sense to include it on this test because it is related to the
other max dimension pnames.

* MAX_HEIGHT. From spec:
   "The maximum supported height for the resource is returned in
. For resources with two or more dimensions, the second
dimension is considered the height. If the resource does not have
at least two dimensions, or if the resource is unsupported, zero
is returned."

  So in addition to the usual zero-test if not supported, it is tested
  that if the target has less that two dimensions, it returns zero
  too, even if supported.

* MAX_DEPTH: From spec:
   "The maximum supported depth for the resource is returned in
. For resources with three or more dimensions, the third
dimension is considered the depth. If the resource does not have
at least three dimensions, or if the resource is unsupported, zero
is returned.

  So in addition to the usual zero-test if not supported, it is tested
  that if the target has less that three dimensions, it returns zero
  too, even if supported.

* MAX_LAYERS: From spec:
   "The maximum supported number of layers for the resource is
returned in . For 1D array targets, the value returned is
the same as the MAX_HEIGHT. For 2D and cube array targets, the
value returned is the same as the MAX_DEPTH. If the resource does
not support layers, or if the resource is unsupported, zero is
returned."

  In addition to the usual zero-test if not supported, it is tested
  that the value returned is the same that the one returned by
  MAX_HEIGHT or MAX_DEPTH for the array texture targets.

Tested on NVIDIA GeForce GTX 950 - NVIDIA 352.55: passes.

Tested on 4.5.13399 on AMD Radeon (TM) R9 380 Series: the tests
doesn't pass for this ATI proprietary drivers for any of the
subtests. It returns a non-zero value for unsupported combinations.
---
 tests/all.py   |   1 +
 .../arb_internalformat_query2/CMakeLists.gl.txt|   2 +-
 .../arb_internalformat_query2/max-dimensions.c | 350 +
 3 files changed, 352 insertions(+), 1 deletion(-)
 create mode 100644 tests/spec/arb_internalformat_query2/max-dimensions.c

diff --git a/tests/all.py b/tests/all.py
index 9ebdeb1..7bcc892 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -3625,6 +3625,7 @@ with profile.group_manager(
 g(['arb_internalformat_query2-internalformat-size-checks'], 'All 
INTERNALFORMAT__SIZE pname checks')
 g(['arb_internalformat_query2-internalformat-type-checks'], 'All 
INTERNALFORMAT__TYPE pname checks')
 g(['arb_internalformat_query2-image-format-compatibility-type'], 
'IMAGE_FORMAT_COMPATIBILITY_TYPE pname checks')
+g(['arb_internalformat_query2-max-dimensions'], 'Max dimensions related 
pname checks')
 
 with profile.group_manager(
 PiglitGLTest, grouptools.join('spec', 'arb_map_buffer_range')) as g:
diff --git a/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt 
b/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
index 93a84ad..73e14f6 100644
--- a/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
+++ b/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
@@ -14,5 +14,5 @@ piglit_add_executable 
(arb_internalformat_query2-samples-pnames samples-pnames.c
 piglit_add_executable (arb_internalformat_query2-internalformat-size-checks 
internalformat-size-checks.c common.c)
 piglit_add_executable (arb_internalformat_query2-internalformat-type-checks 
internalformat-type-checks.c common.c)
 piglit_add_executable 
(arb_internalformat_query2-image-format-compatibility-type 
image-format-compatibility-type.c common.c)
-
+piglit_add_executable (arb_internalformat_query2-max-dimensions 
max-dimensions.c common.c)
 # vim: ft=cmake:
diff --git a/tests/spec/arb_internalformat_query2/max-dimensions.c 
b/tests/spec/arb_internalformat_query2/max-dimensions.c
new file mode 100644
index 000..08ce651
--- /dev/null
+++ b/tests/spec/arb_internalformat_query2/max-dimensions.c
@@ -0,0 +1,350 @@
+/*
+ * Copyright © 2015 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 

[Piglit] [PATCH 13/21] arb_internalformat_query2: add a generic check for TEXTURE_IMAGE_TYPE

2016-01-19 Thread Alejandro Piñeiro
 "TEXTURE_IMAGE_TYPE:
  
  Possible values include any value that is legal to pass for the
   parameter to the Tex*Image*D commands, or NONE if the
  resource is not supported for this operation."

Tested on NVIDIA GeForce GTX 950 - NVIDIA 352.55: pass.
---
 .../generic-pname-checks.c | 54 ++
 1 file changed, 54 insertions(+)

diff --git a/tests/spec/arb_internalformat_query2/generic-pname-checks.c 
b/tests/spec/arb_internalformat_query2/generic-pname-checks.c
index 606aa69..f5729e7 100644
--- a/tests/spec/arb_internalformat_query2/generic-pname-checks.c
+++ b/tests/spec/arb_internalformat_query2/generic-pname-checks.c
@@ -188,6 +188,55 @@ static GLint possible_values_texture_image_format[] = {
 GL_NONE
 };
 
+/*
+ * From query2 spec:
+ *
+ * "TEXTURE_IMAGE_TYPE:
+ * 
+ * Possible values include any value that is legal to pass for the
+ *  parameter to the Tex*Image*D commands, or NONE if the
+ * resource is not supported for this operation."
+ *
+ * From 4.2 core spec:
+ * "TexImage3D
+ * 
+ * format, type, and data specify the format of the image data, the
+ * type of those data, and a reference to the image data in the cur-
+ * rently bound pixel unpack buffer or client memory, as described in
+ * section 3.7.2. The format STENCIL_INDEX is not allowed."
+ *
+ * This is basically Table 3.2 (defined at section 3.7.2)
+ */
+static GLint possible_values_texture_image_type[] = {
+/* Table 3.2 */
+GL_UNSIGNED_BYTE,
+GL_BYTE,
+GL_UNSIGNED_SHORT,
+GL_SHORT,
+GL_UNSIGNED_INT,
+GL_INT,
+GL_HALF_FLOAT,
+GL_FLOAT,
+GL_UNSIGNED_BYTE_3_3_2,
+GL_UNSIGNED_BYTE_2_3_3_REV,
+GL_UNSIGNED_SHORT_5_6_5,
+GL_UNSIGNED_SHORT_5_6_5_REV,
+GL_UNSIGNED_SHORT_4_4_4_4,
+GL_UNSIGNED_SHORT_4_4_4_4_REV,
+GL_UNSIGNED_SHORT_5_5_5_1,
+GL_UNSIGNED_SHORT_1_5_5_5_REV,
+GL_UNSIGNED_INT_8_8_8_8,
+GL_UNSIGNED_INT_8_8_8_8_REV,
+GL_UNSIGNED_INT_10_10_10_2,
+GL_UNSIGNED_INT_2_10_10_10_REV,
+GL_UNSIGNED_INT_24_8,
+GL_UNSIGNED_INT_10F_11F_11F_REV,
+GL_UNSIGNED_INT_5_9_9_9_REV,
+GL_FLOAT_32_UNSIGNED_INT_24_8_REV,
+/* GL_NONE from query2 TEXTURE_IMAGE_TYPE spec */
+GL_NONE
+};
+
 enum piglit_result
 piglit_display(void)
 {
@@ -279,5 +328,10 @@ piglit_init(int argc, char **argv)
ARRAY_SIZE(possible_values_texture_image_format))
 && pass;
 
+pname = GL_TEXTURE_IMAGE_TYPE;
+pass = check_basic(, 1, possible_values_texture_image_type,
+   ARRAY_SIZE(possible_values_texture_image_type))
+&& pass;
+
 piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
 }
-- 
2.1.4

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


[Piglit] [PATCH 03/21] arb_internalformat_query2: test for the most generic pname checks

2016-01-19 Thread Alejandro Piñeiro
The spec includes conditions for all the pnames. On most cases, it is
generic like this:

 "Possible values returned are . If the resource is not
  supported, or if the operation is not supported, NONE is
  returned."

So this test checks that for those pnames:
 * If it is not supported (using INTERNALFORMAT_SUPPORTED), the
   returned value is zero.
 * If it is supported, and there is available a list of possible
   values, the returned value is among one of those values.

Tested on NVIDIA GeForce GTX 950 - NVIDIA 352.55: most of them passes,
except:

* IMAGE_TEXEL_SIZE
  From spec:
  The size of a texel when the resource when used as an image
  texture is returned in .  This is the value from the
  /Size/ column in Table 3.22. If the resource is not supported
  for image textures, or if image textures are not supported, zero
  is returned.

  NVIDIA proprietary drivers returns 1, 2 or 4, a values not present on Table 
3.22.

* IMAGE_PIXEL_TYPE:
  From spec:
  The pixel type of the resource when used as an image texture is
  returned in .  This is the value from the /Pixel type/
  column in Table 3.22. If the resource is not supported for image
  textures, or if image textures are not supported, NONE is
  returned.

  NVIDIA proprietary drivers returns in some cases
  GL_UNSIGNED_INT_8_8_8_8_REV, that although defined on core spec 4.2,
  it is not included on Table 3.22

* IMAGE_PIXEL_FORMAT:
  From spec:
  The pixel format of the resource when used as an image texture
  is returned in .  This is the value from the /Pixel
  format/ column in Table 3.22. If the resource is not supported
  for image textures, or if image textures are not supported, NONE
  is returned.

  NVIDIA proprietary drivers returns in some cases GL_R11F_G11F_B10F,
  that although defined on core spec 4.2, it is not included on Table
  3.22
---
 tests/all.py   |   1 +
 .../arb_internalformat_query2/CMakeLists.gl.txt|   1 +
 tests/spec/arb_internalformat_query2/common.c  | 314 +
 tests/spec/arb_internalformat_query2/common.h  |  48 +++-
 .../generic-pname-checks.c | 235 +++
 5 files changed, 598 insertions(+), 1 deletion(-)
 create mode 100644 tests/spec/arb_internalformat_query2/common.c
 create mode 100644 tests/spec/arb_internalformat_query2/generic-pname-checks.c

diff --git a/tests/all.py b/tests/all.py
index 3911099..ff57f3b 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -3620,6 +3620,7 @@ with profile.group_manager(
 PiglitGLTest,
 grouptools.join('spec', 'arb_internalformat_query2')) as g:
 g(['arb_internalformat_query2-api-errors'], 'API error checks')
+g(['arb_internalformat_query2-generic-pname-checks'], 'Individual most 
generic pname checks')
 
 with profile.group_manager(
 PiglitGLTest, grouptools.join('spec', 'arb_map_buffer_range')) as g:
diff --git a/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt 
b/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
index 7a0e857..cd3b07e 100644
--- a/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
+++ b/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
@@ -9,5 +9,6 @@ link_libraries (
 )
 
 piglit_add_executable (arb_internalformat_query2-api-errors api-errors.c)
+piglit_add_executable (arb_internalformat_query2-generic-pname-checks 
generic-pname-checks.c common.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_internalformat_query2/common.c 
b/tests/spec/arb_internalformat_query2/common.c
new file mode 100644
index 000..99ea485
--- /dev/null
+++ b/tests/spec/arb_internalformat_query2/common.c
@@ -0,0 +1,314 @@
+/*
+ * Copyright © 2015 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 "common.h"
+#include   /* for PRIu64 macro */
+
+/* Generic callback type, doing a 

[Piglit] [PATCH 07/21] arb_internalformat_query2: IMAGE_FORMAT_COMPATIBILITY_TYPE test

2016-01-19 Thread Alejandro Piñeiro
From spec:
   "IMAGE_FORMAT_COMPATIBILITY_TYPE: The matching criteria use for the
resource when used as an image textures is returned in
. This is equivalent to calling GetTexParameter with
 set to IMAGE_FORMAT_COMPATIBILITY_TYPE. Possible values
are IMAGE_FORMAT_COMPATIBILITY_BY_SIZE or
IMAGE_FORMAT_COMPATIBILITY_BY_CLASS.  If the resource is not
supported for image textures, or if image textures are not
supported, NONE is returned."

Tested on NVIDIA GeForce GTX 950 - NVIDIA 352.55: fails for the same
reasons it fails for INTERNALFORMAT_{X}_SIZE and INTERNALFORMAT_{X}_TYPE.
---
 tests/all.py   |   1 +
 .../arb_internalformat_query2/CMakeLists.gl.txt|   1 +
 .../image-format-compatibility-type.c  | 172 +
 3 files changed, 174 insertions(+)
 create mode 100644 
tests/spec/arb_internalformat_query2/image-format-compatibility-type.c

diff --git a/tests/all.py b/tests/all.py
index fc7cac3..9ebdeb1 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -3624,6 +3624,7 @@ with profile.group_manager(
 g(['arb_internalformat_query2-samples-pnames'], 'SAMPLES and 
NUM_SAMPLE_COUNTS pname checks')
 g(['arb_internalformat_query2-internalformat-size-checks'], 'All 
INTERNALFORMAT__SIZE pname checks')
 g(['arb_internalformat_query2-internalformat-type-checks'], 'All 
INTERNALFORMAT__TYPE pname checks')
+g(['arb_internalformat_query2-image-format-compatibility-type'], 
'IMAGE_FORMAT_COMPATIBILITY_TYPE pname checks')
 
 with profile.group_manager(
 PiglitGLTest, grouptools.join('spec', 'arb_map_buffer_range')) as g:
diff --git a/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt 
b/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
index d2f368d..93a84ad 100644
--- a/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
+++ b/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
@@ -13,5 +13,6 @@ piglit_add_executable 
(arb_internalformat_query2-generic-pname-checks generic-pn
 piglit_add_executable (arb_internalformat_query2-samples-pnames 
samples-pnames.c common.c)
 piglit_add_executable (arb_internalformat_query2-internalformat-size-checks 
internalformat-size-checks.c common.c)
 piglit_add_executable (arb_internalformat_query2-internalformat-type-checks 
internalformat-type-checks.c common.c)
+piglit_add_executable 
(arb_internalformat_query2-image-format-compatibility-type 
image-format-compatibility-type.c common.c)
 
 # vim: ft=cmake:
diff --git 
a/tests/spec/arb_internalformat_query2/image-format-compatibility-type.c 
b/tests/spec/arb_internalformat_query2/image-format-compatibility-type.c
new file mode 100644
index 000..a34491d
--- /dev/null
+++ b/tests/spec/arb_internalformat_query2/image-format-compatibility-type.c
@@ -0,0 +1,172 @@
+/*
+ * Copyright © 2015 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.
+ */
+
+/**
+ * \file image-format-compatibility-type.c
+ *
+ * Verify conditions defined for IMAGE_FORMAT_COMPATIBILITY_TYPE pname.
+ *
+ */
+
+#include "common.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 10;
+   config.window_visual = PIGLIT_GL_VISUAL_RGB;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+   return PIGLIT_FAIL;
+}
+
+static GLint
+get_tex_parameter_value(const GLenum target,
+const GLenum internalformat)
+{
+bool has_texture;
+GLuint tex;
+GLuint buffer;
+GLint param;
+
+has_texture = create_texture(target, internalformat, , );
+if (!has_texture) {
+return GL_NONE;
+}
+
+glGetTexParameteriv(target, GL_IMAGE_FORMAT_COMPATIBILITY_TYPE, 
);
+
+glDeleteTextures(1, );
+glDeleteBuffers(1, );
+
+return param;
+}
+
+/* From the spec:
+ *
+ * "- IMAGE_FORMAT_COMPATIBILITY_TYPE: The matching 

[Piglit] [PATCH 02/21] arb_internalformat_query2: query2 api-error check

2016-01-19 Thread Alejandro Piñeiro
Similar to the equivalent for arb_internalformat_query, but in
addition to test when a invalid pname/target combination should return
INVALID_ENUM, it also checks that a valid combination returns
NO_ERROR, and testing both GetInternalformativ and
GetInternalformati64v.

The rationale of this is that is really likely that the implementation
of arb_internal_format_query2 would reuse a lot of bits of
arb_internal_format_query, so we want to be sure that a combination
that was invalid with arb_internal_format_query is not considered
invalid by arb_internal_format_query2.

Tested on NVIDIA GeForce GTX 950 - NVIDIA 352.55: pass
---
 tests/all.py   |   5 +
 tests/spec/CMakeLists.txt  |   1 +
 .../arb_internalformat_query2/CMakeLists.gl.txt|  13 +
 .../spec/arb_internalformat_query2/CMakeLists.txt  |   1 +
 tests/spec/arb_internalformat_query2/api-errors.c  | 179 ++
 tests/spec/arb_internalformat_query2/common.h  | 265 +
 6 files changed, 464 insertions(+)
 create mode 100644 tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
 create mode 100644 tests/spec/arb_internalformat_query2/CMakeLists.txt
 create mode 100644 tests/spec/arb_internalformat_query2/api-errors.c
 create mode 100644 tests/spec/arb_internalformat_query2/common.h

diff --git a/tests/all.py b/tests/all.py
index 3184b6e..3911099 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -3617,6 +3617,11 @@ with profile.group_manager(
 g(['arb_internalformat_query-minmax'], 'minmax')
 
 with profile.group_manager(
+PiglitGLTest,
+grouptools.join('spec', 'arb_internalformat_query2')) as g:
+g(['arb_internalformat_query2-api-errors'], 'API error checks')
+
+with profile.group_manager(
 PiglitGLTest, grouptools.join('spec', 'arb_map_buffer_range')) as g:
 g(['map_buffer_range_error_check'], run_concurrent=False)
 g(['map_buffer_range_test'], run_concurrent=False)
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index fb1269b..29974b3 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -30,6 +30,7 @@ add_subdirectory (arb_gpu_shader5)
 add_subdirectory (arb_gpu_shader_fp64)
 add_subdirectory (arb_instanced_arrays)
 add_subdirectory (arb_internalformat_query)
+add_subdirectory (arb_internalformat_query2)
 add_subdirectory (arb_invalidate_subdata)
 add_subdirectory (arb_map_buffer_alignment)
 add_subdirectory (arb_map_buffer_range)
diff --git a/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt 
b/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
new file mode 100644
index 000..7a0e857
--- /dev/null
+++ b/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
@@ -0,0 +1,13 @@
+include_directories(
+   ${GLEXT_INCLUDE_DIR}
+   ${OPENGL_INCLUDE_PATH}
+)
+
+link_libraries (
+   piglitutil_${piglit_target_api}
+   ${OPENGL_gl_LIBRARY}
+)
+
+piglit_add_executable (arb_internalformat_query2-api-errors api-errors.c)
+
+# vim: ft=cmake:
diff --git a/tests/spec/arb_internalformat_query2/CMakeLists.txt 
b/tests/spec/arb_internalformat_query2/CMakeLists.txt
new file mode 100644
index 000..144a306
--- /dev/null
+++ b/tests/spec/arb_internalformat_query2/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git a/tests/spec/arb_internalformat_query2/api-errors.c 
b/tests/spec/arb_internalformat_query2/api-errors.c
new file mode 100644
index 000..e88480c
--- /dev/null
+++ b/tests/spec/arb_internalformat_query2/api-errors.c
@@ -0,0 +1,179 @@
+/*
+ * Copyright © 2015 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.
+ */
+
+/**
+ * \file api-errors.c
+ * Verify a handful of error conditions required by the spec.
+ *
+ * None of these subtests is large enough to warrant a separate test case.
+ *
+ * Equivalent to internalformat_query-api-errors, with testing
+ * 

[Piglit] [PATCH 04/21] arb_internalformat_query2: test for SAMPLES and NUM_SAMPLE_COUNTS pnames

2016-01-19 Thread Alejandro Piñeiro
For those pnames, it verify that the defined on the spec is fulfilled:
  NUM_SAMPLE_COUNTS

If  is not color-renderable, depth-renderable, or
stencil-renderable (as defined in section 4.4.4), or if 
does not support multiple samples (ie other than
TEXTURE_2D_MULTISAMPLE, TEXTURE_2D_MULTISAMPLE_ARRAY, or
RENDERBUFFER), 0 is returned.

  SAMPLES

If  is not color-renderable, depth-renderable, or
stencil-renderable (as defined in section 4.4.4), or if 
does not support multiple samples (ie other than
TEXTURE_2D_MULTISAMPLE, TEXTURE_2D_MULTISAMPLE_ARRAY, or
RENDERBUFFER),  is not modified.

This test is really similar to api-errors test at
arb_internalformat_query, with the difference that on that case an
error was defined, and here was "softed" to return some specific
values. It also covers query1 overrun test.

Those two tests fails on the following proprietary drivers:
  * 4.5.13399 on AMD Radeon (TM) R9 380 Series
  * 4.5.0 NVIDIA 352.55 on GeForce GTX 950/PCIe/SSE2

For NUM_SAMPLES_COUNTS, they report a value different of 0 (5 on the
NVIDIA, 4 on ATI) for target/internalformat that should return 0
(example: GL_TEXTURE_1D+GL_COMPRESSED_RGB).  It is worth to note that
for those cases, INTERNALFORMAT_SUPPORTED returns TRUE. It is not
clear if they provide multi-sample capabilities for those targets.

That seems to suggest that the paragraph was C from query1, and it
is being too restrictive, when the purpose of the query2 itself is "a)
provide a mechanism for implementations to declare support *above* the
minimum required by the specification".

For the SAMPLES case, it changes the first element of ,
for cases where it should remain unmodified.
---
 tests/all.py   |   1 +
 .../arb_internalformat_query2/CMakeLists.gl.txt|   1 +
 tests/spec/arb_internalformat_query2/common.c  |  76 ++
 tests/spec/arb_internalformat_query2/common.h  |  19 ++
 .../arb_internalformat_query2/samples-pnames.c | 299 +
 5 files changed, 396 insertions(+)
 create mode 100644 tests/spec/arb_internalformat_query2/samples-pnames.c

diff --git a/tests/all.py b/tests/all.py
index ff57f3b..78ba91f 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -3621,6 +3621,7 @@ with profile.group_manager(
 grouptools.join('spec', 'arb_internalformat_query2')) as g:
 g(['arb_internalformat_query2-api-errors'], 'API error checks')
 g(['arb_internalformat_query2-generic-pname-checks'], 'Individual most 
generic pname checks')
+g(['arb_internalformat_query2-samples-pnames'], 'SAMPLES and 
NUM_SAMPLE_COUNTS pname checks')
 
 with profile.group_manager(
 PiglitGLTest, grouptools.join('spec', 'arb_map_buffer_range')) as g:
diff --git a/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt 
b/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
index cd3b07e..a204fb5 100644
--- a/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
+++ b/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
@@ -10,5 +10,6 @@ link_libraries (
 
 piglit_add_executable (arb_internalformat_query2-api-errors api-errors.c)
 piglit_add_executable (arb_internalformat_query2-generic-pname-checks 
generic-pname-checks.c common.c)
+piglit_add_executable (arb_internalformat_query2-samples-pnames 
samples-pnames.c common.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_internalformat_query2/common.c 
b/tests/spec/arb_internalformat_query2/common.c
index 99ea485..c860118 100644
--- a/tests/spec/arb_internalformat_query2/common.c
+++ b/tests/spec/arb_internalformat_query2/common.c
@@ -105,6 +105,20 @@ test_data_execute(test_data *data,
data->params_size, data->params);
 }
 
+/* Usually we want to call GetInternalformati*v with the size of the
+ * buffer, but there are some cases where we want to specify a
+ * different size */
+void
+test_data_execute_with_size(test_data *data,
+const GLenum target,
+const GLenum internalformat,
+const GLenum pname,
+int size)
+{
+data->callback(target, internalformat, pname,
+   size, data->params);
+}
+
 void
 test_data_set_testing64(test_data *data,
 const int testing64)
@@ -312,3 +326,65 @@ try_basic(const GLenum *targets, unsigned num_targets,
 
return pass;
 }
+
+/*
+ * Sets the value of @data params at @index to @value.
+*/
+void
+test_data_set_value_at_index(test_data *data,
+ const int index,
+ const GLint64 value)
+{
+if (index > data->params_size || index < 0) {
+fprintf(stderr, "ERROR: invalid index while setting"
+" auxiliar test data\n");
+return;
+}
+
+if (data->testing64) {
+((GLint64*)data->params)[index] = value;
+} else {
+ 

[Piglit] [PATCH 01/21] arb_internalformat_query: remove references to arb_internalformat_query2

2016-01-19 Thread Alejandro Piñeiro
arb_internalformat_query tests was taking into account query2, in
order to avoid testing some pnames/internalformats valid on query2.

But taking into account how deeply arb_internalformat_query2 extended
and changed the behaviour of GetInternalformativ, it is really more
clear to isolate both.

With this commit arb_internalformat_query tests will test when only
arb_internalformat_query is present, and arb_internalformat_query2
will test when both are present (as arb_internalformat_query2 has
arb_internalformat_query as a requirement).

This patch makes this one obsolete:
http://lists.freedesktop.org/archives/piglit/2015-October/017746.html
---
 tests/spec/arb_internalformat_query/api-errors.c | 35 ++--
 tests/spec/arb_internalformat_query/minmax.c |  3 ++
 2 files changed, 6 insertions(+), 32 deletions(-)

diff --git a/tests/spec/arb_internalformat_query/api-errors.c 
b/tests/spec/arb_internalformat_query/api-errors.c
index ee21c17..a174143 100644
--- a/tests/spec/arb_internalformat_query/api-errors.c
+++ b/tests/spec/arb_internalformat_query/api-errors.c
@@ -63,9 +63,6 @@ static const GLenum invalid_targets[] = {
GL_STENCIL_ATTACHMENT,
GL_TEXTURE_4D_SGIS,
GL_TEXTURE_RENDERBUFFER_NV,
-};
-
-static const GLenum invalid_targets_without_query2[] = {
GL_TEXTURE_1D,
GL_TEXTURE_1D_ARRAY,
GL_TEXTURE_2D,
@@ -152,9 +149,6 @@ static const GLenum invalid_pnames[] = {
GL_TEXTURE_WIDTH,
GL_TEXTURE_HEIGHT,
GL_TEXTURE_COMPONENTS,
-};
-
-static const GLenum invalid_pnames_without_query2[] = {
GL_INTERNALFORMAT_SUPPORTED,
GL_INTERNALFORMAT_PREFERRED,
GL_INTERNALFORMAT_RED_SIZE,
@@ -285,6 +279,9 @@ piglit_init(int argc, char **argv)
 
piglit_require_extension("GL_ARB_framebuffer_object");
piglit_require_extension("GL_ARB_internalformat_query");
+/* ARB_internalformat_query2 redefines and extend this
+ * extension. That extension have their own tests*/
+piglit_require_not_extension("GL_ARB_internalformat_query2");
 
/* The GL_ARB_internalformat_query spec says:
 *
@@ -310,22 +307,7 @@ piglit_init(int argc, char **argv)
 * then TEXTURE_2D_MULTISAMPLE and TEXTURE_2D_MULTISAMPLE_ARRAY
 * are not supported  parameters to GetInternalformativ."
 *
-* However, GL_ARB_internalformat_query2 adds GL_TEXTURE_1D,
-* GL_TEXTURE_1D_ARRAY, GL_TEXTURE_2D, GL_TEXTURE_2D_ARRAY,
-* GL_TEXTURE_3D, GL_TEXTURE_CUBE_MAP, GL_TEXTURE_CUBE_MAP_ARRAY,
-* GL_TEXTURE_RECTANGLE, and GL_TEXTURE_BUFFER to the list of
-* available targets.
-*
 */
-   if (!piglit_is_extension_supported("GL_ARB_internalformat_query2")) {
-   pass = try(invalid_targets_without_query2,
-  ARRAY_SIZE(invalid_targets_without_query2),
-  valid_formats, ARRAY_SIZE(valid_formats),
-  valid_pnames, ARRAY_SIZE(valid_pnames),
-  GL_INVALID_ENUM)
-   && pass;
-   }
-
if (!piglit_is_extension_supported("GL_ARB_texture_multisample")) {
pass = try(invalid_targets_without_tms,
   ARRAY_SIZE(invalid_targets_without_tms),
@@ -346,18 +328,7 @@ piglit_init(int argc, char **argv)
 * "If the  parameter to GetInternalformativ is not SAMPLES
 * or NUM_SAMPLE_COUNTS, then an INVALID_ENUM error is generated."
 *
-* However, GL_ARB_internalformat_query2 adds a giant pile of possible
-* enums to this list.
 */
-   if (!piglit_is_extension_supported("GL_ARB_internalformat_query2")) {
-   pass = try(valid_targets, ARRAY_SIZE(valid_targets),
-  valid_formats, ARRAY_SIZE(valid_formats),
-  invalid_pnames_without_query2,
-  ARRAY_SIZE(invalid_pnames_without_query2),
-  GL_INVALID_ENUM)
-   && pass;
-   }
-
pass = try(valid_targets, ARRAY_SIZE(valid_targets),
   valid_formats, ARRAY_SIZE(valid_formats),
   invalid_pnames, ARRAY_SIZE(invalid_pnames),
diff --git a/tests/spec/arb_internalformat_query/minmax.c 
b/tests/spec/arb_internalformat_query/minmax.c
index 9a9d8f6..5fa2ffb 100644
--- a/tests/spec/arb_internalformat_query/minmax.c
+++ b/tests/spec/arb_internalformat_query/minmax.c
@@ -242,6 +242,9 @@ piglit_init(int argc, char **argv)
 
piglit_require_extension("GL_ARB_framebuffer_object");
piglit_require_extension("GL_ARB_internalformat_query");
+/* ARB_internalformat_query2 redefines and extend this
+ * extension. That extension have their own tests*/
+piglit_require_not_extension("GL_ARB_internalformat_query2");
 
/* Need GL 3 or extensions to support the valid_formats[] above */

[Piglit] [PATCH 00/21][RFC] Tests for ARB_internalformat_query2 extension

2016-01-19 Thread Alejandro Piñeiro
This is an RFC series for the ARB_internalformat_query2 extension:

https://www.opengl.org/registry/specs/ARB/internalformat_query2.txt

The corresponding bug is being tracked at:

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

It is still a RFC sending because there are still one pending thing
(detailed below, at Notes), but I preferred to send the full series in
advance because the main bulk is already done, and the series for the
Mesa implementation was just sent [1].

Notes:

 * It used arb_internalformat_query tests as a base.

 * The first commit removes the references to
   ARB_internalformat_query2 on the ARB_internalformat_query tests. query2 not
   only expands the possible attribute values GetInternalformativ can
   receive, but also changes its behaviour, so we concluded that it
   would be better to keep both test suites independent.

 * common.c defines a test_data structure, which main purpose is
   to abstract the fact that we have now two really similar methods
   (GetInternalformativ and GetInternalformati64v) which only
   difference is the type of the params parameter. So the tests would
   not worry about castings or which specific method is being
   called. One could argue that at this point it deserves a C++ class,
   but we preferred to stick to C.

 * For several pnames there aren't too much to test, because after
   all, we are talking about an specification that returns values that
   depend on the current implementation/hw. For that reason several
   pnames are handled by a generic test (generic-pname-checks) that
   only ensures that the returned values are among the possible values
   defined by the spec.

 * The one thing pending is a better handling of the dependencies with
   other extensions. In most extensions, the dependencies with other
   extensions are a "hard" dependency, so one given extension is needed
   for a different extension. With ARB_internalformat_query2 we have
   "soft" dependencies, in the sense that there are dependencies with
   other extensions, but lacking those dependencies doesn't prevent
   query2 to be supported, but just affects the returned value for
   some pnames. For example:

 "Dependencies on EXT_texture_sRGB

   If EXT_texture_sRGB or equivalent functionality is not
   supported, queries for the SRGB_READ  and for sRGB
   internalformats return the appropriate "unsupported" response."

   So the pending thing is for each pname, check its dependencies, in
   order to ensure that the unsupported response is returned.

 * Finally, the 13 tests passes on the patch series that was just
   proposed for Mesa [1]. They were also run using NVIDIA proprietary
   drivers (NVIDIA GeForce GTX 950 - NVIDIA 352.55). In that case, the
   pass/fail ratio is 5/8. What is failing is explained on the commit
   message.

cheers,
Alejandro (on behalf of the team that worked on this)

[1] http://lists.freedesktop.org/archives/mesa-dev/2016-January/105277.html

Alejandro Piñeiro (18):
  arb_internalformat_query: remove references to
arb_internalformat_query2
  arb_internalformat_query2: query2 api-error check
  arb_internalformat_query2: test for the most generic pname checks
  arb_internalformat_query2: test for SAMPLES and NUM_SAMPLE_COUNTS
pnames
  arb_internalformat_query2: test for INTERNALFORMAT_{X}_SIZE pnames
  arb_internalformat_query2: test for INTERNALFORMAT_{X}_TYPE pnames
  arb_internalformat_query2: IMAGE_FORMAT_COMPATIBILITY_TYPE test
  arb_internalformat_query2: max dimensions related checks
  arb_internalformat_query2: check returned max-dimensions values
against GetInteger
  arb_internalformat_query2: add MAX_COMBINED_DIMENSIONS subtest to
max-dimensions
  arb_internalformat_query2: add a generic check for
TEXTURE_IMAGE_FORMAT
  arb_internalformat_query2: add a generic check for TEXTURE_IMAGE_TYPE
  arb_internalformat_query2: add generic check for
GET_TEXTURE_IMAGE_FORMAT
  arb_internalformat_query2: add generic check for
GET_TEXTURE_IMAGE_TYPE
  arb_internalformat_query2: test for COLOR_ENCODING
  arb_internalformat_query2: test for TEXTURE_COMPRESSED_BLOCK_
  arb_internalformat_query2: port of query1 minmax test to query2
  arb_internalformat_query2: test for FILTER pname

Antia Puentes (3):
  arb_internalformat_query2: Check if the resource is supported in
max-dimensions
  arb_internalformat_query2: Added tests for image textures
  arb_internalformat_query2: Added tests for
{COLOR,DEPTH,STENCIL}_COMPONENTS

 tests/all.py   |  17 +
 tests/spec/CMakeLists.txt  |   1 +
 tests/spec/arb_internalformat_query/api-errors.c   |  35 +-
 tests/spec/arb_internalformat_query/minmax.c   |   3 +
 .../arb_internalformat_query2/CMakeLists.gl.txt|  25 +
 .../spec/arb_internalformat_query2/CMakeLists.txt  |   1 +
 tests/spec/arb_internalformat_query2/api-errors.c  | 179 ++
 .../arb_internalformat_query2/color-encoding.c | 210 

[Piglit] [PATCH 15/21] arb_internalformat_query2: add generic check for GET_TEXTURE_IMAGE_TYPE

2016-01-19 Thread Alejandro Piñeiro
From spec:
 "GET_TEXTURE_IMAGE_TYPE:
  

  Possible values include any value that is legal to pass for the
   parameter to GetTexImage, or NONE if the resource does not
  support this operation, or if GetTexImage is not supported."

Tested on NVIDIA GeForce GTX 950 - NVIDIA 352.55: pass.
---
 .../arb_internalformat_query2/generic-pname-checks.c  | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/tests/spec/arb_internalformat_query2/generic-pname-checks.c 
b/tests/spec/arb_internalformat_query2/generic-pname-checks.c
index e7c3fd6..2011a9d 100644
--- a/tests/spec/arb_internalformat_query2/generic-pname-checks.c
+++ b/tests/spec/arb_internalformat_query2/generic-pname-checks.c
@@ -398,5 +398,24 @@ piglit_init(int argc, char **argv)
 && pass;
 }
 
+/*
+ * From spec:
+ * "GET_TEXTURE_IMAGE_TYPE:
+ *  
+ *  Possible values include any value that is legal to pass
+ *  for the  parameter to GetTexImage, or NONE if the
+ *  resource does not support this operation, or if
+ *  GetTexImage is not supported."
+ *
+ * From 4.2 spec (section 6.1.4) this is table 3.2, that are
+ * also the possible values for TEXTURE_IMAGE_TYPE, so we
+ * reuse that list here.
+ *
+ **/
+pname = GL_GET_TEXTURE_IMAGE_TYPE;
+pass = check_basic(, 1, possible_values_texture_image_type,
+   ARRAY_SIZE(possible_values_texture_image_type))
+&& pass;
+
 piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
 }
-- 
2.1.4

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


[Piglit] [PATCH 14/21] arb_internalformat_query2: add generic check for GET_TEXTURE_IMAGE_FORMAT

2016-01-19 Thread Alejandro Piñeiro
From query2 spec:
"GET_TEXTURE_IMAGE_FORMAT:
 
 Possible values include any value that is legal to pass for the
  parameter to GetTexImage, or NONE if the resource does not
 support this operation, or if GetTexImage is not supported."

The possible list of values is the same that testing
TEXTURE_IMAGE_FORMAT, but depending on the gl version,
GL_STENCIL_INDEX is allowed too. This commits adds another list of
possible values. We could have added a clone method that added extra
values, but for now that would be an overkill. We could add more if we
find more similar cases.

Tested on NVIDIA GeForce GTX 950 - NVIDIA 352.55: fails.

As with TEXTURE_IMAGE_FORMAT in some cases returns GL_R11F_G11F_B10F
or GL_RGB9_E5, that are internalformats, not formats.
---
 .../generic-pname-checks.c | 65 ++
 1 file changed, 65 insertions(+)

diff --git a/tests/spec/arb_internalformat_query2/generic-pname-checks.c 
b/tests/spec/arb_internalformat_query2/generic-pname-checks.c
index f5729e7..e7c3fd6 100644
--- a/tests/spec/arb_internalformat_query2/generic-pname-checks.c
+++ b/tests/spec/arb_internalformat_query2/generic-pname-checks.c
@@ -191,6 +191,57 @@ static GLint possible_values_texture_image_format[] = {
 /*
  * From query2 spec:
  *
+ * "GET_TEXTURE_IMAGE_FORMAT:
+ *  
+ * Possible values include any value that is legal to pass for the
+ *  parameter to GetTexImage, or NONE if the resource does not
+ * support this operation, or if GetTexImage is not supported."
+ *
+ * From 4.2 core spec (section 6.1.4):
+ * "format is a pixel format from table 3.3"
+ * "Calling GetTexImage with a format of STENCIL_INDEX causes the
+ *  error INVALID_ENUM ."
+ *
+ * So on 4.2 the possible values would be the same that
+ * texture_image_format.
+ *
+ * But, since 4.4 (section 8.11.4) STENCIL_INDEX is a valid enum, and
+ * INVALID_OPERATION would be raised if used in combination with a
+ * wrong internalformat.
+ *
+ * So possible_values_get_texture_image_format would include
+ * STENCIL_INDEX. When passing possible values to
+ * GET_TEXTURE_IMAGE_FORMAT, it would need to fallback to
+ * possible_values_texture_image_format if needed.
+ */
+static GLint possible_values_get_texture_image_format[] = {
+/* Table 3.3 */
+GL_STENCIL_INDEX,
+GL_DEPTH_COMPONENT,
+GL_DEPTH_STENCIL,
+GL_RED,
+GL_GREEN,
+GL_BLUE,
+GL_RG,
+GL_RGB,
+GL_RGBA,
+GL_BGR,
+GL_BGRA,
+GL_RED_INTEGER,
+GL_GREEN_INTEGER,
+GL_BLUE_INTEGER,
+GL_RG_INTEGER,
+GL_RGB_INTEGER,
+GL_RGBA_INTEGER,
+GL_BGR_INTEGER,
+GL_BGRA_INTEGER,
+/* GL_NONE from query2 TEXTURE_IMAGE_FORMAT spec */
+GL_NONE
+};
+
+/*
+ * From query2 spec:
+ *
  * "TEXTURE_IMAGE_TYPE:
  * 
  * Possible values include any value that is legal to pass for the
@@ -333,5 +384,19 @@ piglit_init(int argc, char **argv)
ARRAY_SIZE(possible_values_texture_image_type))
 && pass;
 
+pname = GL_GET_TEXTURE_IMAGE_FORMAT;
+
+/* To know why this gl version if needed, see comment at
+ * possible_values_get_texture_image_format */
+if (piglit_get_gl_version() < 44) {
+pass = check_basic(, 1, 
possible_values_texture_image_format,
+   
ARRAY_SIZE(possible_values_texture_image_format))
+&& pass;
+} else {
+pass = check_basic(, 1, 
possible_values_get_texture_image_format,
+   
ARRAY_SIZE(possible_values_get_texture_image_format))
+&& pass;
+}
+
 piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
 }
-- 
2.1.4

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


[Piglit] [PATCH 19/21] arb_internalformat_query2: Added tests for image textures

2016-01-19 Thread Alejandro Piñeiro
From: Antia Puentes 

Checks that:
  * TEXEL_SIZE
  * IMAGE_COMPATIBILITY_CLASS
  * IMAGE_PIXEL_FORMAT
  * IMAGE_PIXEL_TYPE
return the values defined for them in Table 3.22 of the OpenGL 4.2
specification depending on the "Image Format" passed.

This test does not check unsupported or expected-failure cases, hence
it does not replace the "generic-pnames-check" test. We may want to
change that in the future to have everything in the same place.

Tested on NVIDIA GeForce GTX 950 - NVIDIA 352.55: fails:

In addition to the errors already found on the generic-pnames test
with this pnames, in some cases NVIDIA implementation is returning
values different to the specified on Table 3.22.
---
 tests/all.py   |   1 +
 .../arb_internalformat_query2/CMakeLists.gl.txt|   1 +
 .../spec/arb_internalformat_query2/image-texture.c | 211 +
 3 files changed, 213 insertions(+)
 create mode 100644 tests/spec/arb_internalformat_query2/image-texture.c

diff --git a/tests/all.py b/tests/all.py
index 4027ad3..f9f3c84 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -3629,6 +3629,7 @@ with profile.group_manager(
 g(['arb_internalformat_query2-color-encoding'], 'COLOR_ENCODING pname 
check')
 g(['arb_internalformat_query2-texture-compressed-block'], 'All 
TEXTURE_COMPRESSED_BLOCK_ pname checks')
 g(['arb_internalformat_query2-minmax'], 'minmax check for 
SAMPLES/NUM_SAMPLE_COUNTS')
+g(['arb_internalformat_query2-image-texture'], 'Checks for pnames related 
to ARB_image_load_store that return values from Table 3.22 (OpenGL 4.2)')
 
 with profile.group_manager(
 PiglitGLTest, grouptools.join('spec', 'arb_map_buffer_range')) as g:
diff --git a/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt 
b/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
index f6119a6..b9a96f0 100644
--- a/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
+++ b/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
@@ -18,5 +18,6 @@ piglit_add_executable 
(arb_internalformat_query2-max-dimensions max-dimensions.c
 piglit_add_executable (arb_internalformat_query2-color-encoding 
color-encoding.c common.c)
 piglit_add_executable (arb_internalformat_query2-texture-compressed-block 
texture-compressed-block.c common.c)
 piglit_add_executable (arb_internalformat_query2-minmax minmax.c common.c)
+piglit_add_executable (arb_internalformat_query2-image-texture image-texture.c 
common.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_internalformat_query2/image-texture.c 
b/tests/spec/arb_internalformat_query2/image-texture.c
new file mode 100644
index 000..f725463
--- /dev/null
+++ b/tests/spec/arb_internalformat_query2/image-texture.c
@@ -0,0 +1,211 @@
+/*
+ * Copyright © 2015 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.
+ */
+
+/**
+ * \file image-texture.c
+ *
+ * Verify conditions defined on the spec for the pnames that have to return
+ * values in the Table 3.22 of the OpenGL 4.2 spec:
+ *
+ *  * TEXEL_SIZE
+ *  * IMAGE_COMPATIBILITY_CLASS
+ *  * IMAGE_PIXEL_FORMAT
+ *  * IMAGE_PIXEL_TYPE
+ *
+ * It only tests values present in Table 3.22, it does not check unsupported
+ * or failure-expected cases.
+ *
+ * As this test does not check unsupported cases, it does not replace the
+ * "generic-pnames-check" test. We may want to change that in the future
+ * to have everything in the same place.
+ */
+
+#include "common.h"
+#include   /* for PRIu64 macro */
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 10;
+   config.window_visual = PIGLIT_GL_VISUAL_RGB;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+return PIGLIT_FAIL;
+}
+
+static const GLenum pnames[] = {
+GL_IMAGE_TEXEL_SIZE,
+GL_IMAGE_COMPATIBILITY_CLASS,
+GL_IMAGE_PIXEL_FORMAT,
+GL_IMAGE_PIXEL_TYPE,
+};
+

[Piglit] [PATCH 12/21] arb_internalformat_query2: add a generic check for TEXTURE_IMAGE_FORMAT

2016-01-19 Thread Alejandro Piñeiro
From spec:

"Possible values include any value that is legal to pass for the
  parameter to the Tex*Image*D commands, or NONE if the
 resource is not supported for this operation."

Tested on NVIDIA GeForce GTX 950 - NVIDIA 352.55: fails:
In some cases is returns GL_R11F_G11F_B10F or GL_RGB9_ES5, that are
internalformats, not valid formats.

Tested on AMD Radeon (TM) R9 380 Series: fails:
It returns values different to NONE on cases where the
target/internalformat are not supported (via
INTERNALFORMAT_SUPPORTED).
---
 .../generic-pname-checks.c | 48 ++
 1 file changed, 48 insertions(+)

diff --git a/tests/spec/arb_internalformat_query2/generic-pname-checks.c 
b/tests/spec/arb_internalformat_query2/generic-pname-checks.c
index ab37b4b..606aa69 100644
--- a/tests/spec/arb_internalformat_query2/generic-pname-checks.c
+++ b/tests/spec/arb_internalformat_query2/generic-pname-checks.c
@@ -145,6 +145,49 @@ static const GLint possible_values_image_pixel_type[] = {
 GL_BYTE,
 };
 
+/* From query2 spec:
+ *
+ * "TEXTURE_IMAGE_FORMAT:
+ * 
+ * Possible values include any value that is legal to pass for the
+ *  parameter to the Tex*Image*D commands, or NONE if the
+ * resource is not supported for this operation."
+ *
+ * From 4.2 core spec:
+ * "TexImage3D
+ * 
+ * format, type, and data specify the format of the image data, the
+ * type of those data, and a reference to the image data in the cur-
+ * rently bound pixel unpack buffer or client memory, as described in
+ * section 3.7.2. The format STENCIL_INDEX is not allowed."
+ *
+ * This is basically Table 3.3 (defined at section 3.7.2) minus
+ * STENCIL_INDEX.
+ */
+static GLint possible_values_texture_image_format[] = {
+/* Table 3.3 minus STENCIL_INDEX */
+GL_DEPTH_COMPONENT,
+GL_DEPTH_STENCIL,
+GL_RED,
+GL_GREEN,
+GL_BLUE,
+GL_RG,
+GL_RGB,
+GL_RGBA,
+GL_BGR,
+GL_BGRA,
+GL_RED_INTEGER,
+GL_GREEN_INTEGER,
+GL_BLUE_INTEGER,
+GL_RG_INTEGER,
+GL_RGB_INTEGER,
+GL_RGBA_INTEGER,
+GL_BGR_INTEGER,
+GL_BGRA_INTEGER,
+/* GL_NONE from query2 TEXTURE_IMAGE_FORMAT spec */
+GL_NONE
+};
+
 enum piglit_result
 piglit_display(void)
 {
@@ -231,5 +274,10 @@ piglit_init(int argc, char **argv)
possible_values_true_false, 
ARRAY_SIZE(possible_values_true_false))
 && pass;
 
+pname = GL_TEXTURE_IMAGE_FORMAT;
+pass = check_basic(, 1, possible_values_texture_image_format,
+   ARRAY_SIZE(possible_values_texture_image_format))
+&& pass;
+
 piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
 }
-- 
2.1.4

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


[Piglit] [PATCH 10/21] arb_internalformat_query2: add MAX_COMBINED_DIMENSIONS subtest to max-dimensions

2016-01-19 Thread Alejandro Piñeiro
From spec:

"MAX_COMBINED_DIMENSIONS: The maximum combined dimensions for the
  resource is returned in . The combined dimensions is the
  product of the individual dimensions of the resource. For
  multisampled surfaces the number of samples is considered an
  additional dimension. Note that the value returned can be >= 2^32
  and should be queried with the 64-bit query.
  
  If the resource is unsupported, zero is returned."

In this case the returning value is a combination of the values of
MAX_WIDTH, MAX_HEIGHT, MAX_DEPTH, SAMPLES and the number of faces, so
the test can check that the returned value is correct in any case.

Note that there are cases that the combined value is greater that
2^32, but the test is also testing the 32-bit query. The spec doesn't
specify what the query should return in that case, so it is assumed
that any value would be correct.

Tested on NVIDIA GeForce GTX 950 - NVIDIA 352.55: fails for cube
map related targets. From spec:

"For cube map targets this is the maximum combined width, height and
 faces"

But NVIDIA propietary drivers is just combining width and height.
---
 tests/spec/arb_internalformat_query2/common.c  |   6 +
 tests/spec/arb_internalformat_query2/common.h  |   2 +
 .../arb_internalformat_query2/max-dimensions.c | 168 +
 3 files changed, 176 insertions(+)

diff --git a/tests/spec/arb_internalformat_query2/common.c 
b/tests/spec/arb_internalformat_query2/common.c
index 8cf096a..40fab69 100644
--- a/tests/spec/arb_internalformat_query2/common.c
+++ b/tests/spec/arb_internalformat_query2/common.c
@@ -601,6 +601,12 @@ test_data_clone(test_data *data)
 }
 
 int
+test_data_get_testing64(test_data *data)
+{
+return data->testing64;
+}
+
+int
 test_data_get_params_size(test_data *data)
 {
 return data->params_size;
diff --git a/tests/spec/arb_internalformat_query2/common.h 
b/tests/spec/arb_internalformat_query2/common.h
index 45e3fda..fa98d00 100644
--- a/tests/spec/arb_internalformat_query2/common.h
+++ b/tests/spec/arb_internalformat_query2/common.h
@@ -324,6 +324,8 @@ void test_data_set_value_at_index(test_data *data,
 
 test_data* test_data_clone(test_data *data);
 
+int test_data_get_testing64(test_data *data);
+
 int test_data_get_params_size(test_data *data);
 
 bool try_basic(const GLenum *targets, unsigned num_targets,
diff --git a/tests/spec/arb_internalformat_query2/max-dimensions.c 
b/tests/spec/arb_internalformat_query2/max-dimensions.c
index e74fd28..68945bf 100644
--- a/tests/spec/arb_internalformat_query2/max-dimensions.c
+++ b/tests/spec/arb_internalformat_query2/max-dimensions.c
@@ -39,6 +39,12 @@
  *   the same as the MAX_HEIGHT. For 2D and cube array targets, the
  *   value returned is the same as the MAX_DEPTH."
  *
+ * MAX_COMBINED_DIMENSIONS: From spec "The maximum combined dimensions
+ *   for the resource is returned in . The combined dimensions
+ *   is the product of the individual dimensions of the
+ *   resource.  If the resource is unsupported, zero is
+ *   returned."
+ *
  * Additionally it also checks that the returned values are the same
  * that the ones you receive calling GetIntegerv with equivalent
  * pnames like GL_MAX_TEXTURE_SIZE, GL_MAX_3D_TEXTURE_SIZE, etc.
@@ -66,9 +72,14 @@
  *
  * So at this point, taking into account the current implementation,
  * it makes sense to check against those values.
+ *
+ * For MAX_COMBINED_DIMENSIONS it compares the returned value against
+ * a combination of MAX_WIDH, MAX_HEIGHT, MAX_DEPTH, MAX_LAYERS and
+ * SAMPLES if supported. Compares against 0 if unsupported.
  */
 
 #include "common.h"
+#include  /* For INT_MAX */
 
 PIGLIT_GL_TEST_CONFIG_BEGIN
 
@@ -456,6 +467,162 @@ check_max_layers()
 return pass;
 }
 
+static bool
+is_cubemap(GLenum target)
+{
+switch(target) {
+case GL_TEXTURE_CUBE_MAP:
+case GL_TEXTURE_CUBE_MAP_ARRAY:
+return true;
+default:
+return false;
+}
+}
+
+static bool
+is_multisample(GLenum target)
+{
+switch(target) {
+case GL_TEXTURE_2D_MULTISAMPLE:
+case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
+return true;
+default:
+return false;
+}
+}
+
+/* It computes the max dimension for @target and @internalformat, and
+ * compares it against the content of @data */
+static bool
+check_against_combined_dimensions(test_data *data,
+  GLenum target,
+  GLenum internalformat,
+  GLint64 *_combined_value)
+{
+GLint current_value;
+GLint64 combined_value = 1;
+/* We don't include MAX_LAYERS, because his value is returned
+   as HEIGHT (on 1d arrays) or DEPTH (on 2d arrays) */
+GLenum max_dimensions_pnames[] = {
+GL_MAX_WIDTH,
+GL_MAX_HEIGHT,
+GL_MAX_DEPTH,
+GL_SAMPLES
+};
+

[Piglit] [PATCH 20/21] arb_internalformat_query2: test for FILTER pname

2016-01-19 Thread Alejandro Piñeiro
From spec:

" FILTER: The support for filter types other than NEAREST or
  NEAREST_MIPMAP_NEAREST for the resource is written to .
  This indicates if sampling from such resources supports setting the
  MIN/MAG filters to LINEAR values.  Possible values returned are
  FULL_SUPPORT, CAVEAT_SUPPORT, or NONE.  If the resource or operation
  is not supported, NONE is returned."

On the case of FILTER there are well known cases defined by the OpenGL
spec where multi-texel filtering is not allowed:

 * Multi-sample textures ( GL_TEXTURE_2D_MULTISAMPLE,
   GL_TEXTURE_2D_MULTISAMPLE_ARRAY).
 * Any resource using a integer internalformat
 * Texture buffer objects

So in addition to check that it returns NONE for not supported
internalformat, we know that it should return NONE too for those
cases.

In other cases, it checks that the returned value is FULL_SUPPORT,
CAVEAT_SUPPORT or NONE.

Tested on NVIDIA GeForce GTX 950 - NVIDIA 352.55: fails:

  * Texture Buffer target is returning FULL_SUPPORT.
  * Multi-texture targets is returning FULL_SUPPORT.
---
 tests/all.py   |   1 +
 .../arb_internalformat_query2/CMakeLists.gl.txt|   1 +
 tests/spec/arb_internalformat_query2/filter.c  | 243 +
 3 files changed, 245 insertions(+)
 create mode 100644 tests/spec/arb_internalformat_query2/filter.c

diff --git a/tests/all.py b/tests/all.py
index f9f3c84..ea251c3 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -3630,6 +3630,7 @@ with profile.group_manager(
 g(['arb_internalformat_query2-texture-compressed-block'], 'All 
TEXTURE_COMPRESSED_BLOCK_ pname checks')
 g(['arb_internalformat_query2-minmax'], 'minmax check for 
SAMPLES/NUM_SAMPLE_COUNTS')
 g(['arb_internalformat_query2-image-texture'], 'Checks for pnames related 
to ARB_image_load_store that return values from Table 3.22 (OpenGL 4.2)')
+g(['arb_internalformat_query2-filter'], 'FILTER pname checks.')
 
 with profile.group_manager(
 PiglitGLTest, grouptools.join('spec', 'arb_map_buffer_range')) as g:
diff --git a/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt 
b/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
index b9a96f0..f3da78d 100644
--- a/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
+++ b/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
@@ -19,5 +19,6 @@ piglit_add_executable 
(arb_internalformat_query2-color-encoding color-encoding.c
 piglit_add_executable (arb_internalformat_query2-texture-compressed-block 
texture-compressed-block.c common.c)
 piglit_add_executable (arb_internalformat_query2-minmax minmax.c common.c)
 piglit_add_executable (arb_internalformat_query2-image-texture image-texture.c 
common.c)
+piglit_add_executable (arb_internalformat_query2-filter filter.c common.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_internalformat_query2/filter.c 
b/tests/spec/arb_internalformat_query2/filter.c
new file mode 100644
index 000..a057143
--- /dev/null
+++ b/tests/spec/arb_internalformat_query2/filter.c
@@ -0,0 +1,243 @@
+/*
+ * Copyright © 2015 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.
+ */
+
+/**
+ * \file filter.c
+ *
+ * Verify the outcome for the GetInternalformativ pname FILTER. From
+ * the spec it just says that:
+ *
+ * "Possible values returned are FULL_SUPPORT, CAVEAT_SUPPORT, or NONE."
+ *
+ * In addition to ensure that the returned value is one of them (so as
+ * generic-pname would do) this test also checks for the well known
+ * cases were multi-texel filtering is not supported:
+ *
+ * * Multi-sample textures ( GL_TEXTURE_2D_MULTISAMPLE,
+ *   GL_TEXTURE_2D_MULTISAMPLE_ARRAY). [1][2]
+ * * Any resource using a integer internalformat [3][4]
+ * * Texture buffer objects [5]
+ *
+ *  [1] https://www.opengl.org/registry/specs/ARB/texture_multisample.txt
+ *  [2] "2.11.12 Multisample Texel Fetches" at 4.2 core spec
+ *  [3] 

[Piglit] [PATCH 18/21] arb_internalformat_query2: port of query1 minmax test to query2

2016-01-19 Thread Alejandro Piñeiro
It is basically the same, but testing with both GetInternalformativ
and GetInternalformati64v, using the test_data struct defined at
common.h

Tested on NVIDIA GeForce GTX 950 - NVIDIA 352.55: pass.
---
 tests/all.py   |   1 +
 .../arb_internalformat_query2/CMakeLists.gl.txt|   1 +
 tests/spec/arb_internalformat_query2/common.c  |  11 +
 tests/spec/arb_internalformat_query2/common.h  |   3 +
 tests/spec/arb_internalformat_query2/minmax.c  | 386 +
 5 files changed, 402 insertions(+)
 create mode 100644 tests/spec/arb_internalformat_query2/minmax.c

diff --git a/tests/all.py b/tests/all.py
index a099251..4027ad3 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -3628,6 +3628,7 @@ with profile.group_manager(
 g(['arb_internalformat_query2-max-dimensions'], 'Max dimensions related 
pname checks')
 g(['arb_internalformat_query2-color-encoding'], 'COLOR_ENCODING pname 
check')
 g(['arb_internalformat_query2-texture-compressed-block'], 'All 
TEXTURE_COMPRESSED_BLOCK_ pname checks')
+g(['arb_internalformat_query2-minmax'], 'minmax check for 
SAMPLES/NUM_SAMPLE_COUNTS')
 
 with profile.group_manager(
 PiglitGLTest, grouptools.join('spec', 'arb_map_buffer_range')) as g:
diff --git a/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt 
b/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
index 5af4b2e..f6119a6 100644
--- a/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
+++ b/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
@@ -17,5 +17,6 @@ piglit_add_executable 
(arb_internalformat_query2-image-format-compatibility-type
 piglit_add_executable (arb_internalformat_query2-max-dimensions 
max-dimensions.c common.c)
 piglit_add_executable (arb_internalformat_query2-color-encoding 
color-encoding.c common.c)
 piglit_add_executable (arb_internalformat_query2-texture-compressed-block 
texture-compressed-block.c common.c)
+piglit_add_executable (arb_internalformat_query2-minmax minmax.c common.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_internalformat_query2/common.c 
b/tests/spec/arb_internalformat_query2/common.c
index 40fab69..b66fdb7 100644
--- a/tests/spec/arb_internalformat_query2/common.c
+++ b/tests/spec/arb_internalformat_query2/common.c
@@ -130,6 +130,17 @@ test_data_set_testing64(test_data *data,
 sync_test_data(data);
 }
 
+void
+test_data_set_params_size(test_data *data,
+  const int params_size)
+{
+if (data->params_size == params_size)
+return;
+
+data->params_size = params_size;
+sync_test_data(data);
+}
+
 GLint64
 test_data_value_at_index(test_data *data,
  const int index)
diff --git a/tests/spec/arb_internalformat_query2/common.h 
b/tests/spec/arb_internalformat_query2/common.h
index fa98d00..2eb0123 100644
--- a/tests/spec/arb_internalformat_query2/common.h
+++ b/tests/spec/arb_internalformat_query2/common.h
@@ -301,6 +301,9 @@ test_data_execute_with_size(test_data *data,
 void test_data_set_testing64(test_data *data,
  const int testing64);
 
+void test_data_set_params_size(test_data *data,
+   const int params_size);
+
 bool test_data_equal_at_index(test_data *data,
   test_data *data_copy,
   const unsigned index);
diff --git a/tests/spec/arb_internalformat_query2/minmax.c 
b/tests/spec/arb_internalformat_query2/minmax.c
new file mode 100644
index 000..550ac44
--- /dev/null
+++ b/tests/spec/arb_internalformat_query2/minmax.c
@@ -0,0 +1,386 @@
+/*
+ * Copyright © 2015 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.
+ */
+
+/**
+ * \file minmax.c
+ * Verify that minimum value requirements for implementation limits
+ * are satisfied. Equivalent to query1 minmax, but testing against
+ * 

[Piglit] [PATCH 21/21] arb_internalformat_query2: Added tests for {COLOR, DEPTH, STENCIL}_COMPONENTS

2016-01-19 Thread Alejandro Piñeiro
From: Antia Puentes 

Tested on NVIDIA GeForce GTX 950 - NVIDIA 352.55: pass.
---
 tests/all.py   |   1 +
 .../arb_internalformat_query2/CMakeLists.gl.txt|   1 +
 .../arb_internalformat_query2/format-components.c  | 280 +
 3 files changed, 282 insertions(+)
 create mode 100644 tests/spec/arb_internalformat_query2/format-components.c

diff --git a/tests/all.py b/tests/all.py
index ea251c3..45cdf9d 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -3631,6 +3631,7 @@ with profile.group_manager(
 g(['arb_internalformat_query2-minmax'], 'minmax check for 
SAMPLES/NUM_SAMPLE_COUNTS')
 g(['arb_internalformat_query2-image-texture'], 'Checks for pnames related 
to ARB_image_load_store that return values from Table 3.22 (OpenGL 4.2)')
 g(['arb_internalformat_query2-filter'], 'FILTER pname checks.')
+g(['arb_internalformat_query2-format-components'], 
'{COLOR,DEPTH,STENCIL}_COMPONENTS pname checks')
 
 with profile.group_manager(
 PiglitGLTest, grouptools.join('spec', 'arb_map_buffer_range')) as g:
diff --git a/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt 
b/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
index f3da78d..13590a0 100644
--- a/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
+++ b/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
@@ -20,5 +20,6 @@ piglit_add_executable 
(arb_internalformat_query2-texture-compressed-block textur
 piglit_add_executable (arb_internalformat_query2-minmax minmax.c common.c)
 piglit_add_executable (arb_internalformat_query2-image-texture image-texture.c 
common.c)
 piglit_add_executable (arb_internalformat_query2-filter filter.c common.c)
+piglit_add_executable (arb_internalformat_query2-format-components 
format-components.c common.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_internalformat_query2/format-components.c 
b/tests/spec/arb_internalformat_query2/format-components.c
new file mode 100644
index 000..98fe959
--- /dev/null
+++ b/tests/spec/arb_internalformat_query2/format-components.c
@@ -0,0 +1,280 @@
+/*
+ * Copyright © 2015 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.
+ */
+
+/**
+ * \file format-components.c
+ *
+ * Tests if the values returned by:
+ *
+ *  * COLOR_COMPONENTS
+ *  * STENCIL_COMPONENTS
+ *  * DEPTH_COMPONENTS
+ *
+ * are correct for all the internalformats.
+ */
+
+#include "common.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+config.supports_gl_compat_version = 10;
+config.window_visual = PIGLIT_GL_VISUAL_RGB;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+return PIGLIT_FAIL;
+}
+
+static const GLenum pnames[] = {
+GL_COLOR_COMPONENTS,
+GL_STENCIL_COMPONENTS,
+GL_DEPTH_COMPONENTS,
+};
+
+static GLboolean
+is_color_format(GLenum internalformat)
+{
+switch (internalformat) {
+case GL_RED:
+case GL_RG:
+case GL_RGB:
+case GL_RGBA:
+case GL_R8:
+case GL_R8_SNORM:
+case GL_R16:
+case GL_R16_SNORM:
+case GL_RG8:
+case GL_RG8_SNORM:
+case GL_RG16:
+case GL_RG16_SNORM:
+case GL_R3_G3_B2:
+case GL_RGB4:
+case GL_RGB5:
+case GL_RGB8:
+case GL_RGB8_SNORM:
+case GL_RGB10:
+case GL_RGB12:
+case GL_RGB16:
+case GL_RGB16_SNORM:
+case GL_RGBA2:
+case GL_RGBA4:
+case GL_RGB5_A1:
+case GL_RGBA8:
+case GL_RGBA8_SNORM:
+case GL_RGB10_A2:
+case GL_RGB10_A2UI:
+case GL_RGBA12:
+case GL_RGBA16:
+case GL_RGBA16_SNORM:
+case GL_SRGB8:
+case GL_SRGB8_ALPHA8:
+case GL_R16F:
+case GL_RG16F:
+case GL_RGB16F:
+case GL_RGBA16F:
+case GL_R32F:
+case GL_RG32F:
+case 

[Piglit] [PATCH 05/21] arb_internalformat_query2: test for INTERNALFORMAT_{X}_SIZE pnames

2016-01-19 Thread Alejandro Piñeiro
From spec:
"  INTERNALFORMAT_RED_SIZE
   INTERNALFORMAT_GREEN_SIZE
   INTERNALFORMAT_BLUE_SIZE
   INTERNALFORMAT_ALPHA_SIZE
   INTERNALFORMAT_DEPTH_SIZE
   INTERNALFORMAT_STENCIL_SIZE
   INTERNALFORMAT_SHARED_SIZE

   For textures this query will return the same information as
   querying GetTexLevelParameter{if}v for TEXTURE_*_SIZE would return.
   If the internal format is unsupported, or if a particular component
   is not present in the format, 0 is written to ."

So this test calls GetInternalformat with INTERNALFORMAT_SUPPORTED:
  * If it is false, it checks that the returned value is 0.
  * If it is true, for texture targets, checks that the returned value
is the same that calling GetTexLevelParameter{if}v.

In order to call GetTexLevelParameter, it requires to create a texture
for the given internalformat/target combination. If that fails it is
assumed that the current implementation doesn't support that
combination, and it is tested against 0 too. Note that this means
that the test would output some error messages even if the test
passes.

Tested on NVIDIA GeForce GTX 950 - NVIDIA 352.55: fails on the next
cases:

  * Fails when trying to create a texture with some per-spec valid
internalformat, like 1D/3D textures with
GL_COMPRESSED_SIGNED_RED_RGTC1. Returns INVALID_ENUM, as if
TexCompressedImage1D were called.

 * GL_TEXTURE_BUFFER has a limited ranged of internalformat supported
   (table 3.15 from spec 4.2). So for example, creating a texture with
   target GL_TEXTURE_BUFFER and internalformat GL_DEPTH_STENCIL would
   fail. On those cases the query should return 0, but it is not
   always the case.
---
 tests/all.py   |   1 +
 .../arb_internalformat_query2/CMakeLists.gl.txt|   1 +
 tests/spec/arb_internalformat_query2/common.c  | 217 +
 tests/spec/arb_internalformat_query2/common.h  |  22 +++
 .../internalformat-size-checks.c   | 196 +++
 5 files changed, 437 insertions(+)
 create mode 100644 
tests/spec/arb_internalformat_query2/internalformat-size-checks.c

diff --git a/tests/all.py b/tests/all.py
index 78ba91f..53c268a 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -3622,6 +3622,7 @@ with profile.group_manager(
 g(['arb_internalformat_query2-api-errors'], 'API error checks')
 g(['arb_internalformat_query2-generic-pname-checks'], 'Individual most 
generic pname checks')
 g(['arb_internalformat_query2-samples-pnames'], 'SAMPLES and 
NUM_SAMPLE_COUNTS pname checks')
+g(['arb_internalformat_query2-internalformat-size-checks'], 'All 
INTERNALFORMAT__SIZE pname checks')
 
 with profile.group_manager(
 PiglitGLTest, grouptools.join('spec', 'arb_map_buffer_range')) as g:
diff --git a/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt 
b/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
index a204fb5..465501b 100644
--- a/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
+++ b/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
@@ -11,5 +11,6 @@ link_libraries (
 piglit_add_executable (arb_internalformat_query2-api-errors api-errors.c)
 piglit_add_executable (arb_internalformat_query2-generic-pname-checks 
generic-pname-checks.c common.c)
 piglit_add_executable (arb_internalformat_query2-samples-pnames 
samples-pnames.c common.c)
+piglit_add_executable (arb_internalformat_query2-internalformat-size-checks 
internalformat-size-checks.c common.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_internalformat_query2/common.c 
b/tests/spec/arb_internalformat_query2/common.c
index c860118..8cf096a 100644
--- a/tests/spec/arb_internalformat_query2/common.c
+++ b/tests/spec/arb_internalformat_query2/common.c
@@ -327,6 +327,223 @@ try_basic(const GLenum *targets, unsigned num_targets,
return pass;
 }
 
+/* Returns a valid format for @internalformat, so it would be possible
+ * to create a texture using glTexImageXD with that
+ * format/internalformat combination */
+static GLenum
+format_for_internalformat(const GLenum internalformat)
+{
+switch(internalformat) {
+case GL_DEPTH_COMPONENT:
+case GL_DEPTH_COMPONENT16:
+case GL_DEPTH_COMPONENT24:
+case GL_DEPTH_COMPONENT32:
+case GL_DEPTH_COMPONENT32F:
+return GL_DEPTH_COMPONENT;
+case GL_DEPTH_STENCIL:
+case GL_DEPTH24_STENCIL8:
+case GL_DEPTH32F_STENCIL8:
+return GL_DEPTH_STENCIL;
+case GL_RGB10_A2UI:
+case GL_R8I:
+case GL_R8UI:
+case GL_R16I:
+case GL_R16UI:
+case GL_R32I:
+case GL_R32UI:
+case GL_RG8I:
+case GL_RG16I:
+case GL_RG16UI:
+case GL_RG32I:
+case GL_RG32UI:
+case GL_RGB8I:
+case GL_RGB8UI:
+case GL_RGB16I:
+case GL_RGB16UI:
+case GL_RGB32I:
+case GL_RGB32UI:
+case GL_RGBA8I:
+case GL_RGBA8UI:
+case GL_RGBA16I:
+   

[Piglit] [PATCH 17/21] arb_internalformat_query2: test for TEXTURE_COMPRESSED_BLOCK_

2016-01-19 Thread Alejandro Piñeiro
This test add a check for the following pnames:
  * TEXTURE_COMPRESSED_BLOCK_WIDTH
  * TEXTURE_COMPRESSED_BLOCK_HEIGHT
  * TEXTURE_COMPRESSED_BLOCK_SIZE

On all those three, query2 spec says the following:
"If the internal format is not compressed, or the resource is not
 supported, 0 is returned."

We could have classified the existing internalformats on
compressed/non-compressed (similar to color-format/non-color-format
for COLOR_ENCONDING), but that seems pointless taking into account
that we already have TEXTURE_COMPRESSED to query if a internalformat
is compressed.

So this test queries TEXTURE_COMPRESSED and INTERNALFORMAT_SUPPORTED,
and if any of them is false, checks that the returned value for any of
those three pnames is zero.

Tested on NVIDIA GeForce GTX 950 - NVIDIA 352.55: pass.
---
 tests/all.py   |   1 +
 .../arb_internalformat_query2/CMakeLists.gl.txt|   2 +
 .../texture-compressed-block.c | 201 +
 3 files changed, 204 insertions(+)
 create mode 100644 
tests/spec/arb_internalformat_query2/texture-compressed-block.c

diff --git a/tests/all.py b/tests/all.py
index 616c3e0..a099251 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -3627,6 +3627,7 @@ with profile.group_manager(
 g(['arb_internalformat_query2-image-format-compatibility-type'], 
'IMAGE_FORMAT_COMPATIBILITY_TYPE pname checks')
 g(['arb_internalformat_query2-max-dimensions'], 'Max dimensions related 
pname checks')
 g(['arb_internalformat_query2-color-encoding'], 'COLOR_ENCODING pname 
check')
+g(['arb_internalformat_query2-texture-compressed-block'], 'All 
TEXTURE_COMPRESSED_BLOCK_ pname checks')
 
 with profile.group_manager(
 PiglitGLTest, grouptools.join('spec', 'arb_map_buffer_range')) as g:
diff --git a/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt 
b/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
index d56e002..5af4b2e 100644
--- a/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
+++ b/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
@@ -16,4 +16,6 @@ piglit_add_executable 
(arb_internalformat_query2-internalformat-type-checks inte
 piglit_add_executable 
(arb_internalformat_query2-image-format-compatibility-type 
image-format-compatibility-type.c common.c)
 piglit_add_executable (arb_internalformat_query2-max-dimensions 
max-dimensions.c common.c)
 piglit_add_executable (arb_internalformat_query2-color-encoding 
color-encoding.c common.c)
+piglit_add_executable (arb_internalformat_query2-texture-compressed-block 
texture-compressed-block.c common.c)
+
 # vim: ft=cmake:
diff --git a/tests/spec/arb_internalformat_query2/texture-compressed-block.c 
b/tests/spec/arb_internalformat_query2/texture-compressed-block.c
new file mode 100644
index 000..09dfb73
--- /dev/null
+++ b/tests/spec/arb_internalformat_query2/texture-compressed-block.c
@@ -0,0 +1,201 @@
+/*
+ * Copyright © 2015 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.
+ */
+
+/**
+ * \file texture-compressed-block.c
+ *
+ * Verify conditions defined on the spec for the following pnames:
+ *  * TEXTURE_COMPRESSED_BLOCK_WIDTH
+ *  * TEXTURE_COMPRESSED_BLOCK_HEIGHT
+ *  * TEXTURE_COMPRESSED_BLOCK_SIZE
+ *
+ * In all those three the spec says :
+ *
+ * "If the internal format is not compressed, or the resource is not
+ *  supported, 0 is returned."
+ *
+ * One could guess which internalformats are compressed, but
+ * TEXTURE_COMPRESSED is already there to know that.
+ *
+ * So this test just verifies that if TEXTURE_COMPRESSED or
+ * INTERNALFORMAT_SUPPORTED are false, all those pnames should return
+ * 0.
+ *
+ * In that sense, this test is generic-pname-checks on those pnames,
+ * plus a TEXTURE_COMPRESSED check.
+ *
+ */
+
+#include "common.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 10;
+   config.window_visual = 

[Piglit] [PATCH 16/21] arb_internalformat_query2: test for COLOR_ENCODING

2016-01-19 Thread Alejandro Piñeiro
From spec:
 "COLOR_ENCODING:
  
  Possible values for color buffers are LINEAR or SRGB, for linear or
  sRGB-encoded color components, respectively. For non-color formats
  (such as depth or stencil), or for unsupported resources, the value
  NONE is returned."

Tested on NVIDIA GeForce GTX 950 - NVIDIA 352.55: pass.
---
 tests/all.py   |   1 +
 .../arb_internalformat_query2/CMakeLists.gl.txt|   1 +
 .../arb_internalformat_query2/color-encoding.c | 210 +
 3 files changed, 212 insertions(+)
 create mode 100644 tests/spec/arb_internalformat_query2/color-encoding.c

diff --git a/tests/all.py b/tests/all.py
index 7bcc892..616c3e0 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -3626,6 +3626,7 @@ with profile.group_manager(
 g(['arb_internalformat_query2-internalformat-type-checks'], 'All 
INTERNALFORMAT__TYPE pname checks')
 g(['arb_internalformat_query2-image-format-compatibility-type'], 
'IMAGE_FORMAT_COMPATIBILITY_TYPE pname checks')
 g(['arb_internalformat_query2-max-dimensions'], 'Max dimensions related 
pname checks')
+g(['arb_internalformat_query2-color-encoding'], 'COLOR_ENCODING pname 
check')
 
 with profile.group_manager(
 PiglitGLTest, grouptools.join('spec', 'arb_map_buffer_range')) as g:
diff --git a/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt 
b/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
index 73e14f6..d56e002 100644
--- a/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
+++ b/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
@@ -15,4 +15,5 @@ piglit_add_executable 
(arb_internalformat_query2-internalformat-size-checks inte
 piglit_add_executable (arb_internalformat_query2-internalformat-type-checks 
internalformat-type-checks.c common.c)
 piglit_add_executable 
(arb_internalformat_query2-image-format-compatibility-type 
image-format-compatibility-type.c common.c)
 piglit_add_executable (arb_internalformat_query2-max-dimensions 
max-dimensions.c common.c)
+piglit_add_executable (arb_internalformat_query2-color-encoding 
color-encoding.c common.c)
 # vim: ft=cmake:
diff --git a/tests/spec/arb_internalformat_query2/color-encoding.c 
b/tests/spec/arb_internalformat_query2/color-encoding.c
new file mode 100644
index 000..5b47426
--- /dev/null
+++ b/tests/spec/arb_internalformat_query2/color-encoding.c
@@ -0,0 +1,210 @@
+/*
+ * Copyright © 2015 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.
+ */
+
+/**
+ * \file color-encoding.c
+ * Verify a handful of conditions required by COLOR_ENCODING
+ */
+
+#include "common.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 10;
+   config.window_visual = PIGLIT_GL_VISUAL_RGB;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+   return PIGLIT_FAIL;
+}
+
+static const GLint color_format_possible_values[] = {
+GL_NONE,
+GL_LINEAR,
+GL_SRGB,
+};
+
+static const GLenum color_internalformats[] = {
+GL_RED,
+GL_RG,
+GL_RGB,
+GL_RGBA,
+GL_R8,
+GL_R8_SNORM,
+GL_R16,
+GL_R16_SNORM,
+GL_RG8,
+GL_RG8_SNORM,
+GL_RG16,
+GL_RG16_SNORM,
+GL_R3_G3_B2,
+GL_RGB4,
+GL_RGB5,
+GL_RGB8,
+GL_RGB8_SNORM,
+GL_RGB10,
+GL_RGB12,
+GL_RGB16,
+GL_RGB16_SNORM,
+GL_RGBA2,
+GL_RGBA4,
+GL_RGB5_A1,
+GL_RGBA8,
+GL_RGBA8_SNORM,
+GL_RGB10_A2,
+GL_RGB10_A2UI,
+GL_RGBA12,
+GL_RGBA16,
+GL_RGBA16_SNORM,
+GL_SRGB8,
+GL_SRGB8_ALPHA8,
+GL_R16F,
+GL_RG16F,
+GL_RGB16F,
+GL_RGBA16F,
+GL_R32F,
+GL_RG32F,
+GL_RGB32F,
+GL_RGBA32F,
+GL_R11F_G11F_B10F,
+GL_RGB9_E5,
+GL_R8I,
+