struct zink_batch_state {
struct zink_fence fence;
struct pipe_reference reference;
- unsigned draw_count;
struct zink_batch_usage usage;
struct zink_context *ctx;
VkSemaphore sem;
struct util_queue_fence flush_completed;
- unsigned compute_count;
struct pipe_resource *flush_res;
struct zink_batch_usage *last_batch_usage;
+ unsigned work_count;
+
bool has_work;
bool in_rp; //renderpass is currently active
};
bool mode_changed = ctx->gfx_pipeline_state.mode != dinfo->mode;
bool reads_drawid = ctx->shader_reads_drawid;
bool reads_basevertex = ctx->shader_reads_basevertex;
- unsigned draw_count = ctx->batch.state->draw_count;
+ unsigned work_count = ctx->batch.work_count;
enum pipe_prim_type mode = dinfo->mode;
update_barriers(ctx, false);
}
bool needs_drawid = reads_drawid && ctx->drawid_broken;
- draw_count += num_draws;
+ work_count += num_draws;
if (index_size > 0) {
if (dindirect && dindirect->buffer) {
assert(num_draws == 1);
screen->vk.CmdEndTransformFeedbackEXT(batch->state->cmdbuf, 0, ctx->num_so_targets, counter_buffers, counter_buffer_offsets);
}
batch->has_work = true;
- ctx->batch.state->draw_count = draw_count;
+ ctx->batch.work_count = work_count;
/* flush if there's >100k draws */
- if (unlikely(ctx->batch.state->resource_size >= screen->total_video_mem / 2 ||
- draw_count >= 100000))
+ if (unlikely(work_count >= 100000))
pctx->flush(pctx, NULL, PIPE_FLUSH_ASYNC);
}
offsetof(struct zink_cs_push_constant, work_dim), sizeof(uint32_t),
&info->work_dim);
- batch->state->compute_count++;
+ batch->work_count++;
if (info->indirect) {
vkCmdDispatchIndirect(batch->state->cmdbuf, zink_resource(info->indirect)->obj->buffer, info->indirect_offset);
zink_batch_reference_resource_rw(batch, zink_resource(info->indirect), false);
vkCmdDispatch(batch->state->cmdbuf, info->grid[0], info->grid[1], info->grid[2]);
batch->has_work = true;
/* flush if there's >100k computes */
- if (unlikely(ctx->batch.state->resource_size >= zink_screen(ctx->base.screen)->total_video_mem / 2 ||
- ctx->batch.state->compute_count >= 100000))
+ if (unlikely(ctx->batch.work_count >= 100000))
pctx->flush(pctx, NULL, PIPE_FLUSH_ASYNC);
}