mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-01-18 04:28:28 +00:00
liverpool_to_vk: Add R32Uint depth promote. (#2145)
This commit is contained in:
parent
c10f9b8269
commit
53d0a309cc
|
@ -71,8 +71,35 @@ vk::ClearValue ColorBufferClearValue(const AmdGpu::Liverpool::ColorBuffer& color
|
||||||
|
|
||||||
vk::SampleCountFlagBits NumSamples(u32 num_samples, vk::SampleCountFlags supported_flags);
|
vk::SampleCountFlagBits NumSamples(u32 num_samples, vk::SampleCountFlags supported_flags);
|
||||||
|
|
||||||
|
static inline bool IsFormatDepthCompatible(vk::Format fmt) {
|
||||||
|
switch (fmt) {
|
||||||
|
// 32-bit float compatible
|
||||||
|
case vk::Format::eD32Sfloat:
|
||||||
|
case vk::Format::eR32Sfloat:
|
||||||
|
case vk::Format::eR32Uint:
|
||||||
|
// 16-bit unorm compatible
|
||||||
|
case vk::Format::eD16Unorm:
|
||||||
|
case vk::Format::eR16Unorm:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool IsFormatStencilCompatible(vk::Format fmt) {
|
||||||
|
switch (fmt) {
|
||||||
|
// 8-bit uint compatible
|
||||||
|
case vk::Format::eS8Uint:
|
||||||
|
case vk::Format::eR8Uint:
|
||||||
|
case vk::Format::eR8Unorm:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static inline vk::Format PromoteFormatToDepth(vk::Format fmt) {
|
static inline vk::Format PromoteFormatToDepth(vk::Format fmt) {
|
||||||
if (fmt == vk::Format::eR32Sfloat) {
|
if (fmt == vk::Format::eR32Sfloat || fmt == vk::Format::eR32Uint) {
|
||||||
return vk::Format::eD32Sfloat;
|
return vk::Format::eD32Sfloat;
|
||||||
} else if (fmt == vk::Format::eR16Unorm) {
|
} else if (fmt == vk::Format::eR16Unorm) {
|
||||||
return vk::Format::eD16Unorm;
|
return vk::Format::eD16Unorm;
|
||||||
|
|
|
@ -82,13 +82,12 @@ ImageView::ImageView(const Vulkan::Instance& instance, const ImageViewInfo& info
|
||||||
vk::Format format = info.format;
|
vk::Format format = info.format;
|
||||||
vk::ImageAspectFlags aspect = image.aspect_mask;
|
vk::ImageAspectFlags aspect = image.aspect_mask;
|
||||||
if (image.aspect_mask & vk::ImageAspectFlagBits::eDepth &&
|
if (image.aspect_mask & vk::ImageAspectFlagBits::eDepth &&
|
||||||
(format == vk::Format::eR32Sfloat || format == vk::Format::eD32Sfloat ||
|
Vulkan::LiverpoolToVK::IsFormatDepthCompatible(format)) {
|
||||||
format == vk::Format::eR16Unorm || format == vk::Format::eD16Unorm)) {
|
|
||||||
format = image.info.pixel_format;
|
format = image.info.pixel_format;
|
||||||
aspect = vk::ImageAspectFlagBits::eDepth;
|
aspect = vk::ImageAspectFlagBits::eDepth;
|
||||||
}
|
}
|
||||||
if (image.aspect_mask & vk::ImageAspectFlagBits::eStencil &&
|
if (image.aspect_mask & vk::ImageAspectFlagBits::eStencil &&
|
||||||
(format == vk::Format::eR8Uint || format == vk::Format::eR8Unorm)) {
|
Vulkan::LiverpoolToVK::IsFormatStencilCompatible(format)) {
|
||||||
format = image.info.pixel_format;
|
format = image.info.pixel_format;
|
||||||
aspect = vk::ImageAspectFlagBits::eStencil;
|
aspect = vk::ImageAspectFlagBits::eStencil;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue