Skip to content

Commit

Permalink
hot-fix: proper calculation of image samples num
Browse files Browse the repository at this point in the history
  • Loading branch information
psucien committed Oct 23, 2024
1 parent 6e00121 commit a8d2684
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/video_core/amdgpu/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
1 change: 1 addition & 0 deletions src/video_core/texture_cache/image_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
7 changes: 6 additions & 1 deletion src/video_core/texture_cache/image_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down

0 comments on commit a8d2684

Please sign in to comment.