[MG_Pipe, MG_Backend, MG_Remote, docs] (P7): ID-P7-30 - D3's two review fixes: the bit-8 and bit-13 rows are pinned, and deletion ordering is guaranteed by the Live/Gen test

The vertex-input and buffer-bindings rows of SubsystemDeps.def became live
behaviour when every reader started reading the table; two static_asserts
now pin them the way the texture and programs rows already were. The
"safe by construction" story about destroy ordering was inverted for the
case where a view holds its owner's last reference - the owner's destroy
reaches the wire first - so the three places that told it now say that the
walk's Live/Gen test is the guarantee.
This commit is contained in:
2026-09-22 18:27:43 -04:00
parent 498eb66a14
commit 22761a692d
5 changed files with 44 additions and 23 deletions
+12 -8
View File
@@ -809,14 +809,18 @@ namespace MobileGL::MG_Backend::DirectGLES {
// may not depend on a client invariant to terminate: a chain the wire could make cyclic ends
// as a null answer rather than as a hang.
//
// DELETION ORDERING IS SAFE BY CONSTRUCTION, AND CHECKED ANYWAY. A view holds a strong
// SharedPtr to its storage owner (TextureObjectView::m_storageOwner) and the client emits
// resource_destroy from the DESTRUCTOR - "the last SharedPtr to this object dropping, not the
// glDelete* that only marks the name and leaves a still-bound object very much alive"
// (MG_State/GLState/TextureState/TextureObject.cpp:63) - so an owner's record cannot die
// while a record that views it is live, however the application orders its glDeleteTextures.
// If one ever did, PipeTextureRecordForHandle tests Live and Gen, so a recycled slot answers
// null rather than a stranger's record.
// DELETION ORDERING: THE LIVE/GEN TEST IS THE GUARANTEE, NOT THE EMIT ORDER. A view holds a
// strong SharedPtr to its storage owner (TextureObjectView::m_storageOwner) and the client
// emits resource_destroy from the DESTRUCTOR - "the last SharedPtr to this object dropping,
// not the glDelete* that only marks the name and leaves a still-bound object very much alive"
// (MG_State/GLState/TextureState/TextureObject.cpp:63). So the owner's storage cannot go away
// under a live view, whatever order the application deletes the two names in. But the two
// destroys are emitted back to back from one destructor chain, and when the view holds the
// owner's LAST reference the member is destroyed before the view's base destructor runs, so
// the wire carries resource_destroy(owner) and then resource_destroy(view): for one apply the
// view record is live with Desc.ViewOf naming a freed slot. No draw can land in between, and
// PipeTextureRecordForHandle tests Live and Gen, so that window answers null (= not clean)
// rather than a recycled stranger's record.
const MG_Pipe::MGPipeResourceRecord* PipeTextureStorageRecordForRecord(
const MG_Pipe::MGPipeResourceRecord& record);
+8
View File
@@ -234,6 +234,14 @@ namespace MobileGL::MG_Pipe {
return "";
}
// Rows 1 and 6 became live behaviour when D3 made every reader read the table (before that
// the bit-7 tests were hard-coded in Managers.cpp and DirectGLES.cpp and these rows were
// dead data). An edit that drops either row now makes BOTH readers agree, so nothing
// downstream can catch it; these two lines can.
static_assert(MGPipeSubsystemRequires(kMGPipeSubsystemVertexInput) == kMGPipeSubsystemResources,
"D-K2's vertex-input row (bit 8 requires bit 7) has gone missing");
static_assert(MGPipeSubsystemRequires(kMGPipeSubsystemBufferBindings) == kMGPipeSubsystemResources,
"D-K2's buffer-bindings row (bit 13 requires bit 7) has gone missing");
static_assert(MGPipeSubsystemRequires(kMGPipeSubsystemTextureResources) ==
(kMGPipeSubsystemResources | kMGPipeSubsystemSamplers),
"D-K2's fourth row (bit 10 requires bit 11) has gone missing again");
+8 -5
View File
@@ -413,11 +413,14 @@ may not depend on a client invariant to terminate), and a storage record that ca
**not clean**: the direction that re-syncs, not a refusal, and it raises nothing.
`SyncTextureViewToBackendByRecord` stamps that same storage serial — or 0, which reads as never
clean — at both its arms, so the stamp and the gate name one quantity. Deletion ordering cannot
strand the walk: a view holds a strong reference to its storage owner and the client emits
`resource_destroy` from the DESTRUCTOR rather than from `glDeleteTextures`
(`TextureObject.cpp:63`), so an owner's record outlives every record that views it whatever order
the application deletes the two names in; `Live`/`Gen` are checked anyway, so a recycled slot
answers null rather than a stranger's record.
strand the walk, and the guarantee is the check, not the emit order: a view holds a strong
reference to its storage owner and the client emits `resource_destroy` from the DESTRUCTOR rather
than from `glDeleteTextures` (`TextureObject.cpp:63`), so the storage cannot go away under a live
view whatever order the application deletes the two names in — but the two destroys leave one
destructor chain back to back, owner FIRST when the view held the owner's last reference, so for
one apply the view record is live with `ViewOf` naming a freed slot. No draw can land in that
window, and the walk tests `Live`/`Gen`, so it answers null (not clean) rather than a recycled
stranger's record.
The four in-body live reads (`GetTarget` at
`Managers.cpp:8876-8877, 8620-8621`; `IsTextureView` `:7060`; the TexBuffer backing `:8223-8231`)