zink: add launch_grid pipe_context hook for compute handling
we're reusing update_descriptors, so this is trivial Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8781>
This commit is contained in:
committed by
Marge Bot
parent
ce6d08a0e7
commit
a2771967cb
@@ -1675,6 +1675,7 @@ zink_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
|
||||
ctx->base.clear_texture = zink_clear_texture;
|
||||
|
||||
ctx->base.draw_vbo = zink_draw_vbo;
|
||||
ctx->base.launch_grid = zink_launch_grid;
|
||||
ctx->base.flush = zink_flush;
|
||||
ctx->base.memory_barrier = zink_memory_barrier;
|
||||
|
||||
|
||||
@@ -259,4 +259,6 @@ zink_draw_vbo(struct pipe_context *pctx,
|
||||
const struct pipe_draw_start_count *draws,
|
||||
unsigned num_draws);
|
||||
|
||||
void
|
||||
zink_launch_grid(struct pipe_context *pctx, const struct pipe_grid_info *info);
|
||||
#endif
|
||||
|
||||
@@ -780,3 +780,29 @@ zink_draw_vbo(struct pipe_context *pctx,
|
||||
}
|
||||
batch->has_draw = true;
|
||||
}
|
||||
|
||||
void
|
||||
zink_launch_grid(struct pipe_context *pctx, const struct pipe_grid_info *info)
|
||||
{
|
||||
struct zink_context *ctx = zink_context(pctx);
|
||||
struct zink_screen *screen = zink_screen(pctx->screen);
|
||||
struct zink_batch *batch = &ctx->compute_batch;
|
||||
struct zink_compute_program *comp_program = get_compute_program(ctx);
|
||||
if (!comp_program)
|
||||
return;
|
||||
|
||||
VkPipeline pipeline = zink_get_compute_pipeline(screen, comp_program,
|
||||
&ctx->compute_pipeline_state);
|
||||
|
||||
update_descriptors(ctx, screen, true);
|
||||
|
||||
|
||||
vkCmdBindPipeline(batch->cmdbuf, VK_PIPELINE_BIND_POINT_COMPUTE, pipeline);
|
||||
|
||||
if (info->indirect) {
|
||||
vkCmdDispatchIndirect(batch->cmdbuf, zink_resource(info->indirect)->buffer, info->indirect_offset);
|
||||
zink_batch_reference_resource_rw(batch, zink_resource(info->indirect), false);
|
||||
} else
|
||||
vkCmdDispatch(batch->cmdbuf, info->grid[0], info->grid[1], info->grid[2]);
|
||||
batch->has_draw = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user