mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-03 07:52:31 +00:00
shader_recompiler: Add more format swap modes
This commit is contained in:
parent
09ce12a868
commit
61cde67012
@ -31,6 +31,12 @@ void Translator::EmitExport(const GcnInst& inst) {
|
|||||||
case MrtSwizzle::Alt:
|
case MrtSwizzle::Alt:
|
||||||
static constexpr std::array<u32, 4> AltSwizzle = {2, 1, 0, 3};
|
static constexpr std::array<u32, 4> AltSwizzle = {2, 1, 0, 3};
|
||||||
return AltSwizzle[comp];
|
return AltSwizzle[comp];
|
||||||
|
case MrtSwizzle::Reverse:
|
||||||
|
static constexpr std::array<u32, 4> RevSwizzle = {3, 2, 1, 0};
|
||||||
|
return RevSwizzle[comp];
|
||||||
|
case MrtSwizzle::ReverseAlt:
|
||||||
|
static constexpr std::array<u32, 4> AltRevSwizzle = {3, 0, 1, 2};
|
||||||
|
return AltRevSwizzle[comp];
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
@ -585,11 +585,9 @@ vk::Format SurfaceFormat(AmdGpu::DataFormat data_format, AmdGpu::NumberFormat nu
|
|||||||
|
|
||||||
vk::Format AdjustColorBufferFormat(vk::Format base_format,
|
vk::Format AdjustColorBufferFormat(vk::Format base_format,
|
||||||
Liverpool::ColorBuffer::SwapMode comp_swap, bool is_vo_surface) {
|
Liverpool::ColorBuffer::SwapMode comp_swap, bool is_vo_surface) {
|
||||||
ASSERT_MSG(comp_swap == Liverpool::ColorBuffer::SwapMode::Standard ||
|
|
||||||
comp_swap == Liverpool::ColorBuffer::SwapMode::Alternate,
|
|
||||||
"Unsupported component swap mode {}", static_cast<u32>(comp_swap));
|
|
||||||
|
|
||||||
const bool comp_swap_alt = comp_swap == Liverpool::ColorBuffer::SwapMode::Alternate;
|
const bool comp_swap_alt = comp_swap == Liverpool::ColorBuffer::SwapMode::Alternate;
|
||||||
|
const bool comp_swap_reverse = comp_swap == Liverpool::ColorBuffer::SwapMode::StandardReverse;
|
||||||
|
const bool comp_swap_alt_reverse = comp_swap == Liverpool::ColorBuffer::SwapMode::AlternateReverse;
|
||||||
if (comp_swap_alt) {
|
if (comp_swap_alt) {
|
||||||
switch (base_format) {
|
switch (base_format) {
|
||||||
case vk::Format::eR8G8B8A8Unorm:
|
case vk::Format::eR8G8B8A8Unorm:
|
||||||
@ -605,6 +603,18 @@ vk::Format AdjustColorBufferFormat(vk::Format base_format,
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
} else if (comp_swap_reverse) {
|
||||||
|
switch (base_format) {
|
||||||
|
case vk::Format::eR8G8B8A8Unorm:
|
||||||
|
return vk::Format::eA8B8G8R8UnormPack32;
|
||||||
|
case vk::Format::eR8G8B8A8Srgb:
|
||||||
|
return is_vo_surface ? vk::Format::eA8B8G8R8UnormPack32
|
||||||
|
: vk::Format::eA8B8G8R8SrgbPack32;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (comp_swap_alt_reverse) {
|
||||||
|
return base_format;
|
||||||
} else {
|
} else {
|
||||||
if (is_vo_surface && base_format == vk::Format::eR8G8B8A8Srgb) {
|
if (is_vo_surface && base_format == vk::Format::eR8G8B8A8Srgb) {
|
||||||
return vk::Format::eR8G8B8A8Unorm;
|
return vk::Format::eR8G8B8A8Unorm;
|
||||||
|
Loading…
Reference in New Issue
Block a user