aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Marek <[email protected]>2019-01-21 11:29:59 -0500
committerRob Clark <[email protected]>2019-01-29 20:22:32 +0000
commit786f9639d62efc7df8e83d75e4e00f96e29c2ce8 (patch)
treec50519936b2db2a1eddf02e6d9ba4201304b6e83
parent0c42b5f3cb903df61f982398bf3a05570cd23bf2 (diff)
mesa/st: wire up DiscardFramebuffer
Signed-off-by: Jonathan Marek <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index 1a63e77826f..3bd7fd4ad27 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -763,6 +763,30 @@ st_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
/**
+ * Called by ctx->Driver.DiscardFramebuffer
+ */
+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_resource *prsc;
+
+ if (!att->Renderbuffer)
+ return;
+
+ prsc = st_renderbuffer(att->Renderbuffer)->surface->texture;
+
+ /* using invalidate_resource will only work for simple 2D resources */
+ if (prsc->depth0 != 1 || prsc->array_size != 1 || prsc->last_level != 0)
+ return;
+
+ if (st->pipe->invalidate_resource)
+ st->pipe->invalidate_resource(st->pipe, prsc);
+}
+
+
+/**
* Called via glDrawBuffer. We only provide this driver function so that we
* can check if we need to allocate a new renderbuffer. Specifically, we
* don't usually allocate a front color buffer when using a double-buffered
@@ -939,6 +963,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;