[Fix] (P11 M2, Espryt, Magma): the texture emitter carries a level's exact dirty footprint as its regions (dev 9524c688) - a single partial box as one region, only a whole-level write as none - so both servers upload exactly the texels written over GPU content; the applier keeps it exact up to 4096 regions, and Espryt's handle arm applies the storage's box-or-rects cut-offs itself while its texture holds no GPU writes

This commit is contained in:
2026-09-29 12:16:55 -04:00
parent c371599811
commit 9145433890
5 changed files with 133 additions and 36 deletions
+21 -3
View File
@@ -9038,9 +9038,27 @@ namespace MobileGL::MG_Backend::DirectGLES {
// whole story" (D-D3), which is the same statement the
// frontend's GetStorageDirtyRects makes by returning 0 - so
// both arms reach the box branch below by the same route.
dirtyRectCount =
std::min<SizeT>(pendingUpload->Regions.size(),
MG_State::GLState::MipmapStorage::kMaxDirtyRects);
//
// P11 M2: the record's list is the level's EXACT footprint now
// (TextureEmit.h), which the storage's own rect list only
// covered, and the storage withheld that list - "0 rects" - when
// it held more rects than it keeps or when they added up to 3/4
// of the union box (one driver call on nearly the same bytes).
// Both cut-offs are this side's to apply now, so the box-or-rects
// choice on a texture the GPU has not written is what it was.
// (Once the GPU may have written it, the footprint below uploads
// every region exactly, whatever this chose.) Never a partial
// list: a truncated list is dropped writes.
SizeT summedTexels = 0;
for (const auto& region : pendingUpload->Regions) {
summedTexels += static_cast<SizeT>(region.W) * static_cast<SizeT>(region.H) *
static_cast<SizeT>(std::max<Uint32>(region.D, 1));
}
const Bool listWithheld =
pendingUpload->Regions.size() < 2 ||
pendingUpload->Regions.size() > MG_State::GLState::MipmapStorage::kMaxDirtyRects ||
summedTexels * 4 >= dirtyRegion.TexelCount() * 3;
dirtyRectCount = listWithheld ? 0 : pendingUpload->Regions.size();
for (SizeT r = 0; r < dirtyRectCount; ++r) {
const auto& region = pendingUpload->Regions[r];
dirtyRects[r] = MG_State::GLState::MipmapDirtyRegion{