Working shader translation + precompilation (Belobug) + v7-v10 RTX 5070 perf + main fixes #1396
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/fxceless--victory-fork!1396
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1396"
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?
@Alpacher on GitHub · 2026-11-26 22:50 UTC · original
Alpacher:pr/fxceless-full-v10→main· +88342 −33966 · 235 files · 582 commits · openFrom:
Alpacher/victory-fork:pr/fxceless-full-v10(headfe703a0)Into:
fxceless/victory-fork:main(52ac4ec)Contents
1. How the branch is built (merge strategy)
Shape
Why it is done this way
maininto the v10 tree gave 39 conflicting files, about 440 conflict hunks. They are inhost.rs(98),draw.rs(39),indirect.rs(31),shadow.rs(29),descriptor/host.rs(25),watch.rs(24),emit/lower.rs(21) and others.a26859f. Mixing them hunk by hunk would give a tree that neither side tested.main's shaders don't compile on the RTX 5070. So the maintainers' rule was: on any conflict in shader translation, precompilation or rendering, keep the v10/Belobug code.What the merge commit does
9d6da5crecords52ac4ecas a parent but keeps the v10 tree (git merge -s ours).main.What was then added on top
main'sdiagnostics/run logs and notes, which are pure additions (826a9c3).main's standalone fixes after its big Nov 26 commit, ported with their original authors (see §5).Other changes
b4143a9):Launch-Rework-v7..v10.ps1andWarm-v7.ps1.scripts/play.ps1stays.2. Attribution
The shader translation, precompilation ("warm"),
list::thin,host/card_steps, the renderer ports and nearly all of the GPU layer in this tree are the work of Belobug and the contributors merged intoBelobug/VIctory-Belobug-AMD, brancha-publier.Commit counts on this branch that are not on
main(git shortlog -sne 52ac4ec..HEAD):local <local@localhost>(andbeloooo <[email protected]>)main)main)Every commit keeps its original author. The ports from
mainsay(cherry picked from commit …)in their messages.3. Belobug's stack: shaders, precompilation, renderer
This section lists the parts of Belobug's work that matter most for the black screen. The full list is in the history.
Shader translation: "every shader the title uses translates"
190a686: 25,790 of 25,985 shaders translate. The 195 that don't are unused geometry shaders.1162d38).06fe22a);4fd34fd).d1f883e,41d3184,0dc5d1b).e70e031).027e367).0fbec7e,9a0843d,2d30943,6fac561).Precompilation (
apps/victory/src/warm.rs,translate --warm)c6ff045).shader-info/shaders(#117).List translation (
crates/victory-gpu/src/list/thin.rs,VICTORY_THIN)Card steps (
crates/victory-gpu/src/host/card_steps.rs)VICTORY_PLACED_ORDER: a placed copy refuses a submission only for taken steps behind it, andcut_forsplits the submission instead of waiting.Renderer ports 1–7 (
port.rs, all opt-in)VICTORY_PORT_CONSTANTS), descriptors, CBVs, guard plan and journal.Other
VICTORY_WAIT_RESIDENT).VICTORY_CARD_BUFFERS_MB,…_MIN_MB).VICTORY_PANEL), and replay and timeline tooling.4. Our v7–v10 optimizations and diagnostics
All of these were made and measured on the RTX 5070 + 5800X3D. Each one is behind an env var with an A/B fallback. The code defaults are listed in §6.
4.1 Memory notices: merge overlaps, rescan-all on overflow (v7,
a8f02d5)crates/victory-gpu/src/watch.rsrecord_remap(921d8d3b).(0, u64::MAX)rescan-all entry is kept.4.2 Exact-copy buffer reuse:
VICTORY_EXACT_REUSE(v7e1c2045, hardened in v9f5c51f9, v1069a259e)crates/victory-gpu/src/shadow.rs, inexact(),Spares,spare_gateandspare_tests(address, len). The title's ring positions move every frame, so there were 650–675 new committed buffers a frame with about 6,000 alive.EXACTlock that every list-translating thread takes.Arc::strong_count, then recent use, then the COM refcount (v10).STARTED + bury_lag()(64; 16 when RAM is limited) submissions have finished and 3 frames have passed (VICTORY_EXACT_REUSE_FRAMES).Kept), so a buffer they use is never idle.Shadow(new id, no card side, no dirty state).shadow::spare_tests.VICTORY_EXACT_REUSE=0gives the v7 path.VICTORY_EXACT_REUSE_SAFE=0gives v8's weaker gate.4.3 Mapping waits on a shared signal:
VICTORY_MAPPED_SHARED(v7,825e8e7)crates/victory-gpu/src/host.rs, inmapped()VICTORY_WAIT_RESIDENTon, every new heap or buffer sent a copy on an aside queue and waited for it while holding one global lock. Runrun-v7-20261126-212142had 161,200 waits in a row.SetEventOnCompletionoutside the lock.VICTORY_MAPPED_SHARED=0.4.4 Translated list calls by kind:
VICTORY_THIN_OPS(v7,7d7fde7; diagnostic)crates/victory-gpu/src/list/thin.rsVICTORY_THIN_OPS=0.4.5 Card-cap turn-down log (v9,
f5c51f9; diagnostic)crates/victory-gpu/src/shadow.rs, incard_room_forVICTORY_CARD_BUFFERS_MB(512 MB by default on budgets ≤12 GiB), later big buffers were turned down silently. They stayed in system memory and were compared on the CPU: 161.9 MB a frame.info!line on each turn-down (the first 16, then every 64th). Behaviour is unchanged.4.6 Why submissions wait on card steps:
VICTORY_CARD_STEPS_WHY(v9,02d3724; diagnostic)crates/victory-gpu/src/host/card_steps.rsplan()leaves a submission to the wait, by cause.VICTORY_PLACED_ORDER=1fixes.VICTORY_CARD_STEPS_WHY=0.4.7 Bind-time split:
VICTORY_BIND_SPLIT(v9c7732cb, v100f9722c; diagnostic)crates/victory-gpu/src/draw.rsandlist/thin.rsState::bindis split into the early texture pass, descriptor tables, title memory by address, and the rest.BIND_NS[8]).VICTORY_BIND_SPLIT=0.4.8 SHR breakdown line:
VICTORY_SHARED_LINE(v10,69a259e; diagnostic)crates/victory-gpu/src/shadow.rs, plusinplace::in_place_bytes()VICTORY_SHARED_LINE=0.4.9
.gitignorefor isolated target dirs (v7,c1af2da)/target-*/,/logs/and root-level*.logfiles.5. main's fixes ported on top
af23c65#1320: split submissions give their tables' slots backfe13d44, cleancherry-pick -x46da5ee#1353: finish a pipeline queue entry when its build panicsdd95546, by hand. The v10make.rsdoesn't useget_or_init, so the compiler guard's bad-key check stays first and the build is wrapped incatch_unwind. Test brought over.a463dcb#1336: pin the texture a placed view aliases while the copy uses it (use-after-free)e2489cc, by hand.alias_ofreturnsHeld. The two callers that copy (draw.rs readable,external.rs prepare_input) hold it. The two callers that only check (texture_at, the texture-ahead pass) use a newhas_aliasthat takes no reference, so a check can never be the last release while a lock is held.e4245f3/52ac4ec#1324: dynamic descriptor slots go back only to the heap that took themfe703a0, by hand.HostHeap::id(NEXT_ID),State::dynamickeeps(heap, id, first, n), andrelease_dynamic/HostHeap::releasecheck the id. Test brought over. (Onmain, this change landed insidee4245f3, and52ac4eccarries only its message.)2440c7b#1321: a stale staging file no longer loses a translationvictory-pipeline/src/cache.rsalready retries up to 128 new names onAlreadyExists, and has the teststaging_retries_collisions_without_changing_existing_files.6. Environment variables
Added or changed by our v7–v10 work (code defaults; "on" means on unless set to
0):VICTORY_EXACT_REUSE=0: always create (v7)VICTORY_EXACT_REUSE_SAFE=0: v8 gate (in-flight only)VICTORY_EXACT_REUSE_FRAMES3VICTORY_MAPPED_SHARED=0: v7VICTORY_THIN_OPS=0: not timedVICTORY_CARD_STEPS_WHY=0: not countedVICTORY_BIND_SPLIT=0: not timedVICTORY_SHARED_LINE=0: not printedBelobug switches we measured with (the defaults are Belobug's and unchanged; this is the set we ran):
VICTORY_PLACED_ORDER1VICTORY_PORT_CONSTANTSVICTORY_CARD_BUFFERS_MB1024…_MIN_MB=1: CPU compare of ≥1 MiB copies goes from 161.9 MB to 0.0 MB a frameVICTORY_CARD_BUFFERS_MIN_MB1VICTORY_WAIT_RESIDENThost.rs)VICTORY_THIN/VICTORY_THIN_THREADS1/6VICTORY_PORT_GUARD,VICTORY_PORT_JOURNAL1VICTORY_JOIN_PARTS,VICTORY_UPLOAD_AHEAD8,1VICTORY_TEXTURE_NO_WAIT=1,VICTORY_RELAY=2,VICTORY_WIDE_BACK=1,VICTORY_CARD_REHASH_RUNS=1,VICTORY_JOIN_COPIES=1,VICTORY_INDIRECT_WINDOW=1,VICTORY_RELAY_COPY=1,VICTORY_CARD_STEPS=2,VICTORY_INDIRECT_BATCH=2,VICTORY_MAP_THREADS=1,VICTORY_TITLE_PRIORITIES=0,VICTORY_CARD_AWAKE=1,VICTORY_SHOW_AFTER=1,VICTORY_D3D12_DRED=light,VICTORY_DSTORAGE_STAGING_MB=256,VICTORY_MAP_LEAN=1,VICTORY_STREAM_PRIORITY=1,VICTORY_FRAME_INTERVAL_MS=16.667,VICTORY_D3D12_ADAPTER=NVIDIA,VICTORY_PANEL=1(from Belobug'sscripts/play.ps1stack)7. Benchmarks (RTX 5070 + 5800X3D, GTA VI)
Rig and settings
game_scarlett_master.exe, Series X mode.End to end
PLACED_ORDERoff)PLACED_ORDER=1, exact reuse on)Subsystems
descriptor tablesbind time per frame (all threads)VICTORY_BIND_SPLITline, runs225548/225146bindper frameexactlineWAIT_RESIDENTlineshader writes looked for on the CPUline, runs215944/225146PLACED_ORDER=1VICTORY_CARD_STEPS_WHYlineCaveat: the two runs behind the bind numbers (
225548/225146) also differ in render scale and in port 1. The table cost, though, is almost all exact-copy creation, which reuse removes directly.8. Root cause: face spikes = PORT_CONSTANTS, not EXACT_REUSE
Symptom: faces and skinned meshes showed vertex "spikes". The first A/B changed exact reuse, port 1 and render scale at once, so it looked as if reuse was to blame.
Mechanism
VICTORY_PORT_CONSTANTS=1(renderer port 1) opens the title's 185 MB graphics region in place, as CUSTOM/system-memory heaps (OpenExistingHeapFromAddress1).0x34e10000holds the constants ring and the skinning output.shadow::exact): 4,600–5,150 askings a frame.Port off
GPU time follows the same cause
Why reuse is not the cause
Shadow.Shadowid or the title address, never on the buffer.Confirmed in game: port 1 off with reuse on gave clean faces. Port 1 stays opt-in (off) in code.
9. What changes for main (read before merging)
Because the merged tree is the v10/Belobug tree, these parts of
mainthat came aftera26859fare replaced by Belobug's equivalents, or removed.main-only modules not in this tree (17 files)crates/victory-gpu/src/:backreads.rs,cardmeter.rs,drvwatch.rs,fpsbox.rs,framelog.rs,heap_pass.rs,heap_worker.rs,plaincopy.rs,profile.rs(+profile/tests.rs),queue2.rs,renderdoc.rs,shot.rs,spread.rs,stats.rscrates/victory-shader/src/emit/:dispatch_threads.rs,halves.rsmain's switches such asVICTORY_HEAP_WORKER,VICTORY_SHOT, the frame log, the FPS corner box, the driver watch, the card meter and the profiler.VICTORY_PANEL), timeline and replay tooling instead.main's changes inside shared files (for example card hashing a thread group a piece, 4 KiB dirty tracking, gather segments,main's texture fixes)main's shader path renders black on our hardware.Kept from
maindiagnostics/, all of its history, and the five fixes in §5.Diff vs
52ac4ecvictory-shader,victory-pipelineandapps/victoryaccount for 50 files, +10,714 / −2,847.If you'd rather keep
main's instrumentation: these features can be re-ported one at a time on top of this tree. They are diagnostics, and none of them is needed for correct rendering.10. Verification
Setup
pr/fxceless-full-v10atfe703a0.CARGO_TARGET_DIR=target-pr-full-v10.Commands
Results
descriptor::host::tests::dynamic_slots_are_given_back_only_to_the_heap_that_took_themandpipeline::make::tests::a_panicking_pipeline_is_refused_and_the_worker_continues, plusshadow::spare_tests.victory.exeis 11,577,856 bytes, SHA-25605722876BE487967701DB599DCDE78F8DBD37CE860CDAC1E049A77F78DC07A45.Spares::takeis used only by tests) is harmless and was already in v10.git merge-base --is-ancestor 52ac4ec HEADis true, andgit merge-tree --write-tree 52ac4ec HEADis clean. Zero conflicts merging intomain.--locked: no lockfile drift.a803c87fa967c0340c96b4f27913a98a3d310c6ebe5f735d6aee1702e2(landing on threads, card steps 2) into local/copies ee188c1df0d4772b3d4254dc02ca79e248) into local/tests 338f42479ea79e248) into local/copies; a test of the bits against remapping 535a3835b174045e4' into local/upcopies cb72fc0a17e6f492d) into local/tests cd37859b39e6f492d) into local/tests 9713df6eccc651346' into local/upcopies 4f6bd62362572bd4c' into local/upcopies 47ae1737c28dd30ab: writes through one view of a page are seen at its other views 49c44f61d38dd30ab(every view of a page is guarded) ab71750898a26859f(the first room renders right) 925736dbd0`victory run GTA6.exe`, run from the game folder, gives an exe path with an empty parent, and that empty folder was mounted as G:. An empty path cannot be made absolute, so the root stayed empty and G:\x64\a.rpf became \x64\a.rpf: the root of the current drive. The title then found none of its files. An empty root is now the current directory, which is what an empty folder means everywhere else (`Path::new("").join("x")` is `x` in the current directory). Passing a path with a folder in it is unaffected. (cherry picked from commit 01ae55a3ba04c39a0e8851cc00da16af7a49adbd)..in the not-yet-existing part of a path bb0a2428fcb69eab84) into night/cpu 2c79c5b7fef61ecf3b) into night/cpu 19be44dd6ff61ecf3b' into night/light be085e5385a2537066) 51d3f4da00f5c03f3b, pull request 999: Geckomacabre895c0b8f,04df4350); on by default 23925a4aa2c36971b2) 17c4717b44449830f6' into local/next 57e55d069apLastBreadcrumbValue is the count of completed breadcrumbs, so history[done] is the first op that had not completed. The old "stopped at command {done} of {count} (op X)" read like one-based numbering and was mistaken for the last completed command (issue #22). Say the count, the last completed op and the zero-based index of the first uncompleted one explicitly, and skip the detail when the reported count is out of range. Refs #2213091f6e) 0dc5d1be48DXIL wants one interpolation mode per signature row; the console packs a nointerpolation float beside an int or a system value (the front face) in one row, and our signatures declared the float linear: 48 pixel and mesh programs were rejected by the validator ("interpolation mode that differs from another element packed into the same row"). Float elements nothing decides (unread inputs, outputs) now take the mode the row's other elements agree on: same_mode_per_row from VIctory13091f6e, ported by hand (the whole commit conflicts in 18 places with what local/next already took of it). All 48 now validate. Co-Authored-By: Claude Opus 5.5 <[email protected]>13091f6e) 41d3184eafimage_get_lod of a 2D array passed the slice as CalculateLOD's third coordinate, which DXIL wants undefined: three pixel programs (PS_DeferredTextured_AlphaClip, PS_MirrorReflectionDeferredTextured_ AlphaClip, PS_VfxVBuffer_AlphaClip) were refused by the validator ("out of bound coord must be undef"). The level does not depend on the slice, so the result is unchanged where a driver took the module. Co-Authored-By: Claude Opus 5.5 <[email protected]>Run port1-1: the title maps the five pieces of its 185 MB heap in another order than their addresses, so the heap was views of one section in a scattered order ("not one stretch of a section: Scattered") and nothing was placed. With VICTORY_PORT_CONSTANTS=1 xmem now gives the page numbers mapped into a 32-bit graphics reservation the slices at their offset in it, when the reservation is all one section and both slices are fresh (never mapped or written: no commit bit), which the title cannot observe. Co-Authored-By: Claude Opus 5.5 <[email protected]>CS_TraceShadowRays_FullAdaptive reuses SGPRs between saved lane masks and constant-buffer fields: a join of a mask and a number (lowered as the number it is) is cut with s_and_b32 / s_or_b32, which structurisation takes for lane masks, and the result is compared per lane as a number. Its ballot holds lanes outside EXEC, so the program was refused ("a lane mask holding lanes elsewhere read as data"). Such a read now takes the number the bit operations compute from their operands (constants, root constants, values lowered as numbers, such operations again; console lanes only, where the joined mask is the console's number). Only on a second try, as first halves of interpolations: with it on for every program, 69 compute programs that already translated came out changed (CS_RaytracingResolve, ...); now none does. `victory translate` makes the same second tries as runs (emit_with_retries). FullAdaptive now translates and validates. The test runs the joined register through both paths on the hardware device (WARP takes no declared wave size); it found that a join read only through such operations must be marked read, or its mask's edge brought 0. Co-Authored-By: Claude Opus 5.5 <[email protected]>Heaps are made without sharing across adapters, so the resources placed in them cannot ask for it: the buffers renderer port 1 places in the heap opened from the title's graphics memory (and every other heap opened from memory) were refused ("parameter incorrect", 1,326 to 3,576 a capture). With `--timing detailed`, a list that runs no shader but ours (the host's state preludes, copies of what the CPU sent up, the card copies' passes) has its commands summed under "... (lists of ours)". Co-Authored-By: Claude Opus 5.5 <[email protected]>c9c932ce9428969f052ac4ec) into the Belobug-based v10 tree 9d6da5ce75@akimfomin on GitHub · 2026-11-26 23:15 UTC · original
The clean merge reported for
52ac4ecno longer holds against maina42b627e78476d691042a2a12e8cd5fcf5e49d77. I ran a three-way check of exact headfe703a0b0c6396c4621b2c82f2a3d994dbc8602b: conflicts indraw.rs,host.rs,indirect.rs,list.rs,pipeline/make.rs,texture.rsandconsole_insn.rs.I would resolve and test
pipeline/make.rsfirst. Current main waits for an unready compute pipeline by default; this matters for dispatches that run only once at a scene change. Exact upstream guard · Independent scene transition measurements from #1312. One cold-cache transition with compute wait ON/OFF on the integrated head, logging dropped dispatches, would catch a resolved merge silently losing that behavior. The check is Git/source-only. PortBridge · AI-assisted comparison.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.