[Piglit] [PATCH 2/2] arb_texture_compression: Check that only the correct formats are advertised

Ian Romanick idr at freedesktop.org
Mon Jul 25 11:01:36 PDT 2011


From: Ian Romanick <ian.d.romanick at intel.com>

There are particular rules about which formats should be advertised
via the GL_COMPRESSED_TEXTURE_FORMATS query.  This checks that those
rules are followed.

This test, in all its variations, passes on NVIDIA (driver 260.19.36).

This test fails on AMD (driver 11.6) because the
GL_COMPRESSED_TEXTURE_FORMATS query does not return *any* formats.

This test fails on Mesa (driver 7.10.3) because the S3TC sRGB
formats are advertised even when GL_EXT_texture_compress_s3tc is not
available.
---
 tests/all.tests                                    |   24 +
 .../spec/arb_texture_compression/CMakeLists.gl.txt |    1 +
 .../spec/arb_texture_compression/invalid-formats.c |  462 ++++++++++++++++++++
 3 files changed, 487 insertions(+), 0 deletions(-)
 create mode 100644 tests/spec/arb_texture_compression/invalid-formats.c

diff --git a/tests/all.tests b/tests/all.tests
index ead56d6..1793339 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -848,6 +848,8 @@ add_texwrap_test2(arb_texture_rectangle, 'RECT', 'proj')
 tdfx_texture_compression_fxt1 = Group()
 spec['3DFX_texture_compression_FXT1'] = tdfx_texture_compression_fxt1
 add_fbo_generatemipmap_extension(tdfx_texture_compression_fxt1, 'GL_3DFX_texture_compression_FXT1', 'fbo-generatemipmap-formats')
+tdfx_texture_compression_fxt1['invalid formats'] = PlainExecTest(['arb_texture_compression-invalid-formats', 'fxt1'])
+tdfx_texture_compression_fxt1['invalid formats'].runConcurrent = True
 
 def add_color_buffer_float_test(name, format, p1, p2):
 	arb_color_buffer_float[format + '-' + name + ('-' + p1 if len(p1) else '') + ('-' + p2 if len(p2) else '')] = PlainExecTest(['arb_color_buffer_float-' + name, format, p1, p2])
@@ -934,6 +936,13 @@ add_texwrap_test2(arb_texture_compression, '2D', 'GL_COMPRESSED_RGB')
 add_texwrap_test2(arb_texture_compression, '2D', 'GL_COMPRESSED_RGBA')
 arb_texture_compression['GL_TEXTURE_INTERNAL_FORMAT query'] = PlainExecTest(['arb_texture_compression-internal-format-query', '-auto'])
 arb_texture_compression['GL_TEXTURE_INTERNAL_FORMAT query'].runConcurrent = True
+arb_texture_compression['unknown formats'] = PlainExecTest(['arb_texture_compression-invalid-formats', 'unknown'])
+arb_texture_compression['unknown formats'].runConcurrent = True
+
+arb_texture_compression_bptc = Group()
+spec['ARB_texture_compression_bptc'] = arb_texture_compression_bptc
+arb_texture_compression_bptc['invalid formats'] = PlainExecTest(['arb_texture_compression-invalid-formats', 'bptc'])
+arb_texture_compression_bptc['invalid formats'].runConcurrent = True
 
 arb_vertex_buffer_object = Group()
 spec['ARB_vertex_buffer_object'] = arb_vertex_buffer_object
@@ -970,6 +979,8 @@ add_texwrap_test2(ext_texture_compression_latc, '2D', 'GL_COMPRESSED_LUMINANCE_L
 add_texwrap_test2(ext_texture_compression_latc, '2D', 'GL_COMPRESSED_SIGNED_LUMINANCE_LATC1')
 add_texwrap_test2(ext_texture_compression_latc, '2D', 'GL_COMPRESSED_LUMINANCE_ALPHA_LATC2')
 add_texwrap_test2(ext_texture_compression_latc, '2D', 'GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2')
+ext_texture_compression_latc['invalid formats'] = PlainExecTest(['arb_texture_compression-invalid-formats', 'latc'])
+ext_texture_compression_latc['invalid formats'].runConcurrent = True
 
 ext_texture_compression_rgtc = Group()
 spec['EXT_texture_compression_rgtc'] = ext_texture_compression_rgtc
@@ -979,6 +990,8 @@ add_texwrap_test2(ext_texture_compression_rgtc, '2D', 'GL_COMPRESSED_RED_RGTC1')
 add_texwrap_test2(ext_texture_compression_rgtc, '2D', 'GL_COMPRESSED_SIGNED_RED_RGTC1')
 add_texwrap_test2(ext_texture_compression_rgtc, '2D', 'GL_COMPRESSED_RG_RGTC2')
 add_texwrap_test2(ext_texture_compression_rgtc, '2D', 'GL_COMPRESSED_SIGNED_RG_RGTC2')
+ext_texture_compression_rgtc['invalid formats'] = PlainExecTest(['arb_texture_compression-invalid-formats', 'rgtc'])
+ext_texture_compression_rgtc['invalid formats'].runConcurrent = True
 
 ext_texture_compression_s3tc = Group()
 spec['EXT_texture_compression_s3tc'] = ext_texture_compression_s3tc
@@ -987,11 +1000,15 @@ add_texwrap_test2(ext_texture_compression_s3tc, '2D', 'GL_COMPRESSED_RGB_S3TC_DX
 add_texwrap_test2(ext_texture_compression_s3tc, '2D', 'GL_COMPRESSED_RGBA_S3TC_DXT1')
 add_texwrap_test2(ext_texture_compression_s3tc, '2D', 'GL_COMPRESSED_RGBA_S3TC_DXT3')
 add_texwrap_test2(ext_texture_compression_s3tc, '2D', 'GL_COMPRESSED_RGBA_S3TC_DXT5')
+ext_texture_compression_s3tc['invalid formats'] = PlainExecTest(['arb_texture_compression-invalid-formats', 's3tc'])
+ext_texture_compression_s3tc['invalid formats'].runConcurrent = True
 
 ati_texture_compression_3dc = Group()
 spec['ATI_texture_compression_3dc'] = ati_texture_compression_3dc
 add_fbo_generatemipmap_extension(ati_texture_compression_3dc, 'GL_ATI_texture_compression_3dc', 'fbo-generatemipmap-formats')
 add_texwrap_test2(ati_texture_compression_3dc, '2D', 'GL_COMPRESSED_LUMINANCE_ALPHA_3DC')
+ati_texture_compression_3dc['invalid formats'] = PlainExecTest(['arb_texture_compression-invalid-formats', '3dc'])
+ati_texture_compression_3dc['invalid formats'].runConcurrent = True
 
 ext_packed_float = Group()
 spec['EXT_packed_float'] = ext_packed_float
@@ -1088,6 +1105,8 @@ add_fbo_generatemipmap_extension(ext_texture_srgb, 'GL_EXT_texture_sRGB', 'fbo-g
 #add_fbo_blending_extension(ext_texture_srgb, 'GL_EXT_texture_sRGB', 'fbo-blending-formats')
 add_fbo_alphatest_extension(ext_texture_srgb, 'GL_EXT_texture_sRGB', 'fbo-alphatest-formats')
 add_fbo_generatemipmap_extension(ext_texture_srgb, 'GL_EXT_texture_sRGB-s3tc', 'fbo-generatemipmap-formats-s3tc')
+ext_texture_srgb['invalid formats'] = PlainExecTest(['arb_texture_compression-invalid-formats', 'srgb'])
+ext_texture_srgb['invalid formats'].runConcurrent = True
 
 ati_draw_buffers = Group()
 spec['ATI_draw_buffers'] = ati_draw_buffers
@@ -1131,6 +1150,11 @@ nv_conditional_render['drawpixels'] = PlainExecTest(['nv_conditional_render-draw
 nv_conditional_render['generatemipmap'] = PlainExecTest(['nv_conditional_render-generatemipmap', '-auto'])
 nv_conditional_render['vertex_array'] = PlainExecTest(['nv_conditional_render-vertex_array', '-auto'])
 
+oes_compressed_paletted_texture = Group()
+spec['OES_compressed_paletted_texture'] = oes_compressed_paletted_texture
+oes_compressed_paletted_texture['invalid formats'] = PlainExecTest(['arb_texture_compression-invalid-formats', 'paletted'])
+oes_compressed_paletted_texture['invalid formats'].runConcurrent = True
+
 # group glslparsertest ------------------------------------------------------
 glslparsertest = Group()
 # Add all shader source files in the directories below.
diff --git a/tests/spec/arb_texture_compression/CMakeLists.gl.txt b/tests/spec/arb_texture_compression/CMakeLists.gl.txt
index 7fdf00c..5a9040d 100644
--- a/tests/spec/arb_texture_compression/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_compression/CMakeLists.gl.txt
@@ -13,5 +13,6 @@ link_libraries (
 )
 
 add_executable (arb_texture_compression-internal-format-query internal-format-query.c)
+add_executable (arb_texture_compression-invalid-formats invalid-formats.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_texture_compression/invalid-formats.c b/tests/spec/arb_texture_compression/invalid-formats.c
new file mode 100644
index 0000000..741e30d
--- /dev/null
+++ b/tests/spec/arb_texture_compression/invalid-formats.c
@@ -0,0 +1,462 @@
+/*
+ * Copyright © 2011 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+/**
+ * \file internal-format-query.c
+ * Check that only general-purpose fmts are listed by COMPRESSED_TEXTURE_FORMATS
+ *
+ * From page 117 (page 129 of the PDF) of the OpenGL 1.3 spec says:
+ *
+ *     "The set of specific compressed internal formats supported by the
+ *     renderer can be obtained by querying the value of COMPRESSED TEXTURE
+ *     FORMATS. The only values returned by this query are those corresponding
+ *     to formats suitable for general-purpose usage. The renderer will not
+ *     enumerate formats with restrictions that need to be specifically
+ *     understood prior to use."
+ *
+ * All texture compression extensions have taken this to mean only linear RGB
+ * and linear RGBA formats should be exposed.
+ */
+#include "piglit-util.h"
+
+int piglit_width = 10, piglit_height = 10;
+int piglit_window_mode = GLUT_RGB;
+
+#define ENUM_AND_STRING(e) \
+	# e, e
+
+struct format_tuple {
+	const char *name;
+	GLenum format;
+};
+
+/**
+ * Set of formats for a particular extension
+ *
+ * Each array of "good" formats and "bad" formats is terminated by a sentinel
+ * with \c format set to zero.
+ *
+ * \note
+ * The arrays are sized for the largest set from any extension.  They may need
+ * to be expanded in the future.
+ */
+struct format_list {
+	/**
+	 * Formats that are part of the extension and should be exposed.
+	 */
+	struct format_tuple good[11];
+
+	/**
+	 * Formats that are part of the extension but should not be exposed.
+	 */
+	struct format_tuple bad[5];
+};
+
+/**
+ * Formats belonging to GL_ARB_texture_comrpession_bptc
+ */
+static const struct format_list bptc_formats = {
+	{
+		{ ENUM_AND_STRING(GL_COMPRESSED_RGBA_BPTC_UNORM_ARB) },
+		{ ENUM_AND_STRING(GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB) },
+		{ ENUM_AND_STRING(GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB) },
+		{ ENUM_AND_STRING(GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB) },
+		{ NULL, 0 },
+	},
+	{
+		{ NULL, 0 },
+	}
+};
+
+/**
+ * Formats belonging to GL_ARB_texture_comrpession_rgtc
+ */
+static const struct format_list rgtc_formats = {
+	{
+		{ NULL, 0 },
+	},
+	{
+		{ ENUM_AND_STRING(GL_COMPRESSED_RED_RGTC1) },
+		{ ENUM_AND_STRING(GL_COMPRESSED_SIGNED_RED_RGTC1) },
+		{ ENUM_AND_STRING(GL_COMPRESSED_RG_RGTC2) },
+		{ ENUM_AND_STRING(GL_COMPRESSED_SIGNED_RG_RGTC2) },
+		{ NULL, 0 },
+	}
+};
+
+/**
+ * Formats belonging to GL_3DFX_texture_comrpession_FXT1
+ */
+static const struct format_list fxt1_formats = {
+	{
+		{ ENUM_AND_STRING(GL_COMPRESSED_RGB_FXT1_3DFX) },
+		{ ENUM_AND_STRING(GL_COMPRESSED_RGBA_FXT1_3DFX) },
+		{ NULL, 0 },
+	},
+	{
+		{ NULL, 0 },
+	}
+};
+
+/**
+ * Formats belonging to GL_ATI_texture_comrpession_3dc
+ */
+static const struct format_list ati_3dc_formats = {
+	{
+		{ NULL, 0 },
+	},
+	{
+		{ "GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI", 0x8837 },
+		{ NULL, 0 },
+	}
+};
+
+/**
+ * Formats belonging to GL_EXT_texture_comrpession_latc
+ */
+static const struct format_list latc_formats = {
+	{
+		{ NULL, 0 },
+	},
+	{
+		{ ENUM_AND_STRING(GL_COMPRESSED_LUMINANCE_LATC1_EXT) },
+		{ ENUM_AND_STRING(GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT) },
+		{ ENUM_AND_STRING(GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT) },
+		{ ENUM_AND_STRING(GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT) },
+		{ NULL, 0 },
+	}
+};
+
+/**
+ * Formats belonging to GL_EXT_texture_comrpession_s3tc
+ */
+static const struct format_list s3tc_formats = {
+	{
+		{ ENUM_AND_STRING(GL_COMPRESSED_RGB_S3TC_DXT1_EXT) },
+		{ ENUM_AND_STRING(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT) },
+		{ ENUM_AND_STRING(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT) },
+		{ NULL, 0 },
+	},
+	{
+		{ ENUM_AND_STRING(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT) },
+		{ NULL, 0 },
+	}
+};
+
+/**
+ * Formats belonging to GL_EXT_texture_sRGB
+ *
+ * These should only be exported if GL_EXT_texture_compression_s3tc is also
+ * supported.
+ */
+static const struct format_list srgb_formats = {
+	{
+		{ NULL, 0 },
+	},
+	{
+		{ ENUM_AND_STRING(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT) },
+		{ ENUM_AND_STRING(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT) },
+		{ ENUM_AND_STRING(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT) },
+		{ ENUM_AND_STRING(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT) },
+		{ NULL, 0 },
+	}
+};
+
+/**
+ * Formats belonging to GL_OES_comrpessed_paletted_texture
+ */
+static const struct format_list paletted_formats = {
+	{
+		{ ENUM_AND_STRING(GL_PALETTE4_RGB8_OES) },
+		{ ENUM_AND_STRING(GL_PALETTE4_RGBA8_OES) },
+		{ ENUM_AND_STRING(GL_PALETTE4_R5_G6_B5_OES) },
+		{ ENUM_AND_STRING(GL_PALETTE4_RGBA4_OES) },
+		{ ENUM_AND_STRING(GL_PALETTE4_RGB5_A1_OES) },
+		{ ENUM_AND_STRING(GL_PALETTE8_RGB8_OES) },
+		{ ENUM_AND_STRING(GL_PALETTE8_RGBA8_OES) },
+		{ ENUM_AND_STRING(GL_PALETTE8_R5_G6_B5_OES) },
+		{ ENUM_AND_STRING(GL_PALETTE8_RGBA4_OES) },
+		{ ENUM_AND_STRING(GL_PALETTE8_RGB5_A1_OES) },
+		{ NULL, 0 },
+	},
+	{
+		{ NULL, 0 },
+	}
+};
+
+/**
+ * List of all known compression methods to test
+ *
+ * The dummy first element is because this list is used by \c main to replace
+ * the \c argv vector when no command line parameters are supplied.
+ */
+const char *all_formats[] = {
+	"argv[0]",
+	"bptc",
+	"s3tc",    //
+	"fxt1",    //
+	"latc",    //
+	"3dc",     //
+	"rgtc",    //
+	"srgb",    //
+	"paletted"
+};
+
+enum piglit_result
+piglit_display(void)
+{
+	return PIGLIT_FAIL;
+}
+
+static bool
+reject_bad(const struct format_tuple *bad, GLenum *compressed_formats,
+	   GLint num_compressed_formats, bool check_errors)
+{
+	bool pass = true;
+	unsigned i;
+	unsigned j;
+
+	for (i = 0; bad[i].format != 0; i++) {
+		for (j = 0; j < num_compressed_formats; j++) {
+			if (compressed_formats[j] == 0)
+				continue;
+
+			if (compressed_formats[j] == bad[i].format)
+				break;
+		}
+
+		if (j != num_compressed_formats) {
+			if (check_errors) {
+				fprintf(stderr,
+					"%s should not be available.\n",
+					bad[i].name);
+				pass = false;
+			}
+
+			/* Replace formats that have been processed with
+			 * zero.  This allows detection of values that don't
+			 * belong to any compression extension.
+			 */
+			compressed_formats[j] = 0;
+		}
+	}
+
+	return pass;
+}
+
+static bool
+try_formats(const struct format_list *t, GLenum *compressed_formats,
+	    GLint num_compressed_formats, bool check_errors, bool supported)
+{
+	bool pass = true;
+
+	if (!supported) {
+		pass = reject_bad(t->good, compressed_formats,
+				  num_compressed_formats, check_errors)
+			&& pass;
+	} else {
+		unsigned i;
+		unsigned j;
+
+		for (i = 0; t->good[i].format != 0; i++) {
+			for (j = 0; j < num_compressed_formats; j++) {
+				if (compressed_formats[j] == 0)
+					continue;
+
+				if (compressed_formats[j] == t->good[i].format)
+					break;
+			}
+
+			if (j == num_compressed_formats) {
+				if (check_errors) {
+					fprintf(stderr,
+						"%s should be available.\n",
+						t->good[i].name);
+					pass = false;
+				}
+			} else {
+				/* Replace formats that have been processed
+				 * with zero.  This allows detection of values
+				 * that don't belong to any compression
+				 * extension.
+				 */
+				compressed_formats[j] = 0;
+			}
+		}
+	}
+
+	pass = reject_bad(t->bad, compressed_formats, num_compressed_formats,
+			  check_errors)
+		&& pass;
+
+	return pass;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+	GLint num_compressed_formats;
+	GLenum *compressed_formats = NULL;
+	unsigned i;
+	bool pass = true;
+	bool log_header = true;
+	bool do_all = false;
+	bool check_errors = true;
+
+	piglit_require_extension("GL_ARB_texture_compression");
+
+	glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS,
+		      &num_compressed_formats);
+	if (num_compressed_formats == 0) {
+		printf("No compressed formats supported.\n");
+	} else {
+		compressed_formats = calloc(num_compressed_formats,
+					    sizeof(GLenum));
+		glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS,
+			      (GLint *) compressed_formats);
+
+		printf("Driver reported the following compressed formats:\n");
+		for (i = 0; i < num_compressed_formats; i++) {
+			printf("    0x%04x\n", compressed_formats[i]);
+		}
+		printf("\n");
+		fflush(stdout);
+	}
+
+	/* First scan the list of formats looking for zeros.  We use that as
+	 * magic flag later in the test.
+	 */
+	for (i = 0; i < num_compressed_formats; i++) {
+		if (compressed_formats[i] == 0) {
+			fprintf(stderr,
+				"Invalid value 0x0000 in format list.\n");
+			piglit_report_result(PIGLIT_FAIL);
+		}
+	}
+
+	/* The "unknown" flag instructs the test to just check for values that
+	 * don't belong to any compression extension supported by this
+	 * implementation.
+	 */
+	if (argc > 1 && strcmp("unknown", argv[1]) == 0) {
+		check_errors = false;
+		argv++;
+		argc--;
+	}
+
+	if (argc == 1) {
+		argv = all_formats;
+		argc = ARRAY_SIZE(all_formats);
+		do_all = true;
+	}
+
+	for (i = 1; i < argc; i++) {
+		if (strcmp(argv[i], "bptc") == 0) {
+			pass = try_formats(&bptc_formats,
+					   compressed_formats,
+					   num_compressed_formats,
+					   check_errors,
+					   GLEW_ARB_texture_compression_bptc)
+				&& pass;
+		} else if (strcmp(argv[i], "s3tc") == 0) {
+			pass = try_formats(&s3tc_formats,
+					   compressed_formats,
+					   num_compressed_formats,
+					   check_errors,
+					   GLEW_EXT_texture_compression_s3tc)
+				&& pass;
+		} else if (strcmp(argv[i], "fxt1") == 0) {
+			pass = try_formats(&fxt1_formats,
+					   compressed_formats,
+					   num_compressed_formats,
+					   check_errors,
+					   GLEW_3DFX_texture_compression_FXT1)
+				&& pass;
+		} else if (strcmp(argv[i], "latc") == 0) {
+			pass = try_formats(&latc_formats,
+					   compressed_formats,
+					   num_compressed_formats,
+					   check_errors,
+					   GLEW_EXT_texture_compression_latc)
+				&& pass;
+		} else if (strcmp(argv[i], "3dc") == 0) {
+			pass = try_formats(&ati_3dc_formats,
+					   compressed_formats,
+					   num_compressed_formats,
+					   check_errors,
+					   GLEW_ATI_texture_compression_3dc)
+				&& pass;
+		} else if (strcmp(argv[i], "rgtc") == 0) {
+			pass = try_formats(&rgtc_formats,
+					   compressed_formats,
+					   num_compressed_formats,
+					   check_errors,
+					   (GLEW_ARB_texture_compression_rgtc
+					    || GLEW_EXT_texture_compression_rgtc))
+				&& pass;
+		} else if (strcmp(argv[i], "srgb") == 0) {
+			pass = try_formats(&srgb_formats,
+					   compressed_formats,
+					   num_compressed_formats,
+					   check_errors,
+					   (GLEW_EXT_texture_sRGB
+					    && GLEW_EXT_texture_compression_s3tc))
+				&& pass;
+		} else if (strcmp(argv[i], "paletted") == 0) {
+			pass = try_formats(&paletted_formats,
+					   compressed_formats,
+					   num_compressed_formats,
+					   check_errors,
+					   GLEW_OES_compressed_paletted_texture)
+				&& pass;
+		} else {
+			fprintf(stderr,
+				"Unrecognized selection `%s'\n", argv[i]);
+			piglit_report_result(PIGLIT_FAIL);
+		}
+	}
+
+	/* After all of the known formats have been processed, the entire
+	 * format array should be zeroed out.  Any non-zero values are either
+	 * errors or formats from unknown extensions... meaning that the test
+	 * may need to be updated.
+	 */
+	if (do_all) {
+		for (i = 0; i < num_compressed_formats; i++) {
+			if (compressed_formats[i] != 0) {
+				if (log_header) {
+					fprintf(stderr,
+						"Unrecognized compressed "
+						"texture formats:\n");
+					log_header = false;
+				}
+
+				fprintf(stderr, "    0x%04x\n",
+					compressed_formats[i]);
+				pass = false;
+			}
+		}
+	}
+
+	piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
-- 
1.7.4.4



More information about the Piglit mailing list