mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 04:58:05 +02:00
mesa: Refactor bind_framebuffer to make _mesa_bind_framebuffers
Fixing dd_function_table::BindFramebuffer will come later because that change is probably not suitable for stable. v2: Fix whitespace issue noticed by Topi. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
This commit is contained in:
parent
64aff35f84
commit
fed9b0ed5a
2 changed files with 26 additions and 12 deletions
|
|
@ -2471,7 +2471,6 @@ static void
|
|||
bind_framebuffer(GLenum target, GLuint framebuffer, bool allow_user_names)
|
||||
{
|
||||
struct gl_framebuffer *newDrawFb, *newReadFb;
|
||||
struct gl_framebuffer *oldDrawFb, *oldReadFb;
|
||||
GLboolean bindReadBuf, bindDrawBuf;
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
|
|
@ -2525,19 +2524,24 @@ bind_framebuffer(GLenum target, GLuint framebuffer, bool allow_user_names)
|
|||
newReadFb = ctx->WinSysReadBuffer;
|
||||
}
|
||||
|
||||
_mesa_bind_framebuffers(ctx,
|
||||
bindDrawBuf ? newDrawFb : ctx->DrawBuffer,
|
||||
bindReadBuf ? newReadFb : ctx->ReadBuffer);
|
||||
}
|
||||
|
||||
void
|
||||
_mesa_bind_framebuffers(struct gl_context *ctx,
|
||||
struct gl_framebuffer *newDrawFb,
|
||||
struct gl_framebuffer *newReadFb)
|
||||
{
|
||||
struct gl_framebuffer *const oldDrawFb = ctx->DrawBuffer;
|
||||
struct gl_framebuffer *const oldReadFb = ctx->ReadBuffer;
|
||||
const bool bindDrawBuf = oldDrawFb != newDrawFb;
|
||||
const bool bindReadBuf = oldReadFb != newReadFb;
|
||||
|
||||
assert(newDrawFb);
|
||||
assert(newDrawFb != &DummyFramebuffer);
|
||||
|
||||
/* save pointers to current/old framebuffers */
|
||||
oldDrawFb = ctx->DrawBuffer;
|
||||
oldReadFb = ctx->ReadBuffer;
|
||||
|
||||
/* check if really changing bindings */
|
||||
if (oldDrawFb == newDrawFb)
|
||||
bindDrawBuf = GL_FALSE;
|
||||
if (oldReadFb == newReadFb)
|
||||
bindReadBuf = GL_FALSE;
|
||||
|
||||
/*
|
||||
* OK, now bind the new Draw/Read framebuffers, if they're changing.
|
||||
*
|
||||
|
|
@ -2573,7 +2577,12 @@ bind_framebuffer(GLenum target, GLuint framebuffer, bool allow_user_names)
|
|||
}
|
||||
|
||||
if ((bindDrawBuf || bindReadBuf) && ctx->Driver.BindFramebuffer) {
|
||||
ctx->Driver.BindFramebuffer(ctx, target, newDrawFb, newReadFb);
|
||||
/* The few classic drivers that actually hook this function really only
|
||||
* want to know if the draw framebuffer changed.
|
||||
*/
|
||||
ctx->Driver.BindFramebuffer(ctx,
|
||||
bindDrawBuf ? GL_FRAMEBUFFER : GL_READ_FRAMEBUFFER,
|
||||
newDrawFb, newReadFb);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -137,6 +137,11 @@ _mesa_get_framebuffer_attachment_parameter(struct gl_context *ctx,
|
|||
GLint *params, const char *caller);
|
||||
|
||||
|
||||
extern void
|
||||
_mesa_bind_framebuffers(struct gl_context *ctx,
|
||||
struct gl_framebuffer *newDrawFb,
|
||||
struct gl_framebuffer *newReadFb);
|
||||
|
||||
extern GLboolean GLAPIENTRY
|
||||
_mesa_IsRenderbuffer(GLuint renderbuffer);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue