[Mesa-dev] [PATCH v2 4/6] mesa/st: wire up Discard{Sub}Framebuffer

Brian Paul brianp at vmware.com
Wed Dec 12 15:56:52 UTC 2018


On 12/12/2018 08:48 AM, Rob Clark wrote:
> Signed-off-by: Rob Clark <robdclark at gmail.com>
> ---
>   src/mesa/state_tracker/st_cb_fbo.c | 39 ++++++++++++++++++++++++++++++
>   1 file changed, 39 insertions(+)
> 
> diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
> index 8901a8680ef..6f46ca03f3c 100644
> --- a/src/mesa/state_tracker/st_cb_fbo.c
> +++ b/src/mesa/state_tracker/st_cb_fbo.c
> @@ -758,6 +758,43 @@ st_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
>      }
>   }
>   
> +static void
> +st_discard_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
> +                       struct gl_renderbuffer_attachment *att)
> +{
> +   struct st_context *st = st_context(ctx);
> +   struct pipe_surface *psurf;
> +
> +   if (!att->Renderbuffer)
> +      return;
> +
> +   psurf = st_renderbuffer(att->Renderbuffer)->surface;
> +

Can the above code go into the conditional below?  Same thing for the 
function below?

> +   if (st->pipe->invalidate_surface)
> +      st->pipe->invalidate_surface(st->pipe, psurf, NULL);
> +}
> +

Can you please put a comment on this function (and below and 
handle_scissor_invalidate()) to describe what they do, please?


-Brian

> +static void
> +st_discard_sub_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
> +                           struct gl_renderbuffer_attachment *att, GLint x,
> +                           GLint y, GLsizei width, GLsizei height)
> +{
> +   struct st_context *st = st_context(ctx);
> +   struct pipe_surface *psurf;
> +
> +   if (!att->Renderbuffer)
> +      return;
> +
> +   psurf = st_renderbuffer(att->Renderbuffer)->surface;
> +
> +   if (st->pipe->invalidate_surface) {
> +      struct pipe_box region;
> +
> +      u_box_2d(x, y, width, height, &region);
> +
> +      st->pipe->invalidate_surface(st->pipe, psurf, &region);
> +   }
> +}
>   
>   /**
>    * Called via glDrawBuffer.  We only provide this driver function so that we
> @@ -936,6 +973,8 @@ st_init_fbo_functions(struct dd_function_table *functions)
>      functions->RenderTexture = st_render_texture;
>      functions->FinishRenderTexture = st_finish_render_texture;
>      functions->ValidateFramebuffer = st_validate_framebuffer;
> +   functions->DiscardFramebuffer = st_discard_framebuffer;
> +   functions->DiscardSubFramebuffer = st_discard_sub_framebuffer;
>   
>      functions->DrawBufferAllocate = st_DrawBufferAllocate;
>      functions->ReadBuffer = st_ReadBuffer;
> 



More information about the mesa-dev mailing list