diff options
author | Paul Berry <stereotype441@gmail.com> | 2011-08-12 12:19:44 -0700 |
---|---|---|
committer | Paul Berry <stereotype441@gmail.com> | 2011-08-18 13:56:13 -0700 |
commit | b83849d9e866b52236b22dfacb3b8fd26c31f478 (patch) | |
tree | b541280b44405513ddddb6371d6c55f6799f5196 | |
parent | 1de2749f06a9a1111eb8126717c4a8d3af0327ce (diff) |
Add uint and uvec uniform support to shader_runner.
With this patch, shader_runner tests can now supply uniform values
using types "uint" and "uvecN".
Reviewed-by: Chad Versace <chad@chad-versace.us>
-rw-r--r-- | tests/shaders/shader_runner.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c index 001f8126..dde39b34 100644 --- a/tests/shaders/shader_runner.c +++ b/tests/shaders/shader_runner.c @@ -647,11 +647,22 @@ get_ints(const char *line, int *ints, unsigned count) void +get_uints(const char *line, unsigned *uints, unsigned count) +{ + unsigned i; + + for (i = 0; i < count; i++) + uints[i] = strtoul(line, (char **) &line, 0); +} + + +void set_uniform(const char *line) { char name[512]; float f[16]; int ints[16]; + unsigned uints[16]; GLuint prog; GLint loc; const char *type; @@ -677,6 +688,10 @@ set_uniform(const char *line) int val = atoi(line); piglit_Uniform1i(loc, val); return; + } else if (strncmp("uint", type, 4) == 0) { + unsigned val = strtoul(line, NULL, 0); + piglit_Uniform1ui(loc, val); + return; } else if (strncmp("vec", type, 3) == 0) { switch (type[3]) { case '2': @@ -707,6 +722,21 @@ set_uniform(const char *line) piglit_Uniform4iv(loc, 1, ints); return; } + } else if (strncmp("uvec", type, 4) == 0) { + switch (type[4]) { + case '2': + get_uints(line, uints, 2); + piglit_Uniform2uiv(loc, 1, uints); + return; + case '3': + get_uints(line, uints, 3); + piglit_Uniform3uiv(loc, 1, uints); + return; + case '4': + get_uints(line, uints, 4); + piglit_Uniform4uiv(loc, 1, uints); + return; + } } else if ((strncmp("mat", type, 3) == 0) && (type[3] != '\0') && (type[4] == 'x')) { |