[MG_Backend, MG_IntegrationTest, MG_Remote, docs] (P7): an owner-side upload shows through a sampled texture view, because the split clean gate resolves to the storage record

P3b/P4b wave 2-D package D3, slice 1. The defect package D2 found with its new
TextureViewAliasScenario gate and excluded by name because the fix is outside D2's footprint.

THE HOLE. Once a glTextureView had been SAMPLED, a later glTexSubImage through the OWNER's
own name never became visible through the view, on inproc, spawn and tcp, green under
monolith. The client half was never at fault: the case's own emit-counter assertions pass on
the red run, so the records were emitted and the applier accepted them. A view owns no texels
and the client keeps ONE emission cursor per storage - an upload through a view's name is
remapped onto its storage owner before it is emitted (MG_Impl/Pipe/TextureEmit.h) - so every
resource_subdata for either name is keyed on the OWNER and ApplyTextureUpload moves the
OWNER's Serial and PendingUploads alone. BackendTextureObject::IsDrawSyncCleanByRecord read
the VIEW's Serial and PendingUploads, which nothing an upload does can move, so the gate
answered CLEAN for every owner write after the view's first sample and the sync that would
have drained the owner's pending uploads never ran.

THE FIX, AND WHY THIS ONE. The gate's two STORAGE clauses are asked of the STORAGE record -
this record for a texture that owns its texels, the record Desc.ViewOf names for a view -
through the new PipeTextureStorageRecordForRecord. The three PARAMETER clauses stay the
view's own record's, because a view has its own texture parameters and its own built-in
sampler, which is the whole reason the second name exists. SyncTextureViewToBackendByRecord
stamps that same storage serial at both its arms, so the stamp and the gate name one
quantity. This is the split equivalent of the monolith gate's GetContentVersion(), which
TextureObjectView forwards to its owner (TextureObjectView.cpp:100-102).

THE ALTERNATIVE WAS REJECTED. A reverse index owner->views, so an owner-side resource_subdata
bumps every viewing record's Serial, is the other shape D2 named. It is wrong here on three
counts: it puts new mutable state in MG_Pipe's applier, which both backends read, to answer a
question one backend's gate asks; it makes ApplyTextureUpload write a record other than the
one the call names, which breaks the applier's own serial discipline; and its index has to be
pruned on view death or an owner upload bumps a recycled slot's Serial - a silent
cross-texture hazard with no test that would catch it. The resolve direction needs no state,
no pruning, and is checked at every use: PipeTextureRecordForHandle tests Live and Gen.

DELETION ORDERING, WHICH DECIDED IT. A view holds a STRONG SharedPtr to its storage owner
(TextureObjectView::m_storageOwner) and the client emits resource_destroy from the DESTRUCTOR,
not from glDeleteTextures - "the last SharedPtr to this object dropping, not the glDelete*
that only marks the name and leaves a still-bound object very much alive"
(TextureObject.cpp:63). So an owner's record outlives every record that views it whatever
order the application deletes the two names in, and the forward edge cannot dangle. The walk
checks anyway, and a null answer is NOT clean - the direction that re-syncs.

VIEWS OF VIEWS. ONE hop always reaches storage: glTextureView composes a view-of-a-view onto
the ROOT at creation (the spec's additive min-level rule), the client's emitter says so and
TextureObjectView's invariant is that its owner is never a view. The walk is transitive
anyway and BOUNDED at four hops, because this side may not depend on a client invariant to
terminate; a cyclic chain the wire could forge ends as a null answer, which is "not clean",
not a refusal. No new abort site and no new Fatal (rule I): fatal_census abort_sites stays 79.

RED-ONCE (rule J), the case D2 excluded, with the exclusion lifted and nothing else changed,
at D2's head a7c06f4f:

    ctest -R 'DirectGLES\.(Split|Spawn|Tcp)\.TextureViewAliasScenario' -j 3
    ->  79% tests passed, 3 tests failed out of 14
        4042 - DirectGLES.Split.TextureViewAliasScenario.TheOwnerUploadDrainRunsAgainAfterADrawBoundary (Failed)
        4046 - DirectGLES.Spawn.TextureViewAliasScenario.TheOwnerUploadDrainRunsAgainAfterADrawBoundary (Failed)
        4050 - DirectGLES.Tcp.TextureViewAliasScenario.TheOwnerUploadDrainRunsAgainAfterADrawBoundary (Failed)

    the first owner write, through the view: 11408 of 11408 pixels disagree;
      first at (2, 2) is rgba(50,160,30,255), expected rgba(0,0,255,255) +/- 2
    the second owner write, through the view: 11408 of 11408 pixels disagree;
      first at (2, 2) is rgba(50,160,30,255), expected rgba(255,255,0,255) +/- 2

Only the PIXEL channel is red; the drain's emit counters pass, which is what places the
defect on the server. The monolith control DirectGLES.TextureViewAliasScenario.* is 4/4 in
the same run. With the fix: 14/14, 100%.

CONTRACT-P5E.md 5.2's clean gate is amended to state the rule the code now implements, and
says out loud that the rec->Serial form it carried through P5e was wrong rather than
restating it. The CMake exclusion is lifted; the scenario registers all four cases on all
three arms again (G14: the name never left any lane).

G1: .text 0xa52203, nm --defined-only 30570 symbols, 0 added / 0 removed, -D 0/0. Every line
touched in Managers.cpp is inside #if MOBILEGL_PIPE_PUSH (the gate and the resolver) or
#if MOBILEGL_BUILD_DISAGGREGATED (the view sync), and Managers.h's declaration is inside the
PIPE_PUSH block, so the pull build's preprocessed text is unchanged.
This commit is contained in:
2026-09-22 18:10:56 -04:00
parent 550f81d5f8
commit 1e1f4bad27
4 changed files with 124 additions and 30 deletions
+15 -24
View File
@@ -2651,34 +2651,25 @@ if (MOBILEGL_BUILD_DISAGGREGATED)
# TextureViewUsable() rather than failing - which is what the Tcp arm did until the fixture
# entry below got the same knob.
#
# ONE CASE IS EXCLUDED BY NAME, and it is a defect this package FOUND rather than a lane
# problem. TheOwnerUploadDrainRunsAgainAfterADrawBoundary is red on all three transports and
# green under monolith:
# ALL FOUR CASES RUN ON ALL THREE ARMS. TheOwnerUploadDrainRunsAgainAfterADrawBoundary was
# EXCLUDED BY NAME here by package D2, which found the defect but could not fix it inside its
# own footprint:
#
# after a view has been SAMPLED once, a later glTexSubImage through the OWNER's own name
# never becomes visible through the view.
#
# The client half is provably correct - the case's own counter assertions pass, so the
# records were emitted and the applier accepted them. The server's per-texture clean gate
# BackendTextureObject::IsDrawSyncCleanByRecord (Managers.cpp:15433) compares the VIEW's
# record.Serial and record.PendingUploads, and an owner-side resource_subdata moves only the
# OWNER's (MG_Pipe/PipeApply.cpp:1175). Nothing anywhere propagates a serial bump from a
# storage owner to the records that view it: MGPResourceDesc::ViewOf is a forward edge with
# no reverse index, and the applier reads it only in the descriptor-equality helper
# (PipeApply.cpp:666). Under monolith the same gate reads GetContentVersion() THROUGH the
# view, which TextureObjectView forwards to the owner (TextureObjectView.cpp:100-102) - the
# forwarding the split gate has no equivalent of. CONTRACT-P5E.md:387-395 states the split
# gate in full and has the same hole, so the implementation is faithful to the contract.
#
# NOT EXCLUDED FROM THE MONOLITH LANES, where it is green and is the regression net for the
# forwarding that works. Listed in notes/p34b/split-scenario-census.md and
# notes/p34b/espryt-d2.md rather than deleted (G14). The fix is a one-line-shaped change in
# MG_Pipe/PipeApply.cpp with an O(#texture records) scan behind it, or a reverse index in
# MGPipeResourceRecord - an owner's decision, not this package's, and it is outside D2's
# declared footprint.
mgl_itest_register_split_arms(
"TextureViewAliasScenario.*-TextureViewAliasScenario.TheOwnerUploadDrainRunsAgainAfterADrawBoundary"
"")
# Package D3 fixed it and this is its red-once (rule J): the case is red on Split, Spawn AND
# Tcp at D2's head a7c06f4f with this exclusion lifted and nothing else changed, and green on
# all three with the fix. The client half was never at fault - the case's own counter
# assertions pass on the red run, so the records were emitted and the applier accepted them.
# The server's per-texture clean gate BackendTextureObject::IsDrawSyncCleanByRecord
# (MG_Backend/DirectGLES/Managers.cpp) compared the VIEW's record.Serial and
# record.PendingUploads, while an owner-side resource_subdata moves only the OWNER's
# (MG_Pipe/PipeApply.cpp ApplyTextureUpload). The gate now RESOLVES THROUGH Desc.ViewOf to the
# storage owner's record for those two clauses, which is the split equivalent of the monolith
# gate's GetContentVersion() forwarding (TextureObjectView.cpp:100-102). CONTRACT-P5E.md §5.2
# states the rule the code now implements.
mgl_itest_register_split_arms("TextureViewAliasScenario.*" "")
# ---- D2: THE UPLOAD-SHAPE GOLD, UNDER ALL THREE TRANSPORTS ------------------------------
#