GPU: no texture layouts or name copies per draw for unchanged answers #1978
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!1978
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1978"
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?
@0xkn0wh3r3 on GitHub · 2026-11-25 02:15 UTC · original
0xkn0wh3r3:gpu/cheap-per-draw-stats→main· +19 −8 · 2 files · 1 commits · openThe problem
Two lookups that run on every draw did expensive work even when the answer did not need it. Both run under a global lock, so the cost adds to every draw.
resource::alias_sourceruns for every placed view a draw reads. It built the placed texture's full console layout (texture_layout, a mip chain of vectors) under the globalTEXTURES_ATlock, and only then looked at the other textures at its address. Most placed views have no texture the GPU writes at that address, so the layout was usually built for nothing.memory::note_useruns on every draw that reads title memory. It copied the pipeline's name into a newStringeach time, under the process-wide stats lock, even when that name was counted already.The fix
resource::alias_sourcenow does the cheap tests first: another resource, written by the GPU, whose host texture is made (and is not this one's). It builds the layout only once such a texture is found. The answer is the same in every case.memory::note_uselooks the name up first and only copies it when it is new, so the name is copied once per frame instead of once per draw.Testing
cargo test -p victory-gpuon an RTX 5070 Ti (driver 621.24): all pass exceptdescriptor::host::tests::dynamic_slots_are_held_until_releasedandmemory::tests::lists_share_a_table_and_copies_keep_their_views, which fail the same way onmain(the NVIDIA 1,000,000-descriptor heap cap, #1835).cargo clippy -p victory-gpu --all-targets, with and without--features diagnostics: clean.Not covered
Not measured in a game run (no game data here). The answers are the same by construction.
Rebased onto
13f91camade). Before, it checked for a host texture of its own. The code of both changes is otherwise the same.@DesertGamer on GitHub · 2026-11-25 02:17 UTC · original
VIctory V2: community PRs, merged and tested
Open PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch.
Where it stands today: launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1).
⚠️ Entering the world on a real GPU can hang it and make Windows reset the driver. Try it at your own risk.
Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help:
https://DesertGamer/VIctory-V2
Unofficial community fork of Marvisak/VIctory, GPL-3.0.
@0xkn0wh3r3 on GitHub · 2026-11-25 06:35 UTC · original
@catminou4: nothing is cached here. Both changes compute the same answers as before, only in a cheaper order.
alias_sourceruns its cheap checks first (another resource, written by the GPU, a host texture of its own), and builds the texture layout only for a candidate that passes them.note_uselooks the pipeline name up before copying it, rather than copying it every draw. Nothing is kept from one draw to the next, so no cache key is involved.@Marvisak on GitHub · 2026-11-25 08:23 UTC · original · edited 2026-11-26 01:20 UTC
Automated triage for the maintainers.
Merge candidate (re-checked on
bc51d6f). This push is a rebase, and the code matches what was reviewed before. Inresource::alias_source(crates/victory-gpu/src/resource.rs), the cheap tests come first: another resource, GPU-written, with a different made host texture. The placed texture's layout (bytes/texture_layout) is built only when such a candidate exists. The result is still the first matching candidate in the same order, andNonein the same cases asmain.memory::note_usecopies a pipeline name only when it is not inStats::usesyet.Neither change alters any answer. The gain is unmeasured in a game run, but it removes per-draw work done under global locks.
CI: passing (
check).Generated by Claude Code
@catminou4 on GitHub · 2026-11-25 02:48 UTC · original · reviewed
Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.
No per-draw texture layouts/name copies when answers are unchanged — draw-call CPU overhead reduction; caching must be keyed on everything that affects the layout. Windows perf validation needed.
@KainanP on GitHub · 2026-11-26 14:50 UTC · original
Measured with a per-call list benchmark on main
63bcca4, with this PR merged on top (RTX 4060 Laptop, release build, median of 7 interleaved runs; method and full table in #2586):resource::alias_sourcefor a texture with nothing else at its address: 120 → 14 ns#3238 makes the same
alias_sourcechange and gets the same number. It also adds a linear-scan refreshed set, which costs more over a long list (see the linked comment), so this version looks like the one to take.AI use: Claude Code (Claude Opus 5.5) ran the measurements and drafted this comment.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.