Signed-off-by: Rob Clark <robdcl...@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; + + if (st->pipe->invalidate_surface) + st->pipe->invalidate_surface(st->pipe, psurf, NULL); +} + +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, ®ion); + + st->pipe->invalidate_surface(st->pipe, psurf, ®ion); + } +} /** * 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; -- 2.19.2 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev