[Feat] (P13 W4b/W4c): Espryt monolith takes the record arm for textures, readbacks, framebuffers, units, images, programs and XFB

This commit is contained in:
2026-10-06 08:14:54 -04:00
parent a7409e1e9a
commit 2af4728e70
22 changed files with 520 additions and 187 deletions
+10
View File
@@ -3946,6 +3946,16 @@ namespace MobileGL::MG_Pipe {
// build would turn 1117 integration cases red for running code that is correct in the role
// they run it in. None of the five is on P5's reduced path, so under a real transport this
// costs nothing and catches a lot.
namespace {
thread_local Bool tl_serverOriginatedWrite = false;
} // namespace
Bool MGPipeApplyingServerOriginatedWrite() { return tl_serverOriginatedWrite; }
MGPipeServerOriginatedWriteScope::MGPipeServerOriginatedWriteScope() : m_previous(tl_serverOriginatedWrite) {
tl_serverOriginatedWrite = true;
}
MGPipeServerOriginatedWriteScope::~MGPipeServerOriginatedWriteScope() { tl_serverOriginatedWrite = m_previous; }
void MGPipeUnmigratedEmulation(const char* name) {
#if MOBILEGL_BUILD_DISAGGREGATED
if (MG_Config::Transport != MG_Config::TransportMode::Monolith) {
+19
View File
@@ -1440,6 +1440,25 @@ namespace MobileGL::MG_Pipe {
// name a TEXTURE target: Buffer, Renderbuffer and anything at or above
// MGPipeResourceTarget::Count are Fatal{ProtocolCorruption} rather than an upload onto
// whatever object holds that slot in the texture slot space.
// P13 W4b: A WRITE THE SERVER PRODUCED, going through the ordinary resource_subdata gate - the
// pack-buffer landing of a readback (PipeApplier.cpp LandReadbackInBuffer) is the one producer.
// Its bytes are the server's own scratch and live for the call only, so a store that ALIASES
// the frontend's shadow (monolith's record arm) must not take them as its base: it lands them
// in the GL store and marks it GPU-written instead, which is how the frontend and every CPU
// reader learn of them (SyncGpuWrites / SplitHostBytesForCpuRead). A copying store takes them
// as it always has. Thread-local; scoped by the producer.
Bool MGPipeApplyingServerOriginatedWrite();
class MGPipeServerOriginatedWriteScope {
public:
MGPipeServerOriginatedWriteScope();
~MGPipeServerOriginatedWriteScope();
MGPipeServerOriginatedWriteScope(const MGPipeServerOriginatedWriteScope&) = delete;
MGPipeServerOriginatedWriteScope& operator=(const MGPipeServerOriginatedWriteScope&) = delete;
private:
Bool m_previous;
};
Bool MGPipeApplyResourceSubData(const MGPSubData& record, const void* bytes,
const MGPSubRegion* regions = nullptr);
// buffer_subdata_resident: same shape; `bytes` is the application's staging store and is
+17
View File
@@ -32,6 +32,8 @@
#include <MG_Util/Debug/Log.h>
#include <Config.h>
#include <MG_State/GLState/ProgramState/ProgramArtifactsCodec.h>
#include <cstdint>
#include <cstdlib>
@@ -308,6 +310,21 @@ namespace MobileGL::MG_Pipe {
// 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.
#if MOBILEGL_BUILD_DISAGGREGATED
// P13 W4c: MONOLITH'S RECORD ARM READS THE RECORD'S ARCHIVE (ProgramHandleArm), so it
// gets one: the link's snapshot, taken here, once per link - the same thing the wire
// decodes into the record, without the codec. A copy rather than a borrow, because the
// record is a snapshot of THIS link and the frontend object's artefacts are replaced
// by the next one while the record may still be in use.
if (MG_Config::RecordArmAliasesFrontend() && link != nullptr && spirv != nullptr) {
auto archive = MakeShared<MG_State::GLState::ProgramArchive>();
archive->Link = *link;
archive->Spirv = *spirv;
if (linkedStages != nullptr) archive->LinkedStages.assign(linkedStages, linkedStages + linkedStageCount);
MGPipeApplyCreateShaderState(*desc, link, spirv, std::move(archive));
return;
}
#endif
(void)linkedStages;
(void)linkedStageCount;
// P5e (pg): NO ARCHIVE ON THIS ARM, and the null is the arm selection rather than a