[MGPipe] carry full mutable mip extents independently of dirty upload boxes

This commit is contained in:
2026-09-20 12:46:01 -04:00
parent 0cb0e9af9b
commit 40c5443fc0
3 changed files with 16 additions and 1 deletions
+3
View File
@@ -1249,6 +1249,9 @@ namespace MobileGL::MG_Pipe {
static_cast<Uint32>(MGPipeResourceTargetForTextureTarget(texture->GetTarget())),
static_cast<Uint32>(uploadTarget));
m_lastSubData.Level = static_cast<Uint16>(level);
m_lastSubData.LevelWidth = static_cast<Uint32>(levelSize.x());
m_lastSubData.LevelHeight = static_cast<Uint32>(levelSize.y());
m_lastSubData.LevelDepth = static_cast<Uint32>(levelSize.z());
// ALWAYS 1 ON THE CLIENT SIDE. The conversion fallbacks (the packed-norm, widened
// and fallback upload preparers) are the server's and run there, so the bytes this
// record declares ARE the level shadow. The server clears the flag internally when
+4 -1
View File
@@ -1290,8 +1290,11 @@ namespace MobileGL::MG_Pipe {
Uint32 RegionCount; // MGPSubRegion[] in the variable tail
Uint32 Pad1;
MGPBlobRef Blob;
// Mutable GL images may define a lone mip or a noncanonical mip size.
// The dirty box describes changed texels, not the full staged image.
Uint32 LevelWidth, LevelHeight, LevelDepth, LevelPad;
};
MGP_ASSERT_POD(MGPSubData, 72);
MGP_ASSERT_POD(MGPSubData, 88);
// The one spelling of MGPSubData::Target's encoding, stated above the struct.
//
@@ -2040,6 +2040,15 @@ namespace MobileGL::MG_Remote::Wire {
// ---- transfer ---------------------------------------------------------------------
case MGPWireOp::ResourceSubData: {
const auto& rec = *static_cast<const MGPSubData*>(payload);
const Bool hasExtent = rec.LevelWidth || rec.LevelHeight || rec.LevelDepth;
if (hasExtent && (rec.Target == kMGPipeResourceTargetBuffer || !rec.LevelWidth ||
!rec.LevelHeight || !rec.LevelDepth || rec.LevelWidth > 0x7fffffffu ||
rec.LevelHeight > 0x7fffffffu || rec.LevelDepth > 0x7fffffffu ||
rec.UnionBox.X < 0 || rec.UnionBox.Y < 0 || rec.UnionBox.Z < 0 ||
Uint64(rec.UnionBox.X) + rec.UnionBox.W > rec.LevelWidth ||
Uint64(rec.UnionBox.Y) + rec.UnionBox.H > rec.LevelHeight ||
Uint64(rec.UnionBox.Z) + rec.UnionBox.D > rec.LevelDepth))
WireProtocolFatal("ResourceSubData.LevelExtent", "invalid full image extent or dirty box");
// Rule A arms both halves. The buffer half already declared a real size in
// monolith and is cross-checked at PipeApply.cpp:702; THE TEXTURE HALF DECLARED 0
// (TextureEmit.h:1265-1267, on the grounds that the byte count was "the server's