diff options
author | Fabian Bieler <fabianbieler@fastmail.fm> | 2017-12-29 18:26:17 +0100 |
---|---|---|
committer | Fabian Bieler <fabianbieler@fastmail.fm> | 2018-01-16 20:10:43 +0100 |
commit | e767051be93b6cdae47b9fa00b0e48a4260431aa (patch) | |
tree | e8c97a808c8cf1dea26f1f7116cfc8d822ed8973 | |
parent | 9cc863099849b4eae10a900f8fb27cea03aa3603 (diff) |
util-gl: Make piglit_compare_images_color respect x and y arguments.
piglit_compare_images_color used to ignore its x and y arguments.
This commit fixes that and fixes piglit_probe_image_color which used to
pass garbage values into piglit_compare_images_color.
The header comment of piglit_probe_image_color is also updated.
Reviewed-by: Brian Paul <brianp@vmware.com>
-rw-r--r-- | tests/util/piglit-util-gl.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c index aafa92383..8b9b093b3 100644 --- a/tests/util/piglit-util-gl.c +++ b/tests/util/piglit-util-gl.c @@ -1653,9 +1653,11 @@ piglit_compare_images_color(int x, int y, int w, int h, int num_components, for (j = 0; j < h; j++) { for (i = 0; i < w; i++) { const float *expected = - &expected_image[(j*w+i)*num_components]; + &expected_image[((j + y) * w + i + x) * + num_components]; const float *probe = - &observed_image[(j*w+i)*num_components]; + &observed_image[((j + y) * w + i + x) * + num_components]; for (p = 0; p < num_components; ++p) { if (fabs(probe[p] - expected[p]) @@ -1677,8 +1679,9 @@ piglit_compare_images_color(int x, int y, int w, int h, int num_components, } /** - * Compare the contents of the current read framebuffer with the given - * in-memory floating-point image. + * Compare the region indicated by x, y, w and h of the current read + * framebuffer with the given in-memory floating-point image of + * dimensions w*h. */ int piglit_probe_image_color(int x, int y, int w, int h, GLenum format, @@ -1700,7 +1703,7 @@ piglit_probe_image_color(int x, int y, int w, int h, GLenum format, pixels = piglit_read_pixels_float(x, y, w, h, format, NULL); - result = piglit_compare_images_color(x, y, w, h, c, tolerance, image, + result = piglit_compare_images_color(0, 0, w, h, c, tolerance, image, pixels); free(pixels); |