[Piglit] [PATCH 1/8] GL3.2 GL_ARB_sync: Test to check the correct error messages are returned for invalid inputs for ClientWaitSync
v2: Fix comments, initialize variables, rewrite loop through all bit masks v3: Remove redundant code, minor fixes, and add to all.tests --- tests/all.tests | 1 + tests/spec/arb_sync/CMakeLists.gl.txt | 1 + tests/spec/arb_sync/ClientWaitSync-errors.c | 96 + 3 files changed, 98 insertions(+) create mode 100644 tests/spec/arb_sync/ClientWaitSync-errors.c diff --git a/tests/all.tests b/tests/all.tests index c45f1cb..4aa77f4 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -1099,6 +1099,7 @@ import_glsl_parser_tests(spec['ARB_shader_stencil_export'], # Group ARB_sync arb_sync = Group() spec['ARB_sync'] = arb_sync +arb_sync['ClientWaitSync-errors'] = concurrent_test('arb_sync-ClientWaitSync-errors') arb_sync['repeat-wait'] = concurrent_test('arb_sync-repeat-wait') arb_sync['timeout-zero'] = concurrent_test('arb_sync-timeout-zero') add_plain_test(arb_sync, 'sync_api') diff --git a/tests/spec/arb_sync/CMakeLists.gl.txt b/tests/spec/arb_sync/CMakeLists.gl.txt index dd4cf35..05f0972 100644 --- a/tests/spec/arb_sync/CMakeLists.gl.txt +++ b/tests/spec/arb_sync/CMakeLists.gl.txt @@ -12,3 +12,4 @@ link_libraries ( piglit_add_executable (arb_sync-repeat-wait repeat-wait.c) piglit_add_executable (arb_sync-timeout-zero timeout-zero.c) +piglit_add_executable (arb_sync-ClientWaitSync-errors ClientWaitSync-errors.c) diff --git a/tests/spec/arb_sync/ClientWaitSync-errors.c b/tests/spec/arb_sync/ClientWaitSync-errors.c new file mode 100644 index 000..2f75fbf --- /dev/null +++ b/tests/spec/arb_sync/ClientWaitSync-errors.c @@ -0,0 +1,96 @@ +/** + * Copyright © 2013 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 + * Test ClientWaitSync() returns correct error messages for invalid input + * + * + * Section 5.2.1(Waiting for Sync Objects) of OpenGL 3.2 Core says: + * If sync is not the name of a sync object, an INVALID_VALUE error + * is generated. If flags contains any bits other than + * SYNC_FLUSH_COMMANDS_BIT, an INVALID_VALUE error is generated. + * + */ + +#include piglit-util-gl-common.h + +PIGLIT_GL_TEST_CONFIG_BEGIN + +config.supports_gl_compat_version = 10; +config.supports_gl_core_version = 31; + +PIGLIT_GL_TEST_CONFIG_END + +enum piglit_result +piglit_display(void) +{ + /* UNREACHED */ + return PIGLIT_FAIL; +} + +void +piglit_init(int argc, char **argv) +{ + bool pass = true; + GLsync a = (GLsync)0xDEADBEEF; + GLenum status; + int i; + + if (piglit_get_gl_version() 32) { + piglit_require_extension(GL_ARB_sync); + } + + /* sync not set up yet so this should fail with both GL error and +* respond GL_WAIT_FAILED +*/ + status = glClientWaitSync(a, GL_SYNC_FLUSH_COMMANDS_BIT, 0); + pass = piglit_check_gl_error(GL_INVALID_VALUE) pass; + if (status != GL_WAIT_FAILED) { + printf(Expected GL_WAIT_FAILED but returned: %s\n, + piglit_get_gl_enum_name(status)); + pass = false; + } + + a = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); + + /* test that valid sync results in NO_ERROR */ + status = glClientWaitSync(a, GL_SYNC_FLUSH_COMMANDS_BIT, 0); + pass = piglit_check_gl_error(GL_NO_ERROR) pass; + + /* test that invalid flag value results in INVALID_VALUE */ + for (i = 0; i sizeof(GLbitfield) * 8; i++) { + GLbitfield mask = 1 i; + /* Skip over the valid bit */ + if (mask == GL_SYNC_FLUSH_COMMANDS_BIT) { + continue; + } + status = glClientWaitSync(a, mask, 0); + if(status != GL_WAIT_FAILED) pass = false; + pass = piglit_check_gl_error(GL_INVALID_VALUE) pass; + } + + glDeleteSync(a); + +
[Piglit] [PATCH 2/8] GL3.2 GL_ARB_sync: Test for valid return values from ClientWaitSync
v2: Fix comments, initialize variables. Still need to figure out if GPU commands needed before testing these. v3: Rewrite test cases, fix comment and config block and add to all.tests --- tests/all.tests | 1 + tests/spec/arb_sync/CMakeLists.gl.txt| 3 +- tests/spec/arb_sync/ClientWaitSync-returns.c | 195 +++ 3 files changed, 198 insertions(+), 1 deletion(-) create mode 100644 tests/spec/arb_sync/ClientWaitSync-returns.c diff --git a/tests/all.tests b/tests/all.tests index 4aa77f4..0118cc9 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -1100,6 +1100,7 @@ import_glsl_parser_tests(spec['ARB_shader_stencil_export'], arb_sync = Group() spec['ARB_sync'] = arb_sync arb_sync['ClientWaitSync-errors'] = concurrent_test('arb_sync-ClientWaitSync-errors') +arb_sync['ClientWaitSync-returns'] = concurrent_test('arb_sync-ClientWaitSync-returns') arb_sync['repeat-wait'] = concurrent_test('arb_sync-repeat-wait') arb_sync['timeout-zero'] = concurrent_test('arb_sync-timeout-zero') add_plain_test(arb_sync, 'sync_api') diff --git a/tests/spec/arb_sync/CMakeLists.gl.txt b/tests/spec/arb_sync/CMakeLists.gl.txt index 05f0972..ff8ca85 100644 --- a/tests/spec/arb_sync/CMakeLists.gl.txt +++ b/tests/spec/arb_sync/CMakeLists.gl.txt @@ -10,6 +10,7 @@ link_libraries ( ${OPENGL_glu_LIBRARY} ) +piglit_add_executable (arb_sync-client-wait-errors ClientWaitSync-errors.c) +piglit_add_executable (arb_sync-client-wait-returns ClientWaitSync-returns.c) piglit_add_executable (arb_sync-repeat-wait repeat-wait.c) piglit_add_executable (arb_sync-timeout-zero timeout-zero.c) -piglit_add_executable (arb_sync-ClientWaitSync-errors ClientWaitSync-errors.c) diff --git a/tests/spec/arb_sync/ClientWaitSync-returns.c b/tests/spec/arb_sync/ClientWaitSync-returns.c new file mode 100644 index 000..e801e04 --- /dev/null +++ b/tests/spec/arb_sync/ClientWaitSync-returns.c @@ -0,0 +1,195 @@ +/** + * Copyright © 2013 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 + * Test ClientWaitSync() returns correct values + * + * + * Section 5.2.1(Waiting for Sync Objects) of OpenGL 3.2 Core says: + * ClientWaitSync returns one of four status values. A return value of + * ALREADY_SIGNALED indicates that sync was signaled at the time + * ClientWaitSync was called. ALREADY_SIGNALED will always be + * returned if sync was signaled, even if the value of timeout is + * zero. A return value of TIMEOUT_EXPIRED indicates that the + * specified timeout period expired before sync was signaled. A re- + * turn value of CONDITION_SATISFIED indicates that sync was signaled + * before the timeout expired. Finally, if an error occurs, in + * addition to generating a GL error as specified below, + * ClientWaitSync immediately returns WAIT_FAILED withoutblocking. + * + */ + +#include piglit-util-gl-common.h + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 10; + config.supports_gl_core_version = 31; + +PIGLIT_GL_TEST_CONFIG_END + +enum piglit_result +piglit_display(void) +{ + /* UNREACHED */ + return PIGLIT_FAIL; +} + +/* One second in nanoseconds */ +#define ONE_SECOND 10 + +void +piglit_init(int argc, char **argv) +{ + bool pass = true; + GLsync fence1, fence2, fence3; + GLenum status1, status2, status3; + /* requires Posix clock API + timespec startTime, endTime; + int timeStatus = -1, seconds_elapsed = -1; + */ + + if (piglit_get_gl_version() 32) { + piglit_require_extension(GL_ARB_sync); + } + + /* Test Case 1: Verify that fence times out correctly after set time */ + + /* queue a draw command */ + piglit_draw_rect(-1, -1, 2, 2); + + /* create fence sync */ + fence1 =
[Piglit] [PATCH 6/8] GL3.2 GL_ARB_sync: Test that IsSync returns true/false if it is given a valid/invalid sync object name
v2: Fix comments, initialize variables v3: Minor fixes and added to all.tests --- tests/all.tests | 1 + tests/spec/arb_sync/CMakeLists.gl.txt | 1 + tests/spec/arb_sync/IsSync.c | 83 +++ 3 files changed, 85 insertions(+) create mode 100644 tests/spec/arb_sync/IsSync.c diff --git a/tests/all.tests b/tests/all.tests index ee2c8df..a842790 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -1104,6 +1104,7 @@ arb_sync['ClientWaitSync-returns'] = concurrent_test('arb_sync-ClientWaitSync-re arb_sync['DeleteSync'] = concurrent_test('arb_sync-DeleteSync') arb_sync['FenceSync-errors'] = concurrent_test('arb_sync-FenceSync-errors') arb_sync['GetSynciv-errors'] = concurrent_test('arb_sync-GetSynciv-errors') +arb_sync['IsSync'] = concurrent_test('arb_sync-IsSync') arb_sync['repeat-wait'] = concurrent_test('arb_sync-repeat-wait') arb_sync['timeout-zero'] = concurrent_test('arb_sync-timeout-zero') add_plain_test(arb_sync, 'sync_api') diff --git a/tests/spec/arb_sync/CMakeLists.gl.txt b/tests/spec/arb_sync/CMakeLists.gl.txt index b6840e1..038e0e1 100644 --- a/tests/spec/arb_sync/CMakeLists.gl.txt +++ b/tests/spec/arb_sync/CMakeLists.gl.txt @@ -15,5 +15,6 @@ piglit_add_executable (arb_sync-client-wait-returns ClientWaitSync-returns.c) piglit_add_executable (arb_sync-delete-sync DeleteSync.c) piglit_add_executable (arb_sync-fence-errors FenceSync-errors.c) piglit_add_executable (arb_sync-get-sync-errors GetSynciv-errors.c) +piglit_add_executable (arb_sync-is-sync IsSync.c) piglit_add_executable (arb_sync-repeat-wait repeat-wait.c) piglit_add_executable (arb_sync-timeout-zero timeout-zero.c) diff --git a/tests/spec/arb_sync/IsSync.c b/tests/spec/arb_sync/IsSync.c new file mode 100644 index 000..1191d76 --- /dev/null +++ b/tests/spec/arb_sync/IsSync.c @@ -0,0 +1,83 @@ +/** + * Copyright © 2013 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 + * Test IsSync() + * + * Section 6.1.7(Sync Object Queries) of OpenGL 3.2 Core says: + * The command + * boolean IsSync( sync sync ); + * returns TRUE if sync is the name of a sync object. If sync is not the + * name of a sync object, or if an error condition occurs, IsSync returns + * FALSE (note that zero is not the name of a sync object). + * + */ + +#include piglit-util-gl-common.h + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 10; + config.supports_gl_core_version = 31; + +PIGLIT_GL_TEST_CONFIG_END + +enum piglit_result +piglit_display(void) +{ + /* UNREACHED */ + return PIGLIT_FAIL; +} + +void +piglit_init(int argc, char **argv) +{ + bool pass = true; + GLsync valid_sync; + GLsync invalid_sync = (GLsync)GL_BACK; + + if (piglit_get_gl_version() 32) { + piglit_require_extension(GL_ARB_sync); + } + + /* Create valid sync object */ + valid_sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); + + /* Check if a valid name returns true */ + pass = glIsSync(valid_sync) pass; + + /* Check if invalid names return false +* From the GL 3.2 Core specification: +* If sync is not the name of a sync object, or if an error +* condition occurs, IsSync returns FALSE (note that zero is not +* the name of a sync object). +*/ + pass = !glIsSync(invalid_sync) pass; + + pass = !glIsSync(0) pass; + + glDeleteSync(valid_sync); + + piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); +} -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 4/8] GL3.2 GL_ARB_sync: Test for the correct error messages caused by invalid input to FenceSync
v2: Fix comments, remove unnecessary tests. v3: Added to all.tests Reviewed-by: Chad Versace chad.vers...@linux.intel.com --- tests/all.tests| 1 + tests/spec/arb_sync/CMakeLists.gl.txt | 1 + tests/spec/arb_sync/FenceSync-errors.c | 72 ++ 3 files changed, 74 insertions(+) create mode 100644 tests/spec/arb_sync/FenceSync-errors.c diff --git a/tests/all.tests b/tests/all.tests index 1572088..d6fb319 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -1102,6 +1102,7 @@ spec['ARB_sync'] = arb_sync arb_sync['ClientWaitSync-errors'] = concurrent_test('arb_sync-ClientWaitSync-errors') arb_sync['ClientWaitSync-returns'] = concurrent_test('arb_sync-ClientWaitSync-returns') arb_sync['DeleteSync'] = concurrent_test('arb_sync-DeleteSync') +arb_sync['FenceSync-errors'] = concurrent_test('arb_sync-FenceSync-errors') arb_sync['repeat-wait'] = concurrent_test('arb_sync-repeat-wait') arb_sync['timeout-zero'] = concurrent_test('arb_sync-timeout-zero') add_plain_test(arb_sync, 'sync_api') diff --git a/tests/spec/arb_sync/CMakeLists.gl.txt b/tests/spec/arb_sync/CMakeLists.gl.txt index 54637eb..bbeab54 100644 --- a/tests/spec/arb_sync/CMakeLists.gl.txt +++ b/tests/spec/arb_sync/CMakeLists.gl.txt @@ -13,5 +13,6 @@ link_libraries ( piglit_add_executable (arb_sync-client-wait-errors ClientWaitSync-errors.c) piglit_add_executable (arb_sync-client-wait-returns ClientWaitSync-returns.c) piglit_add_executable (arb_sync-delete-sync DeleteSync.c) +piglit_add_executable (arb_sync-fence-errors FenceSync-errors.c) piglit_add_executable (arb_sync-repeat-wait repeat-wait.c) piglit_add_executable (arb_sync-timeout-zero timeout-zero.c) diff --git a/tests/spec/arb_sync/FenceSync-errors.c b/tests/spec/arb_sync/FenceSync-errors.c new file mode 100644 index 000..ec33017 --- /dev/null +++ b/tests/spec/arb_sync/FenceSync-errors.c @@ -0,0 +1,72 @@ +/** + * Copyright © 2013 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 + * Test FenceSync() returns correct error messages for invalid input + * + * Section 5.2(Sync Objects and Fences) of OpenGL 3.2 Core says: + * An INVALID_ENUM error is generated if condition is not + * SYNC_GPU_COMMANDS_COMPLETE. If flags is not zero, an INVALID_VALUE + * error is generated. + * + */ + +#include piglit-util-gl-common.h + +PIGLIT_GL_TEST_CONFIG_BEGIN + +config.supports_gl_compat_version = 10; +config.supports_gl_core_version = 31; + +PIGLIT_GL_TEST_CONFIG_END + +enum piglit_result +piglit_display(void) +{ + /* UNREACHED */ + return PIGLIT_FAIL; +} + +void +piglit_init(int argc, char **argv) +{ + bool pass = true; + GLsync a, b; + + if (piglit_get_gl_version() 32) { + piglit_require_extension(GL_ARB_sync); + } + + /* test that an invalid condition results in INVALID_ENUM */ + a = glFenceSync(GL_NONE, 0); + pass = piglit_check_gl_error(GL_INVALID_ENUM) pass; + glDeleteSync(a); + + /* test that invalid flag value results in INVALID_VALUE */ + b = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 1); + pass = piglit_check_gl_error(GL_INVALID_VALUE) pass; + glDeleteSync(b); + + piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); +} -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 5/8] GL3.2 GL_ARB_sync: Test that GetSynciv sets correct error codes.
v2: Fix comments, initialize variables v3: Minor fixes and add to all.tests --- tests/all.tests| 1 + tests/spec/arb_sync/CMakeLists.gl.txt | 1 + tests/spec/arb_sync/GetSynciv-errors.c | 91 ++ 3 files changed, 93 insertions(+) create mode 100644 tests/spec/arb_sync/GetSynciv-errors.c diff --git a/tests/all.tests b/tests/all.tests index d6fb319..ee2c8df 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -1103,6 +1103,7 @@ arb_sync['ClientWaitSync-errors'] = concurrent_test('arb_sync-ClientWaitSync-err arb_sync['ClientWaitSync-returns'] = concurrent_test('arb_sync-ClientWaitSync-returns') arb_sync['DeleteSync'] = concurrent_test('arb_sync-DeleteSync') arb_sync['FenceSync-errors'] = concurrent_test('arb_sync-FenceSync-errors') +arb_sync['GetSynciv-errors'] = concurrent_test('arb_sync-GetSynciv-errors') arb_sync['repeat-wait'] = concurrent_test('arb_sync-repeat-wait') arb_sync['timeout-zero'] = concurrent_test('arb_sync-timeout-zero') add_plain_test(arb_sync, 'sync_api') diff --git a/tests/spec/arb_sync/CMakeLists.gl.txt b/tests/spec/arb_sync/CMakeLists.gl.txt index bbeab54..b6840e1 100644 --- a/tests/spec/arb_sync/CMakeLists.gl.txt +++ b/tests/spec/arb_sync/CMakeLists.gl.txt @@ -14,5 +14,6 @@ piglit_add_executable (arb_sync-client-wait-errors ClientWaitSync-errors.c) piglit_add_executable (arb_sync-client-wait-returns ClientWaitSync-returns.c) piglit_add_executable (arb_sync-delete-sync DeleteSync.c) piglit_add_executable (arb_sync-fence-errors FenceSync-errors.c) +piglit_add_executable (arb_sync-get-sync-errors GetSynciv-errors.c) piglit_add_executable (arb_sync-repeat-wait repeat-wait.c) piglit_add_executable (arb_sync-timeout-zero timeout-zero.c) diff --git a/tests/spec/arb_sync/GetSynciv-errors.c b/tests/spec/arb_sync/GetSynciv-errors.c new file mode 100644 index 000..472c05e --- /dev/null +++ b/tests/spec/arb_sync/GetSynciv-errors.c @@ -0,0 +1,91 @@ +/** + * Copyright © 2013 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 + * Test GetSynciv() sets correct error codes + * + * Section 6.1.7(Sync Object Queries) of OpenGL 3.2 Core says: + * (For GetSynciv) If sync is not the name of a sync object, an INVALID_VALUE + * error is generated. If pname is not one of the values described above, an + * INVALID_ENUM error is generated. + * + */ + +#include piglit-util-gl-common.h + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 10; + config.supports_gl_core_version = 31; + +PIGLIT_GL_TEST_CONFIG_END + +enum piglit_result +piglit_display(void) +{ + /* UNREACHED */ + return PIGLIT_FAIL; +} + +void +piglit_init(int argc, char **argv) +{ + bool pass = true; + GLsync valid_fence; + GLsync invalid_fence = (GLsync) 0x1373; + + GLsizei len; + GLint val; + + if (piglit_get_gl_version() 32) { + piglit_require_extension(GL_ARB_sync); + } + + valid_fence = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); + + /* test that invalid sync results in INVALID_VALUE */ + glGetSynciv(invalid_fence, GL_SYNC_STATUS, 1, len, val); + pass = piglit_check_gl_error(GL_INVALID_VALUE) pass; + + /* test valid pname values result in NO_ERROR */ + glGetSynciv(valid_fence, GL_OBJECT_TYPE, 1, len, val); + pass = piglit_check_gl_error(GL_NO_ERROR) pass; + + glGetSynciv(valid_fence, GL_SYNC_STATUS, 1, len, val); + pass = piglit_check_gl_error(GL_NO_ERROR) pass; + + glGetSynciv(valid_fence, GL_SYNC_CONDITION, 1, len, val); + pass = piglit_check_gl_error(GL_NO_ERROR) pass; + + glGetSynciv(valid_fence, GL_SYNC_FLAGS, 1, len, val); + pass = piglit_check_gl_error(GL_NO_ERROR) pass; + + /* test that invalid pname results in INVALID_ENUM */ + glGetSynciv(valid_fence,
[Piglit] [PATCH 3/8] GL3.2 GL_ARB_sync: Basic test for DeleteSync
v2: Fix comments, add test for passing invalid sync to IsSync(), change variable types. v3: Minor fixes and add to all.tests --- tests/all.tests | 1 + tests/spec/arb_sync/CMakeLists.gl.txt | 1 + tests/spec/arb_sync/DeleteSync.c | 78 +++ 3 files changed, 80 insertions(+) create mode 100644 tests/spec/arb_sync/DeleteSync.c diff --git a/tests/all.tests b/tests/all.tests index 0118cc9..1572088 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -1101,6 +1101,7 @@ arb_sync = Group() spec['ARB_sync'] = arb_sync arb_sync['ClientWaitSync-errors'] = concurrent_test('arb_sync-ClientWaitSync-errors') arb_sync['ClientWaitSync-returns'] = concurrent_test('arb_sync-ClientWaitSync-returns') +arb_sync['DeleteSync'] = concurrent_test('arb_sync-DeleteSync') arb_sync['repeat-wait'] = concurrent_test('arb_sync-repeat-wait') arb_sync['timeout-zero'] = concurrent_test('arb_sync-timeout-zero') add_plain_test(arb_sync, 'sync_api') diff --git a/tests/spec/arb_sync/CMakeLists.gl.txt b/tests/spec/arb_sync/CMakeLists.gl.txt index ff8ca85..54637eb 100644 --- a/tests/spec/arb_sync/CMakeLists.gl.txt +++ b/tests/spec/arb_sync/CMakeLists.gl.txt @@ -12,5 +12,6 @@ link_libraries ( piglit_add_executable (arb_sync-client-wait-errors ClientWaitSync-errors.c) piglit_add_executable (arb_sync-client-wait-returns ClientWaitSync-returns.c) +piglit_add_executable (arb_sync-delete-sync DeleteSync.c) piglit_add_executable (arb_sync-repeat-wait repeat-wait.c) piglit_add_executable (arb_sync-timeout-zero timeout-zero.c) diff --git a/tests/spec/arb_sync/DeleteSync.c b/tests/spec/arb_sync/DeleteSync.c new file mode 100644 index 000..7e4be41 --- /dev/null +++ b/tests/spec/arb_sync/DeleteSync.c @@ -0,0 +1,78 @@ +/** + * Copyright © 2013 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 + * Test DeleteSync() returns correct error messages + * + * Section 5.2(Sync Objects and Fences) on p243 of OpenGL 3.2 Core says: + * DeleteSync will silently ignore a sync value of zero. An INVALID_VALUE + * error is generated if sync is neither zero nor the name of a sync object. + * + */ + +#include piglit-util-gl-common.h + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 10; + config.supports_gl_core_version = 31; + +PIGLIT_GL_TEST_CONFIG_END + +enum piglit_result +piglit_display(void) +{ + /* UNREACHED */ + return PIGLIT_FAIL; +} + +void +piglit_init(int argc, char **argv) +{ + bool pass = true; + GLsync sync; + GLsync invalid = (GLsync) GL_FRONT; + + if (piglit_get_gl_version() 32) { + piglit_require_extension(GL_ARB_sync); + } + + /* Test for successful function calls +* DeleteSync will silently ignore a sync value of zero +*/ + glDeleteSync(0); + pass = piglit_check_gl_error(GL_NO_ERROR) pass; + + sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); + glDeleteSync(sync); + pass = piglit_check_gl_error(GL_NO_ERROR) pass; + /* Check if sync was deleted */ + pass = !glIsSync(sync) pass; + + /* Test for unsuccessful function calls */ + glDeleteSync(invalid); + pass = piglit_check_gl_error(GL_INVALID_VALUE) pass; + + piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); +} -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 7/8] GL3.2 GL_ARB_sync: Test that a sync object is initialized with the correct properties
v2: Fix comments, add extra checks for length variable being modified v3: Start some rendering to insure initialized values and add to all.tests --- tests/all.tests | 1 + tests/spec/arb_sync/CMakeLists.gl.txt | 1 + tests/spec/arb_sync/sync-initialize.c | 134 ++ 3 files changed, 136 insertions(+) create mode 100644 tests/spec/arb_sync/sync-initialize.c diff --git a/tests/all.tests b/tests/all.tests index a842790..e56ae38 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -1106,6 +1106,7 @@ arb_sync['FenceSync-errors'] = concurrent_test('arb_sync-FenceSync-errors') arb_sync['GetSynciv-errors'] = concurrent_test('arb_sync-GetSynciv-errors') arb_sync['IsSync'] = concurrent_test('arb_sync-IsSync') arb_sync['repeat-wait'] = concurrent_test('arb_sync-repeat-wait') +arb_sync['sync-initialize'] = concurrent_test('arb_sync-sync-initialize') arb_sync['timeout-zero'] = concurrent_test('arb_sync-timeout-zero') add_plain_test(arb_sync, 'sync_api') diff --git a/tests/spec/arb_sync/CMakeLists.gl.txt b/tests/spec/arb_sync/CMakeLists.gl.txt index 038e0e1..9855d69 100644 --- a/tests/spec/arb_sync/CMakeLists.gl.txt +++ b/tests/spec/arb_sync/CMakeLists.gl.txt @@ -17,4 +17,5 @@ piglit_add_executable (arb_sync-fence-errors FenceSync-errors.c) piglit_add_executable (arb_sync-get-sync-errors GetSynciv-errors.c) piglit_add_executable (arb_sync-is-sync IsSync.c) piglit_add_executable (arb_sync-repeat-wait repeat-wait.c) +piglit_add_executable (arb_sync-sync-initialize sync-initialize.c) piglit_add_executable (arb_sync-timeout-zero timeout-zero.c) diff --git a/tests/spec/arb_sync/sync-initialize.c b/tests/spec/arb_sync/sync-initialize.c new file mode 100644 index 000..706db02 --- /dev/null +++ b/tests/spec/arb_sync/sync-initialize.c @@ -0,0 +1,134 @@ +/** + * Copyright © 2013 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 + * Test that a sync is initialized correctly with FenceSync + * + * Section 5.2(Sync Objects and Fences) of OpenGL 3.2 Core says: + * Table 5.1: Initial properties of a sync object created with FenceSync. + * + * Property Name Property Value + * -- + * OBJECT_TYPESYNC_FENCE + * SYNC_CONDITION condition + * SYNC_STATUSUNSIGNALED + * SYNC_FLAGS flags + * + */ + +#include piglit-util-gl-common.h + +PIGLIT_GL_TEST_CONFIG_BEGIN + +config.supports_gl_compat_version = 10; +config.supports_gl_core_version = 31; + +PIGLIT_GL_TEST_CONFIG_END + +enum piglit_result +piglit_display(void) +{ + /* UNREACHED */ + return PIGLIT_FAIL; +} + +void +piglit_init(int argc, char **argv) +{ + bool pass = true; + GLsizei length = -5; + GLint value; + GLsync sync; + + if (piglit_get_gl_version() 32) { + piglit_require_extension(GL_ARB_sync); + } + + /* Start some rendering that will not end before this test finishes +* in order to make sure the fence sync is still set to initial values +*/ + piglit_draw_rect(-1, -1, 2, 2); + + /* Create a new fence sync */ + sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); + + /* Test initialized as fence type */ + glGetSynciv(sync, GL_OBJECT_TYPE, 1, length, value); + if(length != 1) { + printf(length should be 1 but incorrectly returned: %d\n, + length); + pass = false; + } + if(value != GL_SYNC_FENCE) { + printf(Expected GL_SYNC_FENCE but returned: %s\n, + piglit_get_gl_enum_name(value)); + pass = false; + } + + /* Test initialized to given condition */ + length = -5; + glGetSynciv(sync, GL_SYNC_CONDITION, 1, length, value); + if(length != 1) { +
Re: [Piglit] [PATCH 4/5] arb_texture_query_levels: add compiler tests for textureQueryLevels()
On 10/04/2013 09:08 PM, Chris Forbes wrote: diff --git a/tests/spec/arb_texture_query_levels/compiler/builtin-functions-float-samplers.frag b/tests/spec/arb_texture_query_levels/compiler/builtin-functions-float-samplers.frag new file mode 100644 index 000..d6a19ba --- /dev/null +++ b/tests/spec/arb_texture_query_levels/compiler/builtin-functions-float-samplers.frag @@ -0,0 +1,46 @@ +// [config] +// expect_result: pass +// glsl_version: 1.30 +// require_extensions: GL_ARB_texture_query_levels GL_ARB_texture_cube_map_array +// [end config] + +#version 130 +#extension GL_ARB_texture_query_levels: require +#extension GL_ARB_texture_cube_map_array: require Does all the hardware that supports one also support the other? If not, then we should split the GL_ARB_texture_cube_map_array tests out into separate .frag and .vert files. Also, we should all .geom versions for 1.50. :) That should just be a sed job. ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 8/8] GL3.2 GL_ARB_sync: Test that the correct error messages are returned from invalid input for WaitSync
v2: Fix comments, remove redundant code v3: Add to all.tests --- tests/all.tests | 1 + tests/spec/arb_sync/CMakeLists.gl.txt | 1 + tests/spec/arb_sync/WaitSync-errors.c | 82 +++ 3 files changed, 84 insertions(+) create mode 100644 tests/spec/arb_sync/WaitSync-errors.c diff --git a/tests/all.tests b/tests/all.tests index e56ae38..f4c0079 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -1108,6 +1108,7 @@ arb_sync['IsSync'] = concurrent_test('arb_sync-IsSync') arb_sync['repeat-wait'] = concurrent_test('arb_sync-repeat-wait') arb_sync['sync-initialize'] = concurrent_test('arb_sync-sync-initialize') arb_sync['timeout-zero'] = concurrent_test('arb_sync-timeout-zero') +arb_sync['WaitSync-errors'] = concurrent_test('arb_sync-WaitSync-errors') add_plain_test(arb_sync, 'sync_api') # Group ARB_ES2_compatibility diff --git a/tests/spec/arb_sync/CMakeLists.gl.txt b/tests/spec/arb_sync/CMakeLists.gl.txt index 9855d69..5385fa0 100644 --- a/tests/spec/arb_sync/CMakeLists.gl.txt +++ b/tests/spec/arb_sync/CMakeLists.gl.txt @@ -19,3 +19,4 @@ piglit_add_executable (arb_sync-is-sync IsSync.c) piglit_add_executable (arb_sync-repeat-wait repeat-wait.c) piglit_add_executable (arb_sync-sync-initialize sync-initialize.c) piglit_add_executable (arb_sync-timeout-zero timeout-zero.c) +piglit_add_executable (arb_sync-WaitSync-errors WaitSync-errors.c) diff --git a/tests/spec/arb_sync/WaitSync-errors.c b/tests/spec/arb_sync/WaitSync-errors.c new file mode 100644 index 000..a6f9976 --- /dev/null +++ b/tests/spec/arb_sync/WaitSync-errors.c @@ -0,0 +1,82 @@ +/** + * Copyright © 2013 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. + */ + +/** + * Test WaitSync() returns correct error codes + * + * Section 5.2.1(Waiting for Sync Objects) of OpenGL 3.2 Core says: + * If sync is not the name of a sync object, an INVALID_VALUE error is + * generated. If timeout is not TIMEOUT_IGNORED or flags is not zero, an + * INVALID_VALUE error is generated. + * + */ + +#include piglit-util-gl-common.h + +PIGLIT_GL_TEST_CONFIG_BEGIN + +config.supports_gl_compat_version = 10; +config.supports_gl_core_version = 31; + +PIGLIT_GL_TEST_CONFIG_END + +enum piglit_result +piglit_display(void) +{ + /* UNREACHED */ + return PIGLIT_FAIL; +} + +void +piglit_init(int argc, char **argv) +{ + bool pass = true; + GLsync a; + GLsync b = (GLsync)20; + + if (piglit_get_gl_version() 32) { + piglit_require_extension(GL_ARB_sync); + } + + a = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); + + /* test that valid parameters passed results in NO_ERROR */ + glWaitSync(a, 0, GL_TIMEOUT_IGNORED); + pass = piglit_check_gl_error(GL_NO_ERROR) pass; + + /* test that invalid sync results in INVALID_VALUE */ + glWaitSync(b, 0, GL_TIMEOUT_IGNORED); + pass = piglit_check_gl_error(GL_INVALID_VALUE) pass; + + /* test that invalid flag value results in INVALID_VALUE */ + glWaitSync(a, 3, GL_TIMEOUT_IGNORED); + pass = piglit_check_gl_error(GL_INVALID_VALUE) pass; + + /* test that invalid timeout value results in INVALID_VALUE */ + glWaitSync(a, 0, 15); + pass = piglit_check_gl_error(GL_INVALID_VALUE) pass; + + glDeleteSync(a); + + piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); +} -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH V9] KHR_debug: test ObjectLabel(), GetObjectLabel(), ObjectPtrLabel() and GetObjectPtrLabel()
I've pushed the test now. I made some trivial fixes on the way: whitespace consistency, but also fixing duplication of the extension name in the summary results. Thanks for all your work on this! diff --git a/tests1 /all.tests b/tests/all.tests index 3e5e1a3..cec532a 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -1319,7 +1319,7 @@ add_plain_test(arb_debug_output, 'arb_debug_output-api_error') # Group KHR_debug khr_debug = Group() spec['KHR_debug'] = khr_debug -add_plain_test(khr_debug, 'khr_debug-object-label') +khr_debug['object-label'] = concurrent_test('khr_debug-object-label') # Group ARB_occlusion_query2 arb_occlusion_query2 = Group() diff --git a/tests/spec/khr_debug/debug-object-label.c b/tests/spec/khr_debug/debug-object-label.c index 6905619..2fabebd 100644 --- a/tests/spec/khr_debug/debug-object-label.c +++ b/tests/spec/khr_debug/debug-object-label.c @@ -73,7 +73,7 @@ test_object_ptr_label() if (!piglit_check_gl_error(GL_INVALID_VALUE)) { fprintf(stderr, GL_INVALID_VALUE should be generated when ObjectPtrLabel() -ptr is not the name of a sync object\n); +ptr is not the name of a sync object\n); pass = false; } @@ -282,7 +282,7 @@ test_object_label() GLchar label[TestLabelLen + 1]; GLchar *bigLabel; bool pass = true; -int maximumLabelLengthTest = 1024; /* Be defensive about the size label length test to avoid memory issues */ + int maximumLabelLengthTest = 1024; /* Be defensive about the size label length test to avoid memory issues */ puts(Test ObjectLabel); @@ -320,7 +320,7 @@ test_object_label() } else { printf(MAX_LABEL_LENGTH test skipped as implementations MAX_LABEL_LENGTH=%i and max piglit test length=%i\n, - maxLabelLength, maximumLabelLengthTest); + maxLabelLength, maximumLabelLengthTest); } /* If label is NULL, any debug label is effectively removed from the object. pgpD3ES6VwnFW.pgp Description: PGP signature ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH 5/5] arb_texture_query_levels: add execution tests
On 10/04/2013 10:04 PM, Matt Turner wrote: On Fri, Oct 4, 2013 at 9:08 PM, Chris Forbes chr...@ijw.co.nz wrote: Ensure that the returned level count is correct in various situations. Signed-off-by: Chris Forbes chr...@ijw.co.nz --- .../execution/fs-baselevel.shader_test | 40 +++ .../execution/fs-maxlevel.shader_test | 40 +++ .../execution/fs-miptree.shader_test | 39 +++ .../execution/fs-nomips.shader_test| 39 +++ .../execution/vs-baselevel.shader_test | 44 + .../execution/vs-maxlevel.shader_test | 45 ++ .../execution/vs-miptree.shader_test | 43 + .../execution/vs-nomips.shader_test| 43 + 8 files changed, 333 insertions(+) create mode 100644 tests/spec/arb_texture_query_levels/execution/fs-baselevel.shader_test create mode 100644 tests/spec/arb_texture_query_levels/execution/fs-maxlevel.shader_test create mode 100644 tests/spec/arb_texture_query_levels/execution/fs-miptree.shader_test create mode 100644 tests/spec/arb_texture_query_levels/execution/fs-nomips.shader_test create mode 100644 tests/spec/arb_texture_query_levels/execution/vs-baselevel.shader_test create mode 100644 tests/spec/arb_texture_query_levels/execution/vs-maxlevel.shader_test create mode 100644 tests/spec/arb_texture_query_levels/execution/vs-miptree.shader_test create mode 100644 tests/spec/arb_texture_query_levels/execution/vs-nomips.shader_test diff --git a/tests/spec/arb_texture_query_levels/execution/fs-baselevel.shader_test b/tests/spec/arb_texture_query_levels/execution/fs-baselevel.shader_test new file mode 100644 index 000..0dfee0c --- /dev/null +++ b/tests/spec/arb_texture_query_levels/execution/fs-baselevel.shader_test @@ -0,0 +1,40 @@ +[require] +GLSL = 1.30 +GL_ARB_texture_query_levels + +[vertex shader] +in vec4 vertex; + +void main() { +gl_Position = vertex; +} Use [vertex shader passthrough] instead? +1 I guess we don't have any tests for 3D, cube, or shadow textures because shader runner doesn't support them? I'm kind of iffy about whether it's worth having execution tests for them too. I think I'd rather see a geometry shader test than tests for other sampler types. Regardless, the series is Reviewed-by: Matt Turner matts...@gmail.com ___ 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 1/4] util: Add utility function to accumulate results of subtests
Ian Romanick i...@freedesktop.org writes: From: Ian Romanick ian.d.roman...@intel.com This looks a lot like piglit_merge_result. pgpcE5xiQ7TU_.pgp Description: PGP signature ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH 1/4] util: Add utility function to accumulate results of subtests
On 10/07/2013 09:02 AM, Eric Anholt wrote: Ian Romanick i...@freedesktop.org writes: From: Ian Romanick ian.d.roman...@intel.com This looks a lot like piglit_merge_result. Agreed. Let's re-use piglit_merge_result(). ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH 2/4] util: Add common framework for command-line invoked subtests
On 10/04/2013 06:10 PM, Ian Romanick wrote: From: Ian Romanick ian.d.roman...@intel.com There are two parts to this. First, command line options of the form -subtest foo have their argument (the foo part) stored in a list in the piglit_gl_test_config. Tests can use this functionality without having to use any of the other parts. This allows every piglit test to have the same syntax for specifying which subtests to run. Second, tests can create a list of piglit_gl_subtest structures. Each structure describes a single subtest: the name (as it will apear in the log), the command-line name (as supplied to -subtest), and the function that implements the test. Helper function use this table and the list of tests specified by -subtest options to run a group of tests. The next patch shows an example of using this functionality. Signed-off-by: Ian Romanick ian.d.roman...@intel.com --- tests/util/piglit-framework-gl.c | 96 ++-- tests/util/piglit-framework-gl.h | 36 ++- 2 files changed, 127 insertions(+), 5 deletions(-) diff --git a/tests/util/piglit-framework-gl.c b/tests/util/piglit-framework-gl.c index 2a315be..975c1a9 100644 --- a/tests/util/piglit-framework-gl.c +++ b/tests/util/piglit-framework-gl.c @@ -40,7 +40,8 @@ int piglit_width; int piglit_height; static void -process_args(int *argc, char *argv[], unsigned *force_samples); +process_args(int *argc, char *argv[], unsigned *force_samples, +struct piglit_gl_test_config *config); void piglit_gl_test_config_init(int *argc, char *argv[], @@ -50,7 +51,7 @@ piglit_gl_test_config_init(int *argc, char *argv[], memset(config, 0, sizeof(*config)); - process_args(argc, argv, force_samples); + process_args(argc, argv, force_samples, config); if (force_samples 1) config-window_samples = force_samples; @@ -72,7 +73,8 @@ delete_arg(char *argv[], int argc, int arg) * length is returned in @a argc. */ static void -process_args(int *argc, char *argv[], unsigned *force_samples) +process_args(int *argc, char *argv[], unsigned *force_samples, +struct piglit_gl_test_config *config) { int j; @@ -120,6 +122,33 @@ process_args(int *argc, char *argv[], unsigned *force_samples) *force_samples = atoi(argv[j]+9); delete_arg(argv, *argc, j--); *argc -= 1; + } else if (!strcmp(argv[j], -subtest)) { + int i; + + j++; + if (j = *argc) { + fprintf(stderr, + -subtest requires an argument\n); + piglit_report_result(PIGLIT_FAIL); + } + + config-selected_subtests = + realloc(config-selected_subtests, + sizeof(char *) + * (config-num_selected_subtests + 1)); + config-selected_subtests[config-num_selected_subtests] = + argv[j]; + + config-num_selected_subtests++; + + /* Remove 2 arguments (hence the 'i - 2') from the +* command line. +*/ + for (i = j + 1; i *argc; i++) { + argv[i - 2] = argv[i]; + } + *argc -= 2; + j -= 2; } } } @@ -219,3 +248,64 @@ piglit_destroy_dma_buf(struct piglit_dma_buf *buf) if (gl_fw-destroy_dma_buf) gl_fw-destroy_dma_buf(buf); } + +const struct piglit_gl_subtest * +piglit_find_subtest(const struct piglit_gl_subtest *subtests, const char *name) +{ + unsigned i; + + for (i = 0; subtests[i].subtest != NULL; i++) { + if (strcmp(subtests[i].option, name) == 0) + return subtests[i]; + } + + return NULL; +} + +enum piglit_result +piglit_run_selected_subtests(const struct piglit_gl_subtest *all_subtests, +const char **selected_subtests, +size_t num_selected_subtests, +enum piglit_result previous_result) +{ + enum piglit_result result = previous_result; + + if (num_selected_subtests) { + unsigned i; + + for (i = 0; i num_selected_subtests; i++) { + enum piglit_result subtest_result; + const char *const name = selected_subtests[i]; + const struct piglit_gl_subtest *subtest = + piglit_find_subtest(all_subtests, name); + + if (subtest == NULL) { + fprintf(stderr, +
Re: [Piglit] [PATCH 3/4] util: Add a -list-subtests option that will list all the subtests
On 10/04/2013 06:11 PM, Ian Romanick wrote: From: Ian Romanick ian.d.roman...@intel.com This required some ugly hacking about to get the list of subtests to process_args. Suggestions? Let's avoid these ugly hacks. Here's my suggestion, which covers patches 2 and 3. Patch 2/4 moves `struct piglit_gl_test_config config` out of main() to file scope. Let's avoid making things global; that leads to a slippery slope. I fought hard to kill many of Piglit's globals, and I don't welcome the arrival of new ones. If at all possible, let's leave it in main() where it is. To leave 'config' in main(), we need to restructure a few things. First, piglit_gl_test_config_init() should no longer parse args; instead, it should only memset 'config' to 0. That is, let's change its signature from void piglit_gl_test_config_init(int *argc, char *argv[], struct piglit_gl_test_config *config) to void piglit_gl_test_config_init(struct piglit_gl_test_config *config) Move the argparsing (that is, the call to process_args()) into piglit_gl_test_run(). That will ensure that args are parsed *after* the test author has set all config variables in the CONFIG block. The CONFIG block in your patch 4/4 should now look like this: PIGLIT_GL_TEST_CONFIG_BEGIN config.subtests = subtests; config.supports_gl_compat_version = 10; config.window_visual = PIGLIT_GL_VISUAL_RGB; PIGLIT_GL_TEST_CONFIG_END The config is no longer defined with file-scope, so piglit_init() should execute subtests like this: result = piglit_run_subtests(PIGLIT_SKIP); piglit_run_selected_subtests() should access `config-subtests` through the global test context object, piglit-framework-gl.c:`struct piglit_gl_framework *gl_fw`, like this: enum piglit_result piglit_run_selected_subtests(enum piglit_result previous_result) { enum piglit_result result = previous_result; const struct piglit_gl_subtest *subtests gl_fw-config-subtests; const char **selected_subtests = gl_fw-config-selected_subtests; ... } At this point, it's no longer necessary for the subtests array to be global, so you could even do the below if you wanted, but that's really up to personal taste. PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10; config.window_visual = PIGLIT_GL_VISUAL_RGB; config.subtests = { { Cannot delete while active, delete-inactive-only, delete_inactive_only }, ..., }; PIGLIT_GL_TEST_CONFIG_END ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] GLSL: Test that input layout qualifiers cannot be used on variable declarations
On 20 September 2013 12:31, Nicholas Mack nichm...@gmail.com wrote: --- ...-layout-qualifiers-with-variable-declarations.geom | 19 +++ ...-layout-qualifiers-with-variable-declarations.geom | 19 +++ 2 files changed, 38 insertions(+) create mode 100644 tests/spec/glsl-1.50/compiler/incorrect-in-layout-qualifiers-with-variable-declarations.geom create mode 100644 tests/spec/glsl-1.50/compiler/incorrect-out-layout-qualifiers-with-variable-declarations.geom diff --git a/tests/spec/glsl-1.50/compiler/incorrect-in-layout-qualifiers-with-variable-declarations.geom b/tests/spec/glsl-1.50/compiler/incorrect-in-layout-qualifiers-with-variable-declarations.geom new file mode 100644 index 000..f26b60d --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/incorrect-in-layout-qualifiers-with-variable-declarations.geom @@ -0,0 +1,19 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// check_link: true This needs to be check_link: false. Otherwise the test will erroneously pass due to lacking the necessary input/output layout qualifiers. A similar change needs to be made to incorrect-out-layout-qualifiers-with-variable-declarations.geom. With that change, this patch is: Reviewed-by: Paul Berry stereotype...@gmail.com +// [end config] +// +// Tests that input layout qualifiers cannot be used on a variable declaration. +// +// GLSLangSpec 1.50, section 4.3.8.2 (Output Layout Qualifiers): +// Geometry shaders allow input layout qualifiers only on the interface +// qualifier in, not on an input block,block member, or variable. + +#version 150 + +layout(points) in float c[]; + +void main() +{ +} diff --git a/tests/spec/glsl-1.50/compiler/incorrect-out-layout-qualifiers-with-variable-declarations.geom b/tests/spec/glsl-1.50/compiler/incorrect-out-layout-qualifiers-with-variable-declarations.geom new file mode 100644 index 000..161de1c --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/incorrect-out-layout-qualifiers-with-variable-declarations.geom @@ -0,0 +1,19 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// check_link: true +// [end config] +// +// Tests that output layout qualifiers cannot be used on a variable declaration. +// +// GLSLangSpec 1.50, section 4.3.8.2 (Output Layout Qualifiers): +// Geometry shaders can have output layout qualifiers only on the interface +// qualifier out, not on an output block or variable declaration. + +#version 150 + +layout(points) out float c; + +void main() +{ +} -- 1.8.3.1 ___ 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 3/4] util: Add a -list-subtests option that will list all the subtests
On 10/07/2013 11:02 AM, Chad Versace wrote: On 10/04/2013 06:11 PM, Ian Romanick wrote: From: Ian Romanick ian.d.roman...@intel.com This required some ugly hacking about to get the list of subtests to process_args. Suggestions? Let's avoid these ugly hacks. Here's my suggestion, which covers patches 2 and 3. My troll bait worked. :) Patch 2/4 moves `struct piglit_gl_test_config config` out of main() to file scope. Let's avoid making things global; that leads to a slippery slope. I fought hard to kill many of Piglit's globals, and I don't welcome the arrival of new ones. If at all possible, let's leave it in main() where it is. To leave 'config' in main(), we need to restructure a few things. First, piglit_gl_test_config_init() should no longer parse args; instead, it should only memset 'config' to 0. That is, let's change its signature from void piglit_gl_test_config_init(int *argc, char *argv[], struct piglit_gl_test_config *config) to void piglit_gl_test_config_init(struct piglit_gl_test_config *config) Move the argparsing (that is, the call to process_args()) into piglit_gl_test_run(). That will ensure that args are parsed *after* the test author has set all config variables in the CONFIG block. The CONFIG block in your patch 4/4 should now look like this: PIGLIT_GL_TEST_CONFIG_BEGIN config.subtests = subtests; config.supports_gl_compat_version = 10; config.window_visual = PIGLIT_GL_VISUAL_RGB; PIGLIT_GL_TEST_CONFIG_END I like this. This is the way I originally wanted to structure things, but there were issues. The config is no longer defined with file-scope, so piglit_init() should execute subtests like this: result = piglit_run_subtests(PIGLIT_SKIP); piglit_run_selected_subtests() should access `config-subtests` through the global test context object, piglit-framework-gl.c:`struct piglit_gl_framework *gl_fw`, like this: enum piglit_result piglit_run_selected_subtests(enum piglit_result previous_result) { enum piglit_result result = previous_result; const struct piglit_gl_subtest *subtests gl_fw-config-subtests; const char **selected_subtests = gl_fw-config-selected_subtests; ... } I have somewhat mixed feelings about this... I liked that the old piglit_run_selected_subtests was both more primitive (flexible) and more explicit. This is the birth of this tool, and I'm not sure how the next user will want to use it. Hmm... A third option is an accessor that lets the test get config or maybe just the list of selected tests from the implicit test context object. At this point, it's no longer necessary for the subtests array to be global, so you could even do the below if you wanted, but that's really up to personal taste. PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10; config.window_visual = PIGLIT_GL_VISUAL_RGB; config.subtests = { { Cannot delete while active, delete-inactive-only, delete_inactive_only }, ..., }; PIGLIT_GL_TEST_CONFIG_END I think that's C99 syntax, so we probably can't use it in piglit. ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] shaders: add test for bool casting of large integers.
From: Dave Airlie airl...@redhat.com I noticed the TGSI convertor just does INEG then AND 0x3f80, which works for small values, but fails for larger ints. This seems to fail on nvidia (4.3.0 NVIDIA 325.15) and on ironlake with mesa 9.2. Signed-off-by: Dave Airlie airl...@redhat.com --- tests/shaders/glsl-fs-i2b-large-int.shader_test | 32 + 1 file changed, 32 insertions(+) create mode 100644 tests/shaders/glsl-fs-i2b-large-int.shader_test diff --git a/tests/shaders/glsl-fs-i2b-large-int.shader_test b/tests/shaders/glsl-fs-i2b-large-int.shader_test new file mode 100644 index 000..96369da --- /dev/null +++ b/tests/shaders/glsl-fs-i2b-large-int.shader_test @@ -0,0 +1,32 @@ +# validate a bug in the TGSI conversion where it just did AND (float)1.0 +# but for large integers this would fail, we should clamp to 1 first +# looks like nobody passes this from my first pass testing. + +[require] +GLSL = 1.30 + +[vertex shader] +void main() +{ + gl_Position = gl_Vertex; +} + +[fragment shader] +#version 130 + +uniform int arg0; +uniform int arg1; + +void main() +{ + bool t = bool(arg0); + bool f = bool(arg1); + + gl_FragColor = vec4(1.0 - float(t), float(t) / 2.0, float(f), 1.0 - float(f)); +} + +[test] +uniform int arg0 0x0ff1 +uniform int arg1 0 +draw rect -1 -1 2 2 +probe all rgba 0.0 0.5 0.0 1.0 -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH 3/4] util: Add a -list-subtests option that will list all the subtests
On 10/07/2013 04:19 PM, Ian Romanick wrote: On 10/07/2013 11:02 AM, Chad Versace wrote: On 10/04/2013 06:11 PM, Ian Romanick wrote: From: Ian Romanick ian.d.roman...@intel.com This required some ugly hacking about to get the list of subtests to process_args. Suggestions? Let's avoid these ugly hacks. Here's my suggestion, which covers patches 2 and 3. My troll bait worked. :) Damn... you caught me... Patch 2/4 moves `struct piglit_gl_test_config config` out of main() to file scope. Let's avoid making things global; that leads to a slippery slope. I fought hard to kill many of Piglit's globals, and I don't welcome the arrival of new ones. If at all possible, let's leave it in main() where it is. To leave 'config' in main(), we need to restructure a few things. First, piglit_gl_test_config_init() should no longer parse args; instead, it should only memset 'config' to 0. That is, let's change its signature from void piglit_gl_test_config_init(int *argc, char *argv[], struct piglit_gl_test_config *config) to void piglit_gl_test_config_init(struct piglit_gl_test_config *config) Move the argparsing (that is, the call to process_args()) into piglit_gl_test_run(). That will ensure that args are parsed *after* the test author has set all config variables in the CONFIG block. The CONFIG block in your patch 4/4 should now look like this: PIGLIT_GL_TEST_CONFIG_BEGIN config.subtests = subtests; config.supports_gl_compat_version = 10; config.window_visual = PIGLIT_GL_VISUAL_RGB; PIGLIT_GL_TEST_CONFIG_END I like this. This is the way I originally wanted to structure things, but there were issues. The config is no longer defined with file-scope, so piglit_init() should execute subtests like this: result = piglit_run_subtests(PIGLIT_SKIP); piglit_run_selected_subtests() should access `config-subtests` through the global test context object, piglit-framework-gl.c:`struct piglit_gl_framework *gl_fw`, like this: enum piglit_result piglit_run_selected_subtests(enum piglit_result previous_result) { enum piglit_result result = previous_result; const struct piglit_gl_subtest *subtests gl_fw-config-subtests; const char **selected_subtests = gl_fw-config-selected_subtests; ... } I have somewhat mixed feelings about this... I liked that the old piglit_run_selected_subtests was both more primitive (flexible) and more explicit. This is the birth of this tool, and I'm not sure how the next user will want to use it. Hmm... A third option is an accessor that lets the test get config or maybe just the list of selected tests from the implicit test context object. Introducing an accessor for the config makes sense to me. At this point, it's no longer necessary for the subtests array to be global, so you could even do the below if you wanted, but that's really up to personal taste. PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10; config.window_visual = PIGLIT_GL_VISUAL_RGB; config.subtests = { { Cannot delete while active, delete-inactive-only, delete_inactive_only }, ..., }; PIGLIT_GL_TEST_CONFIG_END I think that's C99 syntax, so we probably can't use it in piglit. Argh, that's not valid syntax anywhere. You can only initialize an array like above at the point of variable declaration. However, such initialization is legal in C89. ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] textureSize: Initialize sample_count to 1.
On 23 September 2013 20:46, Kenneth Graunke kenn...@whitecape.org wrote: The multisampling tests initialize the number of miplevels to the number of samples. Since this is zero, we allocate an array of zero miplevels, and then try to write to the first element. Fixes the following Valgrind error: Invalid write of size 8 at 0x403123: compute_miplevel_info (common.c:163) by 0x402B9B: piglit_init (textureSize.c:455) by 0x4EA6B89: run_test (piglit_fbo_framework.c:50) by 0x4EA4BEE: piglit_gl_test_run (piglit-framework-gl.c:141) by 0x401FC7: main (textureSize.c:68) Address 0xa04d040 is 0 bytes after a block of size 0 alloc'd at 0x4C2757B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x40310A: compute_miplevel_info (common.c:161) by 0x402B9B: piglit_init (textureSize.c:455) by 0x4EA6B89: run_test (piglit_fbo_framework.c:50) by 0x4EA4BEE: piglit_gl_test_run (piglit-framework-gl.c:141) by 0x401FC7: main (textureSize.c:68) Signed-off-by: Kenneth Graunke kenn...@whitecape.org Cc: Chris Forbes chr...@ijw.co.nz --- tests/texturing/shaders/textureSize.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/texturing/shaders/textureSize.c b/tests/texturing/shaders/textureSize.c index f010d9c..85a11d3 100644 --- a/tests/texturing/shaders/textureSize.c +++ b/tests/texturing/shaders/textureSize.c @@ -432,6 +432,8 @@ piglit_init(int argc, char **argv) int prog; int tex_location; + sample_count = 1; + require_GL_features(test_stage); if (sampler.target == GL_TEXTURE_CUBE_MAP_ARRAY) It looks like the textureSize test creates its textures using common.c's upload_miplevel_data(), which always passes a sample count of 4 to glTexImage{2,3}DMultisample(). Would it be better to set sample_count to 4 to match this? In addition, maybe we should change upload_miplevel_data() so that it passes sample_count to glTexImage{2,3}DMultisample() rather than hardcoding a sample count of 4. ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH 1/2] GLSL 1.50: Test that version 140 and version 150 shaders can be linked together
On 27 September 2013 11:55, Nicholas Mack nichm...@gmail.com wrote: --- .../glsl-1.50/linker/versions-mingled.shader_test | 29 ++ 1 file changed, 29 insertions(+) create mode 100644 tests/spec/glsl-1.50/linker/versions-mingled.shader_test diff --git a/tests/spec/glsl-1.50/linker/versions-mingled.shader_test b/tests/spec/glsl-1.50/linker/versions-mingled.shader_test new file mode 100644 index 000..543a778 --- /dev/null +++ b/tests/spec/glsl-1.50/linker/versions-mingled.shader_test @@ -0,0 +1,29 @@ +# Tests that GLSL 1.40 and GLSL 1.50 shaders may be linked together +# +# GLSL 1.50 Spec, 3.3 (): Were you meaning to put something between the parentheses? (The section name, Preprocessor, perhaps?) The same comment applies to patch 2. With that fixed, the series is: Reviewed-by: Paul Berry stereotype...@gmail.com +# Shaders declaring version 1.40 of the shading language can be linked with +# shaders declaring version 1.50 in the same program. +[require] +GLSL = 1.50 + +[vertex shader] +#version 140 + +in vec4 a; + +void main() +{ + gl_Position = a; +} + +[fragment shader] +#version 150 + +void main() +{ + gl_FragColor = vec4(1.); +} + +[test] + + -- 1.8.3.1 ___ 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] GL 1.50: Test that UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER is accepted by GetActiveUniformBlockiv()
Nicholas Mack nichm...@gmail.com writes: v2: Incorporate this test into referenced-by-shader.c @@ -40,10 +41,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10; - config.window_width = 10; - config.window_height = 10; - config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE; - It looks like this won't ever get run on a 3.2 context on Mesa because you need at least config.supports_gl_core_version = 31. + bool use_gs = piglit_get_gl_version() = 32; + const char *header; + char *temp_source; + int num_uniforms_used = 0; + + if(use_gs) { There should always be a space between 'if' and '(' - for (i = 0; i 3; i++) { - GLint ref_vs, ref_fs; + if(use_gs) { + num_uniforms_used = 7; + printf(v g f\n); + } + else { Usually we cuddle the braces like } else { With the one functional fix and the little style nits fixed, this would be: Reviewed-by: Eric Anholt e...@anholt.net pgpHDw5ucWS4z.pgp Description: PGP signature ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 01/13] arb_shader_atomic_counters: Import common helper functions.
--- tests/all.tests| 3 + tests/spec/CMakeLists.txt | 1 + .../arb_shader_atomic_counters/CMakeLists.gl.txt | 13 + .../spec/arb_shader_atomic_counters/CMakeLists.txt | 1 + tests/spec/arb_shader_atomic_counters/common.c | 302 + tests/spec/arb_shader_atomic_counters/common.h | 90 ++ 6 files changed, 410 insertions(+) create mode 100644 tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt create mode 100644 tests/spec/arb_shader_atomic_counters/CMakeLists.txt create mode 100644 tests/spec/arb_shader_atomic_counters/common.c create mode 100644 tests/spec/arb_shader_atomic_counters/common.h diff --git a/tests/all.tests b/tests/all.tests index abe247e..e1907d6 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -3165,6 +3165,9 @@ add_shader_test_dir(spec, os.path.join(generatedTestDir, 'spec'), recursive=True) import_glsl_parser_tests(profile.tests, generatedTestDir, ['spec']) +arb_shader_atomic_counters = Group() +spec['ARB_shader_atomic_counters'] = arb_shader_atomic_counters + 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 18b846d..011fd63 100644 --- a/tests/spec/CMakeLists.txt +++ b/tests/spec/CMakeLists.txt @@ -24,6 +24,7 @@ add_subdirectory (amd_seamless_cubemap_per_texture) add_subdirectory (amd_vertex_shader_layer) add_subdirectory (arb_separate_shader_objects) add_subdirectory (arb_shader_texture_lod/execution) +add_subdirectory (arb_shader_atomic_counters) add_subdirectory (arb_shader_objects) add_subdirectory (arb_shading_language_420pack/execution) add_subdirectory (arb_sync) diff --git a/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt b/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt new file mode 100644 index 000..b204c02 --- /dev/null +++ b/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt @@ -0,0 +1,13 @@ +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} +) + +# vim: ft=cmake: diff --git a/tests/spec/arb_shader_atomic_counters/CMakeLists.txt b/tests/spec/arb_shader_atomic_counters/CMakeLists.txt new file mode 100644 index 000..144a306 --- /dev/null +++ b/tests/spec/arb_shader_atomic_counters/CMakeLists.txt @@ -0,0 +1 @@ +piglit_include_target_api() diff --git a/tests/spec/arb_shader_atomic_counters/common.c b/tests/spec/arb_shader_atomic_counters/common.c new file mode 100644 index 000..638d5af --- /dev/null +++ b/tests/spec/arb_shader_atomic_counters/common.c @@ -0,0 +1,302 @@ +/* + * Copyright © 2013 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_atomic_counters tests. + */ + +#include common.h + +bool +atomic_counters_probe_buffer(unsigned base, unsigned count, + const uint32_t *expected) +{ +uint32_t *p = glMapBufferRange( +GL_ATOMIC_COUNTER_BUFFER, base * sizeof(uint32_t), +count * sizeof(uint32_t), GL_MAP_READ_BIT); +unsigned i; + +if (!p) { +printf(Couldn't map atomic counter buffer for read-back.\n); +return false; +} + +for (i = 0; i count; ++i) { +if (p[i] != expected[i]) { +printf(Probe value at (%i)\n, i); +printf( Expected: 0x%08x\n, expected[i]); +printf( Observed: 0x%08x\n, p[i]); +glUnmapBuffer(GL_ATOMIC_COUNTER_BUFFER); +return false; +
[Piglit] [PATCH 00/13] Tests for the ARB_shader_atomic_counters_extension.
This patch series implements a bunch of tests for the ARB_shader_atomic_counters extension -- Patches adding support for it to the i965 driver have been around for a while on the mesa-dev mailing list, and they can also be found in my personal branch [1]. 54 of these tests pass using the i965 implementation on both Ivy Bridge and Haswell, 5 are skipped mainly due to the lack of support for tessellation and geometry shaders from mesa master, none of the tests fail on i965. I've pushed the whole series to my personal piglit repository to ease testing [2]. Thanks. [1] http://cgit.freedesktop.org/~currojerez/mesa/log/?h=atomic-counters [2] http://cgit.freedesktop.org/~currojerez/piglit/ [PATCH 01/13] arb_shader_atomic_counters: Import common helper functions. [PATCH 02/13] arb_shader_atomic_counters: Import GLSL parser tests. [PATCH 03/13] arb_shader_atomic_counters: Test the atomic counter query functions. [PATCH 04/13] arb_shader_atomic_counters: Test dynamic indexing of atomic counter arrays. [PATCH 05/13] arb_shader_atomic_counters: Test the buffer binding API functions. [PATCH 06/13] arb_shader_atomic_counters: Test that atomics aren't allocated from the default uniform block. [PATCH 07/13] arb_shader_atomic_counters: Test that atomic ops aren't executed for discarded fragments. [PATCH 08/13] arb_shader_atomic_counters: Test that atomic counters can be passed as function arguments. [PATCH 09/13] arb_shader_atomic_counters: Test the maximum number of supported counters, buffers and bindings. [PATCH 10/13] arb_shader_atomic_counters: Test the minimum maximum limits defined by the spec. [PATCH 11/13] arb_shader_atomic_counters: Test linkage of atomic counters with conflicting locations. [PATCH 12/13] arb_shader_atomic_counters: Test that atomic built-ins execute the expected operations on memory. [PATCH 13/13] arb_shader_atomic_counters: Test the atomicity of atomic built-in functions. ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 03/13] arb_shader_atomic_counters: Test the atomic counter query functions.
--- tests/all.tests| 1 + .../arb_shader_atomic_counters/CMakeLists.gl.txt | 2 + .../arb_shader_atomic_counters/active-counters.c | 411 + 3 files changed, 414 insertions(+) create mode 100644 tests/spec/arb_shader_atomic_counters/active-counters.c diff --git a/tests/all.tests b/tests/all.tests index 4c5f434..37a413c 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -3170,6 +3170,7 @@ spec['ARB_shader_atomic_counters'] = arb_shader_atomic_counters import_glsl_parser_tests(spec['ARB_shader_atomic_counters'], os.path.join(testsDir, 'spec', 'arb_shader_atomic_counters'), ['']) +arb_shader_atomic_counters['active-counters'] = concurrent_test('arb_shader_atomic_counters-active-counters') profile.tests['hiz'] = hiz profile.tests['fast_color_clear'] = fast_color_clear diff --git a/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt b/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt index b204c02..4249ff0 100644 --- a/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt +++ b/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt @@ -10,4 +10,6 @@ link_libraries ( ${OPENGL_glu_LIBRARY} ) +add_executable (arb_shader_atomic_counters-active-counters active-counters.c common.c) + # vim: ft=cmake: diff --git a/tests/spec/arb_shader_atomic_counters/active-counters.c b/tests/spec/arb_shader_atomic_counters/active-counters.c new file mode 100644 index 000..7f6ed1e --- /dev/null +++ b/tests/spec/arb_shader_atomic_counters/active-counters.c @@ -0,0 +1,411 @@ +/* + * Copyright © 2013 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 active-counters.c + * + * Compile a shader with a bunch of atomic counters and check that the + * active atomic counter and buffer query functions return sane + * results. + */ + +#include common.h + +#define L 1 + +PIGLIT_GL_TEST_CONFIG_BEGIN + +config.supports_gl_core_version = 31; + +config.window_width = L; +config.window_height = L; +config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA; + +PIGLIT_GL_TEST_CONFIG_END + +const char *fs_source = #version 140\n +#extension GL_ARB_shader_atomic_counters : enable\n +\n +out ivec4 fcolor;\n +\n +layout(binding=0) uniform atomic_uint x0[2];\n +layout(binding=0) uniform atomic_uint x1;\n +layout(binding=3, offset=8) uniform atomic_uint x2;\n +layout(binding=3, offset=12) uniform atomic_uint x3;\n +\n +layout(binding=7, binding=2, offset=4) uniform;\n +\n +layout(binding=2) uniform atomic_uint x4;\n +layout(binding=7, offset=8, offset=0) uniform atomic_uint x5;\n +layout(binding=3) uniform atomic_uint x6, x7;\n +\n +void main() {\n + fcolor.x = int(atomicCounter(x0[0]) + atomicCounter(x0[1])\n + + atomicCounter(x1) + atomicCounter(x2)\n + + atomicCounter(x3) + atomicCounter(x4)\n + + atomicCounter(x5) + atomicCounter(x6)\n + + atomicCounter(x7));\n +}\n; + +struct buffer_info { +unsigned num_counters; +unsigned min_reasonable_size; +}; + +static const struct buffer_info * +expected_buffer_info(unsigned binding) +{ +if (binding == 0) { +static const struct buffer_info info = { 2, 12 }; +return info; +} else if (binding == 2) { +static const struct buffer_info info = { 1, 4 }; +return info; +} else if (binding == 3) { +static const struct buffer_info info = { 4, 24 }; +return info; +} else if (binding == 7) { +static const struct
[Piglit] [PATCH 02/13] arb_shader_atomic_counters: Import GLSL parser tests.
--- tests/all.tests| 3 +++ .../compiler/builtins.frag | 24 ++ .../compiler/declaration-allowed.frag | 21 +++ .../compiler/declaration-arg-inout.frag| 21 +++ .../compiler/declaration-arg-out.frag | 21 +++ .../compiler/declaration-const.frag| 17 +++ .../compiler/declaration-initializer.frag | 16 +++ .../compiler/declaration-input.frag| 17 +++ .../compiler/declaration-local.frag| 17 +++ .../compiler/declaration-output.frag | 17 +++ .../compiler/expression-allowed.frag | 22 .../compiler/expression-disallowed-1.frag | 21 +++ .../compiler/expression-disallowed-2.frag | 21 +++ .../compiler/expression-disallowed-3.frag | 21 +++ .../compiler/expression-disallowed-4.frag | 21 +++ .../compiler/expression-disallowed-5.frag | 21 +++ .../compiler/expression-disallowed-6.frag | 21 +++ .../compiler/lvalue-1.frag | 17 +++ .../compiler/lvalue-2.frag | 17 +++ .../compiler/lvalue-3.frag | 18 .../compiler/uniform-block.frag| 18 .../preprocessor/define.frag | 19 + .../preprocessor/define.vert | 19 + 23 files changed, 430 insertions(+) create mode 100644 tests/spec/arb_shader_atomic_counters/compiler/builtins.frag create mode 100644 tests/spec/arb_shader_atomic_counters/compiler/declaration-allowed.frag create mode 100644 tests/spec/arb_shader_atomic_counters/compiler/declaration-arg-inout.frag create mode 100644 tests/spec/arb_shader_atomic_counters/compiler/declaration-arg-out.frag create mode 100644 tests/spec/arb_shader_atomic_counters/compiler/declaration-const.frag create mode 100644 tests/spec/arb_shader_atomic_counters/compiler/declaration-initializer.frag create mode 100644 tests/spec/arb_shader_atomic_counters/compiler/declaration-input.frag create mode 100644 tests/spec/arb_shader_atomic_counters/compiler/declaration-local.frag create mode 100644 tests/spec/arb_shader_atomic_counters/compiler/declaration-output.frag create mode 100644 tests/spec/arb_shader_atomic_counters/compiler/expression-allowed.frag create mode 100644 tests/spec/arb_shader_atomic_counters/compiler/expression-disallowed-1.frag create mode 100644 tests/spec/arb_shader_atomic_counters/compiler/expression-disallowed-2.frag create mode 100644 tests/spec/arb_shader_atomic_counters/compiler/expression-disallowed-3.frag create mode 100644 tests/spec/arb_shader_atomic_counters/compiler/expression-disallowed-4.frag create mode 100644 tests/spec/arb_shader_atomic_counters/compiler/expression-disallowed-5.frag create mode 100644 tests/spec/arb_shader_atomic_counters/compiler/expression-disallowed-6.frag create mode 100644 tests/spec/arb_shader_atomic_counters/compiler/lvalue-1.frag create mode 100644 tests/spec/arb_shader_atomic_counters/compiler/lvalue-2.frag create mode 100644 tests/spec/arb_shader_atomic_counters/compiler/lvalue-3.frag create mode 100644 tests/spec/arb_shader_atomic_counters/compiler/uniform-block.frag create mode 100644 tests/spec/arb_shader_atomic_counters/preprocessor/define.frag create mode 100644 tests/spec/arb_shader_atomic_counters/preprocessor/define.vert diff --git a/tests/all.tests b/tests/all.tests index e1907d6..4c5f434 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -3167,6 +3167,9 @@ import_glsl_parser_tests(profile.tests, generatedTestDir, ['spec']) arb_shader_atomic_counters = Group() spec['ARB_shader_atomic_counters'] = arb_shader_atomic_counters +import_glsl_parser_tests(spec['ARB_shader_atomic_counters'], +os.path.join(testsDir, 'spec', 'arb_shader_atomic_counters'), +['']) profile.tests['hiz'] = hiz profile.tests['fast_color_clear'] = fast_color_clear diff --git a/tests/spec/arb_shader_atomic_counters/compiler/builtins.frag b/tests/spec/arb_shader_atomic_counters/compiler/builtins.frag new file mode 100644 index 000..74f97f7 --- /dev/null +++ b/tests/spec/arb_shader_atomic_counters/compiler/builtins.frag @@ -0,0 +1,24 @@ +/* [config] + * expect_result: pass + * glsl_version: 1.40 + * require_extensions: GL_ARB_shader_atomic_counters + * [end config] + * + * Check that the builtin constants defined by the extension + * are present. + */ +#version 140 +#extension GL_ARB_shader_atomic_counters: require + +out ivec4 fcolor; + +void main() +{ +fcolor.x = gl_MaxVertexAtomicCounters + +
[Piglit] [PATCH 04/13] arb_shader_atomic_counters: Test dynamic indexing of atomic counter arrays.
--- tests/all.tests| 1 + .../arb_shader_atomic_counters/CMakeLists.gl.txt | 1 + .../arb_shader_atomic_counters/array-indexing.c| 175 + 3 files changed, 177 insertions(+) create mode 100644 tests/spec/arb_shader_atomic_counters/array-indexing.c diff --git a/tests/all.tests b/tests/all.tests index 37a413c..b9ec52b 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -3171,6 +3171,7 @@ import_glsl_parser_tests(spec['ARB_shader_atomic_counters'], os.path.join(testsDir, 'spec', 'arb_shader_atomic_counters'), ['']) arb_shader_atomic_counters['active-counters'] = concurrent_test('arb_shader_atomic_counters-active-counters') +arb_shader_atomic_counters['array-indexing'] = concurrent_test('arb_shader_atomic_counters-array-indexing') profile.tests['hiz'] = hiz profile.tests['fast_color_clear'] = fast_color_clear diff --git a/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt b/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt index 4249ff0..83e38ec 100644 --- a/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt +++ b/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt @@ -11,5 +11,6 @@ link_libraries ( ) add_executable (arb_shader_atomic_counters-active-counters active-counters.c common.c) +add_executable (arb_shader_atomic_counters-array-indexing array-indexing.c common.c) # vim: ft=cmake: diff --git a/tests/spec/arb_shader_atomic_counters/array-indexing.c b/tests/spec/arb_shader_atomic_counters/array-indexing.c new file mode 100644 index 000..be9e252 --- /dev/null +++ b/tests/spec/arb_shader_atomic_counters/array-indexing.c @@ -0,0 +1,175 @@ +/* + * Copyright © 2013 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 array-indexing.c + * + * Check that dynamically uniform indexing of an atomic counter array + * works as expected. + */ + +#include common.h + +#define L 1 + +PIGLIT_GL_TEST_CONFIG_BEGIN + +config.supports_gl_core_version = 31; + +config.window_width = L; +config.window_height = L; +config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA; + +PIGLIT_GL_TEST_CONFIG_END + +static bool +set_uniform_int(GLuint prog, const char *name, int value) +{ +int loc; + +glLinkProgram(prog); +glUseProgram(prog); + +loc = glGetUniformLocation(prog, name); +if (loc 0) +return false; + +glUniform1i(loc, value); + +return piglit_check_gl_error(GL_NO_ERROR); +} + +static bool +run_test_vertex(void) +{ +const char *fs_source = #version 140\n +flat in ivec4 vcolor;\n +out ivec4 fcolor;\n +void main() {\n + fcolor = vcolor;\n +}\n; +const char *vs_source = #version 140\n +#extension GL_ARB_shader_atomic_counters : enable\n +\n +layout(binding = 0, offset = 4) uniform atomic_uint x[3];\n +in vec4 position;\n +flat out ivec4 vcolor;\n +uniform int index;\n +\n +void main() {\n + vcolor.x = int(atomicCounterIncrement(x[1 + index]));\n + vcolor.y = int(atomicCounterIncrement(x[0 + index]));\n + vcolor.z = int(atomicCounterIncrement(x[1 + index]));\n + vcolor.w = int(atomicCounterIncrement(x[0 + index]));\n + gl_Position = position;\n +}\n; +const unsigned int start[] = { 1, 2, 4, 8 }; +const unsigned int expected[] = { 8, 4, 9, 5 }; +GLuint prog = glCreateProgram(); +bool ret = +atomic_counters_compile(prog, GL_FRAGMENT_SHADER, fs_source) +
[Piglit] [PATCH 06/13] arb_shader_atomic_counters: Test that atomics aren't allocated from the default uniform block.
--- tests/all.tests| 1 + .../arb_shader_atomic_counters/CMakeLists.gl.txt | 1 + .../arb_shader_atomic_counters/default-partition.c | 122 + 3 files changed, 124 insertions(+) create mode 100644 tests/spec/arb_shader_atomic_counters/default-partition.c diff --git a/tests/all.tests b/tests/all.tests index 171f305..91d4e6f 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -3173,6 +3173,7 @@ import_glsl_parser_tests(spec['ARB_shader_atomic_counters'], arb_shader_atomic_counters['active-counters'] = concurrent_test('arb_shader_atomic_counters-active-counters') arb_shader_atomic_counters['array-indexing'] = concurrent_test('arb_shader_atomic_counters-array-indexing') arb_shader_atomic_counters['buffer-binding'] = concurrent_test('arb_shader_atomic_counters-buffer-binding') +arb_shader_atomic_counters['default-partition'] = concurrent_test('arb_shader_atomic_counters-default-partition') profile.tests['hiz'] = hiz profile.tests['fast_color_clear'] = fast_color_clear diff --git a/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt b/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt index 93dec7d..f9479de 100644 --- a/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt +++ b/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt @@ -13,5 +13,6 @@ link_libraries ( add_executable (arb_shader_atomic_counters-active-counters active-counters.c common.c) add_executable (arb_shader_atomic_counters-array-indexing array-indexing.c common.c) add_executable (arb_shader_atomic_counters-buffer-binding buffer-binding.c common.c) +add_executable (arb_shader_atomic_counters-default-partition default-partition.c common.c) # vim: ft=cmake: diff --git a/tests/spec/arb_shader_atomic_counters/default-partition.c b/tests/spec/arb_shader_atomic_counters/default-partition.c new file mode 100644 index 000..d0d26a2 --- /dev/null +++ b/tests/spec/arb_shader_atomic_counters/default-partition.c @@ -0,0 +1,122 @@ +/* + * Copyright © 2013 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 default-partition.c + * + * Test that the following is met: + * + * Unlike other user-defined uniforms declared at global scope, + * [atomic counters] take NO storage from the default partition, + * they have NO location [...] + * + * (from the ARB_shader_atomic_counters specification) + */ + +#include common.h + +#define L 1 + +PIGLIT_GL_TEST_CONFIG_BEGIN + +config.supports_gl_core_version = 31; + +config.window_width = L; +config.window_height = L; +config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA; + +PIGLIT_GL_TEST_CONFIG_END + +static bool +run_test(unsigned max_uniforms) +{ +const char *fs_template = #version 140\n +#extension GL_ARB_shader_atomic_counters : enable\n +\n +#define N %d\n +\n +out ivec4 fcolor;\n +layout(binding=0) uniform atomic_uint x;\n +uniform uint y[N];\n +\n +void main() {\n + int i;\n + uint z = atomicCounter(x);\n + \n + for (i = 0; i N; ++i)\n + z += y[i];\n + \n + fcolor.x = int(z);\n +}\n; +char *fs_source; +GLuint prog = glCreateProgram(); +int n = 0, ret; + +ret = asprintf(fs_source, fs_template, max_uniforms); +assert(ret 0); + +/* This should fail to link if 'x' ended up being accounted in + * the default uniform partition because 'y[]' uses up the + * whole available uniform space. */ +atomic_counters_compile(prog, GL_FRAGMENT_SHADER, fs_source); +
[Piglit] [PATCH 09/13] arb_shader_atomic_counters: Test the maximum number of supported counters, buffers and bindings.
--- tests/all.tests| 1 + .../arb_shader_atomic_counters/CMakeLists.gl.txt | 1 + .../spec/arb_shader_atomic_counters/max-counters.c | 434 + 3 files changed, 436 insertions(+) create mode 100644 tests/spec/arb_shader_atomic_counters/max-counters.c diff --git a/tests/all.tests b/tests/all.tests index 88656e5..7b264ff 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -3176,6 +3176,7 @@ arb_shader_atomic_counters['buffer-binding'] = concurrent_test('arb_shader_atomi arb_shader_atomic_counters['default-partition'] = concurrent_test('arb_shader_atomic_counters-default-partition') arb_shader_atomic_counters['fragment-discard'] = concurrent_test('arb_shader_atomic_counters-fragment-discard') arb_shader_atomic_counters['function-argument'] = concurrent_test('arb_shader_atomic_counters-function-argument') +arb_shader_atomic_counters['max-counters'] = concurrent_test('arb_shader_atomic_counters-max-counters') profile.tests['hiz'] = hiz profile.tests['fast_color_clear'] = fast_color_clear diff --git a/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt b/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt index f7c2c26..b473b3b 100644 --- a/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt +++ b/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt @@ -16,5 +16,6 @@ add_executable (arb_shader_atomic_counters-buffer-binding buffer-binding.c commo add_executable (arb_shader_atomic_counters-default-partition default-partition.c common.c) add_executable (arb_shader_atomic_counters-fragment-discard fragment-discard.c common.c) add_executable (arb_shader_atomic_counters-function-argument function-argument.c common.c) +add_executable (arb_shader_atomic_counters-max-counters max-counters.c common.c) # vim: ft=cmake: diff --git a/tests/spec/arb_shader_atomic_counters/max-counters.c b/tests/spec/arb_shader_atomic_counters/max-counters.c new file mode 100644 index 000..91157f6 --- /dev/null +++ b/tests/spec/arb_shader_atomic_counters/max-counters.c @@ -0,0 +1,434 @@ +/* + * Copyright © 2013 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-counters.c + * + * Test that using more than the maximum number of suported atomic + * counters, buffers or bindings fails with a linking error. + */ + +#include common.h + +#define L 1 + +PIGLIT_GL_TEST_CONFIG_BEGIN + +config.supports_gl_core_version = 31; + +config.window_width = L; +config.window_height = L; +config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA; + +PIGLIT_GL_TEST_CONFIG_END + +static bool +run_test_vertex_max_counters(unsigned num_counters) +{ +/* Generate a shader with 'num_counters' counters. */ +char *vs_source = atomic_counters_generate_source( +#version 140\n +#extension GL_ARB_shader_atomic_counters : enable\n +\n +%s\n +\n +in vec4 position;\n +flat out ivec4 vcolor;\n +\n +void main() {\n + uint y = 0u;\n + %s\n + vcolor.x = int(y);\n + gl_Position = position;\n +}\n, +layout(binding=0) uniform atomic_uint x%d;\n, + y += atomicCounterDecrement(x%d);\n, +num_counters); +GLuint prog = glCreateProgram(); +bool ret = atomic_counters_compile(prog, GL_VERTEX_SHADER, vs_source) +atomic_counters_link(prog); + +glDeleteProgram(prog); +free(vs_source); +return ret; +} + +static bool +run_test_fragment_max_counters(unsigned num_counters) +{ +/* Generate a shader with 'num_counters' counters. */ +char *fs_source =
[Piglit] [PATCH 08/13] arb_shader_atomic_counters: Test that atomic counters can be passed as function arguments.
--- tests/all.tests| 1 + .../arb_shader_atomic_counters/CMakeLists.gl.txt | 1 + .../arb_shader_atomic_counters/function-argument.c | 114 + 3 files changed, 116 insertions(+) create mode 100644 tests/spec/arb_shader_atomic_counters/function-argument.c diff --git a/tests/all.tests b/tests/all.tests index 4aba933..88656e5 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -3175,6 +3175,7 @@ arb_shader_atomic_counters['array-indexing'] = concurrent_test('arb_shader_atomi arb_shader_atomic_counters['buffer-binding'] = concurrent_test('arb_shader_atomic_counters-buffer-binding') arb_shader_atomic_counters['default-partition'] = concurrent_test('arb_shader_atomic_counters-default-partition') arb_shader_atomic_counters['fragment-discard'] = concurrent_test('arb_shader_atomic_counters-fragment-discard') +arb_shader_atomic_counters['function-argument'] = concurrent_test('arb_shader_atomic_counters-function-argument') profile.tests['hiz'] = hiz profile.tests['fast_color_clear'] = fast_color_clear diff --git a/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt b/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt index 5526fbf..f7c2c26 100644 --- a/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt +++ b/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt @@ -15,5 +15,6 @@ add_executable (arb_shader_atomic_counters-array-indexing array-indexing.c commo add_executable (arb_shader_atomic_counters-buffer-binding buffer-binding.c common.c) add_executable (arb_shader_atomic_counters-default-partition default-partition.c common.c) add_executable (arb_shader_atomic_counters-fragment-discard fragment-discard.c common.c) +add_executable (arb_shader_atomic_counters-function-argument function-argument.c common.c) # vim: ft=cmake: diff --git a/tests/spec/arb_shader_atomic_counters/function-argument.c b/tests/spec/arb_shader_atomic_counters/function-argument.c new file mode 100644 index 000..042c0e9 --- /dev/null +++ b/tests/spec/arb_shader_atomic_counters/function-argument.c @@ -0,0 +1,114 @@ +/* + * Copyright © 2013 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 function-argument.c + * + * Check that atomic operations work as expected on counters passed as + * function arguments. + */ + +#include common.h + +#define L 256 +#define N (L * L) + +PIGLIT_GL_TEST_CONFIG_BEGIN + +config.supports_gl_core_version = 31; + +config.window_width = L; +config.window_height = L; +config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA; + +PIGLIT_GL_TEST_CONFIG_END + +static bool +run_test(void) +{ +const char *fs_source = #version 140\n +#extension GL_ARB_shader_atomic_counters : enable\n +\n +layout(binding = 0, offset = 0) uniform atomic_uint x;\n +layout(binding = 0, offset = 4) uniform atomic_uint y;\n +out ivec4 fcolor;\n +\n +uint f(atomic_uint z) {\n + return atomicCounterIncrement(z); +}\n +\n +void main() {\n + fcolor.x = int(f(y));\n +}\n; +const char *vs_source = #version 140\n +in vec4 piglit_vertex;\n +\n +void main() {\n + gl_Position = piglit_vertex;\n +}\n; +const uint32_t start_value[] = { 0, 0 }; +const uint32_t expected_value[] = { 0, N }; +GLuint prog = glCreateProgram(); +bool ret = atomic_counters_compile(prog, GL_FRAGMENT_SHADER, fs_source) +atomic_counters_compile(prog, GL_VERTEX_SHADER, vs_source) +atomic_counters_draw_rect(prog, 2, start_value) +
[Piglit] [PATCH 10/13] arb_shader_atomic_counters: Test the minimum maximum limits defined by the spec.
--- tests/all.tests| 1 + .../arb_shader_atomic_counters/CMakeLists.gl.txt | 1 + tests/spec/arb_shader_atomic_counters/minmax.c | 71 ++ 3 files changed, 73 insertions(+) create mode 100644 tests/spec/arb_shader_atomic_counters/minmax.c diff --git a/tests/all.tests b/tests/all.tests index 7b264ff..4f4fccc 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -3177,6 +3177,7 @@ arb_shader_atomic_counters['default-partition'] = concurrent_test('arb_shader_at arb_shader_atomic_counters['fragment-discard'] = concurrent_test('arb_shader_atomic_counters-fragment-discard') arb_shader_atomic_counters['function-argument'] = concurrent_test('arb_shader_atomic_counters-function-argument') arb_shader_atomic_counters['max-counters'] = concurrent_test('arb_shader_atomic_counters-max-counters') +arb_shader_atomic_counters['minmax'] = concurrent_test('arb_shader_atomic_counters-minmax') profile.tests['hiz'] = hiz profile.tests['fast_color_clear'] = fast_color_clear diff --git a/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt b/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt index b473b3b..79f4975 100644 --- a/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt +++ b/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt @@ -17,5 +17,6 @@ add_executable (arb_shader_atomic_counters-default-partition default-partition.c add_executable (arb_shader_atomic_counters-fragment-discard fragment-discard.c common.c) add_executable (arb_shader_atomic_counters-function-argument function-argument.c common.c) add_executable (arb_shader_atomic_counters-max-counters max-counters.c common.c) +add_executable (arb_shader_atomic_counters-minmax minmax.c common.c) # vim: ft=cmake: diff --git a/tests/spec/arb_shader_atomic_counters/minmax.c b/tests/spec/arb_shader_atomic_counters/minmax.c new file mode 100644 index 000..b847847 --- /dev/null +++ b/tests/spec/arb_shader_atomic_counters/minmax.c @@ -0,0 +1,71 @@ +/* + * Copyright © 2013 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 for the minimum maximum values described in the + * ARB_shader_atomic_counters spec. + */ + +#include common.h +#include minmax-test.h + +#define L 1 + +PIGLIT_GL_TEST_CONFIG_BEGIN + +config.supports_gl_core_version = 31; +config.window_width = L; +config.window_height = L; +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) +{ +piglit_require_gl_version(31); +piglit_require_extension(GL_ARB_shader_atomic_counters); + +piglit_print_minmax_header(); + +piglit_test_min_int(GL_MAX_FRAGMENT_ATOMIC_COUNTERS, 8); +piglit_test_min_int(GL_MAX_COMBINED_ATOMIC_COUNTERS, 8); + +piglit_test_min_int(GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS, 1); +piglit_test_min_int(GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS, 1); +piglit_test_min_int(GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE, 32); + +piglit_test_min_int(GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS, 1); + +if (!piglit_check_gl_error(GL_NO_ERROR)) +piglit_report_result(PIGLIT_FAIL); + +piglit_report_result(piglit_minmax_pass ? PIGLIT_PASS : PIGLIT_FAIL); +} -- 1.8.3.4 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 05/13] arb_shader_atomic_counters: Test the buffer binding API functions.
--- tests/all.tests| 1 + .../arb_shader_atomic_counters/CMakeLists.gl.txt | 1 + .../arb_shader_atomic_counters/buffer-binding.c| 159 + 3 files changed, 161 insertions(+) create mode 100644 tests/spec/arb_shader_atomic_counters/buffer-binding.c diff --git a/tests/all.tests b/tests/all.tests index b9ec52b..171f305 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -3172,6 +3172,7 @@ import_glsl_parser_tests(spec['ARB_shader_atomic_counters'], ['']) arb_shader_atomic_counters['active-counters'] = concurrent_test('arb_shader_atomic_counters-active-counters') arb_shader_atomic_counters['array-indexing'] = concurrent_test('arb_shader_atomic_counters-array-indexing') +arb_shader_atomic_counters['buffer-binding'] = concurrent_test('arb_shader_atomic_counters-buffer-binding') profile.tests['hiz'] = hiz profile.tests['fast_color_clear'] = fast_color_clear diff --git a/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt b/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt index 83e38ec..93dec7d 100644 --- a/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt +++ b/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt @@ -12,5 +12,6 @@ link_libraries ( add_executable (arb_shader_atomic_counters-active-counters active-counters.c common.c) add_executable (arb_shader_atomic_counters-array-indexing array-indexing.c common.c) +add_executable (arb_shader_atomic_counters-buffer-binding buffer-binding.c common.c) # vim: ft=cmake: diff --git a/tests/spec/arb_shader_atomic_counters/buffer-binding.c b/tests/spec/arb_shader_atomic_counters/buffer-binding.c new file mode 100644 index 000..89af961 --- /dev/null +++ b/tests/spec/arb_shader_atomic_counters/buffer-binding.c @@ -0,0 +1,159 @@ +/* + * Copyright © 2013 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 buffer-binding.c + * + * Test that glBindBufferBase() and glBindBufferRange() have the + * necessary error checking for atomic counter buffers and that they + * update the buffer metadata correctly. + */ + +#include common.h + +#define L 1 + +PIGLIT_GL_TEST_CONFIG_BEGIN + +config.supports_gl_core_version = 31; + +config.window_width = L; +config.window_height = L; +config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA; + +PIGLIT_GL_TEST_CONFIG_END + +static bool +run_test_bind_at(unsigned i) +{ +GLuint buffer; + +glGenBuffers(1, buffer); + +glBindBufferBase(GL_ATOMIC_COUNTER_BUFFER, i, buffer); +if (glGetError()) +return false; + +glBufferData(GL_ATOMIC_COUNTER_BUFFER, 4, NULL, GL_STATIC_DRAW); +glDeleteBuffers(1, buffer); + +return !glGetError(); +} + +static bool +run_test_bind_range(unsigned i) +{ +GLuint buffer; +GLint binding; +GLint start, size; + +glGenBuffers(1, buffer); + +glBindBufferBase(GL_ATOMIC_COUNTER_BUFFER, i, buffer); +if (!piglit_check_gl_error(GL_NO_ERROR)) { +printf(Initial buffer binding failed.\n); +return false; +} + +glBufferData(GL_ATOMIC_COUNTER_BUFFER, 16, NULL, GL_STATIC_DRAW); + +glBindBufferRange(GL_ATOMIC_COUNTER_BUFFER, i, buffer, 6, 5); +if (!piglit_check_gl_error(GL_INVALID_VALUE)) { +printf(Misaligned buffer range binding didn't generate a +GL_INVALID_VALUE error.\n); +return false; +} + +glBindBufferRange(GL_ATOMIC_COUNTER_BUFFER, i, buffer, 8, 5); +if (!piglit_check_gl_error(GL_NO_ERROR)) { +printf(Buffer range binding failed.\n); +return false; +} + +glGetIntegerv(GL_ATOMIC_COUNTER_BUFFER_BINDING, binding); +if
[Piglit] [PATCH 07/13] arb_shader_atomic_counters: Test that atomic ops aren't executed for discarded fragments.
--- tests/all.tests| 1 + .../arb_shader_atomic_counters/CMakeLists.gl.txt | 1 + .../arb_shader_atomic_counters/fragment-discard.c | 113 + 3 files changed, 115 insertions(+) create mode 100644 tests/spec/arb_shader_atomic_counters/fragment-discard.c diff --git a/tests/all.tests b/tests/all.tests index 91d4e6f..4aba933 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -3174,6 +3174,7 @@ arb_shader_atomic_counters['active-counters'] = concurrent_test('arb_shader_atom arb_shader_atomic_counters['array-indexing'] = concurrent_test('arb_shader_atomic_counters-array-indexing') arb_shader_atomic_counters['buffer-binding'] = concurrent_test('arb_shader_atomic_counters-buffer-binding') arb_shader_atomic_counters['default-partition'] = concurrent_test('arb_shader_atomic_counters-default-partition') +arb_shader_atomic_counters['fragment-discard'] = concurrent_test('arb_shader_atomic_counters-fragment-discard') profile.tests['hiz'] = hiz profile.tests['fast_color_clear'] = fast_color_clear diff --git a/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt b/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt index f9479de..5526fbf 100644 --- a/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt +++ b/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt @@ -14,5 +14,6 @@ add_executable (arb_shader_atomic_counters-active-counters active-counters.c com add_executable (arb_shader_atomic_counters-array-indexing array-indexing.c common.c) add_executable (arb_shader_atomic_counters-buffer-binding buffer-binding.c common.c) add_executable (arb_shader_atomic_counters-default-partition default-partition.c common.c) +add_executable (arb_shader_atomic_counters-fragment-discard fragment-discard.c common.c) # vim: ft=cmake: diff --git a/tests/spec/arb_shader_atomic_counters/fragment-discard.c b/tests/spec/arb_shader_atomic_counters/fragment-discard.c new file mode 100644 index 000..e3b75cd --- /dev/null +++ b/tests/spec/arb_shader_atomic_counters/fragment-discard.c @@ -0,0 +1,113 @@ +/* + * Copyright © 2013 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 fragment-discard.c + * + * Check that atomic counter operations from discarded fragments have + * no effect. + */ + +#include common.h + +#define L 256 +#define N (L * L) + +PIGLIT_GL_TEST_CONFIG_BEGIN + +config.supports_gl_core_version = 31; + +config.window_width = L; +config.window_height = L; +config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA; + +PIGLIT_GL_TEST_CONFIG_END + +static bool +run_test(void) +{ +const char *fs_source = #version 140\n +#extension GL_ARB_shader_atomic_counters : enable\n +\n +layout(binding = 0, offset = 0) uniform atomic_uint x;\n +layout(binding = 0, offset = 4) uniform atomic_uint y;\n +out ivec4 fcolor;\n +\n +void main() {\n + if ((atomicCounterIncrement(x) 0x3u) == 0u)\n + discard;\n +\n + fcolor.x = int(atomicCounterIncrement(y));\n +}\n; +const char *vs_source = #version 140\n +in vec4 piglit_vertex;\n +\n +void main() {\n + gl_Position = piglit_vertex;\n +}\n; +const uint32_t start_value[] = { 0, 0 }; +const uint32_t expected_value[] = { N, N * 3/4 }; +GLuint prog = glCreateProgram(); +bool ret = atomic_counters_compile(prog, GL_FRAGMENT_SHADER, fs_source) +atomic_counters_compile(prog, GL_VERTEX_SHADER, vs_source) +atomic_counters_draw_rect(prog, 2, start_value) +
[Piglit] [PATCH 11/13] arb_shader_atomic_counters: Test linkage of atomic counters with conflicting locations.
--- tests/all.tests| 1 + .../arb_shader_atomic_counters/CMakeLists.gl.txt | 1 + .../arb_shader_atomic_counters/multiple-defs.c | 213 + 3 files changed, 215 insertions(+) create mode 100644 tests/spec/arb_shader_atomic_counters/multiple-defs.c diff --git a/tests/all.tests b/tests/all.tests index 4f4fccc..4b416ae 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -3178,6 +3178,7 @@ arb_shader_atomic_counters['fragment-discard'] = concurrent_test('arb_shader_ato arb_shader_atomic_counters['function-argument'] = concurrent_test('arb_shader_atomic_counters-function-argument') arb_shader_atomic_counters['max-counters'] = concurrent_test('arb_shader_atomic_counters-max-counters') arb_shader_atomic_counters['minmax'] = concurrent_test('arb_shader_atomic_counters-minmax') +arb_shader_atomic_counters['multiple-defs'] = concurrent_test('arb_shader_atomic_counters-multiple-defs') profile.tests['hiz'] = hiz profile.tests['fast_color_clear'] = fast_color_clear diff --git a/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt b/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt index 79f4975..5c90092 100644 --- a/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt +++ b/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt @@ -18,5 +18,6 @@ add_executable (arb_shader_atomic_counters-fragment-discard fragment-discard.c c add_executable (arb_shader_atomic_counters-function-argument function-argument.c common.c) add_executable (arb_shader_atomic_counters-max-counters max-counters.c common.c) add_executable (arb_shader_atomic_counters-minmax minmax.c common.c) +add_executable (arb_shader_atomic_counters-multiple-defs multiple-defs.c common.c) # vim: ft=cmake: diff --git a/tests/spec/arb_shader_atomic_counters/multiple-defs.c b/tests/spec/arb_shader_atomic_counters/multiple-defs.c new file mode 100644 index 000..3f768f9 --- /dev/null +++ b/tests/spec/arb_shader_atomic_counters/multiple-defs.c @@ -0,0 +1,213 @@ +/* + * Copyright © 2013 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 multiple-defs.c + * + * Checks that atomic counters with the same name may be linked + * together if and only if their layout specifications are equivalent. + */ + +#include common.h + +#define L 1 + +PIGLIT_GL_TEST_CONFIG_BEGIN + +config.supports_gl_core_version = 31; + +config.window_width = L; +config.window_height = L; +config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA; + +PIGLIT_GL_TEST_CONFIG_END + +const char *frag_src = #version 140\n +#extension GL_ARB_shader_atomic_counters : enable\n +\n +flat in ivec4 vcolor;\n +out ivec4 fcolor;\n +\n +layout(binding=3, offset=4) uniform atomic_uint x0;\n +layout(binding=2, offset=0) uniform atomic_uint x1;\n +layout(binding=2) uniform atomic_uint x2;\n +\n +void main() {\n + fcolor.x = vcolor.x + int(atomicCounter(x0) +\n + atomicCounter(x1) + atomicCounter(x2));\n +}\n; + +const char *vert_src_ok = #version 140\n +#extension GL_ARB_shader_atomic_counters : enable\n +\n +in vec4 position;\n +flat out ivec4 vcolor;\n +\n +layout(binding=2) uniform atomic_uint x1;\n +layout(binding=2, offset=4) uniform atomic_uint x2;\n +layout(binding=3, offset=4) uniform atomic_uint x0;\n +\n +void main() {\n + vcolor.x = int(atomicCounter(x0) + atomicCounter(x1)\n + + atomicCounter(x2));\n + gl_Position = position;\n +}\n; + +/* This should fail because 'x1' is redefined with a conflicting + * binding specification. */ +const char *vert_src_fail_1 = #version 140\n +#extension
[Piglit] [PATCH 12/13] arb_shader_atomic_counters: Test that atomic built-ins execute the expected operations on memory.
--- tests/all.tests| 1 + .../arb_shader_atomic_counters/CMakeLists.gl.txt | 1 + tests/spec/arb_shader_atomic_counters/semantics.c | 383 + 3 files changed, 385 insertions(+) create mode 100644 tests/spec/arb_shader_atomic_counters/semantics.c diff --git a/tests/all.tests b/tests/all.tests index 4b416ae..1c5dc9c 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -3179,6 +3179,7 @@ arb_shader_atomic_counters['function-argument'] = concurrent_test('arb_shader_at arb_shader_atomic_counters['max-counters'] = concurrent_test('arb_shader_atomic_counters-max-counters') arb_shader_atomic_counters['minmax'] = concurrent_test('arb_shader_atomic_counters-minmax') arb_shader_atomic_counters['multiple-defs'] = concurrent_test('arb_shader_atomic_counters-multiple-defs') +arb_shader_atomic_counters['semantics'] = concurrent_test('arb_shader_atomic_counters-semantics') profile.tests['hiz'] = hiz profile.tests['fast_color_clear'] = fast_color_clear diff --git a/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt b/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt index 5c90092..8eb3692 100644 --- a/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt +++ b/tests/spec/arb_shader_atomic_counters/CMakeLists.gl.txt @@ -19,5 +19,6 @@ add_executable (arb_shader_atomic_counters-function-argument function-argument.c add_executable (arb_shader_atomic_counters-max-counters max-counters.c common.c) add_executable (arb_shader_atomic_counters-minmax minmax.c common.c) add_executable (arb_shader_atomic_counters-multiple-defs multiple-defs.c common.c) +add_executable (arb_shader_atomic_counters-semantics semantics.c common.c) # vim: ft=cmake: diff --git a/tests/spec/arb_shader_atomic_counters/semantics.c b/tests/spec/arb_shader_atomic_counters/semantics.c new file mode 100644 index 000..9807065 --- /dev/null +++ b/tests/spec/arb_shader_atomic_counters/semantics.c @@ -0,0 +1,383 @@ +/* + * Copyright © 2013 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 + * + * Tests that the atomic built-in functions have the expected effects + * on memory and return the expected results. + */ + +#include common.h + +#define L 1 + +PIGLIT_GL_TEST_CONFIG_BEGIN + +config.supports_gl_core_version = 31; + +config.window_width = L; +config.window_height = L; +config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA; + +PIGLIT_GL_TEST_CONFIG_END + +static bool +run_test_vertex(void) +{ +const char *fs_source = #version 140\n +flat in ivec4 vcolor;\n +out ivec4 fcolor;\n +void main() {\n + fcolor = vcolor;\n +}\n; +const char *vs_source = #version 140\n +#extension GL_ARB_shader_atomic_counters : enable\n +\n +layout(binding = 0, offset = 0) uniform atomic_uint x;\n +in vec4 piglit_vertex;\n +flat out ivec4 vcolor;\n +\n +void main() {\n + vcolor.x = int(atomicCounterDecrement(x));\n + vcolor.y = int(atomicCounterIncrement(x));\n + vcolor.z = int(atomicCounterIncrement(x));\n + vcolor.w = int(atomicCounter(x));\n + gl_Position = piglit_vertex;\n +}\n; +const uint32_t start_buffer[] = { 0x }; +const uint32_t expected_buffer[] = { 0x0 }; +const uint32_t expected_color[] = { 0xfffe, 0xfffe, +0x, 0x0 }; +GLuint prog = glCreateProgram(); +bool ret = +atomic_counters_compile(prog, GL_FRAGMENT_SHADER, fs_source) +