X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Ffbobject.c;h=f32f93167517096178b543bdad7e1bb5f1d6d9b2;hb=62b8f494fac377c88bf2bb0eff67cdf4db37da42;hp=044bd635794bf45cb321a5f80c1fa8519eca684b;hpb=84e3e12b2582f4707a837ebb960ea7ce19e1c263;p=mesa.git diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 044bd635794..f32f9316751 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; } @@ -3754,11 +3762,13 @@ _mesa_get_framebuffer_attachment_parameter(struct gl_context *ctx, * either no framebuffer is bound to target; or the default framebuffer * is bound, attachment is DEPTH or STENCIL, and the number of depth or * stencil bits, respectively, is zero." + * + * Note that we don't need explicit checks on DEPTH and STENCIL, because + * on the case the spec is pointing, att->Type is already NONE, so we + * just need to check att->Type. */ - *params = (_mesa_is_winsys_fbo(buffer) && - ((attachment != GL_DEPTH && attachment != GL_STENCIL) || - (att->Type != GL_NONE))) - ? GL_FRAMEBUFFER_DEFAULT : att->Type; + *params = (_mesa_is_winsys_fbo(buffer) && att->Type != GL_NONE) ? + GL_FRAMEBUFFER_DEFAULT : att->Type; return; case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT: if (att->Type == GL_RENDERBUFFER_EXT) {