[Mesa-dev] [PATCH 3/6] mesa/st: wire up DiscardFramebuffer

Roland Scheidegger sroland at vmware.com
Tue Dec 11 23:03:05 UTC 2018


Am 11.12.18 um 23:50 schrieb Rob Clark:
> pipe_context::invalidate_resource() is so *almost* what we want, but
> with FBOs the fb can be a single layer/level of a pipe_resource, which
> makes ::invalidate_resource() not expressive enough.
> 
> Signed-off-by: Rob Clark <robdclark at gmail.com>
> ---
>  src/gallium/include/pipe/p_context.h |  8 ++++++++
>  src/mesa/state_tracker/st_cb_fbo.c   | 16 ++++++++++++++++
>  2 files changed, 24 insertions(+)
> 
> diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
> index e07b76d4f03..d4e9179b78a 100644
> --- a/src/gallium/include/pipe/p_context.h
> +++ b/src/gallium/include/pipe/p_context.h
> @@ -803,6 +803,14 @@ struct pipe_context {
>     void (*invalidate_resource)(struct pipe_context *ctx,
>                                 struct pipe_resource *resource);
>  
> +   /**
> +    * Like ->invalidate_surface,
Like ->invalidate->resource?

gallium interface changes must use gallium: in the shortlog. Should
probably split up the patch into 2.
It's also missing the gallium/docs changes.

Roland



 but can invalidate a specific layer and level
> +    * of a resource.  If the backing surf->texture has just a single layer and
> +    * level (like window system buffers) it is equiv to ->invalidate_resource
> +    */
> +   void (*invalidate_surface)(struct pipe_context *ctx,
> +                              struct pipe_surface *surf);
> +
>     /**
>      * Return information about unexpected device resets.
>      */
> diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
> index 8901a8680ef..3ece1d4a9de 100644
> --- a/src/mesa/state_tracker/st_cb_fbo.c
> +++ b/src/mesa/state_tracker/st_cb_fbo.c
> @@ -758,6 +758,21 @@ 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;
> +
> +   if (st->pipe->invalidate_surface)
> +      st->pipe->invalidate_surface(st->pipe, psurf);
> +}
>  
>  /**
>   * Called via glDrawBuffer.  We only provide this driver function so that we
> @@ -936,6 +951,7 @@ 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->DrawBufferAllocate = st_DrawBufferAllocate;
>     functions->ReadBuffer = st_ReadBuffer;
> 



More information about the mesa-dev mailing list