[Piglit] [PATCH 2/5] shader_runner: Add the ability to specify uniform integer vectors
Ian Romanick
idr at freedesktop.org
Tue May 3 11:29:59 PDT 2011
From: Ian Romanick <ian.d.romanick at intel.com>
---
tests/shaders/shader_runner.c | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 20044c5..710e486 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -637,10 +637,21 @@ get_floats(const char *line, float *f, unsigned count)
void
+get_ints(const char *line, int *ints, unsigned count)
+{
+ unsigned i;
+
+ for (i = 0; i < count; i++)
+ ints[i] = strtol(line, (char **) &line, 0);
+}
+
+
+void
set_uniform(const char *line)
{
char name[512];
float f[16];
+ float ints[16];
GLuint prog;
GLint loc;
const char *type;
@@ -681,6 +692,21 @@ set_uniform(const char *line)
piglit_Uniform4fv(loc, 1, f);
return;
}
+ } else if (strncmp("ivec", type, 4) == 0) {
+ switch (type[4]) {
+ case '2':
+ get_ints(line, ints, 2);
+ piglit_Uniform2iv(loc, 1, ints);
+ return;
+ case '3':
+ get_ints(line, ints, 3);
+ piglit_Uniform3iv(loc, 1, ints);
+ return;
+ case '4':
+ get_ints(line, ints, 4);
+ piglit_Uniform4iv(loc, 1, ints);
+ return;
+ }
} else if ((strncmp("mat", type, 3) == 0)
&& (type[3] != '\0')
&& (type[4] == 'x')) {
--
1.7.4
More information about the Piglit
mailing list