diff --git a/src/gallium/drivers/zink/zink_batch.c b/src/gallium/drivers/zink/zink_batch.c index 25e8c31d33f..cbf989053a6 100644 --- a/src/gallium/drivers/zink/zink_batch.c +++ b/src/gallium/drivers/zink/zink_batch.c @@ -823,12 +823,12 @@ zink_end_batch(struct zink_context *ctx, struct zink_batch *batch) ctx->work_count = 0; /* this is swapchain presentation semaphore handling */ - if (batch->swapchain) { - if (zink_kopper_acquired(batch->swapchain->obj->dt, batch->swapchain->obj->dt_idx) && !batch->swapchain->obj->present) { - batch->state->present = zink_kopper_present(screen, batch->swapchain); - batch->state->swapchain = batch->swapchain; + if (ctx->swapchain) { + if (zink_kopper_acquired(ctx->swapchain->obj->dt, ctx->swapchain->obj->dt_idx) && !ctx->swapchain->obj->present) { + batch->state->present = zink_kopper_present(screen, ctx->swapchain); + batch->state->swapchain = ctx->swapchain; } - batch->swapchain = NULL; + ctx->swapchain = NULL; } if (screen->device_lost) diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 9073768859d..761438b98c1 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -4168,7 +4168,7 @@ zink_flush_resource(struct pipe_context *pctx, } else { ctx->needs_present = res; } - ctx->batch.swapchain = res; + ctx->swapchain = res; } else if (res->dmabuf) res->queue = VK_QUEUE_FAMILY_FOREIGN_EXT; } diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index 25a67cc9edd..9e21133a985 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -1843,7 +1843,7 @@ zink_flush_frontbuffer(struct pipe_screen *pscreen, } /* handle any outstanding acquire submits (not just from above) */ - if (ctx->batch.swapchain || ctx->needs_present) { + if (ctx->swapchain || ctx->needs_present) { ctx->batch.state->has_work = true; pctx->flush(pctx, NULL, PIPE_FLUSH_END_OF_FRAME); if (ctx->last_batch_state && screen->threaded_submit) { diff --git a/src/gallium/drivers/zink/zink_types.h b/src/gallium/drivers/zink/zink_types.h index 55c80f088d4..96641b633de 100644 --- a/src/gallium/drivers/zink/zink_types.h +++ b/src/gallium/drivers/zink/zink_types.h @@ -677,8 +677,6 @@ zink_batch_state(struct zink_fence *fence) struct zink_batch { struct zink_batch_state *state; - - struct zink_resource *swapchain; }; @@ -1871,6 +1869,7 @@ struct zink_context { struct set rendering_state_cache[6]; //[util_logbase2_ceil(msrtss samplecount)] struct set render_pass_state_cache; struct hash_table *render_pass_cache; + struct zink_resource *swapchain; VkExtent2D swapchain_size; bool fb_changed; bool in_rp; //renderpass is currently active