Mesa (master): mesa: use same is_color_attachment trick to discern error cases
Ilia Mirkin
imirkin at kemper.freedesktop.org
Wed Feb 1 03:14:26 UTC 2017
Module: Mesa
Branch: master
Commit: 62b8f494fac377c88bf2bb0eff67cdf4db37da42
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=62b8f494fac377c88bf2bb0eff67cdf4db37da42
Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date: Tue Jan 24 00:26:29 2017 -0500
mesa: use same is_color_attachment trick to discern error cases
All the other calls to retrieve the attachment have been covered except
this one - return the proper error for attachment points that are valid
enums but out of bound for the driver.
Fixes GL45-CTS.geometry_shader.layered_fbo.fb_texture_invalid_attachment
Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
---
src/mesa/main/fbobject.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 6934805..f32f931 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -3150,6 +3150,7 @@ _mesa_framebuffer_texture(struct gl_context *ctx, struct gl_framebuffer *fb,
const char *caller)
{
struct gl_renderbuffer_attachment *att;
+ bool is_color_attachment;
/* The window-system framebuffer object is immutable */
if (_mesa_is_winsys_fbo(fb)) {
@@ -3159,10 +3160,17 @@ _mesa_framebuffer_texture(struct gl_context *ctx, struct gl_framebuffer *fb,
}
/* Not a hash lookup, so we can afford to get the attachment here. */
- att = get_attachment(ctx, fb, attachment, NULL);
+ att = get_attachment(ctx, fb, attachment, &is_color_attachment);
if (att == NULL) {
- _mesa_error(ctx, GL_INVALID_ENUM, "%s(invalid attachment %s)", caller,
- _mesa_enum_to_string(attachment));
+ if (is_color_attachment) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "%s(invalid color attachment %s)", caller,
+ _mesa_enum_to_string(attachment));
+ } else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "%s(invalid attachment %s)", caller,
+ _mesa_enum_to_string(attachment));
+ }
return;
}
More information about the mesa-commit
mailing list