[Piglit] [PATCH 6/9] Add uint and uvec uniform support to shader_runner.
Paul Berry
stereotype441 at gmail.com
Mon Aug 15 11:45:27 PDT 2011
With this patch, shader_runner tests can now supply uniform values
using types "uint" and "uvecN".
---
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 001f812..172fc34 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, 3) == 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')) {
--
1.7.6
More information about the Piglit
mailing list