[Mesa-dev] [RFC 3/3] mesa/st: wire up DiscardTexture

Rob Clark robdclark at gmail.com
Sun Aug 16 11:56:24 PDT 2015


From: Rob Clark <robclark at freedesktop.org>

Turn it into call to optional pipe->invalidate_resource().

Signed-off-by: Rob Clark <robclark at freedesktop.org>
---
 src/mesa/state_tracker/st_cb_fbo.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index 5707590..597dbf4 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -833,7 +833,17 @@ st_UnmapRenderbuffer(struct gl_context *ctx,
    strb->transfer = NULL;
 }
 
+static void
+st_DiscardTexture(struct gl_context *ctx,
+                  struct gl_framebuffer *fb,
+                  struct gl_renderbuffer_attachment *att)
+{
+   struct st_context *st = st_context(ctx);
+   struct pipe_resource *pt = st_get_texobj_resource(att->Texture);
 
+   if (st->pipe->invalidate_resource && pt)
+      st->pipe->invalidate_resource(st->pipe, pt);
+}
 
 void st_init_fbo_functions(struct dd_function_table *functions)
 {
@@ -850,6 +860,8 @@ void st_init_fbo_functions(struct dd_function_table *functions)
 
    functions->MapRenderbuffer = st_MapRenderbuffer;
    functions->UnmapRenderbuffer = st_UnmapRenderbuffer;
+
+   functions->DiscardTexture = st_DiscardTexture;
 }
 
 
-- 
2.4.3



More information about the mesa-dev mailing list