[Fix] (MG_Backend/DirectVulkan): hook up TextureManager to TextureEnumConverter

This commit is contained in:
2026-03-03 13:30:33 +08:00
parent fc3a7cd5f1
commit 7687c19b33
3 changed files with 3 additions and 22 deletions
@@ -9,6 +9,7 @@
#include "VkTextureManager.h"
#include "MG_State/GLState/Core.h"
#include "MG_Util/Converters/MGToVk/TextureEnumConverter.h"
namespace MobileGL::MG_Backend::DirectVulkan {
Bool VkTextureManager::Initialize(const InitInfo& initInfo) {
@@ -148,7 +149,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
TextureUploadTarget uploadTarget,
const IntVec3 &texelSize, SizeT byteSize, Uint32 mipLevels,
TextureResource &resource) {
const VkFormat format = GetVkFormat(texture.GetFormat());
const VkFormat format = MG_Util::ConvertTextureInternalFormatToVkEnum(texture.GetFormat());
if (format == VK_FORMAT_UNDEFINED) {
MGLOG_D("%s: format == VK_FORMAT_UNDEFINED", __func__);
return false;
@@ -428,24 +429,6 @@ namespace MobileGL::MG_Backend::DirectVulkan {
return validLevelCount;
}
VkFormat VkTextureManager::GetVkFormat(TextureInternalFormat format) {
switch (format) {
case TextureInternalFormat::RGBA:
case TextureInternalFormat::RGBA8:
return VK_FORMAT_R8G8B8A8_UNORM;
case TextureInternalFormat::SRGB8Alpha8:
return VK_FORMAT_R8G8B8A8_SRGB;
case TextureInternalFormat::Depth24Stencil8:
return VK_FORMAT_D24_UNORM_S8_UINT;
case TextureInternalFormat::Depth32FStencil8:
return VK_FORMAT_D32_SFLOAT_S8_UINT;
case TextureInternalFormat::DepthComponent32F:
return VK_FORMAT_D32_SFLOAT;
default:
return VK_FORMAT_UNDEFINED;
}
}
VkImageAspectFlags VkTextureManager::GetAspectMaskForFormat(VkFormat format) {
switch (format) {
case VK_FORMAT_D16_UNORM:
@@ -100,7 +100,6 @@ private:
SizeT& outByteSize,
Uint32& outMipLevelCount);
static Uint32 GetUploadMipLevelCount(const MG_State::GLState::TextureObjectMipmap& texture, TextureUploadTarget target);
static VkFormat GetVkFormat(TextureInternalFormat format);
static VkImageAspectFlags GetAspectMaskForFormat(VkFormat format);
VkDevice m_device = VK_NULL_HANDLE;
@@ -126,8 +126,6 @@ namespace MobileGL {
return VK_FORMAT_A2R10G10B10_UNORM_PACK32;
case TextureInternalFormat::RGB10A2UI:
return VK_FORMAT_A2R10G10B10_UINT_PACK32;
case TextureInternalFormat::RGBA12:
return VK_FORMAT_UNDEFINED;
case TextureInternalFormat::RGBA16:
return VK_FORMAT_R16G16B16A16_UNORM;
case TextureInternalFormat::SRGB8:
@@ -226,6 +224,7 @@ namespace MobileGL {
return VK_FORMAT_R8G8B8_UNORM;
case TextureInternalFormat::RGBA:
return VK_FORMAT_R8G8B8A8_UNORM;
case TextureInternalFormat::RGBA12:
default:
return VK_FORMAT_UNDEFINED;
}