aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2012-12-14 15:32:14 -0800
committerIan Romanick <ian.d.romanick@intel.com>2013-01-16 14:52:21 -0800
commite8f378e95315ad3920269eecb2e6c7c75fe58379 (patch)
treea955b79d3cf257b92517c34c3508b00a928ddcbc /tests
parentdadf56dad25730556e36e9446aabfc80458cc12f (diff)
downloadpiglit-e8f378e95315ad3920269eecb2e6c7c75fe58379.tar.gz
Accept array uniform names with or without [0] from glGetActiveUniform
This is required by OpenGL ES 3.0 and desktop OpenGL 4.2. Previous version were ambiguous. Previously these tests failed on NVIDIA's closed-source driver (version 304.64) with the error messages: 0: f1 loc=0 size=1 type=0x1406 1: f2 loc=1 size=1 type=0x1406 2: s.a loc=2 size=1 type=0x1406 3: s.b loc=3 size=1 type=0x1406 4: s.c loc=4 size=1 type=0x1406 5: s.d loc=5 size=1 type=0x1406 6: v[0] loc=6 size=3 type=0x8b52 getuniform-02: wrong type for 'v' (found 0x8b52, expected 0x1406) and Unexpected max active uniform length (saw 9, expected 6) Unexpected active uniform length (saw 8, expected 5) for "color[0]" With these changes, both tests pass. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/shaders/getuniform-02.c6
-rw-r--r--tests/shaders/glsl-getactiveuniform-length.c23
2 files changed, 23 insertions, 6 deletions
diff --git a/tests/shaders/getuniform-02.c b/tests/shaders/getuniform-02.c
index 5d774038..85724325 100644
--- a/tests/shaders/getuniform-02.c
+++ b/tests/shaders/getuniform-02.c
@@ -109,7 +109,11 @@ piglit_init(int argc, char **argv)
printf("%d: %s loc=%d size=%d type=0x%x\n", i, name, loc, size, type);
}
- if (strcmp(name, "v") == 0) {
+ /* OpenGL ES 3.0 and OpenGL 4.2 require that the "[0]" be appended to
+ * the name. Earlier versions of the spec are ambiguous. Accept either
+ * name.
+ */
+ if (strcmp(name, "v") == 0 || strcmp(name, "v[0]") == 0) {
expectedType = GL_FLOAT_VEC4_ARB;
expectedSize = 3;
}
diff --git a/tests/shaders/glsl-getactiveuniform-length.c b/tests/shaders/glsl-getactiveuniform-length.c
index cace5eb7..2c596c4c 100644
--- a/tests/shaders/glsl-getactiveuniform-length.c
+++ b/tests/shaders/glsl-getactiveuniform-length.c
@@ -59,6 +59,13 @@ piglit_init(int argc, char **argv)
char *name;
GLsizei size;
+ /* OpenGL ES 3.0 and OpenGL 4.2 require that the "[0]" be appended to
+ * the name. Earlier versions of the spec are ambiguous. Accept
+ * either name.
+ */
+ const size_t scalar_length = strlen("color");
+ const size_t array_length = strlen("color[0]");
+
piglit_require_gl_version(20);
vs = piglit_compile_shader(GL_VERTEX_SHADER,
@@ -76,9 +83,11 @@ piglit_init(int argc, char **argv)
*/
glGetProgramiv(prog, GL_ACTIVE_UNIFORM_MAX_LENGTH, &len);
- if (len != strlen("color") + 1) {
+ if (len != (scalar_length + 1) && len != (array_length + 1)) {
printf("Unexpected max active uniform length "
- "(saw %d, expected %lu)\n", len, (unsigned long) strlen("color") + 1);
+ "(saw %d, expected %lu or %lu)\n", len,
+ (unsigned long) scalar_length,
+ (unsigned long) array_length);
pass = GL_FALSE;
}
@@ -89,10 +98,14 @@ piglit_init(int argc, char **argv)
*/
name = malloc(len);
glGetActiveUniform(prog, 0, len + 20, &ret_len, &size, &type, name);
- if (ret_len != strlen("color")) {
+
+ if (ret_len != scalar_length && ret_len != array_length) {
printf("Unexpected active uniform length "
- "(saw %d, expected %lu) for \"%s\"\n",
- ret_len, (unsigned long) strlen("color"), name);
+ "(saw %d, expected %lu or %lu) for \"%s\"\n",
+ ret_len,
+ (unsigned long) scalar_length,
+ (unsigned long) array_length,
+ name);
pass = GL_FALSE;
}