summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolai Hähnle <nicolai.haehnle@amd.com>2017-09-29 14:07:04 +0200
committerNicolai Hähnle <nicolai.haehnle@amd.com>2017-10-03 16:52:13 +0200
commitff037c1d88ffd4788e314415040cb212be85f2d5 (patch)
treef53a23ed84f6245e6134cbeb29896fda0c1441e9
parent5aa6eea37f44f818632a3dad4c1a7478085bd56d (diff)
fbo-viewport: fix false error caused by slight rounding differences
This test compares rendering to the window system framebuffer with rendering to an FBO, and it does so by rendering rotated quads. There can be slight differences in rounding if the Y axis is flipped between those buffers causing rendering differences which are permitted by GL. Change the test to render axis-aligned quads in each viewport instead. This should still catch any error with flipped Ys, and there are no rounding issues since pixels are fully covered by quads. Reviewed-by: Brian Paul <brianp@vmware.com>
-rw-r--r--tests/fbo/fbo-viewport.c37
1 files changed, 11 insertions, 26 deletions
diff --git a/tests/fbo/fbo-viewport.c b/tests/fbo/fbo-viewport.c
index 82d9f04f4..b2e351ce1 100644
--- a/tests/fbo/fbo-viewport.c
+++ b/tests/fbo/fbo-viewport.c
@@ -43,7 +43,7 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
PIGLIT_GL_TEST_CONFIG_END
/**
- * Draw some simple quads in a bunch of viewports which tile the window.
+ * Draw full-viewport quads in a bunch of viewports which tile the window.
* Note that viewports extend beyond the edges of the window too.
*/
static void
@@ -53,56 +53,41 @@ draw_test_image(void)
glClear(GL_COLOR_BUFFER_BIT);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustum(-1, 1, -1, 1, 3, 9.5);
-
- /* Draw some quads at an odd rotation.
- * Note that we want near/far frustum clipping.
- */
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glTranslatef(0, 1, -6.20);
- glRotatef(-60, 1, 0, 0);
- glRotatef(30, 0, 0, 1);
- glScalef(3.5, 3.5, 3.5);
-
/* loop over viewports */
+ int i = 1;
for (vy = -50; vy < piglit_height; vy += vh+10) {
- for (vx = -30; vx < piglit_width; vx += vw+10) {
+ for (vx = -30; vx < piglit_width; vx += vw+10, ++i) {
glViewport(vx, vy, vw, vh);
glBegin(GL_QUADS);
- glColor3f(1, 0, 0);
+ glColor3f((i % 4) / 3.0, ((i / 4) % 4) / 3.0, 0.0);
glVertex2f(-1, -1);
glVertex2f( 0, -1);
glVertex2f( 0, 0);
glVertex2f(-1, 0);
- glColor3f(0, 1, 0);
+ glColor3f((i % 4) / 3.0, ((i / 4) % 4) / 3.0, 0.333);
glVertex2f( 0, -1);
glVertex2f( 1, -1);
glVertex2f( 1, 0);
glVertex2f( 0, 0);
- glColor3f(0, 0, 1);
- glVertex2f(-1, 0);
+ glColor3f((i % 4) / 3.0, ((i / 4) % 4) / 3.0, 0.666);
glVertex2f( 0, 0);
+ glVertex2f( 1, 0);
+ glVertex2f( 1, 1);
glVertex2f( 0, 1);
- glVertex2f(-1, 1);
- glColor3f(1, 1, 1);
+ glColor3f((i % 4) / 3.0, ((i / 4) % 4) / 3.0, 1.0);
+ glVertex2f(-1, 0);
glVertex2f( 0, 0);
- glVertex2f( 1, 0);
- glVertex2f( 1, 1);
glVertex2f( 0, 1);
+ glVertex2f(-1, 1);
glEnd();
}
}
-
- glPopMatrix();
}