From ed01f4e31a03c77bf5b0ab804ef2890ab051fe95 Mon Sep 17 00:00:00 2001 From: Swung0x48 Date: Sun, 20 Sep 2026 13:02:56 -0400 Subject: [PATCH] [MGPipe] preserve explicit mip extents in the shared texture staging owner --- MobileGL/MG_Backend/DirectGLES/Managers.cpp | 7 +------ MobileGL/MG_Pipe/PipeApply.cpp | 2 +- MobileGL/MG_Remote/Server/StagedTextureStore.h | 8 ++++++++ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/MobileGL/MG_Backend/DirectGLES/Managers.cpp b/MobileGL/MG_Backend/DirectGLES/Managers.cpp index 24459b5b..7cde9abd 100644 --- a/MobileGL/MG_Backend/DirectGLES/Managers.cpp +++ b/MobileGL/MG_Backend/DirectGLES/Managers.cpp @@ -2723,12 +2723,7 @@ namespace MobileGL::MG_Backend::DirectGLES { if (bytes == nullptr || record.Blob.Size == 0) return; const auto* stored = PipeTextureRecordForHandle(res); if (stored == nullptr) return; - const IntVec3 extent = record.LevelWidth && record.LevelHeight && record.LevelDepth - ? IntVec3{static_cast(record.LevelWidth), static_cast(record.LevelHeight), - static_cast(record.LevelDepth)} - : MG_Remote::Server::StagedTextureMipExtent( - stored->Desc.Target, stored->Desc.Width, stored->Desc.Height, stored->Desc.Depth, - static_cast(record.Level)); + const IntVec3 extent = MG_Remote::Server::StagedTextureUploadExtent(stored->Desc, record); store.Adopt(MG_Remote::Server::StagedTextureStore::KeyForHandle(res), MG_Pipe::MGPipeSubDataUploadTargetOf(record.Target), record.Level, extent, bytes, static_cast(record.Blob.Size)); diff --git a/MobileGL/MG_Pipe/PipeApply.cpp b/MobileGL/MG_Pipe/PipeApply.cpp index f2e359c7..7a3addb6 100644 --- a/MobileGL/MG_Pipe/PipeApply.cpp +++ b/MobileGL/MG_Pipe/PipeApply.cpp @@ -1024,7 +1024,7 @@ namespace MobileGL::MG_Pipe { const auto& desc = stored.Desc; store.Adopt(MG_Remote::Server::StagedTextureStore::KeyForHandle(upload.Res), MGPipeSubDataUploadTargetOf(upload.Target), upload.Level, - MG_Remote::Server::StagedTextureMipExtent(desc.Target, desc.Width, desc.Height, desc.Depth, upload.Level), + MG_Remote::Server::StagedTextureUploadExtent(desc, upload), bytes, static_cast(upload.Blob.Size)); } diff --git a/MobileGL/MG_Remote/Server/StagedTextureStore.h b/MobileGL/MG_Remote/Server/StagedTextureStore.h index 7c8372d1..5ef2a549 100644 --- a/MobileGL/MG_Remote/Server/StagedTextureStore.h +++ b/MobileGL/MG_Remote/Server/StagedTextureStore.h @@ -131,6 +131,14 @@ namespace MobileGL::MG_Remote::Server { return extent; } + inline IntVec3 StagedTextureUploadExtent(const MG_Pipe::MGPResourceDesc& desc, + const MG_Pipe::MGPSubData& upload) { + if (upload.LevelWidth && upload.LevelHeight && upload.LevelDepth) + return {static_cast(upload.LevelWidth), static_cast(upload.LevelHeight), + static_cast(upload.LevelDepth)}; + return StagedTextureMipExtent(desc.Target, desc.Width, desc.Height, desc.Depth, upload.Level); + } + class StagedTextureStore { public: // `copies` is "this process is really split". False reproduces the monolith expression