diff options
| author | CamilleLaVey <camillelavey99@gmail.com> | 2026-08-25 20:03:18 +0200 |
|---|---|---|
| committer | crueter <crueter@eden-emu.dev> | 2026-08-25 20:03:18 +0200 |
| commit | 0295dc5fff9b2977e753e7c126cc870abb07ee3f (patch) | |
| tree | 751496ed005803472254a4739b10f4cfb26045d7 /src/video_core/texture_cache | |
| parent | 60a474b8df051beb1d5fb84f4363d1576fcbb3fa (diff) | |
[vulkan] Removal of QCOM sampler limiters + CustomBorderColor and ColorBorderSwizzle adjustments (#4301)
This PR removes the artificial limit added for QCOM drivers based on a sampler budget limit (based on #3280 work), removes the ban on CustomBorderColor/BorderColorSwizzle for also QCOM driver, reduce the amount of combination required to created a sampler with custom border color/ color border swizzle; adds cases on R16 formats not able to swizzle on BGR565 formats; degrades samplers and color combinations when there's no color border swizzle available; fixes the srgb (LUT) values from legacy and now all the color variations are cached in the same key, instead of having 7 different handlers for them. In resume, rather than performance (due to the reduced amount of process on duplicated/ synced code on pipeline/texture cache), it's a graphica accuracy work that will improve image quality at the cost of almost 0 performance hit, rather than certain hitch if the color combination wasn't cached before. This applies to all platform.
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4301
Reviewed-by: Samuel <lizzie@eden-emu.dev>
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
Diffstat (limited to 'src/video_core/texture_cache')
| -rw-r--r-- | src/video_core/texture_cache/texture_cache.h | 57 | ||||
| -rw-r--r-- | src/video_core/texture_cache/texture_cache_base.h | 4 |
2 files changed, 0 insertions, 61 deletions
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index bcc40afde0..b6a37286a0 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h @@ -1896,68 +1896,11 @@ SamplerId TextureCache<P>::FindSampler(const TSCEntry& config, bool compute) { const auto [pair, is_new] = channel_state->samplers.try_emplace(config); if (is_new) { pair->second = slot_samplers.insert(runtime, config); - EnforceSamplerBudget(); } return pair->second; } template <class P> -std::optional<size_t> TextureCache<P>::QuerySamplerBudget() const { - if constexpr (requires { runtime.GetSamplerHeapBudget(); }) { - return runtime.GetSamplerHeapBudget(); - } else { - return std::nullopt; - } -} - -template <class P> -void TextureCache<P>::EnforceSamplerBudget() { - if (auto const budget = QuerySamplerBudget(); budget) { - if (slot_samplers.size() < *budget) { - return; - } - if (!channel_state) { - return; - } - if (last_sampler_gc_frame == frame_tick) { - return; - } - last_sampler_gc_frame = frame_tick; - TrimInactiveSamplers(*budget); - } -} - -template <class P> -void TextureCache<P>::TrimInactiveSamplers(size_t budget) { - if (channel_state->samplers.size() > 0) { - constexpr size_t SAMPLER_GC_SLACK = 1024; - ankerl::unordered_dense::set<SamplerId> active_sampler_ids; - for (auto const& e : channel_state->sampler_ids) - active_sampler_ids.insert(e.second); - // Elements in the map must be necesarily valid - size_t removed = 0; - for (auto it = channel_state->samplers.begin(); it != channel_state->samplers.end();) { - const SamplerId sampler_id = it->second; - if (!sampler_id || sampler_id == CORRUPT_ID) { - it = channel_state->samplers.erase(it); - } else if (std::ranges::find(active_sampler_ids, sampler_id) != active_sampler_ids.end()) { - ++it; - } else { - slot_samplers.erase(sampler_id); - it = channel_state->samplers.erase(it); - ++removed; - if (slot_samplers.size() + SAMPLER_GC_SLACK <= budget) { - break; - } - } - } - if (removed != 0) { - LOG_WARNING(HW_GPU, "Sampler cache exceeded {} entries on this driver; reclaimed {} inactive samplers", budget, removed); - } - } -} - -template <class P> ImageViewId TextureCache<P>::FindColorBuffer(size_t index) { const auto& regs = maxwell3d->regs; if (index >= regs.rt_control.count) { diff --git a/src/video_core/texture_cache/texture_cache_base.h b/src/video_core/texture_cache/texture_cache_base.h index 77947e83c7..d143c1ef72 100644 --- a/src/video_core/texture_cache/texture_cache_base.h +++ b/src/video_core/texture_cache/texture_cache_base.h @@ -420,9 +420,6 @@ private: void QueueAsyncDecode(Image& image, ImageId image_id); void TickAsyncDecode(); - void EnforceSamplerBudget(); - void TrimInactiveSamplers(size_t budget); - std::optional<size_t> QuerySamplerBudget() const; void QueueAsyncUnswizzle(Image& image, ImageId image_id); void TickAsyncUnswizzle(); @@ -509,7 +506,6 @@ private: u64 modification_tick = 0; u64 frame_tick = 0; - u64 last_sampler_gc_frame = (std::numeric_limits<u64>::max)(); Common::ThreadWorker texture_decode_worker{1, "TextureDecoder", {}, Common::ThreadPlacement::Efficiency}; |
