From 1dc217b32cb0816374c72dc5c90049078bb07e7b Mon Sep 17 00:00:00 2001 From: Swung0x48 Date: Thu, 16 Jul 2026 03:54:33 -0400 Subject: [PATCH] [Fix] (MG_Util/Metrics): correct Depth32FStencil8 shadow texel size (16->8) and FLOAT_32_UNSIGNED_INT_24_8_REV type size (4->8) to the GL client transfer layout --- MobileGL/MG_Util/Metrics/TextureMetrics.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/MobileGL/MG_Util/Metrics/TextureMetrics.cpp b/MobileGL/MG_Util/Metrics/TextureMetrics.cpp index 4bf7da45..1c92191c 100644 --- a/MobileGL/MG_Util/Metrics/TextureMetrics.cpp +++ b/MobileGL/MG_Util/Metrics/TextureMetrics.cpp @@ -87,6 +87,9 @@ namespace MobileGL { case TextureInternalFormat::RG32F: case TextureInternalFormat::RG32I: case TextureInternalFormat::RG32UI: + // Matches the FLOAT_32_UNSIGNED_INT_24_8_REV client layout the shadow storage keeps: + // a float32 depth word followed by a word with stencil in bits 0-7. + case TextureInternalFormat::Depth32FStencil8: return 8; case TextureInternalFormat::RGB32F: @@ -97,7 +100,6 @@ namespace MobileGL { case TextureInternalFormat::RGBA32F: case TextureInternalFormat::RGBA32I: case TextureInternalFormat::RGBA32UI: - case TextureInternalFormat::Depth32FStencil8: return 16; case TextureInternalFormat::R11FG11FB10F: @@ -243,8 +245,11 @@ namespace MobileGL { case TexturePixelDataType::UnsignedInt101111Rev: case TexturePixelDataType::UnsignedInt5999Rev: case TexturePixelDataType::UnsignedInt248: - case TexturePixelDataType::Float32UnsignedInt248Rev: return 4; + // FLOAT_32_UNSIGNED_INT_24_8_REV transfers two 32-bit words per texel: + // a float32 depth word followed by a word with stencil in bits 0-7. + case TexturePixelDataType::Float32UnsignedInt248Rev: + return 8; default: return 0; }