[Piglit] Tests for ARB_shader_image_load_store (resend).
This is my third and last rebase and resend of the ARB_shader_image_load_store tests I sent to this mailing list last October. If there have been no objections by the 3rd February at noon (UTC) I will push the rest of the series without review. [PATCH 01/23] util/shader: Define "nothrow" variant of piglit_compile_shader_text(). [PATCHv2 02/23] arb_shader_image_load_store: Add common image metadata. [PATCHv2 03/23] arb_shader_image_load_store: Import grid execution helpers. [PATCH 04/23] arb_shader_image_load_store: Add misc. image manipulation code and hook up to the build system. [PATCHv2 05/23] arb_shader_image_load_store: Import atomicity image built-in tests. [PATCHv2 06/23] arb_shader_image_load_store: Import image format bitcasting test. [PATCH 07/23] arb_shader_image_load_store: Import memory coherency test. [PATCH 08/23] arb_shader_image_load_store: Import dead fragments test. [PATCH 09/23] arb_shader_image_load_store: Import early_fragment_tests test. [PATCHv2 10/23] arb_shader_image_load_store: Import host memory barrier tests. [PATCHv2 11/23] arb_shader_image_load_store: Import image array indexing test. [PATCH 12/23] arb_shader_image_load_store: Import invalid and undefined image access tests. [PATCH 13/23] arb_shader_image_load_store: Import tests for layered and unlayered binding. [PATCH 14/23] arb_shader_image_load_store: Import test for mipmap level binding. [PATCHv2 15/23] arb_shader_image_load_store: Import tests for the maximum of supported images. [PATCH 16/23] arb_shader_image_load_store: Import test for the maximum texture size. [PATCH 17/23] arb_shader_image_load_store: Import minimum maximum test. [PATCH 18/23] arb_shader_image_load_store: Import memory access qualifier test. [PATCH 19/23] arb_shader_image_load_store: Import image aliasing test. [PATCH 20/23] arb_shader_image_load_store: Import built-in semantics tests. [PATCH 21/23] arb_shader_image_load_store: Import shader memory barrier tests. [PATCH 22/23] arb_shader_image_load_store: Import image unit and uniform state tracking tests. [PATCH 23/23] arb_shader_image_load_store: Import test for atomics with unused result. ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 14/23] arb_shader_image_load_store: Import test for mipmap level binding.
Test that image loads and stores land in the correct mipmap level of the texture when a level other than the first is bound to an image unit. --- tests/all.py | 1 + .../arb_shader_image_load_store/CMakeLists.gl.txt | 1 + tests/spec/arb_shader_image_load_store/level.c | 195 + 3 files changed, 197 insertions(+) create mode 100644 tests/spec/arb_shader_image_load_store/level.c diff --git a/tests/all.py b/tests/all.py index a043b0b..5c796fa 100644 --- a/tests/all.py +++ b/tests/all.py @@ -4435,6 +4435,7 @@ arb_shader_image_load_store['host-mem-barrier'] = PiglitGLTest('arb_shader_image arb_shader_image_load_store['indexing'] = PiglitGLTest('arb_shader_image_load_store-indexing', run_concurrent=True) arb_shader_image_load_store['invalid'] = PiglitGLTest('arb_shader_image_load_store-invalid', run_concurrent=True) arb_shader_image_load_store['layer'] = PiglitGLTest('arb_shader_image_load_store-layer', run_concurrent=True) +arb_shader_image_load_store['level'] = PiglitGLTest('arb_shader_image_load_store-level', run_concurrent=True) profile.tests['hiz'] = hiz profile.tests['fast_color_clear'] = fast_color_clear diff --git a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt index 2dfdccf..990c3e0 100644 --- a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt +++ b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt @@ -21,5 +21,6 @@ piglit_add_executable(arb_shader_image_load_store-host-mem-barrier host-mem-barr piglit_add_executable(arb_shader_image_load_store-indexing indexing.c ${depends}) piglit_add_executable(arb_shader_image_load_store-invalid invalid.c ${depends}) piglit_add_executable(arb_shader_image_load_store-layer layer.c ${depends}) +piglit_add_executable(arb_shader_image_load_store-level level.c ${depends}) # vim: ft=cmake: diff --git a/tests/spec/arb_shader_image_load_store/level.c b/tests/spec/arb_shader_image_load_store/level.c new file mode 100644 index 000..5fbdbaf --- /dev/null +++ b/tests/spec/arb_shader_image_load_store/level.c @@ -0,0 +1,195 @@ +/* + * Copyright (C) 2014 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 level.c + * + * Test the binding of individual mipmap levels to an image unit by + * dumping the whole accessible contents of an image to the + * framebuffer and then checking that the observed values match the + * bound mipmap level. The same mipmap level is then overwritten by + * the shader program after its contents have been read. + */ + +#include "common.h" + +/** Window width. */ +#define W 16 + +/** Window height. */ +#define H 96 + +/** Total number of pixels in the window and image. */ +#define N (W * H) + +/** Maximum number of mipmap levels. */ +#define M 11 + +PIGLIT_GL_TEST_CONFIG_BEGIN + +config.supports_gl_core_version = 32; + +config.window_width = W; +config.window_height = H; +config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA; + +PIGLIT_GL_TEST_CONFIG_END + +static bool +init_image(const struct image_info img, unsigned l) +{ +const unsigned num_levels = image_num_levels(img); +uint32_t pixels[4 * N * M]; +unsigned i; + +for (i = 0; i < 4 * N * num_levels; ++i) +pixels[i] = encode(img.format, i); + +return upload_image_levels(img, num_levels, l, 0, pixels); +} + +static bool +check_fb(const struct grid_info grid, const struct image_info img, unsigned l) +{ +const unsigned offset = 4 * image_level_offset(img, l); +const unsigned n = 4 * product(grid.size); +uint32_t pixels_fb[4 * N], expect_fb[4 * N]; +unsigned i; + +if (!download_result(grid, pixels_fb)) +return false; + +for (i = 0; i < n; ++i) { +/* + * The framebuffer c
[Piglit] [PATCH 13/23] arb_shader_image_load_store: Import tests for layered and unlayered binding.
Test binding of individual layers from a layered texture and the simultaneous binding of all layers (layered binding). For textures targets that don't have multiple layers we just test that the layered and unlayered binding modes have no effect as required by the spec. --- tests/all.py | 1 + .../arb_shader_image_load_store/CMakeLists.gl.txt | 1 + tests/spec/arb_shader_image_load_store/layer.c | 221 + 3 files changed, 223 insertions(+) create mode 100644 tests/spec/arb_shader_image_load_store/layer.c diff --git a/tests/all.py b/tests/all.py index 8aa8835..a043b0b 100644 --- a/tests/all.py +++ b/tests/all.py @@ -4434,6 +4434,7 @@ arb_shader_image_load_store['early-z'] = PiglitGLTest('arb_shader_image_load_sto arb_shader_image_load_store['host-mem-barrier'] = PiglitGLTest('arb_shader_image_load_store-host-mem-barrier', run_concurrent=True) arb_shader_image_load_store['indexing'] = PiglitGLTest('arb_shader_image_load_store-indexing', run_concurrent=True) arb_shader_image_load_store['invalid'] = PiglitGLTest('arb_shader_image_load_store-invalid', run_concurrent=True) +arb_shader_image_load_store['layer'] = PiglitGLTest('arb_shader_image_load_store-layer', run_concurrent=True) profile.tests['hiz'] = hiz profile.tests['fast_color_clear'] = fast_color_clear diff --git a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt index 6139e58..2dfdccf 100644 --- a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt +++ b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt @@ -20,5 +20,6 @@ piglit_add_executable(arb_shader_image_load_store-early-z early-z.c ${depends}) piglit_add_executable(arb_shader_image_load_store-host-mem-barrier host-mem-barrier.c ${depends}) piglit_add_executable(arb_shader_image_load_store-indexing indexing.c ${depends}) piglit_add_executable(arb_shader_image_load_store-invalid invalid.c ${depends}) +piglit_add_executable(arb_shader_image_load_store-layer layer.c ${depends}) # vim: ft=cmake: diff --git a/tests/spec/arb_shader_image_load_store/layer.c b/tests/spec/arb_shader_image_load_store/layer.c new file mode 100644 index 000..8cf2673 --- /dev/null +++ b/tests/spec/arb_shader_image_load_store/layer.c @@ -0,0 +1,221 @@ +/* + * Copyright (C) 2014 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 layer.c + * + * The spec defines two different image unit binding modes for + * textures with multiple layers, depending on the "layered" parameter + * of glBindImageTexture(): + * + * "If is TRUE, the entire level is bound. If is + * FALSE, only the single layer identified by will be bound. + * When is FALSE, the single bound layer is treated as a + * different texture target for image accesses: + * + * * one-dimensional array texture layers are treated as one-dimensional + * textures; + * + * * two-dimensional array, three-dimensional, cube map, cube map array + * texture layers are treated as two-dimensional textures; and + * + * * two-dimensional multisample array textures are treated as + * two-dimensional multisample textures." + * + * We check that this is the case by binding a texture of each target + * in layered or unlayered mode and then dumping all the accessible + * contents of the texture to the framebuffer from a fragment shader. + * After each individual texel is read its old contents are + * overwritten by the shader. + * + * For textures that don't have multiple layers we check that the + * described process reads and subsequently overwrites the full + * texture contents regardless of the values of the layered and layer + * parameters, since according to the spec: + * + * "If the texture identified by does not have multiple + * layers or faces, the entire texture level is bound, regardless of +
[Piglit] [PATCH 07/23] arb_shader_image_load_store: Import memory coherency test.
Test the cache coherency of images declared as "coherent" or "volatile" when accessed from different combinations of dependent shader stages. --- tests/all.py | 1 + tests/quick.py | 2 + .../arb_shader_image_load_store/CMakeLists.gl.txt | 1 + tests/spec/arb_shader_image_load_store/coherency.c | 228 + 4 files changed, 232 insertions(+) create mode 100644 tests/spec/arb_shader_image_load_store/coherency.c diff --git a/tests/all.py b/tests/all.py index d045e0e..e82c7fd 100644 --- a/tests/all.py +++ b/tests/all.py @@ -4428,6 +4428,7 @@ import_glsl_parser_tests(spec['ARB_shader_image_load_store'], ['']) arb_shader_image_load_store['atomicity'] = PiglitGLTest('arb_shader_image_load_store-atomicity', run_concurrent=True) arb_shader_image_load_store['bitcast'] = PiglitGLTest('arb_shader_image_load_store-bitcast', run_concurrent=True) +arb_shader_image_load_store['coherency'] = PiglitGLTest('arb_shader_image_load_store-coherency', run_concurrent=True) profile.tests['hiz'] = hiz profile.tests['fast_color_clear'] = fast_color_clear diff --git a/tests/quick.py b/tests/quick.py index 8762d7d..2f0d690 100644 --- a/tests/quick.py +++ b/tests/quick.py @@ -12,3 +12,5 @@ del profile.tests['shaders']['glsl-fs-inline-explosion'] del profile.tests['shaders']['glsl-fs-unroll-explosion'] del profile.tests['shaders']['glsl-vs-inline-explosion'] del profile.tests['shaders']['glsl-vs-unroll-explosion'] + +profile.tests['spec']['ARB_shader_image_load_store']['coherency'].command += ["--quick"] diff --git a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt index 6b53370..6a6aa25 100644 --- a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt +++ b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt @@ -14,5 +14,6 @@ set(depends image.c grid.c common.c) piglit_add_executable(arb_shader_image_load_store-atomicity atomicity.c ${depends}) piglit_add_executable(arb_shader_image_load_store-bitcast bitcast.c ${depends}) +piglit_add_executable(arb_shader_image_load_store-coherency coherency.c ${depends}) # vim: ft=cmake: diff --git a/tests/spec/arb_shader_image_load_store/coherency.c b/tests/spec/arb_shader_image_load_store/coherency.c new file mode 100644 index 000..e8484a7 --- /dev/null +++ b/tests/spec/arb_shader_image_load_store/coherency.c @@ -0,0 +1,228 @@ +/* + * Copyright (C) 2014 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 coherency.c + * + * Images declared as "coherent" or "volatile" give certain guarantees + * regarding the visibility of memory writes to other shader invocations + * in the pipeline. This test checks the following assertion of the + * spec: + * "When reading a variable declared as 'coherent', the values returned + * will reflect the results of previously completed writes performed by + * other shader invocations. When writing a variable declared as + * 'coherent', the values written will be reflected in subsequent + * coherent reads performed by other shader invocations." + * + * Together with: + * "When executing a shader whose inputs are generated from a previous + * programmable stage, the shader invocations from the previous stage + * are guaranteed to have executed far enough to generate final values + * for all next-stage inputs." + * + * In order to test this we bind two shader programs at different + * execution stages of the pipeline and check that the values written to + * an image from the first stage are visible when the same primitive is + * dispatched at the second stage. This is repeated for all combinations + * of dependent shader stages (what necessarily excludes the compute + * shader), for the "coherent" and "volatile" qualifiers (the latter is + * sup
[Piglit] [PATCHv2 06/23] arb_shader_image_load_store: Import image format bitcasting test.
The ARB_shader_image_load_store extension allows the reinterpretation of the binary contents of an existing image as an image of a different compatible format. The resulting values should be predictable and are defined in terms of the usual GL pixel transfer operations. v2: Actually bind the image with the bitcasted format. --- tests/all.py | 1 + .../arb_shader_image_load_store/CMakeLists.gl.txt | 1 + tests/spec/arb_shader_image_load_store/bitcast.c | 174 + 3 files changed, 176 insertions(+) create mode 100644 tests/spec/arb_shader_image_load_store/bitcast.c diff --git a/tests/all.py b/tests/all.py index 630c4d5..d045e0e 100644 --- a/tests/all.py +++ b/tests/all.py @@ -4427,6 +4427,7 @@ import_glsl_parser_tests(spec['ARB_shader_image_load_store'], os.path.join(testsDir, 'spec', 'arb_shader_image_load_store'), ['']) arb_shader_image_load_store['atomicity'] = PiglitGLTest('arb_shader_image_load_store-atomicity', run_concurrent=True) +arb_shader_image_load_store['bitcast'] = PiglitGLTest('arb_shader_image_load_store-bitcast', run_concurrent=True) profile.tests['hiz'] = hiz profile.tests['fast_color_clear'] = fast_color_clear diff --git a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt index 8c67bb6..6b53370 100644 --- a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt +++ b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt @@ -13,5 +13,6 @@ link_libraries ( set(depends image.c grid.c common.c) piglit_add_executable(arb_shader_image_load_store-atomicity atomicity.c ${depends}) +piglit_add_executable(arb_shader_image_load_store-bitcast bitcast.c ${depends}) # vim: ft=cmake: diff --git a/tests/spec/arb_shader_image_load_store/bitcast.c b/tests/spec/arb_shader_image_load_store/bitcast.c new file mode 100644 index 000..ab04ca1 --- /dev/null +++ b/tests/spec/arb_shader_image_load_store/bitcast.c @@ -0,0 +1,174 @@ +/* + * Copyright (C) 2014 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 bitcast.c + * + * Test that the reinterpretation of the binary contents of an image + * as a different compatible format yields predictable results as + * specified by the extension. + */ + +#include "common.h" + +/** Window width. */ +#define W 16 + +/** Window height. */ +#define H 96 + +/** Total number of pixels in the window and image. */ +#define N (W * H) + +PIGLIT_GL_TEST_CONFIG_BEGIN + +config.supports_gl_core_version = 32; + +config.window_width = W; +config.window_height = H; +config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA; + +PIGLIT_GL_TEST_CONFIG_END + +static bool +init_image(const struct image_info img, + const struct image_format_info *dst_format) +{ +const unsigned m = image_num_components(img.format); +uint32_t pixels[4 * N]; +int i; + +for (i = 0; i < m * N; ++i) +pixels[i] = encode(img.format, + get_idx(image_format_scale(img.format), i % m) + * i / (m * N)); + +if (!upload_image(img, 0, pixels)) + return false; + +glBindImageTexture(0, get_texture(0), 0, GL_TRUE, 0, + GL_READ_ONLY, dst_format->format); + +return piglit_check_gl_error(GL_NO_ERROR); +} + +static bool +check(const struct grid_info grid, const struct image_info src_img, + const struct image_info dst_img) +{ +uint32_t pixels_fb[4 * N]; +uint32_t pixels_img[4 * N]; + +if (!download_result(grid, pixels_fb)) +return false; + +/* + * According to the spec, the reinterpretation of the texture + * data performed by image loads is equivalent to: + * +
[Piglit] [PATCH 08/23] arb_shader_image_load_store: Import dead fragments test.
Test that image stores and atomics have no effect when called from fragment shader invocations that aren't covered by a primitive or have been discarded. --- tests/all.py | 1 + .../arb_shader_image_load_store/CMakeLists.gl.txt | 1 + .../arb_shader_image_load_store/dead-fragments.c | 249 + 3 files changed, 251 insertions(+) create mode 100644 tests/spec/arb_shader_image_load_store/dead-fragments.c diff --git a/tests/all.py b/tests/all.py index e82c7fd..0f0e9d7 100644 --- a/tests/all.py +++ b/tests/all.py @@ -4429,6 +4429,7 @@ import_glsl_parser_tests(spec['ARB_shader_image_load_store'], arb_shader_image_load_store['atomicity'] = PiglitGLTest('arb_shader_image_load_store-atomicity', run_concurrent=True) arb_shader_image_load_store['bitcast'] = PiglitGLTest('arb_shader_image_load_store-bitcast', run_concurrent=True) arb_shader_image_load_store['coherency'] = PiglitGLTest('arb_shader_image_load_store-coherency', run_concurrent=True) +arb_shader_image_load_store['dead-fragments'] = PiglitGLTest('arb_shader_image_load_store-dead-fragments', run_concurrent=True) profile.tests['hiz'] = hiz profile.tests['fast_color_clear'] = fast_color_clear diff --git a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt index 6a6aa25..af8d85b 100644 --- a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt +++ b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt @@ -15,5 +15,6 @@ set(depends image.c grid.c common.c) piglit_add_executable(arb_shader_image_load_store-atomicity atomicity.c ${depends}) piglit_add_executable(arb_shader_image_load_store-bitcast bitcast.c ${depends}) piglit_add_executable(arb_shader_image_load_store-coherency coherency.c ${depends}) +piglit_add_executable(arb_shader_image_load_store-dead-fragments dead-fragments.c ${depends}) # vim: ft=cmake: diff --git a/tests/spec/arb_shader_image_load_store/dead-fragments.c b/tests/spec/arb_shader_image_load_store/dead-fragments.c new file mode 100644 index 000..d33fa02 --- /dev/null +++ b/tests/spec/arb_shader_image_load_store/dead-fragments.c @@ -0,0 +1,249 @@ +/* + * Copyright (C) 2014 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 dead-fragments.c + * + * Quoting the ARB_shader_image_load_store extension: + * "If a fragment shader is invoked to process fragments or samples + * not covered by a primitive being rasterized to facilitate the + * approximation of derivatives for texture lookups, stores and + * atomics have no effect." + * + * The purpose of this test is to check this assertion, as well as + * that image stores and atomics have no effect after a fragment is + * discarded. Both tests are repeated for a few different built-in + * functions. + */ + +#include "common.h" + +/** Window width. */ +#define W 16 + +/** Window height. */ +#define H 96 + +/** Total number of pixels in the window and image. */ +#define N (W * H) + +PIGLIT_GL_TEST_CONFIG_BEGIN + +config.supports_gl_core_version = 32; + +config.window_width = W; +config.window_height = H; +config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA; + +PIGLIT_GL_TEST_CONFIG_END + +struct image_op_info { +/** Image built-in name. */ +const char *name; + +/** GLSL statement that invokes this image built-in. */ +const char *hunk; +}; + +static const struct image_op_info image_ops[] = { +{ +"imageStore", +"void inc(ivec2 idx) {\n" +"imageStore(img, IMAGE_ADDR(idx)," +"imageLoad(img, IMAGE_ADDR(idx)) + BASE_T(1));\n" +"}\n" +}, +{ +"imageAtomicAdd", +"void inc(ivec2 idx) {\n" +"imageAtomicAdd(img, IMAGE_ADDR(i
[Piglit] [PATCH 12/23] arb_shader_image_load_store: Import invalid and undefined image access tests.
Test a number of cases like reading or writing outside the limits of the image that the spec defines as being invalid either return zero or have no effect depending on the specific built-in. In addition test that other cases that according to the spec cause undefined results don't lead to program termination. --- tests/all.py | 1 + .../arb_shader_image_load_store/CMakeLists.gl.txt | 1 + tests/spec/arb_shader_image_load_store/invalid.c | 485 + 3 files changed, 487 insertions(+) create mode 100644 tests/spec/arb_shader_image_load_store/invalid.c diff --git a/tests/all.py b/tests/all.py index befa94d..8aa8835 100644 --- a/tests/all.py +++ b/tests/all.py @@ -4433,6 +4433,7 @@ arb_shader_image_load_store['dead-fragments'] = PiglitGLTest('arb_shader_image_l arb_shader_image_load_store['early-z'] = PiglitGLTest('arb_shader_image_load_store-early-z', run_concurrent=True) arb_shader_image_load_store['host-mem-barrier'] = PiglitGLTest('arb_shader_image_load_store-host-mem-barrier', run_concurrent=True) arb_shader_image_load_store['indexing'] = PiglitGLTest('arb_shader_image_load_store-indexing', run_concurrent=True) +arb_shader_image_load_store['invalid'] = PiglitGLTest('arb_shader_image_load_store-invalid', run_concurrent=True) profile.tests['hiz'] = hiz profile.tests['fast_color_clear'] = fast_color_clear diff --git a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt index df89aa8..6139e58 100644 --- a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt +++ b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt @@ -19,5 +19,6 @@ piglit_add_executable(arb_shader_image_load_store-dead-fragments dead-fragments. piglit_add_executable(arb_shader_image_load_store-early-z early-z.c ${depends}) piglit_add_executable(arb_shader_image_load_store-host-mem-barrier host-mem-barrier.c ${depends}) piglit_add_executable(arb_shader_image_load_store-indexing indexing.c ${depends}) +piglit_add_executable(arb_shader_image_load_store-invalid invalid.c ${depends}) # vim: ft=cmake: diff --git a/tests/spec/arb_shader_image_load_store/invalid.c b/tests/spec/arb_shader_image_load_store/invalid.c new file mode 100644 index 000..a0981e4 --- /dev/null +++ b/tests/spec/arb_shader_image_load_store/invalid.c @@ -0,0 +1,485 @@ +/* + * Copyright (C) 2014 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 invalid.c + * + * The ARB_shader_image_load_store extension defines an image access + * to be invalid when certain conditions are met, in which case image + * stores and atomics are defined to have no effect and image loads + * and atomics give zero as result. This test causes such invalid + * accesses and checks that the result is as expected and that no data + * is accidentally overwritten. + * + * The spec describes other conditions that cause an image access to + * have undefined results. In those cases we simply check that the + * undefined access didn't lead to program termination. + */ + +#include "common.h" + +/** Window width. */ +#define W 16 + +/** Window height. */ +#define H 96 + +/** Total number of pixels in the window and image. */ +#define N (W * H) + +PIGLIT_GL_TEST_CONFIG_BEGIN + +config.supports_gl_core_version = 32; + +config.window_width = W; +config.window_height = H; +config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA; + +PIGLIT_GL_TEST_CONFIG_END + +struct image_op_info { +/** Image built-in name. */ +const char *name; + +/** Allowed image formats. */ +const struct image_format_info *formats; + +/** GLSL statement that invokes this image built-in. */ +const char *hunk; +}; + +static const struct image_op_info image_ops[] = { +{ +"imageLoad", image_formats_load_store,
[Piglit] [PATCHv2 02/23] arb_shader_image_load_store: Add common image metadata.
Define helper data structures and functions to query several kinds of information for any supported image format, target or shader stage, like the matching pixel transfer type and format for a given image format, GLSL type information, error tolerance, maximum supported dimensions and samples for a given image dimensionality, number of supported image uniforms for a given shader stage, etc. This also defines the image_info data structure that aggregates some combination of image target, format and dimensions in a single object to avoid having to repeat the same three arguments constantly when working with images. v2: Encode per-image base datatype information in a struct instead of having separate switch-case statements spread over several query functions. Add comment explaining the reason why there are no specific semantics attached to image dimensions. (Ian) --- tests/spec/arb_shader_image_load_store/image.c | 743 + tests/spec/arb_shader_image_load_store/image.h | 386 + 2 files changed, 1129 insertions(+) create mode 100644 tests/spec/arb_shader_image_load_store/image.c create mode 100644 tests/spec/arb_shader_image_load_store/image.h diff --git a/tests/spec/arb_shader_image_load_store/image.c b/tests/spec/arb_shader_image_load_store/image.c new file mode 100644 index 000..58cda9b --- /dev/null +++ b/tests/spec/arb_shader_image_load_store/image.c @@ -0,0 +1,743 @@ +/* + * Copyright (C) 2014 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.c + * + * Common image format, target and shader stage metadata. + */ + +#include "image.h" + +struct image_extent +image_optimal_extent(struct image_extent ext) +{ +const unsigned n = product(ext); +const unsigned w = 1 << MIN2(ffs(n) - 1, (int)log2(n) / 2); +const struct image_extent opt = { +w, n / w, 1, 1 +}; + +return opt; +} + +const struct image_format_info image_formats_load_store[] = { +{ "rgba32f", GL_RGBA32F, GL_RGBA, GL_FLOAT, { 32, 32, 32, 32 } }, +{ "rgba16f", GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT, { 16, 16, 16, 16 } }, +{ "rg32f", GL_RG32F, GL_RG, GL_FLOAT, { 32, 32, 0, 0 } }, +{ "rg16f", GL_RG16F, GL_RG, GL_HALF_FLOAT, { 16, 16, 0, 0 } }, +{ "r11f_g11f_b10f", GL_R11F_G11F_B10F, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV, { 11, 11, 10, 0 } }, +{ "r32f", GL_R32F, GL_RED, GL_FLOAT, { 32, 0, 0, 0 } }, +{ "r16f", GL_R16F, GL_RED, GL_HALF_FLOAT, { 16, 0, 0, 0 } }, +{ "rgba32ui", GL_RGBA32UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT, { 32, 32, 32, 32 } }, +{ "rgba16ui", GL_RGBA16UI, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT, { 16, 16, 16, 16 } }, +{ "rgb10_a2ui", GL_RGB10_A2UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT_2_10_10_10_REV, { 10, 10, 10, 2 } }, +{ "rgba8ui", GL_RGBA8UI, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE, { 8, 8, 8, 8 } }, +{ "rg32ui", GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT, { 32, 32, 0, 0 } }, +{ "rg16ui", GL_RG16UI, GL_RG_INTEGER, GL_UNSIGNED_SHORT, { 16, 16, 0, 0 } }, +{ "rg8ui", GL_RG8UI, GL_RG_INTEGER, GL_UNSIGNED_BYTE, { 8, 8, 0, 0 } }, +{ "r32ui", GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT, { 32, 0, 0, 0 } }, +{ "r16ui", GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT, { 16, 0, 0, 0 } }, +{ "r8ui", GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE, { 8, 0, 0, 0 } }, +{ "rgba32i", GL_RGBA32I, GL_RGBA_INTEGER, GL_INT, { 32, 32, 32, 32 } }, +{ "rgba16i", GL_RGBA16I, GL_RGBA_INTEGER, GL_SHORT, { 16, 16, 16, 16 } }, +{ "rgba8i", GL_RGBA8I, GL_RGBA_INTEGER, GL_BYTE, { 8, 8, 8, 8 } }, +{ "rg32i", GL_RG32I, GL_RG_INTEGER, GL_INT, { 32, 32, 0, 0 } }, +{ "rg16i", GL_RG16I, GL_RG_INTEGER, GL_SHORT, { 16, 16, 0, 0 } }, +{ "rg8i", GL_RG8I, GL_RG_INTEGER, GL_BYTE, { 8, 8, 0, 0 } }, +
[Piglit] [PATCH 09/23] arb_shader_image_load_store: Import early_fragment_tests test.
The extension defines an input layout qualifier that allows the application to force early fragment tests for a specified shader program. This has several consequences that are verified by this test, including that the fragment shader is guaranteed not to be executed if the depth test fails, that the depth value computed by the fragment shader is ignored, and that fragments discarded during or after fragment shader execution are counted by occlusion queries. --- tests/all.py | 1 + .../arb_shader_image_load_store/CMakeLists.gl.txt | 1 + tests/spec/arb_shader_image_load_store/early-z.c | 298 + 3 files changed, 300 insertions(+) create mode 100644 tests/spec/arb_shader_image_load_store/early-z.c diff --git a/tests/all.py b/tests/all.py index 0f0e9d7..0e8101f 100644 --- a/tests/all.py +++ b/tests/all.py @@ -4430,6 +4430,7 @@ arb_shader_image_load_store['atomicity'] = PiglitGLTest('arb_shader_image_load_s arb_shader_image_load_store['bitcast'] = PiglitGLTest('arb_shader_image_load_store-bitcast', run_concurrent=True) arb_shader_image_load_store['coherency'] = PiglitGLTest('arb_shader_image_load_store-coherency', run_concurrent=True) arb_shader_image_load_store['dead-fragments'] = PiglitGLTest('arb_shader_image_load_store-dead-fragments', run_concurrent=True) +arb_shader_image_load_store['early-z'] = PiglitGLTest('arb_shader_image_load_store-early-z', run_concurrent=True) profile.tests['hiz'] = hiz profile.tests['fast_color_clear'] = fast_color_clear diff --git a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt index af8d85b..874afac 100644 --- a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt +++ b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt @@ -16,5 +16,6 @@ piglit_add_executable(arb_shader_image_load_store-atomicity atomicity.c ${depend piglit_add_executable(arb_shader_image_load_store-bitcast bitcast.c ${depends}) piglit_add_executable(arb_shader_image_load_store-coherency coherency.c ${depends}) piglit_add_executable(arb_shader_image_load_store-dead-fragments dead-fragments.c ${depends}) +piglit_add_executable(arb_shader_image_load_store-early-z early-z.c ${depends}) # vim: ft=cmake: diff --git a/tests/spec/arb_shader_image_load_store/early-z.c b/tests/spec/arb_shader_image_load_store/early-z.c new file mode 100644 index 000..2485602 --- /dev/null +++ b/tests/spec/arb_shader_image_load_store/early-z.c @@ -0,0 +1,298 @@ +/* + * Copyright (C) 2014 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 early-z.c + * + * Test the interaction between early per-fragment tests, image access + * and occlusion queries. According to the spec: + * + * "When early per-fragment operations are enabled, the depth bounds + * test, stencil test, depth buffer test, and occlusion query sample + * counting operations are performed prior to fragment shader + * execution, and the stencil buffer, depth buffer, and occlusion + * query sample counts will be updated accordingly." + * + * "If a fragment is discarded during any of these operations, it will + * not be processed by any subsequent stage, including fragment + * shader execution." + * + * This checks several consequences of the quoted text, including that + * the fragment shader is guaranteed not to be executed if the depth + * test fails, that the depth value computed by the fragment shader is + * ignored, and that fragments discarded during fragment shader + * execution are counted by occlusion queries. We also check that + * when using normal (late) fragment tests image stores have an effect + * regardless of the depth test results. + */ + +#include "common.h" + +/** Window width. */ +#define W 16 + +/** Window height. */ +#define H 96 + +/** Total number of pixels in the window and image.
[Piglit] [PATCHv2 10/23] arb_shader_image_load_store: Import host memory barrier tests.
Add tests for the glMemoryBarrier() API which provides a way to serialize shader memory transactions issued by previous drawing commands with respect to subsequent GL commands. v2: Skip indirect draw and transform feedback tests when the extensions they rely on are not supported. --- tests/all.py |1 + tests/quick.py |1 + .../arb_shader_image_load_store/CMakeLists.gl.txt |1 + .../arb_shader_image_load_store/host-mem-barrier.c | 1063 4 files changed, 1066 insertions(+) create mode 100644 tests/spec/arb_shader_image_load_store/host-mem-barrier.c diff --git a/tests/all.py b/tests/all.py index 0e8101f..041bac8 100644 --- a/tests/all.py +++ b/tests/all.py @@ -4431,6 +4431,7 @@ arb_shader_image_load_store['bitcast'] = PiglitGLTest('arb_shader_image_load_sto arb_shader_image_load_store['coherency'] = PiglitGLTest('arb_shader_image_load_store-coherency', run_concurrent=True) arb_shader_image_load_store['dead-fragments'] = PiglitGLTest('arb_shader_image_load_store-dead-fragments', run_concurrent=True) arb_shader_image_load_store['early-z'] = PiglitGLTest('arb_shader_image_load_store-early-z', run_concurrent=True) +arb_shader_image_load_store['host-mem-barrier'] = PiglitGLTest('arb_shader_image_load_store-host-mem-barrier', run_concurrent=True) profile.tests['hiz'] = hiz profile.tests['fast_color_clear'] = fast_color_clear diff --git a/tests/quick.py b/tests/quick.py index 2f0d690..72b3b19 100644 --- a/tests/quick.py +++ b/tests/quick.py @@ -14,3 +14,4 @@ del profile.tests['shaders']['glsl-vs-inline-explosion'] del profile.tests['shaders']['glsl-vs-unroll-explosion'] profile.tests['spec']['ARB_shader_image_load_store']['coherency'].command += ["--quick"] +profile.tests['spec']['ARB_shader_image_load_store']['host-mem-barrier'].command += ["--quick"] diff --git a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt index 874afac..814a585 100644 --- a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt +++ b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt @@ -17,5 +17,6 @@ piglit_add_executable(arb_shader_image_load_store-bitcast bitcast.c ${depends}) piglit_add_executable(arb_shader_image_load_store-coherency coherency.c ${depends}) piglit_add_executable(arb_shader_image_load_store-dead-fragments dead-fragments.c ${depends}) piglit_add_executable(arb_shader_image_load_store-early-z early-z.c ${depends}) +piglit_add_executable(arb_shader_image_load_store-host-mem-barrier host-mem-barrier.c ${depends}) # vim: ft=cmake: diff --git a/tests/spec/arb_shader_image_load_store/host-mem-barrier.c b/tests/spec/arb_shader_image_load_store/host-mem-barrier.c new file mode 100644 index 000..ee0d650 --- /dev/null +++ b/tests/spec/arb_shader_image_load_store/host-mem-barrier.c @@ -0,0 +1,1063 @@ +/* + * Copyright (C) 2014 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 host-mem-barrier.c + * + * Unlike other GL API objects, images are not implicitly synchronized + * with subsequent GL operations. The glMemoryBarrier() API is provided + * to serialize shader memory transactions issued by previous drawing + * commands with respect to a given set of subsequent GL commands + * specified as a bit set. + * + * This test should cause several kinds of data hazard situations + * deliberately (RaW, WaR, WaW) between image loads and stores and other + * parts of the pipeline including vertex, element and indirect command + * fetch, shader uniform buffer, image and atomic counter access, texture + * sampling, pixel transfer operations, texture and buffer update + * commands, framebuffer writes and reads and transform feedback output. + * + * The test is repeated for different execution sizes to account for + * implementat
[Piglit] [PATCHv2 05/23] arb_shader_image_load_store: Import atomicity image built-in tests.
Import a number of tests intended to check if the read-modify-write built-in functions defined by the spec are carried out atomically. v2: Disable the locking imageAtomicExchange test and use a lockless algorithm instead to test the built-in. Avoids GPU hang on Intel hardware. --- tests/all.py | 1 + .../arb_shader_image_load_store/CMakeLists.gl.txt | 2 + tests/spec/arb_shader_image_load_store/atomicity.c | 366 + 3 files changed, 369 insertions(+) create mode 100644 tests/spec/arb_shader_image_load_store/atomicity.c diff --git a/tests/all.py b/tests/all.py index b872493..630c4d5 100644 --- a/tests/all.py +++ b/tests/all.py @@ -4426,6 +4426,7 @@ spec['ARB_shader_image_load_store'] = arb_shader_image_load_store import_glsl_parser_tests(spec['ARB_shader_image_load_store'], os.path.join(testsDir, 'spec', 'arb_shader_image_load_store'), ['']) +arb_shader_image_load_store['atomicity'] = PiglitGLTest('arb_shader_image_load_store-atomicity', run_concurrent=True) profile.tests['hiz'] = hiz profile.tests['fast_color_clear'] = fast_color_clear diff --git a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt index cc5586d..8c67bb6 100644 --- a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt +++ b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt @@ -12,4 +12,6 @@ link_libraries ( set(depends image.c grid.c common.c) +piglit_add_executable(arb_shader_image_load_store-atomicity atomicity.c ${depends}) + # vim: ft=cmake: diff --git a/tests/spec/arb_shader_image_load_store/atomicity.c b/tests/spec/arb_shader_image_load_store/atomicity.c new file mode 100644 index 000..92e3afa --- /dev/null +++ b/tests/spec/arb_shader_image_load_store/atomicity.c @@ -0,0 +1,366 @@ +/* + * Copyright (C) 2014 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 atomicity.c + * + * Test the atomicity of the read-modify-write image operations + * defined by the spec. The subtests can be classified in two groups: + * + * The ones that test bitwise operations (imageAtomicAnd(), + * imageAtomicOr(), imageAtomicXor()) and imageAtomicExchange() work + * by using an image as bitmap which is written to by a large number + * of shader invocations in parallel, each of them will use a bitwise + * built-in to flip an individual bit on the image. If the + * read-modify-write operation is implemented atomically no write will + * overwrite any concurrent write supposed to flip a different bit in + * the same dword, so the whole bitmap will be inverted when the + * rendering completes. + * + * The remaining subtests (imageAtomicAdd(), imageAtomicMin(), + * imageAtomicMax(), imageAtomicCompSwap()) operate on a single 32-bit + * location of the image which is accessed concurrently from all + * shader invocations. In each case a function written in terms of + * one of the built-ins is guaranteed to return a unique 32-bit value + * for each concurrent invocation as long as the read-modify-write + * operation is implemented atomically. The way in which this is + * achieved differs for each built-in and is described in more detail + * below. + */ + +#include "common.h" + +/** Window width. */ +#define W 16 + +/** Window height. */ +#define H 96 + +/** Total number of pixels in the window and image. */ +#define N (W * H) + +PIGLIT_GL_TEST_CONFIG_BEGIN + +config.supports_gl_core_version = 32; + +config.window_width = W; +config.window_height = H; +config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA; + +PIGLIT_GL_TEST_CONFIG_END + +static bool +init_image(const struct image_info img, uint32_t v) +{ +uint32_t pixels[N]; + +return init_pixels(img, pixels, v, 0, 0, 0) && +upload_image(img, 0, pixels
[Piglit] [PATCHv2 15/23] arb_shader_image_load_store: Import tests for the maximum of supported images.
Test that the limits of supported image units (GL_MAX_IMAGE_UNITS), per-shader image uniforms (GL_MAX_*_IMAGE_UNIFORMS), and combined image uniforms (GL_MAX_COMBINED_IMAGE_UNIFORMS) are true by setting up a GL pipeline that reaches some of the limits and checking that it renders as expected. v2: Don't assume that the implementation supports images on the vertex/tesselation/geometry shader. --- tests/all.py | 1 + .../arb_shader_image_load_store/CMakeLists.gl.txt | 1 + .../spec/arb_shader_image_load_store/max-images.c | 274 + 3 files changed, 276 insertions(+) create mode 100644 tests/spec/arb_shader_image_load_store/max-images.c diff --git a/tests/all.py b/tests/all.py index 5c796fa..0a36a93 100644 --- a/tests/all.py +++ b/tests/all.py @@ -4436,6 +4436,7 @@ arb_shader_image_load_store['indexing'] = PiglitGLTest('arb_shader_image_load_st arb_shader_image_load_store['invalid'] = PiglitGLTest('arb_shader_image_load_store-invalid', run_concurrent=True) arb_shader_image_load_store['layer'] = PiglitGLTest('arb_shader_image_load_store-layer', run_concurrent=True) arb_shader_image_load_store['level'] = PiglitGLTest('arb_shader_image_load_store-level', run_concurrent=True) +arb_shader_image_load_store['max-images'] = PiglitGLTest('arb_shader_image_load_store-max-images', run_concurrent=True) profile.tests['hiz'] = hiz profile.tests['fast_color_clear'] = fast_color_clear diff --git a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt index 990c3e0..2871b48 100644 --- a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt +++ b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt @@ -22,5 +22,6 @@ piglit_add_executable(arb_shader_image_load_store-indexing indexing.c ${depends} piglit_add_executable(arb_shader_image_load_store-invalid invalid.c ${depends}) piglit_add_executable(arb_shader_image_load_store-layer layer.c ${depends}) piglit_add_executable(arb_shader_image_load_store-level level.c ${depends}) +piglit_add_executable(arb_shader_image_load_store-max-images max-images.c ${depends}) # vim: ft=cmake: diff --git a/tests/spec/arb_shader_image_load_store/max-images.c b/tests/spec/arb_shader_image_load_store/max-images.c new file mode 100644 index 000..1e1186c --- /dev/null +++ b/tests/spec/arb_shader_image_load_store/max-images.c @@ -0,0 +1,274 @@ +/* + * Copyright (C) 2014 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 max-images.c + * + * Check that images work as expected up to the reported limit of + * image units and the per-shader and combined limit of image + * uniforms. + */ + +#include "common.h" + +/** Window width. */ +#define W 16 + +/** Window height. */ +#define H 96 + +/** Total number of pixels in the window and images. */ +#define N (W * H) + +PIGLIT_GL_TEST_CONFIG_BEGIN + +config.supports_gl_core_version = 32; + +config.window_width = W; +config.window_height = H; +config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA; + +PIGLIT_GL_TEST_CONFIG_END + +/** + * Return the total number of image uniforms used by the shader stages + * specified in the \a stages bit-field. + */ +static unsigned +num_images_for_stages(const struct grid_info grid, unsigned stages) +{ +const struct image_stage_info *stage; +unsigned n = 0; + +for (stage = image_stages(); stage->name; ++stage) { +if (grid.stages & stages & stage->bit) +n += image_stage_max_images(stage); +} + + +return MIN2(max_combined_images(), n); +} + +/** + * Return the total number of image uniforms used by the specified + * shader stage. + */ +static unsigned +num_images_for_stage(const struct grid_info grid, + const struct image_stage_info *stage) +{ +return nu
[Piglit] [PATCH 17/23] arb_shader_image_load_store: Import minimum maximum test.
--- tests/all.py | 1 + .../arb_shader_image_load_store/CMakeLists.gl.txt | 1 + tests/spec/arb_shader_image_load_store/minmax.c| 76 ++ 3 files changed, 78 insertions(+) create mode 100644 tests/spec/arb_shader_image_load_store/minmax.c diff --git a/tests/all.py b/tests/all.py index 32637be..aa03825 100644 --- a/tests/all.py +++ b/tests/all.py @@ -4438,6 +4438,7 @@ arb_shader_image_load_store['layer'] = PiglitGLTest('arb_shader_image_load_store arb_shader_image_load_store['level'] = PiglitGLTest('arb_shader_image_load_store-level', run_concurrent=True) arb_shader_image_load_store['max-images'] = PiglitGLTest('arb_shader_image_load_store-max-images', run_concurrent=True) arb_shader_image_load_store['max-size'] = PiglitGLTest('arb_shader_image_load_store-max-size', run_concurrent=True) +arb_shader_image_load_store['minmax'] = PiglitGLTest('arb_shader_image_load_store-minmax', run_concurrent=True) profile.tests['hiz'] = hiz profile.tests['fast_color_clear'] = fast_color_clear diff --git a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt index 461628c..bf574f1 100644 --- a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt +++ b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt @@ -24,5 +24,6 @@ piglit_add_executable(arb_shader_image_load_store-layer layer.c ${depends}) piglit_add_executable(arb_shader_image_load_store-level level.c ${depends}) piglit_add_executable(arb_shader_image_load_store-max-images max-images.c ${depends}) piglit_add_executable(arb_shader_image_load_store-max-size max-size.c ${depends}) +piglit_add_executable(arb_shader_image_load_store-minmax minmax.c ${depends}) # vim: ft=cmake: diff --git a/tests/spec/arb_shader_image_load_store/minmax.c b/tests/spec/arb_shader_image_load_store/minmax.c new file mode 100644 index 000..647caeb --- /dev/null +++ b/tests/spec/arb_shader_image_load_store/minmax.c @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2014 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 + * + * Test the minimum values for the implementation limits specified by + * the ARB_shader_image_load_store extension. + */ + +#include "common.h" +#include "minmax-test.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + +config.supports_gl_core_version = 31; +config.window_width = 1; +config.window_height = 1; +config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA; + +PIGLIT_GL_TEST_CONFIG_END + +enum piglit_result +piglit_display(void) +{ +return PIGLIT_FAIL; +} + +void +piglit_init(int argc, char **argv) +{ +int ver = piglit_get_gl_version(); + +piglit_require_extension("GL_ARB_shader_image_load_store"); + +piglit_print_minmax_header(); + +piglit_test_min_int(GL_MAX_IMAGE_UNITS, 8); +piglit_test_min_int(GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS, 8); +piglit_test_min_int(GL_MAX_IMAGE_SAMPLES, 0); +piglit_test_min_int(GL_MAX_VERTEX_IMAGE_UNIFORMS, 0); +piglit_test_min_int(GL_MAX_FRAGMENT_IMAGE_UNIFORMS, 8); +if (ver >= 32) +piglit_test_min_int(GL_MAX_GEOMETRY_IMAGE_UNIFORMS, 0); +if (ver >= 40) { +piglit_test_min_int(GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS, 0); +piglit_test_min_int(GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS, 0); +} +if (ver >= 43) +piglit_test_min_int(GL_MAX_COMPUTE_IMAGE_UNIFORMS, 8); +piglit_test_min_int(GL_MAX_COMBINED_IMAGE_UNIFORMS, 8); + +if (!piglit_check_gl_error(GL_NO_ERROR)) +piglit_report_result(PIGLIT_FAIL); + +piglit_report_result(piglit_minmax_pass ? PIGLIT_PASS : PIGLIT_FAIL); +} -- 2.1.3 ___ Piglit mailing list P
[Piglit] [PATCHv2 11/23] arb_shader_image_load_store: Import image array indexing test.
Test that indexing of image arrays using dynamically uniform expressions works as expected. v2: Add support for shader stages other than fragment. --- tests/all.py | 1 + .../arb_shader_image_load_store/CMakeLists.gl.txt | 1 + tests/spec/arb_shader_image_load_store/indexing.c | 174 + 3 files changed, 176 insertions(+) create mode 100644 tests/spec/arb_shader_image_load_store/indexing.c diff --git a/tests/all.py b/tests/all.py index 041bac8..befa94d 100644 --- a/tests/all.py +++ b/tests/all.py @@ -4432,6 +4432,7 @@ arb_shader_image_load_store['coherency'] = PiglitGLTest('arb_shader_image_load_s arb_shader_image_load_store['dead-fragments'] = PiglitGLTest('arb_shader_image_load_store-dead-fragments', run_concurrent=True) arb_shader_image_load_store['early-z'] = PiglitGLTest('arb_shader_image_load_store-early-z', run_concurrent=True) arb_shader_image_load_store['host-mem-barrier'] = PiglitGLTest('arb_shader_image_load_store-host-mem-barrier', run_concurrent=True) +arb_shader_image_load_store['indexing'] = PiglitGLTest('arb_shader_image_load_store-indexing', run_concurrent=True) profile.tests['hiz'] = hiz profile.tests['fast_color_clear'] = fast_color_clear diff --git a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt index 814a585..df89aa8 100644 --- a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt +++ b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt @@ -18,5 +18,6 @@ piglit_add_executable(arb_shader_image_load_store-coherency coherency.c ${depend piglit_add_executable(arb_shader_image_load_store-dead-fragments dead-fragments.c ${depends}) piglit_add_executable(arb_shader_image_load_store-early-z early-z.c ${depends}) piglit_add_executable(arb_shader_image_load_store-host-mem-barrier host-mem-barrier.c ${depends}) +piglit_add_executable(arb_shader_image_load_store-indexing indexing.c ${depends}) # vim: ft=cmake: diff --git a/tests/spec/arb_shader_image_load_store/indexing.c b/tests/spec/arb_shader_image_load_store/indexing.c new file mode 100644 index 000..ead0866 --- /dev/null +++ b/tests/spec/arb_shader_image_load_store/indexing.c @@ -0,0 +1,174 @@ +/* + * Copyright (C) 2014 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 indexing.c + * + * Test that image array indexing gives the expected results. The + * original ARB_shader_image_load_store is rather vague in this + * regard, but the GLSL 4.2 specification states that: + * + * "When aggregated into arrays within a shader, images can only be + * indexed with a dynamically uniform integral expression, otherwise + * results are undefined." + * + * Which means that we can only check indexing with dynamically + * uniform expressions, i.e. expressions that are invariant for all + * shader invocations in which they are evaluated. + */ + +#include "common.h" + +/** Window width. */ +#define W 16 + +/** Window height. */ +#define H 96 + +/** Total number of pixels in the window and images. */ +#define N (W * H) + +PIGLIT_GL_TEST_CONFIG_BEGIN + +config.supports_gl_core_version = 32; + +config.window_width = W; +config.window_height = H; +config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA; + +PIGLIT_GL_TEST_CONFIG_END + +static bool +init_images(const struct image_info img, GLuint prog) +{ +uint32_t pixels[H][W]; +int i, j, unit; + +for (unit = 0; unit < 8; ++unit) { +char *name = NULL; + +for (i = 0; i < W; ++i) +for (j = 0; j < H; ++j) +pixels[j][i] = (i + j + unit) % 16; + +if (!upload_image(img, unit, pixels[0])) +return false; + +asprintf(&name, "imgs[%d]", unit); +set_uniform_int
[Piglit] [PATCH 16/23] arb_shader_image_load_store: Import test for the maximum texture size.
Test that images work as expected up to the maximum texture dimensions reported by the implementation for each target. The test is carried out one dimension at a time to avoid creating huge textures (a 16Kx16K RGBA32F texture is already 4GB), but this is not always possible because e.g. both dimensions of a cubemap necessarily have to be equal. There is a hard-coded limit for the total texture size (which is especially stringent in quick mode) to make sure that the implementation doesn't make us do anything stupid like creating a 32 GB cubemap array texture. --- tests/all.py | 1 + tests/quick.py | 1 + .../arb_shader_image_load_store/CMakeLists.gl.txt | 1 + tests/spec/arb_shader_image_load_store/max-size.c | 197 + 4 files changed, 200 insertions(+) create mode 100644 tests/spec/arb_shader_image_load_store/max-size.c diff --git a/tests/all.py b/tests/all.py index 0a36a93..32637be 100644 --- a/tests/all.py +++ b/tests/all.py @@ -4437,6 +4437,7 @@ arb_shader_image_load_store['invalid'] = PiglitGLTest('arb_shader_image_load_sto arb_shader_image_load_store['layer'] = PiglitGLTest('arb_shader_image_load_store-layer', run_concurrent=True) arb_shader_image_load_store['level'] = PiglitGLTest('arb_shader_image_load_store-level', run_concurrent=True) arb_shader_image_load_store['max-images'] = PiglitGLTest('arb_shader_image_load_store-max-images', run_concurrent=True) +arb_shader_image_load_store['max-size'] = PiglitGLTest('arb_shader_image_load_store-max-size', run_concurrent=True) profile.tests['hiz'] = hiz profile.tests['fast_color_clear'] = fast_color_clear diff --git a/tests/quick.py b/tests/quick.py index 72b3b19..77cbefb 100644 --- a/tests/quick.py +++ b/tests/quick.py @@ -15,3 +15,4 @@ del profile.tests['shaders']['glsl-vs-unroll-explosion'] profile.tests['spec']['ARB_shader_image_load_store']['coherency'].command += ["--quick"] profile.tests['spec']['ARB_shader_image_load_store']['host-mem-barrier'].command += ["--quick"] +profile.tests['spec']['ARB_shader_image_load_store']['max-size'].command += ["--quick"] diff --git a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt index 2871b48..461628c 100644 --- a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt +++ b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt @@ -23,5 +23,6 @@ piglit_add_executable(arb_shader_image_load_store-invalid invalid.c ${depends}) piglit_add_executable(arb_shader_image_load_store-layer layer.c ${depends}) piglit_add_executable(arb_shader_image_load_store-level level.c ${depends}) piglit_add_executable(arb_shader_image_load_store-max-images max-images.c ${depends}) +piglit_add_executable(arb_shader_image_load_store-max-size max-size.c ${depends}) # vim: ft=cmake: diff --git a/tests/spec/arb_shader_image_load_store/max-size.c b/tests/spec/arb_shader_image_load_store/max-size.c new file mode 100644 index 000..bd08091 --- /dev/null +++ b/tests/spec/arb_shader_image_load_store/max-size.c @@ -0,0 +1,197 @@ +/* + * Copyright (C) 2014 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 max-size.c + * + * Check that images work as expected up to the maximum texture size + * reported for each target. + */ + +#include "common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + +config.supports_gl_core_version = 32; + +config.window_width = 1; +config.window_height = 1; +config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA; + +PIGLIT_GL_TEST_CONFIG_END + +static bool +init_image(const struct image_info img, unsigned unit) +{ +const unsigned n = image_num_components(img.format) * product(img.size); +uint32_t *pixels = malloc(sizeof(uint32_t) * n); +bool ret; +int i; + +for (i = 0; i < n; ++i
[Piglit] [PATCH 19/23] arb_shader_image_load_store: Import image aliasing test.
Test if the implementation is incorrectly assuming that different image uniforms point to disjoint locations in memory, which could lead to incorrect code transformations and break valid GLSL programs. --- tests/all.py | 1 + .../arb_shader_image_load_store/CMakeLists.gl.txt | 1 + tests/spec/arb_shader_image_load_store/restrict.c | 179 + 3 files changed, 181 insertions(+) create mode 100644 tests/spec/arb_shader_image_load_store/restrict.c diff --git a/tests/all.py b/tests/all.py index ab9d936..3f95600 100644 --- a/tests/all.py +++ b/tests/all.py @@ -4440,6 +4440,7 @@ arb_shader_image_load_store['max-images'] = PiglitGLTest('arb_shader_image_load_ arb_shader_image_load_store['max-size'] = PiglitGLTest('arb_shader_image_load_store-max-size', run_concurrent=True) arb_shader_image_load_store['minmax'] = PiglitGLTest('arb_shader_image_load_store-minmax', run_concurrent=True) arb_shader_image_load_store['qualifiers'] = PiglitGLTest('arb_shader_image_load_store-qualifiers', run_concurrent=True) +arb_shader_image_load_store['restrict'] = PiglitGLTest('arb_shader_image_load_store-restrict', run_concurrent=True) profile.tests['hiz'] = hiz profile.tests['fast_color_clear'] = fast_color_clear diff --git a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt index 57948f1..bf202e4 100644 --- a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt +++ b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt @@ -26,5 +26,6 @@ piglit_add_executable(arb_shader_image_load_store-max-images max-images.c ${depe piglit_add_executable(arb_shader_image_load_store-max-size max-size.c ${depends}) piglit_add_executable(arb_shader_image_load_store-minmax minmax.c ${depends}) piglit_add_executable(arb_shader_image_load_store-qualifiers qualifiers.c ${depends}) +piglit_add_executable(arb_shader_image_load_store-restrict restrict.c ${depends}) # vim: ft=cmake: diff --git a/tests/spec/arb_shader_image_load_store/restrict.c b/tests/spec/arb_shader_image_load_store/restrict.c new file mode 100644 index 000..32d3092 --- /dev/null +++ b/tests/spec/arb_shader_image_load_store/restrict.c @@ -0,0 +1,179 @@ +/* + * Copyright (C) 2014 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 restrict.c + * + * Test if the implementation is incorrectly assuming that different + * image uniforms point to disjoint locations in memory, which could lead + * to code reordering and access coalescing that could break valid GLSL + * programs. This is done by repeatedly reading and writing to an image + * through two different uniforms that alias the same image in a way that + * is likely to misrender if the implementation is coalescing loads. + * + * The same test is repeated with the "restrict" keyword which + * explicitly allows the implementation to make such assumptions. The + * rendering results from this test are ignored as it's only useful to + * test the "restrict" keyword and to find out if the implementation + * is making such transformations since otherwise the main test is not + * meaningful. + */ + +#include "common.h" + +/** Window width. */ +#define W 16 + +/** Window height. */ +#define H 96 + +/** Total number of pixels in the window and image. */ +#define N (W * H) + +PIGLIT_GL_TEST_CONFIG_BEGIN + +config.supports_gl_core_version = 32; + +config.window_width = W; +config.window_height = H; +config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA; + +PIGLIT_GL_TEST_CONFIG_END + +struct image_qualifier_info { +/** Test name. */ +const char *name; + +/** Image qualifier keyword. */ +const char *qualifier; + +/** Informative "control" test whose result is ignored. */ +bool control_test; +}; + +const struct image_qualifier_info im
[Piglit] [PATCH 01/23] util/shader: Define "nothrow" variant of piglit_compile_shader_text().
Define a variant of piglit_compile_shader_text() that doesn't call piglit_report_result() on failure killing the program, which is quite annoying for tests that expect a compilation to fail and for tests that are structured in a number of subtests, because a single sub-test failing to compile a shader will prevent the remaining tests from running. I guess this would ideally be the default behavior of piglit_compile_shader_text(), but with >300 callers in tree it seems rather difficult to change at this stage. --- tests/util/piglit-shader.c | 20 ++-- tests/util/piglit-shader.h | 1 + 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/tests/util/piglit-shader.c b/tests/util/piglit-shader.c index e8fe9c4..37cc7cc 100644 --- a/tests/util/piglit-shader.c +++ b/tests/util/piglit-shader.c @@ -122,7 +122,7 @@ shader_name(GLenum target) * Convenience function to compile a GLSL shader. */ GLuint -piglit_compile_shader_text(GLenum target, const char *text) +piglit_compile_shader_text_nothrow(GLenum target, const char *text) { GLuint prog; GLint ok; @@ -149,7 +149,8 @@ piglit_compile_shader_text(GLenum target, const char *text) info); fprintf(stderr, "source:\n%s", text); - piglit_report_result(PIGLIT_FAIL); + glDeleteShader(prog); + prog = 0; } else if (0) { /* Enable this to get extra compilation info. @@ -164,6 +165,21 @@ piglit_compile_shader_text(GLenum target, const char *text) return prog; } +/** + * Convenience function to compile a GLSL shader. Throws PIGLIT_FAIL + * on error terminating the program. + */ +GLuint +piglit_compile_shader_text(GLenum target, const char *text) +{ +GLuint shader = piglit_compile_shader_text_nothrow(target, text); + +if (!shader) +piglit_report_result(PIGLIT_FAIL); + +return shader; +} + static GLboolean link_check_status(GLint prog, FILE *output) { diff --git a/tests/util/piglit-shader.h b/tests/util/piglit-shader.h index e2eef03..9208451 100644 --- a/tests/util/piglit-shader.h +++ b/tests/util/piglit-shader.h @@ -31,6 +31,7 @@ void piglit_get_glsl_version(bool *es, int* major, int* minor); GLuint piglit_compile_shader(GLenum target, const char *filename); +GLuint piglit_compile_shader_text_nothrow(GLenum target, const char *text); GLuint piglit_compile_shader_text(GLenum target, const char *text); GLboolean piglit_link_check_status(GLint prog); GLboolean piglit_link_check_status_quiet(GLint prog); -- 2.1.3 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 18/23] arb_shader_image_load_store: Import memory access qualifier test.
Test that no changes are observed when an optional image qualifier is omitted (e.g. access qualifiers may be omitted, format qualifiers may be omitted when the "writeonly" qualifier is present), and test several combinations of binding access modes and access qualifiers. --- tests/all.py | 1 + .../arb_shader_image_load_store/CMakeLists.gl.txt | 1 + .../spec/arb_shader_image_load_store/qualifiers.c | 190 + 3 files changed, 192 insertions(+) create mode 100644 tests/spec/arb_shader_image_load_store/qualifiers.c diff --git a/tests/all.py b/tests/all.py index aa03825..ab9d936 100644 --- a/tests/all.py +++ b/tests/all.py @@ -4439,6 +4439,7 @@ arb_shader_image_load_store['level'] = PiglitGLTest('arb_shader_image_load_store arb_shader_image_load_store['max-images'] = PiglitGLTest('arb_shader_image_load_store-max-images', run_concurrent=True) arb_shader_image_load_store['max-size'] = PiglitGLTest('arb_shader_image_load_store-max-size', run_concurrent=True) arb_shader_image_load_store['minmax'] = PiglitGLTest('arb_shader_image_load_store-minmax', run_concurrent=True) +arb_shader_image_load_store['qualifiers'] = PiglitGLTest('arb_shader_image_load_store-qualifiers', run_concurrent=True) profile.tests['hiz'] = hiz profile.tests['fast_color_clear'] = fast_color_clear diff --git a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt index bf574f1..57948f1 100644 --- a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt +++ b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt @@ -25,5 +25,6 @@ piglit_add_executable(arb_shader_image_load_store-level level.c ${depends}) piglit_add_executable(arb_shader_image_load_store-max-images max-images.c ${depends}) piglit_add_executable(arb_shader_image_load_store-max-size max-size.c ${depends}) piglit_add_executable(arb_shader_image_load_store-minmax minmax.c ${depends}) +piglit_add_executable(arb_shader_image_load_store-qualifiers qualifiers.c ${depends}) # vim: ft=cmake: diff --git a/tests/spec/arb_shader_image_load_store/qualifiers.c b/tests/spec/arb_shader_image_load_store/qualifiers.c new file mode 100644 index 000..bb6f908 --- /dev/null +++ b/tests/spec/arb_shader_image_load_store/qualifiers.c @@ -0,0 +1,190 @@ +/* + * Copyright (C) 2014 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 qualifiers.c + * + * Test several combinations of image access qualifiers and binding + * access modes and check that omitting optional qualifiers doesn't + * have any effect on the rendering. + */ + +#include "common.h" + +/** Window width. */ +#define W 16 + +/** Window height. */ +#define H 96 + +/** Total number of pixels in the window and images. */ +#define N (W * H) + +PIGLIT_GL_TEST_CONFIG_BEGIN + +config.supports_gl_core_version = 32; + +config.window_width = W; +config.window_height = H; +config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA; + +PIGLIT_GL_TEST_CONFIG_END + +static bool +init_image_pixels(const struct image_info img, unsigned unit, + uint32_t *r_pixels) +{ +const unsigned m = image_num_components(img.format); +const struct image_datum s = image_format_scale(img.format); +unsigned i; + +for (i = 0; i < m * N; ++i) +r_pixels[i] = +(unit == 1 ? 0 : + encode(img.format, get_idx(s, i % m) * i / (m * N))); + +return true; +} + +static bool +init_image(const struct image_info img, unsigned unit, + bool strict_binding) +{ +uint32_t pixels[4 * N]; +bool ret = init_image_pixels(img, unit, pixels) && +upload_image(img, unit, pixels); + +if (strict_binding) +glBindImageTexture(unit, get_texture(unit), 0, GL_TRUE, 0, +
[Piglit] [PATCH 04/23] arb_shader_image_load_store: Add misc. image manipulation code and hook up to the build system.
--- tests/all.py | 6 + tests/spec/CMakeLists.txt | 1 + .../arb_shader_image_load_store/CMakeLists.gl.txt | 15 + .../arb_shader_image_load_store/CMakeLists.txt | 1 + tests/spec/arb_shader_image_load_store/common.c| 621 + tests/spec/arb_shader_image_load_store/common.h| 140 + 6 files changed, 784 insertions(+) create mode 100644 tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt create mode 100644 tests/spec/arb_shader_image_load_store/CMakeLists.txt create mode 100644 tests/spec/arb_shader_image_load_store/common.c create mode 100644 tests/spec/arb_shader_image_load_store/common.h diff --git a/tests/all.py b/tests/all.py index d6f4ac3..b872493 100644 --- a/tests/all.py +++ b/tests/all.py @@ -4421,6 +4421,12 @@ spec['ARB_direct_state_access']['getcompressedtextureimage'] = PiglitGLTest(['ar spec['ARB_direct_state_access']['texture-storage-multisample'] = PiglitGLTest(['arb_direct_state_access-texture-storage-multisample'], run_concurrent=True) spec['ARB_direct_state_access']['texture-buffer'] = PiglitGLTest(['arb_direct_state_access-texture-buffer'], run_concurrent=True) +arb_shader_image_load_store = {} +spec['ARB_shader_image_load_store'] = arb_shader_image_load_store +import_glsl_parser_tests(spec['ARB_shader_image_load_store'], + os.path.join(testsDir, 'spec', 'arb_shader_image_load_store'), + ['']) + profile.tests['hiz'] = hiz profile.tests['fast_color_clear'] = fast_color_clear profile.tests['glean'] = glean diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt index 890b1d2..2551923 100644 --- a/tests/spec/CMakeLists.txt +++ b/tests/spec/CMakeLists.txt @@ -42,6 +42,7 @@ add_subdirectory (arb_shader_subroutine) add_subdirectory (arb_shader_texture_lod/execution) add_subdirectory (arb_shader_atomic_counters) add_subdirectory (arb_shader_objects) +add_subdirectory (arb_shader_image_load_store) add_subdirectory (arb_shading_language_420pack/execution) add_subdirectory (arb_stencil_texturing) add_subdirectory (arb_sync) diff --git a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt new file mode 100644 index 000..cc5586d --- /dev/null +++ b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt @@ -0,0 +1,15 @@ +include_directories( + ${GLEXT_INCLUDE_DIR} + ${OPENGL_INCLUDE_PATH} + ${piglit_SOURCE_DIR}/tests/util +) + +link_libraries ( + piglitutil_${piglit_target_api} + ${OPENGL_gl_LIBRARY} + ${OPENGL_glu_LIBRARY} +) + +set(depends image.c grid.c common.c) + +# vim: ft=cmake: diff --git a/tests/spec/arb_shader_image_load_store/CMakeLists.txt b/tests/spec/arb_shader_image_load_store/CMakeLists.txt new file mode 100644 index 000..144a306 --- /dev/null +++ b/tests/spec/arb_shader_image_load_store/CMakeLists.txt @@ -0,0 +1 @@ +piglit_include_target_api() diff --git a/tests/spec/arb_shader_image_load_store/common.c b/tests/spec/arb_shader_image_load_store/common.c new file mode 100644 index 000..88b0f75 --- /dev/null +++ b/tests/spec/arb_shader_image_load_store/common.c @@ -0,0 +1,621 @@ +/* + * Copyright (C) 2014 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 common.c + * + * Common utility functions for the ARB_shader_image_load_store tests. + */ + +#include "common.h" + +bool +set_uniform_int(GLuint prog, const char *name, int value) +{ +int loc, last_prog; + +loc = glGetUniformLocation(prog, name); +if (loc < 0) +return true; + +glGetIntegerv(GL_CURRENT_PROGRAM, &last_prog); +if (prog != last_prog) +glUseProgram(prog); + +glUniform1i(loc, value); + +return piglit_check_gl_error(GL_NO_ERROR); +} + +static GL
[Piglit] [PATCHv2 03/23] arb_shader_image_load_store: Import grid execution helpers.
Define helper functions that are able to run a piece of GLSL code on an arbitrary shader stage (as of now VS, TCS, TES, GS, FS and CS are supported) for a given execution size. This makes every shader stage expose a consistent interface that looks like a sort of primitive two-dimensional compute grid, with the peculiarity that you can run several stages at the same time and chain the results of one stage into the arguments of the next. This is useful in cases where one needs to run the exact same test on a number of shader stages and using code generators or duplicating code would be inconvenient. v2: Fix crash when generate_program() is called with unsupported shader stage arguments. --- tests/spec/arb_shader_image_load_store/grid.c | 450 ++ tests/spec/arb_shader_image_load_store/grid.h | 155 + 2 files changed, 605 insertions(+) create mode 100644 tests/spec/arb_shader_image_load_store/grid.c create mode 100644 tests/spec/arb_shader_image_load_store/grid.h diff --git a/tests/spec/arb_shader_image_load_store/grid.c b/tests/spec/arb_shader_image_load_store/grid.c new file mode 100644 index 000..766d968 --- /dev/null +++ b/tests/spec/arb_shader_image_load_store/grid.c @@ -0,0 +1,450 @@ +/* + * Copyright (C) 2014 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 grid.c + * + * Utility code for running a grid of shader invocations abstracting + * out the details of the specific shader stage it's run on. + */ + +#include "common.h" + +char * +concat(char *hunk0, ...) +{ +char *s = hunk0; +char *hunk; +va_list ap; + +va_start(ap, hunk0); + +while ((hunk = va_arg(ap, char *))) { +char *t = s; +asprintf(&s, "%s\n%s", t, hunk); +free(t); +free(hunk); +} + +va_end(ap); +return s; +} + +char * +image_hunk(const struct image_info img, const char *prefix) +{ +char *s = NULL; + +asprintf(&s, + "#define %sBASE_T %s\n" + "#define %sDATA_T %s\n" + "#define %sSCALE vec4(%.8e, %.8e, %.8e, %.8e)\n" + "#define %sIMAGE_ADDR_(addr_t, ext, i) %s\n" + "#define %sIMAGE_ADDR(idx)" + "%sIMAGE_ADDR_(%s, ivec4(%d, %d, %d, %d)," + " ((idx).x + W * (idx).y))\n" + "#define %sIMAGE_LAYOUT_Q layout(%s)\n" + "#define %sIMAGE_BARE_T %s%s\n" + "#define %sIMAGE_T %sIMAGE_LAYOUT_Q %sIMAGE_BARE_T\n", + prefix, image_scalar_type_name(img.format), + prefix, image_vector_type_name(img.format), + prefix, image_format_scale(img.format).x, + image_format_scale(img.format).y, + image_format_scale(img.format).z, + image_format_scale(img.format).w, + prefix, (image_target_samples(img.target) > 1 ? + "addr_t(ivec3(i / ext.x % ext.y," + " i / ext.x / ext.y % ext.z," + " i / ext.x / ext.y / ext.z))," + "(i % ext.x)" : + "addr_t(ivec3(i % ext.x," + " i / ext.x % ext.y," + " i / ext.x / ext.y))"), + prefix, prefix, img.target->addr_type_name, + img.size.x, img.size.y, img.size.z, img.size.w, + prefix, img.format->name, + prefix, image_type_name(img.format), img.target->name, + prefix, prefix, prefix); +return s; +} + +static char * +header_hunk(const struct grid_info grid) +{ +char *s = NULL; + +asprintf(&s, "#version 150\n" + "#extension GL_ARB
[Piglit] [PATCH 22/23] arb_shader_image_load_store: Import image unit and uniform state tracking tests.
Test the image unit and image uniform binding commands and then check that the state query APIs return the expected values for all bound image units. --- tests/all.py | 1 + .../arb_shader_image_load_store/CMakeLists.gl.txt | 1 + tests/spec/arb_shader_image_load_store/state.c | 480 + 3 files changed, 482 insertions(+) create mode 100644 tests/spec/arb_shader_image_load_store/state.c diff --git a/tests/all.py b/tests/all.py index 736dc78..fbb9c19 100644 --- a/tests/all.py +++ b/tests/all.py @@ -4443,6 +4443,7 @@ arb_shader_image_load_store['qualifiers'] = PiglitGLTest('arb_shader_image_load_ arb_shader_image_load_store['restrict'] = PiglitGLTest('arb_shader_image_load_store-restrict', run_concurrent=True) arb_shader_image_load_store['semantics'] = PiglitGLTest('arb_shader_image_load_store-semantics', run_concurrent=True) arb_shader_image_load_store['shader-mem-barrier'] = PiglitGLTest('arb_shader_image_load_store-shader-mem-barrier', run_concurrent=True) +arb_shader_image_load_store['state'] = PiglitGLTest('arb_shader_image_load_store-state', run_concurrent=True) profile.tests['hiz'] = hiz profile.tests['fast_color_clear'] = fast_color_clear diff --git a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt index edb928a..3d0bdd5 100644 --- a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt +++ b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt @@ -29,5 +29,6 @@ piglit_add_executable(arb_shader_image_load_store-qualifiers qualifiers.c ${depe piglit_add_executable(arb_shader_image_load_store-restrict restrict.c ${depends}) piglit_add_executable(arb_shader_image_load_store-semantics semantics.c ${depends}) piglit_add_executable(arb_shader_image_load_store-shader-mem-barrier shader-mem-barrier.c ${depends}) +piglit_add_executable(arb_shader_image_load_store-state state.c ${depends}) # vim: ft=cmake: diff --git a/tests/spec/arb_shader_image_load_store/state.c b/tests/spec/arb_shader_image_load_store/state.c new file mode 100644 index 000..bc25b56 --- /dev/null +++ b/tests/spec/arb_shader_image_load_store/state.c @@ -0,0 +1,480 @@ +/* + * Copyright (C) 2014 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 state.c + * + * Test image unit binding by creating a number of textures and + * binding them as images with different parameters (including + * incorrect arguments that are supposed to generate GL errors), + * delete and unbind a few images and check using the state query API + * that the implementation is keeping track of the image unit state + * correctly. + * + * A second test checks that glUniform*() work as specified when used + * to assign image units to shader image uniforms. + */ + +#include "common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + +/** Image width. */ +#define W 16 + +/** Image height. */ +#define H 96 + +/** Total number of pixels in the image. */ +#define N (W * H) + +/** Maximum number of mipmap levels. */ +#define M 11 + +config.supports_gl_core_version = 32; + +config.window_width = 1; +config.window_height = 1; +config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA; + +PIGLIT_GL_TEST_CONFIG_END + +struct image_unit_action { +enum { +/** End of action list. */ +END = 0, + +/** Create a new texture object of type \a obj and + * bind it to the specified image unit. */ +BIND_NEW, + +/** Bind the same texture object that was previously + * bound to image unit \a obj to the specified image + * unit. */ +BIND_IDX, + +/** Bind texture object \a obj to the specified image + * unit. */ +BIND_OBJ, + +/**
[Piglit] [PATCH 23/23] arb_shader_image_load_store: Import test for atomics with unused result.
Test all image atomic built-in functions without using their return value to make sure that they aren't optimized out by the compiler accidentally and because some implementations may use different hardware instructions for the same atomic operation depending on whether the return value of the built-in is used or not. --- tests/all.py | 1 + .../arb_shader_image_load_store/CMakeLists.gl.txt | 1 + tests/spec/arb_shader_image_load_store/unused.c| 178 + 3 files changed, 180 insertions(+) create mode 100644 tests/spec/arb_shader_image_load_store/unused.c diff --git a/tests/all.py b/tests/all.py index fbb9c19..188300a 100644 --- a/tests/all.py +++ b/tests/all.py @@ -,6 +,7 @@ arb_shader_image_load_store['restrict'] = PiglitGLTest('arb_shader_image_load_st arb_shader_image_load_store['semantics'] = PiglitGLTest('arb_shader_image_load_store-semantics', run_concurrent=True) arb_shader_image_load_store['shader-mem-barrier'] = PiglitGLTest('arb_shader_image_load_store-shader-mem-barrier', run_concurrent=True) arb_shader_image_load_store['state'] = PiglitGLTest('arb_shader_image_load_store-state', run_concurrent=True) +arb_shader_image_load_store['unused'] = PiglitGLTest('arb_shader_image_load_store-unused', run_concurrent=True) profile.tests['hiz'] = hiz profile.tests['fast_color_clear'] = fast_color_clear diff --git a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt index 3d0bdd5..9db9d18 100644 --- a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt +++ b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt @@ -30,5 +30,6 @@ piglit_add_executable(arb_shader_image_load_store-restrict restrict.c ${depends} piglit_add_executable(arb_shader_image_load_store-semantics semantics.c ${depends}) piglit_add_executable(arb_shader_image_load_store-shader-mem-barrier shader-mem-barrier.c ${depends}) piglit_add_executable(arb_shader_image_load_store-state state.c ${depends}) +piglit_add_executable(arb_shader_image_load_store-unused unused.c ${depends}) # vim: ft=cmake: diff --git a/tests/spec/arb_shader_image_load_store/unused.c b/tests/spec/arb_shader_image_load_store/unused.c new file mode 100644 index 000..91fa5c5 --- /dev/null +++ b/tests/spec/arb_shader_image_load_store/unused.c @@ -0,0 +1,178 @@ +/* + * Copyright (C) 2014 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 unused.c + * + * Test that atomic ops with unused return value still have the + * expected effect (which implies that they aren't being optimized out + * accidentally by the compiler). + */ + +#include "common.h" + +/** Window width. */ +#define W 16 + +/** Window height. */ +#define H 96 + +/** Total number of pixels in the window and image. */ +#define N (W * H) + +PIGLIT_GL_TEST_CONFIG_BEGIN + +config.supports_gl_core_version = 32; + +config.window_width = W; +config.window_height = H; +config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA; + +PIGLIT_GL_TEST_CONFIG_END + +static bool +init_image(const struct image_info img, uint32_t v) +{ +uint32_t pixels[N]; + +return init_pixels(img, pixels, v, 0, 0, 0) && +upload_image(img, 0, pixels); +} + +static bool +check(const struct image_info img, uint32_t v) +{ +uint32_t pixels[N]; + +return download_image(img, 0, pixels) && +check_pixels(img, pixels, v, 0, 0, 0); +} + +/** + * Test skeleton: Init image to \a init_value, run the provided shader + * \a op and check that the resulting image pixels equal \a + * check_value. + */ +static bool +run_test(uint32_t init_value, uint32_t check_value, + const char *op) +{ +const struct grid_info grid = +grid_info(GL_FRAGMENT_SHADER, GL_R32UI, W, H); +const struct image_info
[Piglit] [PATCH 21/23] arb_shader_image_load_store: Import shader memory barrier tests.
Test the relative ordering of memory transactions before and after a call to the memoryBarrier() GLSL built-in. --- tests/all.py | 1 + tests/quick.py | 1 + .../arb_shader_image_load_store/CMakeLists.gl.txt | 1 + .../shader-mem-barrier.c | 222 + 4 files changed, 225 insertions(+) create mode 100644 tests/spec/arb_shader_image_load_store/shader-mem-barrier.c diff --git a/tests/all.py b/tests/all.py index 56852ad..736dc78 100644 --- a/tests/all.py +++ b/tests/all.py @@ -4442,6 +4442,7 @@ arb_shader_image_load_store['minmax'] = PiglitGLTest('arb_shader_image_load_stor arb_shader_image_load_store['qualifiers'] = PiglitGLTest('arb_shader_image_load_store-qualifiers', run_concurrent=True) arb_shader_image_load_store['restrict'] = PiglitGLTest('arb_shader_image_load_store-restrict', run_concurrent=True) arb_shader_image_load_store['semantics'] = PiglitGLTest('arb_shader_image_load_store-semantics', run_concurrent=True) +arb_shader_image_load_store['shader-mem-barrier'] = PiglitGLTest('arb_shader_image_load_store-shader-mem-barrier', run_concurrent=True) profile.tests['hiz'] = hiz profile.tests['fast_color_clear'] = fast_color_clear diff --git a/tests/quick.py b/tests/quick.py index aa20059..7d6eae2 100644 --- a/tests/quick.py +++ b/tests/quick.py @@ -17,3 +17,4 @@ profile.tests['spec']['ARB_shader_image_load_store']['coherency'].command += ["- profile.tests['spec']['ARB_shader_image_load_store']['host-mem-barrier'].command += ["--quick"] profile.tests['spec']['ARB_shader_image_load_store']['max-size'].command += ["--quick"] profile.tests['spec']['ARB_shader_image_load_store']['semantics'].command += ["--quick"] +profile.tests['spec']['ARB_shader_image_load_store']['shader-mem-barrier'].command += ["--quick"] diff --git a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt index f03b4af..edb928a 100644 --- a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt +++ b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt @@ -28,5 +28,6 @@ piglit_add_executable(arb_shader_image_load_store-minmax minmax.c ${depends}) piglit_add_executable(arb_shader_image_load_store-qualifiers qualifiers.c ${depends}) piglit_add_executable(arb_shader_image_load_store-restrict restrict.c ${depends}) piglit_add_executable(arb_shader_image_load_store-semantics semantics.c ${depends}) +piglit_add_executable(arb_shader_image_load_store-shader-mem-barrier shader-mem-barrier.c ${depends}) # vim: ft=cmake: diff --git a/tests/spec/arb_shader_image_load_store/shader-mem-barrier.c b/tests/spec/arb_shader_image_load_store/shader-mem-barrier.c new file mode 100644 index 000..c5011f9 --- /dev/null +++ b/tests/spec/arb_shader_image_load_store/shader-mem-barrier.c @@ -0,0 +1,222 @@ +/* + * Copyright (C) 2014 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 shader-mem-barrier.c + * + * Test that the memoryBarrier() GLSL built-in effectively serializes + * memory transactions initiated after and before the call. This is + * done by having a number of threads write to separate locations in a + * loop serializing each pair of writes with memoryBarrier() while the + * remaining threads monitor the evolution of the same memory + * locations until an inconsistency is observed or the test runs to + * completion. + * + * The test is repeated for the "volatile" qualifier with no barriers, + * for all execution stages and for different relative arrangements of + * producer and monitor threads to account for implementations with + * varying levels of parallelism and with caches of different sizes. + * + * Unless running in "quick" mode a series of control tests is + * executed which disables memory barriers in order to make sure
[Piglit] [PATCH 20/23] arb_shader_image_load_store: Import built-in semantics tests.
Test that image built-in functions do what they are supposed to do by comparing their results with a simulation run on the CPU with similar inputs. The test is repeated for all built-ins, shader stages, formats and texture targets either sequentially or combinatorially depending on the --quick flag. --- tests/all.py | 1 + tests/quick.py | 1 + .../arb_shader_image_load_store/CMakeLists.gl.txt | 1 + tests/spec/arb_shader_image_load_store/semantics.c | 397 + 4 files changed, 400 insertions(+) create mode 100644 tests/spec/arb_shader_image_load_store/semantics.c diff --git a/tests/all.py b/tests/all.py index 3f95600..56852ad 100644 --- a/tests/all.py +++ b/tests/all.py @@ -4441,6 +4441,7 @@ arb_shader_image_load_store['max-size'] = PiglitGLTest('arb_shader_image_load_st arb_shader_image_load_store['minmax'] = PiglitGLTest('arb_shader_image_load_store-minmax', run_concurrent=True) arb_shader_image_load_store['qualifiers'] = PiglitGLTest('arb_shader_image_load_store-qualifiers', run_concurrent=True) arb_shader_image_load_store['restrict'] = PiglitGLTest('arb_shader_image_load_store-restrict', run_concurrent=True) +arb_shader_image_load_store['semantics'] = PiglitGLTest('arb_shader_image_load_store-semantics', run_concurrent=True) profile.tests['hiz'] = hiz profile.tests['fast_color_clear'] = fast_color_clear diff --git a/tests/quick.py b/tests/quick.py index 77cbefb..aa20059 100644 --- a/tests/quick.py +++ b/tests/quick.py @@ -16,3 +16,4 @@ del profile.tests['shaders']['glsl-vs-unroll-explosion'] profile.tests['spec']['ARB_shader_image_load_store']['coherency'].command += ["--quick"] profile.tests['spec']['ARB_shader_image_load_store']['host-mem-barrier'].command += ["--quick"] profile.tests['spec']['ARB_shader_image_load_store']['max-size'].command += ["--quick"] +profile.tests['spec']['ARB_shader_image_load_store']['semantics'].command += ["--quick"] diff --git a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt index bf202e4..f03b4af 100644 --- a/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt +++ b/tests/spec/arb_shader_image_load_store/CMakeLists.gl.txt @@ -27,5 +27,6 @@ piglit_add_executable(arb_shader_image_load_store-max-size max-size.c ${depends} piglit_add_executable(arb_shader_image_load_store-minmax minmax.c ${depends}) piglit_add_executable(arb_shader_image_load_store-qualifiers qualifiers.c ${depends}) piglit_add_executable(arb_shader_image_load_store-restrict restrict.c ${depends}) +piglit_add_executable(arb_shader_image_load_store-semantics semantics.c ${depends}) # vim: ft=cmake: diff --git a/tests/spec/arb_shader_image_load_store/semantics.c b/tests/spec/arb_shader_image_load_store/semantics.c new file mode 100644 index 000..122e490 --- /dev/null +++ b/tests/spec/arb_shader_image_load_store/semantics.c @@ -0,0 +1,397 @@ +/* + * Copyright (C) 2014 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 semantics.c + * + * Test all allowed combinations of image targets, formats, built-in + * functions and shader stages. The test initializes an image to some + * arbitrary pattern and runs N invocations of a shader that calls the + * built-in function once on the corresponding location of the image. + * Then the same operation is simulated on the CPU and the results are + * compared with each other. + */ + +#include "common.h" + +/** Window width. The actual width of the image varies with the image + * dimensionality, but the total number of pixels \a N remains + * invariant. */ +#define W 16 + +/** Window height. */ +#define H 96 + +/** Total number of pixels in the window and image. */ +#define N (W * H) + +PIGLIT_GL_TEST_CONFIG_BEGIN + +config.supports_gl_core_version = 32; + +config.window
Re: [Piglit] Tests for ARB_shader_image_load_store (resend).
Francisco Jerez writes: > This is my third and last rebase and resend of the > ARB_shader_image_load_store tests I sent to this mailing list last > October. If there have been no objections by the 3rd February at noon > (UTC) I will push the rest of the series without review. > A working branch can be found in my piglit tree as before: http://cgit.freedesktop.org/~currojerez/piglit/log/?h=image-load-store > [PATCH 01/23] util/shader: Define "nothrow" variant of > piglit_compile_shader_text(). > [PATCHv2 02/23] arb_shader_image_load_store: Add common image metadata. > [PATCHv2 03/23] arb_shader_image_load_store: Import grid execution helpers. > [PATCH 04/23] arb_shader_image_load_store: Add misc. image manipulation code > and hook up to the build system. > [PATCHv2 05/23] arb_shader_image_load_store: Import atomicity image built-in > tests. > [PATCHv2 06/23] arb_shader_image_load_store: Import image format bitcasting > test. > [PATCH 07/23] arb_shader_image_load_store: Import memory coherency test. > [PATCH 08/23] arb_shader_image_load_store: Import dead fragments test. > [PATCH 09/23] arb_shader_image_load_store: Import early_fragment_tests test. > [PATCHv2 10/23] arb_shader_image_load_store: Import host memory barrier tests. > [PATCHv2 11/23] arb_shader_image_load_store: Import image array indexing test. > [PATCH 12/23] arb_shader_image_load_store: Import invalid and undefined image > access tests. > [PATCH 13/23] arb_shader_image_load_store: Import tests for layered and > unlayered binding. > [PATCH 14/23] arb_shader_image_load_store: Import test for mipmap level > binding. > [PATCHv2 15/23] arb_shader_image_load_store: Import tests for the maximum of > supported images. > [PATCH 16/23] arb_shader_image_load_store: Import test for the maximum > texture size. > [PATCH 17/23] arb_shader_image_load_store: Import minimum maximum test. > [PATCH 18/23] arb_shader_image_load_store: Import memory access qualifier > test. > [PATCH 19/23] arb_shader_image_load_store: Import image aliasing test. > [PATCH 20/23] arb_shader_image_load_store: Import built-in semantics tests. > [PATCH 21/23] arb_shader_image_load_store: Import shader memory barrier tests. > [PATCH 22/23] arb_shader_image_load_store: Import image unit and uniform > state tracking tests. > [PATCH 23/23] arb_shader_image_load_store: Import test for atomics with > unused result. > ___ > Piglit mailing list > Piglit@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/piglit pgpdJYbWkQxf_.pgp Description: PGP signature ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH 01/23] util/shader: Define "nothrow" variant of piglit_compile_shader_text().
On 2015-01-31 07:41:23, Francisco Jerez wrote: > Define a variant of piglit_compile_shader_text() that doesn't call > piglit_report_result() on failure killing the program, which is quite > annoying for tests that expect a compilation to fail and for tests > that are structured in a number of subtests, because a single sub-test > failing to compile a shader will prevent the remaining tests from > running. > > I guess this would ideally be the default behavior of > piglit_compile_shader_text(), but with >300 callers in tree it seems > rather difficult to change at this stage. sed? Maybe piglit_compile_shader_text => piglit_require_compile_shader_text? > --- > tests/util/piglit-shader.c | 20 ++-- > tests/util/piglit-shader.h | 1 + > 2 files changed, 19 insertions(+), 2 deletions(-) > > diff --git a/tests/util/piglit-shader.c b/tests/util/piglit-shader.c > index e8fe9c4..37cc7cc 100644 > --- a/tests/util/piglit-shader.c > +++ b/tests/util/piglit-shader.c > @@ -122,7 +122,7 @@ shader_name(GLenum target) > * Convenience function to compile a GLSL shader. > */ > GLuint > -piglit_compile_shader_text(GLenum target, const char *text) > +piglit_compile_shader_text_nothrow(GLenum target, const char *text) > { > GLuint prog; > GLint ok; > @@ -149,7 +149,8 @@ piglit_compile_shader_text(GLenum target, const char > *text) > info); > > fprintf(stderr, "source:\n%s", text); Do you think piglit_compile_shader_text_nothrow should be silent if the shader fails to compile? Maybe move the fprintf's as well? -Jordan > - piglit_report_result(PIGLIT_FAIL); > + glDeleteShader(prog); > + prog = 0; > } > else if (0) { > /* Enable this to get extra compilation info. > @@ -164,6 +165,21 @@ piglit_compile_shader_text(GLenum target, const char > *text) > return prog; > } > > +/** > + * Convenience function to compile a GLSL shader. Throws PIGLIT_FAIL > + * on error terminating the program. > + */ > +GLuint > +piglit_compile_shader_text(GLenum target, const char *text) > +{ > +GLuint shader = piglit_compile_shader_text_nothrow(target, text); > + > +if (!shader) > +piglit_report_result(PIGLIT_FAIL); > + > +return shader; > +} > + > static GLboolean > link_check_status(GLint prog, FILE *output) > { > diff --git a/tests/util/piglit-shader.h b/tests/util/piglit-shader.h > index e2eef03..9208451 100644 > --- a/tests/util/piglit-shader.h > +++ b/tests/util/piglit-shader.h > @@ -31,6 +31,7 @@ > void piglit_get_glsl_version(bool *es, int* major, int* minor); > > GLuint piglit_compile_shader(GLenum target, const char *filename); > +GLuint piglit_compile_shader_text_nothrow(GLenum target, const char *text); > GLuint piglit_compile_shader_text(GLenum target, const char *text); > GLboolean piglit_link_check_status(GLint prog); > GLboolean piglit_link_check_status_quiet(GLint prog); > -- > 2.1.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
Re: [Piglit] [PATCH 01/23] util/shader: Define "nothrow" variant of piglit_compile_shader_text().
On Sat, Jan 31, 2015 at 7:41 AM, Francisco Jerez wrote: > Define a variant of piglit_compile_shader_text() that doesn't call > piglit_report_result() on failure killing the program, which is quite > annoying for tests that expect a compilation to fail and for tests > that are structured in a number of subtests, because a single sub-test > failing to compile a shader will prevent the remaining tests from > running. Do we want this function because we expect certain compilations to fail (and if so, why are we trying to compile them?) or just for ease of developing a large containing many subtests? I looked at its use in 3/23 and wasn't sure of the answer. ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCHv2 02/23] arb_shader_image_load_store: Add common image metadata.
Reviewed-by: Jordan Justen On 2015-01-31 07:41:24, Francisco Jerez wrote: > Define helper data structures and functions to query several kinds of > information for any supported image format, target or shader stage, > like the matching pixel transfer type and format for a given image > format, GLSL type information, error tolerance, maximum supported > dimensions and samples for a given image dimensionality, number of > supported image uniforms for a given shader stage, etc. > > This also defines the image_info data structure that aggregates some > combination of image target, format and dimensions in a single object > to avoid having to repeat the same three arguments constantly when > working with images. > > v2: Encode per-image base datatype information in a struct instead of > having separate switch-case statements spread over several query > functions. Add comment explaining the reason why there are no > specific semantics attached to image dimensions. (Ian) > --- > tests/spec/arb_shader_image_load_store/image.c | 743 > + > tests/spec/arb_shader_image_load_store/image.h | 386 + > 2 files changed, 1129 insertions(+) > create mode 100644 tests/spec/arb_shader_image_load_store/image.c > create mode 100644 tests/spec/arb_shader_image_load_store/image.h > > diff --git a/tests/spec/arb_shader_image_load_store/image.c > b/tests/spec/arb_shader_image_load_store/image.c > new file mode 100644 > index 000..58cda9b > --- /dev/null > +++ b/tests/spec/arb_shader_image_load_store/image.c > @@ -0,0 +1,743 @@ > +/* > + * Copyright (C) 2014 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.c > + * > + * Common image format, target and shader stage metadata. > + */ > + > +#include "image.h" > + > +struct image_extent > +image_optimal_extent(struct image_extent ext) > +{ > +const unsigned n = product(ext); > +const unsigned w = 1 << MIN2(ffs(n) - 1, (int)log2(n) / 2); > +const struct image_extent opt = { > +w, n / w, 1, 1 > +}; > + > +return opt; > +} > + > +const struct image_format_info image_formats_load_store[] = { > +{ "rgba32f", GL_RGBA32F, GL_RGBA, GL_FLOAT, { 32, 32, 32, 32 } }, > +{ "rgba16f", GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT, { 16, 16, 16, 16 } > }, > +{ "rg32f", GL_RG32F, GL_RG, GL_FLOAT, { 32, 32, 0, 0 } }, > +{ "rg16f", GL_RG16F, GL_RG, GL_HALF_FLOAT, { 16, 16, 0, 0 } }, > +{ "r11f_g11f_b10f", GL_R11F_G11F_B10F, GL_RGB, > GL_UNSIGNED_INT_10F_11F_11F_REV, { 11, 11, 10, 0 } }, > +{ "r32f", GL_R32F, GL_RED, GL_FLOAT, { 32, 0, 0, 0 } }, > +{ "r16f", GL_R16F, GL_RED, GL_HALF_FLOAT, { 16, 0, 0, 0 } }, > +{ "rgba32ui", GL_RGBA32UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT, { 32, > 32, 32, 32 } }, > +{ "rgba16ui", GL_RGBA16UI, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT, { 16, > 16, 16, 16 } }, > +{ "rgb10_a2ui", GL_RGB10_A2UI, GL_RGBA_INTEGER, > GL_UNSIGNED_INT_2_10_10_10_REV, { 10, 10, 10, 2 } }, > +{ "rgba8ui", GL_RGBA8UI, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE, { 8, 8, > 8, 8 } }, > +{ "rg32ui", GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT, { 32, 32, 0, > 0 } }, > +{ "rg16ui", GL_RG16UI, GL_RG_INTEGER, GL_UNSIGNED_SHORT, { 16, 16, > 0, 0 } }, > +{ "rg8ui", GL_RG8UI, GL_RG_INTEGER, GL_UNSIGNED_BYTE, { 8, 8, 0, 0 } > }, > +{ "r32ui", GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT, { 32, 0, 0, 0 > } }, > +{ "r16ui", GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT, { 16, 0, 0, > 0 } }, > +{ "r8ui", GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE, { 8, 0, 0, 0 } > }, > +{ "rgba32i", GL_RGBA32I, GL_RGBA_INTEGER, GL_INT, { 32, 32, 32, 32 } > }, > +{ "rgba16i", GL_RGBA16I, GL_RGBA_INTEGER, GL_SHORT, { 16, 16, 16, 16 > } }, > +
Re: [Piglit] [PATCH 01/23] util/shader: Define "nothrow" variant of piglit_compile_shader_text().
Jordan Justen writes: > On 2015-01-31 07:41:23, Francisco Jerez wrote: >> Define a variant of piglit_compile_shader_text() that doesn't call >> piglit_report_result() on failure killing the program, which is quite >> annoying for tests that expect a compilation to fail and for tests >> that are structured in a number of subtests, because a single sub-test >> failing to compile a shader will prevent the remaining tests from >> running. >> >> I guess this would ideally be the default behavior of >> piglit_compile_shader_text(), but with >300 callers in tree it seems >> rather difficult to change at this stage. > > sed? > > Maybe piglit_compile_shader_text => piglit_require_compile_shader_text? > I personally don't care enough to make such a change affecting hundreds of other tests that wouldn't have the slightest chance of being reviewed before it no longer applies cleanly. I would support the change though if you feel like doing it. >> --- >> tests/util/piglit-shader.c | 20 ++-- >> tests/util/piglit-shader.h | 1 + >> 2 files changed, 19 insertions(+), 2 deletions(-) >> >> diff --git a/tests/util/piglit-shader.c b/tests/util/piglit-shader.c >> index e8fe9c4..37cc7cc 100644 >> --- a/tests/util/piglit-shader.c >> +++ b/tests/util/piglit-shader.c >> @@ -122,7 +122,7 @@ shader_name(GLenum target) >> * Convenience function to compile a GLSL shader. >> */ >> GLuint >> -piglit_compile_shader_text(GLenum target, const char *text) >> +piglit_compile_shader_text_nothrow(GLenum target, const char *text) >> { >> GLuint prog; >> GLint ok; >> @@ -149,7 +149,8 @@ piglit_compile_shader_text(GLenum target, const char >> *text) >> info); >> >> fprintf(stderr, "source:\n%s", text); > > Do you think piglit_compile_shader_text_nothrow should be silent if > the shader fails to compile? > > Maybe move the fprintf's as well? > As the main motivation for this function is to avoid killing the program when a shader compilation fails, I think the fprintf() is fine and useful to find out what is going on when something fails. But we could make it dependent on a parameter or factor it out to a separate function if you like. > -Jordan > >> - piglit_report_result(PIGLIT_FAIL); >> + glDeleteShader(prog); >> + prog = 0; >> } >> else if (0) { >> /* Enable this to get extra compilation info. >> @@ -164,6 +165,21 @@ piglit_compile_shader_text(GLenum target, const char >> *text) >> return prog; >> } >> >> +/** >> + * Convenience function to compile a GLSL shader. Throws PIGLIT_FAIL >> + * on error terminating the program. >> + */ >> +GLuint >> +piglit_compile_shader_text(GLenum target, const char *text) >> +{ >> +GLuint shader = piglit_compile_shader_text_nothrow(target, text); >> + >> +if (!shader) >> +piglit_report_result(PIGLIT_FAIL); >> + >> +return shader; >> +} >> + >> static GLboolean >> link_check_status(GLint prog, FILE *output) >> { >> diff --git a/tests/util/piglit-shader.h b/tests/util/piglit-shader.h >> index e2eef03..9208451 100644 >> --- a/tests/util/piglit-shader.h >> +++ b/tests/util/piglit-shader.h >> @@ -31,6 +31,7 @@ >> void piglit_get_glsl_version(bool *es, int* major, int* minor); >> >> GLuint piglit_compile_shader(GLenum target, const char *filename); >> +GLuint piglit_compile_shader_text_nothrow(GLenum target, const char *text); >> GLuint piglit_compile_shader_text(GLenum target, const char *text); >> GLboolean piglit_link_check_status(GLint prog); >> GLboolean piglit_link_check_status_quiet(GLint prog); >> -- >> 2.1.3 >> >> ___ >> Piglit mailing list >> Piglit@lists.freedesktop.org >> http://lists.freedesktop.org/mailman/listinfo/piglit pgpGzP6lwEGWR.pgp Description: PGP signature ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH 01/23] util/shader: Define "nothrow" variant of piglit_compile_shader_text().
Hi Matt, Matt Turner writes: > On Sat, Jan 31, 2015 at 7:41 AM, Francisco Jerez > wrote: >> Define a variant of piglit_compile_shader_text() that doesn't call >> piglit_report_result() on failure killing the program, which is quite >> annoying for tests that expect a compilation to fail and for tests >> that are structured in a number of subtests, because a single sub-test >> failing to compile a shader will prevent the remaining tests from >> running. > > Do we want this function because we expect certain compilations to > fail (and if so, why are we trying to compile them?) or just for ease > of developing a large containing many subtests? > This series only uses it for the second reason, i.e. to avoid killing the program when a shader compilation fails so it can go on and run the remaining subtests. But I can imagine it could also be useful someday for the first reason. > I looked at its use in 3/23 and wasn't sure of the answer. pgpbAeTumlIcn.pgp Description: PGP signature ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH 01/23] util/shader: Define "nothrow" variant of piglit_compile_shader_text().
On 2015-01-31 11:45:59, Francisco Jerez wrote: > Jordan Justen writes: > > > On 2015-01-31 07:41:23, Francisco Jerez wrote: > >> Define a variant of piglit_compile_shader_text() that doesn't call > >> piglit_report_result() on failure killing the program, which is quite > >> annoying for tests that expect a compilation to fail and for tests > >> that are structured in a number of subtests, because a single sub-test > >> failing to compile a shader will prevent the remaining tests from > >> running. > >> > >> I guess this would ideally be the default behavior of > >> piglit_compile_shader_text(), but with >300 callers in tree it seems > >> rather difficult to change at this stage. > > > > sed? > > > > Maybe piglit_compile_shader_text => piglit_require_compile_shader_text? > > > I personally don't care enough to make such a change affecting hundreds > of other tests that wouldn't have the slightest chance of being reviewed > before it no longer applies cleanly. I would support the change though > if you feel like doing it. > > >> --- > >> tests/util/piglit-shader.c | 20 ++-- > >> tests/util/piglit-shader.h | 1 + > >> 2 files changed, 19 insertions(+), 2 deletions(-) > >> > >> diff --git a/tests/util/piglit-shader.c b/tests/util/piglit-shader.c > >> index e8fe9c4..37cc7cc 100644 > >> --- a/tests/util/piglit-shader.c > >> +++ b/tests/util/piglit-shader.c > >> @@ -122,7 +122,7 @@ shader_name(GLenum target) > >> * Convenience function to compile a GLSL shader. > >> */ > >> GLuint > >> -piglit_compile_shader_text(GLenum target, const char *text) > >> +piglit_compile_shader_text_nothrow(GLenum target, const char *text) > >> { > >> GLuint prog; > >> GLint ok; > >> @@ -149,7 +149,8 @@ piglit_compile_shader_text(GLenum target, const char > >> *text) > >> info); > >> > >> fprintf(stderr, "source:\n%s", text); > > > > Do you think piglit_compile_shader_text_nothrow should be silent if > > the shader fails to compile? > > > > Maybe move the fprintf's as well? > > > > As the main motivation for this function is to avoid killing the program > when a shader compilation fails, I think the fprintf() is fine and > useful to find out what is going on when something fails. But we could > make it dependent on a parameter or factor it out to a separate function > if you like. Okay. Let's go ahead with this for now. Reviewed-by: Jordan Justen > > > >> - piglit_report_result(PIGLIT_FAIL); > >> + glDeleteShader(prog); > >> + prog = 0; > >> } > >> else if (0) { > >> /* Enable this to get extra compilation info. > >> @@ -164,6 +165,21 @@ piglit_compile_shader_text(GLenum target, const char > >> *text) > >> return prog; > >> } > >> > >> +/** > >> + * Convenience function to compile a GLSL shader. Throws PIGLIT_FAIL > >> + * on error terminating the program. > >> + */ > >> +GLuint > >> +piglit_compile_shader_text(GLenum target, const char *text) > >> +{ > >> +GLuint shader = piglit_compile_shader_text_nothrow(target, text); > >> + > >> +if (!shader) > >> +piglit_report_result(PIGLIT_FAIL); > >> + > >> +return shader; > >> +} > >> + > >> static GLboolean > >> link_check_status(GLint prog, FILE *output) > >> { > >> diff --git a/tests/util/piglit-shader.h b/tests/util/piglit-shader.h > >> index e2eef03..9208451 100644 > >> --- a/tests/util/piglit-shader.h > >> +++ b/tests/util/piglit-shader.h > >> @@ -31,6 +31,7 @@ > >> void piglit_get_glsl_version(bool *es, int* major, int* minor); > >> > >> GLuint piglit_compile_shader(GLenum target, const char *filename); > >> +GLuint piglit_compile_shader_text_nothrow(GLenum target, const char > >> *text); > >> GLuint piglit_compile_shader_text(GLenum target, const char *text); > >> GLboolean piglit_link_check_status(GLint prog); > >> GLboolean piglit_link_check_status_quiet(GLint prog); > >> -- > >> 2.1.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