[Mesa-dev] [PATCH 01/11] mesa: Refactor _mesa_framebuffer_renderbuffer
Anuj Phogat
anuj.phogat at gmail.com
Fri Feb 5 23:04:04 UTC 2016
On Fri, Feb 5, 2016 at 1:04 PM, Ian Romanick <idr at freedesktop.org> wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> This function previously was only used in fbobject.c and contained a
> bunch of API validation. Split the function into
> framebuffer_renderbuffer that is static and contains the validation, and
> _mesa_framebuffer_renderbuffer that is suitable for calling from
> elsewhere in Mesa (e.g., meta).
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
> src/mesa/main/fbobject.c | 42 ++++++++++++++++++++++++++----------------
> src/mesa/main/fbobject.h | 3 +--
> 2 files changed, 27 insertions(+), 18 deletions(-)
>
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index 2d4acb3..0b0653d 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -3413,8 +3413,27 @@ void
> _mesa_framebuffer_renderbuffer(struct gl_context *ctx,
> struct gl_framebuffer *fb,
> GLenum attachment,
> - struct gl_renderbuffer *rb,
> - const char *func)
> + struct gl_renderbuffer *rb)
> +{
> + assert(!_mesa_is_winsys_fbo(fb));
> +
> + FLUSH_VERTICES(ctx, _NEW_BUFFERS);
> +
> + assert(ctx->Driver.FramebufferRenderbuffer);
> + ctx->Driver.FramebufferRenderbuffer(ctx, fb, attachment, rb);
> +
> + /* Some subsequent GL commands may depend on the framebuffer's visual
> + * after the binding is updated. Update visual info now.
> + */
> + _mesa_update_framebuffer_visual(ctx, fb);
> +}
> +
> +static void
> +framebuffer_renderbuffer(struct gl_context *ctx,
> + struct gl_framebuffer *fb,
> + GLenum attachment,
> + struct gl_renderbuffer *rb,
> + const char *func)
> {
> struct gl_renderbuffer_attachment *att;
>
> @@ -3444,18 +3463,9 @@ _mesa_framebuffer_renderbuffer(struct gl_context *ctx,
> }
> }
>
> - FLUSH_VERTICES(ctx, _NEW_BUFFERS);
> -
> - assert(ctx->Driver.FramebufferRenderbuffer);
> - ctx->Driver.FramebufferRenderbuffer(ctx, fb, attachment, rb);
> -
> - /* Some subsequent GL commands may depend on the framebuffer's visual
> - * after the binding is updated. Update visual info now.
> - */
> - _mesa_update_framebuffer_visual(ctx, fb);
> + _mesa_framebuffer_renderbuffer(ctx, fb, attachment, rb);
> }
>
> -
> void GLAPIENTRY
> _mesa_FramebufferRenderbuffer(GLenum target, GLenum attachment,
> GLenum renderbuffertarget,
> @@ -3491,8 +3501,8 @@ _mesa_FramebufferRenderbuffer(GLenum target, GLenum attachment,
> rb = NULL;
> }
>
> - _mesa_framebuffer_renderbuffer(ctx, fb, attachment, rb,
> - "glFramebufferRenderbuffer");
> + framebuffer_renderbuffer(ctx, fb, attachment, rb,
> + "glFramebufferRenderbuffer");
> }
>
>
> @@ -3528,8 +3538,8 @@ _mesa_NamedFramebufferRenderbuffer(GLuint framebuffer, GLenum attachment,
> rb = NULL;
> }
>
> - _mesa_framebuffer_renderbuffer(ctx, fb, attachment, rb,
> - "glNamedFramebufferRenderbuffer");
> + framebuffer_renderbuffer(ctx, fb, attachment, rb,
> + "glNamedFramebufferRenderbuffer");
> }
>
>
> diff --git a/src/mesa/main/fbobject.h b/src/mesa/main/fbobject.h
> index 8dad0ff..458e440 100644
> --- a/src/mesa/main/fbobject.h
> +++ b/src/mesa/main/fbobject.h
> @@ -91,8 +91,7 @@ extern void
> _mesa_framebuffer_renderbuffer(struct gl_context *ctx,
> struct gl_framebuffer *fb,
> GLenum attachment,
> - struct gl_renderbuffer *rb,
> - const char *func);
> + struct gl_renderbuffer *rb);
>
> extern void
> _mesa_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb);
> --
> 2.5.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Patches 1-5 are:
Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>
I'll continue reviewing rest of the series.
More information about the mesa-dev
mailing list