These don't need to remain in the GL-specific utility library. Signed-off-by: Josh Triplett <j...@joshtriplett.org> --- tests/util/piglit-util-gl-common.c | 116 +++++++++++++++++++++++++++++++++++++ tests/util/piglit-util-gl.c | 115 ------------------------------------ 2 files changed, 116 insertions(+), 115 deletions(-)
diff --git a/tests/util/piglit-util-gl-common.c b/tests/util/piglit-util-gl-common.c index e05ae43..a4c283d 100644 --- a/tests/util/piglit-util-gl-common.c +++ b/tests/util/piglit-util-gl-common.c @@ -1680,3 +1680,119 @@ int piglit_probe_texel_volume_rgba(int target, int level, int x, int y, int z, free(buffer); return 1; } + +/** + * Read a pixel from the given location and compare its depth value to the + * given expected value. + * + * Print a log message if the depth value deviates from the expected value. + * \return true if the depth value matches, false otherwise + */ +int piglit_probe_pixel_depth(int x, int y, float expected) +{ + GLfloat probe; + GLfloat delta; + + glReadPixels(x, y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &probe); + + delta = probe - expected; + if (fabs(delta) < 0.01) + return 1; + + printf("Probe depth at (%i,%i)\n", x, y); + printf(" Expected: %f\n", expected); + printf(" Observed: %f\n", probe); + + return 0; +} + +int piglit_probe_rect_depth(int x, int y, int w, int h, float expected) +{ + int i, j; + GLfloat *probe; + GLfloat *pixels = malloc(w*h*sizeof(float)); + + glReadPixels(x, y, w, h, GL_DEPTH_COMPONENT, GL_FLOAT, pixels); + + for (j = 0; j < h; j++) { + for (i = 0; i < w; i++) { + probe = &pixels[j*w+i]; + + if (fabs(*probe - expected) >= 0.01) { + printf("Probe depth at (%i,%i)\n", x+i, y+j); + printf(" Expected: %f\n", expected); + printf(" Observed: %f\n", *probe); + + free(pixels); + return 0; + } + } + } + + free(pixels); + 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 stencil 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 stencil 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; +} + +bool piglit_probe_buffer(GLuint buf, GLenum target, const char *label, + unsigned n, unsigned num_components, + const float *expected) +{ + float *ptr; + unsigned i; + bool status = true; + + glBindBuffer(target, buf); + ptr = glMapBuffer(target, GL_READ_ONLY); + + for (i = 0; i < n * num_components; i++) { + if (fabs(ptr[i] - expected[i % num_components]) > 0.01) { + printf("%s[%i]: %f, Expected: %f\n", label, i, ptr[i], + expected[i % num_components]); + status = false; + } + } + + glUnmapBuffer(target); + + return status; +} + diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c index 8e4fc52..611b59a 100644 --- a/tests/util/piglit-util-gl.c +++ b/tests/util/piglit-util-gl.c @@ -38,121 +38,6 @@ GLint piglit_ARBfp_pass_through = 0; -/** - * Read a pixel from the given location and compare its depth value to the - * given expected value. - * - * Print a log message if the depth value deviates from the expected value. - * \return true if the depth value matches, false otherwise - */ -int piglit_probe_pixel_depth(int x, int y, float expected) -{ - GLfloat probe; - GLfloat delta; - - glReadPixels(x, y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &probe); - - delta = probe - expected; - if (fabs(delta) < 0.01) - return 1; - - printf("Probe depth at (%i,%i)\n", x, y); - printf(" Expected: %f\n", expected); - printf(" Observed: %f\n", probe); - - return 0; -} - -int piglit_probe_rect_depth(int x, int y, int w, int h, float expected) -{ - int i, j; - GLfloat *probe; - GLfloat *pixels = malloc(w*h*sizeof(float)); - - glReadPixels(x, y, w, h, GL_DEPTH_COMPONENT, GL_FLOAT, pixels); - - for (j = 0; j < h; j++) { - for (i = 0; i < w; i++) { - probe = &pixels[j*w+i]; - - if (fabs(*probe - expected) >= 0.01) { - printf("Probe depth at (%i,%i)\n", x+i, y+j); - printf(" Expected: %f\n", expected); - printf(" Observed: %f\n", *probe); - - free(pixels); - return 0; - } - } - } - - free(pixels); - 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 stencil 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 stencil 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; -} - -bool piglit_probe_buffer(GLuint buf, GLenum target, const char *label, - unsigned n, unsigned num_components, - const float *expected) -{ - float *ptr; - unsigned i; - bool status = true; - - glBindBuffer(target, buf); - ptr = glMapBuffer(target, GL_READ_ONLY); - - for (i = 0; i < n * num_components; i++) { - if (fabs(ptr[i] - expected[i % num_components]) > 0.01) { - printf("%s[%i]: %f, Expected: %f\n", label, i, ptr[i], - expected[i % num_components]); - status = false; - } - } - - glUnmapBuffer(target); - - return status; -} - int piglit_use_fragment_program(void) { static const char source[] = -- 2.0.1 _______________________________________________ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit