[Piglit] [PATCH] primitive-restart-draw-mode: fix failures caused by precision issues

Marek Olšák maraeo at gmail.com
Sat Mar 22 11:20:45 PDT 2014


From: Marek Olšák <marek.olsak at amd.com>

Instead of offsetting the vertex position for the second half of the screen,
setup both halves as separate viewports.
---
 tests/general/primitive-restart-draw-mode.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tests/general/primitive-restart-draw-mode.c b/tests/general/primitive-restart-draw-mode.c
index 9bf47b4..722a440 100644
--- a/tests/general/primitive-restart-draw-mode.c
+++ b/tests/general/primitive-restart-draw-mode.c
@@ -249,20 +249,26 @@ piglit_display(void)
 
 	glClear(GL_COLOR_BUFFER_BIT);
 	glUseProgram(prog);
-	glUniform2f(window_size_loc, piglit_width, piglit_height);
+	glUniform2f(window_size_loc, piglit_width/2, piglit_height);
 	glVertexAttribPointer(vertex_attr, 2, GL_FLOAT, GL_FALSE,
 			      sizeof(vertex_patterns[test->pattern][0]),
 			      vertex_patterns[test->pattern]);
 	glEnableVertexAttribArray(vertex_attr);
 
 	for (col = 0; col < NUM_COLS; col++) {
+		if (col == 0)
+			glViewport(0, 0, piglit_width/2, piglit_height);
+		else
+			glViewport(piglit_width/2, 0, piglit_width/2, piglit_height);
+
 		for (row = 0; row < NUM_ROWS; row++) {
-			glUniform2f(offset_loc, col * PATTERN_SIZE,
+			glUniform2f(offset_loc, 0,
 				    (NUM_ROWS - 1 - row) * PATTERN_SIZE);
 			draw_pattern(row + 1, col == 0);
 		}
 	}
 
+	glViewport(0, 0, piglit_width, piglit_height);
 	pass = piglit_probe_rect_halves_equal_rgba(0, 0, piglit_width,
 						   piglit_height) && pass;
 	pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
-- 
1.8.3.2



More information about the Piglit mailing list