Commit 8b22896d authored by Chad Versace's avatar Chad Versace Committed by Chad Versace

util: Add stencil probe functions

Add functions:
    piglit_probe_pixel_stencil
    piglit_probe_rect_stencil
Signed-off-by: default avatarChad Versace <chad.versace@intel.com>
parent 763dec4b
......@@ -323,6 +323,45 @@ int piglit_probe_rect_depth(int x, int y, int w, int h, float expected)
return 1;
}
int piglit_probe_pixel_stencil(int x, int y, unsigned expected)
{
GLuint probe;
glReadPixels(x, y, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_INT, &probe);
if (probe == expected)
return 1;
printf("Probe at (%i, %i)\n", x, y);
printf(" Expected: %u\n", expected);
printf(" Observed: %u\n", probe);
return 0;
}
int piglit_probe_rect_stencil(int x, int y, int w, int h, unsigned expected)
{
int i, j;
GLuint *pixels = malloc(w*h*sizeof(GLuint));
glReadPixels(x, y, w, h, GL_STENCIL_INDEX, GL_UNSIGNED_INT, pixels);
for (j = 0; j < h; j++) {
for (i = 0; i < w; i++) {
GLuint probe = pixels[j * w + i];
if (probe != expected) {
printf("Probe at (%i, %i)\n", x + i, y + j);
printf(" Expected: %u\n", expected);
printf(" Observed: %u\n", probe);
free(pixels);
return 0;
}
}
}
free(pixels);
return 1;
}
/**
* Read a texel rectangle from the given location and compare its RGBA value to
* the given expected values.
......
......@@ -123,6 +123,8 @@ int piglit_probe_texel_rgba(int target, int level, int x, int y,
const float* expected);
int piglit_probe_pixel_depth(int x, int y, float expected);
int piglit_probe_rect_depth(int x, int y, int w, int h, float expected);
int piglit_probe_pixel_stencil(int x, int y, unsigned expected);
int piglit_probe_rect_stencil(int x, int y, int w, int h, unsigned expected);
int piglit_probe_rect_halves_equal_rgba(int x, int y, int w, int h);
int piglit_use_fragment_program(void);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment