diff options
| author | 2023-05-04 17:44:49 +0200 | |
|---|---|---|
| committer | 2023-05-07 23:46:12 +0200 | |
| commit | 016c6feb49255792e4093be381e20509eb94e6d1 (patch) | |
| tree | 274dd6a0d6f7d88918d612970ebbed4e5961cbef /src | |
| parent | Buffer cache: always use async buffer downloads and fix regression. (diff) | |
| download | yuzu-016c6feb49255792e4093be381e20509eb94e6d1.tar.gz yuzu-016c6feb49255792e4093be381e20509eb94e6d1.tar.xz yuzu-016c6feb49255792e4093be381e20509eb94e6d1.zip | |
Texture cache: reverse inmediate flush changes
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/texture_cache/image_info.cpp | 12 | ||||
| -rw-r--r-- | src/video_core/texture_cache/image_view_base.cpp | 5 | ||||
| -rw-r--r-- | src/video_core/texture_cache/texture_cache.h | 25 |
3 files changed, 14 insertions, 28 deletions
diff --git a/src/video_core/texture_cache/image_info.cpp b/src/video_core/texture_cache/image_info.cpp index 11f3f78a1..e8ddde691 100644 --- a/src/video_core/texture_cache/image_info.cpp +++ b/src/video_core/texture_cache/image_info.cpp | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | #include <fmt/format.h> | 4 | #include <fmt/format.h> |
| 5 | 5 | ||
| 6 | #include "common/assert.h" | 6 | #include "common/assert.h" |
| 7 | #include "common/settings.h" | ||
| 7 | #include "video_core/surface.h" | 8 | #include "video_core/surface.h" |
| 8 | #include "video_core/texture_cache/format_lookup_table.h" | 9 | #include "video_core/texture_cache/format_lookup_table.h" |
| 9 | #include "video_core/texture_cache/image_info.h" | 10 | #include "video_core/texture_cache/image_info.h" |
| @@ -22,6 +23,8 @@ using VideoCore::Surface::PixelFormat; | |||
| 22 | using VideoCore::Surface::SurfaceType; | 23 | using VideoCore::Surface::SurfaceType; |
| 23 | 24 | ||
| 24 | ImageInfo::ImageInfo(const TICEntry& config) noexcept { | 25 | ImageInfo::ImageInfo(const TICEntry& config) noexcept { |
| 26 | forced_flushed = config.IsPitchLinear() && !Settings::values.use_reactive_flushing.GetValue(); | ||
| 27 | dma_downloaded = forced_flushed; | ||
| 25 | format = PixelFormatFromTextureInfo(config.format, config.r_type, config.g_type, config.b_type, | 28 | format = PixelFormatFromTextureInfo(config.format, config.r_type, config.g_type, config.b_type, |
| 26 | config.a_type, config.srgb_conversion); | 29 | config.a_type, config.srgb_conversion); |
| 27 | num_samples = NumSamples(config.msaa_mode); | 30 | num_samples = NumSamples(config.msaa_mode); |
| @@ -117,6 +120,9 @@ ImageInfo::ImageInfo(const TICEntry& config) noexcept { | |||
| 117 | 120 | ||
| 118 | ImageInfo::ImageInfo(const Maxwell3D::Regs::RenderTargetConfig& ct, | 121 | ImageInfo::ImageInfo(const Maxwell3D::Regs::RenderTargetConfig& ct, |
| 119 | Tegra::Texture::MsaaMode msaa_mode) noexcept { | 122 | Tegra::Texture::MsaaMode msaa_mode) noexcept { |
| 123 | forced_flushed = | ||
| 124 | ct.tile_mode.is_pitch_linear && !Settings::values.use_reactive_flushing.GetValue(); | ||
| 125 | dma_downloaded = forced_flushed; | ||
| 120 | format = VideoCore::Surface::PixelFormatFromRenderTargetFormat(ct.format); | 126 | format = VideoCore::Surface::PixelFormatFromRenderTargetFormat(ct.format); |
| 121 | rescaleable = false; | 127 | rescaleable = false; |
| 122 | if (ct.tile_mode.is_pitch_linear) { | 128 | if (ct.tile_mode.is_pitch_linear) { |
| @@ -155,6 +161,9 @@ ImageInfo::ImageInfo(const Maxwell3D::Regs::RenderTargetConfig& ct, | |||
| 155 | 161 | ||
| 156 | ImageInfo::ImageInfo(const Maxwell3D::Regs::Zeta& zt, const Maxwell3D::Regs::ZetaSize& zt_size, | 162 | ImageInfo::ImageInfo(const Maxwell3D::Regs::Zeta& zt, const Maxwell3D::Regs::ZetaSize& zt_size, |
| 157 | Tegra::Texture::MsaaMode msaa_mode) noexcept { | 163 | Tegra::Texture::MsaaMode msaa_mode) noexcept { |
| 164 | forced_flushed = | ||
| 165 | zt.tile_mode.is_pitch_linear && !Settings::values.use_reactive_flushing.GetValue(); | ||
| 166 | dma_downloaded = forced_flushed; | ||
| 158 | format = VideoCore::Surface::PixelFormatFromDepthFormat(zt.format); | 167 | format = VideoCore::Surface::PixelFormatFromDepthFormat(zt.format); |
| 159 | size.width = zt_size.width; | 168 | size.width = zt_size.width; |
| 160 | size.height = zt_size.height; | 169 | size.height = zt_size.height; |
| @@ -195,6 +204,9 @@ ImageInfo::ImageInfo(const Maxwell3D::Regs::Zeta& zt, const Maxwell3D::Regs::Zet | |||
| 195 | 204 | ||
| 196 | ImageInfo::ImageInfo(const Fermi2D::Surface& config) noexcept { | 205 | ImageInfo::ImageInfo(const Fermi2D::Surface& config) noexcept { |
| 197 | UNIMPLEMENTED_IF_MSG(config.layer != 0, "Surface layer is not zero"); | 206 | UNIMPLEMENTED_IF_MSG(config.layer != 0, "Surface layer is not zero"); |
| 207 | forced_flushed = config.linear == Fermi2D::MemoryLayout::Pitch && | ||
| 208 | !Settings::values.use_reactive_flushing.GetValue(); | ||
| 209 | dma_downloaded = forced_flushed; | ||
| 198 | format = VideoCore::Surface::PixelFormatFromRenderTargetFormat(config.format); | 210 | format = VideoCore::Surface::PixelFormatFromRenderTargetFormat(config.format); |
| 199 | rescaleable = false; | 211 | rescaleable = false; |
| 200 | if (config.linear == Fermi2D::MemoryLayout::Pitch) { | 212 | if (config.linear == Fermi2D::MemoryLayout::Pitch) { |
diff --git a/src/video_core/texture_cache/image_view_base.cpp b/src/video_core/texture_cache/image_view_base.cpp index c3b2b196d..d134b6738 100644 --- a/src/video_core/texture_cache/image_view_base.cpp +++ b/src/video_core/texture_cache/image_view_base.cpp | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | #include <algorithm> | 4 | #include <algorithm> |
| 5 | 5 | ||
| 6 | #include "common/assert.h" | 6 | #include "common/assert.h" |
| 7 | #include "common/settings.h" | ||
| 8 | #include "video_core/compatible_formats.h" | 7 | #include "video_core/compatible_formats.h" |
| 9 | #include "video_core/surface.h" | 8 | #include "video_core/surface.h" |
| 10 | #include "video_core/texture_cache/formatter.h" | 9 | #include "video_core/texture_cache/formatter.h" |
| @@ -26,9 +25,7 @@ ImageViewBase::ImageViewBase(const ImageViewInfo& info, const ImageInfo& image_i | |||
| 26 | ASSERT_MSG(VideoCore::Surface::IsViewCompatible(image_info.format, info.format, false, true), | 25 | ASSERT_MSG(VideoCore::Surface::IsViewCompatible(image_info.format, info.format, false, true), |
| 27 | "Image view format {} is incompatible with image format {}", info.format, | 26 | "Image view format {} is incompatible with image format {}", info.format, |
| 28 | image_info.format); | 27 | image_info.format); |
| 29 | const bool preemptive = | 28 | if (image_info.forced_flushed) { |
| 30 | !Settings::values.use_reactive_flushing.GetValue() && image_info.type == ImageType::Linear; | ||
| 31 | if (image_info.forced_flushed || preemptive) { | ||
| 32 | flags |= ImageViewFlagBits::PreemtiveDownload; | 29 | flags |= ImageViewFlagBits::PreemtiveDownload; |
| 33 | } | 30 | } |
| 34 | if (image_info.type == ImageType::e3D && info.type != ImageViewType::e3D) { | 31 | if (image_info.type == ImageType::e3D && info.type != ImageViewType::e3D) { |
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index 762e8a52f..29ac01eb4 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h | |||
| @@ -711,39 +711,16 @@ void TextureCache<P>::CommitAsyncFlushes() { | |||
| 711 | } | 711 | } |
| 712 | 712 | ||
| 713 | if (any_none_dma) { | 713 | if (any_none_dma) { |
| 714 | bool all_pre_sync = true; | ||
| 715 | auto download_map = runtime.DownloadStagingBuffer(total_size_bytes, true); | 714 | auto download_map = runtime.DownloadStagingBuffer(total_size_bytes, true); |
| 716 | for (const PendingDownload& download_info : download_ids) { | 715 | for (const PendingDownload& download_info : download_ids) { |
| 717 | if (download_info.is_swizzle) { | 716 | if (download_info.is_swizzle) { |
| 718 | Image& image = slot_images[download_info.object_id]; | 717 | Image& image = slot_images[download_info.object_id]; |
| 719 | all_pre_sync &= image.info.dma_downloaded; | ||
| 720 | image.info.dma_downloaded = true; | ||
| 721 | const auto copies = FullDownloadCopies(image.info); | 718 | const auto copies = FullDownloadCopies(image.info); |
| 722 | image.DownloadMemory(download_map, copies); | 719 | image.DownloadMemory(download_map, copies); |
| 723 | download_map.offset += Common::AlignUp(image.unswizzled_size_bytes, 64); | 720 | download_map.offset += Common::AlignUp(image.unswizzled_size_bytes, 64); |
| 724 | } | 721 | } |
| 725 | } | 722 | } |
| 726 | if (!all_pre_sync) { | 723 | uncommitted_async_buffers.emplace_back(download_map); |
| 727 | runtime.Finish(); | ||
| 728 | auto it = download_ids.begin(); | ||
| 729 | while (it != download_ids.end()) { | ||
| 730 | const PendingDownload& download_info = *it; | ||
| 731 | if (download_info.is_swizzle) { | ||
| 732 | const ImageBase& image = slot_images[download_info.object_id]; | ||
| 733 | const auto copies = FullDownloadCopies(image.info); | ||
| 734 | download_map.offset -= Common::AlignUp(image.unswizzled_size_bytes, 64); | ||
| 735 | std::span<u8> download_span = | ||
| 736 | download_map.mapped_span.subspan(download_map.offset); | ||
| 737 | SwizzleImage(*gpu_memory, image.gpu_addr, image.info, copies, download_span, | ||
| 738 | swizzle_data_buffer); | ||
| 739 | it = download_ids.erase(it); | ||
| 740 | } else { | ||
| 741 | it++; | ||
| 742 | } | ||
| 743 | } | ||
| 744 | } else { | ||
| 745 | uncommitted_async_buffers.emplace_back(download_map); | ||
| 746 | } | ||
| 747 | } | 724 | } |
| 748 | 725 | ||
| 749 | async_buffers.emplace_back(std::move(uncommitted_async_buffers)); | 726 | async_buffers.emplace_back(std::move(uncommitted_async_buffers)); |