From 29a0e0c5b0670c194ed139047881691113399c2c Mon Sep 17 00:00:00 2001 From: kalaposfos13 <153381648+kalaposfos13@users.noreply.github.com> Date: Tue, 22 Apr 2025 15:33:22 +0200 Subject: [PATCH] Change the control flow to be a bit more readable --- src/video_core/texture_cache/image_info.cpp | 15 ++++++++------- src/video_core/texture_cache/image_view.cpp | 14 ++++++++------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/video_core/texture_cache/image_info.cpp b/src/video_core/texture_cache/image_info.cpp index aca6f3172..3e5e13bde 100644 --- a/src/video_core/texture_cache/image_info.cpp +++ b/src/video_core/texture_cache/image_info.cpp @@ -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(); diff --git a/src/video_core/texture_cache/image_view.cpp b/src/video_core/texture_cache/image_view.cpp index c22d3ebcd..e47d7006e 100644 --- a/src/video_core/texture_cache/image_view.cpp +++ b/src/video_core/texture_cache/image_view.cpp @@ -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;