[Fix] (MG_Util/Texture, MG_Util/Converters): canonical packed transfer types for RGBA4/RGB565/RGB10_A2UI - NormalizePixelFormat's default handed backends GL_UNSIGNED_BYTE (and a non-integer GL_RGB transfer format for RGB10_A2UI), so uploads read 4 bytes per texel from 2-byte packed shadow rows (rgba4 layers shifted by 2x slice stride) or were rejected outright; also map GL_RGB565 <-> TextureInternalFormat::RGB5 (the enum had no GL_RGB565 mapping at all, glTexImage* with it failed as unknown)

This commit is contained in:
2026-07-16 19:44:36 -04:00
parent 25323bfb8e
commit 72532de780
3 changed files with 24 additions and 1 deletions
@@ -282,12 +282,17 @@ namespace MobileGL::MG_Util::TextureFormatProcessor {
// Color sized other
case GL_RGB9_E5:
case GL_R11F_G11F_B10F:
case GL_RGB565:
*outFormat = GL_RGB;
break;
case GL_RGB10_A2:
case GL_RGB5_A1:
case GL_RGBA4:
*outFormat = GL_RGBA;
break;
case GL_RGB10_A2UI:
*outFormat = GL_RGBA_INTEGER;
break;
// Depth
case GL_DEPTH_COMPONENT16:
@@ -459,11 +464,23 @@ namespace MobileGL::MG_Util::TextureFormatProcessor {
*outType = GL_UNSIGNED_INT_10F_11F_11F_REV;
break;
case GL_RGB10_A2:
case GL_RGB10_A2UI:
*outType = GL_UNSIGNED_INT_2_10_10_10_REV;
break;
case GL_RGB5_A1:
*outType = GL_UNSIGNED_SHORT_5_5_5_1;
break;
// The shadow mip keeps these formats' packed client bytes (legacy copy path),
// so the canonical transfer type must stay the packed word — the previous
// default (GL_UNSIGNED_BYTE) made the backend read 4 bytes per texel from a
// 2-byte-per-texel shadow (KHR-GL33.pixelstoragemodes teximage rgba4/rgb565
// sliced/garbled uploads).
case GL_RGBA4:
*outType = GL_UNSIGNED_SHORT_4_4_4_4;
break;
case GL_RGB565:
*outType = GL_UNSIGNED_SHORT_5_6_5;
break;
// Depth
case GL_DEPTH_COMPONENT16: