[Feat] (MG_Util|MG_State/TextureState): Add TexturePixelDataType::HalfFloat and TexturePixelDataType::UnsignedInt248. Handle TexturePixelDataType::Float32UnsignedInt248Rev.

This commit is contained in:
BZLZHH
2026-01-01 13:17:25 +08:00
parent 21dcbc9e52
commit b68d2859e8
5 changed files with 42 additions and 24 deletions
@@ -171,6 +171,8 @@ namespace MobileGL {
UnsignedInt,
Int,
Float,
HalfFloat,
UnsignedInt248,
UnsignedByte332,
UnsignedByte233Rev,
UnsignedShort565,
@@ -253,6 +253,10 @@ namespace MobileGL {
return TexturePixelDataType::Int;
case GL_FLOAT:
return TexturePixelDataType::Float;
case GL_HALF_FLOAT:
return TexturePixelDataType::HalfFloat;
case GL_UNSIGNED_INT_24_8:
return TexturePixelDataType::UnsignedInt248;
case GL_UNSIGNED_BYTE_3_3_2:
return TexturePixelDataType::UnsignedByte332;
case GL_UNSIGNED_BYTE_2_3_3_REV:
@@ -246,6 +246,10 @@ namespace MobileGL {
return GL_INT;
case TexturePixelDataType::Float:
return GL_FLOAT;
case TexturePixelDataType::HalfFloat:
return GL_HALF_FLOAT;
case TexturePixelDataType::UnsignedInt248:
return GL_UNSIGNED_INT_24_8;
case TexturePixelDataType::UnsignedByte332:
return GL_UNSIGNED_BYTE_3_3_2;
case TexturePixelDataType::UnsignedByte233Rev:
@@ -246,6 +246,10 @@ namespace MobileGL {
return "Int";
case TexturePixelDataType::Float:
return "Float";
case TexturePixelDataType::HalfFloat:
return "HalfFloat";
case TexturePixelDataType::UnsignedInt248:
return "UnsignedInt248";
case TexturePixelDataType::UnsignedByte332:
return "UnsignedByte332";
case TexturePixelDataType::UnsignedByte233Rev:
+28 -24
View File
@@ -94,29 +94,29 @@ namespace MobileGL {
SizeT GetBaseInputFormatComponentCount(TextureInputFormat format) {
switch (format) {
case TextureInputFormat::Red:
case TextureInputFormat::RInteger:
return 1;
case TextureInputFormat::RG:
case TextureInputFormat::RGInteger:
return 2;
case TextureInputFormat::RGB:
case TextureInputFormat::BGR:
case TextureInputFormat::RGBInteger:
case TextureInputFormat::BGRInteger:
return 3;
case TextureInputFormat::RGBA:
case TextureInputFormat::BGRA:
case TextureInputFormat::RGBAInteger:
case TextureInputFormat::BGRAInteger:
return 4;
case TextureInputFormat::StencilIndex:
case TextureInputFormat::DepthComponent:
case TextureInputFormat::DepthStencil:
return 1;
default:
MGLOG_D("%s: Unknown input format!", __func__);
return 0;
case TextureInputFormat::Red:
case TextureInputFormat::RInteger:
return 1;
case TextureInputFormat::RG:
case TextureInputFormat::RGInteger:
return 2;
case TextureInputFormat::RGB:
case TextureInputFormat::BGR:
case TextureInputFormat::RGBInteger:
case TextureInputFormat::BGRInteger:
return 3;
case TextureInputFormat::RGBA:
case TextureInputFormat::BGRA:
case TextureInputFormat::RGBAInteger:
case TextureInputFormat::BGRAInteger:
return 4;
case TextureInputFormat::StencilIndex:
case TextureInputFormat::DepthComponent:
case TextureInputFormat::DepthStencil:
return 1;
default:
MGLOG_D("%s: Unknown input format!", __func__);
return 0;
}
}
@@ -210,6 +210,9 @@ namespace MobileGL {
case TexturePixelDataType::UnsignedInt2101010Rev:
case TexturePixelDataType::UnsignedInt101111Rev:
case TexturePixelDataType::UnsignedInt5999Rev:
case TexturePixelDataType::UnsignedInt248:
case TexturePixelDataType::Float32UnsignedInt248Rev:
return 4;
return 4;
default:
return 0;
@@ -222,11 +225,12 @@ namespace MobileGL {
case TexturePixelDataType::Byte:
return 1;
case TexturePixelDataType::UnsignedShort:
case TexturePixelDataType::HalfFloat:
case TexturePixelDataType::Short:
return 2;
case TexturePixelDataType::UnsignedInt:
case TexturePixelDataType::Int:
case TexturePixelDataType::Float:
case TexturePixelDataType::Int:
return 4;
default:
return 0;