Mesa (main): zink: add more clear hooks
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jun 22 12:54:37 UTC 2021
Module: Mesa
Branch: main
Commit: 6cc2929e876204ba967e5857fb4fc35522d6f506
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6cc2929e876204ba967e5857fb4fc35522d6f506
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Fri Jun 18 11:47:23 2021 -0400
zink: add more clear hooks
Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11466>
---
src/gallium/drivers/zink/zink_clear.c | 27 +++++++++++++++++++++++++++
src/gallium/drivers/zink/zink_clear.h | 13 +++++++++++++
src/gallium/drivers/zink/zink_context.c | 2 ++
3 files changed, 42 insertions(+)
diff --git a/src/gallium/drivers/zink/zink_clear.c b/src/gallium/drivers/zink/zink_clear.c
index 3594396b041..bf38e97d23f 100644
--- a/src/gallium/drivers/zink/zink_clear.c
+++ b/src/gallium/drivers/zink/zink_clear.c
@@ -22,6 +22,7 @@
*/
#include "zink_context.h"
+#include "zink_query.h"
#include "zink_resource.h"
#include "zink_screen.h"
@@ -468,6 +469,32 @@ zink_clear_buffer(struct pipe_context *pctx,
pipe_buffer_unmap(pctx, xfer);
}
+void
+zink_clear_render_target(struct pipe_context *pctx, struct pipe_surface *dst,
+ const union pipe_color_union *color, unsigned dstx,
+ unsigned dsty, unsigned width, unsigned height,
+ bool render_condition_enabled)
+{
+ struct zink_context *ctx = zink_context(pctx);
+ zink_blit_begin(ctx, ZINK_BLIT_SAVE_FB | ZINK_BLIT_SAVE_FS | (render_condition_enabled ? 0 : ZINK_BLIT_NO_COND_RENDER));
+ util_blitter_clear_render_target(ctx->blitter, dst, color, dstx, dsty, width, height);
+ if (!render_condition_enabled && ctx->render_condition_active)
+ zink_start_conditional_render(ctx);
+}
+
+void
+zink_clear_depth_stencil(struct pipe_context *pctx, struct pipe_surface *dst,
+ unsigned clear_flags, double depth, unsigned stencil,
+ unsigned dstx, unsigned dsty, unsigned width, unsigned height,
+ bool render_condition_enabled)
+{
+ struct zink_context *ctx = zink_context(pctx);
+ zink_blit_begin(ctx, ZINK_BLIT_SAVE_FB | ZINK_BLIT_SAVE_FS | (render_condition_enabled ? 0 : ZINK_BLIT_NO_COND_RENDER));
+ util_blitter_clear_depth_stencil(ctx->blitter, dst, clear_flags, depth, stencil, dstx, dsty, width, height);
+ if (!render_condition_enabled && ctx->render_condition_active)
+ zink_start_conditional_render(ctx);
+}
+
bool
zink_fb_clear_needs_explicit(struct zink_framebuffer_clear *fb_clear)
{
diff --git a/src/gallium/drivers/zink/zink_clear.h b/src/gallium/drivers/zink/zink_clear.h
index 2eb81273cde..5f6492a17a7 100644
--- a/src/gallium/drivers/zink/zink_clear.h
+++ b/src/gallium/drivers/zink/zink_clear.h
@@ -72,6 +72,19 @@ zink_clear_buffer(struct pipe_context *pctx,
unsigned size,
const void *clear_value,
int clear_value_size);
+
+void
+zink_clear_render_target(struct pipe_context *ctx, struct pipe_surface *dst,
+ const union pipe_color_union *color, unsigned dstx,
+ unsigned dsty, unsigned width, unsigned height,
+ bool render_condition_enabled);
+
+void
+zink_clear_depth_stencil(struct pipe_context *ctx, struct pipe_surface *dst,
+ unsigned clear_flags, double depth, unsigned stencil,
+ unsigned dstx, unsigned dsty, unsigned width, unsigned height,
+ bool render_condition_enabled);
+
bool
zink_fb_clear_needs_explicit(struct zink_framebuffer_clear *fb_clear);
diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 5b5dbea650c..087df64418b 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -3378,6 +3378,8 @@ zink_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
ctx->base.clear = zink_clear;
ctx->base.clear_texture = zink_clear_texture;
ctx->base.clear_buffer = zink_clear_buffer;
+ ctx->base.clear_render_target = zink_clear_render_target;
+ ctx->base.clear_depth_stencil = zink_clear_depth_stencil;
ctx->base.draw_vbo = zink_draw_vbo;
ctx->base.launch_grid = zink_launch_grid;
More information about the mesa-commit
mailing list