[Mesa-dev] [PATCH 04/13] mesa: remove _mesa_problem() from a couple of locations
Timothy Arceri
tarceri at itsqueeze.com
Mon May 8 06:35:28 UTC 2017
_mesa_problem() is still useful in some places such as is if a backend
compile fails, but for the majority of cases we should be able to
remove it.
OpenGL test suites are becoming very mature, we should place more
trust in debug builds picking up missed cases.
---
src/mesa/main/attrib.c | 6 ++----
src/mesa/main/fbobject.c | 8 +++-----
2 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index dbcfb4e..9e86fae 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -1421,22 +1421,21 @@ _mesa_PopAttrib(void)
TEST_AND_UPDATE(ctx->Multisample.SampleAlphaToOne,
ms->SampleAlphaToOne,
GL_SAMPLE_ALPHA_TO_ONE);
_mesa_SampleCoverage(ms->SampleCoverageValue,
ms->SampleCoverageInvert);
}
break;
default:
- _mesa_problem( ctx, "Bad attrib flag in PopAttrib");
- break;
+ unreachable("Bad attrib flag in PopAttrib");
}
next = attr->next;
free(attr->data);
free(attr);
attr = next;
}
}
@@ -1746,22 +1745,21 @@ _mesa_PopClientAttrib(void)
break;
case GL_CLIENT_VERTEX_ARRAY_BIT: {
struct gl_array_attrib * attr =
(struct gl_array_attrib *) node->data;
restore_array_attrib(ctx, &ctx->Array, attr);
free_array_attrib_data(ctx, attr);
ctx->NewState |= _NEW_ARRAY;
break;
}
default:
- _mesa_problem( ctx, "Bad attrib flag in PopClientAttrib");
- break;
+ unreachable("Bad attrib flag in PopClientAttrib");
}
next = node->next;
free(node->data);
free(node);
node = next;
}
}
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index ef4fecf..a1c5a6f 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -3959,42 +3959,40 @@ get_framebuffer_attachment_parameter(struct gl_context *ctx,
case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:
case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:
case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:
case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:
case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:
if ((!_mesa_is_desktop_gl(ctx) ||
!ctx->Extensions.ARB_framebuffer_object)
&& !_mesa_is_gles3(ctx)) {
goto invalid_pname_enum;
}
- else if (att->Type == GL_NONE) {
- _mesa_error(ctx, err, "%s(invalid pname %s)", caller,
- _mesa_enum_to_string(pname));
- }
else if (att->Texture) {
const struct gl_texture_image *texImage =
_mesa_select_tex_image(att->Texture, att->Texture->Target,
att->TextureLevel);
if (texImage) {
*params = get_component_bits(pname, texImage->_BaseFormat,
texImage->TexFormat);
}
else {
*params = 0;
}
}
else if (att->Renderbuffer) {
*params = get_component_bits(pname, att->Renderbuffer->_BaseFormat,
att->Renderbuffer->Format);
}
else {
- _mesa_problem(ctx, "%s: invalid FBO attachment structure", caller);
+ assert(att->Type == GL_NONE);
+ _mesa_error(ctx, err, "%s(invalid pname %s)", caller,
+ _mesa_enum_to_string(pname));
}
return;
case GL_FRAMEBUFFER_ATTACHMENT_LAYERED:
if (!_mesa_has_geometry_shaders(ctx)) {
goto invalid_pname_enum;
} else if (att->Type == GL_TEXTURE) {
*params = att->Layered;
} else if (att->Type == GL_NONE) {
_mesa_error(ctx, err, "%s(invalid pname %s)", caller,
_mesa_enum_to_string(pname));
--
2.9.3
More information about the mesa-dev
mailing list