mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-26 20:50:23 +01:00
mesa: Make detach_renderbuffer available outside fbobject.c
Also add a return value indicating whether any work was done.
This will be used by the next patch.
v2: Move 'fb->Attachment[i].Texture == att' check to the next
patch... where it was intended to be in the first place. Noticed by
Chad.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 438cc6bc49)
This commit is contained in:
parent
0c405cd0e8
commit
8ee4a4e417
2 changed files with 38 additions and 9 deletions
|
|
@ -1227,19 +1227,42 @@ _mesa_BindRenderbufferEXT(GLenum target, GLuint renderbuffer)
|
|||
* the renderbuffer.
|
||||
* This is used when a renderbuffer object is deleted.
|
||||
* The spec calls for unbinding.
|
||||
*
|
||||
* \returns
|
||||
* \c true if the renderbuffer was detached from an attachment point. \c
|
||||
* false otherwise.
|
||||
*/
|
||||
static void
|
||||
detach_renderbuffer(struct gl_context *ctx,
|
||||
struct gl_framebuffer *fb,
|
||||
struct gl_renderbuffer *rb)
|
||||
bool
|
||||
_mesa_detach_renderbuffer(struct gl_context *ctx,
|
||||
struct gl_framebuffer *fb,
|
||||
const void *att)
|
||||
{
|
||||
GLuint i;
|
||||
unsigned i;
|
||||
bool progress = false;
|
||||
|
||||
for (i = 0; i < BUFFER_COUNT; i++) {
|
||||
if (fb->Attachment[i].Renderbuffer == rb) {
|
||||
if (fb->Attachment[i].Renderbuffer == att) {
|
||||
_mesa_remove_attachment(ctx, &fb->Attachment[i]);
|
||||
progress = true;
|
||||
}
|
||||
}
|
||||
invalidate_framebuffer(fb);
|
||||
|
||||
/* Section 4.4.4 (Framebuffer Completeness), subsection "Whole Framebuffer
|
||||
* Completeness," of the OpenGL 3.1 spec says:
|
||||
*
|
||||
* "Performing any of the following actions may change whether the
|
||||
* framebuffer is considered complete or incomplete:
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* - Deleting, with DeleteTextures or DeleteRenderbuffers, an object
|
||||
* containing an image that is attached to a framebuffer object
|
||||
* that is bound to the framebuffer."
|
||||
*/
|
||||
if (progress)
|
||||
invalidate_framebuffer(fb);
|
||||
|
||||
return progress;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1264,11 +1287,11 @@ _mesa_DeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
|
|||
}
|
||||
|
||||
if (_mesa_is_user_fbo(ctx->DrawBuffer)) {
|
||||
detach_renderbuffer(ctx, ctx->DrawBuffer, rb);
|
||||
_mesa_detach_renderbuffer(ctx, ctx->DrawBuffer, rb);
|
||||
}
|
||||
if (_mesa_is_user_fbo(ctx->ReadBuffer)
|
||||
&& ctx->ReadBuffer != ctx->DrawBuffer) {
|
||||
detach_renderbuffer(ctx, ctx->ReadBuffer, rb);
|
||||
_mesa_detach_renderbuffer(ctx, ctx->ReadBuffer, rb);
|
||||
}
|
||||
|
||||
/* Remove from hash table immediately, to free the ID.
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include "compiler.h"
|
||||
#include "glheader.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
struct gl_context;
|
||||
struct gl_texture_object;
|
||||
|
|
@ -113,6 +114,11 @@ _mesa_is_legal_color_format(const struct gl_context *ctx, GLenum baseFormat);
|
|||
extern GLenum
|
||||
_mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat);
|
||||
|
||||
extern bool
|
||||
_mesa_detach_renderbuffer(struct gl_context *ctx,
|
||||
struct gl_framebuffer *fb,
|
||||
const void *att);
|
||||
|
||||
extern GLboolean GLAPIENTRY
|
||||
_mesa_IsRenderbuffer(GLuint renderbuffer);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue