From e2333d98a804dfe701b9b6b8a5ba7f97c4f217f6 Mon Sep 17 00:00:00 2001 From: Swung0x48 Date: Tue, 29 Sep 2026 12:20:15 -0400 Subject: [PATCH] [Fix] (Magma, P11 M2): DirectVulkan::GetDescriptorPoolCensus reads the server renderer's pools on the apply thread under inproc (the test probe, between drain batches) instead of racing its growth, rewinds and trims, and answers unavailable on spawn and tcp --- .../MG_Backend/DirectVulkan/DirectVulkan.cpp | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/MobileGL/MG_Backend/DirectVulkan/DirectVulkan.cpp b/MobileGL/MG_Backend/DirectVulkan/DirectVulkan.cpp index 79abe037..53fefc85 100644 --- a/MobileGL/MG_Backend/DirectVulkan/DirectVulkan.cpp +++ b/MobileGL/MG_Backend/DirectVulkan/DirectVulkan.cpp @@ -1764,6 +1764,29 @@ namespace MobileGL::MG_Backend::DirectVulkan { #endif DescriptorPoolCensus GetDescriptorPoolCensus() { +#if MOBILEGL_BUILD_DISAGGREGATED + // P11 M2: UNDER A TRANSPORT THE POOLS ARE THE SERVER RENDERER'S, and its apply thread + // grows, rewinds and trims them while the test thread would be reading - a census taken + // after a swap the client ran ahead of, or mid-burst, walks a set cache BeginFrame may be + // clearing. Inproc, the server is a thread of this process: the read is posted to it as + // the test probe, which runs between drain batches, so it sees every record published + // before it and none half-applied - without waiting on the GPU, which is the point of the + // trim case (it gives a burst back with other slots' work in flight). Spawn and tcp keep + // their pools in another process; the client has no renderer and answers unavailable. + if (MG_Config::Transport != MG_Config::TransportMode::Monolith && + !MG_Remote::Server::ServerLoop::OnApplyThread()) { + if (MG_Config::Transport != MG_Config::TransportMode::InProcess) return DescriptorPoolCensus{}; + DescriptorPoolCensus census{}; + const MobileGLResult result = MG_Remote::Server::ServerLoopInstance().RunProbeOnApplyThreadForTesting( + +[](void* user) -> MobileGLResult { + *static_cast(user) = + pVulkanRenderer ? pVulkanRenderer->GetDescriptorPoolCensus() : DescriptorPoolCensus{}; + return MOBILEGL_OK; + }, + &census); + return result == MOBILEGL_OK ? census : DescriptorPoolCensus{}; + } +#endif return pVulkanRenderer ? pVulkanRenderer->GetDescriptorPoolCensus() : DescriptorPoolCensus{}; } } // namespace MobileGL::MG_Backend::DirectVulkan