[Piglit] [PATCH 2/4] drawoverhead: fix primitive restart testing for GL Compatibility

Marek Olšák maraeo at gmail.com
Tue Jun 20 20:02:39 UTC 2017


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

---
 tests/perf/drawoverhead.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/tests/perf/drawoverhead.c b/tests/perf/drawoverhead.c
index 7dff1b4..4e04a05 100644
--- a/tests/perf/drawoverhead.c
+++ b/tests/perf/drawoverhead.c
@@ -399,38 +399,48 @@ draw_many_ubo_change(unsigned count)
 				glBindBufferBase(GL_UNIFORM_BUFFER, 0, ubo[(i + j) % 4]);
 			glDrawArrays(GL_TRIANGLES, 0, 3);
 		}
 	}
 }
 
 static void
 draw_state_change(unsigned count)
 {
 	unsigned i;
+	void (*enable)(GLenum) = glEnable;
+	void (*disable)(GLenum) = glDisable;
+	GLenum glenum = enable_enum;
+
+	if (is_compat && enable_enum == GL_PRIMITIVE_RESTART) {
+		enable = glEnableClientState;
+		disable = glDisableClientState;
+		glenum = GL_PRIMITIVE_RESTART_NV;
+	}
+
 	if (indexed) {
 		for (i = 0; i < count; i++) {
 			if (i & 1)
-				glEnable(enable_enum);
+				enable(glenum);
 			else
-				glDisable(enable_enum);
+				disable(glenum);
 			glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, NULL);
 		}
 	} else {
 		for (i = 0; i < count; i++) {
 			if (i & 1)
-				glEnable(enable_enum);
+				enable(glenum);
 			else
-				glDisable(enable_enum);
+				disable(glenum);
 			glDrawArrays(GL_TRIANGLES, 0, 3);
 		}
 	}
-	glDisable(enable_enum);
+	disable(glenum);
 }
 
 static void
 draw_scissor_change(unsigned count)
 {
 	unsigned i;
 	glEnable(GL_SCISSOR_TEST);
 	if (indexed) {
 		for (i = 0; i < count; i++) {
 			if (i & 1)
-- 
2.7.4



More information about the Piglit mailing list