diff options
author | Liam <byteslice@airmail.cc> | 2023-05-22 07:13:47 +0200 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2023-05-23 00:10:16 +0200 |
commit | 8758932031ff4836652e7577ec566fd733f46e0b (patch) | |
tree | 05e92cf0f69862e7a59cf55744acc9657afa2a86 /src/video_core/texture_cache | |
parent | Merge pull request #10392 from danilaml/update-cubeb-again (diff) | |
download | yuzu-8758932031ff4836652e7577ec566fd733f46e0b.tar yuzu-8758932031ff4836652e7577ec566fd733f46e0b.tar.gz yuzu-8758932031ff4836652e7577ec566fd733f46e0b.tar.bz2 yuzu-8758932031ff4836652e7577ec566fd733f46e0b.tar.lz yuzu-8758932031ff4836652e7577ec566fd733f46e0b.tar.xz yuzu-8758932031ff4836652e7577ec566fd733f46e0b.tar.zst yuzu-8758932031ff4836652e7577ec566fd733f46e0b.zip |
Diffstat (limited to 'src/video_core/texture_cache')
-rw-r--r-- | src/video_core/texture_cache/texture_cache.h | 36 | ||||
-rw-r--r-- | src/video_core/texture_cache/texture_cache_base.h | 3 |
2 files changed, 39 insertions, 0 deletions
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index b24086fce..8e62a5f78 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h @@ -184,6 +184,42 @@ void TextureCache<P>::FillComputeImageViews(std::span<ImageViewInOut> views) { } template <class P> +void TextureCache<P>::CheckFeedbackLoop(std::span<const ImageViewInOut> views) { + const bool requires_barrier = [&] { + for (const auto& view : views) { + if (!view.id) { + continue; + } + auto& image_view = slot_image_views[view.id]; + + // Check color targets + for (const auto& ct_view_id : render_targets.color_buffer_ids) { + if (ct_view_id) { + auto& ct_view = slot_image_views[ct_view_id]; + if (image_view.image_id == ct_view.image_id) { + return true; + } + } + } + + // Check zeta target + if (render_targets.depth_buffer_id) { + auto& zt_view = slot_image_views[render_targets.depth_buffer_id]; + if (image_view.image_id == zt_view.image_id) { + return true; + } + } + } + + return false; + }(); + + if (requires_barrier) { + runtime.BarrierFeedbackLoop(); + } +} + +template <class P> typename P::Sampler* TextureCache<P>::GetGraphicsSampler(u32 index) { if (index > channel_state->graphics_sampler_table.Limit()) { LOG_DEBUG(HW_GPU, "Invalid sampler index={}", index); diff --git a/src/video_core/texture_cache/texture_cache_base.h b/src/video_core/texture_cache/texture_cache_base.h index 0720494e5..1a3308e2d 100644 --- a/src/video_core/texture_cache/texture_cache_base.h +++ b/src/video_core/texture_cache/texture_cache_base.h @@ -148,6 +148,9 @@ public: /// Fill image_view_ids with the compute images in indices void FillComputeImageViews(std::span<ImageViewInOut> views); + /// Handle feedback loops during draws. + void CheckFeedbackLoop(std::span<const ImageViewInOut> views); + /// Get the sampler from the graphics descriptor table in the specified index Sampler* GetGraphicsSampler(u32 index); |