[Piglit] [PATCH 1/2] util: add piglit_probe_pixel_rgba_sint/uint
christoph at bumiller.com
christoph at bumiller.com
Mon Dec 19 07:52:41 PST 2011
From: Christoph Bumiller <e0425955 at student.tuwien.ac.at>
---
tests/util/piglit-util-gl.c | 40 ++++++++++++++++++++++++++++++++++++++++
tests/util/piglit-util.h | 2 ++
2 files changed, 42 insertions(+), 0 deletions(-)
diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index 2a88ef5..7eaaaee 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -69,6 +69,46 @@ int piglit_probe_pixel_rgba(int x, int y, const float* expected)
return 0;
}
+int piglit_probe_pixel_rgba_sint(int x, int y, const GLint* expected)
+{
+ GLint probe[4];
+ int i;
+
+ glReadPixels(x, y, 1, 1, GL_RGBA_INTEGER, GL_INT, probe);
+
+ for(i = 0; i < 4; ++i)
+ if (probe[i] != expected[i])
+ break;
+ if (i == 4)
+ return 1;
+
+ printf("Probe at (%i,%i)\n", x, y);
+ printf(" Expected: %i %i %i %i\n", expected[0], expected[1], expected[2], expected[3]);
+ printf(" Observed: %i %i %i %i\n", probe[0], probe[1], probe[2], probe[3]);
+
+ return 0;
+}
+
+int piglit_probe_pixel_rgba_uint(int x, int y, const GLuint* expected)
+{
+ GLuint probe[4];
+ int i;
+
+ glReadPixels(x, y, 1, 1, GL_RGBA_INTEGER, GL_UNSIGNED_INT, probe);
+
+ for(i = 0; i < 4; ++i)
+ if (probe[i] != expected[i])
+ break;
+ if (i == 4)
+ return 1;
+
+ printf("Probe at (%i,%i)\n", x, y);
+ printf(" Expected: %08x %08x %08x %08x\n", expected[0], expected[1], expected[2], expected[3]);
+ printf(" Observed: %08x %08x %08x %08x\n", probe[0], probe[1], probe[2], probe[3]);
+
+ return 0;
+}
+
int piglit_probe_pixel_rgb_silent(int x, int y, const float* expected, float *out_probe)
{
GLfloat probe[3];
diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
index 15eb42a..2625c76 100755
--- a/tests/util/piglit-util.h
+++ b/tests/util/piglit-util.h
@@ -191,6 +191,8 @@ int piglit_probe_pixel_rgb_silent(int x, int y, const float* expected, float *ou
int piglit_probe_pixel_rgba_silent(int x, int y, const float* expected, float *out_probe);
int piglit_probe_pixel_rgb(int x, int y, const float* expected);
int piglit_probe_pixel_rgba(int x, int y, const float* expected);
+int piglit_probe_pixel_rgba_sint(int x, int y, const GLint* expected);
+int piglit_probe_pixel_rgba_uint(int x, int y, const GLuint* expected);
int piglit_probe_rect_rgb(int x, int y, int w, int h, const float* expected);
int piglit_probe_rect_rgba(int x, int y, int w, int h, const float* expected);
int piglit_probe_image_rgb(int x, int y, int w, int h, const float *image);
--
1.7.3.4
More information about the Piglit
mailing list