diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/shaders/glsl-fs-log2.shader_test | 4 | ||||
-rw-r--r-- | tests/shaders/shader_runner.c | 22 |
2 files changed, 21 insertions, 5 deletions
diff --git a/tests/shaders/glsl-fs-log2.shader_test b/tests/shaders/glsl-fs-log2.shader_test index 0e67d620d..67fa10707 100644 --- a/tests/shaders/glsl-fs-log2.shader_test +++ b/tests/shaders/glsl-fs-log2.shader_test @@ -17,7 +17,7 @@ void main() clear color 1.0 0.0 0.0 0.0 clear ortho -uniform args1 vec4 1.0 2.0 4.0 0.0 -uniform args2 vec4 0.5 -0.5 -1.5 0.0 +uniform vec4 args1 1.0 2.0 4.0 0.0 +uniform vec4 args2 0.5 -0.5 -1.5 0.0 draw rect 10 10 10 10 probe rgb 15 15 0.5 0.5 0.5 diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c index 84381ada0..8593a760b 100644 --- a/tests/shaders/shader_runner.c +++ b/tests/shaders/shader_runner.c @@ -160,6 +160,19 @@ eat_whitespace(const char *src) /** + * Skip over non-whitespace upto the end of line + */ +const char * +eat_text(const char *src) +{ + while (!isspace(*src) && (*src != '\0')) + src++; + + return src; +} + + +/** * Compare two values given a specified comparison operator */ bool @@ -529,9 +542,13 @@ set_uniform(const char *line) float f[16]; GLuint prog; GLint loc; + const char *type; glGetIntegerv(GL_CURRENT_PROGRAM, (GLint *) &prog); + type = eat_whitespace(line); + line = eat_text(type); + line = strcpy_to_space(name, eat_whitespace(line)); loc = glGetUniformLocation(prog, name); if (loc < 0) { @@ -540,9 +557,8 @@ set_uniform(const char *line) piglit_report_result(PIGLIT_FAILURE); } - line = eat_whitespace(line); - if (strncmp("vec4", line, 4) == 0) { - get_floats(line + 4, f, 4); + if (strncmp("vec4", type, 4) == 0) { + get_floats(line, f, 4); glUniform4fv(loc, 1, f); } } |