summaryrefslogtreecommitdiff
path: root/tests/util
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2018-06-07 15:37:18 -0700
committerJason Ekstrand <jason.ekstrand@intel.com>2018-06-08 11:41:44 -0700
commitd1ca4bbf07193cd650fb77230233cc70bab73f13 (patch)
tree3a47c4dc523b26aee6a2bc2ed52b1580329be3f8 /tests/util
parent55ea425addc6c06f47562c00ef6ccc7ae33713ff (diff)
util/gl: Use probe_rect instead of hand-rolling
Reviewed-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'tests/util')
-rw-r--r--tests/util/piglit-util-gl.c83
1 files changed, 3 insertions, 80 deletions
diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index 54fb3d0c4..a19eef5f0 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -1346,30 +1346,7 @@ probe_rect(int x, int y, int w, int h, int num_components,
int
piglit_probe_rect_rgb_silent(int x, int y, int w, int h, const float *expected)
{
- int i, j;
- GLfloat *probe;
- GLfloat *pixels;
-
- if (can_probe_ubyte())
- return probe_rect_ubyte(x, y, w, h, 3, expected, 0, 0, true);
-
- pixels = read_pixels_float(x, y, w, h, GL_RGB, NULL);
-
- for (j = 0; j < h; j++) {
- for (i = 0; i < w; i++) {
- probe = &pixels[(j*w+i)*3];
-
- if (compare_pixels_float(probe, expected,
- piglit_tolerance, 3))
- continue;
-
- free(pixels);
- return 0;
- }
- }
-
- free(pixels);
- return 1;
+ return probe_rect(x, y, w, h, 3, expected, 0, 0, true);
}
/* More efficient variant if you don't know need floats and GBA channels. */
@@ -1406,34 +1383,7 @@ piglit_probe_rect_r_ubyte(int x, int y, int w, int h, GLubyte expected)
int
piglit_probe_rect_rgb(int x, int y, int w, int h, const float *expected)
{
- int i, j;
- GLfloat *probe;
- GLfloat *pixels;
-
- if (can_probe_ubyte())
- return probe_rect_ubyte(x, y, w, h, 3, expected, 0, 0, false);
-
- pixels = read_pixels_float(x, y, w, h, GL_RGBA, NULL);
-
- for (j = 0; j < h; j++) {
- for (i = 0; i < w; i++) {
- probe = &pixels[(j*w+i)*4];
-
- if (compare_pixels_float(probe, expected,
- piglit_tolerance, 3))
- continue;
-
- print_bad_pixel_float(x + i, y + j, 3,
- expected,
- probe);
-
- free(pixels);
- return 0;
- }
- }
-
- free(pixels);
- return 1;
+ return probe_rect(x, y, w, h, 3, expected, 0, 0, false);
}
int
@@ -1514,34 +1464,7 @@ piglit_probe_rect_halves_equal_rgba(int x, int y, int w, int h)
int
piglit_probe_rect_rgba(int x, int y, int w, int h, const float *expected)
{
- int i, j;
- GLfloat *probe;
- GLfloat *pixels;
-
- if (can_probe_ubyte())
- return probe_rect_ubyte(x, y, w, h, 4, expected, 0, 0, false);
-
- pixels = read_pixels_float(x, y, w, h, GL_RGBA, NULL);
-
- for (j = 0; j < h; j++) {
- for (i = 0; i < w; i++) {
- probe = &pixels[(j*w+i)*4];
-
- if (compare_pixels_float(probe, expected,
- piglit_tolerance, 4))
- continue;
-
- print_bad_pixel_float(x + i, y + j, 4,
- expected,
- probe);
-
- free(pixels);
- return 0;
- }
- }
-
- free(pixels);
- return 1;
+ return probe_rect(x, y, w, h, 4, expected, 0, 0, false);
}
int