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

Submitted by Marek Olšák on June 20, 2017, 8:02 p.m.

Details

Message ID 1497988961-4537-2-git-send-email-maraeo@gmail.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Piglit

Not browsing as part of any series.

Commit Message

Marek Olšák June 20, 2017, 8:02 p.m.
From: Marek Olšák <marek.olsak@amd.com>

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

Patch hide | download patch | download mbox

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)