mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-02 16:38:09 +02:00
zink: promote flushed clears to unordered cmdbuf when possible
this reuses the unordered_blitting codepath for fb clears for #9016 Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23056>
This commit is contained in:
parent
dfc01aea83
commit
80b8defaf3
1 changed files with 31 additions and 1 deletions
|
|
@ -25,6 +25,7 @@
|
|||
#include "zink_clear.h"
|
||||
#include "zink_context.h"
|
||||
#include "zink_format.h"
|
||||
#include "zink_inlines.h"
|
||||
#include "zink_query.h"
|
||||
|
||||
#include "util/u_blitter.h"
|
||||
|
|
@ -719,9 +720,38 @@ fb_clears_apply_internal(struct zink_context *ctx, struct pipe_resource *pres, i
|
|||
return;
|
||||
if (ctx->batch.in_rp)
|
||||
zink_clear_framebuffer(ctx, BITFIELD_BIT(i));
|
||||
else
|
||||
else {
|
||||
struct zink_resource *res = zink_resource(pres);
|
||||
bool queries_disabled = ctx->queries_disabled;
|
||||
VkCommandBuffer cmdbuf = ctx->batch.state->cmdbuf;
|
||||
/* slightly different than the u_blitter handling:
|
||||
* this can be called recursively while unordered_blitting=true
|
||||
*/
|
||||
bool can_reorder = zink_screen(ctx->base.screen)->info.have_KHR_dynamic_rendering &&
|
||||
!ctx->render_condition_active &&
|
||||
!ctx->unordered_blitting &&
|
||||
zink_get_cmdbuf(ctx, NULL, res) == ctx->batch.state->barrier_cmdbuf;
|
||||
if (can_reorder) {
|
||||
/* set unordered_blitting but NOT blitting:
|
||||
* let begin_rendering handle layouts
|
||||
*/
|
||||
ctx->unordered_blitting = true;
|
||||
/* for unordered clears, swap the unordered cmdbuf for the main one for the whole op to avoid conditional hell */
|
||||
ctx->batch.state->cmdbuf = ctx->batch.state->barrier_cmdbuf;
|
||||
ctx->rp_changed = true;
|
||||
ctx->queries_disabled = true;
|
||||
ctx->batch.state->has_barriers = true;
|
||||
}
|
||||
/* this will automatically trigger all the clears */
|
||||
zink_batch_rp(ctx);
|
||||
if (can_reorder) {
|
||||
zink_batch_no_rp(ctx);
|
||||
ctx->unordered_blitting = false;
|
||||
ctx->rp_changed = true;
|
||||
ctx->queries_disabled = queries_disabled;
|
||||
ctx->batch.state->cmdbuf = cmdbuf;
|
||||
}
|
||||
}
|
||||
zink_fb_clear_reset(ctx, i);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue