mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-27 04:25:12 +00:00
Skip PromoteFormatToDepth in the case of a dummy image
Also add more debug info in case of a failure
This commit is contained in:
parent
46b88bd10f
commit
7fa2d0ea42
@ -100,13 +100,14 @@ static inline bool IsFormatStencilCompatible(vk::Format fmt) {
|
||||
}
|
||||
}
|
||||
|
||||
static inline vk::Format PromoteFormatToDepth(vk::Format fmt) {
|
||||
static inline vk::Format PromoteFormatToDepth(vk::Format fmt, bool& valid) {
|
||||
if (fmt == vk::Format::eR32Sfloat || fmt == vk::Format::eR32Uint) {
|
||||
return vk::Format::eD32Sfloat;
|
||||
} else if (fmt == vk::Format::eR16Unorm) {
|
||||
return vk::Format::eD16Unorm;
|
||||
}
|
||||
UNREACHABLE_MSG("Unexpected depth format {}", vk::to_string(fmt));
|
||||
valid = false;
|
||||
return fmt; // move the unreachable one step up to be able to print more info
|
||||
}
|
||||
|
||||
} // namespace Vulkan::LiverpoolToVK
|
||||
|
@ -126,9 +126,15 @@ ImageInfo::ImageInfo(const AmdGpu::Liverpool::DepthBuffer& buffer, u32 num_slice
|
||||
ImageInfo::ImageInfo(const AmdGpu::Image& image, const Shader::ImageResource& desc) noexcept {
|
||||
tiling_mode = image.GetTilingMode();
|
||||
pixel_format = LiverpoolToVK::SurfaceFormat(image.GetDataFmt(), image.GetNumberFmt());
|
||||
// Override format if image is forced to be a depth target
|
||||
if (desc.is_depth) {
|
||||
pixel_format = LiverpoolToVK::PromoteFormatToDepth(pixel_format);
|
||||
// Override format if image is forced to be a depth target, except if the image is a dummy one
|
||||
if (desc.is_depth && (image.width != 0 && image.height != 0)) {
|
||||
bool valid = true;
|
||||
pixel_format = Vulkan::LiverpoolToVK::PromoteFormatToDepth(pixel_format, valid);
|
||||
ASSERT_MSG(
|
||||
valid,
|
||||
"PromoteFormatToDepth failed, info dump: format: {}, size: {}x{}, data_format: {}",
|
||||
vk::to_string(pixel_format), image.width + 1, image.height + 1,
|
||||
AmdGpu::NameOf(image.GetDataFmt()));
|
||||
}
|
||||
type = ConvertImageType(image.GetType());
|
||||
props.is_tiled = image.IsTiled();
|
||||
|
@ -37,8 +37,14 @@ ImageViewInfo::ImageViewInfo(const AmdGpu::Image& image, const Shader::ImageReso
|
||||
nfmt = AmdGpu::NumberFormat::Unorm;
|
||||
}
|
||||
format = Vulkan::LiverpoolToVK::SurfaceFormat(dfmt, nfmt);
|
||||
if (desc.is_depth) {
|
||||
format = Vulkan::LiverpoolToVK::PromoteFormatToDepth(format);
|
||||
// Override format if image is forced to be a depth target, except if the image is a dummy one
|
||||
if (desc.is_depth && (image.width != 0 && image.height != 0)) {
|
||||
bool valid = true;
|
||||
format = Vulkan::LiverpoolToVK::PromoteFormatToDepth(format, valid);
|
||||
ASSERT_MSG(
|
||||
valid,
|
||||
"PromoteFormatToDepth failed, info dump: format: {}, size: {}x{}, data_format: {}",
|
||||
vk::to_string(format), image.width, image.height, AmdGpu::NameOf(image.GetDataFmt()));
|
||||
}
|
||||
|
||||
range.base.level = image.base_level;
|
||||
|
Loading…
Reference in New Issue
Block a user