mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-27 12:31:50 +01:00
Use guest texture view type to determine the underlying image type
If we have a Nx1x1 image then determining the type from dimensions will result in a 1D image being created thus preventing us from creating a 2D view. By using the image view type we can avoid this for textures from TICs since we know in advance how they will be used
This commit is contained in:
parent
05966f34e5
commit
486a835d0a
@ -295,17 +295,32 @@ namespace skyline::gpu {
|
||||
if (format->vkAspect & (vk::ImageAspectFlagBits::eDepth | vk::ImageAspectFlagBits::eStencil))
|
||||
usage |= vk::ImageUsageFlagBits::eDepthStencilAttachment;
|
||||
|
||||
// First attempt to derive type from dimensions
|
||||
auto imageType{guest->dimensions.GetType()};
|
||||
|
||||
// Try to ensure that the image type is compatible with the given image view type since we can't create a 2D image view from a 1D image
|
||||
if (imageType == vk::ImageType::e1D && guest->type != texture::TextureType::e1D && guest->type != texture::TextureType::e1DArray) {
|
||||
switch (guest->type) {
|
||||
case texture::TextureType::e3D:
|
||||
imageType = vk::ImageType::e3D;
|
||||
break;
|
||||
default:
|
||||
imageType = vk::ImageType::e2D;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
vk::ImageCreateFlags flags{gpu.traits.quirks.vkImageMutableFormatCostly ? vk::ImageCreateFlags{} : vk::ImageCreateFlagBits::eMutableFormat};
|
||||
|
||||
if (guest->dimensions.GetType() == vk::ImageType::e2D && dimensions.width == dimensions.height && layerCount >= 6)
|
||||
if (imageType == vk::ImageType::e2D && dimensions.width == dimensions.height && layerCount >= 6)
|
||||
flags |= vk::ImageCreateFlagBits::eCubeCompatible;
|
||||
else if (guest->dimensions.GetType() == vk::ImageType::e3D)
|
||||
else if (imageType == vk::ImageType::e3D)
|
||||
flags |= vk::ImageCreateFlagBits::e2DArrayCompatible;
|
||||
|
||||
|
||||
vk::ImageCreateInfo imageCreateInfo{
|
||||
.flags = flags,
|
||||
.imageType = guest->dimensions.GetType(),
|
||||
.imageType = imageType,
|
||||
.format = *guest->format,
|
||||
.extent = guest->dimensions,
|
||||
.mipLevels = 1,
|
||||
|
Loading…
Reference in New Issue
Block a user