Commit 1dbc6cef authored by Nicolai Hähnle's avatar Nicolai Hähnle

New test: texturing/texdepth

Very basic test of
 - ARB_depth_texture
 - ARB_shadow
 - ARB_shadow_ambient
 - EXT_shadow_funcs
parent eb6359d4
......@@ -70,6 +70,7 @@ bugs['r300-readcache'] = PlainExecTest([testBinDir + 'r300-readcache'])
texturing = Group()
texturing['cubemap'] = PlainExecTest([testBinDir + 'cubemap', '-auto'])
texturing['texdepth'] = PlainExecTest([testBinDir + 'texdepth', '-auto'])
texturing['texrect-many'] = PlainExecTest([testBinDir + 'texrect-many', '-auto'])
profile.tests['bugs'] = bugs
......
......@@ -19,4 +19,5 @@ link_libraries (
)
add_executable (cubemap cubemap.c)
add_executable (texdepth texdepth.c)
add_executable (texrect-many texrect-many.c)
This diff is collapsed.
......@@ -23,6 +23,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "GL/glut.h"
#include "piglit-util.h"
/** Returns the line in the program string given the character position. */
......@@ -59,3 +63,36 @@ void piglit_require_extension(const char *name)
exit(1);
}
}
/**
* Read a pixel from the given location and compare its RGBA value to the
* given expected values.
*
* Print a log message if the color value deviates from the expected value.
* \return true if the color values match, false otherwise
*/
int piglit_probe_pixel_rgba(int x, int y, const float* expected)
{
GLfloat probe[4];
GLfloat delta[4];
GLfloat deltamax;
int i;
glReadPixels(x, y, 1, 1, GL_RGBA, GL_FLOAT, probe);
deltamax = 0.0;
for(i = 0; i < 4; ++i) {
delta[i] = probe[i] - expected[i];
if (fabs(delta[i]) > deltamax)
deltamax = fabs(delta[i]);
}
if (deltamax < 0.01)
return 1;
printf("Probe at (%i,%i)\n", x, y);
printf(" Expected: %f %f %f %f\n", expected[0], expected[1], expected[2], expected[3]);
printf(" Observed: %f %f %f %f\n", probe[0], probe[1], probe[2], probe[3]);
return 0;
}
......@@ -32,4 +32,4 @@ enum piglit_result {
int FindLine(const char *program, int position);
void piglit_report_result(enum piglit_result result);
void piglit_require_extension(const char *name);
int piglit_probe_pixel_rgba(int x, int y, 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