mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-01-01 12:46:01 +00:00
image_view: Add more BGRA storage format swizzles. (#1693)
This commit is contained in:
parent
e8e3d63d1d
commit
e9a691e95e
|
@ -70,8 +70,9 @@ std::unordered_map<vk::Format, vk::FormatProperties3> GetFormatProperties(
|
|||
static constexpr std::array misc_formats = {
|
||||
vk::Format::eA2R10G10B10UnormPack32, vk::Format::eA8B8G8R8UnormPack32,
|
||||
vk::Format::eA8B8G8R8SrgbPack32, vk::Format::eB8G8R8A8Unorm,
|
||||
vk::Format::eB8G8R8A8Srgb, vk::Format::eR5G6B5UnormPack16,
|
||||
vk::Format::eD24UnormS8Uint,
|
||||
vk::Format::eB8G8R8A8Snorm, vk::Format::eB8G8R8A8Uint,
|
||||
vk::Format::eB8G8R8A8Sint, vk::Format::eB8G8R8A8Srgb,
|
||||
vk::Format::eR5G6B5UnormPack16, vk::Format::eD24UnormS8Uint,
|
||||
};
|
||||
for (const auto& format : misc_formats) {
|
||||
if (!format_properties.contains(format)) {
|
||||
|
|
|
@ -58,11 +58,22 @@ bool IsIdentityMapping(u32 dst_sel, u32 num_components) {
|
|||
}
|
||||
|
||||
vk::Format TrySwizzleFormat(vk::Format format, u32 dst_sel) {
|
||||
if (format == vk::Format::eR8G8B8A8Unorm && dst_sel == 0b111100101110) {
|
||||
return vk::Format::eB8G8R8A8Unorm;
|
||||
}
|
||||
if (format == vk::Format::eR8G8B8A8Srgb && dst_sel == 0b111100101110) {
|
||||
return vk::Format::eB8G8R8A8Srgb;
|
||||
// BGRA
|
||||
if (dst_sel == 0b111100101110) {
|
||||
switch (format) {
|
||||
case vk::Format::eR8G8B8A8Unorm:
|
||||
return vk::Format::eB8G8R8A8Unorm;
|
||||
case vk::Format::eR8G8B8A8Snorm:
|
||||
return vk::Format::eB8G8R8A8Snorm;
|
||||
case vk::Format::eR8G8B8A8Uint:
|
||||
return vk::Format::eB8G8R8A8Uint;
|
||||
case vk::Format::eR8G8B8A8Sint:
|
||||
return vk::Format::eB8G8R8A8Sint;
|
||||
case vk::Format::eR8G8B8A8Srgb:
|
||||
return vk::Format::eB8G8R8A8Srgb;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return format;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue