Commit 246be615 authored by Vinson Lee's avatar Vinson Lee

fdo23670-drawpix_stencil: Fix up and build as a piglit test.

parent 799e9299
......@@ -149,6 +149,7 @@ bugs['tex1d-2dborder'] = PlainExecTest([testBinDir + 'tex1d-2dborder', '-auto'])
bugs['point-sprite'] = PlainExecTest([testBinDir + 'point-sprite', '-auto'])
bugs['fdo22540'] = PlainExecTest([testBinDir + 'fdo22540', '-auto'])
bugs['fdo23489'] = PlainExecTest([testBinDir + 'fdo23489', '-auto'])
bugs['fdo23670-drawpix_stencil'] = PlainExecTest([testBinDir + 'fdo23670-drawpix_stencil', '-auto'])
texturing = Group()
texturing['copytexsubimage'] = PlainExecTest([testBinDir + 'copytexsubimage', '-auto'])
......
......@@ -31,3 +31,4 @@ add_executable (fdo20701 fdo20701.c)
add_executable (point-sprite point-sprite.c)
add_executable (fdo22540 fdo22540.c)
add_executable (fdo23489 fdo23489.c)
add_executable (fdo23670-drawpix_stencil fdo23670-drawpix_stencil.c)
......@@ -34,9 +34,13 @@
#include <GL/glut.h>
#endif
#include "piglit-util.h"
#define WIN_WIDTH 100
#define WIN_HEIGHT 100
static GLboolean Automatic = GL_FALSE;
static void
init(void)
{
......@@ -55,7 +59,11 @@ display(void)
{
GLubyte stencil_rect[20 * 20];
int i;
int x, y;
GLboolean pass = GL_TRUE;
static float red[] = {1.0, 0.0, 0,0, 0.0};
static float black[] = {0.0, 0.0, 0,0, 0.0};
glClearStencil(0);
glClearDepth(1.0);
glClearColor(0.0, 0.0, 0.0, 0.0);
......@@ -77,15 +85,38 @@ display(void)
glColor3f(1.0, 0.0, 0.0);
glRectf(50, 50, 50+20, 50+20);
glDisable(GL_STENCIL_TEST);
for (x = 50; x < 50 + 20; x++) {
for (y = 50; y < 50 + 10; y++) {
pass &= piglit_probe_pixel_rgb(x, y, red);
}
for (y = 50 + 10; y < 50 + 20; y++) {
pass &= piglit_probe_pixel_rgb(x, y, black);
}
}
glutSwapBuffers();
if (Automatic) {
piglit_report_result(pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
}
}
int main(int argc, char **argv)
{
int i;
for(i = 1; i < argc; ++i) {
if (!strcmp(argv[i], "-auto"))
Automatic = 1;
else
printf("Unknown option: %s\n", argv[i]);
}
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_STENCIL);
glutInitWindowSize(WIN_WIDTH, WIN_HEIGHT);
glutCreateWindow("drawpix_stencil");
glutCreateWindow("fdo23670-drawpix_stencil");
glutKeyboardFunc(piglit_escape_exit_key);
glutDisplayFunc(display);
init();
......
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