[Piglit] [PATCH 03/16] util: Unify desktop OpenGL and OpenGL ES draw_rect functions
Ian Romanick
idr at freedesktop.org
Mon Aug 26 11:37:02 PDT 2013
From: Ian Romanick <ian.d.romanick at intel.com>
After the previous commit, the code for each was identical.
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 | 95 ++++++++++++++++++++++++++++
tests/util/piglit-util-gl.c | 96 ----------------------------
tests/util/piglit-util-gles.c | 125 -------------------------------------
3 files changed, 95 insertions(+), 221 deletions(-)
diff --git a/tests/util/piglit-util-gl-common.c b/tests/util/piglit-util-gl-common.c
index b506805..b5e87bf 100644
--- a/tests/util/piglit-util-gl-common.c
+++ b/tests/util/piglit-util-gl-common.c
@@ -641,3 +641,98 @@ piglit_draw_rect_from_arrays(const void *verts, const void *tex)
# error "don't know how to draw arrays"
#endif
}
+
+/**
+ * Convenience function to draw an axis-aligned rectangle.
+ */
+GLvoid
+piglit_draw_rect(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);
+}
+
+/**
+ * Convenience function to draw an axis-aligned rectangle.
+ */
+GLvoid
+piglit_draw_rect_z(float z, float x, float y, float w, float h)
+{
+ float verts[4][4];
+
+ verts[0][0] = x;
+ verts[0][1] = y;
+ verts[0][2] = z;
+ verts[0][3] = 1.0;
+ verts[1][0] = x + w;
+ verts[1][1] = y;
+ verts[1][2] = z;
+ verts[1][3] = 1.0;
+ verts[2][0] = x;
+ verts[2][1] = y + h;
+ verts[2][2] = z;
+ verts[2][3] = 1.0;
+ verts[3][0] = x + w;
+ verts[3][1] = y + h;
+ verts[3][2] = z;
+ verts[3][3] = 1.0;
+
+ piglit_draw_rect_from_arrays(verts, NULL);
+}
+
+/**
+ * Convenience function to draw an axis-aligned rectangle
+ * with texture coordinates.
+ */
+GLvoid
+piglit_draw_rect_tex(float x, float y, float w, float h,
+ float tx, float ty, float tw, float th)
+{
+ float verts[4][4];
+ float tex[4][2];
+
+ verts[0][0] = x;
+ verts[0][1] = y;
+ verts[0][2] = 0.0;
+ verts[0][3] = 1.0;
+ tex[0][0] = tx;
+ tex[0][1] = ty;
+ verts[1][0] = x + w;
+ verts[1][1] = y;
+ verts[1][2] = 0.0;
+ verts[1][3] = 1.0;
+ tex[1][0] = tx + tw;
+ tex[1][1] = ty;
+ verts[2][0] = x;
+ verts[2][1] = y + h;
+ verts[2][2] = 0.0;
+ verts[2][3] = 1.0;
+ tex[2][0] = tx;
+ tex[2][1] = ty + th;
+ verts[3][0] = x + w;
+ verts[3][1] = y + h;
+ verts[3][2] = 0.0;
+ verts[3][3] = 1.0;
+ tex[3][0] = tx + tw;
+ tex[3][1] = ty + th;
+
+ piglit_draw_rect_from_arrays(verts, tex);
+}
diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index cf6e599..587c290 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -840,102 +840,6 @@ piglit_draw_triangle_z(float z, float x1, float y1, float x2, float y2,
}
/**
- * Convenience function to draw an axis-aligned rectangle.
- */
-GLvoid
-piglit_draw_rect(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);
-}
-
-/**
- * Convenience function to draw an axis-aligned rectangle.
- */
-GLvoid
-piglit_draw_rect_z(float z, float x, float y, float w, float h)
-{
- float verts[4][4];
-
- verts[0][0] = x;
- verts[0][1] = y;
- verts[0][2] = z;
- verts[0][3] = 1.0;
- verts[1][0] = x + w;
- verts[1][1] = y;
- verts[1][2] = z;
- verts[1][3] = 1.0;
- verts[2][0] = x;
- verts[2][1] = y + h;
- verts[2][2] = z;
- verts[2][3] = 1.0;
- verts[3][0] = x + w;
- verts[3][1] = y + h;
- verts[3][2] = z;
- verts[3][3] = 1.0;
-
- piglit_draw_rect_from_arrays(verts, NULL);
-}
-
-/**
- * Convenience function to draw an axis-aligned rectangle
- * with texture coordinates.
- */
-GLvoid
-piglit_draw_rect_tex(float x, float y, float w, float h,
- float tx, float ty, float tw, float th)
-{
- float verts[4][4];
- float tex[4][2];
-
- verts[0][0] = x;
- verts[0][1] = y;
- verts[0][2] = 0.0;
- verts[0][3] = 1.0;
- tex[0][0] = tx;
- tex[0][1] = ty;
- verts[1][0] = x + w;
- verts[1][1] = y;
- verts[1][2] = 0.0;
- verts[1][3] = 1.0;
- tex[1][0] = tx + tw;
- tex[1][1] = ty;
- verts[2][0] = x;
- verts[2][1] = y + h;
- verts[2][2] = 0.0;
- verts[2][3] = 1.0;
- tex[2][0] = tx;
- tex[2][1] = ty + th;
- verts[3][0] = x + w;
- verts[3][1] = y + h;
- verts[3][2] = 0.0;
- verts[3][3] = 1.0;
- tex[3][0] = tx + tw;
- tex[3][1] = ty + th;
-
- piglit_draw_rect_from_arrays(verts, tex);
-}
-
-
-/**
* Convenience function to configure an abitrary orthogonal projection matrix
*/
void
diff --git a/tests/util/piglit-util-gles.c b/tests/util/piglit-util-gles.c
index 57b0aa6..c1b649a 100644
--- a/tests/util/piglit-util-gles.c
+++ b/tests/util/piglit-util-gles.c
@@ -175,131 +175,6 @@ piglit_escape_exit_key(unsigned char key, int x, int y)
}
/**
- * Convenience function to draw an axis-aligned rectangle.
- */
-GLvoid
-piglit_draw_rect(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);
-}
-
-
-/**
- * Convenience function to draw an axis-aligned backfaced rectangle.
- */
-GLvoid
-piglit_draw_rect_back(float x, float y, float w, float h)
-{
- float verts[4][4];
-
- verts[0][0] = x + w;
- verts[0][1] = y;
- verts[0][2] = 0.0;
- verts[0][3] = 1.0;
- verts[1][0] = x;
- verts[1][1] = y;
- verts[1][2] = 0.0;
- verts[1][3] = 1.0;
- verts[2][0] = x + w;
- verts[2][1] = y + h;
- verts[2][2] = 0.0;
- verts[2][3] = 1.0;
- verts[3][0] = x;
- verts[3][1] = y + h;
- verts[3][2] = 0.0;
- verts[3][3] = 1.0;
-
- piglit_draw_rect_from_arrays(verts, NULL);
-}
-
-
-/**
- * Convenience function to draw an axis-aligned rectangle.
- */
-GLvoid
-piglit_draw_rect_z(float z, float x, float y, float w, float h)
-{
- float verts[4][4];
-
- verts[0][0] = x;
- verts[0][1] = y;
- verts[0][2] = z;
- verts[0][3] = 1.0;
- verts[1][0] = x + w;
- verts[1][1] = y;
- verts[1][2] = z;
- verts[1][3] = 1.0;
- verts[2][0] = x;
- verts[2][1] = y + h;
- verts[2][2] = z;
- verts[2][3] = 1.0;
- verts[3][0] = x + w;
- verts[3][1] = y + h;
- verts[3][2] = z;
- verts[3][3] = 1.0;
-
- piglit_draw_rect_from_arrays(verts, NULL);
-}
-
-/**
- * Convenience function to draw an axis-aligned rectangle
- * with texture coordinates.
- */
-GLvoid
-piglit_draw_rect_tex(float x, float y, float w, float h,
- float tx, float ty, float tw, float th)
-{
- float verts[4][4];
- float tex[4][2];
-
- verts[0][0] = x;
- verts[0][1] = y;
- verts[0][2] = 0.0;
- verts[0][3] = 1.0;
- tex[0][0] = tx;
- tex[0][1] = ty;
- verts[1][0] = x + w;
- verts[1][1] = y;
- verts[1][2] = 0.0;
- verts[1][3] = 1.0;
- tex[1][0] = tx + tw;
- tex[1][1] = ty;
- verts[2][0] = x;
- verts[2][1] = y + h;
- verts[2][2] = 0.0;
- verts[2][3] = 1.0;
- tex[2][0] = tx;
- tex[2][1] = ty + th;
- verts[3][0] = x + w;
- verts[3][1] = y + h;
- verts[3][2] = 0.0;
- verts[3][3] = 1.0;
- tex[3][0] = tx + tw;
- tex[3][1] = ty + th;
-
- piglit_draw_rect_from_arrays(verts, tex);
-}
-
-/**
* Generates a texture with the given internalFormat, w, h with a
* teximage of r, g, b w quadrants.
*
--
1.8.1.4
More information about the Piglit
mailing list