[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, UnsignedInt,
Int, Int,
Float, Float,
HalfFloat,
UnsignedInt248,
UnsignedByte332, UnsignedByte332,
UnsignedByte233Rev, UnsignedByte233Rev,
UnsignedShort565, UnsignedShort565,
@@ -253,6 +253,10 @@ namespace MobileGL {
return TexturePixelDataType::Int; return TexturePixelDataType::Int;
case GL_FLOAT: case GL_FLOAT:
return TexturePixelDataType::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: case GL_UNSIGNED_BYTE_3_3_2:
return TexturePixelDataType::UnsignedByte332; return TexturePixelDataType::UnsignedByte332;
case GL_UNSIGNED_BYTE_2_3_3_REV: case GL_UNSIGNED_BYTE_2_3_3_REV:
@@ -246,6 +246,10 @@ namespace MobileGL {
return GL_INT; return GL_INT;
case TexturePixelDataType::Float: case TexturePixelDataType::Float:
return GL_FLOAT; return GL_FLOAT;
case TexturePixelDataType::HalfFloat:
return GL_HALF_FLOAT;
case TexturePixelDataType::UnsignedInt248:
return GL_UNSIGNED_INT_24_8;
case TexturePixelDataType::UnsignedByte332: case TexturePixelDataType::UnsignedByte332:
return GL_UNSIGNED_BYTE_3_3_2; return GL_UNSIGNED_BYTE_3_3_2;
case TexturePixelDataType::UnsignedByte233Rev: case TexturePixelDataType::UnsignedByte233Rev:
@@ -246,6 +246,10 @@ namespace MobileGL {
return "Int"; return "Int";
case TexturePixelDataType::Float: case TexturePixelDataType::Float:
return "Float"; return "Float";
case TexturePixelDataType::HalfFloat:
return "HalfFloat";
case TexturePixelDataType::UnsignedInt248:
return "UnsignedInt248";
case TexturePixelDataType::UnsignedByte332: case TexturePixelDataType::UnsignedByte332:
return "UnsignedByte332"; return "UnsignedByte332";
case TexturePixelDataType::UnsignedByte233Rev: case TexturePixelDataType::UnsignedByte233Rev:
+28 -24
View File
@@ -94,29 +94,29 @@ namespace MobileGL {
SizeT GetBaseInputFormatComponentCount(TextureInputFormat format) { SizeT GetBaseInputFormatComponentCount(TextureInputFormat format) {
switch (format) { switch (format) {
case TextureInputFormat::Red: case TextureInputFormat::Red:
case TextureInputFormat::RInteger: case TextureInputFormat::RInteger:
return 1; return 1;
case TextureInputFormat::RG: case TextureInputFormat::RG:
case TextureInputFormat::RGInteger: case TextureInputFormat::RGInteger:
return 2; return 2;
case TextureInputFormat::RGB: case TextureInputFormat::RGB:
case TextureInputFormat::BGR: case TextureInputFormat::BGR:
case TextureInputFormat::RGBInteger: case TextureInputFormat::RGBInteger:
case TextureInputFormat::BGRInteger: case TextureInputFormat::BGRInteger:
return 3; return 3;
case TextureInputFormat::RGBA: case TextureInputFormat::RGBA:
case TextureInputFormat::BGRA: case TextureInputFormat::BGRA:
case TextureInputFormat::RGBAInteger: case TextureInputFormat::RGBAInteger:
case TextureInputFormat::BGRAInteger: case TextureInputFormat::BGRAInteger:
return 4; return 4;
case TextureInputFormat::StencilIndex: case TextureInputFormat::StencilIndex:
case TextureInputFormat::DepthComponent: case TextureInputFormat::DepthComponent:
case TextureInputFormat::DepthStencil: case TextureInputFormat::DepthStencil:
return 1; return 1;
default: default:
MGLOG_D("%s: Unknown input format!", __func__); MGLOG_D("%s: Unknown input format!", __func__);
return 0; return 0;
} }
} }
@@ -210,6 +210,9 @@ namespace MobileGL {
case TexturePixelDataType::UnsignedInt2101010Rev: case TexturePixelDataType::UnsignedInt2101010Rev:
case TexturePixelDataType::UnsignedInt101111Rev: case TexturePixelDataType::UnsignedInt101111Rev:
case TexturePixelDataType::UnsignedInt5999Rev: case TexturePixelDataType::UnsignedInt5999Rev:
case TexturePixelDataType::UnsignedInt248:
case TexturePixelDataType::Float32UnsignedInt248Rev:
return 4;
return 4; return 4;
default: default:
return 0; return 0;
@@ -222,11 +225,12 @@ namespace MobileGL {
case TexturePixelDataType::Byte: case TexturePixelDataType::Byte:
return 1; return 1;
case TexturePixelDataType::UnsignedShort: case TexturePixelDataType::UnsignedShort:
case TexturePixelDataType::HalfFloat:
case TexturePixelDataType::Short: case TexturePixelDataType::Short:
return 2; return 2;
case TexturePixelDataType::UnsignedInt: case TexturePixelDataType::UnsignedInt:
case TexturePixelDataType::Int:
case TexturePixelDataType::Float: case TexturePixelDataType::Float:
case TexturePixelDataType::Int:
return 4; return 4;
default: default:
return 0; return 0;