diff --git a/MobileGL/MG_Backend/DirectVulkan/Renderer/VkRenderPassManager.cpp b/MobileGL/MG_Backend/DirectVulkan/Renderer/VkRenderPassManager.cpp index ad8316de..411eac6e 100644 --- a/MobileGL/MG_Backend/DirectVulkan/Renderer/VkRenderPassManager.cpp +++ b/MobileGL/MG_Backend/DirectVulkan/Renderer/VkRenderPassManager.cpp @@ -116,7 +116,9 @@ namespace MobileGL::MG_Backend::DirectVulkan { Vector attachmentDescriptions(validDrawBufCount); Vector colorAttachmentRefs(validDrawBufCount); Vector pendingClearAttachments; - Vector textureResources(validDrawBufCount, nullptr); + auto& textureResources = RenderPassEntry::s_textureResourcesScratch; + textureResources.clear(); + textureResources.resize(validDrawBufCount, nullptr); Vector attachmentViews(validDrawBufCount, VK_NULL_HANDLE); // This should automatically work on default & offscreen FBO // assuming default FBO has the right param @@ -290,7 +292,6 @@ namespace MobileGL::MG_Backend::DirectVulkan { renderPass, framebuffer, compatibilityHash, - Move(textureResources), Move(pendingClearAttachments), static_cast(attachmentViews.size()), extent, diff --git a/MobileGL/MG_Backend/DirectVulkan/Renderer/VkRenderPassManager.h b/MobileGL/MG_Backend/DirectVulkan/Renderer/VkRenderPassManager.h index 297abefe..1685e74f 100644 --- a/MobileGL/MG_Backend/DirectVulkan/Renderer/VkRenderPassManager.h +++ b/MobileGL/MG_Backend/DirectVulkan/Renderer/VkRenderPassManager.h @@ -25,11 +25,10 @@ namespace MobileGL::MG_Backend::DirectVulkan { struct RenderPassEntry { static inline VkDevice s_device; + static inline Vector s_textureResourcesScratch; VkRenderPass renderPass = VK_NULL_HANDLE; VkFramebuffer framebuffer = VK_NULL_HANDLE; Uint64 compatibilityHash = 0; - // Should we hold pointer-to-resource here? - Vector textureResources; Vector pendingClearAttachments; Uint32 attachmentCount = 0; IntVec2 extent = {0, 0}; @@ -41,7 +40,6 @@ namespace MobileGL::MG_Backend::DirectVulkan { std::swap(renderPass, that.renderPass); std::swap(framebuffer, that.framebuffer); std::swap(compatibilityHash, that.compatibilityHash); - std::swap(textureResources, that.textureResources); std::swap(pendingClearAttachments, that.pendingClearAttachments); std::swap(attachmentCount, that.attachmentCount); std::swap(extent, that.extent); @@ -51,14 +49,12 @@ namespace MobileGL::MG_Backend::DirectVulkan { VkRenderPass renderpass, VkFramebuffer framebuffer, Uint64 compatibilityHash, - const std::vector& textureResources, const Vector& pendingClearAttachments, Uint32 attachmentCount, IntVec2 extent, int subpass): renderPass(renderpass), framebuffer(framebuffer), compatibilityHash(compatibilityHash), - textureResources(Move(textureResources)), pendingClearAttachments(Move(pendingClearAttachments)), attachmentCount(attachmentCount), extent(extent),