mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-27 04:25:12 +00:00
Use a cleaner error check
This commit is contained in:
parent
7fa2d0ea42
commit
1f1f8d1037
@ -100,14 +100,13 @@ static inline bool IsFormatStencilCompatible(vk::Format fmt) {
|
||||
}
|
||||
}
|
||||
|
||||
static inline vk::Format PromoteFormatToDepth(vk::Format fmt, bool& valid) {
|
||||
static inline vk::Format PromoteFormatToDepth(vk::Format fmt) {
|
||||
if (fmt == vk::Format::eR32Sfloat || fmt == vk::Format::eR32Uint) {
|
||||
return vk::Format::eD32Sfloat;
|
||||
} else if (fmt == vk::Format::eR16Unorm) {
|
||||
return vk::Format::eD16Unorm;
|
||||
}
|
||||
valid = false;
|
||||
return fmt; // move the unreachable one step up to be able to print more info
|
||||
return vk::Format::eUndefined;
|
||||
}
|
||||
|
||||
} // namespace Vulkan::LiverpoolToVK
|
||||
|
@ -128,10 +128,9 @@ ImageInfo::ImageInfo(const AmdGpu::Image& image, const Shader::ImageResource& de
|
||||
pixel_format = LiverpoolToVK::SurfaceFormat(image.GetDataFmt(), image.GetNumberFmt());
|
||||
// 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);
|
||||
pixel_format = Vulkan::LiverpoolToVK::PromoteFormatToDepth(pixel_format);
|
||||
ASSERT_MSG(
|
||||
valid,
|
||||
pixel_format != vk::Format::eUndefined,
|
||||
"PromoteFormatToDepth failed, info dump: format: {}, size: {}x{}, data_format: {}",
|
||||
vk::to_string(pixel_format), image.width + 1, image.height + 1,
|
||||
AmdGpu::NameOf(image.GetDataFmt()));
|
||||
|
@ -39,10 +39,9 @@ ImageViewInfo::ImageViewInfo(const AmdGpu::Image& image, const Shader::ImageReso
|
||||
format = Vulkan::LiverpoolToVK::SurfaceFormat(dfmt, nfmt);
|
||||
// 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);
|
||||
format = Vulkan::LiverpoolToVK::PromoteFormatToDepth(format);
|
||||
ASSERT_MSG(
|
||||
valid,
|
||||
format != vk::Format::eUndefined,
|
||||
"PromoteFormatToDepth failed, info dump: format: {}, size: {}x{}, data_format: {}",
|
||||
vk::to_string(format), image.width, image.height, AmdGpu::NameOf(image.GetDataFmt()));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user