diff options
author | Chad Versace <chad.versace@linux.intel.com> | 2012-07-06 18:31:53 -0700 |
---|---|---|
committer | Chad Versace <chad.versace@linux.intel.com> | 2012-07-15 21:16:35 -0700 |
commit | 636a5c41f5e72d90af66c790824e2f0552eaea62 (patch) | |
tree | ba0b366078bedad2ea9a4e270bbcb88c9fa50034 | |
parent | c59e4f0ba28ce6523b78f136c57f2718e2779a88 (diff) |
util: Make piglit_probe_rect_halves_equal_rgba() GLES-compatible
In GLES, glReadPixels does not accept format=GL_FLOAT, but it does accept
format=GL_BYTE.
This shouldn't make any tests begin failing. If anything, this commit may
make pass some almost-passing tests because there is less precision in
probing with glReadPixels(GL_BYTE) than glReadPixels(GL_FLOAT).
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
-rw-r--r-- | tests/util/piglit-util-gl.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c index f54f58ec3..13a98fd2c 100644 --- a/tests/util/piglit-util-gl.c +++ b/tests/util/piglit-util-gl.c @@ -653,16 +653,22 @@ int piglit_probe_texel_rgb(int target, int level, int x, int y, int piglit_probe_rect_halves_equal_rgba(int x, int y, int w, int h) { - int i, j, p, wh = w/2; - GLfloat *probe1, *probe2; - GLfloat *pixels = malloc(w*h*4*sizeof(float)); + int i, j, p; + GLfloat probe1[4]; + GLfloat probe2[4]; + GLubyte *pixels = malloc(w*h*4*sizeof(GLubyte)); - glReadPixels(x, y, w, h, GL_RGBA, GL_FLOAT, pixels); + glReadPixels(x, y, w, h, GL_RGBA, GL_UNSIGNED_BYTE, pixels); for (j = 0; j < h; j++) { - for (i = 0; i < wh; i++) { - probe1 = &pixels[(j*w+i)*4]; - probe2 = &pixels[(j*w+wh+i)*4]; + for (i = 0; i < w / 2; i++) { + GLubyte *pixel1 = &pixels[4 * (j * w + i)]; + GLubyte *pixel2 = &pixels[4 * (j * w + w / 2 + i)]; + + for (p = 0; p < 4; ++p) { + probe1[p] = pixel1[p] / 255.0f; + probe2[p] = pixel2[p] / 255.0f; + } for (p = 0; p < 4; ++p) { if (fabs(probe1[p] - probe2[p]) >= piglit_tolerance[p]) { |