texture_cache: OpenGL: Implement MSAA uploads and copies
This commit is contained in:
parent
ed4a88bd93
commit
93cf2b3ca8
12 changed files with 136 additions and 14 deletions
|
@ -22,6 +22,9 @@ std::string Name(const ImageBase& image) {
|
|||
const u32 num_layers = image.info.resources.layers;
|
||||
const u32 num_levels = image.info.resources.levels;
|
||||
std::string resource;
|
||||
if (image.info.num_samples > 1) {
|
||||
resource += fmt::format(":{}xMSAA", image.info.num_samples);
|
||||
}
|
||||
if (num_layers > 1) {
|
||||
resource += fmt::format(":L{}", num_layers);
|
||||
}
|
||||
|
|
|
@ -773,7 +773,7 @@ void TextureCache<P>::RefreshContents(Image& image, ImageId image_id) {
|
|||
image.flags &= ~ImageFlagBits::CpuModified;
|
||||
TrackImage(image, image_id);
|
||||
|
||||
if (image.info.num_samples > 1) {
|
||||
if (image.info.num_samples > 1 && !runtime.CanUploadMSAA()) {
|
||||
LOG_WARNING(HW_GPU, "MSAA image uploads are not implemented");
|
||||
return;
|
||||
}
|
||||
|
@ -1167,14 +1167,14 @@ ImageId TextureCache<P>::JoinImages(const ImageInfo& info, GPUVAddr gpu_addr, VA
|
|||
if (True(overlap.flags & ImageFlagBits::GpuModified)) {
|
||||
new_image.flags |= ImageFlagBits::GpuModified;
|
||||
}
|
||||
const auto& resolution = Settings::values.resolution_info;
|
||||
const SubresourceBase base = new_image.TryFindBase(overlap.gpu_addr).value();
|
||||
const u32 up_scale = can_rescale ? resolution.up_scale : 1;
|
||||
const u32 down_shift = can_rescale ? resolution.down_shift : 0;
|
||||
auto copies = MakeShrinkImageCopies(new_info, overlap.info, base, up_scale, down_shift);
|
||||
if (overlap.info.num_samples != new_image.info.num_samples) {
|
||||
LOG_WARNING(HW_GPU, "Copying between images with different samples is not implemented");
|
||||
runtime.CopyImageMSAA(new_image, overlap, std::move(copies));
|
||||
} else {
|
||||
const auto& resolution = Settings::values.resolution_info;
|
||||
const SubresourceBase base = new_image.TryFindBase(overlap.gpu_addr).value();
|
||||
const u32 up_scale = can_rescale ? resolution.up_scale : 1;
|
||||
const u32 down_shift = can_rescale ? resolution.down_shift : 0;
|
||||
auto copies = MakeShrinkImageCopies(new_info, overlap.info, base, up_scale, down_shift);
|
||||
runtime.CopyImage(new_image, overlap, std::move(copies));
|
||||
}
|
||||
if (True(overlap.flags & ImageFlagBits::Tracked)) {
|
||||
|
|
|
@ -573,10 +573,6 @@ u32 CalculateUnswizzledSizeBytes(const ImageInfo& info) noexcept {
|
|||
if (info.type == ImageType::Buffer) {
|
||||
return info.size.width * BytesPerBlock(info.format);
|
||||
}
|
||||
if (info.num_samples > 1) {
|
||||
// Multisample images can't be uploaded or downloaded to the host
|
||||
return 0;
|
||||
}
|
||||
if (info.type == ImageType::Linear) {
|
||||
return info.pitch * Common::DivCeil(info.size.height, DefaultBlockHeight(info.format));
|
||||
}
|
||||
|
@ -703,7 +699,6 @@ ImageViewType RenderTargetImageViewType(const ImageInfo& info) noexcept {
|
|||
std::vector<ImageCopy> MakeShrinkImageCopies(const ImageInfo& dst, const ImageInfo& src,
|
||||
SubresourceBase base, u32 up_scale, u32 down_shift) {
|
||||
ASSERT(dst.resources.levels >= src.resources.levels);
|
||||
ASSERT(dst.num_samples == src.num_samples);
|
||||
|
||||
const bool is_dst_3d = dst.type == ImageType::e3D;
|
||||
if (is_dst_3d) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue