[Piglit] [PATCH 1/4] arb_internalformat_query2: minmax GL_ALPHA8 deprecated on 3.1+

Alejandro PiƱeiro apinheiro at igalia.com
Fri Oct 27 09:24:13 UTC 2017


---
 tests/spec/arb_internalformat_query2/minmax.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/tests/spec/arb_internalformat_query2/minmax.c b/tests/spec/arb_internalformat_query2/minmax.c
index a2cf059928..fde03c1bd5 100644
--- a/tests/spec/arb_internalformat_query2/minmax.c
+++ b/tests/spec/arb_internalformat_query2/minmax.c
@@ -46,6 +46,9 @@ PIGLIT_GL_TEST_CONFIG_END
 
 /* These are all the formats that are required to be color-renderable
  * by the OpenGL 3.0 spec.
+ *
+ * But note that GL_ALPHA8 was removed on 3.1 and beyond, so we need
+ * to take that into account.
  */
 static const GLenum valid_formats[] = {
         GL_RGBA32F,
@@ -283,6 +286,7 @@ piglit_init(int argc, char **argv)
         const bool tms_supported =
                 piglit_is_extension_supported("GL_ARB_texture_multisample");
         GLint max_samples;
+        GLint valid_formats_size = ARRAY_SIZE(valid_formats);
 
         piglit_require_extension("GL_ARB_framebuffer_object");
         piglit_require_extension("GL_ARB_internalformat_query2");
@@ -293,8 +297,14 @@ piglit_init(int argc, char **argv)
                 piglit_require_extension("GL_ARB_texture_float");
         }
 
+        /* GL_ALPHA8 was removed on OpenGL 3.1, so on that case we
+         * skip that format
+         */
+        if (piglit_get_gl_version() >= 31)
+                valid_formats_size = valid_formats_size - 1;
+
         glGetIntegerv(GL_MAX_SAMPLES, &max_samples);
-        for (i = 0; i < ARRAY_SIZE(valid_formats); i++) {
+        for (i = 0; i < valid_formats_size; i++) {
                 pass = try(GL_RENDERBUFFER,
                            valid_formats[i],
                            max_samples,
@@ -345,7 +355,7 @@ piglit_init(int argc, char **argv)
                                 max_samples_name = "GL_MAX_COLOR_TEXTURE_SAMPLES";
                         }
 
-                        for (j = 0; j < ARRAY_SIZE(valid_formats); j++) {
+                        for (j = 0; j < valid_formats_size; j++) {
                                 pass = try(valid_targets_with_tms[i],
                                            valid_formats[j],
                                            max_samples,
-- 
2.11.0



More information about the Piglit mailing list