summaryrefslogtreecommitdiff
path: root/progs/tests/shader_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'progs/tests/shader_api.c')
-rw-r--r--progs/tests/shader_api.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/progs/tests/shader_api.c b/progs/tests/shader_api.c
index 598f029a97..6453856345 100644
--- a/progs/tests/shader_api.c
+++ b/progs/tests/shader_api.c
@@ -5,7 +5,7 @@
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
+#include <GL/glew.h>
#include <GL/glut.h>
static void assert_test(const char *file, int line, int cond, const char *msg)
@@ -113,7 +113,8 @@ static void test_uniform_size_type1(const char *glslType, GLenum glType, const c
GLenum type;
GLint size;
- printf(" Running subtest %s\n", glslType); fflush(stdout);
+ printf(" Running subtest %s\n", glslType);
+ fflush(stdout);
sprintf(buffer, "#version 120\nuniform %s m[60];\nvoid main() { gl_Position[0] = m[59]%s; }\n",
glslType, el);
@@ -169,7 +170,8 @@ static void test_attrib_size_type1(const char *glslType, GLenum glType, const ch
GLenum type;
GLint size;
- printf(" Running subtest %s\n", glslType); fflush(stdout);
+ printf(" Running subtest %s\n", glslType);
+ fflush(stdout);
sprintf(buffer, "#version 120\nattribute %s m;\nvoid main() { gl_Position[0] = m%s; }\n",
glslType, el);
@@ -302,8 +304,6 @@ static void test_uniform_multiple_samplers(void)
assert_no_error();
program = make_program(NULL, "uniform sampler2D s[2];\nvoid main() { gl_FragColor = texture2D(s[1], vec2(0.0, 0.0)); }\n");
location = glGetUniformLocation(program, "s[0]");
- if (location == -1) /* Mesa doesn't currently support indexing */
- location = glGetUniformLocation(program, "s");
assert(location != -1);
assert_no_error();
glUniform1iv(location, 2, values);
@@ -321,8 +321,17 @@ static void run_test(const char *name, void (*callback)(void))
int main(int argc, char **argv)
{
+ const char *version;
+
glutInit(&argc, argv);
glutCreateWindow("Mesa bug demo");
+ glewInit();
+
+ version = (const char *) glGetString(GL_VERSION);
+ if (version[0] == '1') {
+ printf("Sorry, this test requires OpenGL 2.x GLSL support\n");
+ exit(0);
+ }
RUN_TEST(test_uniform_size_type);
RUN_TEST(test_attrib_size_type);