diff --git a/MobileGL/MG_Backend/DirectVulkan/Renderer/VkTextureManager.cpp b/MobileGL/MG_Backend/DirectVulkan/Renderer/VkTextureManager.cpp index e2dfc61b..ce47020b 100644 --- a/MobileGL/MG_Backend/DirectVulkan/Renderer/VkTextureManager.cpp +++ b/MobileGL/MG_Backend/DirectVulkan/Renderer/VkTextureManager.cpp @@ -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: diff --git a/MobileGL/MG_Backend/DirectVulkan/Renderer/VkTextureManager.h b/MobileGL/MG_Backend/DirectVulkan/Renderer/VkTextureManager.h index 6340d451..7846b529 100644 --- a/MobileGL/MG_Backend/DirectVulkan/Renderer/VkTextureManager.h +++ b/MobileGL/MG_Backend/DirectVulkan/Renderer/VkTextureManager.h @@ -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; diff --git a/MobileGL/MG_Util/Converters/MGToVk/TextureEnumConverter.cpp b/MobileGL/MG_Util/Converters/MGToVk/TextureEnumConverter.cpp index 05a7154f..68568525 100644 --- a/MobileGL/MG_Util/Converters/MGToVk/TextureEnumConverter.cpp +++ b/MobileGL/MG_Util/Converters/MGToVk/TextureEnumConverter.cpp @@ -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; }