[Mesa-dev] [PATCH 21/38] main: Refactor _mesa_update_draw_buffer_bounds.

Fredrik Höglund fredrik at kde.org
Sun Apr 12 09:01:23 PDT 2015


Reviewed-by: Fredrik Höglund <fredrik at kde.org>

On Wednesday 04 March 2015, Laura Ekstrand wrote:
> ---
>  src/mesa/drivers/dri/i915/i830_vtbl.c       | 2 +-
>  src/mesa/drivers/dri/i915/i915_vtbl.c       | 2 +-
>  src/mesa/drivers/dri/r200/r200_state.c      | 2 +-
>  src/mesa/drivers/dri/radeon/radeon_common.c | 2 +-
>  src/mesa/drivers/dri/radeon/radeon_state.c  | 2 +-
>  src/mesa/main/framebuffer.c                 | 6 +++---
>  src/mesa/main/framebuffer.h                 | 3 ++-
>  src/mesa/main/state.c                       | 2 +-
>  8 files changed, 11 insertions(+), 10 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c b/src/mesa/drivers/dri/i915/i830_vtbl.c
> index 4fff29e..8ed8ff5 100644
> --- a/src/mesa/drivers/dri/i915/i830_vtbl.c
> +++ b/src/mesa/drivers/dri/i915/i830_vtbl.c
> @@ -732,7 +732,7 @@ i830_update_draw_buffer(struct intel_context *intel)
>        /* this updates the DrawBuffer->_NumColorDrawBuffers fields, etc */
>        _mesa_update_framebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer);
>        /* this updates the DrawBuffer's Width/Height if it's a FBO */
> -      _mesa_update_draw_buffer_bounds(ctx);
> +      _mesa_update_draw_buffer_bounds(ctx, ctx->DrawBuffer);
>     }
>  
>     if (fb->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
> diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c
> index 9ed298c..3d77303 100644
> --- a/src/mesa/drivers/dri/i915/i915_vtbl.c
> +++ b/src/mesa/drivers/dri/i915/i915_vtbl.c
> @@ -734,7 +734,7 @@ i915_update_draw_buffer(struct intel_context *intel)
>        /* this updates the DrawBuffer->_NumColorDrawBuffers fields, etc */
>        _mesa_update_framebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer);
>        /* this updates the DrawBuffer's Width/Height if it's a FBO */
> -      _mesa_update_draw_buffer_bounds(ctx);
> +      _mesa_update_draw_buffer_bounds(ctx, ctx->DrawBuffer);
>     }
>  
>     if (fb->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
> diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c
> index b020439..5c0f8a4 100644
> --- a/src/mesa/drivers/dri/r200/r200_state.c
> +++ b/src/mesa/drivers/dri/r200/r200_state.c
> @@ -2216,7 +2216,7 @@ GLboolean r200ValidateState( struct gl_context *ctx )
>     if (new_state & _NEW_BUFFERS) {
>        _mesa_update_framebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer);
>        /* this updates the DrawBuffer's Width/Height if it's a FBO */
> -      _mesa_update_draw_buffer_bounds(ctx);
> +      _mesa_update_draw_buffer_bounds(ctx, ctx->DrawBuffer);
>  
>        R200_STATECHANGE(rmesa, ctx);
>     }
> diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c
> index 84c8066..5ba5953 100644
> --- a/src/mesa/drivers/dri/radeon/radeon_common.c
> +++ b/src/mesa/drivers/dri/radeon/radeon_common.c
> @@ -222,7 +222,7 @@ void radeon_draw_buffer(struct gl_context *ctx, struct gl_framebuffer *fb)
>  		/* this updates the DrawBuffer->_NumColorDrawBuffers fields, etc */
>  		_mesa_update_framebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer);
>  		/* this updates the DrawBuffer's Width/Height if it's a FBO */
> -		_mesa_update_draw_buffer_bounds(ctx);
> +		_mesa_update_draw_buffer_bounds(ctx, ctx->DrawBuffer);
>  	}
>  
>  	if (fb->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
> diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c
> index 2c0a99a..75caa97 100644
> --- a/src/mesa/drivers/dri/radeon/radeon_state.c
> +++ b/src/mesa/drivers/dri/radeon/radeon_state.c
> @@ -1995,7 +1995,7 @@ GLboolean radeonValidateState( struct gl_context *ctx )
>     if (new_state & _NEW_BUFFERS) {
>       _mesa_update_framebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer);
>       /* this updates the DrawBuffer's Width/Height if it's a FBO */
> -     _mesa_update_draw_buffer_bounds(ctx);
> +     _mesa_update_draw_buffer_bounds(ctx, ctx->DrawBuffer);
>       RADEON_STATECHANGE(rmesa, ctx);
>     }
>  
> diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
> index eee457d..6cb13d3 100644
> --- a/src/mesa/main/framebuffer.c
> +++ b/src/mesa/main/framebuffer.c
> @@ -312,7 +312,7 @@ _mesa_resize_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
>  
>     if (ctx) {
>        /* update scissor / window bounds */
> -      _mesa_update_draw_buffer_bounds(ctx);
> +      _mesa_update_draw_buffer_bounds(ctx, ctx->DrawBuffer);
>        /* Signal new buffer state so that swrast will update its clipping
>         * info (the CLIP_BIT flag).
>         */
> @@ -413,9 +413,9 @@ _mesa_scissor_bounding_box(const struct gl_context *ctx,
>   * \param ctx  the GL context.
>   */
>  void
> -_mesa_update_draw_buffer_bounds(struct gl_context *ctx)
> +_mesa_update_draw_buffer_bounds(struct gl_context *ctx,
> +                                struct gl_framebuffer *buffer)
>  {
> -   struct gl_framebuffer *buffer = ctx->DrawBuffer;
>     int bbox[4];
>  
>     if (!buffer)
> diff --git a/src/mesa/main/framebuffer.h b/src/mesa/main/framebuffer.h
> index d3b7e58..d02b86f 100644
> --- a/src/mesa/main/framebuffer.h
> +++ b/src/mesa/main/framebuffer.h
> @@ -77,7 +77,8 @@ _mesa_scissor_bounding_box(const struct gl_context *ctx,
>                             unsigned idx, int *bbox);
>  
>  extern void 
> -_mesa_update_draw_buffer_bounds(struct gl_context *ctx);
> +_mesa_update_draw_buffer_bounds(struct gl_context *ctx,
> +                                struct gl_framebuffer *drawFb);
>  
>  extern void
>  _mesa_update_framebuffer_visual(struct gl_context *ctx,
> diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
> index 2ebba03..a39065e 100644
> --- a/src/mesa/main/state.c
> +++ b/src/mesa/main/state.c
> @@ -393,7 +393,7 @@ _mesa_update_state_locked( struct gl_context *ctx )
>        _mesa_update_framebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer);
>  
>     if (new_state & (_NEW_SCISSOR | _NEW_BUFFERS | _NEW_VIEWPORT))
> -      _mesa_update_draw_buffer_bounds( ctx );
> +      _mesa_update_draw_buffer_bounds(ctx, ctx->DrawBuffer);
>  
>     if (new_state & _NEW_LIGHT)
>        _mesa_update_lighting( ctx );
> 



More information about the mesa-dev mailing list