mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-20 08:21:56 +09:00
[MG_Backend, MG_State, scripts] (P7): retire the texture legacy-arm scope and tag the p7-magma remainder P13
This commit is contained in:
@@ -1807,8 +1807,8 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
// SyncTexture reads the frontend ITextureObject: the target, the format, the level
|
||||
// chain, the dirty scan and - through UploadDirtyMipLevels - the CLIENT's mip shadow
|
||||
// texels. Under an active transport none of that memory is the server's to read
|
||||
// (rule E), which is exactly what Magma's texture-legacy-arm scope has been waiving
|
||||
// since P5c. This arm is the same sync re-sourced: the SHAPE comes from the applier's
|
||||
// (rule E), which is exactly what Magma's texture-legacy-arm scope waived from P5c until
|
||||
// P7 retired it (SyncTexture). This arm is the same sync re-sourced: the SHAPE comes from the applier's
|
||||
// resource record (MGPipeApplier().TextureResources - the resource_create /
|
||||
// resource_respecify descriptors), the TEXELS from the server's staged-texture store
|
||||
// (P5c tx, adopted at apply time), and the WHICH-LEVELS from the record's
|
||||
@@ -2958,16 +2958,16 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
|
||||
Bool VkTextureManager::SyncTexture(MG_State::GLState::ITextureObject &texture,
|
||||
TextureResource &outResource) {
|
||||
#if MOBILEGL_BUILD_DISAGGREGATED
|
||||
// P5c (gt): Magma's texture sync still reads - and clears - the CLIENT's mip shadow:
|
||||
// the dirty scan below, and UploadDirtyMipLevels' texel reads / region reads /
|
||||
// MarkStorageDirty(false) clears. CONTRACT-P5C §2 migrated Espryt's sync and Magma's
|
||||
// T5 writes, and left THIS path on the legacy arm; under the verb barrier and one
|
||||
// address space the reads answer correctly, and the migration is P7's server-side
|
||||
// sync. The scope is the debt's greppable form (MipmapStorage.h); outside it the
|
||||
// layer-1 guard still aborts.
|
||||
const MG_State::GLState::MGPipeTextureLegacyArmScope textureLegacyArm;
|
||||
#endif
|
||||
// This is the FRONTEND-object sync: it reads - and clears - the client's mip shadow (the
|
||||
// dirty scan below, UploadDirtyMipLevels' texel / region reads and MarkStorageDirty(false)
|
||||
// clears), so it belongs to the monolith arm only. Under an active transport every wire
|
||||
// verb syncs through the handle-keyed arm (SyncTextureResourceByHandle, and the sampled
|
||||
// wire descriptors in UniformManager) from the applier's record and the staged-texture
|
||||
// store. P5c's named exemption for this function (MGPipeTextureLegacyArmScope) was retired
|
||||
// in P7 (ratchet88) once a probe proved it never armed on the apply thread; a regression
|
||||
// now meets the layer-1 guard (Fatal{RoleViolation, "texture-legacy-arm"},
|
||||
// MipmapStorage.cpp) by accessor name. This block is exactly as many lines as the one it
|
||||
// replaced: __LINE__ reaches this file's pull .text, and G1 compares the bytes.
|
||||
// Cross-draw fast path: if the resource is already built and neither the texture's
|
||||
// pixel content (bumped in MarkStorageDirty), its SHAPE (bumped in BumpShapeVersion)
|
||||
// nor its params changed since the last sync, there is nothing to re-check or
|
||||
|
||||
@@ -49,14 +49,22 @@ namespace MobileGL {
|
||||
// instead of rendering from client memory.
|
||||
//
|
||||
// A client-thread caller is unaffected (this is the frontend's own state, and the
|
||||
// guard returns unless ServerLoop::OnApplyThread()); Magma's texture sync keeps
|
||||
// its named scope exemption; the pull build compiles none of it.
|
||||
// guard returns unless ServerLoop::OnApplyThread()); the pull build compiles none
|
||||
// of it.
|
||||
//
|
||||
// P7 (ratchet88): NO EXEMPTION IS LEFT. P5c gave Magma's texture sync a named
|
||||
// scope (MGPipeTextureLegacyArmScope) that waived this guard around
|
||||
// VkTextureManager::SyncTexture on the apply thread. Since P5f's handle-keyed arm
|
||||
// the wire draw, blit, copy, clear, mipmap and readback verbs sync from the
|
||||
// applier's resource record and the staged-texture store, and SyncTexture - the
|
||||
// frontend-object sync - is monolith-only: a probe that aborted whenever the scope
|
||||
// armed on the apply thread stayed silent across the Magma split / spawn / tcp
|
||||
// lanes and their full-binary variants. The scope was retired with it, so a
|
||||
// regression that routes a wire verb back through the frontend object aborts
|
||||
// here BY ACCESSOR NAME rather than being waived.
|
||||
void RefuseLegacyTextureArmFromApplyThread(const char* surface) {
|
||||
if (MG_Config::Transport == MG_Config::TransportMode::Monolith) return;
|
||||
if (!MG_Remote::Server::ServerLoop::OnApplyThread()) return;
|
||||
// The named exemption (MipmapStorage.h): Magma's texture sync is tx's
|
||||
// declared leftover and retires with P7.
|
||||
if (MGPipeTextureLegacyArmScope::ActiveOnApplyThread()) return;
|
||||
MGLOG_F("MGPipe: Fatal{RoleViolation, \"texture-legacy-arm\"} - the apply thread "
|
||||
"called TextureObjectMipmap::%s on a frontend object. With an active "
|
||||
"transport the server reads the staged-texture store and the resource "
|
||||
@@ -98,34 +106,6 @@ namespace MobileGL {
|
||||
}
|
||||
} // namespace
|
||||
|
||||
#if MOBILEGL_BUILD_DISAGGREGATED
|
||||
namespace {
|
||||
// NOT thread_local (P5d round 3, package D), for hd's reason in
|
||||
// MG_Impl/Pipe/SlotAllocator.cpp: RefuseLegacyTextureArmFromApplyThread above
|
||||
// is this counter's ONLY reader in the tree and it returns before it looks
|
||||
// unless the transport is active and ServerLoop::OnApplyThread() is true, so
|
||||
// the apply thread is the only thread whose depth could change an answer. The
|
||||
// scope below therefore counts only there, which makes the apply thread the
|
||||
// single writer and the single reader - no race to defend, and no
|
||||
// __emutls_get_address call per access (7.4% of the apply thread, 7.7% and the
|
||||
// top symbol on the monolith's GL thread).
|
||||
Uint32 g_textureLegacyArmScopeDepth = 0;
|
||||
}
|
||||
|
||||
MGPipeTextureLegacyArmScope::MGPipeTextureLegacyArmScope()
|
||||
: m_counted(MG_Remote::Server::ServerLoop::OnApplyThread()) {
|
||||
if (m_counted) ++g_textureLegacyArmScopeDepth;
|
||||
}
|
||||
|
||||
MGPipeTextureLegacyArmScope::~MGPipeTextureLegacyArmScope() {
|
||||
if (m_counted) --g_textureLegacyArmScopeDepth;
|
||||
}
|
||||
|
||||
Bool MGPipeTextureLegacyArmScope::ActiveOnApplyThread() {
|
||||
return g_textureLegacyArmScopeDepth != 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
SizeT MipmapStorage::GetLevelCount() const {
|
||||
#if MOBILEGL_BUILD_DISAGGREGATED
|
||||
RefuseLegacyTextureShapeReadFromApplyThread("GetMipmapLevelCount");
|
||||
|
||||
@@ -38,42 +38,6 @@ namespace MobileGL {
|
||||
}
|
||||
};
|
||||
|
||||
#if MOBILEGL_BUILD_DISAGGREGATED
|
||||
// P5c (gt, CONTRACT-P5C §6 layer 1): the NAMED EXEMPTION to the texture legacy-arm
|
||||
// guard, the texture analogue of hd's MGPipeFrontendKeyedRegistryScope
|
||||
// (MG_Impl/Pipe/SlotAllocator.h). Magma's texture sync (VkTextureManager::SyncTexture
|
||||
// and the UploadDirtyMipLevels it drives) still reads and clears the CLIENT's mip
|
||||
// shadow - the one texture family tx did not migrate (CONTRACT-P5C §2 names Espryt's
|
||||
// sync reads and Magma's T5 writes; Magma's upload read path is absent from it), and
|
||||
// inproc was green on it because the barrier and the shared address space held.
|
||||
// Inside this scope the guard's surfaces stay legal - read-only-or-clean, barrier-
|
||||
// held, and greppable as exactly this name; retiring the scope is P7's server-side
|
||||
// Magma texture sync. Every OTHER apply-thread touch of a guarded surface is still
|
||||
// Fatal{RoleViolation, "texture-legacy-arm"}.
|
||||
//
|
||||
// The depth is counted ONLY on the apply thread (P5d round 3, package D), exactly
|
||||
// as hd's two scopes in MG_Impl/Pipe/SlotAllocator.h are: the guard above is the
|
||||
// counter's only reader and it returns before it looks unless
|
||||
// ServerLoop::OnApplyThread() is true, so a depth kept on any other thread could
|
||||
// never change an answer. m_counted remembers the constructor's decision so the
|
||||
// destructor undoes exactly what the constructor did. The query is spelled
|
||||
// ActiveOnApplyThread() rather than Active() because the precondition belongs in
|
||||
// the name: off the apply thread it now answers false however many scopes are
|
||||
// open, and a future second reader must be made to see that rather than trust a
|
||||
// bare Active().
|
||||
class MGPipeTextureLegacyArmScope {
|
||||
public:
|
||||
MGPipeTextureLegacyArmScope();
|
||||
~MGPipeTextureLegacyArmScope();
|
||||
MGPipeTextureLegacyArmScope(const MGPipeTextureLegacyArmScope&) = delete;
|
||||
MGPipeTextureLegacyArmScope& operator=(const MGPipeTextureLegacyArmScope&) = delete;
|
||||
static Bool ActiveOnApplyThread();
|
||||
|
||||
private:
|
||||
Bool m_counted;
|
||||
};
|
||||
#endif
|
||||
|
||||
class MipmapStorage {
|
||||
public:
|
||||
SizeT GetLevelCount() const;
|
||||
|
||||
Reference in New Issue
Block a user