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
if (desc.is_depth && (image.width != 0 && image.height != 0)) {
pixel_format = Vulkan::LiverpoolToVK::PromoteFormatToDepth(pixel_format);
ASSERT_MSG(
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()));
} else if (image.width == 0 && image.height == 0) {
pixel_format = vk::Format::eD32Sfloat;
if (pixel_format == vk::Format::eUndefined) {
ASSERT_MSG(
image.width == 0 && image.height == 0,
"PromoteFormatToDepth failed, info dump: format: {}, size: {}x{}, data_format: {}",
vk::to_string(pixel_format), image.width, image.height,
AmdGpu::NameOf(image.GetDataFmt()));
pixel_format = vk::Format::eD32Sfloat;
}
}
type = ConvertImageType(image.GetType());
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
if (desc.is_depth && (image.width != 0 && image.height != 0)) {
format = Vulkan::LiverpoolToVK::PromoteFormatToDepth(format);
ASSERT_MSG(
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()));
} else if (image.width == 0 && image.height == 0) {
format = vk::Format::eD32Sfloat;
if (format == vk::Format::eUndefined) {
ASSERT_MSG(
image.width == 0 && image.height == 0,
"PromoteFormatToDepth failed, info dump: format: {}, size: {}x{}, data_format: {}",
vk::to_string(format), image.width, image.height,
AmdGpu::NameOf(image.GetDataFmt()));
format = vk::Format::eD32Sfloat;
}
}
range.base.level = image.base_level;