[v2,06/15] nv_conditional_render: wrap up query gen/deletion

Submitted by Erik Faye-Lund on Nov. 7, 2018, 9:14 p.m.

Details

Message ID 20181107211420.7355-7-erik.faye-lund@collabora.com
State New
Headers show

Not browsing as part of any series.

Patch hide | download patch | download mbox

diff --git a/tests/spec/nv_conditional_render/begin-while-active.c b/tests/spec/nv_conditional_render/begin-while-active.c
index 8a21243eb..36a1b4070 100644
--- a/tests/spec/nv_conditional_render/begin-while-active.c
+++ b/tests/spec/nv_conditional_render/begin-while-active.c
@@ -62,13 +62,13 @@  piglit_init(int argc, char **argv)
 	GLuint q;
 	piglit_require_extension("GL_NV_conditional_render");
 
-	glGenQueries(1, &q);
+	gen_queries(1, &q);
 	begin_query(q);
 	glBeginConditionalRenderNV(q, GL_QUERY_WAIT_NV);
 	if (!piglit_check_gl_error(GL_INVALID_OPERATION))
 		piglit_report_result(PIGLIT_FAIL);
 	end_query();
-	glDeleteQueries(1, &q);
+	delete_queries(1, &q);
 
 	piglit_report_result(PIGLIT_PASS);
 }
diff --git a/tests/spec/nv_conditional_render/bitmap.c b/tests/spec/nv_conditional_render/bitmap.c
index 2c0bd8e48..efb5c411c 100644
--- a/tests/spec/nv_conditional_render/bitmap.c
+++ b/tests/spec/nv_conditional_render/bitmap.c
@@ -64,7 +64,7 @@  piglit_display(void)
 	buf = malloc(piglit_width * piglit_height);
 	memset(buf, 0xff, piglit_width * piglit_height);
 
-	glGenQueries(1, &q);
+	gen_queries(1, &q);
 
 	/* Generate query pass: draw top half of screen. */
 	glColor4f(0.0, 1.0, 0.0, 0.0);
@@ -90,7 +90,7 @@  piglit_display(void)
 
 	piglit_present_results();
 
-	glDeleteQueries(1, &q);
+	delete_queries(1, &q);
 	free(buf);
 
 	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
diff --git a/tests/spec/nv_conditional_render/blitframebuffer.c b/tests/spec/nv_conditional_render/blitframebuffer.c
index 9a981d45e..37e639073 100644
--- a/tests/spec/nv_conditional_render/blitframebuffer.c
+++ b/tests/spec/nv_conditional_render/blitframebuffer.c
@@ -86,7 +86,7 @@  piglit_display(void)
 
 	fill_tex(0, piglit_width, piglit_height / 2, green_ub);
 
-	glGenQueries(1, &q);
+	gen_queries(1, &q);
 	fail_query(q);
 
 	/* BlitFramebuffer() should be affected by conditional rendering. */
@@ -107,7 +107,7 @@  piglit_display(void)
 
 	piglit_present_results();
 
-	glDeleteQueries(1, &q);
+	delete_queries(1, &q);
 
 	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
diff --git a/tests/spec/nv_conditional_render/clear.c b/tests/spec/nv_conditional_render/clear.c
index ad8169d3f..2ad24eea5 100644
--- a/tests/spec/nv_conditional_render/clear.c
+++ b/tests/spec/nv_conditional_render/clear.c
@@ -59,7 +59,7 @@  piglit_display(void)
 	glClearColor(0.5, 0.5, 0.5, 0.5);
 	glClear(GL_COLOR_BUFFER_BIT);
 
-	glGenQueries(1, &q);
+	gen_queries(1, &q);
 
 	/* Generate query pass: draw top half of screen. */
 	glColor4f(0.0, 1.0, 0.0, 0.0);
@@ -84,7 +84,7 @@  piglit_display(void)
 
 	piglit_present_results();
 
-	glDeleteQueries(1, &q);
+	delete_queries(1, &q);
 
 	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
diff --git a/tests/spec/nv_conditional_render/common.c b/tests/spec/nv_conditional_render/common.c
index b29a6bf6d..c2a3bbdeb 100644
--- a/tests/spec/nv_conditional_render/common.c
+++ b/tests/spec/nv_conditional_render/common.c
@@ -43,6 +43,18 @@  fill_tex(int level, int w, int h, const unsigned char *color)
 	free(data);
 }
 
+void
+gen_queries(GLsizei n, GLuint *ids)
+{
+	glGenQueries(n, ids);
+}
+
+void
+delete_queries(GLsizei n, GLuint *ids)
+{
+	glDeleteQueries(n, ids);
+}
+
 void
 begin_query(GLuint id)
 {
diff --git a/tests/spec/nv_conditional_render/common.h b/tests/spec/nv_conditional_render/common.h
index 752d3eb34..d50063c28 100644
--- a/tests/spec/nv_conditional_render/common.h
+++ b/tests/spec/nv_conditional_render/common.h
@@ -30,6 +30,12 @@ 
 void
 fill_tex(int level, int w, int h, const unsigned char *color);
 
+void
+gen_queries(GLsizei n, GLuint *ids);
+
+void
+delete_queries(GLsizei n, GLuint *ids);
+
 void
 begin_query(GLuint id);
 
diff --git a/tests/spec/nv_conditional_render/copypixels.c b/tests/spec/nv_conditional_render/copypixels.c
index 92c65a207..3599bb1ff 100644
--- a/tests/spec/nv_conditional_render/copypixels.c
+++ b/tests/spec/nv_conditional_render/copypixels.c
@@ -59,8 +59,8 @@  piglit_display(void)
 	glClearColor(1.0, 0.0, 0.0, 0.0);
 	glClear(GL_COLOR_BUFFER_BIT);
 
-	glGenQueries(1, &qpass);
-	glGenQueries(1, &qfail);
+	gen_queries(1, &qpass);
+	gen_queries(1, &qfail);
 
 	/* Generate query pass: draw top half of screen. */
 	glColor4f(0.0, 1.0, 0.0, 0.0);
@@ -86,8 +86,8 @@  piglit_display(void)
 
 	piglit_present_results();
 
-	glDeleteQueries(1, &qfail);
-	glDeleteQueries(1, &qpass);
+	delete_queries(1, &qfail);
+	delete_queries(1, &qpass);
 
 	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
diff --git a/tests/spec/nv_conditional_render/copyteximage.c b/tests/spec/nv_conditional_render/copyteximage.c
index 8d167e47e..aa1f05551 100644
--- a/tests/spec/nv_conditional_render/copyteximage.c
+++ b/tests/spec/nv_conditional_render/copyteximage.c
@@ -70,7 +70,7 @@  piglit_display(void)
 
 	fill_tex(0, piglit_width, piglit_height / 2, red);
 
-	glGenQueries(1, &q);
+	gen_queries(1, &q);
 	fail_query(q);
 
 	/* This should not be affected by conditional rendering. */
@@ -89,7 +89,7 @@  piglit_display(void)
 
 	piglit_present_results();
 
-	glDeleteQueries(1, &q);
+	delete_queries(1, &q);
 
 	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
diff --git a/tests/spec/nv_conditional_render/copytexsubimage.c b/tests/spec/nv_conditional_render/copytexsubimage.c
index 043b3b5ba..a45c41320 100644
--- a/tests/spec/nv_conditional_render/copytexsubimage.c
+++ b/tests/spec/nv_conditional_render/copytexsubimage.c
@@ -70,7 +70,7 @@  piglit_display(void)
 
 	fill_tex(0, piglit_width*2, piglit_height / 2, red);
 
-	glGenQueries(1, &q);
+	gen_queries(1, &q);
 	fail_query(q);
 
 	/* This should not be affected by conditional rendering. */
@@ -89,7 +89,7 @@  piglit_display(void)
 
 	piglit_present_results();
 
-	glDeleteQueries(1, &q);
+	delete_queries(1, &q);
 
 	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
diff --git a/tests/spec/nv_conditional_render/dlist.c b/tests/spec/nv_conditional_render/dlist.c
index 85dc3f73f..a6331b1c4 100644
--- a/tests/spec/nv_conditional_render/dlist.c
+++ b/tests/spec/nv_conditional_render/dlist.c
@@ -52,7 +52,7 @@  piglit_display(void)
 	glClearColor(0.5, 0.5, 0.5, 0.5);
 	glClear(GL_COLOR_BUFFER_BIT);
 
-	glGenQueries(1, &q);
+	gen_queries(1, &q);
 
 	/* Generate query pass: draw bottom half of screen. */
 	glColor4f(0.0, 1.0, 0.0, 0.0);
@@ -79,7 +79,7 @@  piglit_display(void)
 
 	piglit_present_results();
 
-	glDeleteQueries(1, &q);
+	delete_queries(1, &q);
 
 	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
diff --git a/tests/spec/nv_conditional_render/drawpixels.c b/tests/spec/nv_conditional_render/drawpixels.c
index f99ad3058..e3b94e2ce 100644
--- a/tests/spec/nv_conditional_render/drawpixels.c
+++ b/tests/spec/nv_conditional_render/drawpixels.c
@@ -63,7 +63,7 @@  piglit_display(void)
 
 	buf = malloc(sizeof(float) * 4 * piglit_width * piglit_height);
 
-	glGenQueries(1, &q);
+	gen_queries(1, &q);
 
 	/* Generate query pass: draw top half of screen. */
 	glColor4f(0.0, 1.0, 0.0, 0.0);
@@ -100,7 +100,7 @@  piglit_display(void)
 
 	piglit_present_results();
 
-	glDeleteQueries(1, &q);
+	delete_queries(1, &q);
 	free(buf);
 
 	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
diff --git a/tests/spec/nv_conditional_render/generatemipmap.c b/tests/spec/nv_conditional_render/generatemipmap.c
index f6516a450..c6acdddf0 100644
--- a/tests/spec/nv_conditional_render/generatemipmap.c
+++ b/tests/spec/nv_conditional_render/generatemipmap.c
@@ -77,7 +77,7 @@  piglit_display(void)
 		fill_tex(i, level_size, level_size, i == 0 ? green_ub : red);
 	}
 
-	glGenQueries(1, &q);
+	gen_queries(1, &q);
 	fail_query(q);
 
 	/* Mipmap generation should not be affected by conditional rendering. */
@@ -98,7 +98,7 @@  piglit_display(void)
 
 	piglit_present_results();
 
-	glDeleteQueries(1, &q);
+	delete_queries(1, &q);
 
 	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
diff --git a/tests/spec/nv_conditional_render/vertex_array.c b/tests/spec/nv_conditional_render/vertex_array.c
index 51a2aae27..84375bd25 100644
--- a/tests/spec/nv_conditional_render/vertex_array.c
+++ b/tests/spec/nv_conditional_render/vertex_array.c
@@ -60,7 +60,7 @@  piglit_display(void)
 	glClearColor(0.5, 0.5, 0.5, 0.5);
 	glClear(GL_COLOR_BUFFER_BIT);
 
-	glGenQueries(1, &q);
+	gen_queries(1, &q);
 
 	/* Generate query pass: draw bottom half of screen. */
 	glColor4f(0.0, 1.0, 0.0, 0.0);
@@ -84,7 +84,7 @@  piglit_display(void)
 
 	piglit_present_results();
 
-	glDeleteQueries(1, &q);
+	delete_queries(1, &q);
 
 	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }