diff options
author | quou <quou@disroot.org> | 2024-12-30 10:17:17 +1100 |
---|---|---|
committer | quou <quou@disroot.org> | 2024-12-30 10:17:17 +1100 |
commit | 6f3f76b8511dee30e835a998005adba57adebe17 (patch) | |
tree | 54c010ddc81d7492cc97d886b807e50318c9d7b8 /video.cpp | |
parent | 131f0b370f52f70f3dc4a6341d543ef2329cc00e (diff) |
correct render pass ends
Diffstat (limited to 'video.cpp')
-rw-r--r-- | video.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -593,6 +593,7 @@ struct Context_Vk : public Context { const Render_Pass& rp ); void end_rp(Renderpass_Vk& rpo, Framebuffer_Vk& fbo); + void check_end_rp(); }; struct Texture_Vk : public Texture, public Late_Terminated { @@ -1942,8 +1943,7 @@ void Device::submit(Context& ctx_) { si.pSignalSemaphores = &ctx->semaphore;*/ si.commandBufferCount = 1; si.pCommandBuffers = &ctx->cb; - if (ctx->last_rpo) - vkCmdEndRenderPass(ctx->cb); + ctx->check_end_rp(); vkEndCommandBuffer(ctx->cb); vkQueueSubmit(dev->queue, 1, &si, ctx->fence); ctx->wait(); @@ -1957,8 +1957,7 @@ void Device::present() { VkSubmitInfo si{}; VkPipelineStageFlags stage = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; - if (ctx->last_rpo) - vkCmdEndRenderPass(ctx->cb); + ctx->check_end_rp(); ctx->transition( dev->get_backbuffer(), Resource_State::presentable @@ -2171,6 +2170,7 @@ void Context::copy(Buffer_Id dst, Buffer_Id src) { region.srcOffset = 0; region.dstOffset = 0; region.size = b.size; + ctx->check_end_rp(); vkCmdCopyBuffer( ctx->cb, b.buf, @@ -2191,6 +2191,7 @@ void Context::copy(Texture_Id dst, Buffer_Id src) { c.imageExtent.width = a.w; c.imageExtent.height = a.h; c.imageExtent.depth = 1; + ctx->check_end_rp(); vkCmdCopyBufferToImage( ctx->cb, b.buf, @@ -2347,8 +2348,7 @@ std::pair<Renderpass_Vk&, Framebuffer_Vk&> Context_Vk::begin_rp( bool has_depth = rp.depth.id; if (last_rpo == rpo.rpo && last_fbo == fbo.fbo) return { rpo, fbo }; - if (last_rpo) - vkCmdEndRenderPass(cb); + check_end_rp(); last_rpo = rpo.rpo; last_fbo = fbo.fbo; for (i = 0; i < c; i++) { @@ -2389,6 +2389,13 @@ void Context_Vk::end_rp(Renderpass_Vk& rpo, Framebuffer_Vk& fbo) { fbo.on_submit(); } +void Context_Vk::check_end_rp() { + if (last_rpo) { + vkCmdEndRenderPass(cb); + last_rpo = 0; + } +} + void Context::submit(const Render_Pass& rp) { Context_Vk* ctx = (Context_Vk*)this; auto [rpo, fbo] = ctx->begin_rp(rp); |