From: Ian Romanick <[email protected]> Also verify the default state of GL_SEPARABLE_PROGRAM.
Signed-off-by: Ian Romanick <[email protected]> --- tests/all.tests | 1 + .../arb_separate_shader_objects/CMakeLists.gl.txt | 1 + .../UseProgramStages-non-separable.c | 113 +++++++++++++++++++++ 3 files changed, 115 insertions(+) create mode 100644 tests/spec/arb_separate_shader_objects/UseProgramStages-non-separable.c diff --git a/tests/all.tests b/tests/all.tests index fe24224..346556d 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -1239,6 +1239,7 @@ arb_separate_shader_objects = Group() spec['ARB_separate_shader_objects'] = arb_separate_shader_objects arb_separate_shader_objects['GetProgramPipelineiv'] = concurrent_test('arb_separate_shader_object-GetProgramPipelineiv') arb_separate_shader_objects['IsProgramPipeline'] = concurrent_test('arb_separate_shader_object-IsProgramPipeline') +arb_separate_shader_objects['UseProgramStages - non-separable program'] = concurrent_test('arb_separate_shader_object-UseProgramStages-non-separable') # Group ARB_sampler_objects arb_sampler_objects = Group() diff --git a/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt b/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt index fa955c6..3397b4d 100644 --- a/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt +++ b/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt @@ -11,3 +11,4 @@ link_libraries ( piglit_add_executable (arb_separate_shader_object-GetProgramPipelineiv GetProgramPipelineiv.c) piglit_add_executable (arb_separate_shader_object-IsProgramPipeline IsProgramPipeline.c) +piglit_add_executable (arb_separate_shader_object-UseProgramStages-non-separable UseProgramStages-non-separable.c) diff --git a/tests/spec/arb_separate_shader_objects/UseProgramStages-non-separable.c b/tests/spec/arb_separate_shader_objects/UseProgramStages-non-separable.c new file mode 100644 index 0000000..7ddd911 --- /dev/null +++ b/tests/spec/arb_separate_shader_objects/UseProgramStages-non-separable.c @@ -0,0 +1,113 @@ +/* + * Copyright © 2013 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +/** + * \file UseProgramStages-non-separable.c + * Verify that a program w/o PROGRAM_SEPARABLE cannot be used with SSO + */ +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 10; + config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE; + +PIGLIT_GL_TEST_CONFIG_END + +static const char *vs_code = + "#version 110\n" + "void main() { gl_Position = gl_Vertex; }\n" + ; + +enum piglit_result +piglit_display(void) +{ + return PIGLIT_FAIL; +} + +void piglit_init(int argc, char **argv) +{ + GLuint prog; + GLuint pipeline; + GLint param; + bool pass = true; + + piglit_require_vertex_shader(); + piglit_require_extension("GL_ARB_separate_shader_objects"); + + prog = piglit_build_simple_program(vs_code, NULL); + + /* Sanity check that GL_PROGRAM_SEPARABLE didn't magically get + * set for us. + */ + param = 0xDEADBEEF; + glGetProgramiv(prog, GL_PROGRAM_SEPARABLE, ¶m); + + pass = piglit_check_gl_error(GL_NO_ERROR) && pass; + + if (param == 0xDEADBEEF) { + fprintf(stderr, + "glGetProgramiv(GL_PROGRAM_SEPARABLE) didn't write " + "a value.\n"); + pass = false; + } else if (param != GL_FALSE) { + fprintf(stderr, "GL_PROGRAM_SEPARABLE is %d, should be 0.\n", + param); + pass = false; + } + + /* Section 2.11.4 (Program Pipeline Objects) of the OpenGL 4.1 + * spec says: + * + * "If the program object named by program was linked without the + * PROGRAM_SEPARABLE parameter set, or was not linked + * successfully, the error INVALID_OPERATION is generated and the + * corresponding shader stages in the pipeline program pipeline + * object are not modified." + */ + glGenProgramPipelines(1, &pipeline); + glUseProgramStages(pipeline, GL_VERTEX_SHADER_BIT, prog); + + /* Verify that the error is generated... + */ + pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass; + + /* ...and that the old binding is not modified. + */ + param = 0xDEADBEEF; + glGetProgramPipelineiv(pipeline, GL_VERTEX_SHADER, ¶m); + pass = piglit_check_gl_error(GL_NO_ERROR) && pass; + + if (param == 0xDEADBEEF) { + fprintf(stderr, + "glGetProgramPipelineiv(GL_VERTEX_SHADER) didn't " + "write a value.\n"); + pass = false; + } else if (param != 0) { + fprintf(stderr, "GL_VERTEX_SHADER is %d, should be 0.\n", + param); + pass = false; + } + + piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); +} -- 1.8.1.4 _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
