[Perf] (DirectGLES): upload the union dirty box instead of scatter rects when staging through the unpack ring (each PBO-sourced glTexSubImage is a GPU copy job on Mali; ~100 sprite rects per tick cost +6ms/frame of GPU time)

This commit is contained in:
2026-08-26 05:52:31 -04:00
parent 56e5d13dc9
commit 33eabfc2ff
@@ -4002,6 +4002,15 @@ namespace MobileGL::MG_Backend::DirectGLES {
dirtyRectCount = textureMipmapObject->GetStorageDirtyRects(
uploadTarget, level, dirtyRects,
MG_State::GLState::MipmapStorage::kMaxDirtyRects);
// The scatter refinement pays only on the client-pointer path,
// where fewer bytes mean less driver-side copying. Through the
// unpack ring every glTexSubImage is a GPU copy job (Mali), so
// ~100 sprite rects become ~100 jobs whose fixed cost dwarfs
// the union box's extra bytes - measured +6 ms/frame of GPU
// time in MC's animated-atlas ticks. One box, one job.
if (BufferImpl::UnpackRingAvailable()) {
dirtyRectCount = 0;
}
}
const auto rectShadowPtr = [&](const MG_State::GLState::MipmapDirtyRegion& rect) {
return static_cast<const Uint8*>(uploadData) +