[Piglit] [PATCH] GL3.3: Test invalid parameters for GL_ARB_texture_rectangle.
v2: Move test into arb_texture_rectangle folder and change context v3: Add tests for other invalid params --- tests/all.tests| 1 + tests/spec/arb_texture_rectangle/CMakeLists.gl.txt | 1 + .../texture-base-level-error.c | 103 + 3 files changed, 105 insertions(+) create mode 100644 tests/spec/arb_texture_rectangle/texture-base-level-error.c diff --git a/tests/all.tests b/tests/all.tests index cdaf1d5..d427419 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -1557,6 +1557,7 @@ add_concurrent_test(arb_texture_rectangle, '1-1-linear-texture') add_plain_test(arb_texture_rectangle, 'texrect-many') add_concurrent_test(arb_texture_rectangle, 'getteximage-targets RECT') add_plain_test(arb_texture_rectangle, 'texrect_simple_arb_texrect') +add_plain_test(arb_texture_rectangle, 'arb_texrect-texture-base-level-error') add_plain_test(arb_texture_rectangle, 'fbo-blit rect') arb_texture_storage = Group() diff --git a/tests/spec/arb_texture_rectangle/CMakeLists.gl.txt b/tests/spec/arb_texture_rectangle/CMakeLists.gl.txt index d84a850..96f04e2 100644 --- a/tests/spec/arb_texture_rectangle/CMakeLists.gl.txt +++ b/tests/spec/arb_texture_rectangle/CMakeLists.gl.txt @@ -11,3 +11,4 @@ link_libraries ( ) piglit_add_executable (texrect_simple_arb_texrect texrect-simple.c) +piglit_add_executable (arb_texrect-texture-base-level-error texture-base-level-error.c) diff --git a/tests/spec/arb_texture_rectangle/texture-base-level-error.c b/tests/spec/arb_texture_rectangle/texture-base-level-error.c new file mode 100644 index 000..a0a2e08 --- /dev/null +++ b/tests/spec/arb_texture_rectangle/texture-base-level-error.c @@ -0,0 +1,103 @@ +/** + * 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 that when target is TEXTURE_RECTANGLE, the correct error messages are + * generated when certain texture parameter values are specified. + * + * Section 3.8.8(Texture Parameters) of OpenGL 3.3 Core says: + * "When target is TEXTURE_RECTANGLE, certain texture parameter values may + * not be specified. In this case, the error INVALID_ENUM is generated if the + * TEXTURE_WRAP_S, TEXTURE_WRAP_T, or TEXTURE_WRAP_R parameter is set + * to REPEAT or MIRRORED_REPEAT. The error INVALID_ENUM is generated if + * TEXTURE_MIN_FILTER is set to a value other than NEAREST or LINEAR (no + * mipmap filtering is permitted). The error INVALID_VALUE is generated if + * TEXTURE_BASE_LEVEL is set to any value other than zero." + * + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_core_version = 31; + config.supports_gl_compat_version = 10; + +PIGLIT_GL_TEST_CONFIG_END + +void +piglit_init(int argc, char **argv) +{ + bool pass = true; + int i; + GLenum invalidWrapParams[] = {GL_REPEAT, GL_MIRRORED_REPEAT}; + GLenum invalidFilterParams[] = {GL_NEAREST_MIPMAP_NEAREST, + GL_NEAREST_MIPMAP_LINEAR, + GL_LINEAR_MIPMAP_NEAREST, + GL_LINEAR_MIPMAP_LINEAR}; + + if(piglit_get_gl_version() < 33) + piglit_require_extension("ARB_texture_rectangle"); + + /* the error INVALID_ENUM is generated if the +* TEXTURE_WRAP_S, TEXTURE_WRAP_T, or TEXTURE_WRAP_R parameter is set +* to REPEAT or MIRRORED_REPEAT +*/ + for(i = 0; i < ARRAY_SIZE(invalidWrapParams); i++) { + glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_WRAP_S, +invalidWrapParams[i]); + pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass; + + glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_WRAP_T, +invalidWrapParams[i]); +
[Piglit] [PATCH] Test that arb_explicit_attrib_location content can be used without enabling the extension.
--- .../arb_explicit_attrib_location/3.30/not-enabled.frag | 16 1 file changed, 16 insertions(+) create mode 100644 tests/spec/arb_explicit_attrib_location/3.30/not-enabled.frag diff --git a/tests/spec/arb_explicit_attrib_location/3.30/not-enabled.frag b/tests/spec/arb_explicit_attrib_location/3.30/not-enabled.frag new file mode 100644 index 000..efa99f6 --- /dev/null +++ b/tests/spec/arb_explicit_attrib_location/3.30/not-enabled.frag @@ -0,0 +1,16 @@ +// [config] +// expect_result: pass +// gl_version: 3.3 +// glsl_version: 3.30 +// [end config] +// +// Try to use layout(location) without enabling the extension. + +#version 330 + +layout(location = 0) out vec4 c; + +void main() +{ + c = vec4(0); +} -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] GL3.3: Test invalid parameters for GL_ARB_texture_rectangle.
v2: Move test into arb_texture_rectangle folder and change context --- tests/all.tests| 1 + tests/spec/arb_texture_rectangle/CMakeLists.gl.txt | 1 + .../texture-base-level-error.c | 67 ++ 3 files changed, 69 insertions(+) create mode 100644 tests/spec/arb_texture_rectangle/texture-base-level-error.c diff --git a/tests/all.tests b/tests/all.tests index cdaf1d5..d427419 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -1557,6 +1557,7 @@ add_concurrent_test(arb_texture_rectangle, '1-1-linear-texture') add_plain_test(arb_texture_rectangle, 'texrect-many') add_concurrent_test(arb_texture_rectangle, 'getteximage-targets RECT') add_plain_test(arb_texture_rectangle, 'texrect_simple_arb_texrect') +add_plain_test(arb_texture_rectangle, 'arb_texrect-texture-base-level-error') add_plain_test(arb_texture_rectangle, 'fbo-blit rect') arb_texture_storage = Group() diff --git a/tests/spec/arb_texture_rectangle/CMakeLists.gl.txt b/tests/spec/arb_texture_rectangle/CMakeLists.gl.txt index d84a850..96f04e2 100644 --- a/tests/spec/arb_texture_rectangle/CMakeLists.gl.txt +++ b/tests/spec/arb_texture_rectangle/CMakeLists.gl.txt @@ -11,3 +11,4 @@ link_libraries ( ) piglit_add_executable (texrect_simple_arb_texrect texrect-simple.c) +piglit_add_executable (arb_texrect-texture-base-level-error texture-base-level-error.c) diff --git a/tests/spec/arb_texture_rectangle/texture-base-level-error.c b/tests/spec/arb_texture_rectangle/texture-base-level-error.c new file mode 100644 index 000..7a0f006 --- /dev/null +++ b/tests/spec/arb_texture_rectangle/texture-base-level-error.c @@ -0,0 +1,67 @@ +/** + * 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 that when setting texture parameters, a TEXTURE_BASE_LEVEL of non-zero + * results in INVALID_VALUE when target is TEXTURE_RECTANGLE. + * + * Section 3.8.8(Texture Parameters) of OpenGL 3.3 Core says: + * "When target is TEXTURE_RECTANGLE, certain texture parameter values may + * not be specified. In this case, the error INVALID_ENUM is generated if the + * TEXTURE_WRAP_S, TEXTURE_WRAP_T, or TEXTURE_WRAP_R parameter is set + * to REPEAT or MIRRORED_REPEAT. The error INVALID_ENUM is generated if + * TEXTURE_MIN_FILTER is set to a value other than NEAREST or LINEAR (no + * mipmap filtering is permitted). The error INVALID_VALUE is generated if + * TEXTURE_BASE_LEVEL is set to any value other than zero." + * + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_core_version = 31; + config.supports_gl_compat_version = 10; + +PIGLIT_GL_TEST_CONFIG_END + +void +piglit_init(int argc, char **argv) +{ + bool pass = true; + + if(piglit_get_gl_version() < 33) + piglit_require_extension("ARB_texture_rectangle"); + + glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_BASE_LEVEL, 37); + pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass; + + piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); +} + +enum piglit_result +piglit_display(void) +{ + /* UNREACHED */ + return PIGLIT_FAIL; +} -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 2/2 v2] Test that if VertexAttribPointer uses a packed type, size must be 4 or BGRA.
v2: change context --- .../CMakeLists.gl.txt | 1 + .../vertex-attrib-pointer-type-size-match.c| 92 ++ 2 files changed, 93 insertions(+) create mode 100644 tests/spec/arb_vertex_type_2_10_10_10_rev/vertex-attrib-pointer-type-size-match.c diff --git a/tests/spec/arb_vertex_type_2_10_10_10_rev/CMakeLists.gl.txt b/tests/spec/arb_vertex_type_2_10_10_10_rev/CMakeLists.gl.txt index 9154c26..a7388a1 100644 --- a/tests/spec/arb_vertex_type_2_10_10_10_rev/CMakeLists.gl.txt +++ b/tests/spec/arb_vertex_type_2_10_10_10_rev/CMakeLists.gl.txt @@ -11,5 +11,6 @@ link_libraries ( piglit_add_executable (draw-vertices-2101010 draw-vertices-2101010.c) piglit_add_executable (gl-3.3-vertex-attrib-p-types vertex-attrib-p-types.c) +piglit_add_executable (gl-3.3-vertex-attrib-pointer-type-size-match vertex-attrib-pointer-type-size-match.c) # vim: ft=cmake: diff --git a/tests/spec/arb_vertex_type_2_10_10_10_rev/vertex-attrib-pointer-type-size-match.c b/tests/spec/arb_vertex_type_2_10_10_10_rev/vertex-attrib-pointer-type-size-match.c new file mode 100644 index 000..7ed5e6f --- /dev/null +++ b/tests/spec/arb_vertex_type_2_10_10_10_rev/vertex-attrib-pointer-type-size-match.c @@ -0,0 +1,92 @@ +/* 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 that if VertexAttribPointer type is INT_2_10_10_10_REV or + * UNSIGNED_INT_2_10_10_10_REV, size must be either 4 or BGRA. + * + * Section 2.8(Vertex Arrays) of GL3.3 core spec says: + * "An INVALID_OPERATION error is generated under any of the following + * conditions: + * • size is BGRA and type is not UNSIGNED_BYTE, INT_2_10_10_10_REV or + * UNSIGNED_INT_2_10_10_10_REV; + * • type is INT_2_10_10_10_REV or UNSIGNED_INT_2_10_10_10_REV, and size + * is neither 4 or BGRA;" + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_core_version = 31; + config.supports_gl_compat_version = 20; + +PIGLIT_GL_TEST_CONFIG_END + +void +piglit_init(int argc, char **argv) +{ + bool pass = true; + int i; + GLint valid_sizes[] = { + 4, GL_BGRA + }; + GLint invalid_sizes[] = { + 1, 2, 3 + }; + + if(piglit_get_gl_version() < 33) + piglit_require_extension("ARB_vertex_type_2_10_10_10_rev"); + + for (i = 0; i < ARRAY_SIZE(valid_sizes); i++) { + glVertexAttribPointer(0, valid_sizes[i], + GL_INT_2_10_10_10_REV, GL_TRUE, + 0, NULL); + pass = piglit_check_gl_error(GL_NO_ERROR) && pass; + + glVertexAttribPointer(0, valid_sizes[i], + GL_UNSIGNED_INT_2_10_10_10_REV, GL_TRUE, + 0, NULL); + pass = piglit_check_gl_error(GL_NO_ERROR) && pass; + } + + for (i = 0; i < ARRAY_SIZE(invalid_sizes); i++) { + glVertexAttribPointer(0, valid_sizes[i], + GL_INT_2_10_10_10_REV, GL_TRUE, + 0, NULL); + pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass; + + glVertexAttribPointer(0, valid_sizes[i], + GL_UNSIGNED_INT_2_10_10_10_REV, GL_TRUE, + 0, NULL); + pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass; + } + + piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); +} + +enum piglit_result +piglit_display(void) +{ + /* UNREACHED */ + return PIGLIT_FAIL; +} -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 1/2 v2] Test that VertexAttribP*() must use one of the appropriate types.
v2: change context --- .../CMakeLists.gl.txt | 1 + .../vertex-attrib-p-types.c| 84 ++ 2 files changed, 85 insertions(+) create mode 100644 tests/spec/arb_vertex_type_2_10_10_10_rev/vertex-attrib-p-types.c diff --git a/tests/spec/arb_vertex_type_2_10_10_10_rev/CMakeLists.gl.txt b/tests/spec/arb_vertex_type_2_10_10_10_rev/CMakeLists.gl.txt index 2ca905b..9154c26 100644 --- a/tests/spec/arb_vertex_type_2_10_10_10_rev/CMakeLists.gl.txt +++ b/tests/spec/arb_vertex_type_2_10_10_10_rev/CMakeLists.gl.txt @@ -10,5 +10,6 @@ link_libraries ( ) piglit_add_executable (draw-vertices-2101010 draw-vertices-2101010.c) +piglit_add_executable (gl-3.3-vertex-attrib-p-types vertex-attrib-p-types.c) # vim: ft=cmake: diff --git a/tests/spec/arb_vertex_type_2_10_10_10_rev/vertex-attrib-p-types.c b/tests/spec/arb_vertex_type_2_10_10_10_rev/vertex-attrib-p-types.c new file mode 100644 index 000..f10304f --- /dev/null +++ b/tests/spec/arb_vertex_type_2_10_10_10_rev/vertex-attrib-p-types.c @@ -0,0 +1,84 @@ +/* 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 that VertexAttribP*() must use types INT_2_10_10_10_REV or + * UNSIGNED_INT_2_10_10_10_REV + * + * Section 2.7(Vertex Specification) of GL3.3 core spec says: + * "The type parameter must be INT_2_10_10_10_REV or + * UNSIGNED_INT_2_10_10_10_REV, specifying signed or unsigned data + * respectively." + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_core_version = 31; + config.supports_gl_compat_version = 20; + +PIGLIT_GL_TEST_CONFIG_END + +void +piglit_init(int argc, char **argv) +{ + bool pass = true; + int i; + GLuint x = 21; + GLenum valid_types[] = { + GL_UNSIGNED_INT_2_10_10_10_REV, + GL_INT_2_10_10_10_REV + }; + GLenum invalid_types[] = { + GL_BYTE, GL_SHORT, GL_INT, GL_FLOAT, GL_HALF_FLOAT, GL_DOUBLE, + GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT, GL_UNSIGNED_INT + }; + + if(piglit_get_gl_version() < 33) + piglit_require_extension("ARB_vertex_type_2_10_10_10_rev"); + + for (i = 0; i < ARRAY_SIZE(valid_types); i++) { + glVertexAttribP1ui(0, valid_types[i], true, x); + pass = piglit_check_gl_error(GL_NO_ERROR) && pass; + + glVertexAttribP1uiv(0, valid_types[i], true, &x); + pass = piglit_check_gl_error(GL_NO_ERROR) && pass; + } + + for (i = 0; i < ARRAY_SIZE(invalid_types); i++) { + glVertexAttribP1ui(0, invalid_types[i], true, x); + pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass; + + glVertexAttribP1uiv(0, invalid_types[i], true, &x); + pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass; + } + + piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); +} + +enum piglit_result +piglit_display(void) +{ + /* UNREACHED */ + return PIGLIT_FAIL; +} -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 2/2] Test that VERTEX_ATTRIB_ARRAY_DIVISOR may be passed to GetVertexAttrib* functions.
--- tests/all.tests| 1 + tests/spec/arb_instanced_arrays/CMakeLists.gl.txt | 1 + .../vertex-attrib-divisor-query.c | 86 ++ 3 files changed, 88 insertions(+) create mode 100644 tests/spec/arb_instanced_arrays/vertex-attrib-divisor-query.c diff --git a/tests/all.tests b/tests/all.tests index b2b380c..4d010e1 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -2546,6 +2546,7 @@ add_plain_test(ati_envmap_bumpmap, 'ati_envmap_bumpmap-bump') arb_instanced_arrays = Group() spec['ARB_instanced_arrays'] = arb_instanced_arrays add_plain_test(arb_instanced_arrays, 'vertex-attrib-divisor-index-error') +add_plain_test(arb_instanced_arrays, 'vertex-attrib-divisor-query') add_plain_test(arb_instanced_arrays, 'instanced_arrays') add_single_param_test_set(arb_instanced_arrays, 'instanced_arrays', 'vbo') diff --git a/tests/spec/arb_instanced_arrays/CMakeLists.gl.txt b/tests/spec/arb_instanced_arrays/CMakeLists.gl.txt index 8f7498e..a4bdd45 100644 --- a/tests/spec/arb_instanced_arrays/CMakeLists.gl.txt +++ b/tests/spec/arb_instanced_arrays/CMakeLists.gl.txt @@ -11,5 +11,6 @@ link_libraries ( piglit_add_executable (instanced_arrays instanced_arrays.c) piglit_add_executable (vertex-attrib-divisor-index-error vertex-attrib-divisor-index-error.c) +piglit_add_executable (vertex-attrib-divisor-query vertex-attrib-divisor-query.c) # vim: ft=cmake: diff --git a/tests/spec/arb_instanced_arrays/vertex-attrib-divisor-query.c b/tests/spec/arb_instanced_arrays/vertex-attrib-divisor-query.c new file mode 100644 index 000..9c47503 --- /dev/null +++ b/tests/spec/arb_instanced_arrays/vertex-attrib-divisor-query.c @@ -0,0 +1,86 @@ +/** + * 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 VERTEX_ATTRIB_ARRAY_DIVISOR may be passed to GetVertexAttrib* + * functions. + * + * GL 3.3 core spec, section 6.1.11 (Shader and Program Queries) says: + * "The commands + * void GetVertexAttribdv( uint index, enum pname, double *params ); + * void GetVertexAttribfv( uint index, enum pname, float *params ); + * void GetVertexAttribiv( uint index, enum pname, int *params ); + * void GetVertexAttribIiv( uint index, enum pname, int *params ); + * void GetVertexAttribIuiv( uint index, enum pname, uint *params ); + * obtain the vertex attribute state named by pname for the generic vertex + * attribute numbered index and places the information in the array params. + * pname must be one of VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, + * VERTEX_ATTRIB_ARRAY_ENABLED, VERTEX_ATTRIB_ARRAY_SIZE, + * VERTEX_ATTRIB_ARRAY_STRIDE, VERTEX_ATTRIB_ARRAY_TYPE, + * VERTEX_ATTRIB_ARRAY_NORMALIZED, VERTEX_ATTRIB_ARRAY_INTEGER, + * VERTEX_ATTRIB_ARRAY_DIVISOR, or CURRENT_VERTEX_ATTRIB." + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_core_version = 33; + config.supports_gl_compat_version = 33; + +PIGLIT_GL_TEST_CONFIG_END + +void +piglit_init(int argc, char **argv) +{ + bool pass = true; + GLdouble dParam[] = {1.0}; + GLfloat fParam[] = {1.0f}; + GLint iParam[] = {-1}; + GLuint uParam[] = {1}; + + glGetVertexAttribdv(0, GL_VERTEX_ATTRIB_ARRAY_DIVISOR, dParam); + pass = piglit_check_gl_error(GL_NO_ERROR) && pass; + + glGetVertexAttribfv(0, GL_VERTEX_ATTRIB_ARRAY_DIVISOR, fParam); + pass = piglit_check_gl_error(GL_NO_ERROR) && pass; + + glGetVertexAttribiv(0, GL_VERTEX_ATTRIB_ARRAY_DIVISOR, iParam); + pass = piglit_check_gl_error(GL_NO_ERROR) && pass; + + glGetVertexAttribIiv(0, GL_VERTEX_ATTRIB_ARRAY_DIVISOR, iParam); + pass = piglit_check_gl_error(GL_NO_ERROR) && pass; + + glGetVertexAttribIuiv(0, GL_VERTEX_ATTRIB_ARRAY_DIVISOR, uParam); + pass = piglit_check_gl_error(GL_NO_ERROR
[Piglit] [PATCH 1/2] Test that VertexAttribDivisor() generates INVALID_VALUE if index is greater than or equal to MAX_VERTEX_ATTRIBS.
--- tests/all.tests| 1 + tests/spec/arb_instanced_arrays/CMakeLists.gl.txt | 1 + .../vertex-attrib-divisor-index-error.c| 59 ++ 3 files changed, 61 insertions(+) create mode 100644 tests/spec/arb_instanced_arrays/vertex-attrib-divisor-index-error.c diff --git a/tests/all.tests b/tests/all.tests index e9a579c..b2b380c 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -2545,6 +2545,7 @@ add_plain_test(ati_envmap_bumpmap, 'ati_envmap_bumpmap-bump') arb_instanced_arrays = Group() spec['ARB_instanced_arrays'] = arb_instanced_arrays +add_plain_test(arb_instanced_arrays, 'vertex-attrib-divisor-index-error') add_plain_test(arb_instanced_arrays, 'instanced_arrays') add_single_param_test_set(arb_instanced_arrays, 'instanced_arrays', 'vbo') diff --git a/tests/spec/arb_instanced_arrays/CMakeLists.gl.txt b/tests/spec/arb_instanced_arrays/CMakeLists.gl.txt index cb6c03d..8f7498e 100644 --- a/tests/spec/arb_instanced_arrays/CMakeLists.gl.txt +++ b/tests/spec/arb_instanced_arrays/CMakeLists.gl.txt @@ -10,5 +10,6 @@ link_libraries ( ) piglit_add_executable (instanced_arrays instanced_arrays.c) +piglit_add_executable (vertex-attrib-divisor-index-error vertex-attrib-divisor-index-error.c) # vim: ft=cmake: diff --git a/tests/spec/arb_instanced_arrays/vertex-attrib-divisor-index-error.c b/tests/spec/arb_instanced_arrays/vertex-attrib-divisor-index-error.c new file mode 100644 index 000..062b14c --- /dev/null +++ b/tests/spec/arb_instanced_arrays/vertex-attrib-divisor-index-error.c @@ -0,0 +1,59 @@ +/** + * 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 VertexAttribDivisor() generates INVALID_VALUE if index is greater + * than or equal to MAX_VERTEX_ATTRIBS. + * + * GL 3.3 core spec, section 2.8 (Vertex Arrays) says: + * "An INVALID_VALUE error is generated if index is greater than or equal to the + * value of MAX_VERTEX_ATTRIBS." + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_core_version = 33; + config.supports_gl_compat_version = 33; + +PIGLIT_GL_TEST_CONFIG_END + +void +piglit_init(int argc, char **argv) +{ + bool pass = true; + + glVertexAttribDivisor(GL_MAX_VERTEX_ATTRIBS, 0); + pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass; + + piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); +} + +enum piglit_result +piglit_display(void) +{ + /* UNREACHED */ + return PIGLIT_FAIL; +} -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 1/2] Test that VertexAttribP*() must use one of the appropriate types.
--- .../CMakeLists.gl.txt | 1 + .../vertex-attrib-p-types.c| 81 ++ 2 files changed, 82 insertions(+) create mode 100644 tests/spec/arb_vertex_type_2_10_10_10_rev/vertex-attrib-p-types.c diff --git a/tests/spec/arb_vertex_type_2_10_10_10_rev/CMakeLists.gl.txt b/tests/spec/arb_vertex_type_2_10_10_10_rev/CMakeLists.gl.txt index 2ca905b..9154c26 100644 --- a/tests/spec/arb_vertex_type_2_10_10_10_rev/CMakeLists.gl.txt +++ b/tests/spec/arb_vertex_type_2_10_10_10_rev/CMakeLists.gl.txt @@ -10,5 +10,6 @@ link_libraries ( ) piglit_add_executable (draw-vertices-2101010 draw-vertices-2101010.c) +piglit_add_executable (gl-3.3-vertex-attrib-p-types vertex-attrib-p-types.c) # vim: ft=cmake: diff --git a/tests/spec/arb_vertex_type_2_10_10_10_rev/vertex-attrib-p-types.c b/tests/spec/arb_vertex_type_2_10_10_10_rev/vertex-attrib-p-types.c new file mode 100644 index 000..366cf87 --- /dev/null +++ b/tests/spec/arb_vertex_type_2_10_10_10_rev/vertex-attrib-p-types.c @@ -0,0 +1,81 @@ +/* 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 that VertexAttribP*() must use types INT_2_10_10_10_REV or + * UNSIGNED_INT_2_10_10_10_REV + * + * Section 2.7(Vertex Specification) of GL3.3 core spec says: + * "The type parameter must be INT_2_10_10_10_REV or + * UNSIGNED_INT_2_10_10_10_REV, specifying signed or unsigned data + * respectively." + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_core_version = 33; + config.supports_gl_compat_version = 33; + +PIGLIT_GL_TEST_CONFIG_END + +void +piglit_init(int argc, char **argv) +{ + bool pass = true; + int i; + GLuint x = 21; + GLenum valid_types[] = { + GL_UNSIGNED_INT_2_10_10_10_REV, + GL_INT_2_10_10_10_REV + }; + GLenum invalid_types[] = { + GL_BYTE, GL_SHORT, GL_INT, GL_FLOAT, GL_HALF_FLOAT, GL_DOUBLE, + GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT, GL_UNSIGNED_INT + }; + + for (i = 0; i < ARRAY_SIZE(valid_types); i++) { + glVertexAttribP1ui(0, valid_types[i], true, x); + pass = piglit_check_gl_error(GL_NO_ERROR) && pass; + + glVertexAttribP1uiv(0, valid_types[i], true, &x); + pass = piglit_check_gl_error(GL_NO_ERROR) && pass; + } + + for (i = 0; i < ARRAY_SIZE(invalid_types); i++) { + glVertexAttribP1ui(0, invalid_types[i], true, x); + pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass; + + glVertexAttribP1uiv(0, invalid_types[i], true, &x); + pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass; + } + + piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); +} + +enum piglit_result +piglit_display(void) +{ + /* UNREACHED */ + return PIGLIT_FAIL; +} -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 2/2] Test that if VertexAttribPointer uses a packed type, size must be 4 or BGRA.
--- .../CMakeLists.gl.txt | 1 + .../vertex-attrib-pointer-type-size-match.c| 89 ++ 2 files changed, 90 insertions(+) create mode 100644 tests/spec/arb_vertex_type_2_10_10_10_rev/vertex-attrib-pointer-type-size-match.c diff --git a/tests/spec/arb_vertex_type_2_10_10_10_rev/CMakeLists.gl.txt b/tests/spec/arb_vertex_type_2_10_10_10_rev/CMakeLists.gl.txt index 9154c26..a7388a1 100644 --- a/tests/spec/arb_vertex_type_2_10_10_10_rev/CMakeLists.gl.txt +++ b/tests/spec/arb_vertex_type_2_10_10_10_rev/CMakeLists.gl.txt @@ -11,5 +11,6 @@ link_libraries ( piglit_add_executable (draw-vertices-2101010 draw-vertices-2101010.c) piglit_add_executable (gl-3.3-vertex-attrib-p-types vertex-attrib-p-types.c) +piglit_add_executable (gl-3.3-vertex-attrib-pointer-type-size-match vertex-attrib-pointer-type-size-match.c) # vim: ft=cmake: diff --git a/tests/spec/arb_vertex_type_2_10_10_10_rev/vertex-attrib-pointer-type-size-match.c b/tests/spec/arb_vertex_type_2_10_10_10_rev/vertex-attrib-pointer-type-size-match.c new file mode 100644 index 000..546e8d1 --- /dev/null +++ b/tests/spec/arb_vertex_type_2_10_10_10_rev/vertex-attrib-pointer-type-size-match.c @@ -0,0 +1,89 @@ +/* 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 that if VertexAttribPointer type is INT_2_10_10_10_REV or + * UNSIGNED_INT_2_10_10_10_REV, size must be either 4 or BGRA. + * + * Section 2.8(Vertex Arrays) of GL3.3 core spec says: + * "An INVALID_OPERATION error is generated under any of the following + * conditions: + * • size is BGRA and type is not UNSIGNED_BYTE, INT_2_10_10_10_REV or + * UNSIGNED_INT_2_10_10_10_REV; + * • type is INT_2_10_10_10_REV or UNSIGNED_INT_2_10_10_10_REV, and size + * is neither 4 or BGRA;" + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_core_version = 33; + config.supports_gl_compat_version = 33; + +PIGLIT_GL_TEST_CONFIG_END + +void +piglit_init(int argc, char **argv) +{ + bool pass = true; + int i; + GLint valid_sizes[] = { + 4, GL_BGRA + }; + GLint invalid_sizes[] = { + 1, 2, 3 + }; + + for (i = 0; i < ARRAY_SIZE(valid_sizes); i++) { + glVertexAttribPointer(0, valid_sizes[i], + GL_INT_2_10_10_10_REV, GL_TRUE, + 0, NULL); + pass = piglit_check_gl_error(GL_NO_ERROR) && pass; + + glVertexAttribPointer(0, valid_sizes[i], + GL_UNSIGNED_INT_2_10_10_10_REV, GL_TRUE, + 0, NULL); + pass = piglit_check_gl_error(GL_NO_ERROR) && pass; + } + + for (i = 0; i < ARRAY_SIZE(invalid_sizes); i++) { + glVertexAttribPointer(0, valid_sizes[i], + GL_INT_2_10_10_10_REV, GL_TRUE, + 0, NULL); + pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass; + + glVertexAttribPointer(0, valid_sizes[i], + GL_UNSIGNED_INT_2_10_10_10_REV, GL_TRUE, + 0, NULL); + pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass; + } + + piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); +} + +enum piglit_result +piglit_display(void) +{ + /* UNREACHED */ + return PIGLIT_FAIL; +} -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] GL3.3: Test that with target of TEXTURE_RECTANGLE, TEXTURE_BASE_LEVEL of non-zero results in INVALID_VALUE.
--- tests/all.tests | 1 + tests/spec/gl-3.3/CMakeLists.gl.txt | 1 + tests/spec/gl-3.3/texture-base-level-error.c | 64 3 files changed, 66 insertions(+) create mode 100644 tests/spec/gl-3.3/texture-base-level-error.c diff --git a/tests/all.tests b/tests/all.tests index e9a579c..ec8cf31 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -770,6 +770,7 @@ spec['!OpenGL/get-active-attrib-returns-all-inputs'] = concurrent_test('gl-get-a spec['!OpenGL 3.2/texture-border-deprecated'] = concurrent_test('gl-3.2-texture-border-deprecated') spec['!OpenGL 3.3/minmax'] = concurrent_test('gl-3.3-minmax') +spec['!OpenGL 3.3/texture-base-level-error'] = concurrent_test('gl-3.3-texture-base-level-error') spec['!OpenGL 3.3/required-renderbuffer-attachment-formats'] = concurrent_test('gl-3.0-required-renderbuffer-attachment-formats 33') spec['!OpenGL 3.3/required-sized-texture-formats'] = concurrent_test('gl-3.0-required-sized-texture-formats 33') spec['!OpenGL 3.3/required-texture-attachment-formats'] = concurrent_test('gl-3.0-required-texture-attachment-formats 33') diff --git a/tests/spec/gl-3.3/CMakeLists.gl.txt b/tests/spec/gl-3.3/CMakeLists.gl.txt index b58b541..7143680 100644 --- a/tests/spec/gl-3.3/CMakeLists.gl.txt +++ b/tests/spec/gl-3.3/CMakeLists.gl.txt @@ -10,5 +10,6 @@ link_libraries ( ) piglit_add_executable (gl-3.3-minmax minmax.c) +piglit_add_executable (gl-3.3-texture-base-level-error texture-base-level-error.c) # vim: ft=cmake: diff --git a/tests/spec/gl-3.3/texture-base-level-error.c b/tests/spec/gl-3.3/texture-base-level-error.c new file mode 100644 index 000..86180c0 --- /dev/null +++ b/tests/spec/gl-3.3/texture-base-level-error.c @@ -0,0 +1,64 @@ +/** + * 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 that when setting texture parameters, a TEXTURE_BASE_LEVEL of non-zero + * results in INVALID_VALUE when target is TEXTURE_RECTANGLE. + * + * Section 3.8.8(Texture Parameters) of OpenGL 3.3 Core says: + * "When target is TEXTURE_RECTANGLE, certain texture parameter values may + * not be specified. In this case, the error INVALID_ENUM is generated if the + * TEXTURE_WRAP_S, TEXTURE_WRAP_T, or TEXTURE_WRAP_R parameter is set + * to REPEAT or MIRRORED_REPEAT. The error INVALID_ENUM is generated if + * TEXTURE_MIN_FILTER is set to a value other than NEAREST or LINEAR (no + * mipmap filtering is permitted). The error INVALID_VALUE is generated if + * TEXTURE_BASE_LEVEL is set to any value other than zero." + * + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_core_version = 33; + config.supports_gl_compat_version = 33; + +PIGLIT_GL_TEST_CONFIG_END + +void +piglit_init(int argc, char **argv) +{ + bool pass = true; + + glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_BASE_LEVEL, 37); + pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass; + + piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); +} + +enum piglit_result +piglit_display(void) +{ + /* UNREACHED */ + return PIGLIT_FAIL; +} -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] GL: Verify that when GL_COORD_REPLACE is set, fragment shader texture coordinates do not get eliminated.
--- tests/all.tests| 2 +- tests/spec/gl-3.2/CMakeLists.gl.txt| 3 +- ...oord-replace-doesnt-eliminate-frag-tex-coords.c | 135 + 3 files changed, 138 insertions(+), 2 deletions(-) create mode 100644 tests/spec/gl-3.2/gl-coord-replace-doesnt-eliminate-frag-tex-coords.c diff --git a/tests/all.tests b/tests/all.tests index af5dcf3..d34773b 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -765,7 +765,7 @@ spec['!OpenGL 3.2/layered-rendering/gl-layer'] = concurrent_test('gl-3.2-layered spec['!OpenGL 3.2/layered-rendering/gl-layer-cube-map'] = concurrent_test('gl-3.2-layered-rendering-gl-layer-cube-map') spec['!OpenGL 3.2/layered-rendering/gl-layer-not-layered'] = concurrent_test('gl-3.2-layered-rendering-gl-layer-not-layered') spec['!OpenGL 3.2/layered-rendering/gl-layer-render'] = concurrent_test('gl-3.2-layered-rendering-gl-layer-render') - +spec['!OpenGL/coord-replace-doesnt-eliminate-frag-tex-coords'] = concurrent_test('gl-coord-replace-doesnt-eliminate-frag-tex-coords') spec['!OpenGL/get-active-attrib-returns-all-inputs'] = concurrent_test('gl-get-active-attrib-returns-all-inputs') spec['!OpenGL 3.2/texture-border-deprecated'] = concurrent_test('gl-3.2-texture-border-deprecated') diff --git a/tests/spec/gl-3.2/CMakeLists.gl.txt b/tests/spec/gl-3.2/CMakeLists.gl.txt index 1457681..c8725be 100644 --- a/tests/spec/gl-3.2/CMakeLists.gl.txt +++ b/tests/spec/gl-3.2/CMakeLists.gl.txt @@ -9,11 +9,12 @@ link_libraries ( ${OPENGL_glu_LIBRARY} ) -piglit_add_executable (gl-get-active-attrib-returns-all-inputs get-active-attrib-returns-all-inputs.c) piglit_add_executable (gl-3.2-minmax minmax.c) piglit_add_executable (gl-3.2-clear-no-buffers clear-no-buffers.c) piglit_add_executable (gl-3.2-get-buffer-parameter-i64v get-buffer-parameter-i64v.c) piglit_add_executable (gl-3.2-get-integer-64iv get-integer-64iv.c) piglit_add_executable (gl-3.2-get-integer-64v get-integer-64v.c) piglit_add_executable (gl-3.2-texture-border-deprecated texture-border-deprecated.c) +piglit_add_executable (gl-coord-replace-doesnt-eliminate-frag-tex-coords gl-coord-replace-doesnt-eliminate-frag-tex-coords) +piglit_add_executable (gl-get-active-attrib-returns-all-inputs get-active-attrib-returns-all-inputs.c) # vim: ft=cmake: diff --git a/tests/spec/gl-3.2/gl-coord-replace-doesnt-eliminate-frag-tex-coords.c b/tests/spec/gl-3.2/gl-coord-replace-doesnt-eliminate-frag-tex-coords.c new file mode 100644 index 000..b07327c --- /dev/null +++ b/tests/spec/gl-3.2/gl-coord-replace-doesnt-eliminate-frag-tex-coords.c @@ -0,0 +1,135 @@ +/** + * 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. + */ + +/** + * Verify that when GL_COORD_REPLACE is set, fragment shader texture + * coordinates (via the gl_TexCoord built-ins) don't get eliminated. + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 21; + + config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE; + +PIGLIT_GL_TEST_CONFIG_END + +static const char *vstext = + "#version 130\n" + "in vec3 vertex;\n" + "void main() {\n" + " gl_Position = vec4(vertex, 1.);\n" + " gl_PointSize = 16;\n" + "}\n"; + +static const char *fstext = + "#version 130\n" + "void main() {\n" + " gl_FragColor = gl_TexCoord[0];\n" + "}\n"; + +static GLuint vao; +static GLuint vertBuff; +static GLuint indexBuf; + +static GLfloat vertices[] = { + 0.0, 0.0, 0.0 +}; +static GLsizei vertSize = sizeof(vertices); + +static GLuint indices[] = { + 0 +}; +static GLsizei indSize = sizeof(indices); + +static GLuint prog; + +void +piglit_init(int argc, char **argv) +{ + GLuint vertIndex; + + prog = piglit_build_simple_program(vstext, fstext);
[Piglit] [PATCH] GL_ARB_base_instance: Verify that the baseinstance setting does not affect the value of gl_InstanceID.
--- tests/all.tests| 4 + tests/spec/CMakeLists.txt | 1 + tests/spec/arb_base_instance/CMakeLists.gl.txt | 9 ++ tests/spec/arb_base_instance/CMakeLists.txt| 1 + .../baseinstance-doesnt-affect-gl-instance-id.c| 134 + 5 files changed, 149 insertions(+) create mode 100644 tests/spec/arb_base_instance/CMakeLists.gl.txt create mode 100644 tests/spec/arb_base_instance/CMakeLists.txt create mode 100644 tests/spec/arb_base_instance/baseinstance-doesnt-affect-gl-instance-id.c diff --git a/tests/all.tests b/tests/all.tests index 8a1b91f..d6a89ba 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -2646,6 +2646,10 @@ add_plain_test(arb_blend_func_extended, 'arb_blend_func_extended-getfragdatainde add_plain_test(arb_blend_func_extended, 'arb_blend_func_extended-fbo-extended-blend') add_plain_test(arb_blend_func_extended, 'arb_blend_func_extended-fbo-extended-blend-explicit') +arb_base_instance = Group() +spec['ARB_base_instance'] = arb_base_instance +add_plain_test(arb_base_instance, 'arb_base_instance-baseinstance-doesnt-affect-gl-instance-id') + apple_object_purgeable = Group() spec['APPLE_object_purgeable'] = apple_object_purgeable add_plain_test(apple_object_purgeable, 'object_purgeable-api-pbo') diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt index 18b846d..100a1f8 100644 --- a/tests/spec/CMakeLists.txt +++ b/tests/spec/CMakeLists.txt @@ -1,4 +1,5 @@ add_subdirectory (amd_performance_monitor) +add_subdirectory (arb_base_instance) add_subdirectory (arb_color_buffer_float) add_subdirectory (arb_debug_output) add_subdirectory (khr_debug) diff --git a/tests/spec/arb_base_instance/CMakeLists.gl.txt b/tests/spec/arb_base_instance/CMakeLists.gl.txt new file mode 100644 index 000..6c86b56 --- /dev/null +++ b/tests/spec/arb_base_instance/CMakeLists.gl.txt @@ -0,0 +1,9 @@ +link_libraries ( + piglitutil_${piglit_target_api} + ${OPENGL_gl_LIBRARY} + ${OPENGL_glu_LIBRARY} +) + +piglit_add_executable (arb_base_instance-baseinstance-doesnt-affect-gl-instance-id baseinstance-doesnt-affect-gl-instance-id.c) + +# vim: ft=cmake: diff --git a/tests/spec/arb_base_instance/CMakeLists.txt b/tests/spec/arb_base_instance/CMakeLists.txt new file mode 100644 index 000..144a306 --- /dev/null +++ b/tests/spec/arb_base_instance/CMakeLists.txt @@ -0,0 +1 @@ +piglit_include_target_api() diff --git a/tests/spec/arb_base_instance/baseinstance-doesnt-affect-gl-instance-id.c b/tests/spec/arb_base_instance/baseinstance-doesnt-affect-gl-instance-id.c new file mode 100644 index 000..336a502 --- /dev/null +++ b/tests/spec/arb_base_instance/baseinstance-doesnt-affect-gl-instance-id.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. + */ + +/** + * Verify that the baseinstance setting (from GL_ARB_base_instance) does + * not affect the value of gl_InstanceID. + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 32; //what settings should be here? + + config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE; + +PIGLIT_GL_TEST_CONFIG_END + +static const char *vstext = + "#version 150\n" + "in vec3 vertex;\n" + "out vec4 passColor;\n" + "void main() {\n" + " if(gl_InstanceID != 0) passColor = vec4(1, 0, 0, 1);\n" + " else passColor = vec4(0, 1, 0, 1);\n" + " gl_Position = vec4(vertex, 1.);\n" + "}\n"; + +static const char *fstext = + "#version 150\n" + "in vec4 passColor;\n" + "out vec4 color;\n" + "void main() {\n" + " color = passColor;\n" + "}\n"; + +static GLuint vao; +static GLuint vertBuff; +static GLuint indexBuf; + +static GLfloat vertices[] = { + -1
[Piglit] [PATCH v2] Interface Blocks: Test how interface block members are accessed from API
v2: Add checks to also test invalid names --- tests/all.tests| 1 + tests/spec/glsl-1.50/execution/CMakeLists.gl.txt | 1 + .../interface-blocks-api-access-members.c | 173 + 3 files changed, 175 insertions(+) create mode 100644 tests/spec/glsl-1.50/execution/interface-blocks-api-access-members.c diff --git a/tests/all.tests b/tests/all.tests index c919f19..d2e685c 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -966,6 +966,7 @@ import_glsl_parser_tests(spec['glsl-1.50'], add_shader_test_dir(spec['glsl-1.50'], os.path.join(testsDir, 'spec', 'glsl-1.50'), recursive=True) +spec['glsl-1.50']['execution']['interface-blocks-api-access-members'] = concurrent_test('glsl-1.50-interface-blocks-api-access-members') spec['glsl-1.50']['execution']['get-active-attrib-array'] = concurrent_test('glsl-1.50-get-active-attrib-array') spec['glsl-1.50']['execution']['vs-input-arrays'] = concurrent_test('glsl-1.50-vs-input-arrays') spec['glsl-1.50']['execution']['vs-named-block-no-modify'] = concurrent_test('glsl-1.50-vs-named-block-no-modify') diff --git a/tests/spec/glsl-1.50/execution/CMakeLists.gl.txt b/tests/spec/glsl-1.50/execution/CMakeLists.gl.txt index 693f69a..114867b 100644 --- a/tests/spec/glsl-1.50/execution/CMakeLists.gl.txt +++ b/tests/spec/glsl-1.50/execution/CMakeLists.gl.txt @@ -13,3 +13,4 @@ ${OPENGL_glu_LIBRARY} piglit_add_executable (glsl-1.50-vs-input-arrays vs-input-arrays.c) piglit_add_executable (glsl-1.50-get-active-attrib-array get-active-attrib-array.c) piglit_add_executable (glsl-1.50-vs-named-block-no-modify vs-named-block-no-modify.c) +piglit_add_executable (glsl-1.50-interface-blocks-api-access-members interface-blocks-api-access-members.c) diff --git a/tests/spec/glsl-1.50/execution/interface-blocks-api-access-members.c b/tests/spec/glsl-1.50/execution/interface-blocks-api-access-members.c new file mode 100644 index 000..77089f8 --- /dev/null +++ b/tests/spec/glsl-1.50/execution/interface-blocks-api-access-members.c @@ -0,0 +1,173 @@ +/** + * 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 the syntax for accessing interface block members through the API + * + * From the GLSL 1.50 core spec, section 4.3.7 (Interface Blocks): + * "Outside the shading language (i.e., in the API), members are similarly + * identified except the block name is always used in place of the instance + * name (API accesses are to interfaces, not to shaders). If there is no + * instance name, then the API does not use the block name to access a member, + * just the member name." + * + * "For blocks declared as arrays, the array index must also be included when + * accessing members" + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 32; + config.supports_gl_core_version = 32; + +PIGLIT_GL_TEST_CONFIG_END + +static const char *vstext = + "#version 150\n" + "in vec4 vertex;\n" + "void main()\n" + "{\n" + " gl_Position = vertex;\n" + "}\n"; + +static const char *gstext = + "#version 150\n" + "layout(points) in;\n" + "layout(points, max_vertices = 3) out;\n" + "out NoInst {\n" + " float a;\n" + " vec3 b;\n" + "};\n" + "out WithInst {\n" + " float c;\n" + " vec3 d;\n" + "} inst;\n" + "out WithInstArray {\n" + " float e;\n" + " vec3 f;\n" + "} instArray[3];\n" + "void main()\n" + "{\n" + " a = 1.0;\n" + " b = vec3(2.0);\n" + " inst.c = 3.0;\n" + " inst.d = vec3(4.0);\n" + " for(int i = 0; i < 3; i++) {\n" + " instArray[i].e = 5.0 + 2 * i;\n
[Piglit] [PATCH v4] 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 v4: Make test work with POSIX_CLOCKS and some other minor changes --- tests/all.tests | 1 + tests/spec/arb_sync/CMakeLists.gl.txt| 1 + tests/spec/arb_sync/ClientWaitSync-returns.c | 183 +++ 3 files changed, 185 insertions(+) create mode 100644 tests/spec/arb_sync/ClientWaitSync-returns.c diff --git a/tests/all.tests b/tests/all.tests index c919f19..bdebbcd 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -1108,6 +1108,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-client-wait-errors') +arb_sync['ClientWaitSync-returns'] = concurrent_test('arb_sync-client-wait-returns') arb_sync['DeleteSync'] = concurrent_test('arb_sync-delete') arb_sync['FenceSync-errors'] = concurrent_test('arb_sync-fence-sync-errors') arb_sync['GetSynciv-errors'] = concurrent_test('arb_sync-get-sync-errors') diff --git a/tests/spec/arb_sync/CMakeLists.gl.txt b/tests/spec/arb_sync/CMakeLists.gl.txt index e5fcb90..901e20f 100644 --- a/tests/spec/arb_sync/CMakeLists.gl.txt +++ b/tests/spec/arb_sync/CMakeLists.gl.txt @@ -11,6 +11,7 @@ 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 DeleteSync.c) piglit_add_executable (arb_sync-fence-sync-errors FenceSync-errors.c) piglit_add_executable (arb_sync-get-sync-errors GetSynciv-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..c78fb57 --- /dev/null +++ b/tests/spec/arb_sync/ClientWaitSync-returns.c @@ -0,0 +1,183 @@ +/** + * 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; + + double seconds_elapsed = -1; + int64_t start = 0, end = 0; + + + 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 = glFenceSync(GL
[Piglit] [PATCH 1/4 v3] GS: Test that geometry shader input/output layout qualifiers only compile if valid
v2: Tests check against list of valid layouts instead of invalid layouts v3: Remove vertex shader info, remove linking, check compile status, rewrite error messages --- tests/all.tests| 12 ++ .../glsl-1.50/execution/geometry/CMakeLists.gl.txt | 2 + .../geometry/gs-input-layout-qualifiers.c | 133 + .../geometry/gs-output-layout-qualifiers.c | 130 4 files changed, 277 insertions(+) create mode 100644 tests/spec/glsl-1.50/execution/geometry/gs-input-layout-qualifiers.c create mode 100644 tests/spec/glsl-1.50/execution/geometry/gs-output-layout-qualifiers.c diff --git a/tests/all.tests b/tests/all.tests index c919f19..2485b39 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -1017,6 +1017,18 @@ for prim_type in ['GL_TRIANGLE_STRIP', 'GL_TRIANGLE_STRIP_ADJACENCY']: 'glsl-1.50-geometry-tri-strip-ordering-with-prim-restart {0} {1}'.format( prim_type, restart_index)) +for input_layout in ['points', 'lines', 'lines_adjacency', 'triangles', + 'triangles_adjacency', 'line_strip', 'triangle_strip']: +add_concurrent_test(spec['glsl-1.50'], +'glsl-1.50-gs-input-layout-qualifiers {0}'.format( +input_layout)) + +for output_layout in ['points', 'lines', 'lines_adjacency', 'triangles', + 'triangles_adjacency', 'line_strip', 'triangle_strip']: +add_concurrent_test(spec['glsl-1.50'], +'glsl-1.50-gs-output-layout-qualifiers {0}'.format( +output_layout)) + spec['glsl-3.30'] = Group() import_glsl_parser_tests(spec['glsl-3.30'], os.path.join(testsDir, 'spec', 'glsl-3.30'), diff --git a/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt b/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt index 3e6bc4b..d759c6b 100644 --- a/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt +++ b/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt @@ -19,3 +19,5 @@ piglit_add_executable (glsl-1.50-gs-emits-too-few-verts gs-emits-too-few-verts.c piglit_add_executable (glsl-1.50-getshaderiv-may-return-GS getshaderiv-may-return-GS.c) piglit_add_executable (glsl-1.50-gs-mismatch-prim-type gs-mismatch-prim-type.c) piglit_add_executable (glsl-1.50-query-gs-prim-types query-gs-prim-types.c) +piglit_add_executable (glsl-1.50-gs-input-layout-qualifiers gs-input-layout-qualifiers.c) +piglit_add_executable (glsl-1.50-gs-output-layout-qualifiers gs-output-layout-qualifiers.c) diff --git a/tests/spec/glsl-1.50/execution/geometry/gs-input-layout-qualifiers.c b/tests/spec/glsl-1.50/execution/geometry/gs-input-layout-qualifiers.c new file mode 100644 index 000..0afc4e8 --- /dev/null +++ b/tests/spec/glsl-1.50/execution/geometry/gs-input-layout-qualifiers.c @@ -0,0 +1,133 @@ +/** + * 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 that geometry shaders only compile with valid input layout qualifiers + * + * Section 4.3.8.1(Input Layout Qualifiers) of the GLSL 1.50 spec says: + * "Geometry shaders allow input layout qualifiers only on the interface + * qualifier in, not on an input block, block member, or variable. The layout + * qualifier identifiers for geometry shader inputs are + * points + * lines + * lines_adjacency + * triangles + * triangles_adjacency" + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 32; +config.supports_gl_core_version = 32; + + config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE; + +PIGLIT_GL_TEST_CONFIG_END + +static const char *gstemplate = + "#version 150\n" + "#define LAYOUT_IN %s\n" +
[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
[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 + * SYNC_STATUSUNSIGNALED + * SYNC_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) { +
[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 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 --- 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 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 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 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 */ + glGetSync
[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 = glFe
[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 is not the name of a sync object, an INVALID_VALUE error + * is generated. If 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_repor
[Piglit] [PATCH] Fix for bug #70015
Cc: "Vinson Lee" Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70015 --- tests/spec/gl-3.2/get-active-attrib-returns-all-inputs.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/spec/gl-3.2/get-active-attrib-returns-all-inputs.c b/tests/spec/gl-3.2/get-active-attrib-returns-all-inputs.c index c604eb2..624de85 100644 --- a/tests/spec/gl-3.2/get-active-attrib-returns-all-inputs.c +++ b/tests/spec/gl-3.2/get-active-attrib-returns-all-inputs.c @@ -72,7 +72,6 @@ static const char *fstext = "}\n"; static GLuint prog; -const int bufSize = 100; bool check_that_attrib_is_active(const char *attrib_name) @@ -82,11 +81,11 @@ check_that_attrib_is_active(const char *attrib_name) GLsizei length; GLint size; GLenum type; - GLchar name[bufSize]; + GLchar name[100]; glGetProgramiv(prog, GL_ACTIVE_ATTRIBUTES, &numAttribs); for (i = 0; i < numAttribs; i++) { - glGetActiveAttrib(prog, i, bufSize, &length, &size, + glGetActiveAttrib(prog, i, 100, &length, &size, &type, name); if (strcmp(name, attrib_name) == 0) { return piglit_check_gl_error(GL_NO_ERROR); -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH v2] GL 3.2: Test that GetTexLevelParameterfv() generates an error when passed TEXTURE_BORDER
v2: Multiple fixes and added to all.tests --- tests/all.tests | 1 + tests/spec/gl-3.2/CMakeLists.gl.txt | 1 + tests/spec/gl-3.2/texture-border-deprecated.c | 66 +++ 3 files changed, 68 insertions(+) create mode 100644 tests/spec/gl-3.2/texture-border-deprecated.c diff --git a/tests/all.tests b/tests/all.tests index dadd98e..93d91f8 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -749,6 +749,7 @@ spec['!OpenGL 3.2/layered-rendering/clear-color'] = concurrent_test('gl-3.2-laye spec['!OpenGL 3.2/layered-rendering/clear-depth'] = concurrent_test('gl-3.2-layered-rendering-clear-depth') spec['!OpenGL 3.2/layered-rendering/framebuffertexture-buffer-textures'] = concurrent_test('gl-3.2-layered-rendering-framebuffertexture-buffer-textures') spec['!OpenGL 3.2/layered-rendering/readpixels'] = concurrent_test('gl-3.2-layered-rendering-readpixels') +spec['!OpenGL 3.2/texture-border-deprecated'] = concurrent_test('gl-3.2-texture-border-deprecated') spec['!OpenGL 3.3/minmax'] = concurrent_test('gl-3.3-minmax') spec['!OpenGL 3.3/required-renderbuffer-attachment-formats'] = concurrent_test('gl-3.0-required-renderbuffer-attachment-formats 33') diff --git a/tests/spec/gl-3.2/CMakeLists.gl.txt b/tests/spec/gl-3.2/CMakeLists.gl.txt index 9fc0a75..39e829a 100644 --- a/tests/spec/gl-3.2/CMakeLists.gl.txt +++ b/tests/spec/gl-3.2/CMakeLists.gl.txt @@ -14,4 +14,5 @@ piglit_add_executable (gl-3.2-clear-no-buffers clear-no-buffers.c) piglit_add_executable (gl-3.2-get-buffer-parameter-i64v get-buffer-parameter-i64v.c) piglit_add_executable (gl-3.2-get-integer-64iv get-integer-64iv.c) piglit_add_executable (gl-3.2-get-integer-64v get-integer-64v.c) +piglit_add_executable (gl-3.2-texture-border-deprecated texture-border-deprecated.c) # vim: ft=cmake: diff --git a/tests/spec/gl-3.2/texture-border-deprecated.c b/tests/spec/gl-3.2/texture-border-deprecated.c new file mode 100644 index 000..6aa9933 --- /dev/null +++ b/tests/spec/gl-3.2/texture-border-deprecated.c @@ -0,0 +1,66 @@ +/** + * 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 GetTexLevelParameterfv() generates an error if passed + * TEXTURE_BORDER. + * + * In GL 3.2 core spec section 6.1.3 (Enumerated Queries), TEXTURE_BORDER is not + * included in the list of acceptable targets for GetTexLevelParameterfv() + * + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_core_version = 32; + config.supports_gl_compat_version = 0; + +PIGLIT_GL_TEST_CONFIG_END + +void +piglit_init(int argc, char **argv) +{ + bool pass = true; + GLfloat data = -1; + GLuint tex; + + glGenTextures(1, &tex); + glBindTexture(GL_TEXTURE_2D, tex); + + glGetTexLevelParameterfv(GL_TEXTURE_2D, 0, GL_TEXTURE_BORDER, &data); + + if (!piglit_check_gl_error(GL_INVALID_ENUM)) + pass = false; + + piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); +} + +enum piglit_result +piglit_display(void) +{ + /* UNREACHED */ + return PIGLIT_FAIL; +} -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 3/4] GS: Test geometry output layout qualifier rules
v2: Split first test into two separate tests and remove the unnecessary second test --- ...-one-out-declaration-per-program-max-verts.geom | 22 ++ ...-one-out-declaration-per-program-prim-type.geom | 22 ++ .../compiler/layout-out-order-irrelevant.geom | 22 ++ 3 files changed, 66 insertions(+) create mode 100644 tests/spec/glsl-1.50/compiler/layout-only-one-out-declaration-per-program-max-verts.geom create mode 100644 tests/spec/glsl-1.50/compiler/layout-only-one-out-declaration-per-program-prim-type.geom create mode 100644 tests/spec/glsl-1.50/compiler/layout-out-order-irrelevant.geom diff --git a/tests/spec/glsl-1.50/compiler/layout-only-one-out-declaration-per-program-max-verts.geom b/tests/spec/glsl-1.50/compiler/layout-only-one-out-declaration-per-program-max-verts.geom new file mode 100644 index 000..c3b067f --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/layout-only-one-out-declaration-per-program-max-verts.geom @@ -0,0 +1,22 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// check_link: true +// [end config] +// +// Section 4.3.8.2(Output Layout Qualifiers) of the GLSL 1.50 spec says: +// "All geometry shader output layout declarations in a program must declare the +// same layout and same value for max_vertices." + +#version 150 + +layout(lines) in; +layout(line_strip, max_vertices=2) out; + +in vec4 pos[]; + +layout(line_strip, max_vertices=3) out; + +void main() +{ +} diff --git a/tests/spec/glsl-1.50/compiler/layout-only-one-out-declaration-per-program-prim-type.geom b/tests/spec/glsl-1.50/compiler/layout-only-one-out-declaration-per-program-prim-type.geom new file mode 100644 index 000..d19932e --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/layout-only-one-out-declaration-per-program-prim-type.geom @@ -0,0 +1,22 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// check_link: true +// [end config] +// +// Section 4.3.8.2(Output Layout Qualifiers) of the GLSL 1.50 spec says: +// "All geometry shader output layout declarations in a program must declare the +// same layout and same value for max_vertices." + +#version 150 + +layout(lines) in; +layout(line_strip, max_vertices=3) out; + +in vec4 pos[]; + +layout(triangle_strip, max_vertices=3) out; + +void main() +{ +} diff --git a/tests/spec/glsl-1.50/compiler/layout-out-order-irrelevant.geom b/tests/spec/glsl-1.50/compiler/layout-out-order-irrelevant.geom new file mode 100644 index 000..05c2b21 --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/layout-out-order-irrelevant.geom @@ -0,0 +1,22 @@ +// [config] +// expect_result: pass +// glsl_version: 1.50 +// check_link: true +// [end config] +// +// Section 4.3.8 (Layout Qualifiers) of the GLSL 1.50 spec says: +// "The tokens in any layout-qualifier-id-list are identifiers, not keywords. +// Generally, they can be listed in any order." +// +// Section 4.3.8.2(Output Layout Qualifiers) of the GLSL 1.50 spec says: +// "One declaration can declare either a primitive type (points, line_strip, or +// triangle_strip), or max_vertices, or both." + +#version 150 + +layout(triangles) in; +layout(max_vertices = 3, triangle_strip) out; + +void main() +{ +} -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 2/4] GS: Test geometry input layout qualifier rules
v2: Remove unnecessary test --- .../compiler/layout-in-only-one-qualifier-id.geom | 25 ++ 1 file changed, 25 insertions(+) create mode 100644 tests/spec/glsl-1.50/compiler/layout-in-only-one-qualifier-id.geom diff --git a/tests/spec/glsl-1.50/compiler/layout-in-only-one-qualifier-id.geom b/tests/spec/glsl-1.50/compiler/layout-in-only-one-qualifier-id.geom new file mode 100644 index 000..937c342 --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/layout-in-only-one-qualifier-id.geom @@ -0,0 +1,25 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// check_link: true +// [end config] +// +// Section 4.3.8.1(Input Layout Qualifiers) of the GLSL 1.50 spec says: +// "Geometry shaders allow input layout qualifiers only on the interface +// qualifier in, not on an input block, block member, or variable. The layout +// qualifier identifiers for geometry shader inputs are +// points +// lines +// lines_adjacency +// triangles +// triangles_adjacency +// Only one argument is accepted." + +#version 150 + +layout(points, triangles_adjacency) in; +layout(points, max_vertices = 1) out; + +void main() +{ +} -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 4/4 v2] GS: Test that max_vertices cannot be set to INT_MAX
v2: Add comment Reviewed-by: Paul Berry --- .../compiler/layout-max-verts-limited.geom | 23 ++ 1 file changed, 23 insertions(+) create mode 100644 tests/spec/glsl-1.50/compiler/layout-max-verts-limited.geom diff --git a/tests/spec/glsl-1.50/compiler/layout-max-verts-limited.geom b/tests/spec/glsl-1.50/compiler/layout-max-verts-limited.geom new file mode 100644 index 000..9b763a7 --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/layout-max-verts-limited.geom @@ -0,0 +1,23 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// check_link: true +// [end config] +// +// Section 4.3.8 (Output Layout Qualifiers) of the GLSL 1.50 spec says: +// "It is an error for the maximum number of vertices to be greater than +// gl_MaxGeometryOutputVertices." +// +// Unfortunately, we can't easlily try to set max_vertices to +// gl_MaxGeometryOutputVertices+1, since "max_vertices=" must be +// followed by an integer-constant (not a constant expression), so as +// a stop gap, we just verify that setting max_vertices = INT_MAX +// leads to an error. + +#version 150 + +layout(max_vertices = 2147483647) out; + +void main() +{ +} -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 1/4] GS: Test that geometry shader input/output layout qualifiers only compile if valid
v2: Tests check against list of valid layouts instead of invalid layouts --- tests/all.tests| 12 ++ .../glsl-1.50/execution/geometry/CMakeLists.gl.txt | 2 + .../geometry/gs-input-layout-qualifiers.c | 128 + .../geometry/gs-output-layout-qualifiers.c | 125 4 files changed, 267 insertions(+) create mode 100644 tests/spec/glsl-1.50/execution/geometry/gs-input-layout-qualifiers.c create mode 100644 tests/spec/glsl-1.50/execution/geometry/gs-output-layout-qualifiers.c diff --git a/tests/all.tests b/tests/all.tests index d0085d3..f66d9f9 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -999,6 +999,18 @@ for prim_type in ['GL_TRIANGLE_STRIP', 'GL_TRIANGLE_STRIP_ADJACENCY']: 'glsl-1.50-geometry-tri-strip-ordering-with-prim-restart {0} {1}'.format( prim_type, restart_index)) +for input_layout in ['points', 'lines', 'lines_adjacency', 'triangles', + 'triangles_adjacency', 'line_strip', 'triangle_strip']: +add_concurrent_test(spec['glsl-1.50'], +'glsl-1.50-gs-input-layout-qualifiers {0}'.format( +input_layout)) + +for output_layout in ['points', 'lines', 'lines_adjacency', 'triangles', + 'triangles_adjacency', 'line_strip', 'triangle_strip']: +add_concurrent_test(spec['glsl-1.50'], +'glsl-1.50-gs-output-layout-qualifiers {0}'.format( +output_layout)) + spec['glsl-3.30'] = Group() import_glsl_parser_tests(spec['glsl-3.30'], os.path.join(testsDir, 'spec', 'glsl-3.30'), diff --git a/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt b/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt index f168f0a..6fc1986 100644 --- a/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt +++ b/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt @@ -18,3 +18,5 @@ piglit_add_executable (glsl-1.50-gs-emits-too-few-verts gs-emits-too-few-verts.c piglit_add_executable (glsl-1.50-getshaderiv-may-return-GS getshaderiv-may-return-GS.c) piglit_add_executable (glsl-1.50-gs-mismatch-prim-type gs-mismatch-prim-type.c) piglit_add_executable (glsl-1.50-query-gs-prim-types query-gs-prim-types.c) +piglit_add_executable (glsl-1.50-gs-input-layout-qualifiers gs-input-layout-qualifiers.c) +piglit_add_executable (glsl-1.50-gs-output-layout-qualifiers gs-output-layout-qualifiers.c) diff --git a/tests/spec/glsl-1.50/execution/geometry/gs-input-layout-qualifiers.c b/tests/spec/glsl-1.50/execution/geometry/gs-input-layout-qualifiers.c new file mode 100644 index 000..82ec9c5 --- /dev/null +++ b/tests/spec/glsl-1.50/execution/geometry/gs-input-layout-qualifiers.c @@ -0,0 +1,128 @@ +/** + * 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 that geometry shaders only compile with valid input layout qualifiers + * + * Section 4.3.8.1(Input Layout Qualifiers) of the GLSL 1.50 spec says: + * "Geometry shaders allow input layout qualifiers only on the interface + * qualifier in, not on an input block, block member, or variable. The layout + * qualifier identifiers for geometry shader inputs are + * points + * lines + * lines_adjacency + * triangles + * triangles_adjacency" + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 32; +config.supports_gl_core_version = 32; + + config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE; + +PIGLIT_GL_TEST_CONFIG_END + +static const char *vstext = + "#version 150\n" + "in vec4 vertex;\n" + "void main() {\n" + " gl_Position = vertex;\n" + "}\n"; + +static const char *gstempl
[Piglit] [PATCH v2] Test that all vertex shader inputs are enumerated by GetActiveAttrib(). This includes built-ins such as gl_InstanceID and gl_VertexID.
v2: Restructure test to check attrib names on an individual basis --- tests/all.tests| 2 + tests/spec/gl-3.2/CMakeLists.gl.txt| 1 + .../gl-3.2/get-active-attrib-returns-all-inputs.c | 127 + 3 files changed, 130 insertions(+) create mode 100644 tests/spec/gl-3.2/get-active-attrib-returns-all-inputs.c diff --git a/tests/all.tests b/tests/all.tests index d0085d3..bec4f9b 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -750,6 +750,8 @@ spec['!OpenGL 3.2/layered-rendering/clear-depth'] = concurrent_test('gl-3.2-laye spec['!OpenGL 3.2/layered-rendering/framebuffertexture-buffer-textures'] = concurrent_test('gl-3.2-layered-rendering-framebuffertexture-buffer-textures') spec['!OpenGL 3.2/layered-rendering/readpixels'] = concurrent_test('gl-3.2-layered-rendering-readpixels') +spec['!OpenGL/get-active-attrib-returns-all-inputs'] = concurrent_test('gl-get-active-attrib-returns-all-inputs') + spec['!OpenGL 3.3/minmax'] = concurrent_test('gl-3.3-minmax') spec['!OpenGL 3.3/required-renderbuffer-attachment-formats'] = concurrent_test('gl-3.0-required-renderbuffer-attachment-formats 33') spec['!OpenGL 3.3/required-sized-texture-formats'] = concurrent_test('gl-3.0-required-sized-texture-formats 33') diff --git a/tests/spec/gl-3.2/CMakeLists.gl.txt b/tests/spec/gl-3.2/CMakeLists.gl.txt index 9fc0a75..224f6fd 100644 --- a/tests/spec/gl-3.2/CMakeLists.gl.txt +++ b/tests/spec/gl-3.2/CMakeLists.gl.txt @@ -9,6 +9,7 @@ link_libraries ( ${OPENGL_glu_LIBRARY} ) +piglit_add_executable (gl-get-active-attrib-returns-all-inputs get-active-attrib-returns-all-inputs.c) piglit_add_executable (gl-3.2-minmax minmax.c) piglit_add_executable (gl-3.2-clear-no-buffers clear-no-buffers.c) piglit_add_executable (gl-3.2-get-buffer-parameter-i64v get-buffer-parameter-i64v.c) diff --git a/tests/spec/gl-3.2/get-active-attrib-returns-all-inputs.c b/tests/spec/gl-3.2/get-active-attrib-returns-all-inputs.c new file mode 100644 index 000..8cc1461 --- /dev/null +++ b/tests/spec/gl-3.2/get-active-attrib-returns-all-inputs.c @@ -0,0 +1,127 @@ +/** + * 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 that built-in vertex input variables are enumerated by GetActiveAttrib() + * + * This is not explicitly stated in any specs before 4.3 core but it seems to + * be clarified in later specs + * + * From GL 4.3 core spec, section 11.1.1 (Vertex Attributes): + * "For GetActiveAttrib, all active vertex shader input variables are + * enumerated, including the special built-in inputs gl_VertexID and + * gl_InstanceID." + * + * From GL 4.3 core spec, section F.5 (Change Log for Released Specifications): + * "Specify in section 11.1.1 that special built-in inputs and outputs such as + * gl_VertexID should be enumerated in the PROGRAM_INPUT and PROGRAM_OUTPUT + * interfaces, as well as the legacy function GetActiveAttrib. Add spec + * language counting the built-ins gl_VertexID and gl_InstanceID against the + * active attribute limit (Bug 9201)." + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 31; +config.supports_gl_core_version = 31; + + config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE; + +PIGLIT_GL_TEST_CONFIG_END + +static const char *vstext = + "#version 140\n" + "in vec4 piglit_vertex;\n" + "flat out int instID;\n" + "flat out int vertID;\n" + "void main() {\n" + " gl_Position = piglit_vertex;\n" + " instID = gl_InstanceID;\n" + " vertID = gl_VertexID;\n" + "}\n"; + +static const char *fstext = + "#version 140\n" + "flat in int instID;\n" + "flat in int vertID;\n" + "out vec4 color;\n" + "void main() {\n" + "
[Piglit] [PATCH] GL 3.2: Test that GetTexLevelParameterfv() generates an error when passed TEXTURE_BORDER
--- tests/spec/gl-3.2/CMakeLists.gl.txt | 1 + tests/spec/gl-3.2/texture-border-deprecated.c | 63 +++ 2 files changed, 64 insertions(+) create mode 100644 tests/spec/gl-3.2/texture-border-deprecated.c diff --git a/tests/spec/gl-3.2/CMakeLists.gl.txt b/tests/spec/gl-3.2/CMakeLists.gl.txt index 9fc0a75..39e829a 100644 --- a/tests/spec/gl-3.2/CMakeLists.gl.txt +++ b/tests/spec/gl-3.2/CMakeLists.gl.txt @@ -14,4 +14,5 @@ piglit_add_executable (gl-3.2-clear-no-buffers clear-no-buffers.c) piglit_add_executable (gl-3.2-get-buffer-parameter-i64v get-buffer-parameter-i64v.c) piglit_add_executable (gl-3.2-get-integer-64iv get-integer-64iv.c) piglit_add_executable (gl-3.2-get-integer-64v get-integer-64v.c) +piglit_add_executable (gl-3.2-texture-border-deprecated texture-border-deprecated.c) # vim: ft=cmake: diff --git a/tests/spec/gl-3.2/texture-border-deprecated.c b/tests/spec/gl-3.2/texture-border-deprecated.c new file mode 100644 index 000..7ba69d5 --- /dev/null +++ b/tests/spec/gl-3.2/texture-border-deprecated.c @@ -0,0 +1,63 @@ +/** + * 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 that GetTexLevelParameterfv() generates an error if passed + * TEXTURE_BORDER. + * + * In GL 3.2 core spec section 6.1.3 (Enumerated Queries), TEXTURE_BORDER is not + * included in the list of acceptable targets for GetTexLevelParameterfv() + * + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_core_version = 32; + config.supports_gl_compat_version = 32; + +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; + GLfloat data = -1; + + glGetTexLevelParameterfv(GL_TEXTURE_2D, 0, GL_TEXTURE_BORDER, &data); + + if(piglit_check_gl_error(GL_NO_ERROR)) { + printf("Expected an error but did not recieve any.\n"); + pass = false; + } + + 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] Test that all vertex shader inputs are enumerated by GetActiveAttrib(). This includes built-ins such as gl_InstanceID and gl_VertexID.
--- tests/all.tests| 2 + tests/spec/gl-3.2/CMakeLists.gl.txt| 1 + .../gl-3.2/get-active-attrib-returns-all-inputs.c | 117 + 3 files changed, 120 insertions(+) create mode 100644 tests/spec/gl-3.2/get-active-attrib-returns-all-inputs.c diff --git a/tests/all.tests b/tests/all.tests index 2d6a52e..153fe9e 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -750,6 +750,8 @@ spec['!OpenGL 3.2/layered-rendering/clear-depth'] = concurrent_test('gl-3.2-laye spec['!OpenGL 3.2/layered-rendering/framebuffertexture-buffer-textures'] = concurrent_test('gl-3.2-layered-rendering-framebuffertexture-buffer-textures') spec['!OpenGL 3.2/layered-rendering/readpixels'] = concurrent_test('gl-3.2-layered-rendering-readpixels') +spec['!OpenGL/get-active-attrib-returns-all-inputs'] = concurrent_test('gl-get-active-attrib-returns-all-inputs') + spec['!OpenGL 3.3/minmax'] = concurrent_test('gl-3.3-minmax') spec['!OpenGL 3.3/required-renderbuffer-attachment-formats'] = concurrent_test('gl-3.0-required-renderbuffer-attachment-formats 33') spec['!OpenGL 3.3/required-sized-texture-formats'] = concurrent_test('gl-3.0-required-sized-texture-formats 33') diff --git a/tests/spec/gl-3.2/CMakeLists.gl.txt b/tests/spec/gl-3.2/CMakeLists.gl.txt index 9fc0a75..224f6fd 100644 --- a/tests/spec/gl-3.2/CMakeLists.gl.txt +++ b/tests/spec/gl-3.2/CMakeLists.gl.txt @@ -9,6 +9,7 @@ link_libraries ( ${OPENGL_glu_LIBRARY} ) +piglit_add_executable (gl-get-active-attrib-returns-all-inputs get-active-attrib-returns-all-inputs.c) piglit_add_executable (gl-3.2-minmax minmax.c) piglit_add_executable (gl-3.2-clear-no-buffers clear-no-buffers.c) piglit_add_executable (gl-3.2-get-buffer-parameter-i64v get-buffer-parameter-i64v.c) diff --git a/tests/spec/gl-3.2/get-active-attrib-returns-all-inputs.c b/tests/spec/gl-3.2/get-active-attrib-returns-all-inputs.c new file mode 100644 index 000..fe48b79 --- /dev/null +++ b/tests/spec/gl-3.2/get-active-attrib-returns-all-inputs.c @@ -0,0 +1,117 @@ +/** + * 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 that built-in vertex input variables are enumerated by GetActiveAttrib() + * + * This is not explicitly stated in any specs before 4.3 core but it seems to + * be clarified in later specs + * + * From GL 4.3 core spec, section 11.1.1 (Vertex Attributes): + * "For GetActiveAttrib, all active vertex shader input variables are + * enumerated, including the special built-in inputs gl_VertexID and + * gl_InstanceID." + * + * From GL 4.3 core spec, section F.5 (Change Log for Released Specifications): + * "Specify in section 11.1.1 that special built-in inputs and outputs such as + * gl_VertexID should be enumerated in the PROGRAM_INPUT and PROGRAM_OUTPUT + * interfaces, as well as the legacy function GetActiveAttrib. Add spec + * language counting the built-ins gl_VertexID and gl_InstanceID against the + * active attribute limit (Bug 9201)." + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 31; +config.supports_gl_core_version = 31; + + config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE; + +PIGLIT_GL_TEST_CONFIG_END + +static const char *vstext = + "#version 140\n" + "in vec4 piglit_vertex;\n" + "flat out int instID;\n" + "flat out int vertID;\n" + "void main() {\n" + " gl_Position = piglit_vertex;\n" + " instID = gl_InstanceID;\n" + " vertID = gl_VertexID;\n" + "}\n"; + +static const char *fstext = + "#version 140\n" + "flat in int instID;\n" + "flat in int vertID;\n" + "out vec4 color;\n" + "void main() {\n" + " color = vec4(instID + vertID);\n" + "}\n"; + +static GLui
[Piglit] [PATCH 2/2] GLSL 1.50: Test that multiple shaders of version 140 and 150 can be linked together
--- ...ons-mingled-multiple-shader-objects.shader_test | 52 ++ 1 file changed, 52 insertions(+) create mode 100644 tests/spec/glsl-1.50/linker/versions-mingled-multiple-shader-objects.shader_test diff --git a/tests/spec/glsl-1.50/linker/versions-mingled-multiple-shader-objects.shader_test b/tests/spec/glsl-1.50/linker/versions-mingled-multiple-shader-objects.shader_test new file mode 100644 index 000..399b442 --- /dev/null +++ b/tests/spec/glsl-1.50/linker/versions-mingled-multiple-shader-objects.shader_test @@ -0,0 +1,52 @@ +# Tests that GLSL 1.40 and GLSL 1.50 shaders may be linked together +# +# GLSL 1.50 Spec, 3.3 (): +# "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 do_test(int b); + +void main() +{ + gl_Position = a; + do_test(8); +} + +[vertex shader] +#version 150 + +void do_test(int b) +{ + gl_Position = vec4(b); +} + +[fragment shader] +#version 140 + +void do_stuff(float b); + +void main() +{ + gl_FragColor = vec4(1.); + do_stuff(.5); +} + +[fragment shader] +#version 150 + +void do_stuff(float b) +{ + gl_FragColor = vec4(b); +} + +[test] + + -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 1/2] GLSL 1.50: Test that version 140 and version 150 shaders can be linked together
--- .../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 (): +# "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] [PATCH 3/4] GLSL 1.50 Interface blocks: Test that interface blocks cannot have initializers or sampler types within the block.
--- ...terface-blocks-no-initializer-within-block.vert | 25 ++ ...erface-blocks-no-sampler-type-within-block.vert | 24 + 2 files changed, 49 insertions(+) create mode 100644 tests/spec/glsl-1.50/compiler/interface-blocks-no-initializer-within-block.vert create mode 100644 tests/spec/glsl-1.50/compiler/interface-blocks-no-sampler-type-within-block.vert diff --git a/tests/spec/glsl-1.50/compiler/interface-blocks-no-initializer-within-block.vert b/tests/spec/glsl-1.50/compiler/interface-blocks-no-initializer-within-block.vert new file mode 100644 index 000..d902a4d --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/interface-blocks-no-initializer-within-block.vert @@ -0,0 +1,25 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// check_link: true +// [end config] +// +// Tests that an initializer is not allowed within a block. +// +// GLSLangSpec.1.50.11, 4.3.7 Interface Blocks: +// "Types and declarators are the same as for other input, output, and uniform +// variable declarations outside blocks, with these exceptions: +// • initializers are not allowed +// • sampler types are not allowed +// • structure definitions cannot be nested inside a block" + +#version 150 + +out block { + vec4 a(1., 0., 0., 1.); +} inst; + +void main() +{ + inst.a = vec4(0.); +} diff --git a/tests/spec/glsl-1.50/compiler/interface-blocks-no-sampler-type-within-block.vert b/tests/spec/glsl-1.50/compiler/interface-blocks-no-sampler-type-within-block.vert new file mode 100644 index 000..8055c72 --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/interface-blocks-no-sampler-type-within-block.vert @@ -0,0 +1,24 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// check_link: true +// [end config] +// +// Tests that an initializer is not allowed within a block. +// +// GLSLangSpec.1.50.11, 4.3.7 Interface Blocks: +// "Types and declarators are the same as for other input, output, and uniform +// variable declarations outside blocks, with these exceptions: +// • initializers are not allowed +// • sampler types are not allowed +// • structure definitions cannot be nested inside a block" + +#version 150 + +out block { + sampler2DShadow a; +} inst; + +void main() +{ +} -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 4/4] Interface Blocks: Test how interface block members are accessed from API
--- tests/all.tests| 1 + tests/spec/glsl-1.50/execution/CMakeLists.gl.txt | 1 + .../interface-blocks-api-access-members.c | 141 + 3 files changed, 143 insertions(+) create mode 100644 tests/spec/glsl-1.50/execution/interface-blocks-api-access-members.c diff --git a/tests/all.tests b/tests/all.tests index 2d6a52e..e5a590c 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -950,6 +950,7 @@ import_glsl_parser_tests(spec['glsl-1.50'], add_shader_test_dir(spec['glsl-1.50'], os.path.join(testsDir, 'spec', 'glsl-1.50'), recursive=True) +spec['glsl-1.50']['execution']['interface-blocks-api-access-members'] = concurrent_test('glsl-1.50-interface-blocks-api-access-members') spec['glsl-1.50']['execution']['get-active-attrib-array'] = concurrent_test('glsl-1.50-get-active-attrib-array') spec['glsl-1.50']['execution']['vs-input-arrays'] = concurrent_test('glsl-1.50-vs-input-arrays') for draw in ['', 'indexed']: diff --git a/tests/spec/glsl-1.50/execution/CMakeLists.gl.txt b/tests/spec/glsl-1.50/execution/CMakeLists.gl.txt index 67a5e00..b1bf6e5 100644 --- a/tests/spec/glsl-1.50/execution/CMakeLists.gl.txt +++ b/tests/spec/glsl-1.50/execution/CMakeLists.gl.txt @@ -12,3 +12,4 @@ ${OPENGL_glu_LIBRARY} piglit_add_executable (glsl-1.50-vs-input-arrays vs-input-arrays.c) piglit_add_executable (glsl-1.50-get-active-attrib-array get-active-attrib-array.c) +piglit_add_executable (glsl-1.50-interface-blocks-api-access-members interface-blocks-api-access-members.c) diff --git a/tests/spec/glsl-1.50/execution/interface-blocks-api-access-members.c b/tests/spec/glsl-1.50/execution/interface-blocks-api-access-members.c new file mode 100644 index 000..af48dfa --- /dev/null +++ b/tests/spec/glsl-1.50/execution/interface-blocks-api-access-members.c @@ -0,0 +1,141 @@ +/** + * 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 the syntax for accessing interface block members through the API + * + * From the GLSL 1.50 core spec, section 4.3.7 (Interface Blocks): + * "Outside the shading language (i.e., in the API), members are similarly + * identified except the block name is always used in place of the instance + * name (API accesses are to interfaces, not to shaders). If there is no + * instance name, then the API does not use the block name to access a member, + * just the member name." + * + * "For blocks declared as arrays, the array index must also be included when + * accessing members" + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 32; + config.supports_gl_core_version = 32; + +PIGLIT_GL_TEST_CONFIG_END + +static const char *vstext = + "#version 150\n" + "in vec4 vertex;\n" + "void main()\n" + "{\n" + " gl_Position = vertex;\n" + "}\n"; + +static const char *gstext = + "#version 150\n" + "layout(points) in;\n" + "layout(points, max_vertices = 3) out;\n" + "out NoInst {\n" + " float a;\n" + " vec3 b;\n" + "};\n" + "out WithInst {\n" + " float c;\n" + " vec3 d;\n" + "} inst;\n" + "out WithInstArray {\n" + " float e;\n" + " vec3 f;\n" + "} instArray[3];\n" + "void main()\n" + "{\n" + " a = 1.0;\n" + " b = vec3(2.0);\n" + " inst.c = 3.0;\n" + " inst.d = vec3(4.0);\n" + " for(int i = 0; i < 3; i++) {\n" + " instArray[i].e = 5.0 + 2 * i;\n" + " instArray[i].f = vec3(6.0 + 2 * i);\n" + " }\n" + "}\n"; + +static GLuint prog; + +static const char *varyings[] = { "a", "b", + //should n
[Piglit] [PATCH 2/4] GLSL 1.50 Interface blocks: Test that the array index must be used to access a member of a block declared in an array.
--- ...locks-array-index-needed-to-access-members.vert | 25 ++ 1 file changed, 25 insertions(+) create mode 100644 tests/spec/glsl-1.50/compiler/interface-blocks-array-index-needed-to-access-members.vert diff --git a/tests/spec/glsl-1.50/compiler/interface-blocks-array-index-needed-to-access-members.vert b/tests/spec/glsl-1.50/compiler/interface-blocks-array-index-needed-to-access-members.vert new file mode 100644 index 000..1a491af --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/interface-blocks-array-index-needed-to-access-members.vert @@ -0,0 +1,25 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// check_link: true +// [end config] +// +// Tests that in order to access a block member in a block array, the array +// index must be included. +// +// GLSLangSpec.1.50.11, 4.3.7 Interface Blocks: +// "For blocks declared as arrays, the array index must also be included +// when accessing members" + +#version 150 + +out Block { + float a; + vec3 b; +} array_blocks[2]; + +void main() +{ + array_blocks.a = 5.0; + +} -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 1/4] GLSL 1.50 Interface blocks: Test that block array sizes must match between shaders
--- ...ce-blocks-vs-fs-array-size-mismatch.shader_test | 37 +++ ...ce-blocks-vs-gs-array-size-mismatch.shader_test | 41 ++ 2 files changed, 78 insertions(+) create mode 100644 tests/spec/glsl-1.50/linker/interface-blocks-vs-fs-array-size-mismatch.shader_test create mode 100644 tests/spec/glsl-1.50/linker/interface-blocks-vs-gs-array-size-mismatch.shader_test diff --git a/tests/spec/glsl-1.50/linker/interface-blocks-vs-fs-array-size-mismatch.shader_test b/tests/spec/glsl-1.50/linker/interface-blocks-vs-fs-array-size-mismatch.shader_test new file mode 100644 index 000..c9e4834 --- /dev/null +++ b/tests/spec/glsl-1.50/linker/interface-blocks-vs-fs-array-size-mismatch.shader_test @@ -0,0 +1,37 @@ +# Test interface blocks declared as arrays must match array sizes. +# +# GLSLangSpec.1.50.11, 4.3.7 Interface Blocks: +# "if a matching block is declared as an array, then the array sizes must +# also match" +[require] +GLSL >= 1.50 + +[vertex shader] + +out block { +vec4 a; +vec4 b; +} vs_block[3]; + +void main() +{ + for(int i = 0; i < 3; i++) { + vs_block[i].a = vec4(1., 0., 0., 1.); + } +} + +[fragment shader] +in block { +vec4 a; +vec4 b; +} fs_block[2]; //different array size should fail to link + +out vec4 color; + +void main() +{ + color = fs_block[0].a; +} + +[test] +link error diff --git a/tests/spec/glsl-1.50/linker/interface-blocks-vs-gs-array-size-mismatch.shader_test b/tests/spec/glsl-1.50/linker/interface-blocks-vs-gs-array-size-mismatch.shader_test new file mode 100644 index 000..5581ba8 --- /dev/null +++ b/tests/spec/glsl-1.50/linker/interface-blocks-vs-gs-array-size-mismatch.shader_test @@ -0,0 +1,41 @@ +# Test interface blocks declared as arrays must match array sizes. +# +# GLSLangSpec.1.50.11, 4.3.7 Interface Blocks: +# "if a matching block is declared as an array, then the array sizes must +# also match" +[require] +GLSL >= 1.50 + +[vertex shader] +out block { +vec4 a; +vec4 b; +} vs_block[3]; + +void main() +{ + for(int i = 0; i < 3; i++) { + vs_block[i].a = vec4(1., 0., 0., 1.); + } +} + +[geometry shader] +layout(triangles) in; +layout(triangle_strip, max_vertices=3) out; + +in block { +vec4 a; +vec4 b; +} vs_block[]; + +out vec4 color; + +void main() +{ + for(int i = 0; i < 2; i++) { + color = vs_block[i].a; + } +} + +[test] +link error -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] Test that GS has access to noise functions
--- .../glsl-1.50/compiler/gs-noise-functions.geom | 24 ++ 1 file changed, 24 insertions(+) create mode 100644 tests/spec/glsl-1.50/compiler/gs-noise-functions.geom diff --git a/tests/spec/glsl-1.50/compiler/gs-noise-functions.geom b/tests/spec/glsl-1.50/compiler/gs-noise-functions.geom new file mode 100644 index 000..0dd765c --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/gs-noise-functions.geom @@ -0,0 +1,24 @@ +// [config] +// expect_result: pass +// glsl_version: 1.50 +// check_link: false +// [end config] +// +//Test that noise functions are available to geometry shaders. + +/* +* GLSLLangSpec 1.50, section 8.9 (Noise Functions): +* "Noise functions are available to fragment, geometry, and vertex shaders." +*/ + +#version 150 + +layout(points) in; +layout(points) out; + +out float n; + +void main() +{ + n = noise1(25); +} -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] GLSL: Test that input layout qualifiers cannot be used on variable declarations
--- ...-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 +// [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] [PATCH] GS: Test that EndPrimitive() is optional for geometry output layout of "points"
--- tests/all.tests| 1 + .../glsl-1.50/execution/geometry/CMakeLists.gl.txt | 1 + ...ometry-end-primitive-optional-with-points-out.c | 161 + 3 files changed, 163 insertions(+) create mode 100644 tests/spec/glsl-1.50/execution/geometry/geometry-end-primitive-optional-with-points-out.c diff --git a/tests/all.tests b/tests/all.tests index 7057134..708e94f 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -950,6 +950,7 @@ for draw in ['', 'indexed']: 'core {0} {1}').format(draw, prim)) spec['glsl-1.50']['built-in constants'] = concurrent_test('built-in-constants tests/spec/glsl-1.50/minimum-maximums.txt') spec['glsl-1.50']['gs-emits-too-few-verts'] = concurrent_test('glsl-1.50-gs-emits-too-few-verts') +spec['glsl-1.50']['gs-end-primitive-optional-with-points-out'] = concurrent_test('glsl-1.50-geometry-end-primitive-optional-with-points-out') spec['glsl-1.50']['getshaderiv-may-return-GS'] = concurrent_test('glsl-1.50-getshaderiv-may-return-GS') spec['glsl-1.50']['query-gs-prim-types'] = concurrent_test('glsl-1.50-query-gs-prim-types') diff --git a/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt b/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt index 3d2ed79..2557d4e 100644 --- a/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt +++ b/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt @@ -11,6 +11,7 @@ ${OPENGL_glu_LIBRARY} ) piglit_add_executable (glsl-1.50-geometry-end-primitive end-primitive.c) +piglit_add_executable (glsl-1.50-geometry-end-primitive-optional-with-points-out geometry-end-primitive-optional-with-points-out.c) piglit_add_executable (glsl-1.50-geometry-primitive-id-restart primitive-id-restart.c) piglit_add_executable (glsl-1.50-geometry-primitive-types primitive-types.c) piglit_add_executable (glsl-1.50-gs-emits-too-few-verts gs-emits-too-few-verts.c) diff --git a/tests/spec/glsl-1.50/execution/geometry/geometry-end-primitive-optional-with-points-out.c b/tests/spec/glsl-1.50/execution/geometry/geometry-end-primitive-optional-with-points-out.c new file mode 100644 index 000..d6c4b44 --- /dev/null +++ b/tests/spec/glsl-1.50/execution/geometry/geometry-end-primitive-optional-with-points-out.c @@ -0,0 +1,161 @@ +/** + * 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 that when the GS output layout is "points" EndPrimitive() is optional. + * + * From the GLSL 1.50 spec, section 8.10 (Geometry Shader Functions): + * + * "If the output layout is declared to be “points”, calling EndPrimitive() + * is optional." + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 32; +config.supports_gl_core_version = 32; + + config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE; + +PIGLIT_GL_TEST_CONFIG_END + +static const char *vstext = + "#version 150\n" + "in vec3 vertex;\n" + "out vec3 pos;\n" + "void main() {\n" + " gl_Position = vec4(vertex, 1.);\n" + " pos = vertex;\n" + "}\n"; + +static const char *gstext = + "#version 150\n" + "layout(triangles) in;\n" + "layout(points, max_vertices = 3) out;\n" + "in vec3 pos[];\n" + "void main() {\n" + " for(int i = 0; i < 3; i++) {\n" + " gl_Position = vec4(pos[i], 1.);\n" + " EmitVertex();\n" + " }\n" + "}\n"; + +static const char *fstext = + "#version 150\n" + "out vec4 color;\n" + "void main() {\n" + " color = vec4(0., 1., 0., 1.);\n" + "}\n"; + +static GLuint vao; +static GLuint vertBuff; +static GLuint indexBuf; + +static GLfloat vertices[] = { + -0.9, 0.9, 0.0, +0.9, 0.9, 0.0, +0.9,-0
[Piglit] [PATCH 1/3 v2] GS: Test that geometry ins/outs can have flat/smooth/noperspective qualifiers
v2: Modify test to also test for correct interpolation of data being passed --- .../gs-also-uses-smooth-flat-noperspective.geom| 25 ++ ...also-uses-smooth-flat-noperspective.shader_test | 95 ++ 2 files changed, 120 insertions(+) create mode 100644 tests/spec/glsl-1.50/compiler/gs-also-uses-smooth-flat-noperspective.geom create mode 100644 tests/spec/glsl-1.50/execution/gs-also-uses-smooth-flat-noperspective.shader_test diff --git a/tests/spec/glsl-1.50/compiler/gs-also-uses-smooth-flat-noperspective.geom b/tests/spec/glsl-1.50/compiler/gs-also-uses-smooth-flat-noperspective.geom new file mode 100644 index 000..f1ab41e --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/gs-also-uses-smooth-flat-noperspective.geom @@ -0,0 +1,25 @@ +// [config] +// expect_result: pass +// glsl_version: 1.50 +// check_link: true +// [end config] + +#version 150 + +layout(points) in; +layout(points, max_vertices = 1) out; + +flat in int a[]; +noperspective in int b[]; +smooth in int c[]; + +flat out int aa; +noperspective out int bb; +smooth out int cc; + +void main() +{ + aa = a[0]; + bb = b[0]; + cc = c[0]; +} diff --git a/tests/spec/glsl-1.50/execution/gs-also-uses-smooth-flat-noperspective.shader_test b/tests/spec/glsl-1.50/execution/gs-also-uses-smooth-flat-noperspective.shader_test new file mode 100644 index 000..fcc1081 --- /dev/null +++ b/tests/spec/glsl-1.50/execution/gs-also-uses-smooth-flat-noperspective.shader_test @@ -0,0 +1,95 @@ +# Test that the qualifiers 'smooth', 'flat', and 'noperspective' can appear on +# geometry shader ins and outs. +# +# From the GLSL 1.50 specification, section 4.3 ("Storage Qualifiers"): +# +# "Outputs from shader (out) and inputs to a shader (in) can be further +# qualified with one of these interpolation qualifiers: +# smooth +# flat +# noperspective" + +[require] +GL >= 3.2 +GLSL >= 1.50 + +[vertex shader] + +uniform mat4 mvp; + +in vec4 vertex; +in vec3 input_data; + +out vec4 pos; +flat out float a; +smooth out float b; +noperspective out float c; + +void main() +{ + gl_Position = vertex * mvp; + pos = vertex * mvp; + a = input_data.r; + b = input_data.g; + c = input_data.b; +} + +[geometry shader] + +layout(triangles) in; +layout(triangle_strip, max_vertices = 3) out; + +in vec4 pos[]; +flat in float a[]; +smooth in float b[]; +noperspective in float c[]; + +flat out float aa; +smooth out float bb; +noperspective out float cc; + +void main() +{ + for(int i = 0; i < 3; i++) { + gl_Position = pos[i]; + aa = a[i]; + bb = b[i]; + cc = c[i]; + EmitVertex(); + } +} + +[fragment shader] + +flat in float aa; +smooth in float bb; +noperspective in float cc; + +out vec4 color; + +void main() +{ + color = vec4(aa, bb, cc, 1.0); +} + +[vertex data] +vertex/float/3 input_data/float/3 + 0.0 6.0 -2.0 0.25 1.0 0.0 +-3.0 -3.0 -1.0 0.50 0.0 0.0 + 9.0 -9.0 -3.0 0.75 0.0 1.0 + +[test] +uniform mat4 mvp 1 0 0 0 0 1 0 0 0 0 -2 -1 0 0 -3 0 +clear color 0.0 0.0 0.0 0.0 +clear +draw arrays GL_TRIANGLE_FAN 0 3 +relative probe rgba (0., 0.) (0.75, 0.1667, 0., 1.0) +relative probe rgba (0.636363636364, 0.181818181818) (0.75, 0.1667, 0.545454545455, 1.0) +relative probe rgba (0.769230769231, 0.153846153846) (0.75, 0.1667, 0.692307692308, 1.0) +relative probe rgba (0.8667, 0.1333) (0.75, 0.1667, 0.8,1.0) +relative probe rgba (0.5,0.4 ) (0.75, 0., 0.3,1.0) +relative probe rgba (0.6667, 0.) (0.75, 0., 0.5,1.0) +relative probe rgba (0.785714285714, 0.285714285714) (0.75, 0., 0.642857142857, 1.0) +relative probe rgba (0.545454545455, 0.545454545455) (0.75, 0.5, 0.272727272727, 1.0) +relative probe rgba (0.692307692308, 0.461538461538) (0.75, 0.5, 0.461538461538, 1.0) +relative probe rgba (0.5833, 0.6667) (0.75, 0.6667, 0.25, 1.0) -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 4/4] GS: Test that max_vertices cannot be greater than glMaxGeometryOutputVertices
--- .../glsl-1.50/compiler/layout-max-verts-limited.geom| 17 + 1 file changed, 17 insertions(+) create mode 100644 tests/spec/glsl-1.50/compiler/layout-max-verts-limited.geom diff --git a/tests/spec/glsl-1.50/compiler/layout-max-verts-limited.geom b/tests/spec/glsl-1.50/compiler/layout-max-verts-limited.geom new file mode 100644 index 000..7794d94 --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/layout-max-verts-limited.geom @@ -0,0 +1,17 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// check_link: true +// [end config] +// +// Section 4.3.8 (Output Layout Qualifiers) of the GLSL 1.50 spec says: +// "It is an error for the maximum number of vertices to be greater than +// gl_MaxGeometryOutputVertices." + +#version 150 + +layout(max_vertices = 2147483647) out; + +void main() +{ +} -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 3/4] GS: Test geometry output layout qualifier rules
--- ...ayout-only-one-out-declaration-per-program.geom | 22 ++ .../compiler/layout-out-only-output-qualifier.geom | 22 ++ .../compiler/layout-out-order-irrelevant.geom | 21 + 3 files changed, 65 insertions(+) create mode 100644 tests/spec/glsl-1.50/compiler/layout-only-one-out-declaration-per-program.geom create mode 100644 tests/spec/glsl-1.50/compiler/layout-out-only-output-qualifier.geom create mode 100644 tests/spec/glsl-1.50/compiler/layout-out-order-irrelevant.geom diff --git a/tests/spec/glsl-1.50/compiler/layout-only-one-out-declaration-per-program.geom b/tests/spec/glsl-1.50/compiler/layout-only-one-out-declaration-per-program.geom new file mode 100644 index 000..d7439e1 --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/layout-only-one-out-declaration-per-program.geom @@ -0,0 +1,22 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// check_link: true +// [end config] +// +// Section 4.3.8.2(Output Layout Qualifiers) of the GLSL 1.50 spec says: +// "All geometry shader output layout declarations in a program must declare the +// same layout and same value for max_vertices." + +#version 150 + +layout(lines) in; +layout(line_strip, max_vertices=2) out; + +in vec4 pos[]; + +layout(triangle_strip, max_vertices=3) out; + +void main() +{ +} diff --git a/tests/spec/glsl-1.50/compiler/layout-out-only-output-qualifier.geom b/tests/spec/glsl-1.50/compiler/layout-out-only-output-qualifier.geom new file mode 100644 index 000..37533d4 --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/layout-out-only-output-qualifier.geom @@ -0,0 +1,22 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// check_link: true +// [end config] +// +// Section 4.3.8.2(Output Layout Qualifiers) of the GLSL 1.50 spec says: +// "Geometry shaders can have output layout qualifiers only on the interface +// qualifier out, not on an output block or variable declaration. The layout +// qualifier identifiers for geometry shader outputs are +// points +// line_strip +// triangle_strip +// max_vertices = integer-constant" + +#version 150 + +layout(lines_adjacency) out; + +void main() +{ +} diff --git a/tests/spec/glsl-1.50/compiler/layout-out-order-irrelevant.geom b/tests/spec/glsl-1.50/compiler/layout-out-order-irrelevant.geom new file mode 100644 index 000..603e175 --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/layout-out-order-irrelevant.geom @@ -0,0 +1,21 @@ +// [config] +// expect_result: pass +// glsl_version: 1.50 +// check_link: true +// [end config] +// +// Section 4.3.8 (Layout Qualifiers) of the GLSL 1.50 spec says: +// "The tokens in any layout-qualifier-id-list are identifiers, not keywords. +// Generally, they can be listed in any order." +// +// Section 4.3.8.2(Output Layout Qualifiers) of the GLSL 1.50 spec says: +// "One declaration can declare either a primitive type (points, line_strip, or +// triangle_strip), or max_vertices, or both." + +#version 150 + +layout(max_vertices = 3, triangle_strip) out; + +void main() +{ +} -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 1/4] GS: Test that geometry shader input/output layout qualifiers only compile if valid
--- tests/all.tests| 12 ++ .../glsl-1.50/execution/geometry/CMakeLists.gl.txt | 2 + .../geometry/gs-input-layout-qualifiers.c | 137 .../geometry/gs-output-layout-qualifiers.c | 139 + 4 files changed, 290 insertions(+) create mode 100644 tests/spec/glsl-1.50/execution/geometry/gs-input-layout-qualifiers.c create mode 100644 tests/spec/glsl-1.50/execution/geometry/gs-output-layout-qualifiers.c diff --git a/tests/all.tests b/tests/all.tests index dc36841..9db40af 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -981,6 +981,18 @@ for layout_type in ['points', 'lines', 'lines_adjacency', 'triangles', 'glsl-1.50-gs-mismatch-prim-type {0}'.format( layout_type)) +for input_layout in ['points', 'lines', 'lines_adjacency', 'triangles', + 'triangles_adjacency', 'line_strip', 'triangle_strip']: +add_concurrent_test(spec['glsl-1.50'], +'glsl-1.50-gs-input-layout-qualifiers {0}'.format( +input_layout)) + +for output_layout in ['points', 'lines', 'lines_adjacency', 'triangles', + 'triangles_adjacency', 'line_strip', 'triangle_strip']: +add_concurrent_test(spec['glsl-1.50'], +'glsl-1.50-gs-output-layout-qualifiers {0}'.format( +output_layout)) + spec['glsl-3.30'] = Group() import_glsl_parser_tests(spec['glsl-3.30'], os.path.join(testsDir, 'spec', 'glsl-3.30'), diff --git a/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt b/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt index f01dc1c..012663d 100644 --- a/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt +++ b/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt @@ -16,3 +16,5 @@ piglit_add_executable (glsl-1.50-geometry-primitive-types primitive-types.c) piglit_add_executable (glsl-1.50-gs-emits-too-few-verts gs-emits-too-few-verts.c) piglit_add_executable (glsl-1.50-getshaderiv-may-return-GS getshaderiv-may-return-GS.c) piglit_add_executable (glsl-1.50-gs-mismatch-prim-type gs-mismatch-prim-type.c) +piglit_add_executable (glsl-1.50-gs-input-layout-qualifiers gs-input-layout-qualifiers.c) +piglit_add_executable (glsl-1.50-gs-output-layout-qualifiers gs-output-layout-qualifiers.c) diff --git a/tests/spec/glsl-1.50/execution/geometry/gs-input-layout-qualifiers.c b/tests/spec/glsl-1.50/execution/geometry/gs-input-layout-qualifiers.c new file mode 100644 index 000..ff95f00 --- /dev/null +++ b/tests/spec/glsl-1.50/execution/geometry/gs-input-layout-qualifiers.c @@ -0,0 +1,137 @@ +/** + * 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 that geometry shaders only compile with valid input layout qualifiers + * + * Section 4.3.8.1(Input Layout Qualifiers) of the GLSL 1.50 spec says: + * "Geometry shaders allow input layout qualifiers only on the interface + * qualifier in, not on an input block, block member, or variable. The layout + * qualifier identifiers for geometry shader inputs are + * points + * lines + * lines_adjacency + * triangles + * triangles_adjacency" + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 32; +config.supports_gl_core_version = 32; + + config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE; + +PIGLIT_GL_TEST_CONFIG_END + +static const char *vstext = + "#version 150\n" + "in vec4 vertex;\n" + "out vec4 pos;\n" + "void main() {\n" + " pos = vertex;\n" + "}\n"; + +static const char *gstemplate = + "#version 150\n" + "#define LAYOUT_IN %s\n" + "layout(LAYOUT_IN) in;\n" +
[Piglit] [PATCH 2/4] GS: Test geometry input layout qualifier rules
--- .../compiler/layout-in-only-input-qualifier.geom | 23 + .../compiler/layout-in-only-one-qualifier-id.geom | 24 ++ 2 files changed, 47 insertions(+) create mode 100644 tests/spec/glsl-1.50/compiler/layout-in-only-input-qualifier.geom create mode 100644 tests/spec/glsl-1.50/compiler/layout-in-only-one-qualifier-id.geom diff --git a/tests/spec/glsl-1.50/compiler/layout-in-only-input-qualifier.geom b/tests/spec/glsl-1.50/compiler/layout-in-only-input-qualifier.geom new file mode 100644 index 000..74902bc --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/layout-in-only-input-qualifier.geom @@ -0,0 +1,23 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// check_link: true +// [end config] +// +// Section 4.3.8.1(Input Layout Qualifiers) of the GLSL 1.50 spec says: +// "Geometry shaders allow input layout qualifiers only on the interface +// qualifier in, not on an input block, block member, or variable. The layout +// qualifier identifiers for geometry shader inputs are +// points +// lines +// lines_adjacency +// triangles +// triangles_adjacency" + +#version 150 + +layout(line_strip) in; + +void main() +{ +} diff --git a/tests/spec/glsl-1.50/compiler/layout-in-only-one-qualifier-id.geom b/tests/spec/glsl-1.50/compiler/layout-in-only-one-qualifier-id.geom new file mode 100644 index 000..4edd840 --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/layout-in-only-one-qualifier-id.geom @@ -0,0 +1,24 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// check_link: true +// [end config] +// +// Section 4.3.8.1(Input Layout Qualifiers) of the GLSL 1.50 spec says: +// "Geometry shaders allow input layout qualifiers only on the interface +// qualifier in, not on an input block, block member, or variable. The layout +// qualifier identifiers for geometry shader inputs are +// points +// lines +// lines_adjacency +// triangles +// triangles_adjacency +// Only one argument is accepted." + +#version 150 + +layout(points, triangles_adjacency) in; + +void main() +{ +} -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 2/3] GS: Tests that varying arrays can only be passed between VS and GS within blocks
--- .../execution/vs-gs-arrays-fail.shader_test| 63 .../vs-gs-arrays-within-blocks-pass.shader_test| 86 ++ 2 files changed, 149 insertions(+) create mode 100644 tests/spec/glsl-1.50/execution/vs-gs-arrays-fail.shader_test create mode 100644 tests/spec/glsl-1.50/execution/vs-gs-arrays-within-blocks-pass.shader_test diff --git a/tests/spec/glsl-1.50/execution/vs-gs-arrays-fail.shader_test b/tests/spec/glsl-1.50/execution/vs-gs-arrays-fail.shader_test new file mode 100644 index 000..877b0a6 --- /dev/null +++ b/tests/spec/glsl-1.50/execution/vs-gs-arrays-fail.shader_test @@ -0,0 +1,63 @@ +# Test that vertex array outputs are not allowed outside of output blocks since +# 2D arrays are not supported. +# +# From the GLSL 1.50 specification, section 4.3.4 ("Inputs"): +# +# "If the output of a vertex shader is itself an array to be consumed by a +# geometry shader, then it must appear in an output block (see interface blocks +# below) in the vertex shader and in an input block in the geometry shader with +# a block instance name declared as an array. This is required for arrays +# output from a vertex shader because two-dimensional arrays are not +# supported." + +[require] +GL >= 3.2 +GLSL >= 1.50 + +[vertex shader] + +in vec4 vertex; + +out vec4 pos; +out float a[3]; + +void main() +{ + gl_Position = vertex; + pos = vertex; + for(int i = 0; i < 3; i++) { + a[i] = i+1; + } +} + +[geometry shader] + +layout(triangles) in; +layout(triangle_strip, max_vertices = 3) out; + +in vec4 pos[]; +in float a[3]; + + +void main() +{ +} + +[fragment shader] + +out vec4 color; + +void main() +{ + color = vec4(1.0, 0.0, 0.0, 1.0); +} + +[vertex data] +vertex/float/2 +-1.0 -1.0 + 1.0 -1.0 + 1.0 1.0 +-1.0 1.0 + +[test] +link error diff --git a/tests/spec/glsl-1.50/execution/vs-gs-arrays-within-blocks-pass.shader_test b/tests/spec/glsl-1.50/execution/vs-gs-arrays-within-blocks-pass.shader_test new file mode 100644 index 000..52b8b00 --- /dev/null +++ b/tests/spec/glsl-1.50/execution/vs-gs-arrays-within-blocks-pass.shader_test @@ -0,0 +1,86 @@ +# Test that vertex array outputs that are passed to a geometry shader are only +# valid if they are declared within an output block. +# +# From the GLSL 1.50 specification, section 4.3.4 ("Inputs"): +# +# "If the output of a vertex shader is itself an array to be consumed by a +# geometry shader, then it must appear in an output block (see interface blocks +# below) in the vertex shader and in an input block in the geometry shader with +# a block instance name declared as an array. This is required for arrays +# output from a vertex shader because two-dimensional arrays are not +# supported." + +[require] +GL >= 3.2 +GLSL >= 1.50 + +[vertex shader] + +in vec4 vertex; + +out vec4 pos; +out block { + float a[4]; +}; + +void main() +{ + gl_Position = vertex; + pos = vertex; + for(int i = 0; i < 4; i++) { + a[i] = i+1; + } +} + +[geometry shader] + +layout(triangles) in; +layout(triangle_strip, max_vertices = 3) out; + +in vec4 pos[]; +in block { + float a[4]; +} b[]; + +out float aa[4]; + +void main() +{ + for(int i = 0; i < 3; i++) { + gl_Position = pos[i]; + for(int j = 0; j < 4; j++) { + aa[j] = b[i].a[j]; + } + EmitVertex(); + } +} + +[fragment shader] + +in float aa[4]; + +out vec4 color; + +void main() +{ + bool fail = false; + for(int i = 0; i < 4; i++) { + if(aa[i] != i + 1) fail = true; + } + + if (fail) + color = vec4(1.0, 0.0, 0.0, 1.0); + else + color = vec4(0.0, 1.0, 0.0, 1.0); +} + +[vertex data] +vertex/float/2 +-1.0 -1.0 + 1.0 -1.0 + 1.0 1.0 +-1.0 1.0 + +[test] +draw arrays GL_TRIANGLE_FAN 0 4 +probe all rgba 0.0 1.0 0.0 1.0 -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 3/3] GS: Test that varyings of the same name between VS and GS must match types
--- .../vs-gs-varyings-match-types.shader_test | 48 ++ 1 file changed, 48 insertions(+) create mode 100644 tests/spec/glsl-1.50/execution/vs-gs-varyings-match-types.shader_test diff --git a/tests/spec/glsl-1.50/execution/vs-gs-varyings-match-types.shader_test b/tests/spec/glsl-1.50/execution/vs-gs-varyings-match-types.shader_test new file mode 100644 index 000..1659fb8 --- /dev/null +++ b/tests/spec/glsl-1.50/execution/vs-gs-varyings-match-types.shader_test @@ -0,0 +1,48 @@ +# Test that between VS and GS varyings of the same name must match type. +# +# From the GLSL 1.50 specification, section 4.3.4 ("Inputs"): +# +# "For the interface between a vertex shader and a geometry shader, vertex +# shader output variables and geometry shader input variables of the same name +# must match in type and qualification, except that the vertex shader name +# cannot be declared as an array while the geometry shader name must be +# declared as an array. Otherwise, a link error will occur." + +[require] +GL >= 3.2 +GLSL >= 1.50 + +[vertex shader] + +in vec4 piglit_vertex; + +out vec4 position; + + +void main() +{ + position = piglit_vertex; +} + +[geometry shader] + +layout(triangles) in; +layout(triangle_strip, max_vertices = 3) out; + +in vec3 position[]; + +void main() +{ +} + +[fragment shader] + +out vec4 color; + +void main() +{ + color = vec4(0.0, 1.0, 0.0, 1.0); +} + +[test] +link error -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 1/3] GS: Test that geometry ins/outs can have flat/smooth/noperspective qualifiers
--- .../gs-also-uses-smooth-flat-noperspective.geom| 25 ++ ...also-uses-smooth-flat-noperspective.shader_test | 91 ++ 2 files changed, 116 insertions(+) create mode 100644 tests/spec/glsl-1.50/compiler/gs-also-uses-smooth-flat-noperspective.geom create mode 100644 tests/spec/glsl-1.50/execution/gs-also-uses-smooth-flat-noperspective.shader_test diff --git a/tests/spec/glsl-1.50/compiler/gs-also-uses-smooth-flat-noperspective.geom b/tests/spec/glsl-1.50/compiler/gs-also-uses-smooth-flat-noperspective.geom new file mode 100644 index 000..f1ab41e --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/gs-also-uses-smooth-flat-noperspective.geom @@ -0,0 +1,25 @@ +// [config] +// expect_result: pass +// glsl_version: 1.50 +// check_link: true +// [end config] + +#version 150 + +layout(points) in; +layout(points, max_vertices = 1) out; + +flat in int a[]; +noperspective in int b[]; +smooth in int c[]; + +flat out int aa; +noperspective out int bb; +smooth out int cc; + +void main() +{ + aa = a[0]; + bb = b[0]; + cc = c[0]; +} diff --git a/tests/spec/glsl-1.50/execution/gs-also-uses-smooth-flat-noperspective.shader_test b/tests/spec/glsl-1.50/execution/gs-also-uses-smooth-flat-noperspective.shader_test new file mode 100644 index 000..e302806 --- /dev/null +++ b/tests/spec/glsl-1.50/execution/gs-also-uses-smooth-flat-noperspective.shader_test @@ -0,0 +1,91 @@ +# Test that the qualifiers 'smooth', 'flat', and 'noperspective' can appear on +# geometry shader ins and outs. +# +# From the GLSL 1.50 specification, section 4.3 ("Storage Qualifiers"): +# +# "Outputs from shader (out) and inputs to a shader (in) can be further +# qualified with one of these interpolation qualifiers: +# smooth +# flat +# noperspective" + +[require] +GL >= 3.2 +GLSL >= 1.50 + +[vertex shader] + +uniform float ref; + +in vec4 vertex; + +out vec4 pos; +flat out float a; +noperspective out float b; +smooth out float c; + +void main() +{ + gl_Position = vertex; + pos = vertex; + a = ref + 1; + b = ref + 2; + c = ref + 3; +} + +[geometry shader] + +uniform float ref; + +layout(triangles) in; +layout(triangle_strip, max_vertices = 3) out; + +in vec4 pos[]; +flat in float a[]; +noperspective in float b[]; +smooth in float c[]; + +flat out float aa; +noperspective out float bb; +smooth out float cc; + +void main() +{ + for(int i = 0; i < 3; i++) { + gl_Position = pos[i]; + aa = a[i] + 1; + bb = b[i] + 2; + cc = c[i] + 3; + EmitVertex(); + } +} + +[fragment shader] + +uniform float ref; + +flat in float aa; +noperspective in float bb; +smooth in float cc; + +out vec4 color; + +void main() +{ + if ((aa != ref + 2) || (bb != ref + 4) || (cc != ref + 6)) + color = vec4(1.0, 0.0, 0.0, 1.0); + else + color = vec4(0.0, 1.0, 0.0, 1.0); +} + +[vertex data] +vertex/float/2 +-1.0 -1.0 + 1.0 -1.0 + 1.0 1.0 +-1.0 1.0 + +[test] +uniform float ref 37.29060007 +draw arrays GL_TRIANGLE_FAN 0 4 +probe all rgba 0.0 1.0 0.0 1.0 -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] GS: Modify an older test to also check MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS with GL version 3.2
--- tests/spec/arb_uniform_buffer_object/minmax.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/spec/arb_uniform_buffer_object/minmax.c b/tests/spec/arb_uniform_buffer_object/minmax.c index ade70dc..62e029e 100644 --- a/tests/spec/arb_uniform_buffer_object/minmax.c +++ b/tests/spec/arb_uniform_buffer_object/minmax.c @@ -53,7 +53,7 @@ piglit_init(int argc, char **argv) int guniforms = 0, gblocks = 0; int funiforms = 0, fblocks = 0; int blocksize = 0; - bool gs = piglit_is_extension_supported("GL_ARB_geometry_shader4"); + bool gs = (piglit_get_gl_version() >= 32) || piglit_is_extension_supported("GL_ARB_geometry_shader4"); piglit_require_extension("GL_ARB_uniform_buffer_object"); -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] Test that GetShaderiv() may now return GEOMETRY_SHADER if passed a valid GS object
--- tests/all.tests| 1 + .../glsl-1.50/execution/geometry/CMakeLists.gl.txt | 1 + .../execution/geometry/getshaderiv-may-return-GS.c | 115 + 3 files changed, 117 insertions(+) create mode 100644 tests/spec/glsl-1.50/execution/geometry/getshaderiv-may-return-GS.c diff --git a/tests/all.tests b/tests/all.tests index be3340c..6e963ca 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -948,6 +948,7 @@ for draw in ['', 'indexed']: 'core {0} {1}').format(draw, prim)) spec['glsl-1.50']['built-in constants'] = concurrent_test('built-in-constants tests/spec/glsl-1.50/minimum-maximums.txt') spec['glsl-1.50']['gs-emits-too-few-verts'] = concurrent_test('gs-emits-too-few-verts') +spec['glsl-1.50']['getshaderiv-may-return-GS'] = concurrent_test('glsl-1.50-getshaderiv-may-return-GS') spec['glsl-3.30'] = Group() spec['glsl-3.30']['built-in constants'] = concurrent_test('built-in-constants tests/spec/glsl-3.30/minimum-maximums.txt') diff --git a/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt b/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt index 865595a..a906c36 100644 --- a/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt +++ b/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt @@ -13,4 +13,5 @@ ${OPENGL_glu_LIBRARY} piglit_add_executable (glsl-1.50-geometry-end-primitive end-primitive.c) piglit_add_executable (glsl-1.50-geometry-primitive-id-restart primitive-id-restart.c) piglit_add_executable (glsl-1.50-geometry-primitive-types primitive-types.c) +piglit_add_executable (glsl-1.50-getshaderiv-may-return-GS getshaderiv-may-return-GS.c) piglit_add_executable (glsl-1.50-gs-mismatch-prim-type gs-mismatch-prim-type.c) diff --git a/tests/spec/glsl-1.50/execution/geometry/getshaderiv-may-return-GS.c b/tests/spec/glsl-1.50/execution/geometry/getshaderiv-may-return-GS.c new file mode 100644 index 000..91cb292 --- /dev/null +++ b/tests/spec/glsl-1.50/execution/geometry/getshaderiv-may-return-GS.c @@ -0,0 +1,115 @@ +/** + * 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 that GetShaderiv() may now return GEOMETRY_SHADER if passed SHADER_TYPE + * + * From the GLSL 3.2 spec, section 6.1.10(Shader and Program Queries): + * "The command + * void GetShaderiv( uint shader, enum pname, int *params ); + * returns properties of the shader object named shader in params. The + * parameter value to return is specified by pname. + *If pname is SHADER_TYPE, VERTEX_SHADER, GEOMETRY_SHADER, or + * FRAGMENT_SHADER is returned if shader is a vertex, geometry, or fragment + * shader object respectively." + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 32; +config.supports_gl_core_version = 32; + + config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE; + +PIGLIT_GL_TEST_CONFIG_END + +static const char *vstext = + "#version 150\n" + "in vec4 piglit_vertex;\n" + "out vec4 pos;\n" + "void main() {\n" + " gl_Position = piglit_vertex;\n" + " pos = piglit_vertex;\n" + "}\n"; + +static const char *gstext = + "#version 150\n" + "layout(triangles) in;\n" + "layout(triangle_strip, max_vertices = 3) out;\n" + "in vec4 pos[];\n" + "void main() {\n" + " for(int i = 0; i < 3; i++) {\n" + " gl_Position = pos[i];\n" + " EmitVertex();\n" + " }\n" + "}\n"; + +static const char *fstext = + "#version 150\n" + "out vec4 color;\n" + "void main() {\n" + " color = vec4(1.);\n" + "}\n"; + +static GLuint prog; + +void +piglit_init(int argc, char **argv) +{ + bool pass = true; + GLuint vs = 0,
[Piglit] [PATCH] Test that GetProgramiv() now accepts GEOMETRY_INPUT_TYPE, GEOMETRY_OUTPUT_TYPE and GEOMETRY_VERTICES_OUT
**NOTE**: At the time this test was written, the new enums, GEOMETRY_INPUT_TYPE, GEOMETRY_OUTPUT_TYPE and GEOMETRY_VERTICES_OUT, do not seem to be implemented, thus causing the tests to fail. --- tests/all.tests| 1 + .../glsl-1.50/execution/geometry/CMakeLists.gl.txt | 1 + .../execution/geometry/query-gs-prim-types.c | 171 + 3 files changed, 173 insertions(+) create mode 100644 tests/spec/glsl-1.50/execution/geometry/query-gs-prim-types.c diff --git a/tests/all.tests b/tests/all.tests index be3340c..1fa6244 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -948,6 +948,7 @@ for draw in ['', 'indexed']: 'core {0} {1}').format(draw, prim)) spec['glsl-1.50']['built-in constants'] = concurrent_test('built-in-constants tests/spec/glsl-1.50/minimum-maximums.txt') spec['glsl-1.50']['gs-emits-too-few-verts'] = concurrent_test('gs-emits-too-few-verts') +spec['glsl-1.50']['query-gs-prim-types'] = concurrent_test('glsl-1.50-query-gs-prim-types') spec['glsl-3.30'] = Group() spec['glsl-3.30']['built-in constants'] = concurrent_test('built-in-constants tests/spec/glsl-3.30/minimum-maximums.txt') diff --git a/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt b/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt index 865595a..147546b 100644 --- a/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt +++ b/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt @@ -14,3 +14,4 @@ piglit_add_executable (glsl-1.50-geometry-end-primitive end-primitive.c) piglit_add_executable (glsl-1.50-geometry-primitive-id-restart primitive-id-restart.c) piglit_add_executable (glsl-1.50-geometry-primitive-types primitive-types.c) piglit_add_executable (glsl-1.50-gs-mismatch-prim-type gs-mismatch-prim-type.c) +piglit_add_executable (glsl-1.50-query-gs-prim-types query-gs-prim-types.c) diff --git a/tests/spec/glsl-1.50/execution/geometry/query-gs-prim-types.c b/tests/spec/glsl-1.50/execution/geometry/query-gs-prim-types.c new file mode 100644 index 000..f9489af --- /dev/null +++ b/tests/spec/glsl-1.50/execution/geometry/query-gs-prim-types.c @@ -0,0 +1,171 @@ +/** + * 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 that GetProgramiv() now accepts GEOMETRY_INPUT_TYPE, + * GEOMETRY_OUTPUT_TYPE and GEOMETRY_VERTICES_OUT. + * + * From the GLSL 3.2 spec, section 2.12.1 (Geometry Shader Input Primitives) + * "The input primitive type may be queried by calling GetProgramiv with the + * symbolic constant GEOMETRY_INPUT_TYPE." + * + * "The output primitive type and maximum output vertex count of a linked + * program may be queried by calling GetProgramiv with the symbolic constants + * GEOMETRY_OUTPUT_TYPE and GEOMETRY_VERTICES_OUT, respectively." + * + * Also, from section 6.1.10(Shader and Program Queries): + * "The command + * void GetProgramiv( uint program, enum pname, int *params ); + * returns properties of the program object named program in params. The + * parameter value to return is specified by pname." + * + * "If pname is GEOMETRY_VERTICES_OUT, the maximum number of vertices the + * geometry shader will output is returned. If pname is GEOMETRY_INPUT_TYPE, + * the geometry shader input type, which must be one of POINTS, LINES, + * LINES_ADJACENCY, TRIANGLES or TRIANGLES_ADJACENCY, is returned. If pname is + * GEOMETRY_OUTPUT_TYPE, the geometry shader output type, which must be one of + * POINTS, LINE_STRIP or TRIANGLE_STRIP, is returned. If GEOMETRY_VERTICES_OUT, + * GEOMETRY_INPUT_TYPE, or GEOMETRY_OUTPUT_TYPE are queried for a program which + * has not been linked successfully, or which does not contain objects to form + * a geometry shader, then an INVALID_OPERATION error is generated." + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN
[Piglit] [PATCH 1/2] Move gs-emits-too-few-verts.c into the correct folder
--- tests/all.tests| 2 +- tests/spec/glsl-1.50/CMakeLists.gl.txt | 1 - .../glsl-1.50/execution/geometry/CMakeLists.gl.txt | 1 + .../execution/geometry/gs-emits-too-few-verts.c| 166 + tests/spec/glsl-1.50/gs-emits-too-few-verts.c | 166 - 5 files changed, 168 insertions(+), 168 deletions(-) create mode 100644 tests/spec/glsl-1.50/execution/geometry/gs-emits-too-few-verts.c delete mode 100644 tests/spec/glsl-1.50/gs-emits-too-few-verts.c diff --git a/tests/all.tests b/tests/all.tests index be3340c..2632cc3 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -947,7 +947,7 @@ for draw in ['', 'indexed']: ('arb_geometry_shader4-ignore-adjacent-vertices ' 'core {0} {1}').format(draw, prim)) spec['glsl-1.50']['built-in constants'] = concurrent_test('built-in-constants tests/spec/glsl-1.50/minimum-maximums.txt') -spec['glsl-1.50']['gs-emits-too-few-verts'] = concurrent_test('gs-emits-too-few-verts') +spec['glsl-1.50']['glsl-1.50-gs-emits-too-few-verts'] = concurrent_test('glsl-1.50-gs-emits-too-few-verts') spec['glsl-3.30'] = Group() spec['glsl-3.30']['built-in constants'] = concurrent_test('built-in-constants tests/spec/glsl-3.30/minimum-maximums.txt') diff --git a/tests/spec/glsl-1.50/CMakeLists.gl.txt b/tests/spec/glsl-1.50/CMakeLists.gl.txt index 7609b98..703469b 100644 --- a/tests/spec/glsl-1.50/CMakeLists.gl.txt +++ b/tests/spec/glsl-1.50/CMakeLists.gl.txt @@ -9,5 +9,4 @@ link_libraries ( ${OPENGL_glu_LIBRARY} ) -piglit_add_executable (gs-emits-too-few-verts gs-emits-too-few-verts.c) # vim: ft=cmake: diff --git a/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt b/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt index 865595a..aefaf41 100644 --- a/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt +++ b/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt @@ -13,4 +13,5 @@ ${OPENGL_glu_LIBRARY} piglit_add_executable (glsl-1.50-geometry-end-primitive end-primitive.c) piglit_add_executable (glsl-1.50-geometry-primitive-id-restart primitive-id-restart.c) piglit_add_executable (glsl-1.50-geometry-primitive-types primitive-types.c) +piglit_add_executable (glsl-1.50-gs-emits-too-few-verts gs-emits-too-few-verts.c) piglit_add_executable (glsl-1.50-gs-mismatch-prim-type gs-mismatch-prim-type.c) diff --git a/tests/spec/glsl-1.50/execution/geometry/gs-emits-too-few-verts.c b/tests/spec/glsl-1.50/execution/geometry/gs-emits-too-few-verts.c new file mode 100644 index 000..45e39ce --- /dev/null +++ b/tests/spec/glsl-1.50/execution/geometry/gs-emits-too-few-verts.c @@ -0,0 +1,166 @@ +/** + * 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. + */ + +/** + * From the GLSL 3.2 spec, section 2.12.2 (Geometry Shader Output Primitives): + * + * "If the number of vertices emitted by the geometry shader is not sufficient + * to produce a single primitive, nothing is drawn." + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 32; +config.supports_gl_core_version = 32; + + config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE; + +PIGLIT_GL_TEST_CONFIG_END + +static const char *vstext = + "#version 150\n" + "in vec3 vertex;\n" + "out vec3 pos;\n" + "void main() {\n" + " gl_Position = vec4(vertex, 1.);\n" + " pos = vertex;\n" + "}\n"; + +static const char *gstext = + "#version 150\n" + "layout(triangles) in;\n" + "layout(triangle_strip, max_vertices = 3) out;\n" + "in vec3 pos[];\n" + "void main() {\n" + " for(int i = 0; i < 2; i++) {\n" + " gl_Position = vec4(pos[i], 1.);\n" + "
[Piglit] [PATCH 2/2] Change the geometry shader output layouts from 'triangles' to 'triangle_strip' because 'triangles' should be invalid
--- tests/spec/glsl-1.50/compiler/layout-global-only-out.geom | 2 +- tests/spec/glsl-1.50/compiler/output-struct.geom | 2 +- tests/spec/glsl-1.50/execution/geometry/gs-mismatch-prim-type.c | 2 +- tests/spec/glsl-1.50/execution/varying-struct-basic-gs-fs.shader_test | 2 +- tests/spec/glsl-1.50/execution/varying-struct-basic-vs-gs.shader_test | 2 +- tests/spec/glsl-1.50/linker/gs-must-specify-input-type.shader_test| 2 +- tests/spec/glsl-1.50/linker/gs-must-specify-max-vertices.shader_test | 2 +- tests/spec/glsl-1.50/linker/gs-without-vs.shader_test | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/spec/glsl-1.50/compiler/layout-global-only-out.geom b/tests/spec/glsl-1.50/compiler/layout-global-only-out.geom index 155f333..e574270 100644 --- a/tests/spec/glsl-1.50/compiler/layout-global-only-out.geom +++ b/tests/spec/glsl-1.50/compiler/layout-global-only-out.geom @@ -11,5 +11,5 @@ void main() { - layout(triangles) out; + layout(triangle_strip) out; } diff --git a/tests/spec/glsl-1.50/compiler/output-struct.geom b/tests/spec/glsl-1.50/compiler/output-struct.geom index 290c957..1d751a0 100644 --- a/tests/spec/glsl-1.50/compiler/output-struct.geom +++ b/tests/spec/glsl-1.50/compiler/output-struct.geom @@ -18,7 +18,7 @@ #version 150 layout(triangles) in; -layout(triangles) out; +layout(triangle_strip) out; in int a[]; in float b[]; diff --git a/tests/spec/glsl-1.50/execution/geometry/gs-mismatch-prim-type.c b/tests/spec/glsl-1.50/execution/geometry/gs-mismatch-prim-type.c index 0e8ecb4..8ce8253 100644 --- a/tests/spec/glsl-1.50/execution/geometry/gs-mismatch-prim-type.c +++ b/tests/spec/glsl-1.50/execution/geometry/gs-mismatch-prim-type.c @@ -66,7 +66,7 @@ static const char *gstemplate = "#version 150\n" "#define LAYOUT_TYPE %s\n" "layout(LAYOUT_TYPE) in;\n" - "layout(triangles, max_vertices = 3) out;\n" + "layout(triangle_strip, max_vertices = 3) out;\n" "in vec3 pos[];\n" "void main() {\n" " for(int i = 0; i < pos.length(); i++) {\n" diff --git a/tests/spec/glsl-1.50/execution/varying-struct-basic-gs-fs.shader_test b/tests/spec/glsl-1.50/execution/varying-struct-basic-gs-fs.shader_test index e59e2b5..5529ff3 100644 --- a/tests/spec/glsl-1.50/execution/varying-struct-basic-gs-fs.shader_test +++ b/tests/spec/glsl-1.50/execution/varying-struct-basic-gs-fs.shader_test @@ -39,7 +39,7 @@ void main() uniform float ref; layout(triangles) in; -layout(triangles, max_vertices=3) out; +layout(triangle_strip, max_vertices=3) out; in vec4 pos[]; diff --git a/tests/spec/glsl-1.50/execution/varying-struct-basic-vs-gs.shader_test b/tests/spec/glsl-1.50/execution/varying-struct-basic-vs-gs.shader_test index 1b584fb..0a5b9b2 100644 --- a/tests/spec/glsl-1.50/execution/varying-struct-basic-vs-gs.shader_test +++ b/tests/spec/glsl-1.50/execution/varying-struct-basic-vs-gs.shader_test @@ -68,7 +68,7 @@ void main() uniform float ref; layout(triangles) in; -layout(triangles, max_vertices=3) out; +layout(triangle_strip, max_vertices=3) out; in vec4 pos[]; diff --git a/tests/spec/glsl-1.50/linker/gs-must-specify-input-type.shader_test b/tests/spec/glsl-1.50/linker/gs-must-specify-input-type.shader_test index af4967b..9468ac2 100644 --- a/tests/spec/glsl-1.50/linker/gs-must-specify-input-type.shader_test +++ b/tests/spec/glsl-1.50/linker/gs-must-specify-input-type.shader_test @@ -26,7 +26,7 @@ void main() [geometry shader] #version 150 -layout(triangles, max_vertices = 3) out; +layout(triangle_strip, max_vertices = 3) out; in vec4 vertex_to_gs[3]; diff --git a/tests/spec/glsl-1.50/linker/gs-must-specify-max-vertices.shader_test b/tests/spec/glsl-1.50/linker/gs-must-specify-max-vertices.shader_test index 9126fec..a5932cd 100644 --- a/tests/spec/glsl-1.50/linker/gs-must-specify-max-vertices.shader_test +++ b/tests/spec/glsl-1.50/linker/gs-must-specify-max-vertices.shader_test @@ -27,7 +27,7 @@ void main() #version 150 layout(triangles) in; -layout(triangles) out; +layout(triangle_strip) out; in vec4 vertex_to_gs[]; diff --git a/tests/spec/glsl-1.50/linker/gs-without-vs.shader_test b/tests/spec/glsl-1.50/linker/gs-without-vs.shader_test index a241685..196689f 100644 --- a/tests/spec/glsl-1.50/linker/gs-without-vs.shader_test +++ b/tests/spec/glsl-1.50/linker/gs-without-vs.shader_test @@ -16,7 +16,7 @@ GLSL >= 1.50 #version 150 layout(triangles) in; -layout(triangles, max_vertices = 3) out; +layout(triangle_strip, max_vertices = 3) out; in vec4 vertex[3]; -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] GL 1.50: Test that UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER is accepted by GetActiveUniformBlockiv()
v2: Incorporate this test into referenced-by-shader.c --- .../referenced-by-shader.c | 142 ++--- 1 file changed, 99 insertions(+), 43 deletions(-) diff --git a/tests/spec/arb_uniform_buffer_object/referenced-by-shader.c b/tests/spec/arb_uniform_buffer_object/referenced-by-shader.c index dad8c77..1026093 100644 --- a/tests/spec/arb_uniform_buffer_object/referenced-by-shader.c +++ b/tests/spec/arb_uniform_buffer_object/referenced-by-shader.c @@ -1,5 +1,5 @@ /* - * Copyright © 2012 Intel Corporation + * Copyright © 2012, 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"), @@ -23,7 +23,8 @@ /** @file referenced-by-shader.c * - * From the GL_ARB_uniform_buffer_object spec: + * From the GL_ARB_uniform_buffer_object spec and + * Section 2.11.4(Uniform Variables) of OpenGL 3.2 Core: * * "If is UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER, * UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER, or @@ -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; - PIGLIT_GL_TEST_CONFIG_END void @@ -51,65 +48,124 @@ piglit_init(int argc, char **argv) { bool pass = true; unsigned int i; - GLuint vs, fs, prog; + GLuint vs, gs, fs, prog; const char *vs_source = - "#extension GL_ARB_uniform_buffer_object : enable\n" - "uniform vs { float a; };\n" - "uniform vsfs { float c; };\n" - "uniform float ;\n" + "%s" + "uniform vs { float v; };\n" + "uniform vsgs { float vg; };\n" + "uniform vsfs { float vf; };\n" + "uniform vsgsfs { float vgf; };\n" + "void main() {\n" + " gl_Position = vec4(v + vg + vf + vgf);\n" + "}\n"; + + const char *gs_source = + "%s" + "layout(triangles) in;\n" + "layout(triangles, max_vertices=3) out;\n" + "uniform gs { float g; };\n" + "uniform vsgs { float vg; };\n" + "uniform gsfs { float gf; };\n" + "uniform vsgsfs { float vgf; };\n" "void main() {\n" - " gl_Position = gl_Vertex + vec4(a + c);\n" + " for(int i = 0; i < 3; i++) {\n" + " gl_Position = vec4(g + vg + gf + vgf);\n" + " EmitVertex();\n" + " }\n" "}\n"; + const char *fs_source = - "#extension GL_ARB_uniform_buffer_object : enable\n" - "uniform fs { float b; };\n" - "uniform vsfs { float c; };\n" - "uniform float ;\n" + "%s" + "uniform fs { float f; };\n" + "uniform vsfs { float vf; };\n" + "uniform gsfs { float gf; };\n" + "uniform vsgsfs { float vgf; };\n" "void main() {\n" - " gl_FragColor = vec4(b + c);\n" + " gl_FragColor = vec4(f + vf + gf + vgf);\n" "}\n"; + char name[10]; + bool use_gs = piglit_get_gl_version() >= 32; + const char *header; + char *temp_source; + int num_uniforms_used = 0; + + if(use_gs) { + header = "#version 150\n"; + } + else { + header = "#extension GL_ARB_uniform_buffer_object : enable\n"; + piglit_require_extension("GL_ARB_uniform_buffer_object"); + } + + prog = glCreateProgram(); + + asprintf(&temp_source, vs_source, header); + vs = piglit_compile_shader_text(GL_VERTEX_SHADER, temp_source); + glAttachShader(prog, vs); + free(temp_source); - piglit_require_extension("GL_ARB_uniform_buffer_object"); + if(use_gs) { + asprintf(&temp_source, gs_source, header); + gs = piglit_compile_shader_text(GL_GEOMETRY_SHADER, temp_source); + glAttachShader(prog, gs); + free(temp_source); + } + + asprintf(&temp_source, fs_source, header); + fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, temp_source); + glAttachShader(prog, fs); + free(temp_source); - fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source); - vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source); - prog = piglit_link_simple_program(vs, fs); - if (!prog) { - fprintf(stderr, "Failed to link shaders.\n"); + glLinkProgram(prog); + if (!piglit_link_check_status(prog)) { piglit_report_result(PIGLIT_FAIL); } - for (i
[Piglit] [PATCH v2] Test that nothing is drawn if GS emits too few vertices to create a primitive
v2: add check for how many primitives were actually generated --- tests/all.tests | 1 + tests/spec/glsl-1.50/CMakeLists.gl.txt| 13 ++ tests/spec/glsl-1.50/CMakeLists.txt | 1 + tests/spec/glsl-1.50/gs-emits-too-few-verts.c | 166 ++ 4 files changed, 181 insertions(+) create mode 100644 tests/spec/glsl-1.50/CMakeLists.gl.txt create mode 100644 tests/spec/glsl-1.50/gs-emits-too-few-verts.c diff --git a/tests/all.tests b/tests/all.tests index 959cbf5..1af16d8 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -943,6 +943,7 @@ for draw in ['', 'indexed']: ('arb_geometry_shader4-ignore-adjacent-vertices ' 'core {0} {1}').format(draw, prim)) spec['glsl-1.50']['built-in constants'] = concurrent_test('built-in-constants tests/spec/glsl-1.50/minimum-maximums.txt') +spec['glsl-1.50']['gs-emits-too-few-verts'] = concurrent_test('gs-emits-too-few-verts') spec['glsl-3.30'] = Group() spec['glsl-3.30']['built-in constants'] = concurrent_test('built-in-constants tests/spec/glsl-3.30/minimum-maximums.txt') diff --git a/tests/spec/glsl-1.50/CMakeLists.gl.txt b/tests/spec/glsl-1.50/CMakeLists.gl.txt new file mode 100644 index 000..7609b98 --- /dev/null +++ b/tests/spec/glsl-1.50/CMakeLists.gl.txt @@ -0,0 +1,13 @@ +include_directories( + ${GLEXT_INCLUDE_DIR} + ${OPENGL_INCLUDE_PATH} +) + +link_libraries ( + piglitutil_${piglit_target_api} + ${OPENGL_gl_LIBRARY} + ${OPENGL_glu_LIBRARY} +) + +piglit_add_executable (gs-emits-too-few-verts gs-emits-too-few-verts.c) +# vim: ft=cmake: diff --git a/tests/spec/glsl-1.50/CMakeLists.txt b/tests/spec/glsl-1.50/CMakeLists.txt index bb76f08..e4126fc 100644 --- a/tests/spec/glsl-1.50/CMakeLists.txt +++ b/tests/spec/glsl-1.50/CMakeLists.txt @@ -1 +1,2 @@ add_subdirectory (execution) +piglit_include_target_api() diff --git a/tests/spec/glsl-1.50/gs-emits-too-few-verts.c b/tests/spec/glsl-1.50/gs-emits-too-few-verts.c new file mode 100644 index 000..553e01e --- /dev/null +++ b/tests/spec/glsl-1.50/gs-emits-too-few-verts.c @@ -0,0 +1,166 @@ +/** + * 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. + */ + +/** + * From the GLSL 3.2 spec, section 2.12.2 (Geometry Shader Output Primitives): + * + * "If the number of vertices emitted by the geometry shader is not sufficient + * to produce a single primitive, nothing is drawn." + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 32; +config.supports_gl_core_version = 32; + + config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE; + +PIGLIT_GL_TEST_CONFIG_END + +static const char *vstext = + "#version 150\n" + "in vec3 vertex;\n" + "out vec3 pos;\n" + "void main() {\n" + " gl_Position = vec4(vertex, 1.);\n" + " pos = vertex;\n" + "}\n"; + +static const char *gstext = + "#version 150\n" + "layout(triangles) in;\n" + "layout(triangles, max_vertices = 3) out;\n" + "in vec3 pos[];\n" + "void main() {\n" + " for(int i = 0; i < 2; i++) {\n" + " gl_Position = vec4(pos[i], 1.);\n" + " EmitVertex();\n" + " }\n" + "}\n"; + +static const char *fstext = + "#version 150\n" + "out vec4 color;\n" + "void main() {\n" + " color = vec4(1., 0., 0., 1.);\n" + "}\n"; + +static GLuint vao; +static GLuint vertBuff; +static GLuint indexBuf; + +static GLfloat vertices[] = { + -1.0, 1.0, 0.0, +1.0, 1.0, 0.0, +1.0,-1.0, 0.0, + -1.0,-1.0, 0.0 +}; +static GLsizei vertSize = sizeof(vertices); + +static GLuint indices[] = { + 0, 1, 2, 0, 2, 3 +}; +static GLsizei indSize = size
[Piglit] [PATCH v2] Test that geometry shaders input types must match the primitive mode
v2: condense all previous tests into a single file and move it to correct location --- tests/all.tests| 6 + .../glsl-1.50/execution/geometry/CMakeLists.gl.txt | 1 + .../execution/geometry/gs-mismatch-prim-type.c | 202 + 3 files changed, 209 insertions(+) create mode 100644 tests/spec/glsl-1.50/execution/geometry/gs-mismatch-prim-type.c diff --git a/tests/all.tests b/tests/all.tests index 7ab841e..da4e2e7 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -955,6 +955,12 @@ for prim_type in ['GL_POINTS', 'GL_LINE_LOOP', 'GL_LINE_STRIP', 'GL_LINES', 'glsl-1.50-geometry-primitive-types {0}'.format( prim_type)) +for layout_type in ['points', 'lines', 'lines_adjacency', 'triangles', + 'triangles_adjacency']: +add_concurrent_test(spec['glsl-1.50'], +'glsl-1.50-gs-mismatch-prim-type {0}'.format( +layout_type)) + spec['glsl-3.30'] = Group() import_glsl_parser_tests(spec['glsl-3.30'], os.path.join(testsDir, 'spec', 'glsl-3.30'), diff --git a/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt b/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt index 202fcd2..b7965a8 100644 --- a/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt +++ b/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt @@ -12,3 +12,4 @@ ${OPENGL_glu_LIBRARY} piglit_add_executable (glsl-1.50-geometry-end-primitive end-primitive.c) piglit_add_executable (glsl-1.50-geometry-primitive-types primitive-types.c) +piglit_add_executable (glsl-1.50-gs-mismatch-prim-type gs-mismatch-prim-type.c) diff --git a/tests/spec/glsl-1.50/execution/geometry/gs-mismatch-prim-type.c b/tests/spec/glsl-1.50/execution/geometry/gs-mismatch-prim-type.c new file mode 100644 index 000..83edf0a --- /dev/null +++ b/tests/spec/glsl-1.50/execution/geometry/gs-mismatch-prim-type.c @@ -0,0 +1,202 @@ +/** + * 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. + */ + +/** + * From the GLSL 3.2 spec, section 2.12.1 (Geometry Shader Input Primitives): + * + * "If a geometry shader is active, any command that transfers vertices to the + * GL will generate an INVALID_OPERATION error if the primitive mode parameter + * is incompatible with the input primitive type of the currently active + * program object, as discussed below." + * + * "Geometry shaders that operate on points are valid only for the POINTS + * primitive type." + * "Geometry shaders that operate on line segments are valid only for the LINES, + * LINE_STRIP, and LINE_LOOP primitive types." + * "Geometry shaders that operate on line segments with adjacent vertices are + * valid only for the LINES_ADJACENCY and LINE_STRIP_ADJACENCY primitive + * types." + * "Geometry shaders that operate on triangles are valid for the TRIANGLES, + * TRIANGLE_STRIP and TRIANGLE_FAN primitive types." + * "Geometry shaders that operate on triangles with adjacent vertices are valid + * for the TRIANGLES_ADJACENCY and TRIANGLE_STRIP_ADJACENCY primitive types." + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 32; +config.supports_gl_core_version = 32; + + config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE; + +PIGLIT_GL_TEST_CONFIG_END + +static const char *vstext = + "#version 150\n" + "in vec3 vertex;\n" + "out vec3 pos;\n" + "void main() {\n" + " gl_Position = vec4(vertex, 1.);\n" + " pos = vertex;\n" + "}\n"; + +static const char *gstemplate = + "#version 150\n" + "#define LAYOUT_TYPE %s\n" + "layout(LAYOUT_TYPE) in;\n" + "layout(triangles, max_vertices = 3) out;\n" + "in vec3 pos[];\n" +
[Piglit] [PATCH] Test that nothing is drawn if GS emits too few vertices to create a primitive
--- tests/all.tests | 1 + tests/spec/glsl-1.50/CMakeLists.gl.txt| 13 +++ tests/spec/glsl-1.50/CMakeLists.txt | 1 + tests/spec/glsl-1.50/gs-emits-too-few-verts.c | 153 ++ 4 files changed, 168 insertions(+) create mode 100644 tests/spec/glsl-1.50/CMakeLists.gl.txt create mode 100644 tests/spec/glsl-1.50/gs-emits-too-few-verts.c diff --git a/tests/all.tests b/tests/all.tests index 7ab841e..efea193 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -937,6 +937,7 @@ for draw in ['', 'indexed']: add_concurrent_test(spec['glsl-1.50'], ('arb_geometry_shader4-ignore-adjacent-vertices ' 'core {0} {1}').format(draw, prim)) +spec['glsl-1.50']['gs-emits-too-few-verts'] = concurrent_test('gs-emits-too-few-verts') # max_vertices of 32 and 128 are important transition points for # mesa/i965 (they are the number of bits in a float and a vec4, diff --git a/tests/spec/glsl-1.50/CMakeLists.gl.txt b/tests/spec/glsl-1.50/CMakeLists.gl.txt new file mode 100644 index 000..7609b98 --- /dev/null +++ b/tests/spec/glsl-1.50/CMakeLists.gl.txt @@ -0,0 +1,13 @@ +include_directories( + ${GLEXT_INCLUDE_DIR} + ${OPENGL_INCLUDE_PATH} +) + +link_libraries ( + piglitutil_${piglit_target_api} + ${OPENGL_gl_LIBRARY} + ${OPENGL_glu_LIBRARY} +) + +piglit_add_executable (gs-emits-too-few-verts gs-emits-too-few-verts.c) +# vim: ft=cmake: diff --git a/tests/spec/glsl-1.50/CMakeLists.txt b/tests/spec/glsl-1.50/CMakeLists.txt index bb76f08..e4126fc 100644 --- a/tests/spec/glsl-1.50/CMakeLists.txt +++ b/tests/spec/glsl-1.50/CMakeLists.txt @@ -1 +1,2 @@ add_subdirectory (execution) +piglit_include_target_api() diff --git a/tests/spec/glsl-1.50/gs-emits-too-few-verts.c b/tests/spec/glsl-1.50/gs-emits-too-few-verts.c new file mode 100644 index 000..411e697 --- /dev/null +++ b/tests/spec/glsl-1.50/gs-emits-too-few-verts.c @@ -0,0 +1,153 @@ +/** + * 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. + */ + +/** + * From the GLSL 3.2 spec, section 2.12.2 (Geometry Shader Output Primitives): + * + * "If the number of vertices emitted by the geometry shader is not sufficient + * to produce a single primitive, nothing is drawn." + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 32; +config.supports_gl_core_version = 32; + + config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE; + +PIGLIT_GL_TEST_CONFIG_END + +static const char *vstext = + "#version 150\n" + "in vec3 vertex;\n" + "out vec3 pos;\n" + "void main() {\n" + " gl_Position = vec4(vertex, 1.);\n" + " pos = vertex;\n" + "}\n"; + +static const char *gstext = + "#version 150\n" + "layout(triangles) in;\n" + "layout(triangles, max_vertices = 3) out;\n" + "in vec3 pos[];\n" + "void main() {\n" + " for(int i = 0; i < pos.length()-1; i++) {\n" + " gl_Position = vec4(pos[i], 1.);\n" + " EmitVertex();\n" + " }\n" + "}\n"; + +static const char *fstext = + "#version 150\n" + "out vec4 color;\n" + "void main() {\n" + " color = vec4(1., 0., 0., 1.);\n" + "}\n"; + +static GLuint vao; +static GLuint vertBuff; +static GLuint indexBuf; + +static GLfloat vertices[] = { + -1.0, 1.0, 0.0, +1.0, 1.0, 0.0, +1.0,-1.0, 0.0, + -1.0,-1.0, 0.0 +}; +static GLsizei vertSize = sizeof(vertices); + +static GLuint indices[] = { + 0, 1, 2, 0, 2, 3 +}; +static GLsizei indSize = sizeof(indices); + +static GLuint prog; + +void +piglit_init(int argc, char **argv) +{ + GLuint vs = 0, gs = 0, fs = 0; + GLuint vertIndex
[Piglit] [PATCH] Test that geometry shaders input types must match the primitive mode
--- tests/spec/glsl-1.50/CMakeLists.gl.txt | 22 +++ tests/spec/glsl-1.50/CMakeLists.txt| 1 + .../glsl-1.50/gs-mismatch-prim-type-lines-adj.c| 167 + tests/spec/glsl-1.50/gs-mismatch-prim-type-lines.c | 167 + .../spec/glsl-1.50/gs-mismatch-prim-type-points.c | 167 + .../gs-mismatch-prim-type-triangles-adj.c | 166 .../glsl-1.50/gs-mismatch-prim-type-triangles.c| 166 7 files changed, 856 insertions(+) create mode 100644 tests/spec/glsl-1.50/CMakeLists.gl.txt create mode 100644 tests/spec/glsl-1.50/gs-mismatch-prim-type-lines-adj.c create mode 100644 tests/spec/glsl-1.50/gs-mismatch-prim-type-lines.c create mode 100644 tests/spec/glsl-1.50/gs-mismatch-prim-type-points.c create mode 100644 tests/spec/glsl-1.50/gs-mismatch-prim-type-triangles-adj.c create mode 100644 tests/spec/glsl-1.50/gs-mismatch-prim-type-triangles.c diff --git a/tests/spec/glsl-1.50/CMakeLists.gl.txt b/tests/spec/glsl-1.50/CMakeLists.gl.txt new file mode 100644 index 000..5ddd05a --- /dev/null +++ b/tests/spec/glsl-1.50/CMakeLists.gl.txt @@ -0,0 +1,22 @@ +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} +) + +piglit_add_executable (glsl-1.50-gs-mismatch-prim-type-lines + gs-mismatch-prim-type-lines.c) +piglit_add_executable (glsl-1.50-gs-mismatch-prim-type-lines-adj + gs-mismatch-prim-type-lines-adj.c) +piglit_add_executable (glsl-1.50-gs-mismatch-prim-type-points + gs-mismatch-prim-type-points.c) +piglit_add_executable (glsl-1.50-gs-mismatch-prim-type-triangles + gs-mismatch-prim-type-triangles.c) +piglit_add_executable (glsl-1.50-gs-mismatch-prim-type-triangles-adj + gs-mismatch-prim-type-triangles-adj.c) diff --git a/tests/spec/glsl-1.50/CMakeLists.txt b/tests/spec/glsl-1.50/CMakeLists.txt index bb76f08..e4126fc 100644 --- a/tests/spec/glsl-1.50/CMakeLists.txt +++ b/tests/spec/glsl-1.50/CMakeLists.txt @@ -1 +1,2 @@ add_subdirectory (execution) +piglit_include_target_api() diff --git a/tests/spec/glsl-1.50/gs-mismatch-prim-type-lines-adj.c b/tests/spec/glsl-1.50/gs-mismatch-prim-type-lines-adj.c new file mode 100644 index 000..1ede844 --- /dev/null +++ b/tests/spec/glsl-1.50/gs-mismatch-prim-type-lines-adj.c @@ -0,0 +1,167 @@ +/** + * 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. + */ + +/** + * From the GLSL 3.2 spec, section 2.12.1 (Geometry Shader Input Primitives): + * + * "If a geometry shader is active, any command that transfers vertices to the + * GL will generate an INVALID_OPERATION error if the primitive mode parameter + * is incompatible with the input primitive type of the currently active + * program object, as discussed below." + * + * "Geometry shaders that operate on line segments with adjacent vertices are + * valid only for the LINES_ADJACENCY and LINE_STRIP_ADJACENCY primitive + * types." + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 32; +config.supports_gl_core_version = 32; + + config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE; + +PIGLIT_GL_TEST_CONFIG_END + +static const char *vstext = + "#version 150\n" + "in vec3 vertex;\n" + "out vec3 pos;\n" + "void main() {\n" + " gl_Position = vec4(vertex, 1.);\n" + " pos = vertex;\n" + "}\n"; + +static const char *gstext = + "#version 150\n" + "layout(lines_adjacency) in;\n" + "layout(triangles, max_vertices = 3) out;\n" + "in vec3 pos[];\n" + "void main
[Piglit] [PATCH] GL 1.50: Test that UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER is accepted by GetActiveUniformBlockiv()
--- tests/spec/glsl-1.50/CMakeLists.gl.txt | 13 +++ tests/spec/glsl-1.50/CMakeLists.txt| 1 + .../query-uniform-block-referenced-by-gs.c | 124 + 3 files changed, 138 insertions(+) create mode 100644 tests/spec/glsl-1.50/CMakeLists.gl.txt create mode 100644 tests/spec/glsl-1.50/query-uniform-block-referenced-by-gs.c diff --git a/tests/spec/glsl-1.50/CMakeLists.gl.txt b/tests/spec/glsl-1.50/CMakeLists.gl.txt new file mode 100644 index 000..aad78f6 --- /dev/null +++ b/tests/spec/glsl-1.50/CMakeLists.gl.txt @@ -0,0 +1,13 @@ +include_directories( + ${GLEXT_INCLUDE_DIR} + ${OPENGL_INCLUDE_PATH} +) + +link_libraries ( + piglitutil_${piglit_target_api} + ${OPENGL_gl_LIBRARY} + ${OPENGL_glu_LIBRARY} +) + +piglit_add_executable (query-uniform-block-referenced-by-gs + query-uniform-block-referenced-by-gs.c) diff --git a/tests/spec/glsl-1.50/CMakeLists.txt b/tests/spec/glsl-1.50/CMakeLists.txt index bb76f08..e4126fc 100644 --- a/tests/spec/glsl-1.50/CMakeLists.txt +++ b/tests/spec/glsl-1.50/CMakeLists.txt @@ -1 +1,2 @@ add_subdirectory (execution) +piglit_include_target_api() diff --git a/tests/spec/glsl-1.50/query-uniform-block-referenced-by-gs.c b/tests/spec/glsl-1.50/query-uniform-block-referenced-by-gs.c new file mode 100644 index 000..76bbd15 --- /dev/null +++ b/tests/spec/glsl-1.50/query-uniform-block-referenced-by-gs.c @@ -0,0 +1,124 @@ +/** + * 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 that UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER is accepted by + * GetActiveUniformBlockiv() + * + * Section 2.11.4(Uniform Variables) of OpenGL 3.2 Core says: + * "Information about an active uniform block can be queried by calling + * void GetActiveUniformBlockiv( uint program, + * uint uniformBlockIndex, + * enum pname, int *params ); + * If pname is UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER, + * UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER, or + * UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER, then a boolean value indicating + * whether the uniform block identified by uniformBlockIndex is referenced by + * the vertex, geometry, or fragment programming stages of program, + * respectively, is returned." + * + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 32; +config.supports_gl_core_version = 32; + + config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE; + +PIGLIT_GL_TEST_CONFIG_END + +static const char *vstext = + "#version 150\n" + "in vec3 vert1;\n" + "out vec3 vert;\n" + "void main() {\n" + " gl_Position = vec4(vert1, 1.);\n" + " vert = vert1;\n" + "}\n"; + +static const char *gstext = + "#version 150\n" + "layout(triangles) in;\n" + "layout(triangles, max_vertices=3) out;\n" + "in vec3 vert[];\n" + "uniform block {\n" + " vec4 a;\n" + " float b;\n" + " vec2 c;\n" + "} uBlock;\n" + "void main() {\n" + " uBlock.a = vec4(2.);\n" + " uBlock.b = 3.3;\n" + " uBlock.c = vec2(1., .5);\n" + " for(int i = 0; i < 3; i++) {\n" + " gl_Position = vec4(vert[i], 1.);\n" + " EmitVertex();\n" + " }\n" + "}\n"; + +static const char *fstext = + "#version 150\n" + "void main() {\n" + " gl_FragColor = vec4(1.);\n" + "}\n"; + +static GLuint prog; + +void +piglit_init(int argc, char **argv) +{ + bool pass = true; + GLuint vs = 0, gs = 0, fs = 0; + GLint param = 0; + + prog = glCreateProgram(); + vs = piglit_compile_shader_text(GL_
[Piglit] [PATCH 2/3] GLSL 1.50: Test that differently specified input/output layouts results in link error
--- ...ax-vertices-multiple-shader-objects.shader_test | 64 ++ ...output-type-multiple-shader-objects.shader_test | 64 ++ 2 files changed, 128 insertions(+) create mode 100644 tests/spec/glsl-1.50/linker/gs-same-max-vertices-multiple-shader-objects.shader_test create mode 100644 tests/spec/glsl-1.50/linker/gs-same-output-type-multiple-shader-objects.shader_test diff --git a/tests/spec/glsl-1.50/linker/gs-same-max-vertices-multiple-shader-objects.shader_test b/tests/spec/glsl-1.50/linker/gs-same-max-vertices-multiple-shader-objects.shader_test new file mode 100644 index 000..414629f --- /dev/null +++ b/tests/spec/glsl-1.50/linker/gs-same-max-vertices-multiple-shader-objects.shader_test @@ -0,0 +1,64 @@ +# Section 2.11.2 (Program Objects) of the GLSL 1.50 spec says: +# +# "Linking will also fail if the program object contains objects to form a +# geometry shader (see section 2.12), and +# • the program contains no objects to form a vertex shader; +# • the input primitive type, output primitive type, or maximum output +#vertex count is not specified in any compiled geometry shader object; +# • the input primitive type, output primitive type, or maximum output +#vertex count is specified differently in multiple geometry shader +#objects." + +[require] +GLSL >= 1.50 + +[vertex shader] +#version 150 + +in vec4 vertex; +out vec4 vertex_to_gs; + +void main() +{ + vertex_to_gs = vertex; +} + +[geometry shader] +#version 150 + +layout(triangles) in; +layout(triangle_strip, max_vertices = 3) out; + +void do_vertex(int i); + +void main() +{ + for (int i = 0; i < 2; i++) +do_vertex(i); +} + +[geometry shader] +#version 150 + +layout(max_vertices = 2) out; + +in vec4 vertex_to_gs[2]; + +void do_vertex(int i) +{ + gl_Position = vertex_to_gs[i]; + EmitVertex(); +} + +[fragment shader] +#version 150 + +out vec4 color; + +void main() +{ + color = vec4(0.0, 1.0, 0.0, 1.0); +} + +[test] +link error diff --git a/tests/spec/glsl-1.50/linker/gs-same-output-type-multiple-shader-objects.shader_test b/tests/spec/glsl-1.50/linker/gs-same-output-type-multiple-shader-objects.shader_test new file mode 100644 index 000..4a35770 --- /dev/null +++ b/tests/spec/glsl-1.50/linker/gs-same-output-type-multiple-shader-objects.shader_test @@ -0,0 +1,64 @@ +# Section 2.11.2 (Program Objects) of the GLSL 1.50 spec says: +# +# "Linking will also fail if the program object contains objects to form a +# geometry shader (see section 2.12), and +# • the program contains no objects to form a vertex shader; +# • the input primitive type, output primitive type, or maximum output +#vertex count is not specified in any compiled geometry shader object; +# • the input primitive type, output primitive type, or maximum output +#vertex count is specified differently in multiple geometry shader +#objects." + +[require] +GLSL >= 1.50 + +[vertex shader] +#version 150 + +in vec4 vertex; +out vec4 vertex_to_gs; + +void main() +{ + vertex_to_gs = vertex; +} + +[geometry shader] +#version 150 + +layout(triangles) in; +layout(triangle_strip, max_vertices = 3) out; + +void do_vertex(int i); + +void main() +{ + for (int i = 0; i < 2; i++) +do_vertex(i); +} + +[geometry shader] +#version 150 + +layout(points) out; + +in vec4 vertex_to_gs[1]; + +void do_vertex(int i) +{ + gl_Position = vertex_to_gs[i]; + EmitVertex(); +} + +[fragment shader] +#version 150 + +out vec4 color; + +void main() +{ + color = vec4(0.0, 1.0, 0.0, 1.0); +} + +[test] +link error -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 3/3] GLSL 1.50: Test that linking fails if there is a geom shader without a vert shader
--- .../glsl-1.50/linker/gs-without-vs.shader_test | 39 ++ 1 file changed, 39 insertions(+) create mode 100644 tests/spec/glsl-1.50/linker/gs-without-vs.shader_test diff --git a/tests/spec/glsl-1.50/linker/gs-without-vs.shader_test b/tests/spec/glsl-1.50/linker/gs-without-vs.shader_test new file mode 100644 index 000..05c14dc --- /dev/null +++ b/tests/spec/glsl-1.50/linker/gs-without-vs.shader_test @@ -0,0 +1,39 @@ +# Section 2.11.2 (Program Objects) of the GLSL 1.50 spec says: +# +# "Linking will also fail if the program object contains objects to form a +# geometry shader (see section 2.12), and +# • the program contains no objects to form a vertex shader; +# • the input primitive type, output primitive type, or maximum output +#vertex count is not specified in any compiled geometry shader object; +# • the input primitive type, output primitive type, or maximum output +#vertex count is specified differently in multiple geometry shader +#objects." + +[require] +GLSL >= 1.50 + +[geometry shader] +#version 150 + +layout(triangles) in; +layout(triangles, max_vertices = 3) out; + +in vec4 vertex[3]; + +void main() +{ + gl_Position = vertex[0]; + EmitVertex(); +} + +[fragment shader] +#version 150 + +out vec4 color; + +void main() +{ + color = vec4(0.0, 1.0, 0.0, 1.0); +} + +[test] -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 1/3] GLSL 1.50: Test that geometry shader must specify input type, output type and maximum output vertices
--- .../linker/gs-must-specify-input-type.shader_test | 52 + .../gs-must-specify-max-vertices.shader_test | 53 ++ .../linker/gs-must-specify-output-type.shader_test | 53 ++ 3 files changed, 158 insertions(+) create mode 100644 tests/spec/glsl-1.50/linker/gs-must-specify-input-type.shader_test create mode 100644 tests/spec/glsl-1.50/linker/gs-must-specify-max-vertices.shader_test create mode 100644 tests/spec/glsl-1.50/linker/gs-must-specify-output-type.shader_test diff --git a/tests/spec/glsl-1.50/linker/gs-must-specify-input-type.shader_test b/tests/spec/glsl-1.50/linker/gs-must-specify-input-type.shader_test new file mode 100644 index 000..af4967b --- /dev/null +++ b/tests/spec/glsl-1.50/linker/gs-must-specify-input-type.shader_test @@ -0,0 +1,52 @@ +# Section 2.11.2 (Program Objects) of the GLSL 1.50 spec says: +# +# "Linking will also fail if the program object contains objects to form a +# geometry shader (see section 2.12), and +# • the program contains no objects to form a vertex shader; +# • the input primitive type, output primitive type, or maximum output +#vertex count is not specified in any compiled geometry shader object; +# • the input primitive type, output primitive type, or maximum output +#vertex count is specified differently in multiple geometry shader +#objects." + +[require] +GLSL >= 1.50 + +[vertex shader] +#version 150 + +in vec4 vertex; +out vec4 vertex_to_gs; + +void main() +{ + vertex_to_gs = vertex; +} + +[geometry shader] +#version 150 + +layout(triangles, max_vertices = 3) out; + +in vec4 vertex_to_gs[3]; + +void main() +{ + for(int i = 0; i < 3; i++) { + gl_Position = vertex_to_gs[i]; + EmitVertex(); + } +} + +[fragment shader] +#version 150 + +out vec4 color; + +void main() +{ + color = vec4(0.0, 1.0, 0.0, 1.0); +} + +[test] +link error diff --git a/tests/spec/glsl-1.50/linker/gs-must-specify-max-vertices.shader_test b/tests/spec/glsl-1.50/linker/gs-must-specify-max-vertices.shader_test new file mode 100644 index 000..9126fec --- /dev/null +++ b/tests/spec/glsl-1.50/linker/gs-must-specify-max-vertices.shader_test @@ -0,0 +1,53 @@ +# Section 2.11.2 (Program Objects) of the GLSL 1.50 spec says: +# +# "Linking will also fail if the program object contains objects to form a +# geometry shader (see section 2.12), and +# • the program contains no objects to form a vertex shader; +# • the input primitive type, output primitive type, or maximum output +#vertex count is not specified in any compiled geometry shader object; +# • the input primitive type, output primitive type, or maximum output +#vertex count is specified differently in multiple geometry shader +#objects." + +[require] +GLSL >= 1.50 + +[vertex shader] +#version 150 + +in vec4 vertex; +out vec4 vertex_to_gs; + +void main() +{ + vertex_to_gs = vertex; +} + +[geometry shader] +#version 150 + +layout(triangles) in; +layout(triangles) out; + +in vec4 vertex_to_gs[]; + +void main() +{ + for(int i = 0; i < 3; i++) { + gl_Position = vertex_to_gs[i]; + EmitVertex(); + } +} + +[fragment shader] +#version 150 + +out vec4 color; + +void main() +{ + color = vec4(0.0, 1.0, 0.0, 1.0); +} + +[test] +link error diff --git a/tests/spec/glsl-1.50/linker/gs-must-specify-output-type.shader_test b/tests/spec/glsl-1.50/linker/gs-must-specify-output-type.shader_test new file mode 100644 index 000..97de5ac --- /dev/null +++ b/tests/spec/glsl-1.50/linker/gs-must-specify-output-type.shader_test @@ -0,0 +1,53 @@ +# Section 2.11.2 (Program Objects) of the GLSL 1.50 spec says: +# +# "Linking will also fail if the program object contains objects to form a +# geometry shader (see section 2.12), and +# • the program contains no objects to form a vertex shader; +# • the input primitive type, output primitive type, or maximum output +#vertex count is not specified in any compiled geometry shader object; +# • the input primitive type, output primitive type, or maximum output +#vertex count is specified differently in multiple geometry shader +#objects." + +[require] +GLSL >= 1.50 + +[vertex shader] +#version 150 + +in vec4 vertex; +out vec4 vertex_to_gs; + +void main() +{ + vertex_to_gs = vertex; +} + +[geometry shader] +#version 150 + +layout(triangles) in; +layout(max_vertices = 3) out; + +in vec4 vertex_to_gs[]; + +void main() +{ + for(int i = 0; i < 3; i++) { + gl_Position = vertex_to_gs[i]; + EmitVertex(); + } +} + +[fragment shader] +#version 150 + +out vec4 color; + +void main() +{ + color = vec4(0.0, 1.0, 0.0, 1.0); +} + +[test] +link error -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mai
[Piglit] [PATCH 1/2] GLSL 1.50: Test that geometry shader output may be a struct
--- tests/spec/glsl-1.50/compiler/output-struct.geom | 52 1 file changed, 52 insertions(+) create mode 100644 tests/spec/glsl-1.50/compiler/output-struct.geom diff --git a/tests/spec/glsl-1.50/compiler/output-struct.geom b/tests/spec/glsl-1.50/compiler/output-struct.geom new file mode 100644 index 000..290c957 --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/output-struct.geom @@ -0,0 +1,52 @@ +// [config] +// expect_result: pass +// glsl_version: 1.50 +// check_link: false +// [end config] +// +//Tests compiler/parser: output of geometry shader may be a struct + +/* +* GLSLLangSpec.1.50.09 4.3.6 Outputs: +* Vertex and geometry output variables output per-vertex data and are declared +* using the out storage qualifier, the centroid out storage qualifier, or the +* deprecated varying storage qualifier. They can only be float, floating-point +* vectors, matrices, signed or unsigned integers or integer vectors, or arrays +* or structures of any these. +*/ + +#version 150 + +layout(triangles) in; +layout(triangles) out; + +in int a[]; +in float b[]; +in vec3 c[]; +in mat4 d[]; + +out struct foo +{ + int a; + float b; + vec3 c; + mat4 d; +} s; + +void main() +{ + for (int i = 0; i < 3; i++) { + s.a = a[i]; + s.b = b[i]; + s.c = c[i]; + s.d = d[i]; + + gl_Position = vec4( + s.a + + s.b + + s.c.x + + s.d[0].x + ); + EmitVertex(); + } +} -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 2/2] GLSL 1.50: Test that struct varyings are passed correctly from GS to FS
--- .../varying-struct-basic-vs-gs-fs.shader_test | 141 + 1 file changed, 141 insertions(+) create mode 100644 tests/spec/glsl-1.50/execution/varying-struct-basic-vs-gs-fs.shader_test diff --git a/tests/spec/glsl-1.50/execution/varying-struct-basic-vs-gs-fs.shader_test b/tests/spec/glsl-1.50/execution/varying-struct-basic-vs-gs-fs.shader_test new file mode 100644 index 000..e59e2b5 --- /dev/null +++ b/tests/spec/glsl-1.50/execution/varying-struct-basic-vs-gs-fs.shader_test @@ -0,0 +1,141 @@ +# Test that varying structs work properly. +# +# From the GLSL 1.50 specification, section 4.3.4 ("Input Variables"): +# +# "Fragment inputs can only be signed and unsigned integers and +# integer vectors, float, floating-point vectors, matrices, or +# arrays or structures of these." +# +# And from section 4.3.6 ("Output Variables"): +# +# "Vertex and geometry output variables output per-vertex data and are +# declared using the out storage qualifier, the centroid out storage +# qualifier, or the deprecated varying storage qualifier. They can only be +# float, floating-point vectors, matrices, signed or unsigned integers or +# integer vectors, or arrays or structures of any these." +# +# This test verifies basic functionality of varying structs using a +# varying struct containing a variety of types. + +[require] +GL >= 3.2 +GLSL >= 1.50 + +[vertex shader] +#version 150 + +in vec4 vertex; +out vec4 pos; + +void main() +{ + gl_Position = vertex; + pos = vertex; +} + +[geometry shader] +#version 150 + +uniform float ref; + +layout(triangles) in; +layout(triangles, max_vertices=3) out; + +in vec4 pos[]; + +struct Foo +{ + mat4 a; + mat3 b; + mat2 c; + vec4 d; + vec3 e; + vec2 f; + float g; +}; +out Foo foo; + +void main() +{ + for(int i = 0; i < 3; i++) { + gl_Position = pos[i]; + foo.a = mat4(ref,ref + 1.0, ref + 2.0, ref + 3.0, +ref + 4.0, ref + 5.0, ref + 6.0, ref + 7.0, +ref + 8.0, ref + 9.0, ref + 10.0, ref + 11.0, +ref + 12.0, ref + 13.0, ref + 14.0, ref + 15.0); + + foo.b = mat3(ref + 16.0, ref + 17.0, ref + 18.0, +ref + 19.0, ref + 20.0, ref + 21.0, +ref + 22.0, ref + 23.0, ref + 24.0); + + foo.c = mat2(ref + 25.0, ref + 26.0, +ref + 27.0, ref + 28.0); + + foo.d = vec4(ref + 29.0, ref + 30.0, ref + 31.0, ref + 32.0); + foo.e = vec3(ref + 33.0, ref + 34.0, ref + 35.0); + foo.f = vec2(ref + 36.0, ref + 37.0); + foo.g = ref + 38.0; + EmitVertex(); + } +} + +[fragment shader] +#version 150 + +uniform float ref; + +struct Foo +{ + mat4 a; + mat3 b; + mat2 c; + vec4 d; + vec3 e; + vec2 f; + float g; +}; +in Foo foo; +out vec4 color; + +#define CHECK(value, expected) \ + if (distance(value, expected) > 0.1) \ + failed = true + +void main() +{ + bool failed = false; + + CHECK(foo.a[0], vec4(ref,ref + 1.0, ref + 2.0, ref + 3.0)); + CHECK(foo.a[1], vec4(ref + 4.0, ref + 5.0, ref + 6.0, ref + 7.0)); + CHECK(foo.a[2], vec4(ref + 8.0, ref + 9.0, ref + 10.0, ref + 11.0)); + CHECK(foo.a[3], vec4(ref + 12.0, ref + 13.0, ref + 14.0, ref + 15.0)); + + CHECK(foo.b[0], vec3(ref + 16.0, ref + 17.0, ref + 18.0)); + CHECK(foo.b[1], vec3(ref + 19.0, ref + 20.0, ref + 21.0)); + CHECK(foo.b[2], vec3(ref + 22.0, ref + 23.0, ref + 24.0)); + + CHECK(foo.c[0], vec2(ref + 25.0, ref + 26.0)); + CHECK(foo.c[1], vec2(ref + 27.0, ref + 28.0)); + + CHECK(foo.d, vec4(ref + 29.0, ref + 30.0, ref + 31.0, ref + 32.0)); + CHECK(foo.e, vec3(ref + 33.0, ref + 34.0, ref + 35.0)); + CHECK(foo.f, vec2(ref + 36.0, ref + 37.0)); + CHECK(foo.g, ref + 38.0); + + if (failed) + color = vec4(1.0, 0.0, 0.0, 1.0); + else + color = vec4(0.0, 1.0, 0.0, 1.0); +} + +[vertex data] +vertex/float/2 +-1.0 -1.0 + 1.0 -1.0 + 1.0 1.0 +-1.0 1.0 + +[test] +uniform float ref 137.035999074 +draw arrays GL_TRIANGLE_FAN 0 4 +probe all rgba 0.0 1.0 0.0 1.0 -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH v2 07/10] 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 --- tests/spec/arb_sync/CMakeLists.gl.txt | 1 + tests/spec/arb_sync/IsSync.c | 82 +++ 2 files changed, 83 insertions(+) create mode 100644 tests/spec/arb_sync/IsSync.c 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..be0 --- /dev/null +++ b/tests/spec/arb_sync/IsSync.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 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 test1; + GLsync test2 = (GLsync)GL_BACK; + + if (piglit_get_gl_version() < 32) { + piglit_require_extension("GL_ARB_sync"); + } + + /* Create valid sync object */ + test1 = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); + + /* Check if a valid name returns true */ + pass = glIsSync(test1) && pass; + + /* Check if invalid names return false */ + /* From the GL 3.2 Core specification: +* "If 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(test2) && pass; + + pass = !glIsSync(0) && pass; + + glDeleteSync(test1); + + 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 v2 08/10] 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 --- tests/spec/arb_sync/CMakeLists.gl.txt | 1 + tests/spec/arb_sync/sync-initialize.c | 125 ++ 2 files changed, 126 insertions(+) create mode 100644 tests/spec/arb_sync/sync-initialize.c 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..eb1bb86 --- /dev/null +++ b/tests/spec/arb_sync/sync-initialize.c @@ -0,0 +1,125 @@ +/** + * 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 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 + * SYNC_STATUSUNSIGNALED + * SYNC_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; +} + +static GLsync test; + +void +piglit_init(int argc, char **argv) +{ + bool pass = true; + GLsizei length = -5; + GLint value; + + if (piglit_get_gl_version() < 32) { + piglit_require_extension("GL_ARB_sync"); + } + + test = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); + + /* Test initialized as fence type */ + glGetSynciv(test, 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 */ + glGetSynciv(test, GL_SYNC_CONDITION, 1, &length, &value); + if(length != 1) { + printf("length should be 1 but incorrectly returned: %d\n", + length); + pass = false; + } + if(value != GL_SYNC_GPU_COMMANDS_COMPLETE) { + printf("Expected GL_SYNC_GPU_COMMANDS_COMPLETE but returned: %s\n", + piglit_get_gl_enum_name(value)); + pass = false; + } + + /* Test initialed to unsignaled */ + glGetSynciv(test, GL_SYNC_STATUS, 1, &length, &value); + if(length != 1) { + printf("length should be 1 but incorrectly returned: %d\n", + length); + pass = false; + } + if(value != GL_UNSIGNALED) { + printf("Expected GL_UNSIGNALED but returned: %s\n", + piglit_get_gl_enum_name(value)); + pass = false; + } + + /* Test initialized with given flag */ + glGetSynciv(test, GL_SYNC_FLAGS, 1, &length, &value); + if(length != 1) { + prin
[Piglit] [PATCH v2 10/10] Add the arb_sync tests to all.tests
--- tests/all.tests | 8 1 file changed, 8 insertions(+) diff --git a/tests/all.tests b/tests/all.tests index 7491cae..f97c65b 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -989,8 +989,16 @@ 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['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['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 -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH v2 06/10] GL3.2 GL_ARB_sync: Test that GetSynciv sets correct error codes.
v2: Fix comments, initialize variables --- tests/spec/arb_sync/CMakeLists.gl.txt | 1 + tests/spec/arb_sync/GetSynciv-errors.c | 94 ++ 2 files changed, 95 insertions(+) create mode 100644 tests/spec/arb_sync/GetSynciv-errors.c 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..46a6b5b --- /dev/null +++ b/tests/spec/arb_sync/GetSynciv-errors.c @@ -0,0 +1,94 @@ +/** + * 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 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 a; + GLsync b = (GLsync) 0x1373; + + GLsizei len; + GLint val; + + if (piglit_get_gl_version() < 32) { + piglit_require_extension("GL_ARB_sync"); + } + + a = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); + + /* test that valid sync results in NO_ERROR */ + glGetSynciv(a, GL_SYNC_STATUS, 1, &len, &val); + pass = piglit_check_gl_error(GL_NO_ERROR) && pass; + + /* test that invalid sync results in INVALID_VALUE */ + glGetSynciv(b, GL_SYNC_STATUS, 1, &len, &val); + pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass; + + /* test valid pname values result in NO_ERROR */ + glGetSynciv(a, GL_OBJECT_TYPE, 1, &len, &val); + pass = piglit_check_gl_error(GL_NO_ERROR) && pass; + + glGetSynciv(a, GL_SYNC_STATUS, 1, &len, &val); + pass = piglit_check_gl_error(GL_NO_ERROR) && pass; + + glGetSynciv(a, GL_SYNC_CONDITION, 1, &len, &val); + pass = piglit_check_gl_error(GL_NO_ERROR) && pass; + + glGetSynciv(a, GL_SYNC_FLAGS, 1, &len, &val); + pass = piglit_check_gl_error(GL_NO_ERROR) && pass; + + /* test that invalid pname results in INVALID_ENUM */ + glGetSynciv(a, GL_INVALID_VALUE, 1, &len, &val); + pass = piglit_check_gl_error(GL_INVALID_ENUM) && 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
[Piglit] [PATCH v2 05/10] GL3.2 GL_ARB_sync: Test for the correct error messages caused by invalid input to FenceSync
v2: Fix comments, remove unnecessary tests. --- tests/spec/arb_sync/CMakeLists.gl.txt | 1 + tests/spec/arb_sync/FenceSync-errors.c | 71 ++ 2 files changed, 72 insertions(+) create mode 100644 tests/spec/arb_sync/FenceSync-errors.c 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..a5d4d78 --- /dev/null +++ b/tests/spec/arb_sync/FenceSync-errors.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. + */ + +/** + * 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 v2 09/10] GL3.2 GL_ARB_sync: Test that the correct error messages are returned from invalid input for WaitSync
v2: Fix comments, remove redundant code --- tests/spec/arb_sync/CMakeLists.gl.txt | 1 + tests/spec/arb_sync/WaitSync-errors.c | 82 +++ 2 files changed, 83 insertions(+) create mode 100644 tests/spec/arb_sync/WaitSync-errors.c 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
[Piglit] [PATCH v2 04/10] GL3.2 GL_ARB_sync: Basic test for DeleteSync
v2: Fix comments, add test for passing invalid sync to IsSync(), change variable types. --- tests/spec/arb_sync/CMakeLists.gl.txt | 2 +- tests/spec/arb_sync/DeleteSync.c | 71 +++ 2 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 tests/spec/arb_sync/DeleteSync.c diff --git a/tests/spec/arb_sync/CMakeLists.gl.txt b/tests/spec/arb_sync/CMakeLists.gl.txt index 1996c75..54637eb 100644 --- a/tests/spec/arb_sync/CMakeLists.gl.txt +++ b/tests/spec/arb_sync/CMakeLists.gl.txt @@ -12,6 +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-errors DeleteSync-errors.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..71305ee --- /dev/null +++ b/tests/spec/arb_sync/DeleteSync.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. + */ + +/** + * 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; + +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 test; + GLsync invalid = (GLsync) GL_FRONT; + + /* 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; + + test = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); + glDeleteSync(test); + pass = piglit_check_gl_error(GL_NO_ERROR) && pass; + /* Check if test was deleted */ + pass = !glIsSync(test) && 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 v2 01/10] 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 --- tests/spec/arb_sync/CMakeLists.gl.txt | 1 + tests/spec/arb_sync/ClientWaitSync-errors.c | 103 2 files changed, 104 insertions(+) create mode 100644 tests/spec/arb_sync/ClientWaitSync-errors.c 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..815585d --- /dev/null +++ b/tests/spec/arb_sync/ClientWaitSync-errors.c @@ -0,0 +1,103 @@ +/** + * 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 ClientWaitSync() returns correct error messages for invalid input + * + * + * Section 5.2.1(Waiting for Sync Objects) of OpenGL 3.2 Core says: + * "If is not the name of a sync object, an INVALID_VALUE error + * is generated. If 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; + GLsync b = (GLsync)20; + GLenum mess1; + int i; + + /* sync not set up yet so this should fail with both GL error and +* respond GL_WAIT_FAILED +*/ + mess1 = glClientWaitSync(a, GL_SYNC_FLUSH_COMMANDS_BIT, 0); + pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass; + if(mess1 != GL_WAIT_FAILED) { + printf("Expected GL_WAIT_FAILED but returned: %s\n", + piglit_get_gl_enum_name(mess1)); + pass = false; + } + + if (piglit_get_gl_version() < 32) { + piglit_require_extension("GL_ARB_sync"); + } + + a = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); + + /* test that valid sync results in NO_ERROR */ + mess1 = glClientWaitSync(a, GL_SYNC_FLUSH_COMMANDS_BIT, 0); + pass = piglit_check_gl_error(GL_NO_ERROR) && pass; + + /* test that invalid sync results in INVALID_VALUE */ + mess1 = glClientWaitSync(b, GL_SYNC_FLUSH_COMMANDS_BIT, 0); + pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass; + + /* test valid flag values result in NO_ERROR (only one option) */ + mess1 = 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; + } + mess1 = glClientWaitSync(a, mask, 0); + 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
[Piglit] [PATCH v2 03/10] GL3.2 GL_ARB_sync: Test DeleteSync errors returned
v2: Remove DeleteSync-errors.c --- tests/spec/arb_sync/CMakeLists.gl.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/spec/arb_sync/CMakeLists.gl.txt b/tests/spec/arb_sync/CMakeLists.gl.txt index ff8ca85..1996c75 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-errors DeleteSync-errors.c) piglit_add_executable (arb_sync-repeat-wait repeat-wait.c) piglit_add_executable (arb_sync-timeout-zero timeout-zero.c) -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH v2 02/10] 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. --- tests/spec/arb_sync/CMakeLists.gl.txt| 3 +- tests/spec/arb_sync/ClientWaitSync-returns.c | 109 +++ 2 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 tests/spec/arb_sync/ClientWaitSync-returns.c 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..1002679 --- /dev/null +++ b/tests/spec/arb_sync/ClientWaitSync-returns.c @@ -0,0 +1,109 @@ +/** + * 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 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; + +PIGLIT_GL_TEST_CONFIG_END + +enum piglit_result +piglit_display(void) +{ + /* UNREACHED */ + return PIGLIT_FAIL; +} + +/* One second in nanoseconds */ +#define ONE_SECOND 100 + +void +piglit_init(int argc, char **argv) +{ + bool pass = true; + GLsync a, b; + GLenum status1; + + /* create syncs */ + a = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); + + /* sync has not been signaled yet */ + status1 = glClientWaitSync(a, GL_SYNC_FLUSH_COMMANDS_BIT, ONE_SECOND); + if(status1 != GL_CONDITION_SATISFIED) { + printf("Expected GL_CONDITION_SATISFIED but returned: %s\n", + piglit_get_gl_enum_name(status1)); + pass = false; + } + + /* sync has already been signaled */ + status1 = glClientWaitSync(a, GL_SYNC_FLUSH_COMMANDS_BIT, ONE_SECOND); + if(status1 != GL_ALREADY_SIGNALED) { + printf("Expected GL_ALREADY_SIGNALED but returned: %s\n", + piglit_get_gl_enum_name(status1)); + pass = false; + } + + /* sync has already been signaled even though timeout is 0 */ + status1 = glClientWaitSync(a, GL_SYNC_FLUSH_COMMANDS_BIT, 0); + if(status1 != GL_ALREADY_SIGNALED) { + printf("Expected GL_ALREADY_SIGNALED with timeout but returned: %s\n", + piglit_get_gl_enum_name(status1)); + pass = false; + } + + /* create new sync and call ClientWaitSync with a quick timeout */ + b = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); + + /* sync will be checked after time
[Piglit] [PATCH 5/5] Add provoking vertex tests to all.tests
--- tests/all.tests | 8 1 file changed, 8 insertions(+) diff --git a/tests/all.tests b/tests/all.tests index 7491cae..54b1edb 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -1196,6 +1196,14 @@ add_plain_test(arb_pixel_buffer_object, 'pbo-teximage') add_plain_test(arb_pixel_buffer_object, 'pbo-teximage-tiling') add_plain_test(arb_pixel_buffer_object, 'pbo-teximage-tiling-2') +# Group ARB_provoking_vertex +arb_provoking_vertex = Group() +spec['ARB_provoking_vertex'] = arb_provoking_vertex; +add_plain_test(arb_provoking_vertex, 'arb-provoking-vertex-control') +add_plain_test(arb_provoking_vertex, 'arb-provoking-vertex-initial') +add_plain_test(arb_provoking_vertex, 'arb-quads-follow-provoking-vertex') +add_plain_test(arb_provoking_vertex, 'arb-xfb-before-flatshading') + # Group ARB_robustness arb_robustness = Group() spec['ARB_robustness'] = arb_robustness -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 4/5] GL 3.2: Test that the Transform Feedback Buffer collects data before flatshading occurs
--- tests/spec/arb_provoking_vertex/CMakeLists.gl.txt | 1 + .../arb_provoking_vertex/xfb-before-flatshading.c | 203 + 2 files changed, 204 insertions(+) create mode 100644 tests/spec/arb_provoking_vertex/xfb-before-flatshading.c diff --git a/tests/spec/arb_provoking_vertex/CMakeLists.gl.txt b/tests/spec/arb_provoking_vertex/CMakeLists.gl.txt index a5ebff9..d70637c 100644 --- a/tests/spec/arb_provoking_vertex/CMakeLists.gl.txt +++ b/tests/spec/arb_provoking_vertex/CMakeLists.gl.txt @@ -12,5 +12,6 @@ link_libraries ( piglit_add_executable (arb-provoking-vertex-control provoking-vertex-control.c) piglit_add_executable (arb-provoking-vertex-initial provoking-vertex-initial.c) piglit_add_executable (arb-quads-follow-provoking-vertex quads-follow-provoking-vertex.c) +piglit_add_executable (arb-xfb-before-flatshading xfb-before-flatshading.c) # vim: ft=cmake: diff --git a/tests/spec/arb_provoking_vertex/xfb-before-flatshading.c b/tests/spec/arb_provoking_vertex/xfb-before-flatshading.c new file mode 100644 index 000..359ad68 --- /dev/null +++ b/tests/spec/arb_provoking_vertex/xfb-before-flatshading.c @@ -0,0 +1,203 @@ +/** + * 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 that transform feedback occurs before flatshading + * + * Section 2.16(Transform Feedback) of OpenGL 3.2 Core says: + * "In transform feedback mode, attributes of the vertices of transformed + * primitives processed by a vertex shader, or primitives generated by a + * geometry shader if one is active, are written out to one or more buffer + * objects. The vertices are fed back after vertex color clamping, but before + * flatshading and clipping." + * + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 32; +config.supports_gl_core_version = 32; + + config.window_width = 100; + config.window_height = 100; + config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE; + +PIGLIT_GL_TEST_CONFIG_END + +static const char *vstext = + "#version 130\n" + "in vec3 vert1;\n" + "in vec3 color;\n" + "flat out vec3 color1;\n" + "out vec3 vert;\n" + "void main() {\n" + " gl_Position = vec4(vert1, 1.);\n" + " vert = vert1;\n" + " color1 = color;\n" + "}\n"; + +static const char *fstext = + "#version 130\n" + "in vec3 vert;\n" + "flat in vec3 color1;\n" + "void main() {\n" + " gl_FragColor = vec4(color1, 1.);\n" + "}\n"; + +static GLuint vao; +static GLuint vertBuff; +static GLuint indexBuf; +static GLuint vertColorBuf; + +static GLfloat vertices[] = { + -1.0, 1.0, 0.0, +1.0, 1.0, 0.0, +1.0,-1.0, 0.0, + -1.0,-1.0, 0.0 +}; +static GLsizei vertSize = sizeof(vertices); + +static GLfloat vertColors[] = { + 1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, 1.0, + 0.0, 1.0, 0.0 +}; +static GLsizei vertColorSize = sizeof(vertColors); + +static GLuint indices[] = { + 0, 1, 2, 0, 2, 3 +}; +static GLsizei indSize = sizeof(indices); + +static GLuint xfb_buf; +static GLuint prog; + +/* Only capture the color data into the transform feedback buffer */ +static const char *varyings[] = { "color1" }; + +/* Calculate number of floats contained in the transform varyings */ +static int numVaryingFloats = ARRAY_SIZE(varyings) * ARRAY_SIZE(indices) * 3; + +void +piglit_init(int argc, char **argv) +{ + bool pass = true; + GLuint vs = 0, fs = 0; + GLuint vertIndex; + GLuint vertColorIndex; + + prog = glCreateProgram(); + vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vstext); + fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fstext); + glAttachShader(prog, vs); + glAttachShader(prog, fs); +
[Piglit] [PATCH 3/5] GL 3.2: Test the validity of QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION
Note: The spec refers to QUADS_FOLLOW_PROVOKING_VERTEX but this is a spec bug. --- tests/spec/arb_provoking_vertex/CMakeLists.gl.txt | 1 + .../quads-follow-provoking-vertex.c| 64 ++ 2 files changed, 65 insertions(+) create mode 100644 tests/spec/arb_provoking_vertex/quads-follow-provoking-vertex.c diff --git a/tests/spec/arb_provoking_vertex/CMakeLists.gl.txt b/tests/spec/arb_provoking_vertex/CMakeLists.gl.txt index cdcd99f..a5ebff9 100644 --- a/tests/spec/arb_provoking_vertex/CMakeLists.gl.txt +++ b/tests/spec/arb_provoking_vertex/CMakeLists.gl.txt @@ -11,5 +11,6 @@ link_libraries ( piglit_add_executable (arb-provoking-vertex-control provoking-vertex-control.c) piglit_add_executable (arb-provoking-vertex-initial provoking-vertex-initial.c) +piglit_add_executable (arb-quads-follow-provoking-vertex quads-follow-provoking-vertex.c) # vim: ft=cmake: diff --git a/tests/spec/arb_provoking_vertex/quads-follow-provoking-vertex.c b/tests/spec/arb_provoking_vertex/quads-follow-provoking-vertex.c new file mode 100644 index 000..7270236 --- /dev/null +++ b/tests/spec/arb_provoking_vertex/quads-follow-provoking-vertex.c @@ -0,0 +1,64 @@ +/** + * 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. + */ + +/** + * QUADS_FOLLOW_PROVOKING_VERTEX was added to GL 3.2 spec + * + * Table 6.45 of GL 3.2 core spec includes QUADS_FOLLOW_PROVOKING_VERTEX + * which can be queried with GetBooleanv() to see "Whether quads follow + * provoking vertex convention" + * + * NOTE: Spec incorrectly uses QUADS_FOLLOW_PROVOKING_VERTEX instead of + * QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION. + * See https://cvs.khronos.org/bugzilla/show_bug.cgi?id=8432 + * + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 32; +config.supports_gl_core_version = 32; + +PIGLIT_GL_TEST_CONFIG_END + +void +piglit_init(int argc, char **argv) +{ + bool pass = true; + GLboolean followsProvoking = false; + + glGetBooleanv(GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION, +&followsProvoking); + + pass = piglit_check_gl_error(GL_NO_ERROR) && pass; + + piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); +} + +enum piglit_result +piglit_display(void) +{ + return PIGLIT_FAIL; +} -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 2/5] GL 3.2: Test that the initial value of provoking vertex mode is LAST_VERTEX_CONVENTION
--- tests/spec/arb_provoking_vertex/CMakeLists.gl.txt | 1 + .../provoking-vertex-initial.c | 64 ++ 2 files changed, 65 insertions(+) create mode 100644 tests/spec/arb_provoking_vertex/provoking-vertex-initial.c diff --git a/tests/spec/arb_provoking_vertex/CMakeLists.gl.txt b/tests/spec/arb_provoking_vertex/CMakeLists.gl.txt index e952392..cdcd99f 100644 --- a/tests/spec/arb_provoking_vertex/CMakeLists.gl.txt +++ b/tests/spec/arb_provoking_vertex/CMakeLists.gl.txt @@ -10,5 +10,6 @@ link_libraries ( ) piglit_add_executable (arb-provoking-vertex-control provoking-vertex-control.c) +piglit_add_executable (arb-provoking-vertex-initial provoking-vertex-initial.c) # vim: ft=cmake: diff --git a/tests/spec/arb_provoking_vertex/provoking-vertex-initial.c b/tests/spec/arb_provoking_vertex/provoking-vertex-initial.c new file mode 100644 index 000..1bd30aa --- /dev/null +++ b/tests/spec/arb_provoking_vertex/provoking-vertex-initial.c @@ -0,0 +1,64 @@ +/** + * 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 that the intitial value of PROVOKING_VERTEX is LAST_VERTEX_CONVENTION + * + * Section 2.18(Flatshading) of OpenGL 3.2 Core says: + * "The initial value of the provoking vertex mode is LAST_VERTEX_CONVENTION." + * + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 32; +config.supports_gl_core_version = 32; + +PIGLIT_GL_TEST_CONFIG_END + +void +piglit_init(int argc, char **argv) +{ + bool pass = true; + int ret = 0; + + glGetIntegerv(GL_PROVOKING_VERTEX, &ret); + if(ret != GL_LAST_VERTEX_CONVENTION) { + printf("GL_PROVOKING_VERTEX was expected to be GL_LAST_VERTEX" + "_CONVENTION, but %s was returned.\n", +piglit_get_gl_enum_name(ret)); + pass = false; + } + + pass = piglit_check_gl_error(GL_NO_ERROR) && pass; + + piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); +} + +enum piglit_result +piglit_display(void) +{ + return PIGLIT_FAIL; +} -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 1/5] GL 3.2: Test functionality of ProvokingVertex()
--- tests/spec/CMakeLists.txt | 1 + tests/spec/arb_provoking_vertex/CMakeLists.gl.txt | 14 tests/spec/arb_provoking_vertex/CMakeLists.txt | 1 + .../provoking-vertex-control.c | 77 ++ 4 files changed, 93 insertions(+) create mode 100644 tests/spec/arb_provoking_vertex/CMakeLists.gl.txt create mode 100644 tests/spec/arb_provoking_vertex/CMakeLists.txt create mode 100644 tests/spec/arb_provoking_vertex/provoking-vertex-control.c diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt index 327780f..17c991a 100644 --- a/tests/spec/CMakeLists.txt +++ b/tests/spec/CMakeLists.txt @@ -14,6 +14,7 @@ add_subdirectory (arb_map_buffer_range) add_subdirectory (arb_multisample) add_subdirectory (arb_occlusion_query) add_subdirectory (arb_occlusion_query2) +add_subdirectory (arb_provoking_vertex) add_subdirectory (arb_robustness) add_subdirectory (arb_sampler_objects) add_subdirectory (arb_seamless_cube_map) diff --git a/tests/spec/arb_provoking_vertex/CMakeLists.gl.txt b/tests/spec/arb_provoking_vertex/CMakeLists.gl.txt new file mode 100644 index 000..e952392 --- /dev/null +++ b/tests/spec/arb_provoking_vertex/CMakeLists.gl.txt @@ -0,0 +1,14 @@ +include_directories( + ${GLEXT_INCLUDE_DIR} + ${OPENGL_INCLUDE_PATH} +) + +link_libraries ( + piglitutil_${piglit_target_api} + ${OPENGL_gl_LIBRARY} + ${OPENGL_glu_LIBRARY} +) + +piglit_add_executable (arb-provoking-vertex-control provoking-vertex-control.c) + +# vim: ft=cmake: diff --git a/tests/spec/arb_provoking_vertex/CMakeLists.txt b/tests/spec/arb_provoking_vertex/CMakeLists.txt new file mode 100644 index 000..4a012b9 --- /dev/null +++ b/tests/spec/arb_provoking_vertex/CMakeLists.txt @@ -0,0 +1 @@ +piglit_include_target_api() \ No newline at end of file diff --git a/tests/spec/arb_provoking_vertex/provoking-vertex-control.c b/tests/spec/arb_provoking_vertex/provoking-vertex-control.c new file mode 100644 index 000..302fdc4 --- /dev/null +++ b/tests/spec/arb_provoking_vertex/provoking-vertex-control.c @@ -0,0 +1,77 @@ +/** + * 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 that ProvokingVertex() controls the provoking vertex convention + * + * Section 2.18(Flatshading) of OpenGL 3.2 Core says: + * "The provoking vertex is controlled with the command + * void ProvokingVertex( enum provokeMode ); + * provokeMode must be either FIRST_VERTEX_CONVENTION or + * LAST_VERTEX_CONVENTION" + * + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 32; +config.supports_gl_core_version = 32; + +PIGLIT_GL_TEST_CONFIG_END + +void +piglit_init(int argc, char **argv) +{ + bool pass = true; + int ret = 0; + + glProvokingVertex(GL_FIRST_VERTEX_CONVENTION); + glGetIntegerv(GL_PROVOKING_VERTEX, &ret); + if(ret != GL_FIRST_VERTEX_CONVENTION) { + printf("GL_PROVOKING_VERTEX was expected to be GL_FIRST_VERTEX" + "_CONVENTION, but %s was returned.\n", +piglit_get_gl_enum_name(ret)); + pass = false; + } + pass = piglit_check_gl_error(GL_NO_ERROR) && pass; + + glProvokingVertex(GL_LAST_VERTEX_CONVENTION); + glGetIntegerv(GL_PROVOKING_VERTEX, &ret); + if(ret != GL_LAST_VERTEX_CONVENTION) { + printf("GL_PROVOKING_VERTEX was expected to be GL_LAST_VERTEX" + "_CONVENTION, but %s was returned.\n", +piglit_get_gl_enum_name(ret)); + pass = false; + } + pass = piglit_check_gl_error(GL_NO_ERROR) && pass; + + piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); +} + +enum piglit_result +piglit_display(void) +{ + return PIGLIT_FAIL; +} -- 1