[Piglit] [PATCH v2] ext_texture_norm16-render: support EXT_render_snorm interactions

2018-06-06 Thread Tapani Pälli
v2: EXT_render_snorm does not add new formats for glTexBuffer,
add separate flag to indicate glTexBuffer support (separate
from req_render that matched before)

Signed-off-by: Tapani Pälli 
---
 tests/spec/ext_texture_norm16/render.c | 39 ++
 1 file changed, 25 insertions(+), 14 deletions(-)

diff --git a/tests/spec/ext_texture_norm16/render.c 
b/tests/spec/ext_texture_norm16/render.c
index 32f601ad0..a6011e3f7 100644
--- a/tests/spec/ext_texture_norm16/render.c
+++ b/tests/spec/ext_texture_norm16/render.c
@@ -91,22 +91,23 @@ static const GLfloat vertex_data[] = {
1.0f,  0.0f
 };
 
-static const struct fmt_test {
+static struct fmt_test {
GLenum iformat;
GLenum base_format;
unsigned bpp;
GLenum type;
bool req_render;
bool can_read;
+   bool can_texbuf;
 } tests[] = {
-   { GL_R16_EXT,   GL_RED, 2,  GL_UNSIGNED_SHORT,  
true,   true,   },
-   { GL_RG16_EXT,  GL_RG,  4,  GL_UNSIGNED_SHORT,  
true,   true,   },
-   { GL_RGB16_EXT, GL_RGB, 6,  GL_UNSIGNED_SHORT,  
false,  true,   },
-   { GL_RGBA16_EXT,GL_RGBA,8,  GL_UNSIGNED_SHORT,  
true,   true,   },
-   { GL_R16_SNORM_EXT, GL_RED, 2,  GL_SHORT,   
false,  false,  },
-   { GL_RG16_SNORM_EXT,GL_RG,  4,  GL_SHORT,   
false,  false,  },
-   { GL_RGB16_SNORM_EXT,   GL_RGB, 6,  GL_SHORT,   
false,  false,  },
-   { GL_RGBA16_SNORM_EXT,  GL_RGBA,8,  GL_SHORT,   
false,  false,  },
+   { GL_R16_EXT,   GL_RED, 2,  GL_UNSIGNED_SHORT,  
true,   true,   true},
+   { GL_RG16_EXT,  GL_RG,  4,  GL_UNSIGNED_SHORT,  
true,   true,   true},
+   { GL_RGB16_EXT, GL_RGB, 6,  GL_UNSIGNED_SHORT,  
false,  true,   false   },
+   { GL_RGBA16_EXT,GL_RGBA,8,  GL_UNSIGNED_SHORT,  
true,   true,   true},
+   { GL_R16_SNORM_EXT, GL_RED, 2,  GL_SHORT,   
false,  false,  false   },
+   { GL_RG16_SNORM_EXT,GL_RG,  4,  GL_SHORT,   
false,  false,  false   },
+   { GL_RGB16_SNORM_EXT,   GL_RGB, 6,  GL_SHORT,   
false,  false,  false   },
+   { GL_RGBA16_SNORM_EXT,  GL_RGBA,8,  GL_SHORT,   
false,  false,  false   },
 };
 
 static GLuint prog;
@@ -330,11 +331,8 @@ test_format(const struct fmt_test *test)
 {
bool pass = true;
 
-   /* The req_render formats match with formats that are
-* supported by texture buffer objects.
-*/
if (piglit_is_extension_supported("GL_OES_texture_buffer") &&
-   test->req_render) {
+   test->can_texbuf) {
bool buf_test = buffer_test(test);
piglit_report_subtest_result(PIGLIT_RESULT(buf_test),
 "format 0x%x TBO test",
@@ -422,8 +420,21 @@ piglit_display(void)
 
bool pass = true;
 
+   struct fmt_test *test = tests;
+   /* Toggle 'req_rend' for EXT_render_snorm compatible formats. */
+   if (piglit_is_extension_supported("GL_EXT_render_snorm")) {
+   for (unsigned i = 0; i < ARRAY_SIZE(tests); i++, test++) {
+   switch (test->iformat) {
+   case GL_R16_SNORM_EXT:
+   case GL_RG16_SNORM_EXT:
+   case GL_RGBA16_SNORM_EXT:
+   test->req_render = true;
+   }
+   }
+   }
+
/* Loop over each format. */
-   const struct fmt_test *test = tests;
+   test = tests;
for (unsigned i = 0; i < ARRAY_SIZE(tests); i++, test++) {
bool fmt_pass = test_format(test);
piglit_report_subtest_result(PIGLIT_RESULT(fmt_pass),
-- 
2.14.4

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


Re: [Piglit] [PATCH] Expand ARB_bindless_texture tests with new shader tests

2018-06-06 Thread Ilia Mirkin
On Wed, Jun 6, 2018 at 3:53 PM, Rhys Perry  wrote:
> These test a compiler's handling of bound image handles used as l-values

r-values, not l-value

l = r

You can't do bound = asdf.

> or being cast and it's handling of constant bindless handles.
>
> They were created in response to issues found in Mesa.

Do these all pass on NVIDIA? Otherwise this all looks perfectly
plausible. Just one minor comment below.

>
> Signed-off-by: Rhys Perry 
> ---
>  .../execution/images/bound-image-array.shader_test | 46 +
>  .../images/bound-image-assignment.shader_test  | 51 +++
>  .../execution/images/bound-image-cast.shader_test  | 50 ++
>  .../execution/images/bound-image-comma.shader_test | 31 
>  .../bound-image-function-parameter.shader_test | 59 
> ++
>  .../images/bound-image-ternary.shader_test | 46 +
>  .../execution/images/constant-handle.shader_test   | 39 ++
>  7 files changed, 322 insertions(+)
>  create mode 100644 
> tests/spec/arb_bindless_texture/execution/images/bound-image-array.shader_test
>  create mode 100644 
> tests/spec/arb_bindless_texture/execution/images/bound-image-assignment.shader_test
>  create mode 100644 
> tests/spec/arb_bindless_texture/execution/images/bound-image-cast.shader_test
>  create mode 100644 
> tests/spec/arb_bindless_texture/execution/images/bound-image-comma.shader_test
>  create mode 100644 
> tests/spec/arb_bindless_texture/execution/images/bound-image-function-parameter.shader_test
>  create mode 100644 
> tests/spec/arb_bindless_texture/execution/images/bound-image-ternary.shader_test
>  create mode 100644 
> tests/spec/arb_bindless_texture/execution/images/constant-handle.shader_test
>
> diff --git 
> a/tests/spec/arb_bindless_texture/execution/images/bound-image-array.shader_test
>  
> b/tests/spec/arb_bindless_texture/execution/images/bound-image-array.shader_test
> new file mode 100644
> index 0..b05d45aad
> --- /dev/null
> +++ 
> b/tests/spec/arb_bindless_texture/execution/images/bound-image-array.shader_test
> @@ -0,0 +1,46 @@
> +[require]
> +GL >= 3.3
> +GLSL >= 3.30
> +GL_ARB_bindless_texture
> +GL_ARB_shader_image_load_store
> +
> +[vertex shader passthrough]
> +
> +[fragment shader]
> +#version 330
> +#extension GL_ARB_bindless_texture: require
> +#extension GL_ARB_shader_image_load_store: require
> +
> +uniform uint index;
> +uniform vec4 color;
> +writeonly uniform image2D img0;
> +writeonly uniform image2D img1;
> +out vec4 outcolor;
> +
> +void main()
> +{
> +   imageStore(image2D[](img0, img1)[index], ivec2(0), color);
> +   outcolor = vec4(0.0, 0.0, 0.0, 1.0);
> +}
> +
> +[test]
> +texture rgbw 0 (1, 1) GL_RGBA8
> +texture rgbw 1 (1, 1) GL_RGBA8
> +image texture 0 GL_RGBA8
> +image texture 1 GL_RGBA8
> +uniform int img0 0
> +uniform int img1 1
> +
> +uniform uint index 0
> +uniform vec4 color 0.5 0.0 0.0 0.0
> +draw rect -1 -1 2 2
> +
> +uniform uint index 1
> +uniform vec4 color 0.0 0.5 0.0 0.0
> +draw rect -1 -1 2 2
> +
> +memory barrier GL_FRAMEBUFFER_BARRIER_BIT
> +fb tex 2d 0
> +probe all rgba 0.5 0.0 0.0 0.0
> +fb tex 2d 1
> +probe all rgba 0.0 0.5 0.0 0.0
> diff --git 
> a/tests/spec/arb_bindless_texture/execution/images/bound-image-assignment.shader_test
>  
> b/tests/spec/arb_bindless_texture/execution/images/bound-image-assignment.shader_test
> new file mode 100644
> index 0..8f6198702
> --- /dev/null
> +++ 
> b/tests/spec/arb_bindless_texture/execution/images/bound-image-assignment.shader_test
> @@ -0,0 +1,51 @@
> +[require]
> +GL >= 3.3
> +GLSL >= 3.30
> +GL_ARB_bindless_texture
> +GL_ARB_shader_image_load_store
> +
> +[vertex shader passthrough]
> +
> +[fragment shader]
> +#version 330
> +#extension GL_ARB_bindless_texture: require
> +#extension GL_ARB_shader_image_load_store: require
> +
> +uniform bool cond;
> +uniform vec4 color;
> +writeonly uniform image2D img0;
> +writeonly uniform image2D img1;
> +out vec4 outcolor;
> +
> +void main()
> +{
> +   image2D img;
> +   if (cond)
> +   img = img1;
> +   else
> +   img = img0;
> +   imageStore(img, ivec2(0), color);
> +   outcolor = vec4(0.0, 0.0, 0.0, 1.0);
> +}
> +
> +[test]
> +texture rgbw 0 (1, 1) GL_RGBA8
> +texture rgbw 1 (1, 1) GL_RGBA8
> +image texture 0 GL_RGBA8
> +image texture 1 GL_RGBA8
> +uniform int img0 0
> +uniform int img1 1
> +
> +uniform int cond 0
> +uniform vec4 color 0.5 0.0 0.0 0.0
> +draw rect -1 -1 2 2
> +
> +uniform int cond 1
> +uniform vec4 color 0.0 0.5 0.0 0.0
> +draw rect -1 -1 2 2
> +
> +memory barrier GL_FRAMEBUFFER_BARRIER_BIT
> +fb tex 2d 0
> +probe all rgba 0.5 0.0 0.0 0.0
> +fb tex 2d 1
> +probe all rgba 0.0 0.5 0.0 0.0
> diff --git 
> a/tests/spec/arb_bindless_texture/execution/images/bound-image-cast.shader_test
>  
> b/tests/spec/arb_bindless_texture/execution/images/bound-image-cast.shader_test
> new file mode 100644
> index 0..bb0396f2c
> --- /dev/nu

[Piglit] [PATCH] Expand ARB_bindless_texture tests with new shader tests

2018-06-06 Thread Rhys Perry
These test a compiler's handling of bound image handles used as l-values
or being cast and it's handling of constant bindless handles.

They were created in response to issues found in Mesa.

Signed-off-by: Rhys Perry 
---
 .../execution/images/bound-image-array.shader_test | 46 +
 .../images/bound-image-assignment.shader_test  | 51 +++
 .../execution/images/bound-image-cast.shader_test  | 50 ++
 .../execution/images/bound-image-comma.shader_test | 31 
 .../bound-image-function-parameter.shader_test | 59 ++
 .../images/bound-image-ternary.shader_test | 46 +
 .../execution/images/constant-handle.shader_test   | 39 ++
 7 files changed, 322 insertions(+)
 create mode 100644 
tests/spec/arb_bindless_texture/execution/images/bound-image-array.shader_test
 create mode 100644 
tests/spec/arb_bindless_texture/execution/images/bound-image-assignment.shader_test
 create mode 100644 
tests/spec/arb_bindless_texture/execution/images/bound-image-cast.shader_test
 create mode 100644 
tests/spec/arb_bindless_texture/execution/images/bound-image-comma.shader_test
 create mode 100644 
tests/spec/arb_bindless_texture/execution/images/bound-image-function-parameter.shader_test
 create mode 100644 
tests/spec/arb_bindless_texture/execution/images/bound-image-ternary.shader_test
 create mode 100644 
tests/spec/arb_bindless_texture/execution/images/constant-handle.shader_test

diff --git 
a/tests/spec/arb_bindless_texture/execution/images/bound-image-array.shader_test
 
b/tests/spec/arb_bindless_texture/execution/images/bound-image-array.shader_test
new file mode 100644
index 0..b05d45aad
--- /dev/null
+++ 
b/tests/spec/arb_bindless_texture/execution/images/bound-image-array.shader_test
@@ -0,0 +1,46 @@
+[require]
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_bindless_texture
+GL_ARB_shader_image_load_store
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 330
+#extension GL_ARB_bindless_texture: require
+#extension GL_ARB_shader_image_load_store: require
+
+uniform uint index;
+uniform vec4 color;
+writeonly uniform image2D img0;
+writeonly uniform image2D img1;
+out vec4 outcolor;
+
+void main()
+{
+   imageStore(image2D[](img0, img1)[index], ivec2(0), color);
+   outcolor = vec4(0.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+texture rgbw 0 (1, 1) GL_RGBA8
+texture rgbw 1 (1, 1) GL_RGBA8
+image texture 0 GL_RGBA8
+image texture 1 GL_RGBA8
+uniform int img0 0
+uniform int img1 1
+
+uniform uint index 0
+uniform vec4 color 0.5 0.0 0.0 0.0
+draw rect -1 -1 2 2
+
+uniform uint index 1
+uniform vec4 color 0.0 0.5 0.0 0.0
+draw rect -1 -1 2 2
+
+memory barrier GL_FRAMEBUFFER_BARRIER_BIT
+fb tex 2d 0
+probe all rgba 0.5 0.0 0.0 0.0
+fb tex 2d 1
+probe all rgba 0.0 0.5 0.0 0.0
diff --git 
a/tests/spec/arb_bindless_texture/execution/images/bound-image-assignment.shader_test
 
b/tests/spec/arb_bindless_texture/execution/images/bound-image-assignment.shader_test
new file mode 100644
index 0..8f6198702
--- /dev/null
+++ 
b/tests/spec/arb_bindless_texture/execution/images/bound-image-assignment.shader_test
@@ -0,0 +1,51 @@
+[require]
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_bindless_texture
+GL_ARB_shader_image_load_store
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 330
+#extension GL_ARB_bindless_texture: require
+#extension GL_ARB_shader_image_load_store: require
+
+uniform bool cond;
+uniform vec4 color;
+writeonly uniform image2D img0;
+writeonly uniform image2D img1;
+out vec4 outcolor;
+
+void main()
+{
+   image2D img;
+   if (cond)
+   img = img1;
+   else
+   img = img0;
+   imageStore(img, ivec2(0), color);
+   outcolor = vec4(0.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+texture rgbw 0 (1, 1) GL_RGBA8
+texture rgbw 1 (1, 1) GL_RGBA8
+image texture 0 GL_RGBA8
+image texture 1 GL_RGBA8
+uniform int img0 0
+uniform int img1 1
+
+uniform int cond 0
+uniform vec4 color 0.5 0.0 0.0 0.0
+draw rect -1 -1 2 2
+
+uniform int cond 1
+uniform vec4 color 0.0 0.5 0.0 0.0
+draw rect -1 -1 2 2
+
+memory barrier GL_FRAMEBUFFER_BARRIER_BIT
+fb tex 2d 0
+probe all rgba 0.5 0.0 0.0 0.0
+fb tex 2d 1
+probe all rgba 0.0 0.5 0.0 0.0
diff --git 
a/tests/spec/arb_bindless_texture/execution/images/bound-image-cast.shader_test 
b/tests/spec/arb_bindless_texture/execution/images/bound-image-cast.shader_test
new file mode 100644
index 0..bb0396f2c
--- /dev/null
+++ 
b/tests/spec/arb_bindless_texture/execution/images/bound-image-cast.shader_test
@@ -0,0 +1,50 @@
+# Same as basic-arithmetic-uvec2-imageStore.shader_test, but with bound images
+[require]
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_bindless_texture
+GL_ARB_shader_image_load_store
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 330
+#extension GL_ARB_bindless_texture: require
+#extension GL_ARB_shader_image_load_store: enable
+
+uniform vec4 color;
+writeonly uniform image2D tex;
+uniform uvec2 handleOffset;
+o

Re: [Piglit] [PATCH] Use _exit() instead of exit() in child processes

2018-06-06 Thread Ian Romanick
On 06/06/2018 02:43 AM, Michel Dänzer wrote:
> From: Michel Dänzer 
> 
> A child process which doesn't call exec() shouldn't use exit(), as that
> will attempt to run any atexit handlers of the parent, which may break.

I did not know that.  The manual page for exit does say, "All functions
registered with atexit(3) and on_exit(3) are  called, in the reverse
order of their registration."  But you also have to read the atexit
page, which says, "When  a child process is created via fork(2), it
inherits copies of its parent's registrations.  Upon a successful call
to one of the exec(3) functions, all registrations are removed."

So... what happens if after fork the child process calls atexit?  That
handler will be registered in the child only, and calling _exit will
skip it.  It's almost like these interfaces aren't very good. :(  It
seems like what you would want is a function the child could call to
unregister all previously registered atexit functions.

Boo.

Reviewed-by: Ian Romanick 

> It actually results in crashing with the Mesa radeonsi driver.
> 
> Signed-off-by: Michel Dänzer 
> ---
>  .../spec/glx_ext_import_context/import-context-multi-process.c  | 2 +-
>  tests/spec/glx_ext_import_context/make-current-multi-process.c  | 2 +-
>  tests/spec/glx_ext_import_context/make-current-single-process.c | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/spec/glx_ext_import_context/import-context-multi-process.c 
> b/tests/spec/glx_ext_import_context/import-context-multi-process.c
> index 5f758d6a8..3d4ab9c91 100644
> --- a/tests/spec/glx_ext_import_context/import-context-multi-process.c
> +++ b/tests/spec/glx_ext_import_context/import-context-multi-process.c
> @@ -50,7 +50,7 @@ int main(int argc, char **argv)
>   pass = try_import_context(0xDEADBEEF, invalid)
>   && pass;
>  
> - exit(pass ? 0 : 1);
> + _exit(pass ? 0 : 1);
>   }
>  
>   /* The test passes if the child exited normally with a return value of
> diff --git a/tests/spec/glx_ext_import_context/make-current-multi-process.c 
> b/tests/spec/glx_ext_import_context/make-current-multi-process.c
> index 0f88eaf97..23e50715f 100644
> --- a/tests/spec/glx_ext_import_context/make-current-multi-process.c
> +++ b/tests/spec/glx_ext_import_context/make-current-multi-process.c
> @@ -62,7 +62,7 @@ int main(int argc, char **argv)
>   XSync(dpy, 0);
>   pass = validate_glx_error_code(BadAccess, -1);
>  
> - exit(pass ? 0 : 1);
> + _exit(pass ? 0 : 1);
>   }
>  
>   /* The test passes if the child exited normally with a return value of
> diff --git a/tests/spec/glx_ext_import_context/make-current-single-process.c 
> b/tests/spec/glx_ext_import_context/make-current-single-process.c
> index 0475f4446..d8734032f 100644
> --- a/tests/spec/glx_ext_import_context/make-current-single-process.c
> +++ b/tests/spec/glx_ext_import_context/make-current-single-process.c
> @@ -52,7 +52,7 @@ int main(int argc, char **argv)
>   XSync(dpy, 0);
>   pass = validate_glx_error_code(Success, -1);
>  
> - exit(pass ? 0 : 1);
> + _exit(pass ? 0 : 1);
>   }
>  
>   /* The test passes if the child exited normally with a return value of
> 

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


Re: [Piglit] [PATCH] Use _exit() instead of exit() in child processes

2018-06-06 Thread Eric Anholt
Michel Dänzer  writes:

> From: Michel Dänzer 
>
> A child process which doesn't call exec() shouldn't use exit(), as that
> will attempt to run any atexit handlers of the parent, which may break.
> It actually results in crashing with the Mesa radeonsi driver.

Reviewed-by: Eric Anholt 


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


Re: [Piglit] [PATCH] general/draw: Test that checks propper render order in mixed draw setups.

2018-06-06 Thread Dylan Baker
Quoting mathias.froehl...@gmx.net (2018-06-04 23:05:27)
> From: Mathias Fröhlich 
> 
> Hi all,
> 
> The description below,
> Please review!!
> 
> best
> Mathias
> 
> 
> 
> The test checks for propper immediate mode flushes when array draws
> are mixed with immediate mode draws.
> The test abstracts out what went wrong in bugzilla #106594.
> 
> Signed-off-by: Mathias Fröhlich 
> ---
>  tests/general/CMakeLists.gl.txt |   1 +
>  tests/general/draw-flush-vertices.c | 111 
>  2 files changed, 112 insertions(+)
>  create mode 100644 tests/general/draw-flush-vertices.c
> 
> diff --git a/tests/general/CMakeLists.gl.txt b/tests/general/CMakeLists.gl.txt
> index ceec9f0b6..7f530974e 100644
> --- a/tests/general/CMakeLists.gl.txt
> +++ b/tests/general/CMakeLists.gl.txt
> @@ -40,6 +40,7 @@ piglit_add_executable (draw-batch draw-batch.c)
>  piglit_add_executable (draw-copypixels-sync draw-copypixels-sync.c)
>  piglit_add_executable (draw-elements draw-elements.c)
>  piglit_add_executable (draw-elements-vs-inputs draw-elements-vs-inputs.c)
> +piglit_add_executable (draw-flush-vertices draw-flush-vertices.c)
>  piglit_add_executable (draw-pixel-with-texture draw-pixel-with-texture.c)
>  piglit_add_executable (draw-sync draw-sync.c)
>  piglit_add_executable (draw-pixels draw-pixels.c)
> diff --git a/tests/general/draw-flush-vertices.c 
> b/tests/general/draw-flush-vertices.c
> new file mode 100644
> index 0..9932a6bc0
> --- /dev/null
> +++ b/tests/general/draw-flush-vertices.c
> @@ -0,0 +1,111 @@
> +/*
> + * Copyright © 2018 Mathias Fröhlich 
> + *
> + * 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.
> + *
> + * Authors:
> + *Mathias Fröhlich 
> + */
> +
> +/* The test does mixes immediate mode and array draws, but does not
> + * not do an other draw setup past the immediate mode draw. By that
> + * it checks for the order of draws that may be inverted if the queued
> + * immediate mode draws are not properly flushed before the array draw.
> + */
> +
> +#include "piglit-util-gl.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> +   config.supports_gl_compat_version = 11;
> +
> +   config.window_width = 32;
> +   config.window_height = 32;
> +   config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
> +   config.khr_no_error_support = PIGLIT_NO_ERRORS;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +void piglit_init(int argc, char **argv)
> +{
> +   piglit_require_gl_version(11);
> +
> +   piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
> +
> +   glDisable(GL_DEPTH_TEST);
> +   glClearColor(0.0, 0.0, 0.0, 1.0);
> +}
> +
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> +   const GLfloat Vertices[2*4] = {
> +   0, 0,
> +   piglit_width, 0,
> +   piglit_width, piglit_height,
> +   0, piglit_height
> +   };
> +   const GLfloat Colors[4*3] = {
> +   1, 0, 0,
> +   1, 0, 0,
> +   1, 0, 0,
> +   1, 0, 0
> +   };
> +
> +   GLboolean pass = GL_TRUE;
> +
> +   glViewport(0, 0, piglit_width, piglit_height);
> +
> +   glEnableClientState(GL_VERTEX_ARRAY);
> +   glVertexPointer(2, GL_FLOAT, sizeof(GLfloat)*2, Vertices);
> +   glEnableClientState(GL_COLOR_ARRAY);
> +   glColorPointer(3, GL_FLOAT, sizeof(GLfloat)*3, Colors);
> +
> +   glClear(GL_COLOR_BUFFER_BIT);
> +
> +   /* Draw a blue quad */
> +   glBegin(GL_QUADS);
> +   glColor3f(0, 0, 1);
> +   glVertex2fv(&Vertices[0]);
> +   glVertex2fv(&Vertices[2]);
> +   glVertex2fv(&Vertices[4]);
> +   glVertex2fv(&Vertices[6]);
> +   glEnd();
> +
> +   /* OpenGL has to make sure that prior to the glDrawArrays call
> +* all immediate mode rendering has landed.
> +*/
> +
> +   /* Draw a red quad */
> +   

[Piglit] [PATCH v2] GL_ARB_texture_buffer_object: New test for error behavior.

2018-06-06 Thread Illia Iorin
This test checks that if we allocate more memory for the buffer
 than possible, we get GL_OUT_OF_MEMORY error.

V2:
  - check GL_ARB_texture_buffer_object extension
  - change storage format to GL_RGBA32I
  - check gl compat version 3.1 because
function glTexBuffer() require that version

Signed-off-by: Illia Iorin 
---
 tests/opengl.py   |  1 +
 .../CMakeLists.gl.txt |  1 +
 .../negative-bad-oom.c| 62 +++
 3 files changed, 64 insertions(+)
 create mode 100644 tests/spec/arb_texture_buffer_object/negative-bad-oom.c

diff --git a/tests/opengl.py b/tests/opengl.py
index 9c43d32c9..56cf4f041 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -2365,6 +2365,7 @@ with profile.test_list.group_manager(
 g(['arb_texture_buffer_object-max-size'], 'max-size')
 g(['arb_texture_buffer_object-minmax'], 'minmax')
 g(['arb_texture_buffer_object-negative-bad-bo'], 'negative-bad-bo')
+g(['arb_texture_buffer_object-negative-bad-oom'], 'negative-bad-oom')
 g(['arb_texture_buffer_object-negative-bad-format'], 'negative-bad-format')
 g(['arb_texture_buffer_object-negative-bad-target'], 'negative-bad-target')
 g(['arb_texture_buffer_object-negative-unsupported'],
diff --git a/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt 
b/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
index 959ca0c2f..98d1e16d8 100644
--- a/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
@@ -25,3 +25,4 @@ piglit_add_executable (arb_texture_buffer_object-subdata-sync 
subdata-sync.c)
 piglit_add_executable (arb_texture_buffer_object-unused-name unused-name.c)
 piglit_add_executable (arb_texture_buffer_object-fetch-outside-bounds 
fetch-outside-bounds.c)
 piglit_add_executable (arb_texture_buffer_object-indexed indexed.c)
+piglit_add_executable (arb_texture_buffer_object-negative-bad-oom 
negative-bad-oom.c)
\ No newline at end of file
diff --git a/tests/spec/arb_texture_buffer_object/negative-bad-oom.c 
b/tests/spec/arb_texture_buffer_object/negative-bad-oom.c
new file mode 100644
index 0..4841f6a52
--- /dev/null
+++ b/tests/spec/arb_texture_buffer_object/negative-bad-oom.c
@@ -0,0 +1,62 @@
+/* Copyright © 2018 Illia Iorin 
+ *
+ * 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 negative-bad-oom.c 
+* This test checks  allocat more memory than possible, 
+* the glGetError() will return  GL_OUT_OF_MEMORY error flag 
+*/
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 31;
+   config.supports_gl_core_version = 31;
+
+   config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+   config.khr_no_error_support = PIGLIT_HAS_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+   return PIGLIT_FAIL; /* UNREACHED */
+}
+
+
+void
+piglit_init(int argc, char **argv)
+{
+   piglit_require_extension("GL_ARB_texture_buffer_object");
+   GLuint tex, tbo;
+   glGenBuffers(1, &tbo);
+   glBindBuffer(GL_TEXTURE_BUFFER, tbo);
+
+   glGenTextures(1, &tex);
+   glBindTexture(GL_TEXTURE_BUFFER, tex);
+   glTexBuffer(GL_TEXTURE_BUFFER, GL_RGBA32I, tbo);
+   glBufferData(GL_TEXTURE_BUFFER,
+INT_MAX , NULL, GL_STATIC_READ);
+   if (!piglit_check_gl_error(GL_OUT_OF_MEMORY))
+   piglit_report_result(PIGLIT_FAIL);
+   piglit_report_result(PIGLIT_PASS);
+}
\ No newline at end of file
-- 
2.17.0

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


[Piglit] [PATCH] Use _exit() instead of exit() in child processes

2018-06-06 Thread Michel Dänzer
From: Michel Dänzer 

A child process which doesn't call exec() shouldn't use exit(), as that
will attempt to run any atexit handlers of the parent, which may break.
It actually results in crashing with the Mesa radeonsi driver.

Signed-off-by: Michel Dänzer 
---
 .../spec/glx_ext_import_context/import-context-multi-process.c  | 2 +-
 tests/spec/glx_ext_import_context/make-current-multi-process.c  | 2 +-
 tests/spec/glx_ext_import_context/make-current-single-process.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/spec/glx_ext_import_context/import-context-multi-process.c 
b/tests/spec/glx_ext_import_context/import-context-multi-process.c
index 5f758d6a8..3d4ab9c91 100644
--- a/tests/spec/glx_ext_import_context/import-context-multi-process.c
+++ b/tests/spec/glx_ext_import_context/import-context-multi-process.c
@@ -50,7 +50,7 @@ int main(int argc, char **argv)
pass = try_import_context(0xDEADBEEF, invalid)
&& pass;
 
-   exit(pass ? 0 : 1);
+   _exit(pass ? 0 : 1);
}
 
/* The test passes if the child exited normally with a return value of
diff --git a/tests/spec/glx_ext_import_context/make-current-multi-process.c 
b/tests/spec/glx_ext_import_context/make-current-multi-process.c
index 0f88eaf97..23e50715f 100644
--- a/tests/spec/glx_ext_import_context/make-current-multi-process.c
+++ b/tests/spec/glx_ext_import_context/make-current-multi-process.c
@@ -62,7 +62,7 @@ int main(int argc, char **argv)
XSync(dpy, 0);
pass = validate_glx_error_code(BadAccess, -1);
 
-   exit(pass ? 0 : 1);
+   _exit(pass ? 0 : 1);
}
 
/* The test passes if the child exited normally with a return value of
diff --git a/tests/spec/glx_ext_import_context/make-current-single-process.c 
b/tests/spec/glx_ext_import_context/make-current-single-process.c
index 0475f4446..d8734032f 100644
--- a/tests/spec/glx_ext_import_context/make-current-single-process.c
+++ b/tests/spec/glx_ext_import_context/make-current-single-process.c
@@ -52,7 +52,7 @@ int main(int argc, char **argv)
XSync(dpy, 0);
pass = validate_glx_error_code(Success, -1);
 
-   exit(pass ? 0 : 1);
+   _exit(pass ? 0 : 1);
}
 
/* The test passes if the child exited normally with a return value of
-- 
2.17.1

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