perf(gpu): lock-free has_pending fast path in Shadow::nothing_new and writes_pending #1134

Manually merged
github merged 1 commit from github-bot/gh-1134 into main 2026-11-28 19:41:58 +00:00 AGit
Owner

@⁠adwen-007 on GitHub · 2026-11-28 13:51 UTC · original
adwen-007:pr/perf-lockfree-has-pending → main · +13 −3 · 1 files · 1 commits · merged 2026-11-28 19:39 UTC

Problem

Shadow::nothing_new and Shadow::writes_pending are called thousands of times per frame on the hot refresh path and unconditionally acquired self.pending.lock() even when no shader writes were pending for that shadow buffer.

Fix

Track pending state with an AtomicBool (has_pending, updated alongside self.pending under its mutex) so nothing_new and writes_pending skip locking the mutex in the common empty case.

Verification

  • cargo check -p victory-gpu passes cleanly on v2026.11.28.01 (63b902f).
  • Verified across multi-hour live title gameplay on Windows 10 x64 + i7-12700K + RTX 3060 Ti with zero synchronization issues.
**@⁠adwen-007** on GitHub · 2026-11-28 13:51 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1134) `adwen-007:pr/perf-lockfree-has-pending` → `main` · +13 −3 · 1 files · 1 commits · merged 2026-11-28 19:39 UTC ## Problem `Shadow::nothing_new` and `Shadow::writes_pending` are called thousands of times per frame on the hot refresh path and unconditionally acquired `self.pending.lock()` even when no shader writes were pending for that shadow buffer. ## Fix Track pending state with an `AtomicBool` (`has_pending`, updated alongside `self.pending` under its mutex) so `nothing_new` and `writes_pending` skip locking the mutex in the common empty case. ## Verification - `cargo check -p victory-gpu` passes cleanly on `v2026.11.28.01` (`63b902f`). - Verified across multi-hour live title gameplay on Windows 10 x64 + i7-12700K + RTX 3060 Ti with zero synchronization issues.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 14:33:59 +00:00
github-bot referenced this pull request from a commit 2026-11-28 19:41:56 +00:00
github manually merged commit 8462e8d5f1 into main 2026-11-28 19:41:58 +00:00
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!1134
No description provided.