Commit cb24c376 authored by Eric Anholt's avatar Eric Anholt

Handle the glsl shader path prefix in the util rather than each program.

parent c7e13d87
......@@ -21,8 +21,6 @@ link_libraries (
${GLEW_glew_LIBRARY}
)
add_definitions ( -DSOURCE_DIR="\\\"${piglit_SOURCE_DIR}/\\\"" )
add_executable (ati-fs-bad-delete ati-fs-bad-delete.c)
add_executable (trinity-fp1 trinity-fp1.c)
add_executable (fp-abs-01 fp-abs-01.c)
......
......@@ -74,9 +74,9 @@ piglit_init(int argc, char **argv)
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
vs = piglit_compile_shader(GL_VERTEX_SHADER,
SOURCE_DIR "tests/shaders/glsl-mvp.vert");
"shaders/glsl-mvp.vert");
fs = piglit_compile_shader(GL_FRAGMENT_SHADER,
SOURCE_DIR "tests/shaders/glsl-fs-exp2.frag");
"shaders/glsl-fs-exp2.frag");
prog = piglit_link_simple_program(vs, fs);
......
......@@ -80,9 +80,9 @@ piglit_init(int argc, char **argv)
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
vs = piglit_compile_shader(GL_VERTEX_SHADER,
SOURCE_DIR "tests/shaders/glsl-mvp.vert");
"shaders/glsl-mvp.vert");
fs = piglit_compile_shader(GL_FRAGMENT_SHADER,
SOURCE_DIR "tests/shaders/glsl-fs-fragcoord.frag");
"shaders/glsl-fs-fragcoord.frag");
prog = piglit_link_simple_program(vs, fs);
......
......@@ -74,9 +74,9 @@ piglit_init(int argc, char **argv)
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
vs = piglit_compile_shader(GL_VERTEX_SHADER,
SOURCE_DIR "tests/shaders/glsl-mvp.vert");
"shaders/glsl-mvp.vert");
fs = piglit_compile_shader(GL_FRAGMENT_SHADER,
SOURCE_DIR "tests/shaders/glsl-fs-log2.frag");
"shaders/glsl-fs-log2.frag");
prog = piglit_link_simple_program(vs, fs);
......
......@@ -68,9 +68,9 @@ piglit_init(int argc, char **argv)
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
vs = piglit_compile_shader(GL_VERTEX_SHADER,
SOURCE_DIR "tests/shaders/glsl-mvp.vert");
"shaders/glsl-mvp.vert");
fs = piglit_compile_shader(GL_FRAGMENT_SHADER,
SOURCE_DIR "tests/shaders/glsl-fs-sqrt-zero.frag");
"shaders/glsl-fs-sqrt-zero.frag");
prog = piglit_link_simple_program(vs, fs);
......
......@@ -74,9 +74,9 @@ piglit_init(int argc, char **argv)
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
vs = piglit_compile_shader(GL_VERTEX_SHADER,
SOURCE_DIR "tests/shaders/glsl-preprocessor-comments.vert");
"shaders/glsl-preprocessor-comments.vert");
fs = piglit_compile_shader(GL_FRAGMENT_SHADER,
SOURCE_DIR "tests/shaders/glsl-preprocessor-comments.frag");
"shaders/glsl-preprocessor-comments.frag");
prog = piglit_link_simple_program(vs, fs);
......
......@@ -81,9 +81,9 @@ piglit_init(int argc, char **argv)
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
vs = piglit_compile_shader(GL_VERTEX_SHADER,
SOURCE_DIR "tests/shaders/glsl-mvp.vert");
"shaders/glsl-mvp.vert");
fs = piglit_compile_shader(GL_FRAGMENT_SHADER,
SOURCE_DIR "tests/shaders/glsl-uniform-update.frag");
"shaders/glsl-uniform-update.frag");
prog = piglit_link_simple_program(vs, fs);
......
......@@ -83,9 +83,9 @@ void piglit_init(int argc, char **argv)
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
vs = piglit_compile_shader(GL_VERTEX_SHADER,
SOURCE_DIR "tests/shaders/glsl-unused-varying.vert");
"shaders/glsl-unused-varying.vert");
fs = piglit_compile_shader(GL_FRAGMENT_SHADER,
SOURCE_DIR "tests/shaders/glsl-unused-varying.frag");
"shaders/glsl-unused-varying.frag");
prog = piglit_link_simple_program(vs, fs);
......
......@@ -70,9 +70,9 @@ void piglit_init(int argc, char **argv)
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
vs = piglit_compile_shader(GL_VERTEX_SHADER,
SOURCE_DIR "tests/shaders/glsl-vs-arrays.vert");
"shaders/glsl-vs-arrays.vert");
fs = piglit_compile_shader(GL_FRAGMENT_SHADER,
SOURCE_DIR "tests/shaders/glsl-color.frag");
"shaders/glsl-color.frag");
prog = piglit_link_simple_program(vs, fs);
......
......@@ -73,9 +73,9 @@ void piglit_init(int argc, char **argv)
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
vs = piglit_compile_shader(GL_VERTEX_SHADER,
SOURCE_DIR "tests/shaders/glsl-vs-if-bool.vert");
"shaders/glsl-vs-if-bool.vert");
fs = piglit_compile_shader(GL_FRAGMENT_SHADER,
SOURCE_DIR "tests/shaders/glsl-color.frag");
"shaders/glsl-color.frag");
prog = piglit_link_simple_program(vs, fs);
......
......@@ -71,9 +71,9 @@ piglit_init(int argc, char **argv)
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
vs = piglit_compile_shader(GL_VERTEX_SHADER,
SOURCE_DIR "tests/shaders/glsl-vs-if.vert");
"shaders/glsl-vs-if.vert");
fs = piglit_compile_shader(GL_FRAGMENT_SHADER,
SOURCE_DIR "tests/shaders/glsl-color.frag");
"shaders/glsl-color.frag");
prog = piglit_link_simple_program(vs, fs);
......
......@@ -108,9 +108,9 @@ piglit_init(int argc, char **argv)
}
vs = piglit_compile_shader(GL_VERTEX_SHADER,
SOURCE_DIR "tests/shaders/glsl-vs-loop.vert");
"shaders/glsl-vs-loop.vert");
fs = piglit_compile_shader(GL_FRAGMENT_SHADER,
SOURCE_DIR "tests/shaders/glsl-color.frag");
"shaders/glsl-color.frag");
prog = piglit_link_simple_program(vs, fs);
......
......@@ -70,9 +70,9 @@ void piglit_init(int argc, char **argv)
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
vs = piglit_compile_shader(GL_VERTEX_SHADER,
SOURCE_DIR "tests/shaders/glsl-vs-mov-after-deref.vert");
"shaders/glsl-vs-mov-after-deref.vert");
fs = piglit_compile_shader(GL_FRAGMENT_SHADER,
SOURCE_DIR "tests/shaders/glsl-color.frag");
"shaders/glsl-color.frag");
prog = piglit_link_simple_program(vs, fs);
......
......@@ -68,9 +68,9 @@ piglit_init(int argc, char **argv)
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
vs = piglit_compile_shader(GL_VERTEX_SHADER,
SOURCE_DIR "tests/shaders/glsl-vs-sqrt-zero.vert");
"shaders/glsl-vs-sqrt-zero.vert");
fs = piglit_compile_shader(GL_FRAGMENT_SHADER,
SOURCE_DIR "tests/shaders/glsl-color.frag");
"shaders/glsl-color.frag");
prog = piglit_link_simple_program(vs, fs);
......
add_definitions ( -DSOURCE_DIR="\\\"${piglit_SOURCE_DIR}/\\\"" )
include_directories(
${OPENGL_INCLUDE_PATH}
${GLUT_INCLUDE_DIR}
......
......@@ -32,6 +32,7 @@
#include <string.h>
#include <errno.h>
#include <sys/stat.h>
#include <sys/param.h>
#include "piglit-util.h"
......@@ -389,8 +390,13 @@ piglit_compile_shader(GLenum target, char *filename)
int err;
GLchar *prog_string;
FILE *f;
char filename_with_path[PATH_MAX];
err = stat(filename, &st);
snprintf(filename_with_path, PATH_MAX - 1,
"%stests/%s", SOURCE_DIR, filename);
filename_with_path[PATH_MAX - 1] = 0;
err = stat(filename_with_path, &st);
if (err == -1) {
fprintf(stderr, "Couldn't stat program: %s\n", strerror(errno));
exit(1);
......@@ -402,7 +408,7 @@ piglit_compile_shader(GLenum target, char *filename)
exit(1);
}
f = fopen(filename, "r");
f = fopen(filename_with_path, "r");
if (f == NULL) {
fprintf(stderr, "Couldn't open program: %s\n", strerror(errno));
exit(1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment