Commit cece95ee authored by Fabian Bieler's avatar Fabian Bieler

fbo-formats: Remove GLenum stringification macros.

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.
Reviewed-by: Brian Paul's avatarBrian Paul <brianp@vmware.com>
parent 8356474e
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
}
......
This diff is collapsed.
......@@ -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;
......
......@@ -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",
......
......@@ -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);
......
......@@ -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;
......
......@@ -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
......
......@@ -512,7 +512,7 @@ test_depth_format(GLenum target, const struct format_desc *format)
piglit_report_subtest_result(ret ? PIGLIT_PASS : PIGLIT_FAIL,
"%s-%s",
piglit_get_gl_enum_name(target),
piglit_get_gl_enum_name(format->internalformat));
get_format_name(format->internalformat));
glDeleteTextures(1, &tex);
return ret;
}
......@@ -539,7 +539,7 @@ test_stencil_format(GLenum target, const struct format_desc *format)
piglit_report_subtest_result(ret ? PIGLIT_PASS : PIGLIT_FAIL,
"%s-%s",
piglit_get_gl_enum_name(target),
piglit_get_gl_enum_name(format->internalformat));
get_format_name(format->internalformat));
glDeleteTextures(1, &tex);
return ret;
}
......
......@@ -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",
......
......@@ -322,7 +322,7 @@ test_formats_type(const struct format_desc *intFormat,
w, h, 1, tx, ty, 0, tw, th, 1,
bits)) {
printf("texsubimage-unpack failed\n");
printf(" internal format: %s\n", piglit_get_gl_enum_name(intFormat->internalformat));
printf(" internal format: %s\n", get_format_name(intFormat->internalformat));
printf(" format: %s\n", piglit_get_gl_enum_name(srcFormat->format));
printf(" type: %s\n", piglit_get_gl_enum_name(type));
printf(" alignment: %d\n", alignment);
......
......@@ -391,7 +391,7 @@ test_region(GLuint pbo, GLenum target, GLenum internal_format,
printf("texsubimage failed\n");
printf(" target: %s\n", piglit_get_gl_enum_name(target));
printf(" internal format: %s\n",
piglit_get_gl_enum_name(internal_format));
get_format_name(internal_format));
printf(" region: %d, %d %d x %d\n",
region->tx, region->ty, region->tw, region->th);
pass = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment