[Piglit] [PATCH] fbo-formats: Remove GLenum stringification macros.
Fabian Bieler
fabianbieler at fastmail.fm
Sat Dec 30 00:16:04 UTC 2017
Replace GLenum stringification macros with calls to piglit_get_gl_enum_name.
V2: Make sure GL 1.0 legacy internal formats '3' and '4' are logged
correctly.
---
tests/fbo/fbo-alphatest-formats.c | 9 +-
tests/fbo/fbo-blending-formats.c | 9 +-
tests/fbo/fbo-clear-formats.c | 7 +-
tests/fbo/fbo-colormask-formats.c | 7 +-
tests/fbo/fbo-formats.h | 398 +++++++++++----------
tests/fbo/fbo-generatemipmap-formats.c | 5 +-
.../gettextureimage-formats.c | 5 +-
.../get-renderbuffer-internalformat.c | 2 +-
.../spec/ext_framebuffer_multisample/fast-clear.c | 10 +-
tests/spec/ext_framebuffer_multisample/formats.cpp | 2 +-
tests/texturing/getteximage-formats.c | 5 +-
11 files changed, 240 insertions(+), 219 deletions(-)
diff --git a/tests/fbo/fbo-alphatest-formats.c b/tests/fbo/fbo-alphatest-formats.c
index 75b4e110f..2a6f0e2f1 100644
--- a/tests/fbo/fbo-alphatest-formats.c
+++ b/tests/fbo/fbo-alphatest-formats.c
@@ -68,6 +68,7 @@ static enum piglit_result test_format(const struct format_desc *format)
GLuint tex, fb;
GLenum status;
int r, g, b, l, a, i;
+ const char *name = get_format_name(format->internalformat);
float cpass[] = {1, 1, 1, 1};
float cfail[] = {0, 0, 0, 0};
@@ -184,11 +185,11 @@ static enum piglit_result test_format(const struct format_desc *format)
piglit_report_result(PIGLIT_FAIL);
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
- printf("Testing %s", format->name);
+ printf("Testing %s", name);
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
printf("- fbo incomplete (status = %s)\n",
piglit_get_gl_enum_name(status));
- piglit_report_subtest_result(PIGLIT_SKIP, "%s", format->name);
+ piglit_report_subtest_result(PIGLIT_SKIP, "%s", name);
return PIGLIT_SKIP;
}
printf("\n");
@@ -262,7 +263,7 @@ static enum piglit_result test_format(const struct format_desc *format)
if (!pass) {
piglit_present_results();
- piglit_report_subtest_result(PIGLIT_FAIL, "%s", format->name);
+ piglit_report_subtest_result(PIGLIT_FAIL, "%s", name);
return PIGLIT_FAIL;
}
@@ -324,7 +325,7 @@ static enum piglit_result test_format(const struct format_desc *format)
piglit_present_results();
piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
- "%s", format->name);
+ "%s", name);
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
diff --git a/tests/fbo/fbo-blending-formats.c b/tests/fbo/fbo-blending-formats.c
index 1e9fbbb97..7841c01ce 100644
--- a/tests/fbo/fbo-blending-formats.c
+++ b/tests/fbo/fbo-blending-formats.c
@@ -91,6 +91,7 @@ static enum piglit_result test_format(const struct format_desc *format)
GLuint tex, fb;
GLenum status;
int r, g, b, l, a, i;
+ const char *name = get_format_name(format->internalformat);
float res0[] = {0.3, 0.3, 0.3, 0.0};
@@ -292,11 +293,11 @@ static enum piglit_result test_format(const struct format_desc *format)
piglit_report_result(PIGLIT_FAIL);
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
- printf("Testing %s", format->name);
+ printf("Testing %s", name);
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
printf(" - fbo incomplete (status = %s)\n",
piglit_get_gl_enum_name(status));
- piglit_report_subtest_result(PIGLIT_SKIP, "%s", format->name);
+ piglit_report_subtest_result(PIGLIT_SKIP, "%s", name);
return PIGLIT_SKIP;
}
printf("\n");
@@ -358,7 +359,7 @@ static enum piglit_result test_format(const struct format_desc *format)
if (!pass) {
piglit_present_results();
- piglit_report_subtest_result(PIGLIT_FAIL, "%s", format->name);
+ piglit_report_subtest_result(PIGLIT_FAIL, "%s", name);
return PIGLIT_FAIL;
}
@@ -411,7 +412,7 @@ static enum piglit_result test_format(const struct format_desc *format)
piglit_present_results();
piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
- "%s", format->name);
+ "%s", name);
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
diff --git a/tests/fbo/fbo-clear-formats.c b/tests/fbo/fbo-clear-formats.c
index bbf83af73..b3c7c4913 100644
--- a/tests/fbo/fbo-clear-formats.c
+++ b/tests/fbo/fbo-clear-formats.c
@@ -522,8 +522,9 @@ test_format(const struct format_desc *format)
int x;
int level;
GLboolean pass = GL_TRUE;
+ const char *name = get_format_name(format->internalformat);
- printf("Testing %s", format->name);
+ printf("Testing %s", name);
if (format->base_internal_format == GL_STENCIL_INDEX)
clear_stencil = true;
@@ -539,7 +540,7 @@ test_format(const struct format_desc *format)
printf(" - FBO incomplete\n");
piglit_report_subtest_result(PIGLIT_SKIP,
"%s (fbo incomplete)",
- format->name);
+ name);
return PIGLIT_SKIP;
}
printf("\n");
@@ -578,7 +579,7 @@ test_format(const struct format_desc *format)
glDeleteTextures(1, &tex);
piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
- "%s", format->name);
+ "%s", name);
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
diff --git a/tests/fbo/fbo-colormask-formats.c b/tests/fbo/fbo-colormask-formats.c
index 788660292..a49bff379 100644
--- a/tests/fbo/fbo-colormask-formats.c
+++ b/tests/fbo/fbo-colormask-formats.c
@@ -58,6 +58,7 @@ static enum piglit_result test_format(const struct format_desc *format)
int r, g, b, l, a, i;
unsigned mask, k;
float defaults[] = {-1, -1, -1, -1};
+ const char *name = get_format_name(format->internalformat);
if (format->base_internal_format == GL_DEPTH_COMPONENT ||
format->base_internal_format == GL_DEPTH_STENCIL ||
@@ -151,13 +152,13 @@ static enum piglit_result test_format(const struct format_desc *format)
piglit_report_result(PIGLIT_FAIL);
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
- printf("Testing %s", format->name);
+ printf("Testing %s", name);
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
printf(" - fbo incomplete (status = %s)\n",
piglit_get_gl_enum_name(status));
piglit_report_subtest_result(PIGLIT_SKIP,
"%s (fbo incomplete)",
- format->name);
+ name);
return PIGLIT_SKIP;
}
printf("\n");
@@ -222,7 +223,7 @@ static enum piglit_result test_format(const struct format_desc *format)
piglit_present_results();
piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
- "%s", format->name);
+ "%s", name);
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
diff --git a/tests/fbo/fbo-formats.h b/tests/fbo/fbo-formats.h
index 579b5c30d..0b5dd6a82 100644
--- a/tests/fbo/fbo-formats.h
+++ b/tests/fbo/fbo-formats.h
@@ -28,7 +28,6 @@
struct format_desc {
GLenum internalformat;
- const char *name;
/**
* Base internal format corresponding to internalformat. See
@@ -50,276 +49,275 @@ struct format_desc {
unsigned min_bits;
};
-#define FORMAT(f, base_internal_format, min_bits) { f, #f, base_internal_format, min_bits }
static const struct format_desc core[] = {
- FORMAT(3, GL_RGB, 0),
- FORMAT(4, GL_RGBA, 0),
- FORMAT(GL_RGB, GL_RGB, 0),
- FORMAT(GL_RGBA, GL_RGBA, 0),
- FORMAT(GL_ALPHA, GL_ALPHA, 0),
- FORMAT(GL_LUMINANCE, GL_LUMINANCE, 0),
- FORMAT(GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, 0),
- FORMAT(GL_INTENSITY, GL_INTENSITY, 0),
-
- FORMAT(GL_ALPHA4, GL_ALPHA, 4),
- FORMAT(GL_ALPHA8, GL_ALPHA, 8),
- FORMAT(GL_ALPHA12, GL_ALPHA, 12),
- FORMAT(GL_ALPHA16, GL_ALPHA, 16),
-
- FORMAT(GL_LUMINANCE4, GL_LUMINANCE, 4),
- FORMAT(GL_LUMINANCE8, GL_LUMINANCE, 8),
- FORMAT(GL_LUMINANCE12, GL_LUMINANCE, 12),
- FORMAT(GL_LUMINANCE16, GL_LUMINANCE, 16),
-
- FORMAT(GL_LUMINANCE4_ALPHA4, GL_LUMINANCE_ALPHA, 4),
- FORMAT(GL_LUMINANCE8_ALPHA8, GL_LUMINANCE_ALPHA, 8),
- FORMAT(GL_LUMINANCE12_ALPHA12, GL_LUMINANCE_ALPHA, 12),
- FORMAT(GL_LUMINANCE16_ALPHA16, GL_LUMINANCE_ALPHA, 16),
-
- FORMAT(GL_INTENSITY4, GL_INTENSITY, 4),
- FORMAT(GL_INTENSITY8, GL_INTENSITY, 8),
- FORMAT(GL_INTENSITY12, GL_INTENSITY, 12),
- FORMAT(GL_INTENSITY16, GL_INTENSITY, 16),
-
- FORMAT(GL_R3_G3_B2, GL_RGB, 2),
- FORMAT(GL_RGB4, GL_RGB, 4),
- FORMAT(GL_RGB5, GL_RGB, 5),
- FORMAT(GL_RGB8, GL_RGB, 8),
- FORMAT(GL_RGB10, GL_RGB, 10),
- FORMAT(GL_RGB12, GL_RGB, 12),
- FORMAT(GL_RGB16, GL_RGB, 16),
-
- FORMAT(GL_RGBA2, GL_RGBA, 2),
- FORMAT(GL_RGBA4, GL_RGBA, 4),
- FORMAT(GL_RGB5_A1, GL_RGBA, 1),
- FORMAT(GL_RGBA8, GL_RGBA, 8),
- FORMAT(GL_RGB10_A2, GL_RGBA, 2),
- FORMAT(GL_RGBA12, GL_RGBA, 12),
- FORMAT(GL_RGBA16, GL_RGBA, 16),
+ { 3, GL_RGB, 0 },
+ { 4, GL_RGBA, 0 },
+ { GL_RGB, GL_RGB, 0 },
+ { GL_RGBA, GL_RGBA, 0 },
+ { GL_ALPHA, GL_ALPHA, 0 },
+ { GL_LUMINANCE, GL_LUMINANCE, 0 },
+ { GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, 0 },
+ { GL_INTENSITY, GL_INTENSITY, 0 },
+
+ { GL_ALPHA4, GL_ALPHA, 4 },
+ { GL_ALPHA8, GL_ALPHA, 8 },
+ { GL_ALPHA12, GL_ALPHA, 12 },
+ { GL_ALPHA16, GL_ALPHA, 16 },
+
+ { GL_LUMINANCE4, GL_LUMINANCE, 4 },
+ { GL_LUMINANCE8, GL_LUMINANCE, 8 },
+ { GL_LUMINANCE12, GL_LUMINANCE, 12 },
+ { GL_LUMINANCE16, GL_LUMINANCE, 16 },
+
+ { GL_LUMINANCE4_ALPHA4, GL_LUMINANCE_ALPHA, 4 },
+ { GL_LUMINANCE8_ALPHA8, GL_LUMINANCE_ALPHA, 8 },
+ { GL_LUMINANCE12_ALPHA12, GL_LUMINANCE_ALPHA, 12 },
+ { GL_LUMINANCE16_ALPHA16, GL_LUMINANCE_ALPHA, 16 },
+
+ { GL_INTENSITY4, GL_INTENSITY, 4 },
+ { GL_INTENSITY8, GL_INTENSITY, 8 },
+ { GL_INTENSITY12, GL_INTENSITY, 12 },
+ { GL_INTENSITY16, GL_INTENSITY, 16 },
+
+ { GL_R3_G3_B2, GL_RGB, 2 },
+ { GL_RGB4, GL_RGB, 4 },
+ { GL_RGB5, GL_RGB, 5 },
+ { GL_RGB8, GL_RGB, 8 },
+ { GL_RGB10, GL_RGB, 10 },
+ { GL_RGB12, GL_RGB, 12 },
+ { GL_RGB16, GL_RGB, 16 },
+
+ { GL_RGBA2, GL_RGBA, 2 },
+ { GL_RGBA4, GL_RGBA, 4 },
+ { GL_RGB5_A1, GL_RGBA, 1 },
+ { GL_RGBA8, GL_RGBA, 8 },
+ { GL_RGB10_A2, GL_RGBA, 2 },
+ { GL_RGBA12, GL_RGBA, 12 },
+ { GL_RGBA16, GL_RGBA, 16 },
};
static const struct format_desc arb_depth_texture[] = {
- FORMAT(GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, 0),
- FORMAT(GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, 16),
- FORMAT(GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT, 24),
- FORMAT(GL_DEPTH_COMPONENT32, GL_DEPTH_COMPONENT, 32),
+ { GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, 0 },
+ { GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, 16 },
+ { GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT, 24 },
+ { GL_DEPTH_COMPONENT32, GL_DEPTH_COMPONENT, 32 },
};
static const struct format_desc ext_packed_depth_stencil[] = {
- FORMAT(GL_DEPTH_STENCIL_EXT, GL_DEPTH_STENCIL, 0),
- FORMAT(GL_DEPTH24_STENCIL8_EXT, GL_DEPTH_STENCIL, 24),
+ { GL_DEPTH_STENCIL_EXT, GL_DEPTH_STENCIL, 0 },
+ { GL_DEPTH24_STENCIL8_EXT, GL_DEPTH_STENCIL, 24 },
};
static const struct format_desc ext_texture_srgb[] = {
- FORMAT(GL_SRGB_EXT, GL_RGB, 0),
- FORMAT(GL_SRGB8_EXT, GL_RGB, 8),
- FORMAT(GL_SRGB_ALPHA_EXT, GL_RGBA, 0),
- FORMAT(GL_SRGB8_ALPHA8_EXT, GL_RGBA, 8),
- FORMAT(GL_SLUMINANCE_ALPHA_EXT, GL_LUMINANCE_ALPHA, 0),
- FORMAT(GL_SLUMINANCE8_ALPHA8_EXT, GL_LUMINANCE_ALPHA, 8),
- FORMAT(GL_SLUMINANCE_EXT, GL_LUMINANCE, 0),
- FORMAT(GL_SLUMINANCE8_EXT, GL_LUMINANCE, 8),
+ { GL_SRGB_EXT, GL_RGB, 0 },
+ { GL_SRGB8_EXT, GL_RGB, 8 },
+ { GL_SRGB_ALPHA_EXT, GL_RGBA, 0 },
+ { GL_SRGB8_ALPHA8_EXT, GL_RGBA, 8 },
+ { GL_SLUMINANCE_ALPHA_EXT, GL_LUMINANCE_ALPHA, 0 },
+ { GL_SLUMINANCE8_ALPHA8_EXT, GL_LUMINANCE_ALPHA, 8 },
+ { GL_SLUMINANCE_EXT, GL_LUMINANCE, 0 },
+ { GL_SLUMINANCE8_EXT, GL_LUMINANCE, 8 },
};
static const struct format_desc ext_texture_srgb_compressed[] = {
- FORMAT(GL_COMPRESSED_SRGB_EXT, GL_RGB, 0),
- FORMAT(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT, GL_RGB, 0),
- FORMAT(GL_COMPRESSED_SRGB_ALPHA_EXT, GL_RGBA, 0),
- FORMAT(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, GL_RGBA, 0),
- FORMAT(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, GL_RGBA, 0),
- FORMAT(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, GL_RGBA, 0),
- FORMAT(GL_COMPRESSED_SLUMINANCE_ALPHA_EXT, GL_LUMINANCE_ALPHA, 0),
- FORMAT(GL_COMPRESSED_SLUMINANCE_EXT, GL_LUMINANCE, 0),
+ { GL_COMPRESSED_SRGB_EXT, GL_RGB, 0 },
+ { GL_COMPRESSED_SRGB_S3TC_DXT1_EXT, GL_RGB, 0 },
+ { GL_COMPRESSED_SRGB_ALPHA_EXT, GL_RGBA, 0 },
+ { GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, GL_RGBA, 0 },
+ { GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, GL_RGBA, 0 },
+ { GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, GL_RGBA, 0 },
+ { GL_COMPRESSED_SLUMINANCE_ALPHA_EXT, GL_LUMINANCE_ALPHA, 0 },
+ { GL_COMPRESSED_SLUMINANCE_EXT, GL_LUMINANCE, 0 },
};
static const struct format_desc ext_texture_compression[] = {
- FORMAT(GL_COMPRESSED_ALPHA, GL_ALPHA, 0),
- FORMAT(GL_COMPRESSED_LUMINANCE, GL_LUMINANCE, 0),
- FORMAT(GL_COMPRESSED_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, 0),
- FORMAT(GL_COMPRESSED_INTENSITY, GL_INTENSITY, 0),
- FORMAT(GL_COMPRESSED_RGB, GL_RGB, 0),
- FORMAT(GL_COMPRESSED_RGBA, GL_RGBA, 0),
+ { GL_COMPRESSED_ALPHA, GL_ALPHA, 0 },
+ { GL_COMPRESSED_LUMINANCE, GL_LUMINANCE, 0 },
+ { GL_COMPRESSED_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, 0 },
+ { GL_COMPRESSED_INTENSITY, GL_INTENSITY, 0 },
+ { GL_COMPRESSED_RGB, GL_RGB, 0 },
+ { GL_COMPRESSED_RGBA, GL_RGBA, 0 },
};
static const struct format_desc tdfx_texture_compression_fxt1[] = {
- FORMAT(GL_COMPRESSED_RGB_FXT1_3DFX, GL_RGB, 0),
- FORMAT(GL_COMPRESSED_RGBA_FXT1_3DFX, GL_RGBA, 0),
+ { GL_COMPRESSED_RGB_FXT1_3DFX, GL_RGB, 0 },
+ { GL_COMPRESSED_RGBA_FXT1_3DFX, GL_RGBA, 0 },
};
static const struct format_desc ext_texture_compression_s3tc[] = {
- FORMAT(GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_RGB, 0),
- FORMAT(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, GL_RGBA, 0),
- FORMAT(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, GL_RGBA, 0),
- FORMAT(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, GL_RGBA, 0),
+ { GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_RGB, 0 },
+ { GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, GL_RGBA, 0 },
+ { GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, GL_RGBA, 0 },
+ { GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, GL_RGBA, 0 },
};
static const struct format_desc ext_texture_integer[] = {
- FORMAT(GL_RGBA8UI_EXT, GL_RGBA, 8),
- FORMAT(GL_RGBA16UI_EXT, GL_RGBA, 16),
- FORMAT(GL_RGBA32UI_EXT, GL_RGBA, 32),
- FORMAT(GL_RGBA8I_EXT, GL_RGBA, 8),
- FORMAT(GL_RGBA16I_EXT, GL_RGBA, 16),
- FORMAT(GL_RGBA32I_EXT, GL_RGBA, 32),
- FORMAT(GL_RGB8UI_EXT, GL_RGB, 8),
- FORMAT(GL_RGB16UI_EXT, GL_RGB, 16),
- FORMAT(GL_RGB32UI_EXT, GL_RGB, 32),
- FORMAT(GL_RGB8I_EXT, GL_RGB, 8),
- FORMAT(GL_RGB16I_EXT, GL_RGB, 16),
- FORMAT(GL_RGB32I_EXT, GL_RGB, 32),
- FORMAT(GL_ALPHA8UI_EXT, GL_ALPHA, 8),
- FORMAT(GL_ALPHA16UI_EXT, GL_ALPHA, 16),
- FORMAT(GL_ALPHA32UI_EXT, GL_ALPHA, 32),
- FORMAT(GL_ALPHA8I_EXT, GL_ALPHA, 8),
- FORMAT(GL_ALPHA16I_EXT, GL_ALPHA, 16),
- FORMAT(GL_ALPHA32I_EXT, GL_ALPHA, 32),
- FORMAT(GL_INTENSITY8UI_EXT, GL_INTENSITY, 8),
- FORMAT(GL_INTENSITY16UI_EXT, GL_INTENSITY, 16),
- FORMAT(GL_INTENSITY32UI_EXT, GL_INTENSITY, 32),
- FORMAT(GL_INTENSITY8I_EXT, GL_INTENSITY, 8),
- FORMAT(GL_INTENSITY16I_EXT, GL_INTENSITY, 16),
- FORMAT(GL_INTENSITY32I_EXT, GL_INTENSITY, 32),
- FORMAT(GL_LUMINANCE8UI_EXT, GL_LUMINANCE, 8),
- FORMAT(GL_LUMINANCE16UI_EXT, GL_LUMINANCE, 16),
- FORMAT(GL_LUMINANCE32UI_EXT, GL_LUMINANCE, 32),
- FORMAT(GL_LUMINANCE8I_EXT, GL_LUMINANCE, 8),
- FORMAT(GL_LUMINANCE16I_EXT, GL_LUMINANCE, 16),
- FORMAT(GL_LUMINANCE32I_EXT, GL_LUMINANCE, 32),
- FORMAT(GL_LUMINANCE_ALPHA8UI_EXT, GL_LUMINANCE_ALPHA, 8),
- FORMAT(GL_LUMINANCE_ALPHA16UI_EXT, GL_LUMINANCE_ALPHA, 16),
- FORMAT(GL_LUMINANCE_ALPHA32UI_EXT, GL_LUMINANCE_ALPHA, 32),
- FORMAT(GL_LUMINANCE_ALPHA8I_EXT, GL_LUMINANCE_ALPHA, 8),
- FORMAT(GL_LUMINANCE_ALPHA16I_EXT, GL_LUMINANCE_ALPHA, 16),
- FORMAT(GL_LUMINANCE_ALPHA32I_EXT, GL_LUMINANCE_ALPHA, 32),
+ { GL_RGBA8UI_EXT, GL_RGBA, 8 },
+ { GL_RGBA16UI_EXT, GL_RGBA, 16 },
+ { GL_RGBA32UI_EXT, GL_RGBA, 32 },
+ { GL_RGBA8I_EXT, GL_RGBA, 8 },
+ { GL_RGBA16I_EXT, GL_RGBA, 16 },
+ { GL_RGBA32I_EXT, GL_RGBA, 32 },
+ { GL_RGB8UI_EXT, GL_RGB, 8 },
+ { GL_RGB16UI_EXT, GL_RGB, 16 },
+ { GL_RGB32UI_EXT, GL_RGB, 32 },
+ { GL_RGB8I_EXT, GL_RGB, 8 },
+ { GL_RGB16I_EXT, GL_RGB, 16 },
+ { GL_RGB32I_EXT, GL_RGB, 32 },
+ { GL_ALPHA8UI_EXT, GL_ALPHA, 8 },
+ { GL_ALPHA16UI_EXT, GL_ALPHA, 16 },
+ { GL_ALPHA32UI_EXT, GL_ALPHA, 32 },
+ { GL_ALPHA8I_EXT, GL_ALPHA, 8 },
+ { GL_ALPHA16I_EXT, GL_ALPHA, 16 },
+ { GL_ALPHA32I_EXT, GL_ALPHA, 32 },
+ { GL_INTENSITY8UI_EXT, GL_INTENSITY, 8 },
+ { GL_INTENSITY16UI_EXT, GL_INTENSITY, 16 },
+ { GL_INTENSITY32UI_EXT, GL_INTENSITY, 32 },
+ { GL_INTENSITY8I_EXT, GL_INTENSITY, 8 },
+ { GL_INTENSITY16I_EXT, GL_INTENSITY, 16 },
+ { GL_INTENSITY32I_EXT, GL_INTENSITY, 32 },
+ { GL_LUMINANCE8UI_EXT, GL_LUMINANCE, 8 },
+ { GL_LUMINANCE16UI_EXT, GL_LUMINANCE, 16 },
+ { GL_LUMINANCE32UI_EXT, GL_LUMINANCE, 32 },
+ { GL_LUMINANCE8I_EXT, GL_LUMINANCE, 8 },
+ { GL_LUMINANCE16I_EXT, GL_LUMINANCE, 16 },
+ { GL_LUMINANCE32I_EXT, GL_LUMINANCE, 32 },
+ { GL_LUMINANCE_ALPHA8UI_EXT, GL_LUMINANCE_ALPHA, 8 },
+ { GL_LUMINANCE_ALPHA16UI_EXT, GL_LUMINANCE_ALPHA, 16 },
+ { GL_LUMINANCE_ALPHA32UI_EXT, GL_LUMINANCE_ALPHA, 32 },
+ { GL_LUMINANCE_ALPHA8I_EXT, GL_LUMINANCE_ALPHA, 8 },
+ { GL_LUMINANCE_ALPHA16I_EXT, GL_LUMINANCE_ALPHA, 16 },
+ { GL_LUMINANCE_ALPHA32I_EXT, GL_LUMINANCE_ALPHA, 32 },
};
static const struct format_desc arb_texture_rg[] = {
- FORMAT(GL_R8, GL_RED, 8),
- FORMAT(GL_R16, GL_RED, 16),
- FORMAT(GL_RG, GL_RG, 0),
- FORMAT(GL_RG8, GL_RG, 8),
- FORMAT(GL_RG16, GL_RG, 16),
+ { GL_R8, GL_RED, 8 },
+ { GL_R16, GL_RED, 16 },
+ { GL_RG, GL_RG, 0 },
+ { GL_RG8, GL_RG, 8 },
+ { GL_RG16, GL_RG, 16 },
};
static const struct format_desc arb_texture_rg_int[] = {
- FORMAT(GL_R8I, GL_RED, 8),
- FORMAT(GL_R8UI, GL_RED, 8),
- FORMAT(GL_R16I, GL_RED, 16),
- FORMAT(GL_R16UI, GL_RED, 16),
- FORMAT(GL_R32I, GL_RED, 32),
- FORMAT(GL_R32UI, GL_RED, 32),
- FORMAT(GL_RG_INTEGER, GL_RG, 0),
- FORMAT(GL_RG8I, GL_RG, 8),
- FORMAT(GL_RG8UI, GL_RG, 8),
- FORMAT(GL_RG16I, GL_RG, 16),
- FORMAT(GL_RG16UI, GL_RG, 16),
- FORMAT(GL_RG32I, GL_RG, 32),
- FORMAT(GL_RG32UI, GL_RG, 32),
+ { GL_R8I, GL_RED, 8 },
+ { GL_R8UI, GL_RED, 8 },
+ { GL_R16I, GL_RED, 16 },
+ { GL_R16UI, GL_RED, 16 },
+ { GL_R32I, GL_RED, 32 },
+ { GL_R32UI, GL_RED, 32 },
+ { GL_RG_INTEGER, GL_RG, 0 },
+ { GL_RG8I, GL_RG, 8 },
+ { GL_RG8UI, GL_RG, 8 },
+ { GL_RG16I, GL_RG, 16 },
+ { GL_RG16UI, GL_RG, 16 },
+ { GL_RG32I, GL_RG, 32 },
+ { GL_RG32UI, GL_RG, 32 },
};
static const struct format_desc arb_texture_rg_float[] = {
- FORMAT(GL_R16F, GL_RED, 16),
- FORMAT(GL_R32F, GL_RED, 32),
- FORMAT(GL_RG16F, GL_RG, 16),
- FORMAT(GL_RG32F, GL_RG, 32),
+ { GL_R16F, GL_RED, 16 },
+ { GL_R32F, GL_RED, 32 },
+ { GL_RG16F, GL_RG, 16 },
+ { GL_RG32F, GL_RG, 32 },
};
static const struct format_desc ext_texture_shared_exponent[] = {
- FORMAT(GL_RGB9_E5_EXT, GL_RGB, 9),
+ { GL_RGB9_E5_EXT, GL_RGB, 9 },
};
static const struct format_desc ext_packed_float[] = {
- FORMAT(GL_R11F_G11F_B10F_EXT, GL_RGB, 10),
+ { GL_R11F_G11F_B10F_EXT, GL_RGB, 10 },
};
static const struct format_desc arb_depth_buffer_float[] = {
- FORMAT(GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, 32),
- FORMAT(GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL, 32),
+ { GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, 32 },
+ { GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL, 32 },
};
static const struct format_desc ext_texture_compression_rgtc[] = {
- FORMAT(GL_COMPRESSED_RED, GL_RED, 0),
- FORMAT(GL_COMPRESSED_RED_RGTC1_EXT, GL_RED, 0),
- FORMAT(GL_COMPRESSED_RG, GL_RG, 0),
- FORMAT(GL_COMPRESSED_RED_GREEN_RGTC2_EXT, GL_RG, 0),
+ { GL_COMPRESSED_RED, GL_RED, 0 },
+ { GL_COMPRESSED_RED_RGTC1_EXT, GL_RED, 0 },
+ { GL_COMPRESSED_RG, GL_RG, 0 },
+ { GL_COMPRESSED_RED_GREEN_RGTC2_EXT, GL_RG, 0 },
};
static const struct format_desc ext_texture_compression_rgtc_signed[] = {
- FORMAT(GL_COMPRESSED_SIGNED_RED_RGTC1_EXT, GL_RED, 0),
- FORMAT(GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT, GL_RG, 0),
+ { GL_COMPRESSED_SIGNED_RED_RGTC1_EXT, GL_RED, 0 },
+ { GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT, GL_RG, 0 },
};
static const struct format_desc arb_texture_float[] = {
- FORMAT(GL_RGB16F_ARB, GL_RGB, 16),
- FORMAT(GL_RGBA16F_ARB, GL_RGBA, 16),
- FORMAT(GL_ALPHA16F_ARB, GL_ALPHA, 16),
- FORMAT(GL_LUMINANCE16F_ARB, GL_LUMINANCE, 16),
- FORMAT(GL_LUMINANCE_ALPHA16F_ARB, GL_LUMINANCE_ALPHA, 16),
- FORMAT(GL_INTENSITY16F_ARB, GL_INTENSITY, 16),
- FORMAT(GL_RGB32F_ARB, GL_RGB, 32),
- FORMAT(GL_RGBA32F_ARB, GL_RGBA, 32),
- FORMAT(GL_ALPHA32F_ARB, GL_ALPHA, 32),
- FORMAT(GL_LUMINANCE32F_ARB, GL_LUMINANCE, 32),
- FORMAT(GL_LUMINANCE_ALPHA32F_ARB, GL_LUMINANCE_ALPHA, 32),
- FORMAT(GL_INTENSITY32F_ARB, GL_INTENSITY, 32)
+ { GL_RGB16F_ARB, GL_RGB, 16 },
+ { GL_RGBA16F_ARB, GL_RGBA, 16 },
+ { GL_ALPHA16F_ARB, GL_ALPHA, 16 },
+ { GL_LUMINANCE16F_ARB, GL_LUMINANCE, 16 },
+ { GL_LUMINANCE_ALPHA16F_ARB, GL_LUMINANCE_ALPHA, 16 },
+ { GL_INTENSITY16F_ARB, GL_INTENSITY, 16 },
+ { GL_RGB32F_ARB, GL_RGB, 32 },
+ { GL_RGBA32F_ARB, GL_RGBA, 32 },
+ { GL_ALPHA32F_ARB, GL_ALPHA, 32 },
+ { GL_LUMINANCE32F_ARB, GL_LUMINANCE, 32 },
+ { GL_LUMINANCE_ALPHA32F_ARB, GL_LUMINANCE_ALPHA, 32 },
+ { GL_INTENSITY32F_ARB, GL_INTENSITY, 32 }
};
static const struct format_desc ati_texture_compression_3dc[] = {
- FORMAT(GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI, GL_LUMINANCE_ALPHA, 0)
+ { GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI, GL_LUMINANCE_ALPHA, 0 }
};
static const struct format_desc ext_texture_compression_latc[] = {
- FORMAT(GL_COMPRESSED_LUMINANCE_LATC1_EXT, GL_LUMINANCE, 0),
- FORMAT(GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT, GL_LUMINANCE_ALPHA, 0),
+ { GL_COMPRESSED_LUMINANCE_LATC1_EXT, GL_LUMINANCE, 0 },
+ { GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT, GL_LUMINANCE_ALPHA, 0 },
};
static const struct format_desc ext_texture_compression_latc_signed[] = {
- FORMAT(GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT, GL_LUMINANCE, 0),
- FORMAT(GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT, GL_LUMINANCE_ALPHA, 0)
+ { GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT, GL_LUMINANCE, 0 },
+ { GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT, GL_LUMINANCE_ALPHA, 0 }
};
static const struct format_desc ext_texture_snorm[] = {
- FORMAT(GL_RED_SNORM, GL_RED, 0),
- FORMAT(GL_R8_SNORM, GL_RED, 8),
- FORMAT(GL_RG_SNORM, GL_RG, 0),
- FORMAT(GL_RG8_SNORM, GL_RG, 8),
- FORMAT(GL_RGB_SNORM, GL_RGB, 0),
- FORMAT(GL_RGB8_SNORM, GL_RGB, 8),
- FORMAT(GL_RGBA_SNORM, GL_RGBA, 0),
- FORMAT(GL_RGBA8_SNORM, GL_RGBA, 8),
- FORMAT(GL_ALPHA_SNORM, GL_ALPHA, 0),
- FORMAT(GL_ALPHA8_SNORM, GL_ALPHA, 8),
- FORMAT(GL_LUMINANCE_SNORM, GL_LUMINANCE, 0),
- FORMAT(GL_LUMINANCE8_SNORM, GL_LUMINANCE, 8),
- FORMAT(GL_LUMINANCE_ALPHA_SNORM, GL_LUMINANCE_ALPHA, 0),
- FORMAT(GL_LUMINANCE8_ALPHA8_SNORM, GL_LUMINANCE_ALPHA, 8),
- FORMAT(GL_INTENSITY_SNORM, GL_INTENSITY, 0),
- FORMAT(GL_INTENSITY8_SNORM, GL_INTENSITY, 8),
- FORMAT(GL_R16_SNORM, GL_RED, 16),
- FORMAT(GL_RG16_SNORM, GL_RG, 16),
- FORMAT(GL_RGB16_SNORM, GL_RGB, 16),
- FORMAT(GL_RGBA16_SNORM, GL_RGBA, 16),
- FORMAT(GL_ALPHA16_SNORM, GL_ALPHA, 16),
- FORMAT(GL_LUMINANCE16_SNORM, GL_LUMINANCE, 16),
- FORMAT(GL_LUMINANCE16_ALPHA16_SNORM, GL_LUMINANCE_ALPHA, 16),
- FORMAT(GL_INTENSITY16_SNORM, GL_INTENSITY, 16)
+ { GL_RED_SNORM, GL_RED, 0 },
+ { GL_R8_SNORM, GL_RED, 8 },
+ { GL_RG_SNORM, GL_RG, 0 },
+ { GL_RG8_SNORM, GL_RG, 8 },
+ { GL_RGB_SNORM, GL_RGB, 0 },
+ { GL_RGB8_SNORM, GL_RGB, 8 },
+ { GL_RGBA_SNORM, GL_RGBA, 0 },
+ { GL_RGBA8_SNORM, GL_RGBA, 8 },
+ { GL_ALPHA_SNORM, GL_ALPHA, 0 },
+ { GL_ALPHA8_SNORM, GL_ALPHA, 8 },
+ { GL_LUMINANCE_SNORM, GL_LUMINANCE, 0 },
+ { GL_LUMINANCE8_SNORM, GL_LUMINANCE, 8 },
+ { GL_LUMINANCE_ALPHA_SNORM, GL_LUMINANCE_ALPHA, 0 },
+ { GL_LUMINANCE8_ALPHA8_SNORM, GL_LUMINANCE_ALPHA, 8 },
+ { GL_INTENSITY_SNORM, GL_INTENSITY, 0 },
+ { GL_INTENSITY8_SNORM, GL_INTENSITY, 8 },
+ { GL_R16_SNORM, GL_RED, 16 },
+ { GL_RG16_SNORM, GL_RG, 16 },
+ { GL_RGB16_SNORM, GL_RGB, 16 },
+ { GL_RGBA16_SNORM, GL_RGBA, 16 },
+ { GL_ALPHA16_SNORM, GL_ALPHA, 16 },
+ { GL_LUMINANCE16_SNORM, GL_LUMINANCE, 16 },
+ { GL_LUMINANCE16_ALPHA16_SNORM, GL_LUMINANCE_ALPHA, 16 },
+ { GL_INTENSITY16_SNORM, GL_INTENSITY, 16 }
};
static const struct format_desc arb_texture_compression_bptc_unorm[] = {
- FORMAT(GL_COMPRESSED_RGBA_BPTC_UNORM, GL_RGBA, 0),
- FORMAT(GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM, GL_RGBA, 0)
+ { GL_COMPRESSED_RGBA_BPTC_UNORM, GL_RGBA, 0 },
+ { GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM, GL_RGBA, 0 }
};
static const struct format_desc arb_texture_compression_bptc_float[] = {
- FORMAT(GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT, GL_RGB, 0),
- FORMAT(GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT, GL_RGB, 0)
+ { GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT, GL_RGB, 0 },
+ { GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT, GL_RGB, 0 }
};
static const struct format_desc arb_es2_compatibility[] = {
- FORMAT(GL_RGB565, GL_RGB, 5)
+ { GL_RGB565, GL_RGB, 5 }
};
static const struct format_desc arb_texture_stencil8[] = {
- FORMAT(GL_STENCIL_INDEX8, GL_STENCIL_INDEX, 0)
+ { GL_STENCIL_INDEX8, GL_STENCIL_INDEX, 0 }
};
struct test_desc {
@@ -520,6 +518,16 @@ static const struct test_desc test_sets[] = {
},
};
+static const char *
+get_format_name(GLenum format)
+{
+ if (format == 3)
+ return "3";
+ if (format == 4)
+ return "4";
+ return piglit_get_gl_enum_name(format);
+}
+
static GLboolean
supported(const struct test_desc *test)
{
diff --git a/tests/fbo/fbo-generatemipmap-formats.c b/tests/fbo/fbo-generatemipmap-formats.c
index 0340c9b3f..9d41b6fe8 100644
--- a/tests/fbo/fbo-generatemipmap-formats.c
+++ b/tests/fbo/fbo-generatemipmap-formats.c
@@ -440,13 +440,14 @@ test_format(const struct format_desc *format, GLenum basetype)
int x;
int level;
GLboolean pass = GL_TRUE;
+ const char *name = get_format_name(format->internalformat);
if (basetype == GL_INT) {
printf("Skipping mipmap generation for integer texture.\n");
return GL_TRUE;
}
- printf("Testing %s%s\n", format->name, tex_width == 256 ? "" : " (NPOT)");
+ printf("Testing %s%s\n", name, tex_width == 256 ? "" : " (NPOT)");
tex = create_tex(format->internalformat, format->base_internal_format,
basetype);
@@ -466,7 +467,7 @@ test_format(const struct format_desc *format, GLenum basetype)
glDeleteTextures(1, &tex);
piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
- "%s%s", format->name,
+ "%s%s", name,
npot ? " NPOT" : "");
return pass;
diff --git a/tests/spec/arb_direct_state_access/gettextureimage-formats.c b/tests/spec/arb_direct_state_access/gettextureimage-formats.c
index dfc8ff429..ccf28ba13 100644
--- a/tests/spec/arb_direct_state_access/gettextureimage-formats.c
+++ b/tests/spec/arb_direct_state_access/gettextureimage-formats.c
@@ -401,7 +401,10 @@ test_format(const struct test_desc *test,
glReadPixels(rx, ry, 1, 1, GL_RGBA, GL_FLOAT, pix);
if (!colors_equal(expected, pix, tolerance)) {
printf("%s failure: format: %s, level %d at pixel(%d, %d)\n",
- TestName, fmt->name, level, rx, ry);
+ TestName,
+ get_format_name(
+ fmt->internalformat),
+ level, rx, ry);
printf(" Expected (%f, %f, %f, %f)\n",
expected[0], expected[1], expected[2], expected[3]);
printf(" Found (%f, %f, %f, %f)\n",
diff --git a/tests/spec/arb_framebuffer_object/get-renderbuffer-internalformat.c b/tests/spec/arb_framebuffer_object/get-renderbuffer-internalformat.c
index 2b6e4d47e..f4a18b4ad 100644
--- a/tests/spec/arb_framebuffer_object/get-renderbuffer-internalformat.c
+++ b/tests/spec/arb_framebuffer_object/get-renderbuffer-internalformat.c
@@ -61,7 +61,7 @@ test_format(const struct format_desc *format)
format->internalformat <= 4)
return PIGLIT_SKIP;
- printf("Testing %s: ", format->name);
+ printf("Testing %s: ", get_format_name(format->internalformat));
glGenRenderbuffers(1, &rb);
glBindRenderbuffer(GL_RENDERBUFFER, rb);
glRenderbufferStorage(GL_RENDERBUFFER, format->internalformat, 1, 1);
diff --git a/tests/spec/ext_framebuffer_multisample/fast-clear.c b/tests/spec/ext_framebuffer_multisample/fast-clear.c
index 49ec0a305..c0b249fb9 100644
--- a/tests/spec/ext_framebuffer_multisample/fast-clear.c
+++ b/tests/spec/ext_framebuffer_multisample/fast-clear.c
@@ -140,12 +140,13 @@ convert_srgb_color(const struct format_desc *format,
float *color)
{
int i;
+ const char *format_name = get_format_name(format->internalformat);
/* If the texture is not an sRGB format then no conversion is
* needed regardless of the sRGB settings.
*/
- if (strstr(format->name, "SRGB") == NULL &&
- strstr(format->name, "SLUMINANCE") == NULL)
+ if (strstr(format_name, "SRGB") == NULL &&
+ strstr(format_name, "SLUMINANCE") == NULL)
return;
/* If GL_FRAMEBUFFER_SRGB was enabled when we did the clear
@@ -343,15 +344,16 @@ test_format(const struct format_desc *format)
GLuint tex;
GLuint fbo;
int i;
+ const char *name = get_format_name(format->internalformat);
if (format->internalformat == 3 || format->internalformat == 4)
return PIGLIT_SKIP;
/* Compressed formats aren't supported for multisampling */
- if (strstr("COMPRESSED", format->name))
+ if (strstr("COMPRESSED", name))
return PIGLIT_SKIP;
- printf("Testing %s\n", format->name);
+ printf("Testing %s\n", name);
if (single_sample)
tex_target = GL_TEXTURE_2D;
diff --git a/tests/spec/ext_framebuffer_multisample/formats.cpp b/tests/spec/ext_framebuffer_multisample/formats.cpp
index 30f88ef41..f8948402e 100644
--- a/tests/spec/ext_framebuffer_multisample/formats.cpp
+++ b/tests/spec/ext_framebuffer_multisample/formats.cpp
@@ -527,7 +527,7 @@ test_format(const struct format_desc *format)
*/
glClearColor(0, 0, 0, 0);
- printf("Testing %s\n", format->name);
+ printf("Testing %s\n", get_format_name(format->internalformat));
/* Set up the framebuffers for rendering the test image. This
* might fail if the format we're testing isn't supported as a
diff --git a/tests/texturing/getteximage-formats.c b/tests/texturing/getteximage-formats.c
index bbd883248..5ea5737a6 100644
--- a/tests/texturing/getteximage-formats.c
+++ b/tests/texturing/getteximage-formats.c
@@ -450,7 +450,10 @@ test_format(const struct test_desc *test,
glReadPixels(rx, ry, 1, 1, GL_RGBA, GL_FLOAT, pix);
if (!colors_equal(expected, pix, tolerance)) {
printf("%s failure: format: %s, level %d at pixel(%d, %d)\n",
- TestName, fmt->name, level, rx, ry);
+ TestName,
+ get_format_name(
+ fmt->internalformat),
+ level, rx, ry);
printf(" Expected (%f, %f, %f, %f)\n",
expected[0], expected[1], expected[2], expected[3]);
printf(" Found (%f, %f, %f, %f)\n",
--
2.15.1
More information about the Piglit
mailing list