Implement SwapMode StandardReverse

This commit is contained in:
greggameplayer 2024-08-30 01:51:08 +02:00
parent 1651db24fe
commit e8d1fec600
No known key found for this signature in database
GPG Key ID: DFCB45491D2A00EB
1 changed files with 19 additions and 1 deletions

View File

@ -585,10 +585,13 @@ 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 || ASSERT_MSG(comp_swap == Liverpool::ColorBuffer::SwapMode::Standard ||
comp_swap == Liverpool::ColorBuffer::SwapMode::Alternate, comp_swap == Liverpool::ColorBuffer::SwapMode::Alternate ||
comp_swap == Liverpool::ColorBuffer::SwapMode::StandardReverse,
"Unsupported component swap mode {}", static_cast<u32>(comp_swap)); "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;
if (comp_swap_alt) { if (comp_swap_alt) {
switch (base_format) { switch (base_format) {
case vk::Format::eR8G8B8A8Unorm: case vk::Format::eR8G8B8A8Unorm:
@ -602,6 +605,21 @@ 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::eB8G8R8A8Unorm:
return vk::Format::eA8B8G8R8UnormPack32;
case vk::Format::eR8G8B8A8Srgb:
return is_vo_surface ? vk::Format::eA8B8G8R8UnormPack32
: vk::Format::eA8B8G8R8SrgbPack32;
case vk::Format::eB8G8R8A8Srgb:
return is_vo_surface ? vk::Format::eA8B8G8R8UnormPack32
: vk::Format::eA8B8G8R8SrgbPack32;
default:
break;
}
} 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;