summaryrefslogtreecommitdiff
path: root/tests/util
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2018-06-07 15:36:29 -0700
committerJason Ekstrand <jason.ekstrand@intel.com>2018-06-08 11:41:44 -0700
commit55ea425addc6c06f47562c00ef6ccc7ae33713ff (patch)
tree99784716aa9d3ec4d68892e3bad80f6d774dd205 /tests/util
parent1753b57186c6fdb72d15ab899b1ac9b1a2585dda (diff)
util/gl: Add more probe helplers
Reviewed-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'tests/util')
-rw-r--r--tests/util/piglit-util-gl.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index 39b6e58e9..54fb3d0c4 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -1296,6 +1296,53 @@ probe_rect_ubyte(int x, int y, int w, int h, int num_components,
return true;
}
+static bool
+probe_rect_float(int x, int y, int w, int h, int num_components,
+ const float *fexpected, size_t x_pitch, size_t y_pitch,
+ bool silent)
+{
+ float *pixels = read_pixels_float(x, y, w, h, GL_RGBA, NULL);
+
+ for (int j = 0; j < h; j++) {
+ for (int i = 0; i < w; i++) {
+ float *probe = &pixels[(j*w+i)*4];
+ const float *pexp = fexpected + i * x_pitch +
+ j * y_pitch;
+
+ if (compare_pixels_float(probe, pexp,
+ piglit_tolerance,
+ num_components))
+ continue;
+
+ if (!silent) {
+ print_bad_pixel_float(x + i, y + j,
+ num_components,
+ fexpected, probe);
+ }
+ free(pixels);
+ return false;
+ }
+ }
+
+ free(pixels);
+ return true;
+}
+
+static bool
+probe_rect(int x, int y, int w, int h, int num_components,
+ const float *fexpected, size_t x_pitch, size_t y_pitch,
+ bool silent)
+{
+ if (can_probe_ubyte()) {
+ return probe_rect_ubyte(x, y, w, h, num_components, fexpected,
+ x_pitch, y_pitch, silent);
+ } else {
+ return probe_rect_float(x, y, w, h, num_components, fexpected,
+ x_pitch, y_pitch, silent);
+ }
+}
+
+
int
piglit_probe_rect_rgb_silent(int x, int y, int w, int h, const float *expected)
{