[Mesa-dev] [PATCH 04/13] mesa: Refactor bind_framebuffer to make _mesa_bind_framebuffers
Pohjolainen, Topi
topi.pohjolainen at intel.com
Thu Feb 11 17:44:36 UTC 2016
On Wed, Feb 10, 2016 at 10:13:14PM -0800, Ian Romanick wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> Fixing dd_function_table::BindFramebuffer will come later because that
> change is probably not suitable for stable.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
> src/mesa/main/fbobject.c | 33 +++++++++++++++++++++------------
> src/mesa/main/fbobject.h | 5 +++++
> 2 files changed, 26 insertions(+), 12 deletions(-)
>
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index 1b9b692..b92b284 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -2472,7 +2472,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);
>
> @@ -2526,18 +2525,23 @@ bind_framebuffer(GLenum target, GLuint framebuffer, bool allow_user_names)
> newReadFb = ctx->WinSysReadBuffer;
> }
>
> - assert(newDrawFb);
> - assert(newDrawFb != &DummyFramebuffer);
> + _mesa_bind_framebuffers(ctx,
> + bindDrawBuf ? newDrawFb : ctx->DrawBuffer,
> + bindReadBuf ? newReadFb : ctx->ReadBuffer);
> +}
>
> - /* save pointers to current/old framebuffers */
> - oldDrawFb = ctx->DrawBuffer;
> - oldReadFb = 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;
>
> - /* check if really changing bindings */
> - if (oldDrawFb == newDrawFb)
> - bindDrawBuf = GL_FALSE;
> - if (oldReadFb == newReadFb)
> - bindReadBuf = GL_FALSE;
> + assert(newDrawFb);
> + assert(newDrawFb != &DummyFramebuffer);
>
> /*
> * OK, now bind the new Draw/Read framebuffers, if they're changing.
> @@ -2574,7 +2578,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,
Extra space.
I had to check the original to see why bind_framebuffer() doesn't pass the
"target"-argument Driver.BindFramebuffer() anymore. It wasn't visible in
this patch alone but "bindDrawBuf" looks to represent it correctly.
> + newDrawFb, newReadFb);
> }
> }
>
> diff --git a/src/mesa/main/fbobject.h b/src/mesa/main/fbobject.h
> index f9a6060..540bd9d 100644
> --- a/src/mesa/main/fbobject.h
> +++ b/src/mesa/main/fbobject.h
> @@ -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);
>
> --
> 2.5.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list