From 2c9b9d2a9f43a43f40b677d99610b4f248e19979 Mon Sep 17 00:00:00 2001 From: Swung0x48 Date: Sat, 19 Sep 2026 22:43:35 -0400 Subject: [PATCH] [MG_Backend] (Disaggregated): P5f fm - retire draw attachments after GPU completion --- .../DirectVulkan/Renderer/VulkanRenderer.cpp | 12 ++++++++++++ .../MG_Backend/DirectVulkan/Renderer/WireDraw.inc | 3 +++ 2 files changed, 15 insertions(+) diff --git a/MobileGL/MG_Backend/DirectVulkan/Renderer/VulkanRenderer.cpp b/MobileGL/MG_Backend/DirectVulkan/Renderer/VulkanRenderer.cpp index 608ebd0d..1e6e249a 100644 --- a/MobileGL/MG_Backend/DirectVulkan/Renderer/VulkanRenderer.cpp +++ b/MobileGL/MG_Backend/DirectVulkan/Renderer/VulkanRenderer.cpp @@ -10146,6 +10146,18 @@ void main() { // dstLevel and the z origins below arrived relative to whichever name the application // passed - so a view's level 0 has to become the parent level it opened onto before it // can index a subresource, exactly as at every other attachment boundary. +#if MOBILEGL_BUILD_DISAGGREGATED + if (wire) { + Uint32 srcMip = static_cast(srcLevel), srcLayer = static_cast(srcZ); + Uint32 dstMip = static_cast(dstLevel), dstLayer = static_cast(dstZ); + if (MG_Pipe::MGPipeHandleIsNull(m_textureManager->ResolveWireTextureStorage( + srcEndpoint.TextureHandle, srcMip, srcLayer)) || + MG_Pipe::MGPipeHandleIsNull(m_textureManager->ResolveWireTextureStorage( + dstEndpoint.TextureHandle, dstMip, dstLayer))) MagmaWireFatal("copy-image-view-record"); + srcLevel = static_cast(srcMip); srcZ = static_cast(srcLayer); + dstLevel = static_cast(dstMip); dstZ = static_cast(dstLayer); + } +#endif srcLevel = static_cast(ToStorageMipLevel(srcEndpoint.Texture.get(), srcLevel)); dstLevel = static_cast(ToStorageMipLevel(dstEndpoint.Texture.get(), dstLevel)); srcZ = static_cast(ToStorageArrayLayer(srcEndpoint.Texture.get(), srcZ)); diff --git a/MobileGL/MG_Backend/DirectVulkan/Renderer/WireDraw.inc b/MobileGL/MG_Backend/DirectVulkan/Renderer/WireDraw.inc index 34f28548..c1c2097c 100644 --- a/MobileGL/MG_Backend/DirectVulkan/Renderer/WireDraw.inc +++ b/MobileGL/MG_Backend/DirectVulkan/Renderer/WireDraw.inc @@ -17,6 +17,9 @@ } void VulkanRenderer::DestroyWireDrawPass() { + // FlushPendingCommands only submits. These objects may still be referenced by + // that submission, so retire this temporary pass after the queue completes. + if (m_wireDrawPass || !m_wireDrawViews.empty()) VK_VERIFY(vkQueueWaitIdle(m_graphicsQueue)); m_wireDrawPass.reset(); for (const auto view : m_wireDrawViews) vkDestroyImageView(m_device, view, nullptr); m_wireDrawViews.clear();