zink: lift some renderpass mechanics up a level in the api

(should be) no functional changes

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16476>
This commit is contained in:
Mike Blumenkrantz
2022-05-10 12:28:34 -04:00
committed by Marge Bot
parent ec3a7323da
commit 91a9676a0c
3 changed files with 17 additions and 11 deletions

View File

@@ -1999,14 +1999,26 @@ zink_update_vk_sample_locations(struct zink_context *ctx)
void void
zink_batch_rp(struct zink_context *ctx) zink_batch_rp(struct zink_context *ctx)
{ {
if (ctx->batch.in_rp)
return;
unsigned clear_buffers;
clear_buffers = zink_begin_render_pass(ctx);
if (!ctx->batch.in_rp) if (!ctx->batch.in_rp)
zink_begin_render_pass(ctx); return; //dead swapchain
if (ctx->render_condition.query)
zink_start_conditional_render(ctx);
zink_clear_framebuffer(ctx, clear_buffers);
} }
void void
zink_batch_no_rp(struct zink_context *ctx) zink_batch_no_rp(struct zink_context *ctx)
{ {
zink_end_render_pass(ctx); if (!ctx->batch.in_rp)
return;
if (ctx->render_condition.query)
zink_stop_conditional_render(ctx);
if (ctx->gfx_pipeline_state.render_pass)
zink_end_render_pass(ctx);
assert(!ctx->batch.in_rp); assert(!ctx->batch.in_rp);
} }

View File

@@ -591,7 +591,7 @@ begin_render_pass(struct zink_context *ctx)
return clear_buffers; return clear_buffers;
} }
void unsigned
zink_begin_render_pass(struct zink_context *ctx) zink_begin_render_pass(struct zink_context *ctx)
{ {
setup_framebuffer(ctx); setup_framebuffer(ctx);
@@ -630,19 +630,13 @@ zink_begin_render_pass(struct zink_context *ctx)
ctx->gfx_pipeline_state.render_pass = rp; ctx->gfx_pipeline_state.render_pass = rp;
} }
assert(ctx->gfx_pipeline_state.render_pass); assert(ctx->gfx_pipeline_state.render_pass);
unsigned clear_buffers = begin_render_pass(ctx); return begin_render_pass(ctx);
if (ctx->render_condition.query)
zink_start_conditional_render(ctx);
zink_clear_framebuffer(ctx, clear_buffers);
} }
void void
zink_end_render_pass(struct zink_context *ctx) zink_end_render_pass(struct zink_context *ctx)
{ {
if (ctx->batch.in_rp) { if (ctx->batch.in_rp) {
if (ctx->render_condition.query)
zink_stop_conditional_render(ctx);
VKCTX(CmdEndRenderPass)(ctx->batch.state->cmdbuf); VKCTX(CmdEndRenderPass)(ctx->batch.state->cmdbuf);
for (unsigned i = 0; i < ctx->fb_state.nr_cbufs; i++) { for (unsigned i = 0; i < ctx->fb_state.nr_cbufs; i++) {
struct zink_ctx_surface *csurf = (struct zink_ctx_surface*)ctx->fb_state.cbufs[i]; struct zink_ctx_surface *csurf = (struct zink_ctx_surface*)ctx->fb_state.cbufs[i];

View File

@@ -89,7 +89,7 @@ zink_destroy_render_pass(struct zink_screen *screen,
struct zink_render_pass *rp); struct zink_render_pass *rp);
void unsigned
zink_begin_render_pass(struct zink_context *ctx); zink_begin_render_pass(struct zink_context *ctx);
void void
zink_end_render_pass(struct zink_context *ctx); zink_end_render_pass(struct zink_context *ctx);