[MG_Pipe, MG_Impl, MG_Remote, MG_State, MG_Test] (Disaggregated): P5e pg - the archive becomes server-owned and the bindings get a record

- MGPipeShaderCsoRecord gains Archive, a SharedPtr<const ProgramArchive> the create
  ADOPTS under a transport. Before this the applier stored the descriptor and the two
  companion pointers named the frontend's own LinkArtifacts/SpirvArtifacts, which
  ProgramObject::Link() replaces in place - so every reflection read on the apply thread
  was torn or stale by construction the moment the client runs ahead (gap G-A).
- MGPipeApplyCreateShaderState takes the archive as a fourth argument, undefaulted for
  PipeRoute.h's stated reason: a caller that has one and forgets it would compile, and
  the failure would be silent. Null on the monolith arm, which keeps its frontend arms
  token for token (ruling 1 / ID-81).
- ProgramArtifactsCodec gains ProgramArchive and the FRAME. SpirvArtifacts carries no
  stage list and MGPProgramDesc::StageMask cannot stand in for one: it is a bit set, and
  GL lets two shader objects share a stage, so a list rebuilt from it can be shorter than
  generatedSpirv - which the backend pairs with it by one running index.
- Codec completeness, as CONTRACT-P5E §5.5 asks: the skipped member is named
  (LinkArtifacts::program, the live glslang TProgram) and proven unread by either backend
  twin; the libc++ caveat at the size echo is read as what it is - a cross-toolchain
  check, exact for an in-process split - and both verdicts are written where they were
  asked for.
- set_program_bindings (opcode 80) lands end to end: EmitProgramBindings on the client,
  the FIFTH ROUTE ESCAPE (three tails in three index spaces plus a parallel name array -
  no generated row can express it, so op 80's gMGPipeContext slot stays null as
  PipeCatalogueTest pins), the wire emitter, the decoder arm that resolves and
  NUL-checks every name span, and the applier body that copies the names into the record
  (rule C) and advances BindingsSerial.
- The record is emitted AFTER create_shader_state, not before as the draft note said: a
  re-issued create clears all three tails because they index into the archive it just
  replaced, so bindings published ahead of it are wiped by the create that follows.
- MGPProgramDesc::LinkStatus is filled, and ID-88 is VERIFIED rather than assumed:
  ProgramObject::Link()'s prologue bumps m_linkVersion and assigns m_artifacts = {} -
  "the complete not-linked state" - before the body runs, and every ProgramLinkTask
  failure arm leaves linkStatus false. A failed relink therefore reports unlinked, the
  re-issue carries LinkStatus = 0, and nothing needs an object_death.
- ID-87's measurement gets its instrument: the archive's byte count is added to
  PipeStats' CsoBlobBytes where the bytes actually exist, one sample per link.
This commit is contained in:
2026-09-18 07:50:27 -04:00
parent f6cfcbd36b
commit 39d0677616
15 changed files with 745 additions and 77 deletions
+28 -2
View File
@@ -310,8 +310,33 @@ namespace MobileGL::MG_Pipe {
void Mono_Escape_CreateShaderState(const MGPProgramDesc* desc,
const MG_State::GLState::LinkArtifacts* link,
const MG_State::GLState::SpirvArtifacts* spirv) {
MGPipeApplyCreateShaderState(*desc, link, spirv);
const MG_State::GLState::SpirvArtifacts* spirv,
const Uint32* linkedStages, Uint32 linkedStageCount) {
// The stage list is the CLIENT ARM's framing input and this arm has no use for it:
// the monolith twin reads GetLinkedShaderStages() off the frontend object it is
// handed. Named and discarded rather than left out of the signature, so the two
// arms stay one row.
(void)linkedStages;
(void)linkedStageCount;
// P5e (pg): NO ARCHIVE ON THIS ARM, and the null is the arm selection rather than a
// hole. Under monolith the two companion pointers ARE the frontend's own archive,
// the backend twin reads it through its frontend overload (ruling 1 keeps that arm
// token for token), and serialising here to deserialise into the record would put
// EncodeProgramArtifacts on the monolith path - which PipeRoute.h's escape note
// and PipeApply.h both promise it is not.
MGPipeApplyCreateShaderState(*desc, link, spirv, nullptr);
}
// P5e (pg), the fifth escape. A pass-through like the four above: the caller already
// holds the three tails and the parallel name array, and under monolith there is no
// segment to resolve - the names ARE the frontend's own String::c_str()s, alive for
// the duration of the call, which is exactly the lifetime the applier's copy-in needs.
void Mono_Escape_SetProgramBindings(const MGPProgramBindings* hdr, const Int32* blockBindings,
const MGPProgramSamplerUnit* samplerUnits,
const MGPProgramStorageOverride* storageOverrides,
const char* const* storageOverrideNames) {
MGPipeApplySetProgramBindings(*hdr, blockBindings, samplerUnits, storageOverrides,
storageOverrideNames);
}
} // namespace
@@ -357,6 +382,7 @@ namespace MobileGL::MG_Pipe {
gMGPipeRouteEscapes.ResourceFlushRange = &Mono_Escape_ResourceFlushRange;
gMGPipeRouteEscapes.MapPersistent = &Mono_Escape_MapPersistent;
gMGPipeRouteEscapes.CreateShaderState = &Mono_Escape_CreateShaderState;
gMGPipeRouteEscapes.SetProgramBindings = &Mono_Escape_SetProgramBindings;
// KEPT, not merely installed. The client arm overwrites the three tables above; these
// three copies are what it forwards to when it finds itself on the server's own thread.