[Piglit] [PATCH] piglit-util: set GL_PATCH_VERTICES when drawing a quad as a patch

Marek Olšák maraeo at gmail.com
Sun May 10 17:06:23 PDT 2015


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

---
 tests/util/piglit-util-gl.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index 131f63e..0ffb82c 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -755,7 +755,16 @@ piglit_draw_rect_from_arrays(const void *verts, const void *tex,
 			glEnableVertexAttribArray(PIGLIT_ATTRIB_TEX);
 		}
 
-		glDrawArrays(use_patches ? GL_PATCHES : GL_TRIANGLE_STRIP, 0, 4);
+		if (use_patches) {
+			GLint old_patch_vertices;
+
+			glGetIntegerv(GL_PATCH_VERTICES, &old_patch_vertices);
+			glPatchParameteri(GL_PATCH_VERTICES, 4);
+			glDrawArrays(GL_PATCHES, 0, 4);
+			glPatchParameteri(GL_PATCH_VERTICES, old_patch_vertices);
+		}
+		else
+			glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
 
 		if (verts)
 			glDisableVertexAttribArray(PIGLIT_ATTRIB_POS);
-- 
2.1.0



More information about the Piglit mailing list