From 63c2a331a99cf16b4c09d6d00fd632abcfa4e840 Mon Sep 17 00:00:00 2001 From: Swung0x48 Date: Sat, 19 Sep 2026 22:14:38 -0400 Subject: [PATCH] [MG_Remote] (Disaggregated): P5f fe - document handle consumers and capture ordering --- MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp | 4 ++-- MobileGL/MG_Remote/Client/EmitTables.cpp | 21 ++++++------------- MobileGL/MG_Remote/Server/PipeApplier.cpp | 16 ++++++-------- 3 files changed, 14 insertions(+), 27 deletions(-) diff --git a/MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp b/MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp index 9d113eb0..bf86ced9 100644 --- a/MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp +++ b/MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp @@ -1993,7 +1993,7 @@ namespace MobileGL::MG_Backend::DirectGLES { xfb.scattered = false; xfb.scatterProgram.reset(); #if MOBILEGL_BUILD_DISAGGREGATED - xfb.scatterArchive.reset(); + xfb.scatterArchive.reset(); #endif xfb.scatterCapacityVertices = 0; if (program->NeedsScatteredTransformFeedbackCapture()) { @@ -2101,7 +2101,7 @@ namespace MobileGL::MG_Backend::DirectGLES { xfb.scattered = false; xfb.scatterProgram.reset(); #if MOBILEGL_BUILD_DISAGGREGATED - xfb.scatterArchive.reset(); + xfb.scatterArchive.reset(); #endif } else { ReadbackCapturedRanges(xfb.targets); diff --git a/MobileGL/MG_Remote/Client/EmitTables.cpp b/MobileGL/MG_Remote/Client/EmitTables.cpp index 5a9ab870..23334f80 100644 --- a/MobileGL/MG_Remote/Client/EmitTables.cpp +++ b/MobileGL/MG_Remote/Client/EmitTables.cpp @@ -1389,21 +1389,12 @@ namespace MobileGL::MG_Remote::Client { // MarkEndTransformFeedbackCaptureTargets). Taking it here as well would mark the same // buffers twice and taking it INSTEAD of there would mark nothing. // - // RULE D (CONTRACT-P5B.md §0): each record carries the GL arguments the frontend handed - // the backend slot and nothing that is a READING of them. The capture program, the - // capture-buffer bindings, the patch state and the bound XFB object all stay - // BARRIER-PULLED - the server's backend reads the client's gPipeInputs fill of the - // moment, which MGP_FILL at each call site has just written and the verb barrier holds - // still (R-1). That is why these are six two-line emitters and not an XFB protocol. - // - // WHAT MUST HAVE CROSSED BEFORE begin_stream_output, since it is the ordering question - // this package was asked: the capture buffers' own resource records (emitted at their - // own call sites through the resource family, long before this point), the program - // (the CSO/program family, likewise), and the buffer BINDINGS - which do not cross as a - // record at all, because set_stream_output_targets (39) has no producer and no consumer - // and CONTRACT-P5B.md §2 rules it NOT required for t2: under the barrier the server's - // StartPendingTransformFeedback reads them through the kXfbSpan/kDraw pulls - // (GetTransformFeedbackProgram, GetBufferBindingPoint). Producing that row is P9's. + // P5f fe extends Begin with the immutable capture snapshot: program CSO handle, + // XFB object lifetime id, and four buffer handle/range pairs. Buffer resource records + // precede this verb through BeforeReadOnlyVerb; AcquireShaderCso below publishes the + // program archive before Begin. Deferred driver Begin and End therefore need no + // frontend program or binding-point lookup. set_stream_output_targets stays unused: + // this state changes at the capture-span boundary, so it rides Begin itself. void EmitBeginTransformFeedback(GLenum primitiveMode) { ClientSession& session = RequireSession("BeginTransformFeedback"); diff --git a/MobileGL/MG_Remote/Server/PipeApplier.cpp b/MobileGL/MG_Remote/Server/PipeApplier.cpp index 28099e0f..157c9a19 100644 --- a/MobileGL/MG_Remote/Server/PipeApplier.cpp +++ b/MobileGL/MG_Remote/Server/PipeApplier.cpp @@ -850,9 +850,8 @@ namespace MobileGL::MG_Remote::Server { ServerUnmigratedVerbFatal("CopyImageSubData+RENDERBUFFER"); } - // THE TWO ENDPOINTS ARE REBUILT FROM THE GL NAMES, through the BARRIER-PULLED sticky - // forward GetTextureObject(name) - `rsp` counts every one of these and P7 is what - // retires them by making the backend take the handles that travel beside the names. + // P5f fe: both texture identities already travel in the record. Pass those handles + // to the backend's server-owned texture table; GL names are diagnostic data only. MG_Backend::CopyImageEndpoint src{}; MG_Backend::CopyImageEndpoint dst{}; src.TextureHandle = copy.Src; @@ -918,9 +917,8 @@ namespace MobileGL::MG_Remote::Server { // application's block INDEX. `name` points into the decoder's bounded local and is // valid for this call only (rule C); the backend slot copies what it needs. // - // Both backends resolve the PROGRAM through the barrier-pulled GetProgramObject(GlName) - // / TryGetDirectVulkanProgram - `rsp` again, retired by P9. ShaderCso travels beside the - // name for the phase that dispatches on it. + // P5f fe: publish the record's program handle for the backend consumer. Espryt + // resolves its server twin directly; Magma's consumer is the fm package's seam. MG_Pipe::MGPipeApplier().ClearVerbHandles(); MG_Pipe::MGPipeApplier().VerbStorageBlockProgram = binding.ShaderCso; table->GL.ShaderStorageBlockBinding(static_cast(binding.GlName), name, @@ -1015,10 +1013,8 @@ namespace MobileGL::MG_Remote::Server { // objects by the GL name (XfbImpl::g_xfbObjects[name], DirectGLES.cpp:1401) and creates // the ES object on first bind; passing the lifetime id would index a map that has never // heard of it and silently create a second driver object per bind. The lifetime id - // travels as the identity P7/P9 will dispatch on once the XFB namespace has a wire - // lifetime of its own - it has no reader on this side today, and pretending otherwise - // by folding it into the key is exactly the "a GL name is never an identity" confusion - // the contract's GlName row is written against. + // identifies the P5f capture snapshot on this side. Keeping it separate preserves + // the backend GL-name argument while Begin/End find the right server-owned span. MG_Pipe::MGPipeApplier().BoundStreamOutputLifetimeId = bind.LifetimeId; table->GL.BindTransformFeedback(static_cast(bind.GlName)); ++m_streamOutputBinds;