mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
VideoBackends / VideoCommon: add type enum to dictate whether a texture is a 2D texture, a texture array, or a cube map; support 2D texture type across backends
Co-authored-by: TellowKrinkle <tellowkrinkle@gmail.com>
This commit is contained in:
@ -70,8 +70,9 @@ std::unique_ptr<VKTexture> VKTexture::Create(const TextureConfig& tex_config, st
|
||||
|
||||
VkImageCreateInfo image_info = {VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
|
||||
nullptr,
|
||||
tex_config.IsCubeMap() ? VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT :
|
||||
static_cast<VkImageCreateFlags>(0),
|
||||
tex_config.type == AbstractTextureType::Texture_CubeMap ?
|
||||
VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT :
|
||||
static_cast<VkImageCreateFlags>(0),
|
||||
VK_IMAGE_TYPE_2D,
|
||||
GetVkFormatForHostTextureFormat(tex_config.format),
|
||||
{tex_config.width, tex_config.height, 1},
|
||||
@ -107,8 +108,26 @@ std::unique_ptr<VKTexture> VKTexture::Create(const TextureConfig& tex_config, st
|
||||
|
||||
std::unique_ptr<VKTexture> texture = std::make_unique<VKTexture>(
|
||||
tex_config, alloc, image, name, VK_IMAGE_LAYOUT_UNDEFINED, ComputeImageLayout::Undefined);
|
||||
if (!texture->CreateView(tex_config.IsCubeMap() ? VK_IMAGE_VIEW_TYPE_CUBE :
|
||||
VK_IMAGE_VIEW_TYPE_2D_ARRAY))
|
||||
|
||||
VkImageViewType image_view_type = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
|
||||
if (tex_config.type == AbstractTextureType::Texture_CubeMap)
|
||||
{
|
||||
image_view_type = VK_IMAGE_VIEW_TYPE_CUBE;
|
||||
}
|
||||
else if (tex_config.type == AbstractTextureType::Texture_2D)
|
||||
{
|
||||
image_view_type = VK_IMAGE_VIEW_TYPE_2D;
|
||||
}
|
||||
else if (tex_config.type == AbstractTextureType::Texture_2DArray)
|
||||
{
|
||||
image_view_type = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
|
||||
}
|
||||
else
|
||||
{
|
||||
PanicAlertFmt("Unhandled texture type.");
|
||||
return nullptr;
|
||||
}
|
||||
if (!texture->CreateView(image_view_type))
|
||||
return nullptr;
|
||||
|
||||
return texture;
|
||||
|
Reference in New Issue
Block a user