From ad47dc8c6f4721e98da1e6ea45898c62b3812fff Mon Sep 17 00:00:00 2001 From: Swung0x48 Date: Tue, 6 Oct 2026 12:58:55 -0400 Subject: [PATCH] [Refactor] (P13 W5 S4c): the XFB lifetime lookup, the deferred-destroy drain and the PBO readback target build without a transport. --- MobileGL/MG_Impl/Pipe/Verb/TextureReadbackEmit.inc | 6 +++++- MobileGL/MG_Pipe/PipeMutation.h | 4 ++++ MobileGL/MG_State/GLState/Core.cpp | 2 +- MobileGL/MG_State/GLState/Core.h | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/MobileGL/MG_Impl/Pipe/Verb/TextureReadbackEmit.inc b/MobileGL/MG_Impl/Pipe/Verb/TextureReadbackEmit.inc index 45a6a9b0..988a1e99 100644 --- a/MobileGL/MG_Impl/Pipe/Verb/TextureReadbackEmit.inc +++ b/MobileGL/MG_Impl/Pipe/Verb/TextureReadbackEmit.inc @@ -62,7 +62,11 @@ // the reply form's UploadSubData is what creates it. MG_Pipe::MGPipeHandle PackBufferReadbackTarget(const SharedPtr& pbo, Uint64 end) { - if (!pbo || MG_Config::Ipc.PboReadbackSync != 0) return MG_Pipe::kMGPipeNullHandle; + if (!pbo) return MG_Pipe::kMGPipeNullHandle; +#if MOBILEGL_BUILD_DISAGGREGATED + // The transport's own fallback knob (MOBILEGL_IPC_PBO_READBACK_SYNC): the reply form. + if (MG_Config::Ipc.PboReadbackSync != 0) return MG_Pipe::kMGPipeNullHandle; +#endif if (!BufferWritebackIsReachable(*pbo) || pbo->IsMapped()) return MG_Pipe::kMGPipeNullHandle; if (end > 0x7FFFFFFFull) return MG_Pipe::kMGPipeNullHandle; return MG_Pipe::MGPipeSlots().FindByLifetimeId(MG_Pipe::MGPipeKind::Buffer, pbo->GetLifetimeId()); diff --git a/MobileGL/MG_Pipe/PipeMutation.h b/MobileGL/MG_Pipe/PipeMutation.h index e8e3c6fc..fda97270 100644 --- a/MobileGL/MG_Pipe/PipeMutation.h +++ b/MobileGL/MG_Pipe/PipeMutation.h @@ -281,6 +281,10 @@ namespace MobileGL::MG_Pipe { // the new session serves its first record. Objects of the ended session that are still // alive find themselves unpublished, so their deaths put nothing on the new wire. void MGPipeForgetEndedSession(); +#else + // P13 W5: without a transport nothing applies off the GL thread, so no destroy is ever + // deferred to the next verb hook (the record arm's BeforeReadOnlyVerb still calls this). + inline void MGPipeDrainDeferredDestroys() {} #endif void MGPipeEmitResourceCreate(MG_State::GLState::BufferObject& buffer); diff --git a/MobileGL/MG_State/GLState/Core.cpp b/MobileGL/MG_State/GLState/Core.cpp index 3604aa3c..34242519 100644 --- a/MobileGL/MG_State/GLState/Core.cpp +++ b/MobileGL/MG_State/GLState/Core.cpp @@ -1556,7 +1556,7 @@ namespace MobileGL::MG_State { return it != m_transformFeedbackObjects.end() && it->second.everBound; } -#if MOBILEGL_BUILD_DISAGGREGATED +#if MOBILEGL_BUILD_RECORD_ARM Uint64 GLContext::GetTransformFeedbackLifetimeId(Uint index) const { const auto found = m_transformFeedbackObjects.find(index); return found == m_transformFeedbackObjects.end() ? 0 : found->second.lifetimeId; diff --git a/MobileGL/MG_State/GLState/Core.h b/MobileGL/MG_State/GLState/Core.h index dfcd6f2b..d6655f3c 100644 --- a/MobileGL/MG_State/GLState/Core.h +++ b/MobileGL/MG_State/GLState/Core.h @@ -571,7 +571,7 @@ namespace MobileGL { // Never returns 0 - the counter starts at 1 so a zero-initialised memo slot cannot // be mistaken for a live object. Uint64 GetBoundTransformFeedbackLifetimeId() const { return m_boundTransformFeedbackLifetimeId; } -#if MOBILEGL_BUILD_DISAGGREGATED +#if MOBILEGL_BUILD_RECORD_ARM Uint64 GetTransformFeedbackLifetimeId(Uint index) const; #endif // Whether the object carrying this identity still has an OPEN capture span - one