[Piglit] [PATCH 05/16] util: Add piglit_draw_rect_shader function
Ian Romanick
idr at freedesktop.org
Mon Aug 26 11:37:04 PDT 2013
From: Ian Romanick <ian.d.romanick at intel.com>
This is just like piglit_draw_rect, but it always uses generic attribute
arrays.
This will be used in future commits.
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Cc: Matt Turner <mattst88 at gmail.com>
Cc: Paul Berry <stereoytpe441 at gmail.com>
---
tests/util/piglit-util-gl-common.c | 28 ++++++++++++++++++++++++++++
tests/util/piglit-util-gl-common.h | 1 +
2 files changed, 29 insertions(+)
diff --git a/tests/util/piglit-util-gl-common.c b/tests/util/piglit-util-gl-common.c
index c097d8f..d95eeac 100644
--- a/tests/util/piglit-util-gl-common.c
+++ b/tests/util/piglit-util-gl-common.c
@@ -695,6 +695,34 @@ piglit_draw_rect(float x, float y, float w, float h)
/**
* Convenience function to draw an axis-aligned rectangle.
*/
+void
+piglit_draw_rect_shader(float x, float y, float w, float h)
+{
+ float verts[4][4];
+
+ verts[0][0] = x;
+ verts[0][1] = y;
+ verts[0][2] = 0.0;
+ verts[0][3] = 1.0;
+ verts[1][0] = x + w;
+ verts[1][1] = y;
+ verts[1][2] = 0.0;
+ verts[1][3] = 1.0;
+ verts[2][0] = x;
+ verts[2][1] = y + h;
+ verts[2][2] = 0.0;
+ verts[2][3] = 1.0;
+ verts[3][0] = x + w;
+ verts[3][1] = y + h;
+ verts[3][2] = 0.0;
+ verts[3][3] = 1.0;
+
+ piglit_draw_rect_from_arrays(verts, NULL, false);
+}
+
+/**
+ * Convenience function to draw an axis-aligned rectangle.
+ */
GLvoid
piglit_draw_rect_z(float z, float x, float y, float w, float h)
{
diff --git a/tests/util/piglit-util-gl-common.h b/tests/util/piglit-util-gl-common.h
index 44e46ac..6056869 100644
--- a/tests/util/piglit-util-gl-common.h
+++ b/tests/util/piglit-util-gl-common.h
@@ -158,6 +158,7 @@ GLvoid piglit_draw_triangle(float x1, float y1, float x2, float y2,
GLvoid piglit_draw_triangle_z(float z, float x1, float y1, float x2, float y2,
float x3, float y3);
GLvoid piglit_draw_rect(float x, float y, float w, float h);
+void piglit_draw_rect_shader(float x, float y, float w, float h);
GLvoid piglit_draw_rect_z(float z, float x, float y, float w, float h);
GLvoid piglit_draw_rect_tex(float x, float y, float w, float h,
float tx, float ty, float tw, float th);
--
1.8.1.4
More information about the Piglit
mailing list