Re: [Piglit] [PATCH] arb_copy_image: add new format swizzle test

2015-09-01 Thread Fredrik Höglund
On Tuesday 01 September 2015, Ilia Mirkin wrote:
> On Tue, Sep 1, 2015 at 12:22 PM, Fredrik Höglund  wrote:
> > On Tuesday 01 September 2015, Brian Paul wrote:
> >> On 08/31/2015 05:38 PM, Ilia Mirkin wrote:
> >> > On Mon, Aug 31, 2015 at 7:29 PM, Ilia Mirkin  
> >> > wrote:
> >> >> Reviewed-by: Ilia Mirkin 
> >> >>
> >> >> Thanks a lot for doing this! I assume that it fails with your gallium
> >> >> ARB_copy_image implementation as I predicted?
> >>
> >> Yes.  In Mesa, I added some code that checks for swizzles and uses
> >> pipe_context::blit() instead.  Seems to fix things, but I need to spend
> >> more time on it.
> >
> > This test is not sufficient though, because it's when you have a copy
> > from B8G8R8A8 to R16G16, or a similar situation, that things get really
> > interesting.
> 
> Yeah, so the thing is that you can't do this with unsized internal
> formats, since they're not part of the view classes, but you could
> (carefully) arrange for a *sized* internal format, like GL_RGBA8 to
> come out as a BGRA pipe format, and then try to copy it to RG16. And
> enjoy the fireworks :)

st/mesa uses the same rules when it selects a pipe format for
GL_RGBA8 as it does for GL_RGBA.  See find_exact_format()
in st_format.c
 
> But the test is a great start, still has my r-b.

Sure, my point is just that we are going to need additional tests for
compatible formats with different component orders.

Fredrik

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


Re: [Piglit] [PATCH] abr_gpu_shader_fp64: Verify that setting a double with glUniform*fv is an error

2015-09-01 Thread Ilia Mirkin
On Tue, Sep 1, 2015 at 2:33 PM, Ian Romanick  wrote:
> On 08/31/2015 09:34 PM, Ilia Mirkin wrote:
>> On Mon, Aug 31, 2015 at 11:55 PM, Ian Romanick  wrote:
>>> +static const char vs_source[] =
>>> +   "#version 330\n"
>>
>> The test description above only requires version 150. AFAIK there's no
>> need for anything higher...
>
> Yes... that was a copy-and-paste mistake.  I'll fix that.

With both instances of that fixed up, this is Reviewed-by: Ilia Mirkin

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


Re: [Piglit] [PATCH v2 4/4] Add API tests for KHR_texture_compression_astc_ldr

2015-09-01 Thread Dylan Baker
I assume this should be added to all.py as well?

On Fri, Aug 28, 2015 at 09:44:38AM -0700, Nanley Chery wrote:
> From: Nanley Chery 
> 
> These tests check that the GL error returned by valid and invalid API calls
> are as defined by the spec.
> 
> Signed-off-by: Nanley Chery 
> ---
>  .../khr_texture_compression_astc/CMakeLists.gl.txt |   1 +
>  .../CMakeLists.gles2.txt   |   1 +
>  .../khr_compressed_astc-basic.c| 366 
> +
>  3 files changed, 368 insertions(+)
>  create mode 100644 
> tests/spec/khr_texture_compression_astc/khr_compressed_astc-basic.c
> 
> diff --git a/tests/spec/khr_texture_compression_astc/CMakeLists.gl.txt 
> b/tests/spec/khr_texture_compression_astc/CMakeLists.gl.txt
> index a47c7d3..79500f7 100644
> --- a/tests/spec/khr_texture_compression_astc/CMakeLists.gl.txt
> +++ b/tests/spec/khr_texture_compression_astc/CMakeLists.gl.txt
> @@ -10,5 +10,6 @@ link_libraries (
>  )
>  
>  piglit_add_executable(khr_compressed_astc-miptree_${piglit_target_api} 
> khr_compressed_astc-miptree.c)
> +piglit_add_executable(khr_compressed_astc-basic_${piglit_target_api} 
> khr_compressed_astc-basic.c)
>  
>  # vim: ft=cmake:
> diff --git a/tests/spec/khr_texture_compression_astc/CMakeLists.gles2.txt 
> b/tests/spec/khr_texture_compression_astc/CMakeLists.gles2.txt
> index 047b8ac..3fb6fa5 100644
> --- a/tests/spec/khr_texture_compression_astc/CMakeLists.gles2.txt
> +++ b/tests/spec/khr_texture_compression_astc/CMakeLists.gles2.txt
> @@ -4,5 +4,6 @@ include_directories(
>  )
>  link_libraries(piglitutil_${piglit_target_api})
>  piglit_add_executable(khr_compressed_astc-miptree_${piglit_target_api} 
> khr_compressed_astc-miptree.c)
> +piglit_add_executable(khr_compressed_astc-basic_${piglit_target_api} 
> khr_compressed_astc-basic.c)
>  
>  # vim: ft=cmake:
> diff --git 
> a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-basic.c 
> b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-basic.c
> new file mode 100644
> index 000..d83ad5e
> --- /dev/null
> +++ b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-basic.c
> @@ -0,0 +1,366 @@
> +/*
> + * Copyright © 2011 Intel Corporation

2014 or 2015 I assume?

> + *
> + * 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 "piglit-util-gl.h"
> +
> +static const GLenum cube_map_face_targets[] = {
> +   GL_TEXTURE_CUBE_MAP_POSITIVE_X,
> +   GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
> +   GL_TEXTURE_CUBE_MAP_POSITIVE_Y,
> +   GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
> +   GL_TEXTURE_CUBE_MAP_POSITIVE_Z,
> +   GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
> +};
> +
> +static const GLenum good_targets[] = {
> +   GL_TEXTURE_2D_ARRAY,
> +   GL_TEXTURE_CUBE_MAP_ARRAY_EXT,
> +   GL_TEXTURE_3D,
> +};
> +
> +typedef struct _astc_fmt {
> + GLenum fmt;
> + int bw;
> + int bh;
> + int bb;
> +} astc_fmt;
> +
> +static const astc_fmt formats[] = {
> +{GL_COMPRESSED_RGBA_ASTC_4x4_KHR  ,  4,  4, 16},
> +{GL_COMPRESSED_RGBA_ASTC_5x4_KHR  ,  5,  4, 16},
> +{GL_COMPRESSED_RGBA_ASTC_5x5_KHR  ,  5,  5, 16},
> +{GL_COMPRESSED_RGBA_ASTC_6x5_KHR  ,  6,  5, 16},
> +{GL_COMPRESSED_RGBA_ASTC_6x6_KHR  ,  6,  6, 16},
> +{GL_COMPRESSED_RGBA_ASTC_8x5_KHR  ,  8,  5, 16},
> +{GL_COMPRESSED_RGBA_ASTC_8x6_KHR  ,  8,  6, 16},
> +{GL_COMPRESSED_RGBA_ASTC_8x8_KHR  ,  8,  8, 16},
> +{GL_COMPRESSED_RGBA_ASTC_10x5_KHR , 10,  5, 16},
> +{GL_COMPRESSED_RGBA_ASTC_10x6_KHR , 10,  6, 16},
> +{GL_COMPRESSED_RGBA_ASTC_10x8_KHR , 10,  8, 16},
> +{GL_COMPRESSED_RGBA_ASTC_10x10_KHR, 10, 10, 16},
> +{GL_COMPRESSED_RGBA_ASTC_12x10_KHR, 12, 10, 16},
> +{GL_COMPRESSED_RGBA_ASTC_12x12_KHR, 12, 12, 16},
> +

Re: [Piglit] [PATCH] abr_gpu_shader_fp64: Verify that setting a double with glUniform*fv is an error

2015-09-01 Thread Ian Romanick
On 08/31/2015 09:34 PM, Ilia Mirkin wrote:
> On Mon, Aug 31, 2015 at 11:55 PM, Ian Romanick  wrote:
>> +static const char vs_source[] =
>> +   "#version 330\n"
> 
> The test description above only requires version 150. AFAIK there's no
> need for anything higher...

Yes... that was a copy-and-paste mistake.  I'll fix that.

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


Re: [Piglit] [PATCH] abr_gpu_shader_fp64: Verify that setting a double with glUniform*fv is an error

2015-09-01 Thread Ian Romanick
On 08/31/2015 11:41 PM, Matt Turner wrote:
> On Mon, Aug 31, 2015 at 8:55 PM, Ian Romanick  wrote:
>> From: Ian Romanick 
>>
>> Also verify that setting a float with glUniform*dv generates an error.
>>
>> NOTE: Mesa currently fails the matrix tests.
>>
>> Signed-off-by: Ian Romanick 
>> Cc: Dave Airlie 
>> ---
> 
> Typo in subject: abr -> arb

Yeah I noticed that as soon as I looked in my e-mail for reviews.  D'oh!

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


Re: [Piglit] [PATCH] arb_copy_image: add new format swizzle test

2015-09-01 Thread Ilia Mirkin
On Tue, Sep 1, 2015 at 1:14 PM, Fredrik Höglund  wrote:
> On Tuesday 01 September 2015, Ilia Mirkin wrote:
>> On Tue, Sep 1, 2015 at 12:22 PM, Fredrik Höglund  wrote:
>> > On Tuesday 01 September 2015, Brian Paul wrote:
>> >> On 08/31/2015 05:38 PM, Ilia Mirkin wrote:
>> >> > On Mon, Aug 31, 2015 at 7:29 PM, Ilia Mirkin  
>> >> > wrote:
>> >> >> Reviewed-by: Ilia Mirkin 
>> >> >>
>> >> >> Thanks a lot for doing this! I assume that it fails with your gallium
>> >> >> ARB_copy_image implementation as I predicted?
>> >>
>> >> Yes.  In Mesa, I added some code that checks for swizzles and uses
>> >> pipe_context::blit() instead.  Seems to fix things, but I need to spend
>> >> more time on it.
>> >
>> > This test is not sufficient though, because it's when you have a copy
>> > from B8G8R8A8 to R16G16, or a similar situation, that things get really
>> > interesting.
>>
>> Yeah, so the thing is that you can't do this with unsized internal
>> formats, since they're not part of the view classes, but you could
>> (carefully) arrange for a *sized* internal format, like GL_RGBA8 to
>> come out as a BGRA pipe format, and then try to copy it to RG16. And
>> enjoy the fireworks :)
>
> st/mesa uses the same rules when it selects a pipe format for
> GL_RGBA8 as it does for GL_RGBA.  See find_exact_format()
> in st_format.c

I know, but this test only uses unsized internal formats :)

>
>> But the test is a great start, still has my r-b.
>
> Sure, my point is just that we are going to need additional tests for
> compatible formats with different component orders.
>
> Fredrik
>
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] abr_gpu_shader_fp64: Verify that setting a double with glUniform*fv is an error

2015-09-01 Thread Matt Turner
On Mon, Aug 31, 2015 at 8:55 PM, Ian Romanick  wrote:
> From: Ian Romanick 
>
> Also verify that setting a float with glUniform*dv generates an error.
>
> NOTE: Mesa currently fails the matrix tests.
>
> Signed-off-by: Ian Romanick 
> Cc: Dave Airlie 
> ---

Typo in subject: abr -> arb
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] arb_copy_image: fix a few error check tests

2015-09-01 Thread Ian Romanick
On 08/31/2015 04:22 PM, Brian Paul wrote:
> Some of the error checks were incorrect before.  Per the spec:
> 
> 1. GL_TEXTURE_BUFFER and GL_TEXTURE_CUBE_MAP_+/-_XYZ are not legal targets
> and should be flagged as invalid enums.

I think we should not check these targets.  Checking for either error
assumes that the implementation checks for the (multiple) error
conditions in a particular order.

> 2. GL_INVALID_OPERATION should be generated when trying to copy between
> compressed/uncompressed formats whose block/texel size do not match.
> ---
>  tests/spec/arb_copy_image/api_errors.c | 23 +++
>  1 file changed, 19 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/spec/arb_copy_image/api_errors.c 
> b/tests/spec/arb_copy_image/api_errors.c
> index 0ef1eda..6f94d06 100644
> --- a/tests/spec/arb_copy_image/api_errors.c
> +++ b/tests/spec/arb_copy_image/api_errors.c
> @@ -140,7 +140,14 @@ test_simple_errors(GLenum src_target, GLenum dst_target)
>   glCopyImageSubData(src, targets[i], 0, 0, 0, 0,
>  dst, dst_target, 0, 0, 0, 0,
>  0, 0, 0);
> - pass &= piglit_check_gl_error(GL_INVALID_ENUM);

I'd support a follow-up patch that changes this test to follow the
piglit idiom of

pass = test() && pass;

> +if (targets[i] == GL_TEXTURE_BUFFER ||
> + (targets[i] >= GL_TEXTURE_CUBE_MAP_POSITIVE_X &&
> +  targets[i] <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z)) {
> + pass &= piglit_check_gl_error(GL_INVALID_ENUM);
> + }
> + else {
> + pass &= piglit_check_gl_error(GL_INVALID_VALUE);
> + }
>   if (!pass)
>   return false;
>   }
> @@ -154,7 +161,14 @@ test_simple_errors(GLenum src_target, GLenum dst_target)
>   glCopyImageSubData(src, src_target, 0, 0, 0, 0,
>  dst, targets[i], 0, 0, 0, 0,
>  0, 0, 0);
> - pass &= piglit_check_gl_error(GL_INVALID_ENUM);
> +if (targets[i] == GL_TEXTURE_BUFFER ||
> + (targets[i] >= GL_TEXTURE_CUBE_MAP_POSITIVE_X &&
> +  targets[i] <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z)) {
> + pass &= piglit_check_gl_error(GL_INVALID_ENUM);
> + }
> + else {
> + pass &= piglit_check_gl_error(GL_INVALID_VALUE);
> + }
>   if (!pass)
>   return false;
>   }
> @@ -235,14 +249,15 @@ test_compressed_alignment_errors()

Ugh.  This test is woefully lacking in spec quotations. :(  If you
replace the comment above this line with:

/* Section 18.3.2 (Copying Between Images) of the OpenGL 4.5 Core
 * Profile spec says:
 *
 * "An INVALID_OPERATION error is generated if the texel size of
 * the uncompressed image is not equal to the block size of the
 * compressed image."
 */

>   glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGB16UI, 32, 32);
>   glCopyImageSubData(tex[0], GL_TEXTURE_2D, 0, 0, 0, 0,
>  tex[2], GL_TEXTURE_2D, 0, 0, 0, 0, 20, 20, 1);
> - pass &= piglit_check_gl_error(GL_INVALID_VALUE);
> + pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
>  
> +/* Check for invalid copy between different compressed formats */

and replace this comment with

/* Section 18.3.2 (Copying Between Images) of the OpenGL 4.5 Core
 * Profile spec says:
 *
 * "An INVALID_OPERATION error is generated if the formats are
 * not compatible."
 *
 * The definition of compatible refers back to table 8.22 "Compatible
 * internal formats for TextureView."  This table does not contain
 * S3TC formats because they are from an older extension.  Given the
 * different encodings of DXT1 and DXT3 textures, it is reasonable to
 * assume they would not be compatible for texture views, and this
 * matches at least NVIDIA's implementation.
 */

then the last two hunks are

Signed-off-by: Ian Romanick 
Reviewed-by: Ian Romanick 

With the amount of effort that justification required, I almost wonder if we
should change the test to use RGTC formats (which are in table 8.22 instead).

It also looks like this test needs to check that one of the S3TC extensions
is supported. :(  I can submit a patch for that... assuming you don't want
to change the test to use RGTC instead.

>   glBindTexture(GL_TEXTURE_2D, tex[3]);
>   

[Piglit] [PATCH] arb_copy_image: fix a few error check tests

2015-09-01 Thread Brian Paul
Some of the error checks were incorrect before.  Per the spec:

1. GL_TEXTURE_BUFFER and GL_TEXTURE_CUBE_MAP_+/-_XYZ are not legal targets
and should be flagged as invalid enums.

2. GL_INVALID_OPERATION should be generated when trying to copy between
compressed/uncompressed formats whose block/texel size do not match.

v2: Also quote spec language for the tests being done, per Ian.
And, remove testing invalid target enums.
---
 tests/spec/arb_copy_image/api_errors.c | 59 ++
 1 file changed, 45 insertions(+), 14 deletions(-)

diff --git a/tests/spec/arb_copy_image/api_errors.c 
b/tests/spec/arb_copy_image/api_errors.c
index 0ef1eda..00c97a5 100644
--- a/tests/spec/arb_copy_image/api_errors.c
+++ b/tests/spec/arb_copy_image/api_errors.c
@@ -78,22 +78,16 @@ image_storage(GLenum target, GLuint name, GLenum 
internal_format,
}
 }
 
-GLenum targets[] = {
+/* only testing legal targets below */
+static const GLenum targets[] = {
GL_TEXTURE_1D,
GL_TEXTURE_1D_ARRAY,
GL_TEXTURE_2D,
GL_TEXTURE_RECTANGLE,
-   GL_TEXTURE_BUFFER,
GL_TEXTURE_2D_ARRAY,
GL_TEXTURE_2D_MULTISAMPLE,
GL_TEXTURE_2D_MULTISAMPLE_ARRAY,
GL_TEXTURE_CUBE_MAP,
-   GL_TEXTURE_CUBE_MAP_POSITIVE_X,
-   GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
-   GL_TEXTURE_CUBE_MAP_POSITIVE_Y,
-   GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
-   GL_TEXTURE_CUBE_MAP_POSITIVE_Z,
-   GL_TEXTURE_CUBE_MAP_NEGATIVE_Z,
GL_TEXTURE_CUBE_MAP_ARRAY,
GL_TEXTURE_3D
 };
@@ -132,29 +126,45 @@ test_simple_errors(GLenum src_target, GLenum dst_target)
/* This is no longer needed */
image_delete(src_target, src2);
 
+   /* Section 18.3.2 (Copying Between Images) of the OpenGL 4.5 Core
+* Profile spec says:
+*
+* "An INVALID_VALUE error is generated if either name does not
+* correspond to a valid renderbuffer or texture object according
+* to the corresponding target parameter."
+*/
if (src_target != GL_RENDERBUFFER_EXT) {
for (i = 0; i < ARRAY_LENGTH(targets); ++i) {
if (targets[i] == src_target)
continue;
 
+   /* here, targets[i] doesn't match src object's target */
glCopyImageSubData(src, targets[i], 0, 0, 0, 0,
   dst, dst_target, 0, 0, 0, 0,
   0, 0, 0);
-   pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+   pass &= piglit_check_gl_error(GL_INVALID_VALUE);
if (!pass)
return false;
}
}
 
+   /* Section 18.3.2 (Copying Between Images) of the OpenGL 4.5 Core
+* Profile spec says:
+*
+* "An INVALID_VALUE error is generated if either name does not
+* correspond to a valid renderbuffer or texture object according
+* to the corresponding target parameter."
+*/
if (dst_target != GL_RENDERBUFFER_EXT) {
for (i = 0; i < ARRAY_LENGTH(targets); ++i) {
if (targets[i] == dst_target)
continue;
 
+   /* here, targets[i] doesn't match dst object's target */
glCopyImageSubData(src, src_target, 0, 0, 0, 0,
   dst, targets[i], 0, 0, 0, 0,
   0, 0, 0);
-   pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+   pass &= piglit_check_gl_error(GL_INVALID_VALUE);
if (!pass)
return false;
}
@@ -230,19 +240,38 @@ test_compressed_alignment_errors()
   tex[1], GL_TEXTURE_2D, 0, 0, 0, 0, 20, 24, 1);
pass &= piglit_check_gl_error(GL_INVALID_VALUE);
 
-   /* Check for compressed with wrong block size */
+   /* Section 18.3.2 (Copying Between Images) of the OpenGL 4.5 Core
+* Profile spec says:
+*
+* "An INVALID_OPERATION error is generated if the texel size of
+* the uncompressed image is not equal to the block size of the
+* compressed image."
+*/
glBindTexture(GL_TEXTURE_2D, tex[2]);
glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGB16UI, 32, 32);
glCopyImageSubData(tex[0], GL_TEXTURE_2D, 0, 0, 0, 0,
   tex[2], GL_TEXTURE_2D, 0, 0, 0, 0, 20, 20, 1);
-   pass &= piglit_check_gl_error(GL_INVALID_VALUE);
+   pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
 
+   /* Section 18.3.2 (Copying Between Images) of the OpenGL 4.5 Core
+* Profile spec says:
+*
+* "An INVALID_OPERATION error is generated if the formats are
+ * not compatible."

Re: [Piglit] [PATCH] arb_copy_image: fix a few error check tests

2015-09-01 Thread Brian Paul

On 09/01/2015 02:33 PM, Ian Romanick wrote:

On 08/31/2015 04:22 PM, Brian Paul wrote:

Some of the error checks were incorrect before.  Per the spec:

1. GL_TEXTURE_BUFFER and GL_TEXTURE_CUBE_MAP_+/-_XYZ are not legal targets
and should be flagged as invalid enums.


I think we should not check these targets.  Checking for either error
assumes that the implementation checks for the (multiple) error
conditions in a particular order.


2. GL_INVALID_OPERATION should be generated when trying to copy between
compressed/uncompressed formats whose block/texel size do not match.
---
  tests/spec/arb_copy_image/api_errors.c | 23 +++
  1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/tests/spec/arb_copy_image/api_errors.c 
b/tests/spec/arb_copy_image/api_errors.c
index 0ef1eda..6f94d06 100644
--- a/tests/spec/arb_copy_image/api_errors.c
+++ b/tests/spec/arb_copy_image/api_errors.c
@@ -140,7 +140,14 @@ test_simple_errors(GLenum src_target, GLenum dst_target)
glCopyImageSubData(src, targets[i], 0, 0, 0, 0,
   dst, dst_target, 0, 0, 0, 0,
   0, 0, 0);
-   pass &= piglit_check_gl_error(GL_INVALID_ENUM);


I'd support a follow-up patch that changes this test to follow the
piglit idiom of

pass = test() && pass;


+if (targets[i] == GL_TEXTURE_BUFFER ||
+   (targets[i] >= GL_TEXTURE_CUBE_MAP_POSITIVE_X &&
+targets[i] <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z)) {
+   pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+   }
+   else {
+   pass &= piglit_check_gl_error(GL_INVALID_VALUE);
+   }
if (!pass)
return false;
}
@@ -154,7 +161,14 @@ test_simple_errors(GLenum src_target, GLenum dst_target)
glCopyImageSubData(src, src_target, 0, 0, 0, 0,
   dst, targets[i], 0, 0, 0, 0,
   0, 0, 0);
-   pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+if (targets[i] == GL_TEXTURE_BUFFER ||
+   (targets[i] >= GL_TEXTURE_CUBE_MAP_POSITIVE_X &&
+targets[i] <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z)) {
+   pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+   }
+   else {
+   pass &= piglit_check_gl_error(GL_INVALID_VALUE);
+   }
if (!pass)
return false;
}
@@ -235,14 +249,15 @@ test_compressed_alignment_errors()


Ugh.  This test is woefully lacking in spec quotations. :(  If you
replace the comment above this line with:

/* Section 18.3.2 (Copying Between Images) of the OpenGL 4.5 Core
 * Profile spec says:
 *
 * "An INVALID_OPERATION error is generated if the texel size of
 * the uncompressed image is not equal to the block size of the
 * compressed image."
 */


glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGB16UI, 32, 32);
glCopyImageSubData(tex[0], GL_TEXTURE_2D, 0, 0, 0, 0,
   tex[2], GL_TEXTURE_2D, 0, 0, 0, 0, 20, 20, 1);
-   pass &= piglit_check_gl_error(GL_INVALID_VALUE);
+   pass &= piglit_check_gl_error(GL_INVALID_OPERATION);

+/* Check for invalid copy between different compressed formats */


and replace this comment with

/* Section 18.3.2 (Copying Between Images) of the OpenGL 4.5 Core
 * Profile spec says:
 *
 * "An INVALID_OPERATION error is generated if the formats are
  * not compatible."
  *
  * The definition of compatible refers back to table 8.22 "Compatible
 * internal formats for TextureView."  This table does not contain
 * S3TC formats because they are from an older extension.  Given the
 * different encodings of DXT1 and DXT3 textures, it is reasonable to
 * assume they would not be compatible for texture views, and this
 * matches at least NVIDIA's implementation.
 */

then the last two hunks are

Signed-off-by: Ian Romanick 
Reviewed-by: Ian Romanick 

With the amount of effort that justification required, I almost wonder if we
should change the test to use RGTC formats (which are in table 8.22 instead).

It also looks like this test needs to check that one of the S3TC extensions
is supported. :(  I can submit a patch for that... assuming you don't want
to change the test to use RGTC instead.


glBindTexture(GL_TEXTURE_2D, tex[3]);

Re: [Piglit] [PATCH] glsl-1.10: test for rotating a variable components in a loop

2015-09-01 Thread Ilia Mirkin
On Tue, Sep 1, 2015 at 9:02 PM, Dave Airlie  wrote:
> From: Dave Airlie 
>
> This test fails on r600 with sb enabled, it does something
> similiar to what a lot of the CTS test cases do.
>
> Signed-off-by: Dave Airlie 
> ---
>  .../fs-while-loop-rotate-value.shader_test | 32 
> ++
>  1 file changed, 32 insertions(+)
>  create mode 100644 
> tests/spec/glsl-1.10/execution/fs-while-loop-rotate-value.shader_test
>
> diff --git 
> a/tests/spec/glsl-1.10/execution/fs-while-loop-rotate-value.shader_test 
> b/tests/spec/glsl-1.10/execution/fs-while-loop-rotate-value.shader_test
> new file mode 100644
> index 000..cb08b0f
> --- /dev/null
> +++ b/tests/spec/glsl-1.10/execution/fs-while-loop-rotate-value.shader_test
> @@ -0,0 +1,32 @@
> +# test to check a bug in r600 sb backend
> +# it miscompiles this due to the 1.0
> +# at the end wierdly.
> +[require]
> +GLSL >= 1.10

Is this allowed in GLSL 1.10? (Having a non-compile-time-resolvable loop)

> +
> +[vertex shader]

[vertex shader passthrough]

> +void main()
> +{
> +  gl_Position = gl_Vertex;
> +}
> +
> +[fragment shader]
> +uniform int count;
> +uniform vec4 init_val;
> +
> +void main()
> +{
> +   vec4 out_val = init_val;
> +   int i = 0;
> +   while (i++ < count) {
> +   out_val = out_val.yzwx;
> +   }
> +   gl_FragColor = vec4(out_val.xyz, 1.0);
> +}
> +
> +[test]
> +uniform int count 3
> +uniform vec4 init_val 0.25 0.5 0.75 1.0
> +
> +draw rect -1 -1 2 2
> +probe all rgba 1.0 0.25 0.5 1.0

Reviewed-by: Ilia Mirkin 

BTW, there's also a tests/shaders/ssa if you prefer to place it in
there... IIRC it has a similar test, but I guess this one's different
enough.

> --
> 2.4.3
>
> ___
> 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] glsl-1.10: test for rotating a variable components in a loop

2015-09-01 Thread Dave Airlie
From: Dave Airlie 

This test fails on r600 with sb enabled, it does something
similiar to what a lot of the CTS test cases do.

Signed-off-by: Dave Airlie 
---
 .../fs-while-loop-rotate-value.shader_test | 32 ++
 1 file changed, 32 insertions(+)
 create mode 100644 
tests/spec/glsl-1.10/execution/fs-while-loop-rotate-value.shader_test

diff --git 
a/tests/spec/glsl-1.10/execution/fs-while-loop-rotate-value.shader_test 
b/tests/spec/glsl-1.10/execution/fs-while-loop-rotate-value.shader_test
new file mode 100644
index 000..cb08b0f
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/fs-while-loop-rotate-value.shader_test
@@ -0,0 +1,32 @@
+# test to check a bug in r600 sb backend
+# it miscompiles this due to the 1.0 
+# at the end wierdly.
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+void main()
+{
+  gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+uniform int count;
+uniform vec4 init_val;
+
+void main()
+{
+   vec4 out_val = init_val;
+   int i = 0;
+   while (i++ < count) {
+   out_val = out_val.yzwx;
+   }
+   gl_FragColor = vec4(out_val.xyz, 1.0);
+}
+
+[test]
+uniform int count 3
+uniform vec4 init_val 0.25 0.5 0.75 1.0
+
+draw rect -1 -1 2 2
+probe all rgba 1.0 0.25 0.5 1.0
-- 
2.4.3

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


[Piglit] [PATCH] Porting basic GL rendering tests to piglit

2015-09-01 Thread Juliet Fru
---
 tests/all.py|   1 +
 tests/spec/gl-1.0/CMakeLists.gl.txt |   1 +
 tests/spec/gl-1.0/no-op-paths.c | 332 
 3 files changed, 334 insertions(+)
 create mode 100644 tests/spec/gl-1.0/no-op-paths.c

diff --git a/tests/all.py b/tests/all.py
index fcfc5cd..85973d6 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1000,6 +1000,7 @@ with profile.group_manager(
 g(['gl-1.0-ortho-pos'])
 g(['gl-1.0-readpixsanity'])
 g(['gl-1.0-logicop'])
+g(['gl-1.0-no-op-paths'])
 
 with profile.group_manager(
 PiglitGLTest,
diff --git a/tests/spec/gl-1.0/CMakeLists.gl.txt 
b/tests/spec/gl-1.0/CMakeLists.gl.txt
index d04b835..7a7f508 100644
--- a/tests/spec/gl-1.0/CMakeLists.gl.txt
+++ b/tests/spec/gl-1.0/CMakeLists.gl.txt
@@ -22,6 +22,7 @@ piglit_add_executable (gl-1.0-front-invalidate-back 
front-invalidate-back.c)
 piglit_add_executable (gl-1.0-logicop logicop.c)
 piglit_add_executable (gl-1.0-long-dlist long-dlist.c)
 piglit_add_executable (gl-1.0-ortho-pos orthpos.c)
+piglit_add_executable (gl-1.0-no-op-paths no-op-paths.c)
 piglit_add_executable (gl-1.0-polygon-line-aa polygon-line-aa.c)
 piglit_add_executable (gl-1.0-push-no-attribs push-no-attribs.c)
 piglit_add_executable (gl-1.0-readpixsanity readpix.c)
diff --git a/tests/spec/gl-1.0/no-op-paths.c b/tests/spec/gl-1.0/no-op-paths.c
new file mode 100644
index 000..ea4abf5
--- /dev/null
+++ b/tests/spec/gl-1.0/no-op-paths.c
@@ -0,0 +1,332 @@
+/*  BEGIN_COPYRIGHT -*- glean -*-
+ *
+ *  Copyright (C) 1999  Allen Akin   All Rights Reserved.
+ *  Copyright (C) 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.
+ *
+ *  END_COPYRIGHT
+ */
+/** @file paths.c
+ *
+ *  Test basic GL rendering paths.
+ *
+ *
+ * Based on the original Glean tpaths.cpp test, this test verifies
+ * that basic, trival OpenGL paths work as expected. For example,
+ * glAlphaFunc(GL_GEQUAL, 0.0) should always pass and
+ * glAlphaFunc(GL_LESS, 0.0) should always fail.  We setup trivial
+ * pass and fail conditions for each of alpha test, blending, color mask,
+ * depth test, logic ops, scissor, stencil, stipple, and texture and
+ * make sure they work as expected.  We also setup trival-pass for all
+ * these paths simultaneously and test that as well.
+ *
+ * To test for pass/fail we examine the color buffer for white or black,
+ * respectively.
+ *
+ * Authors:
+ * Brian Paul 
+ * Adapted to Piglit by Juliet Fru , August 2015.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 10;
+
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA |
+   PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_DEPTH;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum path {
+   ALPHA,
+   BLEND,
+   COLOR_MASK,
+   DEPTH,
+   LOGIC,
+   SCISSOR,
+   STENCIL,
+   STIPPLE,
+   TEXTURE,
+   ZZZ  /* end-of-list token */
+};
+
+enum state{
+   DISABLE,
+   ALWAYS_PASS,
+   ALWAYS_FAIL
+};
+
+const char *
+path_name(enum path paths)
+{
+   switch (paths) {
+   case ALPHA:
+   return "Alpha Test";
+   case BLEND:
+   return "Blending";
+   case COLOR_MASK:
+   return "Color Mask";
+   case DEPTH:
+   return "Depth Test";
+   case LOGIC:
+   return "LogicOp";
+   case SCISSOR:
+   return "Scissor Test";
+   case STENCIL:
+   return "Stencil Test";
+   case STIPPLE:
+   return "Polygon Stipple";
+   case TEXTURE:
+   return "Modulated Texture";
+   case ZZZ:
+   return "paths";
+   }
+}
+
+void
+set_path_state(enum path paths, enum state states)
+{
+   int i;
+   switch (paths) {
+   case ALPHA:
+  

Re: [Piglit] [PATCH] Porting basic GL rendering tests to piglit

2015-09-01 Thread Ilia Mirkin
On Tue, Sep 1, 2015 at 5:49 PM, Juliet Fru  wrote:
> ---
>  tests/all.py|   1 +
>  tests/spec/gl-1.0/CMakeLists.gl.txt |   1 +
>  tests/spec/gl-1.0/no-op-paths.c | 332 
> 
>  3 files changed, 334 insertions(+)
>  create mode 100644 tests/spec/gl-1.0/no-op-paths.c
>
> diff --git a/tests/all.py b/tests/all.py
> index fcfc5cd..85973d6 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -1000,6 +1000,7 @@ with profile.group_manager(
>  g(['gl-1.0-ortho-pos'])
>  g(['gl-1.0-readpixsanity'])
>  g(['gl-1.0-logicop'])
> +g(['gl-1.0-no-op-paths'])
>
>  with profile.group_manager(
>  PiglitGLTest,
> diff --git a/tests/spec/gl-1.0/CMakeLists.gl.txt 
> b/tests/spec/gl-1.0/CMakeLists.gl.txt
> index d04b835..7a7f508 100644
> --- a/tests/spec/gl-1.0/CMakeLists.gl.txt
> +++ b/tests/spec/gl-1.0/CMakeLists.gl.txt
> @@ -22,6 +22,7 @@ piglit_add_executable (gl-1.0-front-invalidate-back 
> front-invalidate-back.c)
>  piglit_add_executable (gl-1.0-logicop logicop.c)
>  piglit_add_executable (gl-1.0-long-dlist long-dlist.c)
>  piglit_add_executable (gl-1.0-ortho-pos orthpos.c)
> +piglit_add_executable (gl-1.0-no-op-paths no-op-paths.c)
>  piglit_add_executable (gl-1.0-polygon-line-aa polygon-line-aa.c)
>  piglit_add_executable (gl-1.0-push-no-attribs push-no-attribs.c)
>  piglit_add_executable (gl-1.0-readpixsanity readpix.c)
> diff --git a/tests/spec/gl-1.0/no-op-paths.c b/tests/spec/gl-1.0/no-op-paths.c
> new file mode 100644
> index 000..ea4abf5
> --- /dev/null
> +++ b/tests/spec/gl-1.0/no-op-paths.c
> @@ -0,0 +1,332 @@
> +/*  BEGIN_COPYRIGHT -*- glean -*-
> + *
> + *  Copyright (C) 1999  Allen Akin   All Rights Reserved.
> + *  Copyright (C) 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.
> + *
> + *  END_COPYRIGHT
> + */
> +/** @file paths.c
> + *
> + *  Test basic GL rendering paths.
> + *
> + *
> + * Based on the original Glean tpaths.cpp test, this test verifies
> + * that basic, trival OpenGL paths work as expected. For example,
> + * glAlphaFunc(GL_GEQUAL, 0.0) should always pass and
> + * glAlphaFunc(GL_LESS, 0.0) should always fail.  We setup trivial
> + * pass and fail conditions for each of alpha test, blending, color mask,
> + * depth test, logic ops, scissor, stencil, stipple, and texture and
> + * make sure they work as expected.  We also setup trival-pass for all
> + * these paths simultaneously and test that as well.
> + *
> + * To test for pass/fail we examine the color buffer for white or black,
> + * respectively.
> + *
> + * Authors:
> + * Brian Paul 
> + * Adapted to Piglit by Juliet Fru , August 2015.
> + */
> +
> +#include "piglit-util-gl.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> +   config.supports_gl_compat_version = 10;
> +
> +   config.window_visual = PIGLIT_GL_VISUAL_RGBA |
> +   PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_DEPTH;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +enum path {
> +   ALPHA,
> +   BLEND,
> +   COLOR_MASK,
> +   DEPTH,
> +   LOGIC,
> +   SCISSOR,
> +   STENCIL,
> +   STIPPLE,
> +   TEXTURE,
> +   ZZZ  /* end-of-list token */
> +};
> +
> +enum state{

Missing space

> +   DISABLE,
> +   ALWAYS_PASS,
> +   ALWAYS_FAIL
> +};
> +
> +const char *

static

> +path_name(enum path paths)
> +{
> +   switch (paths) {
> +   case ALPHA:
> +   return "Alpha Test";
> +   case BLEND:
> +   return "Blending";
> +   case COLOR_MASK:
> +   return "Color Mask";
> +   case DEPTH:
> +   return "Depth Test";
> +   case LOGIC:
> +   return "LogicOp";
> +   case SCISSOR:
> +   return "Scissor Test";
> +   case 

Re: [Piglit] [PATCH] arb_copy_image: add new format swizzle test

2015-09-01 Thread Ilia Mirkin
On Tue, Sep 1, 2015 at 12:22 PM, Fredrik Höglund  wrote:
> On Tuesday 01 September 2015, Brian Paul wrote:
>> On 08/31/2015 05:38 PM, Ilia Mirkin wrote:
>> > On Mon, Aug 31, 2015 at 7:29 PM, Ilia Mirkin  wrote:
>> >> Reviewed-by: Ilia Mirkin 
>> >>
>> >> Thanks a lot for doing this! I assume that it fails with your gallium
>> >> ARB_copy_image implementation as I predicted?
>>
>> Yes.  In Mesa, I added some code that checks for swizzles and uses
>> pipe_context::blit() instead.  Seems to fix things, but I need to spend
>> more time on it.
>
> This test is not sufficient though, because it's when you have a copy
> from B8G8R8A8 to R16G16, or a similar situation, that things get really
> interesting.

Yeah, so the thing is that you can't do this with unsized internal
formats, since they're not part of the view classes, but you could
(carefully) arrange for a *sized* internal format, like GL_RGBA8 to
come out as a BGRA pipe format, and then try to copy it to RG16. And
enjoy the fireworks :)

But the test is a great start, still has my r-b.

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


Re: [Piglit] [PATCH] arb_copy_image: add new format swizzle test

2015-09-01 Thread Fredrik Höglund
On Tuesday 01 September 2015, Brian Paul wrote:
> On 08/31/2015 05:38 PM, Ilia Mirkin wrote:
> > On Mon, Aug 31, 2015 at 7:29 PM, Ilia Mirkin  wrote:
> >> Reviewed-by: Ilia Mirkin 
> >>
> >> Thanks a lot for doing this! I assume that it fails with your gallium
> >> ARB_copy_image implementation as I predicted?
> 
> Yes.  In Mesa, I added some code that checks for swizzles and uses 
> pipe_context::blit() instead.  Seems to fix things, but I need to spend 
> more time on it.

This test is not sufficient though, because it's when you have a copy
from B8G8R8A8 to R16G16, or a similar situation, that things get really
interesting.

Fredrik

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


Re: [Piglit] [PATCH] ext_texture_integer: add new tex formats test

2015-09-01 Thread Brian Paul

On 08/31/2015 05:38 PM, Ilia Mirkin wrote:

On Mon, Aug 31, 2015 at 7:21 PM, Brian Paul  wrote:

Test glTexImage2D() and glGetTexImage() with a variety of internalFormats
and user formats/types.

Note: currently fails with Mesa, passes with NVIDIA.
---
  tests/all.py |   1 +
  tests/spec/ext_texture_integer/CMakeLists.gl.txt |   1 +
  tests/spec/ext_texture_integer/texformats.c  | 182 +++
  3 files changed, 184 insertions(+)
  create mode 100644 tests/spec/ext_texture_integer/texformats.c

diff --git a/tests/all.py b/tests/all.py
index fe088f5..9320722 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -3127,6 +3127,7 @@ with profile.group_manager(
  g(['ext_texture_integer-getteximage-clamping'], 'getteximage-clamping')
  g(['ext_texture_integer-getteximage-clamping', 'GL_ARB_texture_rg'],
'getteximage-clamping GL_ARB_texture_rg')
+g(['ext_texture_integer-texformats']),
  g(['ext_texture_integer-texture_integer_glsl130'],
'texture_integer_glsl130')
  g(['fbo-integer'], run_concurrent=False)
diff --git a/tests/spec/ext_texture_integer/CMakeLists.gl.txt 
b/tests/spec/ext_texture_integer/CMakeLists.gl.txt
index 44d9399..2932bc2 100644
--- a/tests/spec/ext_texture_integer/CMakeLists.gl.txt
+++ b/tests/spec/ext_texture_integer/CMakeLists.gl.txt
@@ -12,6 +12,7 @@ link_libraries (

  piglit_add_executable (ext_texture_integer-fbo-blending fbo-blending.c)
  piglit_add_executable (ext_texture_integer-fbo_integer_precision_clear 
fbo-integer-precision-clear.c)
+piglit_add_executable (ext_texture_integer-texformats texformats.c)
  piglit_add_executable (ext_texture_integer-fbo_integer_readpixels_sint_uint 
fbo-integer-readpixels-sint-uint.c)
  piglit_add_executable (ext_texture_integer-getteximage-clamping 
getteximage-clamping.c)
  piglit_add_executable (ext_texture_integer-texture_integer_glsl130 
texture-integer-glsl130.c)
diff --git a/tests/spec/ext_texture_integer/texformats.c 
b/tests/spec/ext_texture_integer/texformats.c
new file mode 100644
index 000..5a4f387
--- /dev/null
+++ b/tests/spec/ext_texture_integer/texformats.c
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2015 VMware, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, 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
+ * NON-INFRINGEMENT.  IN NO EVENT SHALL VMWARE AND/OR THEIR SUPPLIERS
+ * 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.
+ */
+
+/**
+ * Test glTexImage2D and glGetTexImage with a variety of combinations of
+ * internal formats, and user-specified formats/types.
+ *
+ * Brian Paul
+ * 31 August 2015
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 10;
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA;
+PIGLIT_GL_TEST_CONFIG_END
+
+
+static bool
+test_format(GLenum intFormat, GLenum format, GLenum type)
+{
+   const int width = 8, height = 8;
+   GLuint tex;
+   GLubyte *image, *getimage;
+   bool pass = true;
+   int i, bytes;
+
+   switch (intFormat) {
+   case GL_ALPHA8I_EXT:
+   case GL_ALPHA8UI_EXT:
+   bytes = 1;
+   break;
+   case GL_ALPHA16I_EXT:
+   case GL_ALPHA16UI_EXT:
+   bytes = 2;
+   break;
+   case GL_ALPHA32I_EXT:
+   case GL_ALPHA32UI_EXT:
+   bytes = 4;
+   break;
+   case GL_RGB8I:
+   case GL_RGB8UI:
+   bytes = 3;
+   break;
+   case GL_RGBA8I:
+   case GL_RGBA8UI:
+   bytes = 4;
+   break;
+   case GL_RGB16I:
+   case GL_RGB16UI:
+   bytes = 6;
+   break;
+   case GL_RGBA16I:
+   case GL_RGBA16UI:
+   bytes = 8;
+   break;
+   case GL_RGB32I:
+   case GL_RGB32UI:
+   bytes = 12;
+   break;
+   case GL_RGBA32I:
+   case GL_RGBA32UI:
+   bytes = 16;
+   break;
+   default:
+   assert(!"Unexpected format");
+  

Re: [Piglit] [PATCH] arb_copy_image: add new format swizzle test

2015-09-01 Thread Brian Paul

On 08/31/2015 05:38 PM, Ilia Mirkin wrote:

On Mon, Aug 31, 2015 at 7:29 PM, Ilia Mirkin  wrote:

Reviewed-by: Ilia Mirkin 

Thanks a lot for doing this! I assume that it fails with your gallium
ARB_copy_image implementation as I predicted?


Yes.  In Mesa, I added some code that checks for swizzles and uses 
pipe_context::blit() instead.  Seems to fix things, but I need to spend 
more time on it.





Oh, and same comment as on the other test -- this doesn't draw
anything so it should probably do its work in piglit_init.


OK.

-Brian


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


[Piglit] [PATCH] ext_texture_integer: add new tex formats test

2015-09-01 Thread Brian Paul
Test glTexImage2D() and glGetTexImage() with a variety of internalFormats
and user formats/types.

Note: currently fails with Mesa, passes with NVIDIA.

v2: fix % vs. & mix-up, move test code into piglit_init().
---
 tests/all.py |   1 +
 tests/spec/ext_texture_integer/CMakeLists.gl.txt |   1 +
 tests/spec/ext_texture_integer/texformats.c  | 185 +++
 3 files changed, 187 insertions(+)
 create mode 100644 tests/spec/ext_texture_integer/texformats.c

diff --git a/tests/all.py b/tests/all.py
index fe088f5..9320722 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -3127,6 +3127,7 @@ with profile.group_manager(
 g(['ext_texture_integer-getteximage-clamping'], 'getteximage-clamping')
 g(['ext_texture_integer-getteximage-clamping', 'GL_ARB_texture_rg'],
   'getteximage-clamping GL_ARB_texture_rg')
+g(['ext_texture_integer-texformats']),
 g(['ext_texture_integer-texture_integer_glsl130'],
   'texture_integer_glsl130')
 g(['fbo-integer'], run_concurrent=False)
diff --git a/tests/spec/ext_texture_integer/CMakeLists.gl.txt 
b/tests/spec/ext_texture_integer/CMakeLists.gl.txt
index 44d9399..2932bc2 100644
--- a/tests/spec/ext_texture_integer/CMakeLists.gl.txt
+++ b/tests/spec/ext_texture_integer/CMakeLists.gl.txt
@@ -12,6 +12,7 @@ link_libraries (
 
 piglit_add_executable (ext_texture_integer-fbo-blending fbo-blending.c)
 piglit_add_executable (ext_texture_integer-fbo_integer_precision_clear 
fbo-integer-precision-clear.c)
+piglit_add_executable (ext_texture_integer-texformats texformats.c)
 piglit_add_executable (ext_texture_integer-fbo_integer_readpixels_sint_uint 
fbo-integer-readpixels-sint-uint.c)
 piglit_add_executable (ext_texture_integer-getteximage-clamping 
getteximage-clamping.c)
 piglit_add_executable (ext_texture_integer-texture_integer_glsl130 
texture-integer-glsl130.c)
diff --git a/tests/spec/ext_texture_integer/texformats.c 
b/tests/spec/ext_texture_integer/texformats.c
new file mode 100644
index 000..4e7abcc
--- /dev/null
+++ b/tests/spec/ext_texture_integer/texformats.c
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 2015 VMware, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, 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
+ * NON-INFRINGEMENT.  IN NO EVENT SHALL VMWARE AND/OR THEIR SUPPLIERS
+ * 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.
+ */
+
+/**
+ * Test glTexImage2D and glGetTexImage with a variety of combinations of
+ * internal formats, and user-specified formats/types.
+ *
+ * Brian Paul
+ * 31 August 2015
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 10;
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA;
+PIGLIT_GL_TEST_CONFIG_END
+
+
+static bool
+test_format(GLenum intFormat, GLenum format, GLenum type)
+{
+   const int width = 8, height = 8;
+   GLuint tex;
+   GLubyte *image, *getimage;
+   bool pass = true;
+   int i, bytes;
+
+   switch (intFormat) {
+   case GL_ALPHA8I_EXT:
+   case GL_ALPHA8UI_EXT:
+   bytes = 1;
+   break;
+   case GL_ALPHA16I_EXT:
+   case GL_ALPHA16UI_EXT:
+   bytes = 2;
+   break;
+   case GL_ALPHA32I_EXT:
+   case GL_ALPHA32UI_EXT:
+   bytes = 4;
+   break;
+   case GL_RGB8I:
+   case GL_RGB8UI:
+   bytes = 3;
+   break;
+   case GL_RGBA8I:
+   case GL_RGBA8UI:
+   bytes = 4;
+   break;
+   case GL_RGB16I:
+   case GL_RGB16UI:
+   bytes = 6;
+   break;
+   case GL_RGBA16I:
+   case GL_RGBA16UI:
+   bytes = 8;
+   break;
+   case GL_RGB32I:
+   case GL_RGB32UI:
+   bytes = 12;
+   break;
+   case GL_RGBA32I:
+   case GL_RGBA32UI:
+   bytes = 16;
+   break;
+   default:
+   assert(!"Unexpected format");
+   bytes = 0;
+   }
+
+   image = malloc(width * height * 

[Piglit] [PATCH] teximage-colors: replace assertion with useful info

2015-09-01 Thread Brian Paul
Instead of asserting or crashing on a bad command line format, print
list of legal values.
---
 tests/texturing/teximage-colors.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/tests/texturing/teximage-colors.c 
b/tests/texturing/teximage-colors.c
index ea0c5e1..bdd261b 100644
--- a/tests/texturing/teximage-colors.c
+++ b/tests/texturing/teximage-colors.c
@@ -486,7 +486,14 @@ piglit_init(int argc, char **argv)
 
piglit_require_extension("GL_EXT_texture_integer");
 
-   assert(format);
+   if (format == NULL) {
+   int i;
+   printf("Invalid format.  Valid formats:\n");
+
+   for (i = 0; i < ARRAY_LENGTH(formats); i++)
+   printf("  %s\n", formats[i].name);
+   exit(1);
+   }
 
signed_prog = piglit_build_simple_program(NULL, frag_shader_signed_src);
unsigned_prog = piglit_build_simple_program(NULL, 
frag_shader_unsigned_src);
-- 
1.9.1

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


[Piglit] [PATCH] arb_copy_image: add new format swizzle test

2015-09-01 Thread Brian Paul
Check that copies between textures whose formats may only differ by
swizzling works correctly.

v2: move test code into piglit_init()
---
 tests/all.py|   1 +
 tests/spec/arb_copy_image/CMakeLists.gl.txt |   1 +
 tests/spec/arb_copy_image/format-swizzle.c  | 232 
 3 files changed, 234 insertions(+)
 create mode 100644 tests/spec/arb_copy_image/format-swizzle.c

diff --git a/tests/all.py b/tests/all.py
index 9320722..0285bc1 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -3897,6 +3897,7 @@ with profile.group_manager(
 g(['arb_copy_image-formats', '--samples=2'])
 g(['arb_copy_image-formats', '--samples=4'])
 g(['arb_copy_image-formats', '--samples=8'])
+g(['arb_copy_image-format-swizzle'])
 
 with profile.group_manager(
 PiglitGLTest, grouptools.join('spec', 'arb_cull_distance')) as g:
diff --git a/tests/spec/arb_copy_image/CMakeLists.gl.txt 
b/tests/spec/arb_copy_image/CMakeLists.gl.txt
index f1a59e3..90e9270 100644
--- a/tests/spec/arb_copy_image/CMakeLists.gl.txt
+++ b/tests/spec/arb_copy_image/CMakeLists.gl.txt
@@ -12,6 +12,7 @@ piglit_add_executable (arb_copy_image-simple simple.c)
 piglit_add_executable (arb_copy_image-api_errors api_errors.c)
 piglit_add_executable (arb_copy_image-targets targets.c)
 piglit_add_executable (arb_copy_image-formats formats.c)
+piglit_add_executable (arb_copy_image-format-swizzle format-swizzle.c)
 piglit_add_executable (arb_copy_image-srgb-copy srgb-copy.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_copy_image/format-swizzle.c 
b/tests/spec/arb_copy_image/format-swizzle.c
new file mode 100644
index 000..08ce432
--- /dev/null
+++ b/tests/spec/arb_copy_image/format-swizzle.c
@@ -0,0 +1,232 @@
+/*
+ * Copyright 2015 VMware, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+/**
+ * This test exercises some subtle format issues for GL_ARB_copy_image.
+ * If a driver supports texture formats which only vary by swizzling (ex: RGBA 
vs.
+ * BGRA) we may wind up using different hardware texture formats depending
+ * on the user-specified format and type arguments to glTexImage.
+ * When we try to copy between such textures, the copy-sub-image code
+ * must be able to handle the swizzling.
+ *
+ * Brian Paul
+ * 31 August 2015
+ */
+
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 13;
+   config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
+PIGLIT_GL_TEST_CONFIG_END
+
+
+static bool
+test_combination(GLenum intFormat,
+GLenum srcFormat, GLenum srcType,
+GLenum dstFormat, GLenum dstType)
+{
+   const int width = 16, height = 16;
+   int i;
+   GLuint textures[2];
+   GLubyte *image, *getimage;
+   bool pass = true;
+   int comps;
+
+   switch (srcFormat) {
+   case GL_RGB:
+   case GL_BGR:
+   comps = 3;
+   break;
+   case GL_RGBA:
+   case GL_BGRA:
+   case GL_RGBA_INTEGER:
+   case GL_BGRA_INTEGER:
+   comps = 4;
+   break;
+   default:
+   assert(!"Unexpected format");
+   comps = 4;
+   }
+
+   getimage = malloc(width * height * comps);
+
+   image = malloc(width * height * comps);
+   if (comps == 4) {
+   for (i = 0; i < width * height; i++) {
+   image[i * 4 + 0] = 0xff;
+   image[i * 4 + 1] = 0x80;
+   image[i * 4 + 2] = 0x40;
+   image[i * 4 + 3] = 0x20;
+   }
+   }
+   else {
+   for (i = 0; i < width * height; i++) {
+   image[i * 3 + 0] = 0xff;
+   image[i * 3 + 1] = 0x80;
+   image[i * 3 + 2] = 0x40;
+   }
+   }
+
+   glGenTextures(2, textures);
+
+