[Piglit] [PATCH 1/2] piglit-util-gl: add support for using patches with fixed function attributes

Timothy Arceri tarceri at itsqueeze.com
Mon May 28 03:22:04 UTC 2018


---
 tests/util/piglit-util-gl.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index 2443be03e..ebd57d77b 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -684,10 +684,22 @@ piglit_draw_rect_from_arrays(const void *verts, const void *tex,
 			glEnableClientState(GL_TEXTURE_COORD_ARRAY);
 		}
 
-		if (instance_count > 1)
-			glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, instance_count);
-		else
-			glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+		if (use_patches) {
+			GLint old_patch_vertices;
+
+			glGetIntegerv(GL_PATCH_VERTICES, &old_patch_vertices);
+			glPatchParameteri(GL_PATCH_VERTICES, 4);
+			if (instance_count > 1)
+				glDrawArraysInstanced(GL_PATCHES, 0, 4, instance_count);
+			else
+				glDrawArrays(GL_PATCHES, 0, 4);
+			glPatchParameteri(GL_PATCH_VERTICES, old_patch_vertices);
+		} else {
+			if (instance_count > 1)
+				glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, instance_count);
+			else
+				glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+		}
 
 		if (verts)
 			glDisableClientState(GL_VERTEX_ARRAY);
-- 
2.17.0



More information about the Piglit mailing list