Avoid format aliasing warnings on Adreno

Implements an algorithm to determine formats that can be aliased as views without needing `VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT`, this avoids spamming warning logs on view creation when the aliased formats will function in practice.
This commit is contained in:
PixelyIon
2022-05-05 19:06:09 +05:30
parent 7206ab4c67
commit 62ea2a6da5
4 changed files with 170 additions and 4 deletions

View File

@ -7,6 +7,7 @@
#include <kernel/types/KProcess.h>
#include "texture.h"
#include "layout.h"
#include "adreno_aliasing.h"
namespace skyline::gpu {
u32 GuestTexture::GetLayerSize() {
@ -539,8 +540,9 @@ namespace skyline::gpu {
if (!pFormat)
pFormat = format;
if (gpu.traits.quirks.vkImageMutableFormatCostly && pFormat->vkFormat != format->vkFormat)
Logger::Warn("Creating a view of a texture with a different format without mutable format: {} - {}", vk::to_string(pFormat->vkFormat), vk::to_string(format->vkFormat));
auto viewFormat{pFormat->vkFormat}, textureFormat{format->vkFormat};
if (gpu.traits.quirks.vkImageMutableFormatCostly && viewFormat != textureFormat && (!gpu.traits.quirks.adrenoRelaxedFormatAliasing || !texture::IsAdrenoAliasCompatible(viewFormat, textureFormat)))
Logger::Warn("Creating a view of a texture with a different format without mutable format: {} - {}", vk::to_string(viewFormat), vk::to_string(textureFormat));
return std::make_shared<TextureView>(shared_from_this(), type, range, pFormat, mapping);
}