aboutsummaryrefslogtreecommitdiff
path: root/tests/shaders
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-10-15 17:27:26 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-10-15 17:27:26 -0700
commit90483f31889e13ebf917fd45ecc4b016a4d70841 (patch)
tree82a532787dd673149968787ddb53f2f1d8d27a59 /tests/shaders
parenta0c247597de5837686a9066ba741837b2d971c69 (diff)
Count shaders attached to a program created with glCreateShaderProgramEXT
Diffstat (limited to 'tests/shaders')
-rw-r--r--tests/shaders/CMakeLists.txt1
-rw-r--r--tests/shaders/createshaderprogram-attached-shaders.c77
2 files changed, 78 insertions, 0 deletions
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);
+}