mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-16 06:23:23 +09:00
[MG_Pipe, MG_Impl, MG_Backend, MG_Test] (Disaggregated): P5e c0e - the cross-package seams
- MGPipeBarriered(op, payload, applierState), IMPLEMENTED, not stubbed: the static wait-class column plus the two payload-derived escalations the contract names (an open XFB span, a draw carrying kDrawClientArrays). One function and two callers is the point - the emit table and the sink must reach the same answer or the client runs on while the server reads a value that has already moved. set_context_values now mirrors IsTransformFeedbackActive into the applier state as well, because a predicate that read it out of gPipeInputs would be reading the very block run-ahead stops filling. - MGPipeApplierCurrentRecordIsBarriered() with the writer beside it. It answers true by default and that IS the landed lockstep answer, not a stub: on a server without kCapRunAheadApply every record is barriered and CONTRACT-P5C's two exemption scopes keep working unchanged. - The sb applier fields (BoundShaderBuffers[3][84], the three windows, the writable masks and ShaderBuffersSerial) and the pg record fields (the three binding tails, Signature, BindingsSerial) with the two entry points MGPipeApplySetShaderBuffers / MGPipeApplySetProgramBindings declared and ABORTING BY NAME. - The by-handle backend seams in Managers.h with aborting bodies in one block: ResolveVaoTwin, ResolveTextureTwin, ResolveProgramTwin, SyncTextureToBackendByHandle, SyncMipmapsToBackendByHandle, and the FBO / RBO / program SyncToBackendByHandle overloads. Five packages sit on opposite sides of these calls - tx2 writes what fb calls, fb writes what tx2 needs, id rekeys the registries all three read - so the signature is fixed once here and each family replaces a body. Abort and not null: a resolver that answered null renders a blank draw and a sync that did nothing renders stale pixels, and both are green lanes. - Coverage.def's GetBufferBindingPoint -> SetShaderBuffers row with BOTH of its PipeFill.cpp switch arms and the pairing asserts, shape-only and inert. It lands with the contract package because PipeFill.cpp belongs to the contract package for the whole phase - an emitter enumerator whose dispatch arm lived in the family's worktree is the merge trap that file's own comment was written about. - FieldOwnership.def re-annotates the six object-class rows plus GetProgramForDispatch to "P5e (Espryt unbarriered), P7 (Magma)", and the strict-abort case follows the string, which IS the debt entry rather than decoration. kMGPipeMaxBufferBindingPoints is pinned against BufferState.h's 84 where both are visible. gen_pipe_field_ownership's refusal count is 8.
This commit is contained in:
@@ -13697,4 +13697,88 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
TwinRegistry<MG_State::GLState::RenderbufferObject, BackendRenderbufferObject, MG_Pipe::MGPipeKind::Renderbuffer>
|
||||
g_backendRenderbufferObjects;
|
||||
} // namespace RenderbufferImpl
|
||||
|
||||
#if MOBILEGL_PIPE_PUSH
|
||||
// =====================================================================================
|
||||
// P5e SEAMS: DECLARED AND REFUSED HERE, BODIED BY THE FAMILY PACKAGES
|
||||
// (MG_Remote/CONTRACT-P5E.md §4.2; BRIEF-P5E §1's "each such seam is a declared signature
|
||||
// in c0e so both sides compile from day one")
|
||||
// =====================================================================================
|
||||
//
|
||||
// WHY THEY ARE ALL IN ONE BLOCK AND WHY THE BODIES ABORT. P5e lands as eight packages in
|
||||
// eight parallel worktrees, and five of them are on opposite sides of these calls: tx2
|
||||
// writes SyncTextureToBackendByHandle and SyncMipmapsToBackendByHandle while fb's
|
||||
// attachment sync and image sweep CALL them; fb writes the two SyncToBackendByHandle
|
||||
// overloads while tx2's detach walk needs the reverse index behind them; id rekeys the
|
||||
// registries the three resolvers read. A package that had to add its own declaration would
|
||||
// collide with the package that added the other half, which is the merge trap P4a's
|
||||
// contract package was written to avoid.
|
||||
//
|
||||
// So the signature is fixed HERE, once, and each family's commit replaces a body. The body
|
||||
// ABORTS BY NAME rather than returning null or doing nothing: a resolver that answered null
|
||||
// would render a blank draw and a sync that did nothing would render stale pixels, and both
|
||||
// would be green lanes. Nothing calls any of them at this commit - every call site is still
|
||||
// on the frontend overload beside it - so the abort is a link-time seam, not a runtime one.
|
||||
//
|
||||
// A package REPLACES the body in place and deletes the matching comment; it does not add a
|
||||
// second definition elsewhere, or the linker's answer depends on link order.
|
||||
namespace {
|
||||
[[noreturn]] void MGPipeP5eSeamNotLanded(const char* name, const char* owner,
|
||||
MG_Pipe::MGPipeHandle handle) {
|
||||
MGLOG_F("MGPipe: Fatal{UnmigratedVerb, \"%s\"} - the P5e by-handle seam is declared by "
|
||||
"package c0e and bodied by package %s; it was called for handle {%u, %u} "
|
||||
"before that package landed",
|
||||
name, owner, handle.Slot, handle.Gen);
|
||||
std::abort();
|
||||
}
|
||||
} // namespace
|
||||
|
||||
namespace VertexArrayImpl {
|
||||
BackendVertexArrayObject* ResolveVaoTwin(MG_Pipe::MGPipeHandle vertexElements) {
|
||||
MGPipeP5eSeamNotLanded("VertexArrayImpl::ResolveVaoTwin", "id/vi", vertexElements);
|
||||
}
|
||||
} // namespace VertexArrayImpl
|
||||
|
||||
namespace TextureImpl {
|
||||
SharedPtr<BackendTextureObject>& SyncTextureToBackendByHandle(MG_Pipe::MGPipeHandle texture,
|
||||
Bool imageBindableStorageRequired) {
|
||||
(void)imageBindableStorageRequired;
|
||||
MGPipeP5eSeamNotLanded("TextureImpl::SyncTextureToBackendByHandle", "tx2", texture);
|
||||
}
|
||||
|
||||
BackendTextureObject* ResolveTextureTwin(MG_Pipe::MGPipeHandle texture) {
|
||||
MGPipeP5eSeamNotLanded("TextureImpl::ResolveTextureTwin", "id/tx2", texture);
|
||||
}
|
||||
|
||||
void BackendTextureObject::SyncMipmapsToBackendByHandle(MG_Pipe::MGPipeHandle texture) {
|
||||
MGPipeP5eSeamNotLanded("BackendTextureObject::SyncMipmapsToBackendByHandle", "tx2",
|
||||
texture);
|
||||
}
|
||||
} // namespace TextureImpl
|
||||
|
||||
namespace FramebufferImpl {
|
||||
void BackendFramebufferObject::SyncToBackendByHandle(MG_Pipe::MGPipeHandle fbo,
|
||||
FramebufferTarget asTarget) {
|
||||
(void)asTarget;
|
||||
MGPipeP5eSeamNotLanded("BackendFramebufferObject::SyncToBackendByHandle", "fb", fbo);
|
||||
}
|
||||
} // namespace FramebufferImpl
|
||||
|
||||
namespace PrgramImpl {
|
||||
BackendProgramObjectImpl* ResolveProgramTwin(MG_Pipe::MGPipeHandle cso) {
|
||||
MGPipeP5eSeamNotLanded("PrgramImpl::ResolveProgramTwin", "id/pg", cso);
|
||||
}
|
||||
|
||||
void BackendProgramObjectImpl::SyncToBackendByHandle(MG_Pipe::MGPipeHandle cso) {
|
||||
MGPipeP5eSeamNotLanded("BackendProgramObjectImpl::SyncToBackendByHandle", "pg", cso);
|
||||
}
|
||||
} // namespace PrgramImpl
|
||||
|
||||
namespace RenderbufferImpl {
|
||||
void BackendRenderbufferObject::SyncToBackendByHandle(MG_Pipe::MGPipeHandle renderbuffer) {
|
||||
MGPipeP5eSeamNotLanded("BackendRenderbufferObject::SyncToBackendByHandle", "fb",
|
||||
renderbuffer);
|
||||
}
|
||||
} // namespace RenderbufferImpl
|
||||
#endif // MOBILEGL_PIPE_PUSH
|
||||
} // namespace MobileGL::MG_Backend::DirectGLES
|
||||
|
||||
@@ -1466,6 +1466,22 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
// the attribute-offset emulation must stay out of the way. Applied to whatever the
|
||||
// applier stored, so the answer is the same whichever side resolved it first.
|
||||
Bool BackendUsesNativeBaseInstance();
|
||||
|
||||
// ---- P5e SEAM (MG_Remote/CONTRACT-P5E.md §4.2; declared by c0e, bodied by id/vi) ----
|
||||
//
|
||||
// THE VAO TWIN, RESOLVED FROM THE HANDLE THE RECORD CARRIED - MGPipeApplierState::
|
||||
// BoundVertexElements - instead of from the frontend VertexArrayObject the draw's
|
||||
// BARRIER_PULLED row hands over. The frontend overload above it stays as the
|
||||
// monolith-glue half, in the shape ResolveSamplerCsoTwin already established for the
|
||||
// sampler CSO family: two overloads, not an #if inside one body, so which arm a caller
|
||||
// is on is visible at the call site.
|
||||
//
|
||||
// It is declared HERE, with a body that aborts by name, because the packages that fill
|
||||
// it in land in parallel worktrees: id rekeys the registry under it, vi moves
|
||||
// PrepareForDraw's call onto it, and neither may edit the other's file. A missing
|
||||
// declaration would make that a merge conflict; a declaration with a quiet body would
|
||||
// make it a null twin and a blank draw.
|
||||
BackendVertexArrayObject* ResolveVaoTwin(MG_Pipe::MGPipeHandle vertexElements);
|
||||
#endif
|
||||
} // namespace VertexArrayImpl
|
||||
|
||||
@@ -1590,6 +1606,14 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
BackendTextureObject(const BackendTextureObject&) = delete;
|
||||
BackendTextureObject& operator=(const BackendTextureObject&) = delete;
|
||||
void SyncMipmapsToBackend(const SharedPtr<MG_State::GLState::ITextureObject>& stateTextureObject);
|
||||
#if MOBILEGL_PIPE_PUSH
|
||||
// P5e SEAM (declared by c0e, bodied by tx2): the same storage sync keyed on the
|
||||
// texture HANDLE, reading the applier's resource record and the server's staged
|
||||
// store instead of the frontend object's levels and pending uploads. fb's
|
||||
// attachment sync and the image sweep both call it, which is why it is declared
|
||||
// once here rather than twice in two packages' worktrees.
|
||||
void SyncMipmapsToBackendByHandle(MG_Pipe::MGPipeHandle texture);
|
||||
#endif
|
||||
// The storage half of the sync for a texture created by glTextureView. Instead of
|
||||
// allocating storage and replaying uploads, it makes this object's ES name BE a view
|
||||
// of the storage texture's ES name (EXT/OES_texture_view), which is what gives the
|
||||
@@ -1820,6 +1844,23 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
SharedPtr<BackendTextureObject>& SyncTextureObjectToBackend(
|
||||
const SharedPtr<MG_State::GLState::ITextureObject>& textureObject,
|
||||
Bool imageBindableStorageRequired = false);
|
||||
#if MOBILEGL_PIPE_PUSH
|
||||
// ---- P5e SEAM (MG_Remote/CONTRACT-P5E.md §4.2, §5.2; declared by c0e, bodied by
|
||||
// id/tx2) --------------------------------------------------------------------------
|
||||
//
|
||||
// EVERY DRAW-PATH TEXTURE ENTRY, BY HANDLE. The caller holds a Texture handle - a
|
||||
// sampler view's Texture, an image unit's Res, a framebuffer surface's Res, VerbMipRes,
|
||||
// VerbCopyTexDst, a copy-image endpoint - and the sync resolves the RECORD first and the
|
||||
// twin by GetOrCreateByHandle, so nothing on the apply thread dereferences a frontend
|
||||
// ITextureObject. The frontend overload above stays as the monolith-glue half.
|
||||
//
|
||||
// ResolveTextureTwin is the lookup without the sync, for the callers that need the twin
|
||||
// to answer a shape question (an image bind's target and storage format come off the
|
||||
// twin, not off a new wire field) after tx2's sync has already run this frame.
|
||||
SharedPtr<BackendTextureObject>& SyncTextureToBackendByHandle(
|
||||
MG_Pipe::MGPipeHandle texture, Bool imageBindableStorageRequired = false);
|
||||
BackendTextureObject* ResolveTextureTwin(MG_Pipe::MGPipeHandle texture);
|
||||
#endif
|
||||
// Brings every texture the next draw reads - the touched units' bindings and the draw
|
||||
// FBO's texture attachments - onto the backend, through the two borrowed-pair memos
|
||||
// documented at their definitions. Declared here so tests can drive those memos directly.
|
||||
@@ -1844,6 +1885,15 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
BackendFramebufferObject& operator=(const BackendFramebufferObject&) = delete;
|
||||
void SyncToBackend(const SharedPtr<MG_State::GLState::FramebufferObject>& stateFBOObject,
|
||||
FramebufferTarget asTarget);
|
||||
#if MOBILEGL_PIPE_PUSH
|
||||
// P5e SEAM (MG_Remote/CONTRACT-P5E.md §5.4; declared by c0e, bodied by fb): the same
|
||||
// sync keyed on the framebuffer HANDLE. The record's eleven surfaces ARE the point
|
||||
// set - the emitter refuses a point at or above the wire width - so the attachment
|
||||
// walk needs no frontend FramebufferObject and no m_pushedSyncHandle handshake: the
|
||||
// handle is the argument. An OVERLOAD rather than a changed signature, so the
|
||||
// monolith arm and the pull build see no token move.
|
||||
void SyncToBackendByHandle(MG_Pipe::MGPipeHandle fbo, FramebufferTarget asTarget);
|
||||
#endif
|
||||
// Apply only this FBO's read buffer (glReadBuffer) to the backend. Split out so it can
|
||||
// still run when SyncCurrentFBO skips the READ-target sync because the same GL FBO is
|
||||
// bound as both draw and read (otherwise glReadBuffer changes would be silently dropped).
|
||||
@@ -2315,6 +2365,14 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
BackendProgramObjectImpl();
|
||||
~BackendProgramObjectImpl();
|
||||
void SyncToBackend(const SharedPtr<MG_State::GLState::ProgramObject>& stateProgramObject);
|
||||
#if MOBILEGL_PIPE_PUSH
|
||||
// P5e SEAM (MG_Remote/CONTRACT-P5E.md §5.5; declared by c0e, bodied by pg): the same
|
||||
// sync keyed on the ShaderCso HANDLE and answered from the record - the archive the
|
||||
// create carries and the three binding tails set_program_bindings carries. It is an
|
||||
// OVERLOAD beside the frontend one, which stays as the monolith-glue half, so the
|
||||
// pull build's mangled names do not move.
|
||||
void SyncToBackendByHandle(MG_Pipe::MGPipeHandle cso);
|
||||
#endif
|
||||
void Use();
|
||||
void SetBaseInstance(Uint32 baseInstance) const;
|
||||
void SetBaseInstanceWordIndex(Int32 wordIndex) const;
|
||||
@@ -2609,6 +2667,23 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
};
|
||||
ImageFormatBakeInputs CollectImageFormatBakeInputs(
|
||||
const MG_State::GLState::ProgramObject& stateProgramObject);
|
||||
|
||||
#if MOBILEGL_PIPE_PUSH
|
||||
// ---- P5e SEAM (MG_Remote/CONTRACT-P5E.md §4.2, §5.5; declared by c0e, bodied by
|
||||
// id/pg) ---------------------------------------------------------------------------
|
||||
//
|
||||
// THE PROGRAM TWIN, RESOLVED FROM MGPipeApplierState::DrawProgram / DispatchProgram /
|
||||
// BoundShaderCso instead of from GetProgramForDraw()'s frontend SharedPtr - the second
|
||||
// unconditional pointer read of every draw, and one of the two rows whose retirement is
|
||||
// what P5e is for. Composite pipeline programs resolve through the same call: their
|
||||
// slots come out of the allocator's composite band, which the server's slot table gains
|
||||
// a band for so the ordinary table does not grow to a million entries.
|
||||
//
|
||||
// Null, loudly, when the handle names no record or cannot be adopted - the shape
|
||||
// ResolveSamplerCsoTwin set - and null silently for the null handle, which is the legal
|
||||
// "nothing bound".
|
||||
BackendProgramObjectImpl* ResolveProgramTwin(MG_Pipe::MGPipeHandle cso);
|
||||
#endif
|
||||
} // namespace PrgramImpl
|
||||
|
||||
namespace SamplerImpl {
|
||||
@@ -2789,6 +2864,16 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
BackendRenderbufferObject(const BackendRenderbufferObject&) = delete;
|
||||
BackendRenderbufferObject& operator=(const BackendRenderbufferObject&) = delete;
|
||||
void SyncToBackend(const SharedPtr<MG_State::GLState::RenderbufferObject>& stateRBOObject);
|
||||
#if MOBILEGL_PIPE_PUSH
|
||||
// P5e SEAM (declared by c0e, bodied by fb): the renderbuffer twin of the
|
||||
// framebuffer overload above. MGPSurface::Res names the renderbuffer and the
|
||||
// resource record already carries its format, extent and sample count (P4a), so the
|
||||
// attachment sync needs no frontend RenderbufferObject - which is what deletes the
|
||||
// one live identity probe left in the attachment path (Managers.cpp's renderbuffer
|
||||
// cross-check, the sibling that never got the Transport == Monolith gate its
|
||||
// texture counterpart has).
|
||||
void SyncToBackendByHandle(MG_Pipe::MGPipeHandle renderbuffer);
|
||||
#endif
|
||||
Uint GetBackendRenderbufferId() const { return m_backendRBOId; }
|
||||
void Bind() const;
|
||||
|
||||
|
||||
@@ -2023,6 +2023,15 @@ namespace MobileGL::MG_Pipe {
|
||||
// emission gate is the subsystem bit plus the whole-record hash and nothing else.
|
||||
case MGPipeFieldEmitter::SetContextValues:
|
||||
return kMGPipeSubsystemResidualValues;
|
||||
// P5e's one emitted row (MG_Remote/CONTRACT-P5E.md §5.6): the indexed buffer
|
||||
// binding points. Written HERE at the contract commit, with the Coverage.def row
|
||||
// and EmittedCallSuppliesTheWholeField's arm beside it, for the reason
|
||||
// kMGPipeWiredSubsystems' block states one paragraph down - this file belongs to
|
||||
// the contract package for the whole phase, and an emitter enumerator whose
|
||||
// dispatch arm lived in the family's own worktree is the merge trap that block
|
||||
// exists to close. It is inert until that family's wired constant leaves 0.
|
||||
case MGPipeFieldEmitter::SetShaderBuffers:
|
||||
return kMGPipeSubsystemBufferBindings;
|
||||
case MGPipeFieldEmitter::kNone:
|
||||
break;
|
||||
}
|
||||
@@ -2091,6 +2100,15 @@ namespace MobileGL::MG_Pipe {
|
||||
MG_State::GLState::VertexArrayObject::MAX_VERTEX_ATTRIBS,
|
||||
"the MGPipe vertex-attribute capacity and the frontend's have drifted");
|
||||
|
||||
// P5e (MG_Remote/CONTRACT-P5E.md §1, ruling 10), pinned here for the same reason and in
|
||||
// the same place: this translation unit sees the frontend constant and the MG_Pipe one,
|
||||
// and nothing else does. 84 is what the emitter may describe and what the wire carries;
|
||||
// the BACKEND clamps to the device's real GL_MAX_UNIFORM_BUFFER_BINDINGS, as it does
|
||||
// today, because a client-side clamp would read a device capability from the wrong side.
|
||||
static_assert(kMGPipeMaxBufferBindingPoints ==
|
||||
MG_State::GLState::BufferBindingPointCount,
|
||||
"the MGPipe buffer-binding-point capacity and the frontend's have drifted");
|
||||
|
||||
// ---- P4a's SEVEN pairings, and EVERY ONE OF THEM COMPARES AGAINST
|
||||
// SubsystemForEmitter RATHER THAN AGAINST A CONSTANT. That is the lesson written out
|
||||
// twenty lines above and it is not a style preference: naming the subsystem constant
|
||||
@@ -2128,6 +2146,23 @@ namespace MobileGL::MG_Pipe {
|
||||
SubsystemForEmitter(MGPipeFieldEmitter::SetDispatchProgram),
|
||||
"set_draw_program and set_dispatch_program are one family and one A/B");
|
||||
|
||||
// P5e's pairing, in the same shape and for the same reason as P4a's seven: the two maps
|
||||
// answer different questions - one takes a field's EMITTER, the other a dirty BIT - and
|
||||
// the emission is gated on one while the residual-fill skip is gated on the other, so a
|
||||
// divergence would push a call whose field is still pulled, or skip a field whose call
|
||||
// was never emitted. Compared against SubsystemForEmitter rather than against the
|
||||
// constant, because pinning the two MAPS to each other is the statement that cannot
|
||||
// drift.
|
||||
static_assert(MGPipeSubsystemForDirty(MGPipeDirty::NewShaderBuffers) ==
|
||||
SubsystemForEmitter(MGPipeFieldEmitter::SetShaderBuffers),
|
||||
"set_shader_buffers and NEW_SHADER_BUFFERS must name one subsystem");
|
||||
static_assert(MGPipeSubsystemForDirty(MGPipeDirty::NewConstBuffers) ==
|
||||
MGPipeSubsystemForDirty(MGPipeDirty::NewShaderBuffers),
|
||||
"the three binding-point bits are one family and one A/B");
|
||||
static_assert(MGPipeSubsystemForDirty(MGPipeDirty::NewSoTargets) ==
|
||||
MGPipeSubsystemForDirty(MGPipeDirty::NewShaderBuffers),
|
||||
"the three binding-point bits are one family and one A/B");
|
||||
|
||||
// THE TEXTURE-RESOURCE SUBSYSTEM HAS NO DIRTY BIT, and that has to be asserted rather
|
||||
// than left as an absence: its calls are dispatched from the GL entry points that
|
||||
// cause them, so a bit that started naming it would gate the emission twice - once at
|
||||
@@ -2283,6 +2318,13 @@ namespace MobileGL::MG_Pipe {
|
||||
case MGPipeInputField::GetTextureUnitObject:
|
||||
case MGPipeInputField::GetProgramForDraw:
|
||||
case MGPipeInputField::GetProgramForDispatch:
|
||||
// P5e (CONTRACT-P5E.md §5.6): the same answer for the same reason. The field is
|
||||
// four raw bases into the frontend's binding-point table and set_shader_buffers
|
||||
// carries resolved {handle, offset, size} ranges; the applier cannot produce a
|
||||
// pointer, so skipping the pull would leave the mirror null on every draw of every
|
||||
// push build. What retires it is the four Espryt consumers reading the applier's
|
||||
// BoundShaderBuffers, not this row.
|
||||
case MGPipeInputField::GetBufferBindingPoint:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
|
||||
@@ -236,6 +236,23 @@
|
||||
// And GetTextureObject / GetProgramObject are STICKY (see MGP_COVERAGE_STICKY_LIST): they are
|
||||
// keyed by GL name, they are object lookups rather than verb state, and a forwarded field has
|
||||
// no storage for an emitted call to supply.
|
||||
//
|
||||
// P5e ADDS ONE ROW, GetBufferBindingPoint -> SetShaderBuffers (MG_Remote/CONTRACT-P5E.md §5.6),
|
||||
// and it is SHAPE-ONLY like P3a's and P4a's six: the field's storage is four raw bases into the
|
||||
// frontend's Array<Array<BindingSlotRange1D, 84>, 4>, and set_shader_buffers carries RESOLVED
|
||||
// {handle, offset, size} ranges per class. The applier has no way to produce a pointer and P5e
|
||||
// deliberately does not give it one, so the row lands in PipeFill.cpp's
|
||||
// EmittedCallSuppliesTheWholeField FALSE arm and the decision is taken THERE. What retires the
|
||||
// pull is not a better applier, it is the four Espryt consumers reading the applier's
|
||||
// BoundShaderBuffers instead of the frontend's binding points - at which point the
|
||||
// FieldOwnership.def row flips to RECORD_SUPPLIED.
|
||||
//
|
||||
// THE ROW IS INERT AT THIS COMMIT for GetBoundVertexArray's reason one phase on: the emission
|
||||
// and the fill skip both test kMGPipeWiredSubsystems, and the buffer-binding family's wired
|
||||
// constant is 0 until the package that gives MG_Impl/Pipe/ShaderBufferEmit.h its body sets it.
|
||||
// It lands here, with its two PipeFill.cpp switch arms, because this file and that one belong
|
||||
// to the contract package for the whole phase - a family package that had to add an enumerator
|
||||
// AND the arm that dispatches on it would be editing the one file the merge trap lives in.
|
||||
#define MGP_COVERAGE_EMITTED_LIST(X) \
|
||||
X(GetActiveTextureUnit, SetContextValues) \
|
||||
X(GetBlendColor, SetDynamicState) \
|
||||
@@ -243,6 +260,7 @@
|
||||
X(GetBlendFuncIndexed, CreateRenderState) \
|
||||
X(GetBoundTransformFeedbackLifetimeId, SetContextValues) \
|
||||
X(GetBoundVertexArray, BindVertexElements) \
|
||||
X(GetBufferBindingPoint, SetShaderBuffers) \
|
||||
X(GetClampReadColor, SetDynamicState) \
|
||||
X(GetClearColor, SetDynamicState) \
|
||||
X(GetClearDepth, SetDynamicState) \
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
/* no record fallback, and PipeFill.cpp:1902-1905 says outright that what retires the pull */ \
|
||||
/* is P8, not a better applier: the storage is a SharedPtr<VertexArrayObject> and */ \
|
||||
/* bind_vertex_elements carries an eight-byte {slot, gen}. */ \
|
||||
X(GetBoundVertexArray, BARRIER_PULLED, "P8", \
|
||||
X(GetBoundVertexArray, BARRIER_PULLED, "P5e (Espryt unbarriered), P7 (Magma)", \
|
||||
"frontend heap reference; the record carries a handle, the mirror is a pointer") \
|
||||
/* 18 Espryt sites + 11 Magma. Coverage.def:37-70 splits the 15 BufferTargets across three */ \
|
||||
/* calls and leaves SEVEN with no carrier at all (CopyRead, CopyWrite, PixelPack, */ \
|
||||
@@ -77,19 +77,19 @@
|
||||
/* though eight targets are covered. */ \
|
||||
X(GetBufferBindingSlot, BARRIER_PULLED, "P8 (indirect), P9 (readback), P13 (transfer)", \
|
||||
"7 of 15 BufferTargets have no call; the field is one array over all 15") \
|
||||
X(GetBufferBindingPoint, BARRIER_PULLED, "P3b/P4b, P7", \
|
||||
X(GetBufferBindingPoint, BARRIER_PULLED, "P5e (Espryt unbarriered), P7 (Magma)", \
|
||||
"frontend BindingSlotRange1D pointer") \
|
||||
/* 8 Espryt sites through GetFramebufferBindingSlotChecked + 13 Magma. SyncCurrentFBO */ \
|
||||
/* (:2995) is SELF-DECLARED monolith glue (DirectGLES.cpp:2961-2965) while BindCurrentFBO */ \
|
||||
/* (:4303-4353) is already split-clean - the bind is migrated, the sync is not. */ \
|
||||
X(GetFramebufferBindingSlot, BARRIER_PULLED, "P3b/P4b (Espryt), P7 (Magma)", \
|
||||
X(GetFramebufferBindingSlot, BARRIER_PULLED, "P5e (Espryt unbarriered), P7 (Magma)", \
|
||||
"frontend BindingSlot<FramebufferObject> pointer") \
|
||||
X(GetImageTextureBinding, BARRIER_PULLED, "P3b/P4b, P7", \
|
||||
X(GetImageTextureBinding, BARRIER_PULLED, "P5e (Espryt unbarriered), P7 (Magma)", \
|
||||
"frontend ImageTextureBinding base pointer") \
|
||||
X(GetTextureUnitObject, BARRIER_PULLED, "P3b/P4b, P7", \
|
||||
X(GetTextureUnitObject, BARRIER_PULLED, "P5e (Espryt unbarriered), P7 (Magma)", \
|
||||
"frontend TextureUnit base pointer; 13 Espryt + 8 Magma sites") \
|
||||
/* DirectGLES.cpp:4497, PrepareForDraw, the second unconditional pointer read of every draw. */ \
|
||||
X(GetProgramForDraw, BARRIER_PULLED, "P8 (Espryt), P7 (Magma)", \
|
||||
X(GetProgramForDraw, BARRIER_PULLED, "P5e (Espryt unbarriered), P7 (Magma)", \
|
||||
"frontend SharedPtr<ProgramObject>; the record carries a handle") \
|
||||
/* P5b package i1 (CONTRACT-P5B.md §6.9, the one row the contract grants a package). This */ \
|
||||
/* was FATAL "reachable only from kDispatch; there is no compute on the reduced path" - and */ \
|
||||
@@ -97,7 +97,7 @@
|
||||
/* PrepareForCompute pulls this inside it (DirectGLES.cpp:5779, VulkanRenderer.cpp:7327). */ \
|
||||
/* It is GetProgramForDraw's twin in every respect, so it takes its class and its retiring */ \
|
||||
/* phases. Overturned by: nothing in P5b; P7/P8 retire both rows together. */ \
|
||||
X(GetProgramForDispatch, BARRIER_PULLED, "P7 (Magma), P8 (Espryt)", \
|
||||
X(GetProgramForDispatch, BARRIER_PULLED, "P5e (Espryt unbarriered), P7 (Magma)", \
|
||||
"frontend SharedPtr<ProgramObject>; the record carries a handle") \
|
||||
/* The XFB family's one OBJECT row. XFB itself is off the reduced path, but kDraw's */ \
|
||||
/* may-read mask carries it and the draw walk reads it regardless - which is exactly the */ \
|
||||
|
||||
@@ -964,8 +964,23 @@ namespace MobileGL::MG_Pipe {
|
||||
// Var-tail header: MGPBufferRange[Count], then MGHostSpan[HostSpanCount]. HostSpanCount is
|
||||
// 0, or Count for the Uniform class under kCapNeedsHostUboBytes (a range with nothing to
|
||||
// ship carries an empty span, so the two arrays stay index-aligned).
|
||||
// MGPShaderBuffers::Class's three values, and the ONLY spelling of them (P5e,
|
||||
// MG_Remote/CONTRACT-P5E.md §1). The payload's comment has named them since P4a and
|
||||
// nothing numbered them, so the emitter and the applier were one literal each away from
|
||||
// disagreeing. Uniform is 0 so a zeroed record describes the uniform binding points, which
|
||||
// is the class every workload has.
|
||||
//
|
||||
// XFB IS NOT ONE OF THEM: set_stream_output_targets carries a Generation this payload has
|
||||
// no field for and its capture points are span-scoped state latched at Begin, so the
|
||||
// catalogue's split between the two rows stays (§5.7).
|
||||
inline constexpr Uint32 kMGPipeShaderBufferClassUniform = 0;
|
||||
inline constexpr Uint32 kMGPipeShaderBufferClassShaderStorage = 1;
|
||||
inline constexpr Uint32 kMGPipeShaderBufferClassAtomicCounter = 2;
|
||||
inline constexpr Uint32 kMGPipeShaderBufferClassCount = 3;
|
||||
|
||||
struct MGPShaderBuffers {
|
||||
Uint32 Class; // Uniform | ShaderStorage | AtomicCounter
|
||||
Uint32 Class; // MGPipeTypes.h's kMGPipeShaderBufferClass* - Uniform | ShaderStorage |
|
||||
// AtomicCounter
|
||||
Uint32 Start;
|
||||
Uint32 Count;
|
||||
Uint32 WritableMask;
|
||||
|
||||
@@ -1537,6 +1537,13 @@ namespace MobileGL::MG_Pipe {
|
||||
PipeInputs::kBufferTargetCount,
|
||||
"the record's per-target array and PipeInputs' have drifted");
|
||||
MGPipeApplyAccess::SetContextValues(gPipeInputs, values);
|
||||
// P5e (CONTRACT-P5E.md §2.1, escalation (i)): mirror the XFB-active flag into the
|
||||
// applier state as well. The barriered predicate has to be computable on the SERVER
|
||||
// from applier state alone - gPipeInputs is the block the run-ahead client stops
|
||||
// filling, so a predicate that read the answer out of THERE would be reading the very
|
||||
// memory the rule exists to stop it reading. One store, inert until the caps bit is
|
||||
// published, and it is what makes the two roles' third clause the same clause.
|
||||
g_applier.IsTransformFeedbackActive = values.IsTransformFeedbackActive != 0;
|
||||
}
|
||||
|
||||
void MGPipeApplySetPatchState(const MGPPatchState& patch) {
|
||||
@@ -2822,6 +2829,90 @@ namespace MobileGL::MG_Pipe {
|
||||
MGPipeApplierNoteTextureStateMoved();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------
|
||||
// P5e's two entry points, DECLARED AND REFUSED HERE (MG_Remote/CONTRACT-P5E.md §1)
|
||||
// ---------------------------------------------------------------------------------
|
||||
//
|
||||
// Package sb writes the first body and package pg the second. Until then a record that
|
||||
// reached either one would be a binding set the server accepted and dropped, so the answer
|
||||
// is a named abort rather than a quiet return: the picture would be wrong and the lane
|
||||
// would be green, which is the one failure mode this campaign spends its refusals on.
|
||||
//
|
||||
// Neither is reachable today - no route row installs the table slot and the wire decoder's
|
||||
// arms for both opcodes validate and decline (PipeCatalogueTest pins both slots null) - so
|
||||
// this is a link-time seam, not a runtime one.
|
||||
void MGPipeApplySetShaderBuffers(const MGPShaderBuffers& hdr, const MGPBufferRange* tail) {
|
||||
(void)tail;
|
||||
MGLOG_F("MGPipe: Fatal{UnmigratedVerb, \"set_shader_buffers\"} - the applier entry point "
|
||||
"is declared by P5e package c0e and bodied by package sb; a record for class %u "
|
||||
"with %u range(s) reached it, which means a route was installed ahead of its "
|
||||
"consumer",
|
||||
hdr.Class, hdr.Count);
|
||||
std::abort();
|
||||
}
|
||||
|
||||
void MGPipeApplySetProgramBindings(const MGPProgramBindings& hdr, const Int32* blockBindings,
|
||||
const MGPProgramSamplerUnit* samplerUnits,
|
||||
const MGPProgramStorageOverride* storageOverrides,
|
||||
const char* const* storageOverrideNames) {
|
||||
(void)blockBindings;
|
||||
(void)samplerUnits;
|
||||
(void)storageOverrides;
|
||||
(void)storageOverrideNames;
|
||||
MGLOG_F("MGPipe: Fatal{UnmigratedVerb, \"set_program_bindings\"} - the applier entry point "
|
||||
"is declared by P5e package c0e and bodied by package pg; a record for shader CSO "
|
||||
"{%u, %u} with %u/%u/%u tail entries reached it, which means a route was installed "
|
||||
"ahead of its consumer",
|
||||
hdr.Cso.Slot, hdr.Cso.Gen, hdr.BlockBindingCount, hdr.SamplerUnitCount,
|
||||
hdr.StorageOverrideCount);
|
||||
std::abort();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------
|
||||
// P5e: the barriered predicate and the applier's current-record flag (§2.1, §4.4)
|
||||
// ---------------------------------------------------------------------------------
|
||||
|
||||
Bool MGPipeBarriered(MGPWireOp op, const void* payload, const MGPipeApplierState& st) {
|
||||
// 1. The static column. Every reply row, present, and the rows whose apply still pulls
|
||||
// a BARRIER_PULLED field or probes the client allocator.
|
||||
if (MGPipeWaitClassFor(op) != kWaitNone) return true;
|
||||
// 2. Escalation (i): an open transform-feedback span makes every verb inside it
|
||||
// barriered. XFB is not migrated by P5e - StartPendingTransformFeedback holds
|
||||
// frontend SharedPtrs across two verbs, which rule C forbids an applier entry point
|
||||
// outright - so the span keeps P5C's semantics and the cost on the steady Espryt
|
||||
// path is one bool test per draw.
|
||||
if (MGPipeCallClassFor(op) == kCtxVerb && st.IsTransformFeedbackActive) return true;
|
||||
// 3. Escalation (ii): a draw whose enabled attributes include a client-memory array.
|
||||
// The server uploads those bytes by dereferencing a raw client pointer, so the draw
|
||||
// cannot run ahead. Under run-ahead the client refuses it before it is published
|
||||
// (§5.1), so this clause is what the LOCKSTEP arm - where the draw is legal - uses.
|
||||
if (op == MGPWireOp::DrawVbo && payload != nullptr) {
|
||||
const auto& draw = *static_cast<const MGPDrawInfo*>(payload);
|
||||
if ((draw.Flags & static_cast<Uint8>(kDrawClientArrays)) != 0) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Server-private and deliberately NOT a member of MGPipeApplierState: it is not per-context
|
||||
// state the applier owns, it is "which record is the apply thread inside right now", and a
|
||||
// reader (the allocator guard) that had to find the right context's applier first would be
|
||||
// asking a harder question than the one it needs answered.
|
||||
//
|
||||
// TRUE IS THE DEFAULT AND THE LOCKSTEP ANSWER. On a server that does not publish
|
||||
// kCapRunAheadApply every record is barriered, the client is parked in its own wait for
|
||||
// each of them, and the two named exemption scopes of CONTRACT-P5C §3.1 keep working
|
||||
// exactly as they do today. Nothing writes this until package id sets it from
|
||||
// MGPipeBarriered in the sink's ApplyOne.
|
||||
namespace {
|
||||
thread_local Bool g_currentRecordBarriered = true;
|
||||
} // namespace
|
||||
|
||||
Bool MGPipeApplierCurrentRecordIsBarriered() { return g_currentRecordBarriered; }
|
||||
|
||||
void MGPipeApplierSetCurrentRecordBarriered(Bool barriered) {
|
||||
g_currentRecordBarriered = barriered;
|
||||
}
|
||||
|
||||
// ================================================================================
|
||||
// w3: the shader CSO, the two program bindings and the default uniform block
|
||||
//
|
||||
|
||||
@@ -11,6 +11,10 @@
|
||||
|
||||
#include "MGPipeRenderStateSpans.h"
|
||||
#include "MGPipeTypes.h"
|
||||
// P5e (MG_Remote/CONTRACT-P5E.md §2.1): MGPipeBarriered takes an MGPWireOp and reads the
|
||||
// generated wait-class and call-class tables, all of which live in MGPipe.h. It is a sibling
|
||||
// header in the same layer - MG_Pipe includes MG_Pipe - so the closure does not move.
|
||||
#include "MGPipe.h"
|
||||
|
||||
// The in-process applier: the SERVER half of the calls P2 emits. Under split this file is
|
||||
// MG_Remote/Server/PipeApplier (ARCHITECTURE.md 8.3); in the monolith it writes
|
||||
@@ -367,6 +371,16 @@ namespace MobileGL::MG_Pipe {
|
||||
// GlobalConstants is the one allocation P4a adds per program, it is bounded by
|
||||
// Desc.GlobalUboSize, and it is NOT on the hot path: set_global_constants is
|
||||
// (ShaderCso, Version) keyed and fires at most once per program per frame.
|
||||
// P5e (MG_Remote/CONTRACT-P5E.md §1): one entry of set_program_bindings' third tail as the
|
||||
// RECORD owns it. The wire carries the block name as an MGHostSpan into SEG_STAGE, which
|
||||
// retires with the record that named it (rule C), so the applier copies the bytes here
|
||||
// rather than keeping the span: a rebuild happens at the next bind, which may be a frame
|
||||
// later, and by then the staged run is somebody else's.
|
||||
struct MGPipeProgramStorageOverride {
|
||||
String Name;
|
||||
Int32 Binding = 0;
|
||||
};
|
||||
|
||||
struct MGPipeShaderCsoRecord {
|
||||
Uint32 Gen = 0;
|
||||
Bool Live = false;
|
||||
@@ -377,6 +391,31 @@ namespace MobileGL::MG_Pipe {
|
||||
Vector<Uint8> GlobalConstants;
|
||||
Uint64 GlobalConstantsSerial = 0;
|
||||
Uint64 Serial = 0;
|
||||
|
||||
// ---- P5e's set_program_bindings tails (CONTRACT-P5E.md §1, §5.5) -------------------
|
||||
//
|
||||
// DECLARED BY c0e, FILLED BY PACKAGE pg. THE THREE POST-LINK MUTABLE REFLECTION FIELDS
|
||||
// the archive cannot answer: glUniformBlockBinding, glUniform1i on a sampler uniform and
|
||||
// glShaderStorageBlockBinding all move a binding INSIDE the frontend's LinkArtifacts
|
||||
// after the link, so a twin that answered a draw from the archive alone would bind the
|
||||
// uniform blocks the program was LINKED with rather than the ones it is BOUND with.
|
||||
//
|
||||
// A RE-ISSUED create_shader_state CLEARS ALL OF THEM, for the reason it clears
|
||||
// GlobalConstants: a relink replaces the archive these index into, so a surviving tail
|
||||
// would name block indices and uniform locations of a program that no longer exists.
|
||||
// The client re-emits set_program_bindings before the create that describes the relink.
|
||||
Vector<Int32> BlockBindings; // dense, GL uniform-block index order
|
||||
Vector<MGPProgramSamplerUnit> SamplerUnits; // sparse, ascending Location
|
||||
Vector<MGPipeProgramStorageOverride> StorageOverrides; // name-keyed by design
|
||||
// The client's commutative hash of the override MAP, so the twin's "must I rebuild the
|
||||
// storage-block bindings" clause is one Uint64 compare and the name tail is touched only
|
||||
// on a rebuild. 0 is "no overrides", which is what an untouched program has.
|
||||
Uint64 Signature = 0;
|
||||
// Server-owned MGGen, ++ on every applied set_program_bindings for this record. It is
|
||||
// what the program twin's clean condition and both texture-unit memos key on (ruling 6),
|
||||
// so it obeys VertexBuffersSerial's rule: ADVANCED, never returned to a value it has
|
||||
// already handed out.
|
||||
Uint64 BindingsSerial = 0;
|
||||
};
|
||||
|
||||
// The vertex-elements CSO as the applier holds it: the unpacked blob, both views, plus
|
||||
@@ -693,6 +732,42 @@ namespace MobileGL::MG_Pipe {
|
||||
MGPipeHandle BoundShaderCso = kMGPipeNullHandle;
|
||||
Uint64 ProgramBindingSerial = 0;
|
||||
|
||||
// ---- P5e: THE INDEXED BUFFER BINDING POINTS (CONTRACT-P5E.md §5.6, rulings 10/11) ---
|
||||
//
|
||||
// DECLARED BY c0e, FILLED BY PACKAGE sb. One window per CLASS, because the record is
|
||||
// per class - a set_shader_buffers names Uniform, ShaderStorage or AtomicCounter and
|
||||
// describes THAT target's array. XFB does NOT ride this state: its targets are span-
|
||||
// scoped and carry a Generation this payload has no field for, so set_stream_output_
|
||||
// targets keeps its own row and XFB stays lockstep (§5.7).
|
||||
//
|
||||
// THE VAR-TAIL WINDOW IS THE BOUND, exactly as it is for the three unit sets above:
|
||||
// Start is 0 by contract, Count is the touched high-water mark, and a binding at or
|
||||
// above Count means "nothing bound" - which is what the frontend array's default says
|
||||
// too, so the server does not have to clear entries outside the window to be right.
|
||||
Array<MGPBufferRange, kMGPipeMaxBufferBindingPoints>
|
||||
BoundShaderBuffers[kMGPipeShaderBufferClassCount]{};
|
||||
Uint32 ShaderBufferStart[kMGPipeShaderBufferClassCount] = {0, 0, 0};
|
||||
Uint32 ShaderBufferCount[kMGPipeShaderBufferClassCount] = {0, 0, 0};
|
||||
// Which entries of classes 1 and 2 the shader may WRITE through. It is what replaces
|
||||
// the backend's own GPU-write marking walk (DirectGLES.cpp's three MarkBufferGpuWritten
|
||||
// sites), which sb deletes under a transport because the client already owns the
|
||||
// GPU-write set and the server's walk is over client memory.
|
||||
Uint32 ShaderBufferWritableMask[kMGPipeShaderBufferClassCount] = {0, 0, 0};
|
||||
// ONE serial for all three classes, ++ on every applied record and ADVANCED (never
|
||||
// zeroed) by MGPipeApplierReset, for VertexBuffersSerial's reason - and the emitter's
|
||||
// latch resets with it, or the first emission after a make-current is suppressed as
|
||||
// unchanged.
|
||||
Uint64 ShaderBuffersSerial = 0;
|
||||
|
||||
// ---- P5e: the applied value the barriered predicate's XFB escalation reads ---------
|
||||
//
|
||||
// MGPContextValues::IsTransformFeedbackActive as set_context_values last delivered it.
|
||||
// It is mirrored HERE, beside the applier's other working state, and not only written
|
||||
// into gPipeInputs, because MGPipeBarriered must be computable on the SERVER from
|
||||
// applier state alone: the record that carries it precedes the verb on the ring, so
|
||||
// both roles evaluate the same predicate over the same value (§2.1, escalation (i)).
|
||||
Bool IsTransformFeedbackActive = false;
|
||||
|
||||
// ---- P5c (rv, CONTRACT-P5C.md §5.3): the server-side answer for the three texture
|
||||
// SHUTTERS. FieldOwnership.def moves GetSamplingResolutionGeneration /
|
||||
// GetTextureBindGeneration / GetTextureContextId to APPLIER_DERIVED - "a shutter, not
|
||||
@@ -782,6 +857,53 @@ namespace MobileGL::MG_Pipe {
|
||||
// The monolith's single applier. Under split there is one per served context.
|
||||
MGPipeApplierState& MGPipeApplier();
|
||||
|
||||
// ---------------------------------------------------------------------------------
|
||||
// P5e: THE BARRIERED PREDICATE (MG_Remote/CONTRACT-P5E.md §2.1, ruling 3)
|
||||
// ---------------------------------------------------------------------------------
|
||||
//
|
||||
// ONE FUNCTION, TWO CALLERS, AND THAT IS THE WHOLE POINT. The client calls it at the emit
|
||||
// table to decide whether to wait after publishing; the sink calls it in ApplyOne to decide
|
||||
// whether the record it is about to apply may read client memory. If the two answers ever
|
||||
// differ the failure is silent: the client runs on while the server reads a value that has
|
||||
// already moved. So it is a PURE FUNCTION OF WIRE-VISIBLE DATA - the static wait-class
|
||||
// column, the record's own payload, and applier state that a record earlier on the ring put
|
||||
// there - and both roles evaluate the same three clauses:
|
||||
//
|
||||
// 1. MGPipeWaitClassFor(op) != kWaitNone the static column (§2.2)
|
||||
// 2. kCtxVerb with an open transform-feedback span escalation (i): XFB stays lockstep
|
||||
// 3. draw_vbo carrying kDrawClientArrays escalation (ii): client vertex arrays
|
||||
//
|
||||
// NO OTHER RUNTIME ESCALATION EXISTS. Adding one is an integrator ruling and a row in the
|
||||
// contract, not a condition somebody adds at a call site - because a fourth clause that only
|
||||
// one side computes is the same silent failure one level down.
|
||||
//
|
||||
// Escalation (ii) is a REFUSAL under run-ahead (§5.1), so on a run-ahead server it never
|
||||
// reaches the sink at all; it is here so the predicate is TOTAL and so the lockstep arm,
|
||||
// where such a draw is legal, gets the barrier it needs.
|
||||
//
|
||||
// `payload` may be null, which answers "the fixed payload is not available here" and makes
|
||||
// clause 3 fall through - a caller that has an opcode but no bytes (the emit table before it
|
||||
// has built the record) must not be told a draw is unbarriered on that account, so DrawVbo
|
||||
// with a null payload is treated as carrying no client arrays and the emit site passes the
|
||||
// real MGPDrawInfo it is about to publish.
|
||||
Bool MGPipeBarriered(MGPWireOp op, const void* payload, const MGPipeApplierState& st);
|
||||
|
||||
// Whether the record the apply thread is INSIDE is a barriered one. Server-private: written
|
||||
// by the sink's ApplyOne from MGPipeBarriered before it dispatches, read by
|
||||
// MGPipeRefuseAllocatorFromApplyThread (§4.4) to decide whether a frontend-keyed registry
|
||||
// probe is a named, accounted debt or a role violation.
|
||||
//
|
||||
// IT ANSWERS `true` BY DEFAULT AND THAT IS THE LANDED LOCKSTEP ANSWER, not a stub: on a
|
||||
// server that does not publish kCapRunAheadApply - Magma always, and Espryt until the
|
||||
// integration commit - EVERY record is barriered, the client is parked in its own wait for
|
||||
// each of them, and P5C's semantics hold unchanged. An asserting body here would abort the
|
||||
// monolith and the lockstep split alike, which is why this one seam is implemented rather
|
||||
// than declared: the safe answer and the correct answer are the same answer.
|
||||
Bool MGPipeApplierCurrentRecordIsBarriered();
|
||||
// The one writer, called by the sink at the top of every record's dispatch. Package id owns
|
||||
// the call site (it is the line ra rebases onto); c0e owns the storage so both compile.
|
||||
void MGPipeApplierSetCurrentRecordBarriered(Bool barriered);
|
||||
|
||||
// P5c (rv): the two serials the PipeInputs texture-shutter accessors answer with under a
|
||||
// server-stamped verb (FieldOwnership.def, APPLIER_DERIVED). Free functions rather than
|
||||
// member reads so PipeInputs.h needs this header's DECLARATIONS only... and because the
|
||||
@@ -1145,6 +1267,37 @@ namespace MobileGL::MG_Pipe {
|
||||
void MGPipeApplyBindSamplerStates(const MGPSamplerStates& hdr, const MGPipeHandle* tail);
|
||||
void MGPipeApplySetShaderImages(const MGPShaderImages& hdr, const MGPImageView* tail);
|
||||
|
||||
// ---------------------------------------------------------------------------------
|
||||
// P5e's two entry points: DECLARED BY c0e, BODIED BY sb AND pg
|
||||
// ---------------------------------------------------------------------------------
|
||||
//
|
||||
// Both are declared here, with bodies in PipeApply.cpp that ABORT BY NAME, so that every
|
||||
// P5e package compiles and links against the same signatures from day one and the family
|
||||
// that lands one of them changes a body rather than adding a symbol. An abort and not a
|
||||
// silent no-op: a record that reached an unimplemented applier and returned quietly is a
|
||||
// dropped binding set, which renders wrong rather than stopping - the exact failure mode
|
||||
// ID-39's sixty-six lost uploads had. Nothing routes either opcode until its package lands
|
||||
// (PipeCatalogueTest pins both table slots null), so the abort is unreachable today.
|
||||
|
||||
// set_shader_buffers, per Class. `tail` is hdr.Count MGPBufferRanges starting at hdr.Start;
|
||||
// Class >= kMGPipeShaderBufferClassCount and Start + Count above the capacity are
|
||||
// Fatal{ProtocolCorruption, "SetShaderBuffers.Class"} / "SetShaderBuffers.Count". Entries
|
||||
// outside the declared window are NOT cleared - the record is "the last set as received",
|
||||
// exactly as set_vertex_buffers is.
|
||||
void MGPipeApplySetShaderBuffers(const MGPShaderBuffers& hdr, const MGPBufferRange* tail);
|
||||
|
||||
// set_program_bindings. The three tails in the order the record declares them, plus the
|
||||
// RESOLVED block names for the override tail: the names ride SEG_STAGE as host spans and
|
||||
// SEG_STAGE retires with the record that named them, so the applier must copy them into the
|
||||
// record before this call returns (rule C) and the decoder hands over pointers that are
|
||||
// valid only for the duration of the call. `storageOverrideNames[i]` belongs to
|
||||
// `storageOverrides[i]`, NUL-terminated, exactly as set_storage_block_binding's single name
|
||||
// is. Any of the four pointers may be null when its count is 0.
|
||||
void MGPipeApplySetProgramBindings(const MGPProgramBindings& hdr, const Int32* blockBindings,
|
||||
const MGPProgramSamplerUnit* samplerUnits,
|
||||
const MGPProgramStorageOverride* storageOverrides,
|
||||
const char* const* storageOverrideNames);
|
||||
|
||||
// create_shader_state. THE ARTEFACTS TRAVEL BESIDE THE RECORD, by pointer: all seven of
|
||||
// desc.Spirv[] and desc.Reflection are declared with Size 0 ("this record does not declare
|
||||
// its blob"), which is what a monolith emission is, and the codec is NOT called - zero
|
||||
|
||||
@@ -106,9 +106,9 @@ inline constexpr const char* kMGPipeFieldRetiringPhase[kMGPipeInputFieldCount] =
|
||||
"-", // GetBlendEquationIndexed
|
||||
"-", // GetBlendFuncIndexed
|
||||
"-", // GetBoundTransformFeedbackName
|
||||
"P8", // GetBoundVertexArray
|
||||
"P5e (Espryt unbarriered), P7 (Magma)", // GetBoundVertexArray
|
||||
"P8 (indirect), P9 (readback), P13 (transfer)", // GetBufferBindingSlot
|
||||
"P3b/P4b, P7", // GetBufferBindingPoint
|
||||
"P5e (Espryt unbarriered), P7 (Magma)", // GetBufferBindingPoint
|
||||
"P7/P13", // GetBufferBindingPointCount
|
||||
"-", // GetTouchedBufferBindingPointCount
|
||||
"-", // GetClampReadColor
|
||||
@@ -121,8 +121,8 @@ inline constexpr const char* kMGPipeFieldRetiringPhase[kMGPipeInputFieldCount] =
|
||||
"-", // GetDepthFunc
|
||||
"-", // GetDepthMask
|
||||
"-", // GetDepthRangeIndexed
|
||||
"P3b/P4b (Espryt), P7 (Magma)", // GetFramebufferBindingSlot
|
||||
"P3b/P4b, P7", // GetImageTextureBinding
|
||||
"P5e (Espryt unbarriered), P7 (Magma)", // GetFramebufferBindingSlot
|
||||
"P5e (Espryt unbarriered), P7 (Magma)", // GetImageTextureBinding
|
||||
"-", // GetLineWidth
|
||||
"-", // GetLogicOp
|
||||
"-", // GetMaxTouchedTextureUnit
|
||||
@@ -136,8 +136,8 @@ inline constexpr const char* kMGPipeFieldRetiringPhase[kMGPipeInputFieldCount] =
|
||||
"-", // GetPolygonOffsetFactor
|
||||
"-", // GetPolygonOffsetUnits
|
||||
"-", // GetPrimitiveRestartIndex
|
||||
"P7 (Magma), P8 (Espryt)", // GetProgramForDispatch
|
||||
"P8 (Espryt), P7 (Magma)", // GetProgramForDraw
|
||||
"P5e (Espryt unbarriered), P7 (Magma)", // GetProgramForDispatch
|
||||
"P5e (Espryt unbarriered), P7 (Magma)", // GetProgramForDraw
|
||||
"P9", // GetProgramObject
|
||||
"-", // GetProvokingVertexMode
|
||||
"-", // GetRenderStateParameters
|
||||
@@ -148,7 +148,7 @@ inline constexpr const char* kMGPipeFieldRetiringPhase[kMGPipeInputFieldCount] =
|
||||
"-", // GetTextureBindGeneration
|
||||
"-", // GetTextureContextId
|
||||
"P7", // GetTextureObject
|
||||
"P3b/P4b, P7", // GetTextureUnitObject
|
||||
"P5e (Espryt unbarriered), P7 (Magma)", // GetTextureUnitObject
|
||||
"-", // GetTransformFeedbackCapturedVertices
|
||||
"-", // GetTransformFeedbackGeneration
|
||||
"-", // GetTransformFeedbackPausedPrimitiveCounter
|
||||
|
||||
@@ -315,6 +315,7 @@ enum class MGPipeFieldEmitter : Uint8 {
|
||||
SetFramebufferState,
|
||||
SetPatchState,
|
||||
SetSamplerViews,
|
||||
SetShaderBuffers,
|
||||
SetShaderImages,
|
||||
SetVertexAttribDefaults,
|
||||
};
|
||||
@@ -331,6 +332,7 @@ inline constexpr const char* kMGPipeFieldEmitterNames[] = {
|
||||
"SetFramebufferState",
|
||||
"SetPatchState",
|
||||
"SetSamplerViews",
|
||||
"SetShaderBuffers",
|
||||
"SetShaderImages",
|
||||
"SetVertexAttribDefaults",
|
||||
};
|
||||
@@ -343,7 +345,7 @@ inline constexpr MGPipeFieldEmitter kMGPipeFieldEmittedBy[kMGPipeInputFieldCount
|
||||
MGPipeFieldEmitter::kNone, // GetBoundTransformFeedbackName
|
||||
MGPipeFieldEmitter::BindVertexElements, // GetBoundVertexArray
|
||||
MGPipeFieldEmitter::kNone, // GetBufferBindingSlot
|
||||
MGPipeFieldEmitter::kNone, // GetBufferBindingPoint
|
||||
MGPipeFieldEmitter::SetShaderBuffers, // GetBufferBindingPoint
|
||||
MGPipeFieldEmitter::kNone, // GetBufferBindingPointCount
|
||||
MGPipeFieldEmitter::SetContextValues, // GetTouchedBufferBindingPointCount
|
||||
MGPipeFieldEmitter::SetDynamicState, // GetClampReadColor
|
||||
@@ -400,7 +402,7 @@ inline constexpr MGPipeFieldEmitter kMGPipeFieldEmittedBy[kMGPipeInputFieldCount
|
||||
MGPipeFieldEmitter::SetContextValues, // GetBoundTransformFeedbackLifetimeId
|
||||
MGPipeFieldEmitter::kNone, // HasOpenTransformFeedbackSpan
|
||||
};
|
||||
inline constexpr SizeT kMGPipeEmittedFieldCount = 47;
|
||||
inline constexpr SizeT kMGPipeEmittedFieldCount = 48;
|
||||
|
||||
struct MGPipeFilledState {
|
||||
Uint64 CurrentVerbSerial;
|
||||
|
||||
@@ -734,8 +734,13 @@ TEST_F(FieldOwnershipTest, StrictErrorsTurnsABarrierPulledReadIntoANamedAbort) {
|
||||
EXPECT_NE(r.Log.find("BARRIER-PULLED"), std::string::npos) << r.Log;
|
||||
EXPECT_NE(r.Log.find("MOBILEGL_IPC_STRICT_ERRORS=1"), std::string::npos) << r.Log;
|
||||
// The strict line names the phase that owes the answer; a strict abort that did not would
|
||||
// leave the reader exactly where the gate found them.
|
||||
EXPECT_NE(r.Log.find("retires in P8]"), std::string::npos) << r.Log;
|
||||
// leave the reader exactly where the gate found them. P5e re-annotated this row (and the
|
||||
// five object-class rows beside it) from "P8" to the phase that actually retires the pull,
|
||||
// which is why the expected text moved with FieldOwnership.def rather than the case being
|
||||
// re-pointed at another field: the string IS the debt entry, read out of the generated
|
||||
// table, and a case that stopped checking it would let the annotation rot.
|
||||
EXPECT_NE(r.Log.find("retires in P5e (Espryt unbarriered), P7 (Magma)]"), std::string::npos)
|
||||
<< r.Log;
|
||||
}
|
||||
|
||||
TEST_F(FieldOwnershipTest, TheSameReadWithoutStrictErrorsSurvivesAndIsCounted) {
|
||||
|
||||
@@ -702,9 +702,15 @@ def self_test():
|
||||
"the field set (%d of %d)" % (total, len(accessors)))
|
||||
if len(sticky) != 7:
|
||||
sys.exit("gen_pipe_field_ownership: self-test: Coverage.def no longer has seven sticky fields")
|
||||
if len(refused) != 7:
|
||||
# EIGHT SINCE P5e (MG_Remote/CONTRACT-P5E.md 5.6): GetBufferBindingPoint joined the seven
|
||||
# when set_shader_buffers got its Coverage.def emitted row. The number is pinned rather
|
||||
# than merely derived because it is the SIZE OF THE SHAPE-ONLY SET - the rows where an
|
||||
# emitted call exists and still does not supply the field - and a row that quietly left
|
||||
# that set would flip to RECORD_SUPPLIED and let the residual fill skip a pull nothing
|
||||
# replaces. Every addition to it is a phase's deliberate act, so it is spelled here.
|
||||
if len(refused) != 8:
|
||||
sys.exit("gen_pipe_field_ownership: self-test: EmittedCallSuppliesTheWholeField refuses %d "
|
||||
"fields, not the seven the contract's derivation is written against" % len(refused))
|
||||
"fields, not the eight the contract's derivation is written against" % len(refused))
|
||||
if trips == 0:
|
||||
sys.exit("gen_pipe_field_ownership: self-test: no negative control tripped - the gates are "
|
||||
"not checking anything")
|
||||
@@ -713,7 +719,7 @@ def self_test():
|
||||
% (len(controls) - trips, len(controls)))
|
||||
print("gen_pipe_field_ownership: self-test: %d negative-control trip(s), each asserted against "
|
||||
"its OWN message; harness control OK; positive control OK "
|
||||
"(%d fields partitioned, 7 sticky forwards, 7 refusals)" % (trips, total))
|
||||
"(%d fields partitioned, 7 sticky forwards, 8 refusals)" % (trips, total))
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user