mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 05:38:31 +09:00
[Fix] (MG_Backend/DirectVulkan): hook up TextureManager to TextureEnumConverter
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
#include "VkTextureManager.h"
|
#include "VkTextureManager.h"
|
||||||
|
|
||||||
#include "MG_State/GLState/Core.h"
|
#include "MG_State/GLState/Core.h"
|
||||||
|
#include "MG_Util/Converters/MGToVk/TextureEnumConverter.h"
|
||||||
|
|
||||||
namespace MobileGL::MG_Backend::DirectVulkan {
|
namespace MobileGL::MG_Backend::DirectVulkan {
|
||||||
Bool VkTextureManager::Initialize(const InitInfo& initInfo) {
|
Bool VkTextureManager::Initialize(const InitInfo& initInfo) {
|
||||||
@@ -148,7 +149,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
TextureUploadTarget uploadTarget,
|
TextureUploadTarget uploadTarget,
|
||||||
const IntVec3 &texelSize, SizeT byteSize, Uint32 mipLevels,
|
const IntVec3 &texelSize, SizeT byteSize, Uint32 mipLevels,
|
||||||
TextureResource &resource) {
|
TextureResource &resource) {
|
||||||
const VkFormat format = GetVkFormat(texture.GetFormat());
|
const VkFormat format = MG_Util::ConvertTextureInternalFormatToVkEnum(texture.GetFormat());
|
||||||
if (format == VK_FORMAT_UNDEFINED) {
|
if (format == VK_FORMAT_UNDEFINED) {
|
||||||
MGLOG_D("%s: format == VK_FORMAT_UNDEFINED", __func__);
|
MGLOG_D("%s: format == VK_FORMAT_UNDEFINED", __func__);
|
||||||
return false;
|
return false;
|
||||||
@@ -428,24 +429,6 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
return validLevelCount;
|
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) {
|
VkImageAspectFlags VkTextureManager::GetAspectMaskForFormat(VkFormat format) {
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case VK_FORMAT_D16_UNORM:
|
case VK_FORMAT_D16_UNORM:
|
||||||
|
|||||||
@@ -100,7 +100,6 @@ private:
|
|||||||
SizeT& outByteSize,
|
SizeT& outByteSize,
|
||||||
Uint32& outMipLevelCount);
|
Uint32& outMipLevelCount);
|
||||||
static Uint32 GetUploadMipLevelCount(const MG_State::GLState::TextureObjectMipmap& texture, TextureUploadTarget target);
|
static Uint32 GetUploadMipLevelCount(const MG_State::GLState::TextureObjectMipmap& texture, TextureUploadTarget target);
|
||||||
static VkFormat GetVkFormat(TextureInternalFormat format);
|
|
||||||
static VkImageAspectFlags GetAspectMaskForFormat(VkFormat format);
|
static VkImageAspectFlags GetAspectMaskForFormat(VkFormat format);
|
||||||
|
|
||||||
VkDevice m_device = VK_NULL_HANDLE;
|
VkDevice m_device = VK_NULL_HANDLE;
|
||||||
|
|||||||
@@ -126,8 +126,6 @@ namespace MobileGL {
|
|||||||
return VK_FORMAT_A2R10G10B10_UNORM_PACK32;
|
return VK_FORMAT_A2R10G10B10_UNORM_PACK32;
|
||||||
case TextureInternalFormat::RGB10A2UI:
|
case TextureInternalFormat::RGB10A2UI:
|
||||||
return VK_FORMAT_A2R10G10B10_UINT_PACK32;
|
return VK_FORMAT_A2R10G10B10_UINT_PACK32;
|
||||||
case TextureInternalFormat::RGBA12:
|
|
||||||
return VK_FORMAT_UNDEFINED;
|
|
||||||
case TextureInternalFormat::RGBA16:
|
case TextureInternalFormat::RGBA16:
|
||||||
return VK_FORMAT_R16G16B16A16_UNORM;
|
return VK_FORMAT_R16G16B16A16_UNORM;
|
||||||
case TextureInternalFormat::SRGB8:
|
case TextureInternalFormat::SRGB8:
|
||||||
@@ -226,6 +224,7 @@ namespace MobileGL {
|
|||||||
return VK_FORMAT_R8G8B8_UNORM;
|
return VK_FORMAT_R8G8B8_UNORM;
|
||||||
case TextureInternalFormat::RGBA:
|
case TextureInternalFormat::RGBA:
|
||||||
return VK_FORMAT_R8G8B8A8_UNORM;
|
return VK_FORMAT_R8G8B8A8_UNORM;
|
||||||
|
case TextureInternalFormat::RGBA12:
|
||||||
default:
|
default:
|
||||||
return VK_FORMAT_UNDEFINED;
|
return VK_FORMAT_UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user