diff options
author | Wollnashorn <Wollnashorn@users.noreply.github.com> | 2023-06-16 13:26:44 +0200 |
---|---|---|
committer | Wollnashorn <Wollnashorn@users.noreply.github.com> | 2023-06-16 13:45:14 +0200 |
commit | 2dc0ff79ece34286c7078922668fd9f0a19b47b7 (patch) | |
tree | a474956c3fdc432f7259c70337d2c304baf80740 /src/video_core/texture_cache/texture_cache.h | |
parent | video_core: Fallback to default anisotropy instead to 1x anisotropy (diff) | |
download | yuzu-2dc0ff79ece34286c7078922668fd9f0a19b47b7.tar yuzu-2dc0ff79ece34286c7078922668fd9f0a19b47b7.tar.gz yuzu-2dc0ff79ece34286c7078922668fd9f0a19b47b7.tar.bz2 yuzu-2dc0ff79ece34286c7078922668fd9f0a19b47b7.tar.lz yuzu-2dc0ff79ece34286c7078922668fd9f0a19b47b7.tar.xz yuzu-2dc0ff79ece34286c7078922668fd9f0a19b47b7.tar.zst yuzu-2dc0ff79ece34286c7078922668fd9f0a19b47b7.zip |
Diffstat (limited to 'src/video_core/texture_cache/texture_cache.h')
-rw-r--r-- | src/video_core/texture_cache/texture_cache.h | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index c7f7448e9..4027d860b 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h @@ -222,30 +222,50 @@ void TextureCache<P>::CheckFeedbackLoop(std::span<const ImageViewInOut> views) { template <class P> typename P::Sampler* TextureCache<P>::GetGraphicsSampler(u32 index) { + return &slot_samplers[GetGraphicsSamplerId(index)]; +} + +template <class P> +typename P::Sampler* TextureCache<P>::GetComputeSampler(u32 index) { + return &slot_samplers[GetComputeSamplerId(index)]; +} + +template <class P> +SamplerId TextureCache<P>::GetGraphicsSamplerId(u32 index) { if (index > channel_state->graphics_sampler_table.Limit()) { LOG_DEBUG(HW_GPU, "Invalid sampler index={}", index); - return &slot_samplers[NULL_SAMPLER_ID]; + return NULL_SAMPLER_ID; } const auto [descriptor, is_new] = channel_state->graphics_sampler_table.Read(index); SamplerId& id = channel_state->graphics_sampler_ids[index]; if (is_new) { id = FindSampler(descriptor); } - return &slot_samplers[id]; + return id; } template <class P> -typename P::Sampler* TextureCache<P>::GetComputeSampler(u32 index) { +SamplerId TextureCache<P>::GetComputeSamplerId(u32 index) { if (index > channel_state->compute_sampler_table.Limit()) { LOG_DEBUG(HW_GPU, "Invalid sampler index={}", index); - return &slot_samplers[NULL_SAMPLER_ID]; + return NULL_SAMPLER_ID; } const auto [descriptor, is_new] = channel_state->compute_sampler_table.Read(index); SamplerId& id = channel_state->compute_sampler_ids[index]; if (is_new) { id = FindSampler(descriptor); } - return &slot_samplers[id]; + return id; +} + +template <class P> +const typename P::Sampler& TextureCache<P>::GetSampler(SamplerId id) const noexcept { + return slot_samplers[id]; +} + +template <class P> +typename P::Sampler& TextureCache<P>::GetSampler(SamplerId id) noexcept { + return slot_samplers[id]; } template <class P> |