mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-07 01:53:24 +09:00
[Refactor] (P13 W5 S4): the staged stores move to MG_Backend/Record as MG_Record and die through the record fail seam.
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
#include <MG_State/GLState/ProgramState/ProgramArtifactsCodec.h>
|
||||
#if MOBILEGL_BUILD_DISAGGREGATED
|
||||
// P5c (tx): §1's server-side per-level extent derivation, for GenerateMipmap's shape reads.
|
||||
#include <MG_Remote/Server/StagedTextureStore.h>
|
||||
#include <MG_Backend/Record/StagedTextureStore.h>
|
||||
// Shared images: the registry the EGLImages are built from (SharedImageImpl below).
|
||||
#include <MG_Remote/Server/SharedImageRegistry.h>
|
||||
// Device loss ends the session through MG_Pipe's latch seam (LatchIfDeviceLost).
|
||||
@@ -11461,9 +11461,9 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
if (desc.Width == 0 || desc.Levels == 0 || window.Base >= desc.Levels) return window;
|
||||
Uint32 end = std::min<Uint32>(applier.VerbMipLevelCount, desc.Levels);
|
||||
if (record.ParamsSerial) end = std::min<Uint32>(end, static_cast<Uint32>(record.Params.MaxLevel) + 1u);
|
||||
const IntVec3 baseExtent = MG_Remote::Server::StagedTextureMipExtent(desc.Target, desc.Width, desc.Height,
|
||||
const IntVec3 baseExtent = MG_Record::StagedTextureMipExtent(desc.Target, desc.Width, desc.Height,
|
||||
desc.Depth, window.Base);
|
||||
const Int shrinking = MG_Remote::Server::StagedTextureShrinkingAxisCount(desc.Target);
|
||||
const Int shrinking = MG_Record::StagedTextureShrinkingAxisCount(desc.Target);
|
||||
Int largest = 1;
|
||||
for (Int axis = 0; axis < shrinking && axis < 3; ++axis) largest = std::max<Int>(largest, baseExtent[axis]);
|
||||
Uint32 chain = 1;
|
||||
@@ -12137,7 +12137,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
}
|
||||
window.StorageTextureId = storage->GetBackendTextureId();
|
||||
GenerateMipmapThroughViewWindow(window, [&record](Uint32 level) {
|
||||
return MG_Remote::Server::StagedTextureMipExtent(record.Desc.Target, record.Desc.Width,
|
||||
return MG_Record::StagedTextureMipExtent(record.Desc.Target, record.Desc.Width,
|
||||
record.Desc.Height, record.Desc.Depth, level);
|
||||
});
|
||||
return true;
|
||||
@@ -12158,9 +12158,9 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
const auto& desc = record.Desc;
|
||||
const GLuint textureId = backendTexture->GetBackendTextureId();
|
||||
for (Uint32 level = window.Base + 1; level < window.End; ++level) {
|
||||
const IntVec3 srcSize = MG_Remote::Server::StagedTextureMipExtent(desc.Target, desc.Width, desc.Height,
|
||||
const IntVec3 srcSize = MG_Record::StagedTextureMipExtent(desc.Target, desc.Width, desc.Height,
|
||||
desc.Depth, level - 1);
|
||||
const IntVec3 dstSize = MG_Remote::Server::StagedTextureMipExtent(desc.Target, desc.Width, desc.Height,
|
||||
const IntVec3 dstSize = MG_Record::StagedTextureMipExtent(desc.Target, desc.Width, desc.Height,
|
||||
desc.Depth, level);
|
||||
BlitDepthTexture2D(textureId, static_cast<GLint>(level - 1), 0, 0,
|
||||
static_cast<GLsizei>(srcSize.x()), static_cast<GLsizei>(srcSize.y()), textureId,
|
||||
@@ -12177,9 +12177,9 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
IsIntegerColorFormat(static_cast<TextureInternalFormat>(desc.InternalFormat)) ? GL_NEAREST : GL_LINEAR;
|
||||
const GLuint textureId = backendTexture->GetBackendTextureId();
|
||||
for (Uint32 level = window.Base + 1; level < window.End; ++level) {
|
||||
const IntVec3 srcSize = MG_Remote::Server::StagedTextureMipExtent(desc.Target, desc.Width, desc.Height,
|
||||
const IntVec3 srcSize = MG_Record::StagedTextureMipExtent(desc.Target, desc.Width, desc.Height,
|
||||
desc.Depth, level - 1);
|
||||
const IntVec3 dstSize = MG_Remote::Server::StagedTextureMipExtent(desc.Target, desc.Width, desc.Height,
|
||||
const IntVec3 dstSize = MG_Record::StagedTextureMipExtent(desc.Target, desc.Width, desc.Height,
|
||||
desc.Depth, level);
|
||||
BlitColorTexture2D(textureId, static_cast<GLint>(level - 1), 0, 0, static_cast<GLsizei>(srcSize.x()),
|
||||
static_cast<GLsizei>(srcSize.y()), textureId, static_cast<GLint>(level), 0, 0,
|
||||
@@ -12681,8 +12681,8 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
Memcpy(rgb.data(), bytes.data(), bytes.size());
|
||||
return true;
|
||||
}
|
||||
auto& store = MG_Remote::Server::ServerStagedTexture();
|
||||
const Uint64 key = MG_Remote::Server::StagedTextureStore::KeyForHandle(mipRes);
|
||||
auto& store = MG_Record::ServerStagedTexture();
|
||||
const Uint64 key = MG_Record::StagedTextureStore::KeyForHandle(mipRes);
|
||||
const auto faceCode = static_cast<Uint16>(face);
|
||||
const auto levelCode = static_cast<Uint16>(level);
|
||||
const Bool half = format == TextureInternalFormat::RGB16F;
|
||||
@@ -12753,7 +12753,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
const GLuint textureId = backendTexture->GetBackendTextureId();
|
||||
const GLenum bindTarget = TextureImpl::ConvertTextureTargetToBackendGLEnum(textureTarget);
|
||||
for (const TextureUploadTarget face : faces) {
|
||||
IntVec3 extent = MG_Remote::Server::StagedTextureMipExtent(desc.Target, desc.Width, desc.Height,
|
||||
IntVec3 extent = MG_Record::StagedTextureMipExtent(desc.Target, desc.Width, desc.Height,
|
||||
desc.Depth, window.Base);
|
||||
Vector<Float> level;
|
||||
const char* declined = nullptr;
|
||||
@@ -12768,7 +12768,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
}
|
||||
for (Uint32 dst = window.Base + 1; dst < window.End; ++dst) {
|
||||
const IntVec3 dstExtent =
|
||||
MG_Remote::Server::StagedTextureMipExtent(desc.Target, desc.Width, desc.Height, desc.Depth, dst);
|
||||
MG_Record::StagedTextureMipExtent(desc.Target, desc.Width, desc.Height, desc.Depth, dst);
|
||||
// The monolith's box filter: the 2x2 source footprint, clamped where a dimension
|
||||
// is already 1 (GL 4.6 core 8.14.4 leaves the filter to the implementation).
|
||||
Vector<Float> next(static_cast<SizeT>(dstExtent.x()) * static_cast<SizeT>(dstExtent.y()) * 3);
|
||||
@@ -12918,8 +12918,8 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
const auto mipRes = MG_Pipe::MGPipeApplier().VerbMipRes;
|
||||
// P8-SE: whether the staged store still stands for the texture is read BEFORE the note
|
||||
// below sets the mark, or the CPU arm's store route could never answer at all.
|
||||
const Bool driverWrittenBefore = MG_Remote::Server::ServerStagedTexture().IsDriverWritten(
|
||||
MG_Remote::Server::StagedTextureStore::KeyForHandle(mipRes));
|
||||
const Bool driverWrittenBefore = MG_Record::ServerStagedTexture().IsDriverWritten(
|
||||
MG_Record::StagedTextureStore::KeyForHandle(mipRes));
|
||||
// Every arm GenerateMipmapByRecord takes writes the levels above the base on the
|
||||
// driver only (P8-B2's CPU arm uploads its levels there too), so the note is
|
||||
// unconditional.
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
#if MOBILEGL_BUILD_DISAGGREGATED
|
||||
// R-11's server-owned staging copy. Header-only and package v1's; see its own header block for
|
||||
// why GLESBufferResource does not simply gain a member.
|
||||
#include <MG_Remote/Server/StagedShadow.h>
|
||||
#include <MG_Remote/Server/StagedTextureStore.h>
|
||||
#include <MG_Backend/Record/StagedShadow.h>
|
||||
#include <MG_Backend/Record/StagedTextureStore.h>
|
||||
#include <MG_Remote/Server/ServerLoop.h>
|
||||
// P5c (ct): object_death's producer (CONTRACT-P5C.md §5.2) - the death notice's split arm
|
||||
// emits the record through the client's emit helper instead of hopping a stack struct to the
|
||||
@@ -1269,9 +1269,9 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
// MG_Remote singleton (ID-8): ~BufferObject reaches the destroy path from exit
|
||||
// handlers, after this TU's globals would already be gone.
|
||||
// -------------------------------------------------------------------------------
|
||||
MG_Remote::Server::StagedShadowStore& ServerStaged() {
|
||||
static MG_Remote::Server::StagedShadowStore& store =
|
||||
*new MG_Remote::Server::StagedShadowStore(
|
||||
MG_Record::StagedShadowStore& ServerStaged() {
|
||||
static MG_Record::StagedShadowStore& store =
|
||||
*new MG_Record::StagedShadowStore(
|
||||
MG_Config::Transport != MG_Config::TransportMode::Monolith);
|
||||
return store;
|
||||
}
|
||||
@@ -3137,7 +3137,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
// (StagedTextureStore.h's coverage ruling). It is ALSO what places that run in
|
||||
// the level image when the record carries a piece of the level rather than the
|
||||
// whole of it (fix A2), which is why it is read here now.
|
||||
auto& store = MG_Remote::Server::ServerStagedTexture();
|
||||
auto& store = MG_Record::ServerStagedTexture();
|
||||
// P13 W4b: an aliasing store (monolith's record arm) adopts too - it records where
|
||||
// the run sits in the frontend's level shadow instead of copying it.
|
||||
if (!store.Holds()) return;
|
||||
@@ -3147,9 +3147,9 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
if (bytes == nullptr || record.Blob.Size == 0) return;
|
||||
const auto* stored = PipeTextureRecordForHandle(res);
|
||||
if (stored == nullptr) return;
|
||||
const Uint64 key = MG_Remote::Server::StagedTextureStore::KeyForHandle(res);
|
||||
const Uint64 key = MG_Record::StagedTextureStore::KeyForHandle(res);
|
||||
const Uint16 uploadTarget = MG_Pipe::MGPipeSubDataUploadTargetOf(record.Target);
|
||||
const IntVec3 extent = MG_Remote::Server::StagedTextureUploadExtent(stored->Desc, record);
|
||||
const IntVec3 extent = MG_Record::StagedTextureUploadExtent(stored->Desc, record);
|
||||
const SizeT runBytes = static_cast<SizeT>(record.Blob.Size);
|
||||
// P8-E (notes/p8/E.md): THE LEVEL HOLDS A COPY THE CLIENT NEVER SAW
|
||||
// (FollowCopyImageInStagedStore). The run is the client's shadow, stale everywhere it
|
||||
@@ -3158,7 +3158,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
// place that way is adopted as ever, and the store stops standing for the texture.
|
||||
if (store.LevelHoldsFollowedCopy(key, uploadTarget, record.Level) &&
|
||||
(record.RegionCount == 0 || regions != nullptr)) {
|
||||
Vector<MG_Remote::Server::StagedTextureStore::ClientTexelBox> boxes;
|
||||
Vector<MG_Record::StagedTextureStore::ClientTexelBox> boxes;
|
||||
if (record.RegionCount == 0) {
|
||||
const auto& box = record.UnionBox;
|
||||
boxes.push_back({box.X, box.Y, box.Z, box.W, box.H, box.D});
|
||||
@@ -3169,7 +3169,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
}
|
||||
}
|
||||
const Uint64 imageOffset = record.RegionCount == 0
|
||||
? 0 : MG_Remote::Server::StagedTextureRunImageOffset(record, regions);
|
||||
? 0 : MG_Record::StagedTextureRunImageOffset(record, regions);
|
||||
if (store.AdoptClientBoxes(key, uploadTarget, record.Level, extent, imageOffset, bytes, runBytes,
|
||||
boxes.data(), boxes.size())) {
|
||||
return;
|
||||
@@ -3186,15 +3186,15 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
return;
|
||||
}
|
||||
store.AdoptRun(key, uploadTarget, record.Level, extent,
|
||||
MG_Remote::Server::StagedTextureRunImageOffset(record, regions), bytes,
|
||||
MG_Record::StagedTextureRunImageOffset(record, regions), bytes,
|
||||
runBytes, /*frontendShadow=*/true);
|
||||
}
|
||||
|
||||
void Ops_H_TextureRespecify(MG_Pipe::MGPipeHandle res, const MG_Pipe::MGPResourceDesc& desc,
|
||||
const MG_Pipe::MGPRespecifiedLevel* level) {
|
||||
auto& store = MG_Remote::Server::ServerStagedTexture();
|
||||
auto& store = MG_Record::ServerStagedTexture();
|
||||
if (!store.Holds()) return;
|
||||
const Uint64 key = MG_Remote::Server::StagedTextureStore::KeyForHandle(res);
|
||||
const Uint64 key = MG_Record::StagedTextureStore::KeyForHandle(res);
|
||||
if (level != nullptr) {
|
||||
// ONE glTexImage*D redefined one level: its exact extent crossed with the
|
||||
// accepted scope carrier, including a legal noncanonical mutable mip.
|
||||
@@ -3216,7 +3216,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
for (Uint32 levelIndex = 0; levelIndex < desc.Levels; ++levelIndex) {
|
||||
store.NoteLevelDefined(
|
||||
key, static_cast<Uint16>(uploadTarget), static_cast<Uint16>(levelIndex),
|
||||
MG_Remote::Server::StagedTextureMipExtent(desc.Target, desc.Width, desc.Height,
|
||||
MG_Record::StagedTextureMipExtent(desc.Target, desc.Width, desc.Height,
|
||||
desc.Depth, levelIndex),
|
||||
desc.Target, desc.InternalFormat);
|
||||
}
|
||||
@@ -3227,8 +3227,8 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
// Deliberately NOT gated on CopiesIntoServerStorage(): Drop's own m_any gate
|
||||
// makes the monolith call one acquire load, and an unconditional drop cannot
|
||||
// strand a key the latch state was misread for.
|
||||
MG_Remote::Server::ServerStagedTexture().Drop(
|
||||
MG_Remote::Server::StagedTextureStore::KeyForHandle(res));
|
||||
MG_Record::ServerStagedTexture().Drop(
|
||||
MG_Record::StagedTextureStore::KeyForHandle(res));
|
||||
}
|
||||
#endif // MOBILEGL_BUILD_DISAGGREGATED
|
||||
|
||||
@@ -3792,7 +3792,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
// process's and every other session's GL buffers are still alive in the shared group.
|
||||
MGL_SERVER_STAGED_DROP_ALL();
|
||||
#if MOBILEGL_BUILD_DISAGGREGATED
|
||||
MG_Remote::Server::ServerStagedTexture().DropAll();
|
||||
MG_Record::ServerStagedTexture().DropAll();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -3818,7 +3818,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
// tx's texture shadows die for the same reason, keyed by handle rather than address
|
||||
// but with the same recycled-identity failure mode: a new context's allocator may
|
||||
// hand out a {slot, gen} the old one's store still answers for.
|
||||
MG_Remote::Server::ServerStagedTexture().DropAll();
|
||||
MG_Record::ServerStagedTexture().DropAll();
|
||||
// P11 B2: every retired T0 import's fence named work on the context that just ended,
|
||||
// so all of them let go now. LIVE imports keep their reference: the next ensure
|
||||
// imports them again on the new context (EnsureBufferResourceForHandle).
|
||||
@@ -6577,8 +6577,8 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
// one. Read by the SERVER, like the MGITEST_MAGMA_FORCE_* knobs.
|
||||
static const Bool s_forceReadbackFailure =
|
||||
std::getenv("MGITEST_ESPRYT_FORCE_REMINT_READBACK_FAILURE") != nullptr;
|
||||
auto& store = MG_Remote::Server::ServerStagedTexture();
|
||||
const Uint64 key = MG_Remote::Server::StagedTextureStore::KeyForHandle(res);
|
||||
auto& store = MG_Record::ServerStagedTexture();
|
||||
const Uint64 key = MG_Record::StagedTextureStore::KeyForHandle(res);
|
||||
const auto target = BufferImpl::StagedTextureTargetForPipeTarget(record.Desc.Target);
|
||||
GLenum canonicalFormat = GL_NONE, canonicalType = GL_NONE;
|
||||
MG_Util::TextureFormatProcessor::NormalizePixelFormat(
|
||||
@@ -8145,7 +8145,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
// monolith). MGB_STAGED_TEXTURE_LIVE is the runtime discriminator; pushedStorage/pushedRes
|
||||
// are the function's own locals. All are #undef'd with the rest after the function.
|
||||
#define MGB_STAGED_TEXTURE_LIVE \
|
||||
(pushedStorage != nullptr && MG_Remote::Server::ServerStagedTexture().Holds())
|
||||
(pushedStorage != nullptr && MG_Record::ServerStagedTexture().Holds())
|
||||
#define MGB_TEXTURE_TARGET(obj) \
|
||||
(MGB_STAGED_TEXTURE_LIVE ? BufferImpl::StagedTextureTargetForPipeTarget(pushedStorage->Desc.Target) \
|
||||
: (obj)->GetTarget())
|
||||
@@ -8154,20 +8154,20 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
: (obj)->GetUploadTargets())
|
||||
#define MGB_LEVEL_TEXEL_SIZE(obj, tgt, lvl) \
|
||||
(MGB_STAGED_TEXTURE_LIVE \
|
||||
? MG_Remote::Server::ServerStagedTexture().LevelExtentOrUndefined( \
|
||||
MG_Remote::Server::StagedTextureStore::KeyForHandle(pushedRes), static_cast<Uint16>(tgt), \
|
||||
? MG_Record::ServerStagedTexture().LevelExtentOrUndefined( \
|
||||
MG_Record::StagedTextureStore::KeyForHandle(pushedRes), static_cast<Uint16>(tgt), \
|
||||
static_cast<Uint16>(lvl)) \
|
||||
: (obj)->GetMipmapTexelSize(tgt, lvl))
|
||||
#define MGB_LEVEL_BYTE_SIZE(obj, tgt, lvl) \
|
||||
(MGB_STAGED_TEXTURE_LIVE \
|
||||
? MG_Remote::Server::ServerStagedTexture().LevelByteSize( \
|
||||
MG_Remote::Server::StagedTextureStore::KeyForHandle(pushedRes), static_cast<Uint16>(tgt), \
|
||||
? MG_Record::ServerStagedTexture().LevelByteSize( \
|
||||
MG_Record::StagedTextureStore::KeyForHandle(pushedRes), static_cast<Uint16>(tgt), \
|
||||
static_cast<Uint16>(lvl)) \
|
||||
: (obj)->GetMipmapByteSize(tgt, lvl))
|
||||
#define MGB_LEVEL_TEXELS(obj, tgt, lvl, site) \
|
||||
(MGB_STAGED_TEXTURE_LIVE \
|
||||
? MG_Remote::Server::ServerStagedTexture().RequireLevelBytes( \
|
||||
MG_Remote::Server::StagedTextureStore::KeyForHandle(pushedRes), static_cast<Uint16>(tgt), \
|
||||
? MG_Record::ServerStagedTexture().RequireLevelBytes( \
|
||||
MG_Record::StagedTextureStore::KeyForHandle(pushedRes), static_cast<Uint16>(tgt), \
|
||||
static_cast<Uint16>(lvl), site) \
|
||||
: (obj)->MapMipmapData(tgt, lvl))
|
||||
#else
|
||||
@@ -8188,8 +8188,8 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
#define MGB_LEVEL_NEEDS_UPLOAD(obj, tgt, lvl) \
|
||||
(pushedStorage != nullptr \
|
||||
? (FindPipeTextureUpload(*pushedStorage, static_cast<Uint16>(tgt), static_cast<Uint16>(lvl)) != nullptr || \
|
||||
MG_Remote::Server::ServerStagedTexture().IsLevelGpuDirty( \
|
||||
MG_Remote::Server::StagedTextureStore::KeyForHandle(pushedRes), static_cast<Uint16>(tgt), \
|
||||
MG_Record::ServerStagedTexture().IsLevelGpuDirty( \
|
||||
MG_Record::StagedTextureStore::KeyForHandle(pushedRes), static_cast<Uint16>(tgt), \
|
||||
static_cast<Uint16>(lvl))) \
|
||||
: (obj)->IsStorageDirty(tgt, lvl))
|
||||
// Re-resolves the record itself, so it is safe after any amount of driver work - and it
|
||||
@@ -8200,8 +8200,8 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
if (pushedStorage != nullptr) { \
|
||||
ConsumePipeTextureUpload(pushedRes, static_cast<Uint16>(tgt), static_cast<Uint16>(lvl)); \
|
||||
if (MGB_STAGED_TEXTURE_LIVE) { \
|
||||
MG_Remote::Server::ServerStagedTexture().MarkLevelGpuDirty( \
|
||||
MG_Remote::Server::StagedTextureStore::KeyForHandle(pushedRes), static_cast<Uint16>(tgt), \
|
||||
MG_Record::ServerStagedTexture().MarkLevelGpuDirty( \
|
||||
MG_Record::StagedTextureStore::KeyForHandle(pushedRes), static_cast<Uint16>(tgt), \
|
||||
static_cast<Uint16>(lvl), false); \
|
||||
} \
|
||||
} else { \
|
||||
@@ -8386,8 +8386,8 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
}
|
||||
}
|
||||
if (m_sharedImage != nullptr && !boxes.empty()) {
|
||||
auto& store = MG_Remote::Server::ServerStagedTexture();
|
||||
const Uint64 key = MG_Remote::Server::StagedTextureStore::KeyForHandle(record.Desc.Resource);
|
||||
auto& store = MG_Record::ServerStagedTexture();
|
||||
const Uint64 key = MG_Record::StagedTextureStore::KeyForHandle(record.Desc.Resource);
|
||||
Bind(GL_TEXTURE_2D);
|
||||
ScopedDefaultUnpackState unpackState;
|
||||
BufferImpl::BindPixelUnpackBufferId(0);
|
||||
@@ -8656,8 +8656,8 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
anyDefined = static_cast<TextureInternalFormat>(stagedDesc.InternalFormat) !=
|
||||
TextureInternalFormat::Unknown;
|
||||
} else {
|
||||
auto& stagedStore = MG_Remote::Server::ServerStagedTexture();
|
||||
const Uint64 stagedKey = MG_Remote::Server::StagedTextureStore::KeyForHandle(pushedRes);
|
||||
auto& stagedStore = MG_Record::ServerStagedTexture();
|
||||
const Uint64 stagedKey = MG_Record::StagedTextureStore::KeyForHandle(pushedRes);
|
||||
for (const auto& uploadTarget : BufferImpl::StagedUploadTargetsForPipeTarget(stagedDesc.Target)) {
|
||||
for (Uint32 level = 0; level < stagedDesc.Levels; ++level) {
|
||||
if (stagedStore.IsLevelDefined(stagedKey, static_cast<Uint16>(uploadTarget),
|
||||
@@ -9267,8 +9267,8 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
// asked (§2.2's last row).
|
||||
if (MGB_STAGED_TEXTURE_LIVE) {
|
||||
const IntVec3 gpuExtent =
|
||||
MG_Remote::Server::ServerStagedTexture().LevelExtentOrUndefined(
|
||||
MG_Remote::Server::StagedTextureStore::KeyForHandle(pushedRes),
|
||||
MG_Record::ServerStagedTexture().LevelExtentOrUndefined(
|
||||
MG_Record::StagedTextureStore::KeyForHandle(pushedRes),
|
||||
static_cast<Uint16>(uploadTarget), static_cast<Uint16>(level));
|
||||
return MG_State::GLState::MipmapDirtyRegion{IntVec3{0, 0, 0}, gpuExtent};
|
||||
}
|
||||
@@ -10687,8 +10687,8 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
// P8-E: the staged store stops standing for this texture's content (a no-op on a
|
||||
// monolith arm, where the store does not copy).
|
||||
if (!storeFollowsTheWrite && !MG_Pipe::MGPipeHandleIsNull(storage)) {
|
||||
MG_Remote::Server::ServerStagedTexture().MarkDriverWritten(
|
||||
MG_Remote::Server::StagedTextureStore::KeyForHandle(storage));
|
||||
MG_Record::ServerStagedTexture().MarkDriverWritten(
|
||||
MG_Record::StagedTextureStore::KeyForHandle(storage));
|
||||
}
|
||||
#else
|
||||
(void)storeFollowsTheWrite;
|
||||
@@ -10698,7 +10698,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
Bool FollowCopyImageInStagedStore(MG_Pipe::MGPipeHandle source, Uint32 sourceLevel, const IntVec3& sourceOrigin,
|
||||
MG_Pipe::MGPipeHandle destination, Uint32 destinationLevel,
|
||||
const IntVec3& destinationOrigin, const IntVec3& size) {
|
||||
auto& store = MG_Remote::Server::ServerStagedTexture();
|
||||
auto& store = MG_Record::ServerStagedTexture();
|
||||
// P13 W4b: an aliasing store (monolith's record arm) follows too; see FollowCopy.
|
||||
if (!store.Holds()) return false;
|
||||
// The store's level key for an endpoint copy-image addresses as ONE image with its
|
||||
@@ -10727,9 +10727,9 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
PipeTextureRecordForHandle(destination)->Desc.InternalFormat) {
|
||||
return false;
|
||||
}
|
||||
return store.FollowCopy(MG_Remote::Server::StagedTextureStore::KeyForHandle(source), sourceTarget,
|
||||
return store.FollowCopy(MG_Record::StagedTextureStore::KeyForHandle(source), sourceTarget,
|
||||
static_cast<Uint16>(sourceLevel), sourceOrigin,
|
||||
MG_Remote::Server::StagedTextureStore::KeyForHandle(destination),
|
||||
MG_Record::StagedTextureStore::KeyForHandle(destination),
|
||||
destinationTarget, static_cast<Uint16>(destinationLevel), destinationOrigin,
|
||||
size);
|
||||
}
|
||||
|
||||
@@ -352,8 +352,8 @@
|
||||
static Bool ReadWireLevelFromStagedStore(MG_Pipe::MGPipeHandle res, TextureInternalFormat logicalFormat,
|
||||
TextureUploadTarget uploadTarget, GLint level, const IntVec3& extent,
|
||||
GLenum format, GLenum type, Vector<Uint8>& bytes) {
|
||||
auto& store = MG_Remote::Server::ServerStagedTexture();
|
||||
const Uint64 key = MG_Remote::Server::StagedTextureStore::KeyForHandle(res);
|
||||
auto& store = MG_Record::ServerStagedTexture();
|
||||
const Uint64 key = MG_Record::StagedTextureStore::KeyForHandle(res);
|
||||
const auto target = static_cast<Uint16>(uploadTarget);
|
||||
const auto mip = static_cast<Uint16>(level);
|
||||
ReadbackChannelMapping mapping{};
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#if MOBILEGL_BUILD_DISAGGREGATED
|
||||
#include "MG_Pipe/MGPipeCallbacks.h"
|
||||
#include "MG_Pipe/PipeApply.h"
|
||||
#include "MG_Remote/Server/StagedShadow.h"
|
||||
#include <MG_Backend/Record/StagedShadow.h>
|
||||
#if MOBILEGL_BUILD_DISAGGREGATED
|
||||
#include "MG_Remote/Transport/AdoptT0.h"
|
||||
#endif
|
||||
@@ -461,7 +461,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
static_cast<unsigned long long>(m_completedSerialFloor),
|
||||
static_cast<unsigned long long>(resource->lastUseSubmitIndex));
|
||||
}
|
||||
MG_Remote::Server::StagedShadowStore::CoverageAdd(resource->stagedCoverage,
|
||||
MG_Record::StagedShadowStore::CoverageAdd(resource->stagedCoverage,
|
||||
static_cast<SizeT>(offset),
|
||||
static_cast<SizeT>(offset + size));
|
||||
++m_sliceEpochCounter;
|
||||
@@ -475,7 +475,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
}
|
||||
const auto* resource = FindWireBuffer(res);
|
||||
if (!resource || offset > resource->size || size > resource->size - offset ||
|
||||
!MG_Remote::Server::StagedShadowStore::CoverageHas(resource->stagedCoverage,
|
||||
!MG_Record::StagedShadowStore::CoverageHas(resource->stagedCoverage,
|
||||
static_cast<SizeT>(offset), static_cast<SizeT>(offset + size))) {
|
||||
MGLOG_F("Magma: Fatal{StageSnapshotTooNarrow, \"buffer-flush\"} {slot=%u, gen=%u}",
|
||||
res.Slot, res.Gen);
|
||||
@@ -795,7 +795,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
resource->imported = true;
|
||||
resource->gpuWritesPending = false;
|
||||
resource->stagedCoverage.clear();
|
||||
MG_Remote::Server::StagedShadowStore::CoverageAdd(resource->stagedCoverage, 0, static_cast<SizeT>(size));
|
||||
MG_Record::StagedShadowStore::CoverageAdd(resource->stagedCoverage, 0, static_cast<SizeT>(size));
|
||||
++m_sliceEpochCounter;
|
||||
return mapped;
|
||||
}
|
||||
@@ -830,7 +830,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
resource->gpuWritesPending = false;
|
||||
// The whole store holds bytes the client supplied (its AHB, seeded from its shadow).
|
||||
resource->stagedCoverage.clear();
|
||||
MG_Remote::Server::StagedShadowStore::CoverageAdd(resource->stagedCoverage, 0, static_cast<SizeT>(size));
|
||||
MG_Record::StagedShadowStore::CoverageAdd(resource->stagedCoverage, 0, static_cast<SizeT>(size));
|
||||
++m_sliceEpochCounter;
|
||||
++m_wireStoreCount;
|
||||
NoteWireStorePeaks();
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// P5f (fm): the handle-keyed texture arm's two sources - the applier's resource records
|
||||
// (shape) and the server's staged-texture store (texels).
|
||||
#include <MG_Pipe/PipeApply.h>
|
||||
#include <MG_Remote/Server/StagedTextureStore.h>
|
||||
#include <MG_Backend/Record/StagedTextureStore.h>
|
||||
// Shared images: a texture whose level 0 is a server-allocated AHardwareBuffer.
|
||||
#include <MG_Remote/Server/SharedImageRegistry.h>
|
||||
#include "../DirectVulkan.h"
|
||||
@@ -2076,8 +2076,8 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
if (!handle.Slot || handle.Slot >= records.size()) return false;
|
||||
const auto& record = records[handle.Slot];
|
||||
if (!record.Live || record.Gen != handle.Gen || !MG_Pipe::MGPipeHandleIsNull(record.Desc.ViewOf)) return false;
|
||||
auto& store = MG_Remote::Server::ServerStagedTexture();
|
||||
const Uint64 key = MG_Remote::Server::StagedTextureStore::KeyForHandle(handle);
|
||||
auto& store = MG_Record::ServerStagedTexture();
|
||||
const Uint64 key = MG_Record::StagedTextureStore::KeyForHandle(handle);
|
||||
const auto upload = static_cast<Uint16>(target);
|
||||
const auto native = m_wireTextureResources.find(key);
|
||||
if (native != m_wireTextureResources.end() && native->second.image && level < native->second.mipLevels) {
|
||||
@@ -2486,12 +2486,12 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
if (record.PendingUploads.empty()) {
|
||||
return true;
|
||||
}
|
||||
auto& store = MG_Remote::Server::ServerStagedTexture();
|
||||
auto& store = MG_Record::ServerStagedTexture();
|
||||
// This arm runs under a transport (the store copies) or on monolith's record arm (it
|
||||
// aliases the frontend's level shadows); a store that holds neither has nothing to upload.
|
||||
MOBILEGL_ASSERT(store.Holds(),
|
||||
"UploadPendingWireLevels under a staged store that holds no levels: the wire arm needs one");
|
||||
const Uint64 key = MG_Remote::Server::StagedTextureStore::KeyForHandle(handle);
|
||||
const Uint64 key = MG_Record::StagedTextureStore::KeyForHandle(handle);
|
||||
const TextureInternalFormat internalFormat = static_cast<TextureInternalFormat>(record.Desc.InternalFormat);
|
||||
const TextureFormatInfo formatInfo = ResolveTextureFormatInfo(internalFormat);
|
||||
const TextureTarget target = WireTextureTargetOfPipeTarget(record.Desc.Target);
|
||||
@@ -2658,7 +2658,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
Uint64 pendingBytes = 0;
|
||||
for (const auto& pending : record.PendingUploads) {
|
||||
pendingBytes += static_cast<Uint64>(
|
||||
store.LevelByteSize(MG_Remote::Server::StagedTextureStore::KeyForHandle(handle),
|
||||
store.LevelByteSize(MG_Record::StagedTextureStore::KeyForHandle(handle),
|
||||
pending.UploadTarget, pending.Level));
|
||||
}
|
||||
WireDeclineTally::SetPendingGauge(static_cast<Uint64>(record.PendingUploads.size()), pendingBytes);
|
||||
@@ -3079,7 +3079,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
WireDeclineTally::Count(WireDeclineSite::TexRecordDeadOrStale);
|
||||
return nullptr;
|
||||
}
|
||||
const Uint64 key = MG_Remote::Server::StagedTextureStore::KeyForHandle(handle);
|
||||
const Uint64 key = MG_Record::StagedTextureStore::KeyForHandle(handle);
|
||||
auto [it, inserted] = resources.try_emplace(key);
|
||||
(void)inserted;
|
||||
TextureResource& resource = it->second;
|
||||
@@ -3132,17 +3132,17 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
case MGPipeResourceTarget::Tex2DArray: target = TextureUploadTarget::Texture2DArray; break;
|
||||
case MGPipeResourceTarget::TexCubeArray: target = TextureUploadTarget::CubeMapArray; break;
|
||||
case MGPipeResourceTarget::TexCube: {
|
||||
const Uint64 key = MG_Remote::Server::StagedTextureStore::KeyForHandle(handle);
|
||||
const Uint64 key = MG_Record::StagedTextureStore::KeyForHandle(handle);
|
||||
for (Uint32 face = baseArrayLayer; face < 6 && face - baseArrayLayer < layerCount; ++face)
|
||||
MG_Remote::Server::ServerStagedTexture().MarkLevelGpuDirty(key,
|
||||
MG_Record::ServerStagedTexture().MarkLevelGpuDirty(key,
|
||||
static_cast<Uint16>(TextureUploadTarget::CubeMapPositiveX) + face,
|
||||
static_cast<Uint16>(mipLevel), true);
|
||||
return;
|
||||
}
|
||||
default: target = TextureUploadTarget::Texture2D; break;
|
||||
}
|
||||
MG_Remote::Server::ServerStagedTexture().MarkLevelGpuDirty(
|
||||
MG_Remote::Server::StagedTextureStore::KeyForHandle(handle),
|
||||
MG_Record::ServerStagedTexture().MarkLevelGpuDirty(
|
||||
MG_Record::StagedTextureStore::KeyForHandle(handle),
|
||||
static_cast<Uint16>(target), static_cast<Uint16>(mipLevel), true);
|
||||
}
|
||||
|
||||
@@ -3151,7 +3151,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
if (MG_Pipe::MGPipeHandleIsNull(handle)) {
|
||||
return false;
|
||||
}
|
||||
const Uint64 key = MG_Remote::Server::StagedTextureStore::KeyForHandle(handle);
|
||||
const Uint64 key = MG_Record::StagedTextureStore::KeyForHandle(handle);
|
||||
auto it = m_wireTextureResources.find(key);
|
||||
if (it == m_wireTextureResources.end() || it->second.image == VK_NULL_HANDLE) {
|
||||
return false;
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
// WireBufferLegacyFatal die through. Declared by MG_Pipe on purpose - see PipeSessionFail.h.
|
||||
#include <MG_Pipe/PipeSessionFail.h>
|
||||
// P5c (T5 / tx): the server's staged-texture shadow GenerateMipmap defines its chain on.
|
||||
#include <MG_Remote/Server/StagedTextureStore.h>
|
||||
#include <MG_Backend/Record/StagedTextureStore.h>
|
||||
#include <MG_Remote/Server/ServerLoop.h>
|
||||
// Shared images: the present side resolves the image it imports (WireSharedImage.inc).
|
||||
#include <MG_Remote/Server/SharedImageRegistry.h>
|
||||
@@ -1715,8 +1715,8 @@ void main() {
|
||||
return false;
|
||||
}
|
||||
const Uint32 requiredMipLevelCount = baseMipLevel + ComputeFullMipLevelCount(baseTexelSize);
|
||||
auto& store = MG_Remote::Server::ServerStagedTexture();
|
||||
const Uint64 key = MG_Remote::Server::StagedTextureStore::KeyForTwinAddress(&resource);
|
||||
auto& store = MG_Record::ServerStagedTexture();
|
||||
const Uint64 key = MG_Record::StagedTextureStore::KeyForTwinAddress(&resource);
|
||||
for (const auto uploadTarget : uploadTargets) {
|
||||
for (Uint32 level = baseMipLevel + 1; level < requiredMipLevelCount; ++level) {
|
||||
// Bytes the shadow held for a generated level go: the declaration below moves its
|
||||
|
||||
@@ -1700,8 +1700,8 @@
|
||||
auto& record = state.TextureResources[handle.Slot];
|
||||
record.Desc.Levels = std::max<Uint16>(record.Desc.Levels,static_cast<Uint16>(base+count));
|
||||
resource->syncedWireSerial = ++record.Serial;
|
||||
auto& store = MG_Remote::Server::ServerStagedTexture();
|
||||
const Uint64 key = MG_Remote::Server::StagedTextureStore::KeyForHandle(handle);
|
||||
auto& store = MG_Record::ServerStagedTexture();
|
||||
const Uint64 key = MG_Record::StagedTextureStore::KeyForHandle(handle);
|
||||
const auto target = static_cast<MG_Pipe::MGPipeResourceTarget>(record.Desc.Target);
|
||||
// The resource descriptor determines the upload-target set; no texture unit or
|
||||
// client upload-target vector participates in defining the generated shadow.
|
||||
@@ -1719,7 +1719,7 @@
|
||||
default: break;
|
||||
}
|
||||
for (Uint32 level=base+1;level<base+count;++level) {
|
||||
const IntVec3 extent = MG_Remote::Server::StagedTextureMipExtent(
|
||||
const IntVec3 extent = MG_Record::StagedTextureMipExtent(
|
||||
record.Desc.Target, record.Desc.Width, record.Desc.Height, record.Desc.Depth, level);
|
||||
// PH-4: the record's own target and format, not NoteLevelDefined's Tex2D/RGBA8
|
||||
// defaults - a 2D-array or 3D level has depth > 1, which the Tex2D device-limit rule
|
||||
|
||||
+7
-7
@@ -1,4 +1,4 @@
|
||||
// MobileGL - MobileGL/MG_Remote/Server/StagedShadow.h
|
||||
// MobileGL - MobileGL/MG_Backend/Record/StagedShadow.h
|
||||
// Copyright (c) 2025-2026 MobileGL-Dev
|
||||
// Licensed under the GNU Lesser General Public License v3.0:
|
||||
// https://www.gnu.org/licenses/gpl-3.0.txt
|
||||
@@ -38,9 +38,9 @@
|
||||
#include <Includes.h>
|
||||
|
||||
// P7 wave 0 / Ph slice (2): RequireCovered's death goes through Session::Fail like every other
|
||||
// one. Not an out-of-line helper - this header is already inside MG_Remote, so it may name
|
||||
// MG_Remote's own funnel, and check_include_closure.py's four probes do not reach it.
|
||||
#include <MG_Remote/FatalFunnel.h>
|
||||
// one. P13 W5: the store left MG_Remote (the record arm runs without it), so it dies through
|
||||
// MG_Pipe's record fail seam, which FatalFunnel.cpp points at SessionFail wherever MG_Remote is linked.
|
||||
#include <MG_Pipe/PipeSessionFail.h>
|
||||
#include <MG_Util/Debug/Log.h>
|
||||
#include <MG_Util/Math/VectorTypes.h>
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
#include <cstring>
|
||||
#include <mutex>
|
||||
|
||||
namespace MobileGL::MG_Remote::Server {
|
||||
namespace MobileGL::MG_Record {
|
||||
|
||||
// P14: WHOSE STAGED BYTES ARE THESE? The two server stores below are one per process, but the
|
||||
// in-process display server serves several sessions in that process at once, and a session's
|
||||
@@ -172,7 +172,7 @@ namespace MobileGL::MG_Remote::Server {
|
||||
if (it == m_shadows.end() || it->second.Bytes.data() != hostBase) return;
|
||||
if (CoverageHas(it->second.Covered, start, end)) return;
|
||||
// Verbatim what the MGLOG_F said, through the funnel that publishes it (P7 wave 0).
|
||||
SessionFail(MGFatalFamily::StageSnapshotTooNarrow,
|
||||
MG_Pipe::MGPipeRecordFail(MG_Pipe::MGFatalFamily::StageSnapshotTooNarrow,
|
||||
"MGPipe: Fatal{StageSnapshotTooNarrow, \"%s\"} - the server's ladder wants "
|
||||
"[%zu, %zu) of a buffer whose staged coverage does not include it. Under "
|
||||
"split the authoritative shadow is SERVER-OWNED (rule C) and "
|
||||
@@ -262,4 +262,4 @@ namespace MobileGL::MG_Remote::Server {
|
||||
std::atomic<Bool> m_any{false};
|
||||
};
|
||||
|
||||
} // namespace MobileGL::MG_Remote::Server
|
||||
} // namespace MobileGL::MG_Record
|
||||
+13
-13
@@ -1,4 +1,4 @@
|
||||
// MobileGL - MobileGL/MG_Remote/Server/StagedTextureStore.h
|
||||
// MobileGL - MobileGL/MG_Backend/Record/StagedTextureStore.h
|
||||
// Copyright (c) 2025-2026 MobileGL-Dev
|
||||
// Licensed under the GNU Lesser General Public License v3.0:
|
||||
// https://www.gnu.org/licenses/gpl-3.0.txt
|
||||
@@ -100,10 +100,10 @@
|
||||
#include <MG_Pipe/MGPipeTypes.h>
|
||||
// StagedShadowStore::CoverageAdd / CoverageHas: ONE spelling of the covered set, so the texture
|
||||
// half's runs and the buffer half's ranges cannot drift apart on what "covered" means.
|
||||
#include <MG_Remote/Server/StagedShadow.h>
|
||||
#include <MG_Backend/Record/StagedShadow.h>
|
||||
// P7 wave 0 / Ph slice (2): RequireLevelBytes' death goes through Session::Fail. Named here
|
||||
// rather than left to StagedShadow.h's copy of the same include.
|
||||
#include <MG_Remote/FatalFunnel.h>
|
||||
#include <MG_Pipe/PipeSessionFail.h>
|
||||
#include <MG_Util/Debug/Log.h>
|
||||
#include <MG_Util/Metrics/TextureMetrics.h>
|
||||
#include <MG_Util/Math/VectorTypes.h>
|
||||
@@ -118,7 +118,7 @@
|
||||
#include <Config.h>
|
||||
#endif
|
||||
|
||||
namespace MobileGL::MG_Remote::Server {
|
||||
namespace MobileGL::MG_Record {
|
||||
|
||||
// §1's server-side per-level extent (CONTRACT-P5C table 0): max(1, base_extent >> level)
|
||||
// per SHRINKING axis, with an array texture's layer count fixed - it is not a dimension of
|
||||
@@ -440,7 +440,7 @@ namespace MobileGL::MG_Remote::Server {
|
||||
if (!validExtent ||
|
||||
(supportsSubData && sizedFormat && !emptyExtent && !StagedTextureDeclaredLevelByteBound(
|
||||
resourceTarget, internalFormat, extent, m_deviceLimits, &byteBound))) {
|
||||
SessionFail(MGFatalFamily::ProtocolCorruption,
|
||||
MG_Pipe::MGPipeRecordFail(MG_Pipe::MGFatalFamily::ProtocolCorruption,
|
||||
"MGPipe: Fatal{ProtocolCorruption, \"StagedTextureStore.NoteLevelDefined\"} - "
|
||||
"the accepted respecify has no valid server-bounded texture level "
|
||||
"(key=%llu, target=%u, level=%u, extent=%d,%d,%d, internalFormat=%u)",
|
||||
@@ -683,7 +683,7 @@ namespace MobileGL::MG_Remote::Server {
|
||||
const LevelShadow* shadow = FindLevel(key, uploadTarget, level);
|
||||
if (shadow != nullptr && LevelComplete(*shadow)) return LevelData(*shadow);
|
||||
// Verbatim what the MGLOG_F said, through the funnel that publishes it (P7 wave 0).
|
||||
SessionFail(MGFatalFamily::StageSnapshotTooNarrow,
|
||||
MG_Pipe::MGPipeRecordFail(MG_Pipe::MGFatalFamily::StageSnapshotTooNarrow,
|
||||
"MGPipe: Fatal{StageSnapshotTooNarrow, \"%s\"} - the texture sync wants the "
|
||||
"bytes of (uploadTarget=%u, level=%u) and the server's staged shadow has no "
|
||||
"COMPLETE covered run for it. Under split the authoritative shadow is "
|
||||
@@ -876,14 +876,14 @@ namespace MobileGL::MG_Remote::Server {
|
||||
// `InternalFormat == 0`, but 0 is TextureInternalFormat::R8, so every R8 upload read
|
||||
// as "arrived before the level was declared".
|
||||
if (!shadow.Defined) {
|
||||
SessionFail(MGFatalFamily::ProtocolCorruption,
|
||||
MG_Pipe::MGPipeRecordFail(MG_Pipe::MGFatalFamily::ProtocolCorruption,
|
||||
"MGPipe: Fatal{ProtocolCorruption, \"StagedTextureStore.LevelExtent\"} - "
|
||||
"resource_subdata arrived before the server declared texture level "
|
||||
"(key=%llu, uploadTarget=%u, level=%u)",
|
||||
static_cast<unsigned long long>(key), uploadTarget, level);
|
||||
}
|
||||
if (!StagedTextureTargetSupportsSubData(shadow.ResourceTarget)) {
|
||||
SessionFail(MGFatalFamily::ProtocolCorruption,
|
||||
MG_Pipe::MGPipeRecordFail(MG_Pipe::MGFatalFamily::ProtocolCorruption,
|
||||
"MGPipe: Fatal{ProtocolCorruption, \"StagedTextureStore.Target\"} - "
|
||||
"resource_subdata is not legal for the server-declared texture target "
|
||||
"(key=%llu, uploadTarget=%u, level=%u, target=%u)",
|
||||
@@ -891,7 +891,7 @@ namespace MobileGL::MG_Remote::Server {
|
||||
static_cast<Uint32>(shadow.ResourceTarget));
|
||||
}
|
||||
if (shadow.DeclaredByteBound == 0) {
|
||||
SessionFail(MGFatalFamily::ProtocolCorruption,
|
||||
MG_Pipe::MGPipeRecordFail(MG_Pipe::MGFatalFamily::ProtocolCorruption,
|
||||
"MGPipe: Fatal{ProtocolCorruption, \"StagedTextureStore.LevelBound\"} - "
|
||||
"resource_subdata into a byteless declared level: its extent is empty or "
|
||||
"its format has no uncompressed size on this server "
|
||||
@@ -901,7 +901,7 @@ namespace MobileGL::MG_Remote::Server {
|
||||
shadow.InternalFormat);
|
||||
}
|
||||
if (shadow.Extent == extent) return;
|
||||
SessionFail(MGFatalFamily::ProtocolCorruption,
|
||||
MG_Pipe::MGPipeRecordFail(MG_Pipe::MGFatalFamily::ProtocolCorruption,
|
||||
"MGPipe: Fatal{ProtocolCorruption, \"StagedTextureStore.LevelExtent\"} - "
|
||||
"resource_subdata extent disagrees with the server-declared texture level "
|
||||
"(key=%llu, uploadTarget=%u, level=%u, declared=%d,%d,%d, record=%d,%d,%d)",
|
||||
@@ -918,7 +918,7 @@ namespace MobileGL::MG_Remote::Server {
|
||||
constexpr Uint64 max = std::numeric_limits<Uint64>::max();
|
||||
const Uint64 runBytes = static_cast<Uint64>(byteSize);
|
||||
if (imageOffset > max - runBytes) {
|
||||
SessionFail(MGFatalFamily::ProtocolCorruption,
|
||||
MG_Pipe::MGPipeRecordFail(MG_Pipe::MGFatalFamily::ProtocolCorruption,
|
||||
"MGPipe: Fatal{ProtocolCorruption, \"StagedTextureStore.CopyRunInto\"} - "
|
||||
"texture run end overflows (handle=%llu, uploadTarget=%u, level=%u, "
|
||||
"offset=%llu, size=%llu)",
|
||||
@@ -929,7 +929,7 @@ namespace MobileGL::MG_Remote::Server {
|
||||
const Uint64 end = imageOffset + runBytes;
|
||||
if (end > shadow.DeclaredByteBound ||
|
||||
end > static_cast<Uint64>(std::numeric_limits<SizeT>::max())) {
|
||||
SessionFail(MGFatalFamily::ProtocolCorruption,
|
||||
MG_Pipe::MGPipeRecordFail(MG_Pipe::MGFatalFamily::ProtocolCorruption,
|
||||
"MGPipe: Fatal{ProtocolCorruption, \"StagedTextureStore.CopyRunInto\"} - "
|
||||
"texture run exceeds the server-declared level byte bound "
|
||||
"(handle=%llu, uploadTarget=%u, level=%u, offset=%llu, size=%llu, "
|
||||
@@ -1045,4 +1045,4 @@ namespace MobileGL::MG_Remote::Server {
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace MobileGL::MG_Remote::Server
|
||||
} // namespace MobileGL::MG_Record
|
||||
@@ -49,7 +49,7 @@
|
||||
#include <MG_Remote/Client/ClientSession.h>
|
||||
#include <MG_Remote/Server/ServerLoop.h>
|
||||
#include <MG_Remote/Server/ServerSession.h>
|
||||
#include <MG_Remote/Server/StagedTextureStore.h>
|
||||
#include <MG_Backend/Record/StagedTextureStore.h>
|
||||
#include <MG_Remote/CapsCodec.h>
|
||||
#endif
|
||||
|
||||
@@ -1497,11 +1497,11 @@ namespace MobileGL::MG_Pipe {
|
||||
void AdoptTextureWithoutBackendHook(const MGPipeResourceRecord& stored, const MGPSubData& upload,
|
||||
const void* bytes, const MGPSubRegion* regions) {
|
||||
if (!MG_Config::DataArmIsRecord() || !bytes || upload.Blob.Size == 0) return;
|
||||
auto& store = MG_Remote::Server::ServerStagedTexture();
|
||||
auto& store = MG_Record::ServerStagedTexture();
|
||||
const auto& desc = stored.Desc;
|
||||
const Uint64 key = MG_Remote::Server::StagedTextureStore::KeyForHandle(upload.Res);
|
||||
const Uint64 key = MG_Record::StagedTextureStore::KeyForHandle(upload.Res);
|
||||
const Uint16 target = MGPipeSubDataUploadTargetOf(upload.Target);
|
||||
const IntVec3 extent = MG_Remote::Server::StagedTextureUploadExtent(desc, upload);
|
||||
const IntVec3 extent = MG_Record::StagedTextureUploadExtent(desc, upload);
|
||||
// RegionCount == 0 IS the whole-level spelling - "the run is the level shadow" - so it
|
||||
// is adopted with the spelling that replaces the level; every other record names a RUN
|
||||
// of the level by its own box (fix A2: a level too large to stage whole crosses as
|
||||
@@ -1514,14 +1514,14 @@ namespace MobileGL::MG_Pipe {
|
||||
return;
|
||||
}
|
||||
store.AdoptRun(key, target, upload.Level, extent,
|
||||
MG_Remote::Server::StagedTextureRunImageOffset(upload, regions), bytes,
|
||||
MG_Record::StagedTextureRunImageOffset(upload, regions), bytes,
|
||||
static_cast<SizeT>(upload.Blob.Size), /*frontendShadow=*/true);
|
||||
}
|
||||
|
||||
void DefineTextureWithoutBackendHook(const MGPResourceDesc& desc, const MGPRespecifiedLevel* level) {
|
||||
if (!MG_Config::DataArmIsRecord()) return;
|
||||
auto& store = MG_Remote::Server::ServerStagedTexture();
|
||||
const Uint64 key = MG_Remote::Server::StagedTextureStore::KeyForHandle(desc.Resource);
|
||||
auto& store = MG_Record::ServerStagedTexture();
|
||||
const Uint64 key = MG_Record::StagedTextureStore::KeyForHandle(desc.Resource);
|
||||
const auto define = [&](Uint16 target, Uint16 mip, const IntVec3& extent) {
|
||||
store.NoteLevelDefined(key, target, mip, extent, desc.Target, desc.InternalFormat);
|
||||
};
|
||||
@@ -1536,7 +1536,7 @@ namespace MobileGL::MG_Pipe {
|
||||
const auto defineChain = [&](TextureUploadTarget target) {
|
||||
for (Uint32 mip = 0; mip < desc.Levels; ++mip)
|
||||
define(static_cast<Uint16>(target), static_cast<Uint16>(mip),
|
||||
MG_Remote::Server::StagedTextureMipExtent(desc.Target, desc.Width,
|
||||
MG_Record::StagedTextureMipExtent(desc.Target, desc.Width,
|
||||
desc.Height, desc.Depth, mip));
|
||||
};
|
||||
switch (static_cast<MGPipeResourceTarget>(desc.Target)) {
|
||||
@@ -1975,7 +1975,7 @@ namespace MobileGL::MG_Pipe {
|
||||
#if MOBILEGL_BUILD_DISAGGREGATED
|
||||
if (MG_Config::DataArmIsRecord() &&
|
||||
(g_resourceOps == nullptr || g_resourceOps->TextureDestroy == nullptr)) {
|
||||
MG_Remote::Server::ServerStagedTexture().DropAll();
|
||||
MG_Record::ServerStagedTexture().DropAll();
|
||||
}
|
||||
#endif
|
||||
// The served context is going away and this applier with it. Under split that is one
|
||||
@@ -2750,8 +2750,8 @@ namespace MobileGL::MG_Pipe {
|
||||
if (g_resourceOps != nullptr && g_resourceOps->TextureDestroy != nullptr)
|
||||
g_resourceOps->TextureDestroy(handle.Handle);
|
||||
else if (MG_Config::DataArmIsRecord())
|
||||
MG_Remote::Server::ServerStagedTexture().Drop(
|
||||
MG_Remote::Server::StagedTextureStore::KeyForHandle(handle.Handle));
|
||||
MG_Record::ServerStagedTexture().Drop(
|
||||
MG_Record::StagedTextureStore::KeyForHandle(handle.Handle));
|
||||
}
|
||||
#endif
|
||||
if (static_cast<MGPipeKind>(handle.Kind) != MGPipeKind::Buffer) return;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "ServerSession.h"
|
||||
#include "ServerLoop.h"
|
||||
#include "../Transport/ReplySlot.h"
|
||||
#include "StagedTextureStore.h"
|
||||
#include <MG_Backend/Record/StagedTextureStore.h>
|
||||
|
||||
#include <Config.h>
|
||||
#include <MG_Backend/MGPipe/PipeInputs.h>
|
||||
@@ -110,7 +110,7 @@ namespace MobileGL::MG_Remote::Server {
|
||||
m_backend = backend;
|
||||
if (backend != nullptr) {
|
||||
const auto& limits = backend->GetDynamicParameters();
|
||||
ServerStagedTexture().SetDeviceLimits(
|
||||
MG_Record::ServerStagedTexture().SetDeviceLimits(
|
||||
limits.MaxTextureSize, limits.Max3DTextureSize, limits.MaxCubeMapTextureSize,
|
||||
limits.MaxArrayTextureLayers, limits.MaxTextureBufferSize);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#include <MG_Backend/DirectGLES/DirectGLES.h>
|
||||
#include <MG_Remote/FatalFunnel.h>
|
||||
#include <MG_Remote/Server/StagedShadow.h>
|
||||
#include <MG_Backend/Record/StagedShadow.h>
|
||||
#include <MG_Remote/Wire/PipeWireCodec.h>
|
||||
|
||||
#include <atomic>
|
||||
@@ -85,7 +85,7 @@ namespace MobileGL::MG_Remote::Server {
|
||||
// The server's staged stores (StagedShadow.h) file their entries under the same two
|
||||
// words as the twin tables, for the same reason one level up: the bytes they hold belong
|
||||
// to one session's group, and a session's teardown may drop only its own.
|
||||
Bool ResolveThreadStagedBucket(StagedBucket* outBucket) {
|
||||
Bool ResolveThreadStagedBucket(MG_Record::StagedBucket* outBucket) {
|
||||
MG_Backend::DirectGLES::TwinKey key;
|
||||
if (!ResolveThreadTwinKey(&key)) return false;
|
||||
outBucket->SessionKey = key.SessionKey;
|
||||
@@ -103,7 +103,7 @@ namespace MobileGL::MG_Remote::Server {
|
||||
// P14 S6: the twin tables' key. Same probe, one level down, installed beside the two it
|
||||
// is the twin of (the native tuple's and the applier's).
|
||||
MG_Backend::DirectGLES::SetTwinKeyResolver(&ResolveThreadTwinKey);
|
||||
SetStagedBucketResolver(&ResolveThreadStagedBucket);
|
||||
MG_Record::SetStagedBucketResolver(&ResolveThreadStagedBucket);
|
||||
}
|
||||
|
||||
SessionRuntime* Detail::CurrentRuntime() { return t_runtime; }
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
#include <MG_Remote/Server/PipeApplier.h>
|
||||
#include <MG_Remote/Server/ServerLoop.h>
|
||||
#include <MG_Remote/Server/ServerSession.h>
|
||||
#include <MG_Remote/Server/StagedShadow.h>
|
||||
#include <MG_Backend/Record/StagedShadow.h>
|
||||
#include <MG_Remote/Transport/InProcessTransport.h>
|
||||
#include <MG_Remote/Transport/ReplySlot.h>
|
||||
#include <MG_Remote/Transport/Ring.h>
|
||||
@@ -981,8 +981,8 @@ TEST(ServerLoopTest, TheAuditPoisonFillsExactlyTheStagedRunAfterTheApplierReturn
|
||||
// `raw - offset` cannot pass this, and the monolith arm below is the control that says so: it
|
||||
// is the SAME call with the same inputs, and it must see the 0xDD.
|
||||
TEST(StagedShadowTest, TheSplitArmCopiesAndSurvivesTheSourceBeingPoisoned) {
|
||||
Server::StagedShadowStore splitStore(/*copies=*/true);
|
||||
Server::StagedShadowStore monolithStore(/*copies=*/false);
|
||||
MG_Record::StagedShadowStore splitStore(/*copies=*/true);
|
||||
MG_Record::StagedShadowStore monolithStore(/*copies=*/false);
|
||||
const int key = 0;
|
||||
|
||||
Vector<Uint8> staged(32, 0xAB);
|
||||
@@ -1012,7 +1012,7 @@ TEST(StagedShadowTest, TheSplitArmCopiesAndSurvivesTheSourceBeingPoisoned) {
|
||||
// between them; runs with a gap do not, and that is the whole mechanism - it is what makes a
|
||||
// missing record detectable instead of papered over by a widened INVALIDATE_RANGE.
|
||||
TEST(StagedShadowTest, CoverageIsExactAndAGapIsNotCovered) {
|
||||
Server::StagedShadowStore store(/*copies=*/true);
|
||||
MG_Record::StagedShadowStore store(/*copies=*/true);
|
||||
const int key = 0;
|
||||
Vector<Uint8> bytes(16, 0x11);
|
||||
|
||||
@@ -1039,7 +1039,7 @@ TEST(StagedShadowTest, CoverageIsExactAndAGapIsNotCovered) {
|
||||
// just staged in the same generation (that regression really happened - TriangleScenario read a
|
||||
// shifted VBO). Both directions are asserted here.
|
||||
TEST(StagedShadowTest, HasShadowIsTrueAfterAdoptAndFalseAfterTheShadowIsDropped) {
|
||||
Server::StagedShadowStore store(/*copies=*/true);
|
||||
MG_Record::StagedShadowStore store(/*copies=*/true);
|
||||
const int key = 0;
|
||||
Vector<Uint8> bytes(16, Uint8{0x44});
|
||||
EXPECT_FALSE(store.HasShadow(&key)) << "nothing staged yet";
|
||||
@@ -1052,7 +1052,7 @@ TEST(StagedShadowTest, HasShadowIsTrueAfterAdoptAndFalseAfterTheShadowIsDropped)
|
||||
}
|
||||
|
||||
TEST(StagedShadowTest, DropForgetsOneResourceAndDropAllForgetsEveryOne) {
|
||||
Server::StagedShadowStore store(/*copies=*/true);
|
||||
MG_Record::StagedShadowStore store(/*copies=*/true);
|
||||
const int a = 0;
|
||||
const int b = 0;
|
||||
Vector<Uint8> bytes(8, 0x22);
|
||||
@@ -1072,7 +1072,7 @@ TEST(StagedShadowTest, DropForgetsOneResourceAndDropAllForgetsEveryOne) {
|
||||
// exactly the shape this wave shipped three of.
|
||||
#if !defined(_WIN32)
|
||||
TEST(StagedShadowTest, ADrainOutsideTheStagedCoverageIsFatalByName) {
|
||||
Server::StagedShadowStore store(/*copies=*/true);
|
||||
MG_Record::StagedShadowStore store(/*copies=*/true);
|
||||
const int key = 0;
|
||||
Vector<Uint8> bytes(16, 0x33);
|
||||
const Uint8* base = store.Adopt(&key, 64, bytes.data(), 0, 16);
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <MG_Util/Debug/Log.h>
|
||||
#include <MG_Backend/DirectGLES/Managers.h>
|
||||
#include <MG_Pipe/PipeApply.h>
|
||||
#include <MG_Remote/Server/StagedTextureStore.h>
|
||||
#include <MG_Backend/Record/StagedTextureStore.h>
|
||||
#include <MG_State/GLState/TextureState/TextureEnum.h>
|
||||
|
||||
#include <csignal>
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
using namespace MobileGL;
|
||||
|
||||
namespace Server = MobileGL::MG_Remote::Server;
|
||||
namespace Server = MobileGL::MG_Record; // P13 W5: the stores moved to MG_Backend/Record
|
||||
|
||||
namespace {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user