Mesa (master): zink: start to refactor clearing
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Jan 15 16:46:10 UTC 2021
Module: Mesa
Branch: master
Commit: 196794264f40d0f1ab8ab7326b528b156302228a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=196794264f40d0f1ab8ab7326b528b156302228a
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Thu Aug 13 11:45:30 2020 -0400
zink: start to refactor clearing
we currently only handle clears inside renderpasses, but it's also possible
to perform clears outside of renderpasses, so we can break this logic up a bit
to open the door to handling the non-rp case
Reviewed-by: Adam Jackson <ajax at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8512>
---
src/gallium/drivers/zink/zink_clear.c | 31 ++++++++++++++++++++++++-------
1 file changed, 24 insertions(+), 7 deletions(-)
diff --git a/src/gallium/drivers/zink/zink_clear.c b/src/gallium/drivers/zink/zink_clear.c
index 102321f9c1c..e8dbe01e334 100644
--- a/src/gallium/drivers/zink/zink_clear.c
+++ b/src/gallium/drivers/zink/zink_clear.c
@@ -26,8 +26,8 @@
#include "util/u_framebuffer.h"
-void
-zink_clear(struct pipe_context *pctx,
+static void
+clear_in_rp(struct pipe_context *pctx,
unsigned buffers,
const struct pipe_scissor_state *scissor_state,
const union pipe_color_union *pcolor,
@@ -36,11 +36,6 @@ zink_clear(struct pipe_context *pctx,
struct zink_context *ctx = zink_context(pctx);
struct pipe_framebuffer_state *fb = &ctx->fb_state;
- /* FIXME: this is very inefficient; if no renderpass has been started yet,
- * we should record the clear if it's full-screen, and apply it as we
- * start the render-pass. Otherwise we can do a partial out-of-renderpass
- * clear.
- */
struct zink_batch *batch = zink_batch_rp(ctx);
VkClearAttachment attachments[1 + PIPE_MAX_COLOR_BUFS];
@@ -86,3 +81,25 @@ zink_clear(struct pipe_context *pctx,
cr.layerCount = util_framebuffer_get_num_layers(fb);
vkCmdClearAttachments(batch->cmdbuf, num_attachments, attachments, 1, &cr);
}
+
+void
+zink_clear(struct pipe_context *pctx,
+ unsigned buffers,
+ const struct pipe_scissor_state *scissor_state,
+ const union pipe_color_union *pcolor,
+ double depth, unsigned stencil)
+{
+ struct zink_context *ctx = zink_context(pctx);
+
+ /* FIXME: this is very inefficient; if no renderpass has been started yet,
+ * we should record the clear if it's full-screen, and apply it as we
+ * start the render-pass. Otherwise we can do a partial out-of-renderpass
+ * clear.
+ */
+ zink_batch_rp(ctx);
+ assert(zink_curr_batch(ctx)->in_rp);
+ if (zink_curr_batch(ctx)->in_rp || ctx->render_condition_active) {
+ clear_in_rp(pctx, buffers, scissor_state, pcolor, depth, stencil);
+ return;
+ }
+}
More information about the mesa-commit
mailing list