diff options
-rw-r--r-- | tests/all.tests | 1 | ||||
-rw-r--r-- | tests/shaders/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/shaders/createshaderprogram-attached-shaders.c | 77 |
3 files changed, 79 insertions, 0 deletions
diff --git a/tests/all.tests b/tests/all.tests index 4b425ba1..eae6bf14 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -197,6 +197,7 @@ add_plain_test(shaders, 'activeprogram-bad-program') add_plain_test(shaders, 'activeprogram-get') add_plain_test(shaders, 'ati-fs-bad-delete') add_plain_test(shaders, 'createshaderprogram-bad-type') +add_plain_test(shaders, 'createshaderprogram-attached-shaders') add_plain_test(shaders, 'trinity-fp1') add_plain_test(shaders, 'fp-abs-01') add_plain_test(shaders, 'fp-abs-02') diff --git a/tests/shaders/CMakeLists.txt b/tests/shaders/CMakeLists.txt index 1c748239..4a9d723d 100644 --- a/tests/shaders/CMakeLists.txt +++ b/tests/shaders/CMakeLists.txt @@ -25,6 +25,7 @@ add_executable (activeprogram-bad-program activeprogram-bad-program.c) add_executable (activeprogram-get activeprogram-get.c) add_executable (ati-fs-bad-delete ati-fs-bad-delete.c) add_executable (createshaderprogram-bad-type createshaderprogram-bad-type.c) +add_executable (createshaderprogram-attached-shaders createshaderprogram-attached-shaders.c) add_executable (trinity-fp1 trinity-fp1.c) add_executable (fp-abs-01 fp-abs-01.c) add_executable (fp-abs-02 fp-abs-02.c) diff --git a/tests/shaders/createshaderprogram-attached-shaders.c b/tests/shaders/createshaderprogram-attached-shaders.c new file mode 100644 index 00000000..8b4c36b6 --- /dev/null +++ b/tests/shaders/createshaderprogram-attached-shaders.c @@ -0,0 +1,77 @@ +/* + * Copyright © 2010 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 createshaderprogram-attached-shaders.c + * Call glCreateShaderProgramEXT, verify that there are 0 attached shaders + * + * \author Ian Romanick <ian.d.romanick@intel.com> + */ +#include "piglit-util.h" + +int piglit_width = 100, piglit_height = 100; +int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE; + +static const char vs_text[] = + "void main() { gl_Position = gl_Vertex; }"; + + +enum piglit_result +piglit_display(void) +{ + return PIGLIT_FAILURE; +} + +void +piglit_init(int argc, char **argv) +{ + GLboolean pass = GL_TRUE; + GLint count; + GLuint prog; + GLenum err; + + if (!GLEW_VERSION_2_0) { + printf("Requires OpenGL 2.0\n"); + piglit_report_result(PIGLIT_SKIP); + } + + piglit_require_extension("GL_EXT_separate_shader_objects"); + + prog = glCreateShaderProgramEXT(GL_VERTEX_SHADER, vs_text); + + err = glGetError(); + if (err != 0) { + printf("Unexpected OpenGL error state 0x%04x for " + "glCreateShaderProgramEXT\n", err); + pass = GL_FALSE; + } + + count = -1; + glGetProgramiv(prog, GL_ATTACHED_SHADERS, &count); + if (count != 0) { + printf("Expected attached shader count of 0, got %d.\n", count); + pass = GL_FALSE; + } + + piglit_report_result(pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE); +} |