[Piglit] [PATCH 2/2] Transform feedback: eliminate test dependency on tessellation order.

Paul Berry stereotype441 at gmail.com
Tue Nov 8 16:03:40 PST 2011


The transform feedback tests interleaved.c and position.c were
assuming that a GL_QUAD whose vertices are ABCD is tessellated into
triangle ABD followed by triangle BCD.  This is not a reliable
assumption--according to the EXT_transform_feedback spec, "the order
of tessellation within a primitive is undefined".  This was causing
these tests to fail on the nVidia proprietary Linux driver, which
tessellates quad ABCD as ABC followed by ACD.

This patch chnges interleaved.c and position.c so that they specify
triangles explicitly using glDrawElements(GL_TRIANGLES).  The expected
output is the same, but the test behavior no longer depends on how the
driver tessellates quads.

Fixes bogus failures on nVidia:
- interleaved-attribs
- position-readback-bufferbase
- position-readback-bufferbase-discard
- position-readback-bufferrange
- position-readback-bufferrange-discard
- position-render-bufferrange
- position-render-bufferrange-discard
---
 tests/spec/ext_transform_feedback/interleaved.c |    5 ++++-
 tests/spec/ext_transform_feedback/position.c    |    5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/tests/spec/ext_transform_feedback/interleaved.c b/tests/spec/ext_transform_feedback/interleaved.c
index 0975943..01c6c82 100644
--- a/tests/spec/ext_transform_feedback/interleaved.c
+++ b/tests/spec/ext_transform_feedback/interleaved.c
@@ -115,6 +115,9 @@ enum piglit_result piglit_display(void)
 		20, 20,
 		20, 10
 	};
+	static const unsigned indices[] = {
+		0, 1, 3, 1, 2, 3
+	};
 	static const float expected[] = {
 		0.550000, 0.660000, 0.770000,
 		1.000000, 0.900000, 0.800000, 0.700000,
@@ -161,7 +164,7 @@ enum piglit_result piglit_display(void)
 	glEnable(GL_RASTERIZER_DISCARD);
 	piglit_BeginTransformFeedback(GL_TRIANGLES);
 	glVertexPointer(2, GL_FLOAT, 0, verts);
-	glDrawArrays(GL_QUADS, 0, 4);
+	glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, indices);
 	piglit_EndTransformFeedback();
 	glDisable(GL_RASTERIZER_DISCARD);
 
diff --git a/tests/spec/ext_transform_feedback/position.c b/tests/spec/ext_transform_feedback/position.c
index 2fbd88f..95a5b35 100644
--- a/tests/spec/ext_transform_feedback/position.c
+++ b/tests/spec/ext_transform_feedback/position.c
@@ -180,6 +180,9 @@ enum piglit_result piglit_display(void)
 		-0.375000, 0.250000, 0.000000, 1.000000,
 		-0.375000, -0.375000, 0.000000, 1.000000,
 	};
+	static const unsigned indices[] = {
+		0, 1, 3, 1, 2, 3
+	};
 	static const float clearcolor[] = {0.2, 0.2, 0.2};
 	static const float white[] = {1, 1, 1};
 	static const float red[] = {1, 0, 0};
@@ -206,7 +209,7 @@ enum piglit_result piglit_display(void)
 	piglit_BeginTransformFeedback(GL_TRIANGLES);
 	glBindBuffer(GL_ARRAY_BUFFER, 0);
 	glVertexPointer(2, GL_FLOAT, 0, verts);
-	glDrawArrays(GL_QUADS, 0, 4);
+	glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, indices);
 	piglit_EndTransformFeedback();
 	if (discard)
 		glDisable(GL_RASTERIZER_DISCARD_EXT);
-- 
1.7.6.4



More information about the Piglit mailing list