Skip the empty host-written texture lock on reads #24
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/DexNom--VIctory!24
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-24"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Adika713 on GitHub · 2026-11-25 19:08 UTC · original
Adika713:perf/dexnom-host-written→main· +114 −13 · 1 files · 1 commits · openSkip the global texture lock when no host-written textures exist.
Every texture use checked
HOST_WRITTEN, a mutex-protected set. In the commoncase that set is empty, so the check took a global lock just to find nothing.
An
AtomicBoolnow records whether the set holds anything; readers returnimmediately while it is false and take the lock only when it is true. Writers
set and clear the flag while holding the same lock.
What is in it
HOST_WRITTEN_ANYatomic flag, kept in sync withHOST_WRITTENunder itsmutex.
is_host_written()used byhost_wrote()andupload_from().ignored CPU-only A/B benchmark.
Tested
AMD Radeon RX 6950 XT (RDNA2), Ryzen 5 3600, 32 GB RAM, Windows 11,
rustc/cargo 1.98.1. No game data; the game was not run. Isolated
CARGO_TARGET_DIR. BCPack format tables were installed locally withInitialize-FormatTables.ps1and were not committed.cargo test --release -p victory-gpu --lib host_written_check_fast_path -- --ignored --nocapture --test-threads=1,3 runs, median of 5 samples:
Correctness:
cargo check -p victory-gpu --lib --tests --locked: exit 0.cargo test -p victory-gpu --lib host_written_tests -- --test-threads=1:1 passed, 0 failed, 1 ignored, 191 filtered.
victory-gpulib, 20 serial runs: 0 failed; each 189 passed,0 failed, 4 ignored, 0 filtered.
cargo test --workspace --no-fail-fast --locked: 0 failed suites.Not tested
about frame rate.
is written only while the
HOST_WRITTENmutex is held.AI use
AI-assisted: OpenCode, model Big Pickle. No game data.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.