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,16 +127,20 @@ ImageInfo::ImageInfo(const AmdGpu::Image& image, const Shader::ImageResource& de
tiling_mode = image.GetTilingMode();
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
if (desc.is_depth && (image.width != 0 && image.height != 0)) {
if (desc.is_depth) {
if (image.width != 0 && image.height != 0) {
pixel_format = Vulkan::LiverpoolToVK::PromoteFormatToDepth(pixel_format);
if (pixel_format == vk::Format::eUndefined) {
ASSERT_MSG(
image.width == 0 && image.height == 0,
"PromoteFormatToDepth failed, info dump: format: {}, size: {}x{}, data_format: {}",
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;
}
} else {
pixel_format = vk::Format::eD32Sfloat;
}
}
type = ConvertImageType(image.GetType());
props.is_tiled = image.IsTiled();

View File

@ -38,16 +38,20 @@ ImageViewInfo::ImageViewInfo(const AmdGpu::Image& image, const Shader::ImageReso
}
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
if (desc.is_depth && (image.width != 0 && image.height != 0)) {
if (desc.is_depth) {
if (image.width != 0 && image.height != 0) {
format = Vulkan::LiverpoolToVK::PromoteFormatToDepth(format);
if (format == vk::Format::eUndefined) {
ASSERT_MSG(
image.width == 0 && image.height == 0,
"PromoteFormatToDepth failed, info dump: format: {}, size: {}x{}, data_format: {}",
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;
}
} else {
format = vk::Format::eD32Sfloat;
}
}
range.base.level = image.base_level;