zink: move last_work_was_compute from zink_batch to zink_context

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29108>
This commit is contained in:
Mike Blumenkrantz
2024-05-08 10:44:48 -04:00
committed by Marge Bot
parent fb6828a9a1
commit 8eacafaccc
3 changed files with 4 additions and 5 deletions

View File

@@ -4098,7 +4098,7 @@ zink_flush_memory_barrier(struct zink_context *ctx, bool is_compute)
VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT |
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT;
const VkPipelineStageFlags cs_flags = VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
VkPipelineStageFlags src = ctx->batch.last_work_was_compute ? cs_flags : gfx_flags;
VkPipelineStageFlags src = ctx->last_work_was_compute ? cs_flags : gfx_flags;
VkPipelineStageFlags dst = is_compute ? cs_flags : gfx_flags;
if (ctx->memory_barrier & (PIPE_BARRIER_TEXTURE | PIPE_BARRIER_SHADER_BUFFER | PIPE_BARRIER_IMAGE))

View File

@@ -1120,7 +1120,7 @@ zink_draw(struct pipe_context *pctx,
}
batch->state->has_work = true;
batch->last_work_was_compute = false;
ctx->last_work_was_compute = false;
ctx->batch.work_count = work_count;
/* flush if there's >100k draws */
if (!ctx->unordered_blitting && (unlikely(work_count >= 30000) || ctx->oom_flush))
@@ -1303,7 +1303,7 @@ zink_launch_grid(struct pipe_context *pctx, const struct pipe_grid_info *info)
} else
VKCTX(CmdDispatch)(batch->state->cmdbuf, info->grid[0], info->grid[1], info->grid[2]);
batch->state->has_work = true;
batch->last_work_was_compute = true;
ctx->last_work_was_compute = true;
/* flush if there's >100k computes */
if (!ctx->unordered_blitting && (unlikely(ctx->batch.work_count >= 30000) || ctx->oom_flush))
pctx->flush(pctx, NULL, 0);

View File

@@ -681,8 +681,6 @@ struct zink_batch {
struct zink_resource *swapchain;
unsigned work_count;
bool last_work_was_compute;
};
@@ -2058,6 +2056,7 @@ struct zink_context {
bool stencil_ref_changed : 1;
bool rasterizer_discard_changed : 1;
bool rp_tc_info_updated : 1;
bool last_work_was_compute : 1;
};
static inline struct zink_context *