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,14 +129,15 @@ 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);
if (pixel_format == vk::Format::eUndefined) {
ASSERT_MSG( ASSERT_MSG(
pixel_format != vk::Format::eUndefined, image.width == 0 && image.height == 0,
"PromoteFormatToDepth failed, info dump: format: {}, size: {}x{}, data_format: {}", "PromoteFormatToDepth failed, info dump: format: {}, size: {}x{}, data_format: {}",
vk::to_string(pixel_format), image.width + 1, image.height + 1, vk::to_string(pixel_format), image.width, image.height,
AmdGpu::NameOf(image.GetDataFmt())); AmdGpu::NameOf(image.GetDataFmt()));
} else if (image.width == 0 && image.height == 0) {
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();
props.is_volume = image.GetType() == AmdGpu::ImageType::Color3D; props.is_volume = image.GetType() == AmdGpu::ImageType::Color3D;

View File

@ -40,13 +40,15 @@ 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);
if (format == vk::Format::eUndefined) {
ASSERT_MSG( ASSERT_MSG(
format != vk::Format::eUndefined, image.width == 0 && image.height == 0,
"PromoteFormatToDepth failed, info dump: format: {}, size: {}x{}, data_format: {}", "PromoteFormatToDepth failed, info dump: format: {}, size: {}x{}, data_format: {}",
vk::to_string(format), image.width, image.height, AmdGpu::NameOf(image.GetDataFmt())); vk::to_string(format), image.width, image.height,
} else if (image.width == 0 && image.height == 0) { AmdGpu::NameOf(image.GetDataFmt()));
format = vk::Format::eD32Sfloat; format = vk::Format::eD32Sfloat;
} }
}
range.base.level = image.base_level; range.base.level = image.base_level;
range.base.layer = image.base_array; range.base.layer = image.base_array;