Change the control flow to be a bit more readable

This commit is contained in:
kalaposfos13 2025-04-22 15:33:22 +02:00
parent a3bae94f1e
commit 29a0e0c5b0
2 changed files with 16 additions and 13 deletions

View File

@ -129,13 +129,14 @@ ImageInfo::ImageInfo(const AmdGpu::Image& image, const Shader::ImageResource& de
// Override format if image is forced to be a depth target, except if the image is a dummy one // 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)) { if (desc.is_depth && (image.width != 0 && image.height != 0)) {
pixel_format = Vulkan::LiverpoolToVK::PromoteFormatToDepth(pixel_format); pixel_format = Vulkan::LiverpoolToVK::PromoteFormatToDepth(pixel_format);
ASSERT_MSG( if (pixel_format == vk::Format::eUndefined) {
pixel_format != vk::Format::eUndefined, ASSERT_MSG(
"PromoteFormatToDepth failed, info dump: format: {}, size: {}x{}, data_format: {}", image.width == 0 && image.height == 0,
vk::to_string(pixel_format), image.width + 1, image.height + 1, "PromoteFormatToDepth failed, info dump: format: {}, size: {}x{}, data_format: {}",
AmdGpu::NameOf(image.GetDataFmt())); vk::to_string(pixel_format), image.width, image.height,
} else if (image.width == 0 && image.height == 0) { AmdGpu::NameOf(image.GetDataFmt()));
pixel_format = vk::Format::eD32Sfloat; pixel_format = vk::Format::eD32Sfloat;
}
} }
type = ConvertImageType(image.GetType()); type = ConvertImageType(image.GetType());
props.is_tiled = image.IsTiled(); props.is_tiled = image.IsTiled();

View File

@ -40,12 +40,14 @@ ImageViewInfo::ImageViewInfo(const AmdGpu::Image& image, const Shader::ImageReso
// Override format if image is forced to be a depth target, except if the image is a dummy one // 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)) { if (desc.is_depth && (image.width != 0 && image.height != 0)) {
format = Vulkan::LiverpoolToVK::PromoteFormatToDepth(format); format = Vulkan::LiverpoolToVK::PromoteFormatToDepth(format);
ASSERT_MSG( if (format == vk::Format::eUndefined) {
format != vk::Format::eUndefined, ASSERT_MSG(
"PromoteFormatToDepth failed, info dump: format: {}, size: {}x{}, data_format: {}", image.width == 0 && image.height == 0,
vk::to_string(format), image.width, image.height, AmdGpu::NameOf(image.GetDataFmt())); "PromoteFormatToDepth failed, info dump: format: {}, size: {}x{}, data_format: {}",
} else if (image.width == 0 && image.height == 0) { vk::to_string(format), image.width, image.height,
format = vk::Format::eD32Sfloat; AmdGpu::NameOf(image.GetDataFmt()));
format = vk::Format::eD32Sfloat;
}
} }
range.base.level = image.base_level; range.base.level = image.base_level;