mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 07:28:11 +02:00
zink: remove batch params from renderpass functions
this no longer makes sense to have Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12770>
This commit is contained in:
parent
46b6ecd4ab
commit
ba925cf958
5 changed files with 43 additions and 38 deletions
|
|
@ -52,8 +52,9 @@ blit_resolve(struct zink_context *ctx, const struct pipe_blit_info *info)
|
|||
|
||||
apply_dst_clears(ctx, info, false);
|
||||
zink_fb_clears_apply_region(ctx, info->src.resource, zink_rect_from_box(&info->src.box));
|
||||
struct zink_batch *batch = zink_batch_no_rp(ctx);
|
||||
|
||||
struct zink_batch *batch = &ctx->batch;
|
||||
zink_batch_no_rp(ctx);
|
||||
zink_batch_reference_resource_rw(batch, src, false);
|
||||
zink_batch_reference_resource_rw(batch, dst, true);
|
||||
|
||||
|
|
@ -157,7 +158,9 @@ blit_native(struct zink_context *ctx, const struct pipe_blit_info *info)
|
|||
|
||||
apply_dst_clears(ctx, info, false);
|
||||
zink_fb_clears_apply_region(ctx, info->src.resource, zink_rect_from_box(&info->src.box));
|
||||
struct zink_batch *batch = zink_batch_no_rp(ctx);
|
||||
|
||||
struct zink_batch *batch = &ctx->batch;
|
||||
zink_batch_no_rp(ctx);
|
||||
zink_batch_reference_resource_rw(batch, src, false);
|
||||
zink_batch_reference_resource_rw(batch, dst, true);
|
||||
|
||||
|
|
|
|||
|
|
@ -116,14 +116,16 @@ clear_in_rp(struct pipe_context *pctx,
|
|||
}
|
||||
cr.baseArrayLayer = 0;
|
||||
cr.layerCount = util_framebuffer_get_num_layers(fb);
|
||||
struct zink_batch *batch = zink_batch_rp(ctx);
|
||||
struct zink_batch *batch = &ctx->batch;
|
||||
zink_batch_rp(ctx);
|
||||
VKCTX(CmdClearAttachments)(batch->state->cmdbuf, num_attachments, attachments, 1, &cr);
|
||||
}
|
||||
|
||||
static void
|
||||
clear_color_no_rp(struct zink_context *ctx, struct zink_resource *res, const union pipe_color_union *pcolor, unsigned level, unsigned layer, unsigned layerCount)
|
||||
{
|
||||
struct zink_batch *batch = zink_batch_no_rp(ctx);
|
||||
struct zink_batch *batch = &ctx->batch;
|
||||
zink_batch_no_rp(ctx);
|
||||
VkImageSubresourceRange range = {0};
|
||||
range.baseMipLevel = level;
|
||||
range.levelCount = 1;
|
||||
|
|
@ -147,7 +149,8 @@ clear_color_no_rp(struct zink_context *ctx, struct zink_resource *res, const uni
|
|||
static void
|
||||
clear_zs_no_rp(struct zink_context *ctx, struct zink_resource *res, VkImageAspectFlags aspects, double depth, unsigned stencil, unsigned level, unsigned layer, unsigned layerCount)
|
||||
{
|
||||
struct zink_batch *batch = zink_batch_no_rp(ctx);
|
||||
struct zink_batch *batch = &ctx->batch;
|
||||
zink_batch_no_rp(ctx);
|
||||
VkImageSubresourceRange range = {0};
|
||||
range.baseMipLevel = level;
|
||||
range.levelCount = 1;
|
||||
|
|
@ -448,7 +451,8 @@ zink_clear_buffer(struct pipe_context *pctx,
|
|||
- size is the number of bytes to fill, and must be either a multiple of 4,
|
||||
or VK_WHOLE_SIZE to fill the range from offset to the end of the buffer
|
||||
*/
|
||||
struct zink_batch *batch = zink_batch_no_rp(ctx);
|
||||
struct zink_batch *batch = &ctx->batch;
|
||||
zink_batch_no_rp(ctx);
|
||||
zink_batch_reference_resource_rw(batch, res, true);
|
||||
util_range_add(&res->base.b, &res->valid_buffer_range, offset, offset + size);
|
||||
VKCTX(CmdFillBuffer)(batch->state->cmdbuf, res->obj->buffer, offset, size, *(uint32_t*)clear_value);
|
||||
|
|
|
|||
|
|
@ -1800,7 +1800,7 @@ zink_evaluate_depth_buffer(struct pipe_context *pctx)
|
|||
}
|
||||
|
||||
void
|
||||
zink_begin_render_pass(struct zink_context *ctx, struct zink_batch *batch)
|
||||
zink_begin_render_pass(struct zink_context *ctx)
|
||||
{
|
||||
setup_framebuffer(ctx);
|
||||
assert(ctx->gfx_pipeline_state.render_pass);
|
||||
|
|
@ -1812,14 +1812,14 @@ zink_begin_render_pass(struct zink_context *ctx, struct zink_batch *batch)
|
|||
}
|
||||
|
||||
void
|
||||
zink_end_render_pass(struct zink_context *ctx, struct zink_batch *batch)
|
||||
zink_end_render_pass(struct zink_context *ctx)
|
||||
{
|
||||
if (batch->in_rp) {
|
||||
if (ctx->batch.in_rp) {
|
||||
if (ctx->render_condition.query)
|
||||
zink_stop_conditional_render(ctx);
|
||||
VKCTX(CmdEndRenderPass)(batch->state->cmdbuf);
|
||||
VKCTX(CmdEndRenderPass)(ctx->batch.state->cmdbuf);
|
||||
}
|
||||
batch->in_rp = false;
|
||||
ctx->batch.in_rp = false;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1937,8 +1937,8 @@ flush_batch(struct zink_context *ctx, bool sync)
|
|||
struct zink_batch *batch = &ctx->batch;
|
||||
if (ctx->clears_enabled)
|
||||
/* start rp to do all the clears */
|
||||
zink_begin_render_pass(ctx, batch);
|
||||
zink_end_render_pass(ctx, batch);
|
||||
zink_begin_render_pass(ctx);
|
||||
zink_end_render_pass(ctx);
|
||||
zink_end_batch(ctx, batch);
|
||||
ctx->deferred_fence = NULL;
|
||||
|
||||
|
|
@ -2329,10 +2329,9 @@ static inline VkCommandBuffer
|
|||
get_cmdbuf(struct zink_context *ctx, struct zink_resource *res)
|
||||
{
|
||||
if ((res->access && !res->unordered_barrier) || !ctx->batch.in_rp) {
|
||||
struct zink_batch *batch = zink_batch_no_rp(ctx);
|
||||
assert(!batch->in_rp);
|
||||
zink_batch_no_rp(ctx);
|
||||
res->unordered_barrier = false;
|
||||
return batch->state->cmdbuf;
|
||||
return ctx->batch.state->cmdbuf;
|
||||
}
|
||||
res->unordered_barrier = true;
|
||||
ctx->batch.state->has_barriers = true;
|
||||
|
|
@ -2546,7 +2545,7 @@ zink_flush(struct pipe_context *pctx,
|
|||
/* triggering clears will force has_work */
|
||||
if (!deferred && ctx->clears_enabled)
|
||||
/* start rp to do all the clears */
|
||||
zink_begin_render_pass(ctx, batch);
|
||||
zink_begin_render_pass(ctx);
|
||||
|
||||
if (!batch->has_work) {
|
||||
if (pfence) {
|
||||
|
|
@ -2767,7 +2766,7 @@ mem_barrier(struct zink_context *ctx, VkPipelineStageFlags src_stage, VkPipeline
|
|||
mb.pNext = NULL;
|
||||
mb.srcAccessMask = src;
|
||||
mb.dstAccessMask = dst;
|
||||
zink_end_render_pass(ctx, batch);
|
||||
zink_end_render_pass(ctx);
|
||||
VKCTX(CmdPipelineBarrier)(batch->state->cmdbuf, src_stage, dst_stage, 0, 1, &mb, 0, NULL, 0, NULL);
|
||||
}
|
||||
|
||||
|
|
@ -2856,8 +2855,10 @@ zink_copy_buffer(struct zink_context *ctx, struct zink_batch *batch, struct zink
|
|||
region.dstOffset = dst_offset;
|
||||
region.size = size;
|
||||
|
||||
if (!batch)
|
||||
batch = zink_batch_no_rp(ctx);
|
||||
if (!batch) {
|
||||
batch = &ctx->batch;
|
||||
zink_batch_no_rp(ctx);
|
||||
}
|
||||
assert(!batch->in_rp);
|
||||
zink_batch_reference_resource_rw(batch, src, false);
|
||||
zink_batch_reference_resource_rw(batch, dst, true);
|
||||
|
|
@ -2875,8 +2876,10 @@ zink_copy_image_buffer(struct zink_context *ctx, struct zink_batch *batch, struc
|
|||
struct zink_resource *img = dst->base.b.target == PIPE_BUFFER ? src : dst;
|
||||
struct zink_resource *buf = dst->base.b.target == PIPE_BUFFER ? dst : src;
|
||||
|
||||
if (!batch)
|
||||
batch = zink_batch_no_rp(ctx);
|
||||
if (!batch) {
|
||||
batch = &ctx->batch;
|
||||
zink_batch_no_rp(ctx);
|
||||
}
|
||||
|
||||
bool buf2img = buf == src;
|
||||
|
||||
|
|
@ -3049,7 +3052,8 @@ zink_resource_copy_region(struct pipe_context *pctx,
|
|||
region.extent.width = src_box->width;
|
||||
region.extent.height = src_box->height;
|
||||
|
||||
struct zink_batch *batch = zink_batch_no_rp(ctx);
|
||||
struct zink_batch *batch = &ctx->batch;
|
||||
zink_batch_no_rp(ctx);
|
||||
zink_batch_reference_resource_rw(batch, src, false);
|
||||
zink_batch_reference_resource_rw(batch, dst, true);
|
||||
|
||||
|
|
|
|||
|
|
@ -389,28 +389,22 @@ void
|
|||
zink_init_vk_sample_locations(struct zink_context *ctx, VkSampleLocationsInfoEXT *loc);
|
||||
|
||||
void
|
||||
zink_begin_render_pass(struct zink_context *ctx,
|
||||
struct zink_batch *batch);
|
||||
zink_begin_render_pass(struct zink_context *ctx);
|
||||
void
|
||||
zink_end_render_pass(struct zink_context *ctx, struct zink_batch *batch);
|
||||
zink_end_render_pass(struct zink_context *ctx);
|
||||
|
||||
static inline struct zink_batch *
|
||||
static inline void
|
||||
zink_batch_rp(struct zink_context *ctx)
|
||||
{
|
||||
struct zink_batch *batch = &ctx->batch;
|
||||
if (!batch->in_rp) {
|
||||
zink_begin_render_pass(ctx, batch);
|
||||
}
|
||||
return batch;
|
||||
if (!ctx->batch.in_rp)
|
||||
zink_begin_render_pass(ctx);
|
||||
}
|
||||
|
||||
static inline struct zink_batch *
|
||||
static inline void
|
||||
zink_batch_no_rp(struct zink_context *ctx)
|
||||
{
|
||||
struct zink_batch *batch = &ctx->batch;
|
||||
zink_end_render_pass(ctx, batch);
|
||||
assert(!batch->in_rp);
|
||||
return batch;
|
||||
zink_end_render_pass(ctx);
|
||||
assert(!ctx->batch.in_rp);
|
||||
}
|
||||
|
||||
static inline VkPipelineStageFlags
|
||||
|
|
|
|||
|
|
@ -514,7 +514,7 @@ zink_draw_vbo(struct pipe_context *pctx,
|
|||
if (BATCH_CHANGED)
|
||||
zink_update_descriptor_refs(ctx, false);
|
||||
|
||||
batch = zink_batch_rp(ctx);
|
||||
zink_batch_rp(ctx);
|
||||
bool pipeline_changed = false;
|
||||
if (!HAS_DYNAMIC_STATE)
|
||||
pipeline_changed = update_gfx_pipeline<BATCH_CHANGED>(ctx, batch->state, mode);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue