hot-fix: proper calculation of image samples num
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / windows-qt (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / macos-qt (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-qt (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions

This commit is contained in:
psucien 2024-10-23 23:11:01 +02:00
parent 6e00121eb5
commit a8d2684929
3 changed files with 14 additions and 1 deletions

View file

@ -261,6 +261,13 @@ struct Image {
return last_level + 1;
}
u32 NumSamples() const {
if (GetType() == ImageType::Color2DMsaa || GetType() == ImageType::Color2DMsaaArray) {
return 1u << last_level;
}
return 1;
}
ImageType GetType() const noexcept {
return static_cast<ImageType>(type);
}

View file

@ -219,6 +219,7 @@ ImageInfo::ImageInfo(const AmdGpu::Image& image, const Shader::ImageResource& de
pitch = image.Pitch();
resources.levels = image.NumLevels();
resources.layers = image.NumLayers(desc.is_array);
num_samples = image.NumSamples();
num_bits = NumBits(image.GetDataFmt());
usage.texture = true;

View file

@ -80,7 +80,12 @@ ImageViewInfo::ImageViewInfo(const AmdGpu::Image& image, const Shader::ImageReso
}
range.base.level = image.base_level;
range.base.layer = image.base_array;
range.extent.levels = image.last_level - image.base_level + 1;
if (image.GetType() == AmdGpu::ImageType::Color2DMsaa ||
image.GetType() == AmdGpu::ImageType::Color2DMsaaArray) {
range.extent.levels = 1;
} else {
range.extent.levels = image.last_level - image.base_level + 1;
}
range.extent.layers = image.last_array - image.base_array + 1;
type = ConvertImageViewType(image.GetType());