[Fix] (MG_Backend/DirectGLES): Handle more internal format.

This commit is contained in:
BZLZHH
2025-11-30 11:24:21 +08:00
parent fe6bd76cfa
commit 7a9cb2dafb
5 changed files with 112 additions and 35 deletions
@@ -4,7 +4,7 @@ namespace MobileGL {
namespace MG_State {
namespace GLState {
TextureObject1D::TextureObject1D(Uint externalIndex)
: TextureObjectWithOneMipmap(TextureTarget::Texture1D, externalIndex) {}
: TextureObjectWithOneMipmap(TextureTarget::Texture1D, externalIndex) {}
Uint TextureObject1D::GetIndexOfTextureUploadTarget(TextureUploadTarget target) const {
MOBILEGL_ASSERT(target == TextureUploadTarget::Texture1D ||
@@ -3,10 +3,8 @@
namespace MobileGL {
namespace MG_State {
namespace GLState {
TextureObject2DCube::TextureObject2DCube(Uint externalIndex):
TextureObjectBase(TextureTarget::TextureCubeMap, externalIndex) {
}
TextureObject2DCube::TextureObject2DCube(Uint externalIndex)
: TextureObjectBase(TextureTarget::TextureCubeMap, externalIndex) {}
Uint TextureObject2DCube::GetMipmapLevelCount() const {
return m_textureStorage.GetLevelCount();
@@ -4,7 +4,7 @@ namespace MobileGL {
namespace MG_State {
namespace GLState {
TextureObject3D::TextureObject3D(Uint externalIndex)
: TextureObjectWithOneMipmap(TextureTarget::Texture3D, externalIndex) {}
: TextureObjectWithOneMipmap(TextureTarget::Texture3D, externalIndex) {}
Uint TextureObject3D::GetIndexOfTextureUploadTarget(TextureUploadTarget target) const {
MOBILEGL_ASSERT(target == TextureUploadTarget::Texture3D ||
@@ -14,9 +14,7 @@ namespace MobileGL {
template <SizeT TargetCount>
class TextureStorage {
public:
TextureStorage() {
static_assert(TargetCount > 0, "Mipmap size must be greater than zero");
}
TextureStorage() { static_assert(TargetCount > 0, "Mipmap size must be greater than zero"); }
void AllocateLevel(Uint targetIndex, Uint level, MipmapInput input) {
MOBILEGL_ASSERT(targetIndex < TargetCount, "AllocateLevel: target invalid");
@@ -61,8 +59,7 @@ namespace MobileGL {
MOBILEGL_ASSERT(targetIndex < TargetCount, "GetTexelSize: target invalid");
auto& targetTexelSizes = m_texelSizes[targetIndex];
if (level >= targetTexelSizes.size())
return {0, 0, 0};
if (level >= targetTexelSizes.size()) return {0, 0, 0};
return targetTexelSizes[level];
}
@@ -73,9 +70,7 @@ namespace MobileGL {
return data[level].size();
}
SizeT GetLevelCount() const {
return m_data[0].size();
}
SizeT GetLevelCount() const { return m_data[0].size(); }
void MarkDirty(Uint targetIndex, Uint level, bool dirty) {
MOBILEGL_ASSERT(targetIndex < TargetCount, "MarkDirty: target invalid");
@@ -94,6 +89,6 @@ namespace MobileGL {
Array<Vector<Vector<Uint8>>, TargetCount> m_data;
Array<Vector<bool>, TargetCount> m_isDirty;
};
}
}
}
} // namespace GLState
} // namespace MG_State
} // namespace MobileGL