Readd accidentally reverted change

This commit is contained in:
kalaposfos13 2025-05-02 10:32:29 +02:00
parent 29a0e0c5b0
commit 161cb46c4e
2 changed files with 24 additions and 16 deletions

View File

@ -127,14 +127,18 @@ ImageInfo::ImageInfo(const AmdGpu::Image& image, const Shader::ImageResource& de
tiling_mode = image.GetTilingMode(); tiling_mode = image.GetTilingMode();
pixel_format = LiverpoolToVK::SurfaceFormat(image.GetDataFmt(), image.GetNumberFmt()); 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 // 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) {
pixel_format = Vulkan::LiverpoolToVK::PromoteFormatToDepth(pixel_format); if (image.width != 0 && image.height != 0) {
if (pixel_format == vk::Format::eUndefined) { pixel_format = Vulkan::LiverpoolToVK::PromoteFormatToDepth(pixel_format);
ASSERT_MSG( if (pixel_format == vk::Format::eUndefined) {
image.width == 0 && image.height == 0, ASSERT_MSG(image.width == 0 && image.height == 0,
"PromoteFormatToDepth failed, info dump: format: {}, size: {}x{}, data_format: {}", "PromoteFormatToDepth failed, info dump: format: {}, size: {}x{}, "
vk::to_string(pixel_format), image.width, image.height, "data_format: {}",
AmdGpu::NameOf(image.GetDataFmt())); vk::to_string(pixel_format), image.width, image.height,
AmdGpu::NameOf(image.GetDataFmt()));
pixel_format = vk::Format::eD32Sfloat;
}
} else {
pixel_format = vk::Format::eD32Sfloat; pixel_format = vk::Format::eD32Sfloat;
} }
} }

View File

@ -38,14 +38,18 @@ ImageViewInfo::ImageViewInfo(const AmdGpu::Image& image, const Shader::ImageReso
} }
format = Vulkan::LiverpoolToVK::SurfaceFormat(dfmt, nfmt); 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 // 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) {
format = Vulkan::LiverpoolToVK::PromoteFormatToDepth(format); if (image.width != 0 && image.height != 0) {
if (format == vk::Format::eUndefined) { format = Vulkan::LiverpoolToVK::PromoteFormatToDepth(format);
ASSERT_MSG( if (format == vk::Format::eUndefined) {
image.width == 0 && image.height == 0, ASSERT_MSG(image.width == 0 && image.height == 0,
"PromoteFormatToDepth failed, info dump: format: {}, size: {}x{}, data_format: {}", "PromoteFormatToDepth failed, info dump: format: {}, size: {}x{}, "
vk::to_string(format), image.width, image.height, "data_format: {}",
AmdGpu::NameOf(image.GetDataFmt())); vk::to_string(format), image.width, image.height,
AmdGpu::NameOf(image.GetDataFmt()));
format = vk::Format::eD32Sfloat;
}
} else {
format = vk::Format::eD32Sfloat; format = vk::Format::eD32Sfloat;
} }
} }