diff --git a/src/rendering/vulkan/renderer/vk_renderstate.cpp b/src/rendering/vulkan/renderer/vk_renderstate.cpp index 781768743..1e6dad299 100644 --- a/src/rendering/vulkan/renderer/vk_renderstate.cpp +++ b/src/rendering/vulkan/renderer/vk_renderstate.cpp @@ -160,6 +160,14 @@ void VkRenderState::EnableLineSmooth(bool on) void VkRenderState::Apply(int dt) { + mApplyCount++; + if (mApplyCount == 1000) + { + EndRenderPass(); + GetVulkanFrameBuffer()->FlushCommands(); + mApplyCount = 0; + } + ApplyRenderPass(dt); ApplyScissor(); ApplyViewport(); @@ -548,6 +556,7 @@ void VkRenderState::Bind(int bindingpoint, uint32_t offset) void VkRenderState::BeginFrame() { mMaterial.Reset(); + mApplyCount = 0; } void VkRenderState::EndRenderPass() diff --git a/src/rendering/vulkan/renderer/vk_renderstate.h b/src/rendering/vulkan/renderer/vk_renderstate.h index 0158454ce..dc2c035d6 100644 --- a/src/rendering/vulkan/renderer/vk_renderstate.h +++ b/src/rendering/vulkan/renderer/vk_renderstate.h @@ -113,6 +113,8 @@ protected: bool mLastModelMatrixEnabled = true; bool mLastTextureMatrixEnabled = true; + int mApplyCount = 0; + struct RenderTarget { VulkanImageView *View = nullptr;