[Piglit] [PATCH 2/2] getteximage-formats: restore text/info printing

Brian Paul brian.e.paul at gmail.com
Sat Dec 8 16:12:42 PST 2012


From: Brian Paul <brianp at vmware.com>

This was removed when we switched to using waffle.  It's being restored
now that we have the piglit_draw_string() function.
---
 tests/texturing/getteximage-formats.c |   52 ++++++++++++++++++++++++++++++--
 1 files changed, 48 insertions(+), 4 deletions(-)

diff --git a/tests/texturing/getteximage-formats.c b/tests/texturing/getteximage-formats.c
index 2901ec9..30fdf32 100644
--- a/tests/texturing/getteximage-formats.c
+++ b/tests/texturing/getteximage-formats.c
@@ -33,6 +33,7 @@
 
 
 #include "piglit-util-gl-common.h"
+#include "piglit-font.h"
 #include "../fbo/fbo-formats.h"
 
 PIGLIT_GL_TEST_CONFIG_BEGIN
@@ -55,6 +56,30 @@ static const GLfloat clearColor[4] = { 0.4, 0.4, 0.4, 0.0 };
 #define DO_BLEND 1
 
 
+static void
+print(int x, int y, const char *s)
+{
+	glColor3f(1, 1, 1);
+	glWindowPos2iARB(x, y);
+	piglit_draw_string(s);
+}
+
+static void
+draw_format_text(const struct test_desc *test,
+                 const struct format_desc *fmt)
+{
+	char s[200];
+	sprintf(s, "%s: %s", test->param, fmt->name);
+	print(10, piglit_height - 20, s);
+}
+
+static void
+draw_unsupported(void)
+{
+	print(10, piglit_height - 40, "Not supported by test");
+}
+
+
 /**
  * Make a simple texture image where red increases from left to right,
  * green increases from bottom to top, blue stays constant (50%) and
@@ -327,12 +352,17 @@ test_format(const struct test_desc *test,
 
 	glClear(GL_COLOR_BUFFER_BIT);
 
-	/* The RGBA_DXT1 formats seem to expose a Mesa/libtxc_dxtn bug.
-	 * Just skip them for now.  Testing the other compressed formats
-	 * is good enough.
-	 */
+	if (!piglit_automatic) {
+		draw_format_text(test, fmt);
+	}
+
 	if (fmt->internalformat != GL_COMPRESSED_RGBA_S3TC_DXT1_EXT &&
 	    fmt->internalformat != GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT) {
+		/* The RGBA_DXT1 formats seem to expose a Mesa/libtxc_dxtn bug.
+		 * Just skip them for now.  Testing the other compressed formats
+		 * is good enough.
+		 */
+
 		/* init texture image */
 		if (!make_texture_image(fmt->internalformat, upperRightTexel))
 			return GL_TRUE; /* unsupported = OK */
@@ -371,6 +401,18 @@ test_format(const struct test_desc *test,
 
 			assert(!glIsEnabled(GL_TEXTURE_2D));
 
+			if (!piglit_automatic) {
+				if (level == 0) {
+					print(x, y - 18, "glGetTexImage");
+					print(x, y - 30, "level 0");
+				}
+				else {
+					char s[10];
+					sprintf(s, "%d", level);
+					print(x, y - 18, s);
+				}
+			}
+
 			if (level <= 2) {
 				GLint rx = x + w-1;
 				GLint ry = y + h-1;
@@ -467,6 +509,8 @@ piglit_display(void)
 		}
 		else {
 			glClear(GL_COLOR_BUFFER_BIT);
+			draw_format_text(set, &set->format[format_index]);
+			draw_unsupported();
 			piglit_present_results();
 		}
 	}
-- 
1.7.4.1



More information about the Piglit mailing list