summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPauli Nieminen <pauli.nieminen@linux.intel.com>2012-06-15 15:00:25 +0300
committerPauli Nieminen <pauli.nieminen@linux.intel.com>2012-06-15 15:00:25 +0300
commit563bae7d37a535a6fb4b390d978b336276ed0068 (patch)
treee3845ca90482ca1f3b793f3333eaa564b05359da
parent5bdecfc56004dedaa8eb1f79e5f12b976d2729de (diff)
util/gl: Make piglit_probe_texel_rgb work with GLES
GLES doesn't have support for GL_FLOAT image data. To support gles we need to convert glReadPixels to use GL_UNSIGNED_BYTE as format. Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
-rw-r--r--tests/util/piglit-util-gl.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index 988ba057..e46fd86e 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -587,10 +587,10 @@ 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));
+ GLubyte *probe1, *probe2;
+ GLubyte *pixels = malloc(w*h*4*sizeof(float));
- 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++) {
@@ -598,12 +598,12 @@ int piglit_probe_rect_halves_equal_rgba(int x, int y, int w, int h)
probe2 = &pixels[(j*w+wh+i)*4];
for (p = 0; p < 4; ++p) {
- if (fabs(probe1[p] - probe2[p]) >= piglit_tolerance[p]) {
+ if (abs(probe1[p] - probe2[p]) >= piglit_tolerance[p]*255) {
printf("Probe at (%i,%i)\n", x+i, x+j);
printf(" Left: %f %f %f %f\n",
- probe1[0], probe1[1], probe1[2], probe1[3]);
+ probe1[0]/255.0, probe1[1]/255.0, probe1[2]/255.0, probe1[3]/255.0);
printf(" Right: %f %f %f %f\n",
- probe2[0], probe2[1], probe2[2], probe2[3]);
+ probe2[0]/255.0, probe2[1]/255.0, probe2[2]/255.0, probe2[3]/255.0);
free(pixels);
return 0;