Commit 97c64688 authored by Marek Olšák's avatar Marek Olšák

util: add functions piglit_probe_pixel_rgb(a)_silent

which don't print anything, but can return the probed pixel color.
parent 5e80f77a
......@@ -86,6 +86,46 @@ int piglit_probe_pixel_rgba(int x, int y, const float* expected)
return 0;
}
int piglit_probe_pixel_rgb_silent(int x, int y, const float* expected, float *out_probe)
{
GLfloat probe[3];
int i;
GLboolean pass = GL_TRUE;
glReadPixels(x, y, 1, 1, GL_RGB, GL_FLOAT, probe);
for(i = 0; i < 3; ++i) {
if (fabs(probe[i] - expected[i]) > piglit_tolerance[i]) {
pass = GL_FALSE;
}
}
if (out_probe)
memcpy(out_probe, probe, sizeof(probe));
return pass;
}
int piglit_probe_pixel_rgba_silent(int x, int y, const float* expected, float *out_probe)
{
GLfloat probe[4];
int i;
GLboolean pass = GL_TRUE;
glReadPixels(x, y, 1, 1, GL_RGBA, GL_FLOAT, probe);
for(i = 0; i < 4; ++i) {
if (fabs(probe[i] - expected[i]) > piglit_tolerance[i]) {
pass = GL_FALSE;
}
}
if (out_probe)
memcpy(out_probe, probe, sizeof(probe));
return pass;
}
int
piglit_probe_rect_rgba(int x, int y, int w, int h, const float *expected)
{
......
......@@ -105,6 +105,8 @@ int FindLine(const char *program, int position);
void piglit_report_result(enum piglit_result result);
void piglit_require_extension(const char *name);
void piglit_require_not_extension(const char *name);
int piglit_probe_pixel_rgb_silent(int x, int y, const float* expected, float *out_probe);
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_rect_rgb(int x, int y, int w, int h, const float* expected);
......
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