Allegory of the CaVI : RE notes. #2609

Closed
opened 2026-11-26 05:10:14 +00:00 by github-bot · 1 comment
Owner

@⁠fubukiclears on GitHub · 2026-11-25 16:45 UTC · original

How a GTX 1660 SUPER walks into a ray-traced prison: test report + RE notes from the exe

Hey all. Huge respect to everyone grinding on this: the fxceless fork, VIcky, VItoriaBr and everyone filing those beautifully detailed reports. This is my way of paying some of that back.

I've been pulling apart game_scarlett_master.exe 1.0.2.1 statically, and I'm dropping everything below so nobody has to rediscover it. All addresses are RVAs (ImageBase 0x140000000; add whatever base your runtime maps it at). No game data in here, just addresses and behaviour.

1. The underdog report: GTX 1660 SUPER (Turing, 6 GB, zero RT cores, 32-lane waves)

Yes, the card everyone forgot about. It runs.

  • Ryzen 5 PRO 4650G, 32 GB RAM, Windows 11, game on an SSD (world loads in ~2.4 min; it took 16-20 min from a hard drive, so do yourself a favour).
  • Tree: fxceless/victory-fork 9376fd6 + Xeltax/VIcky fx-heapmap-8d + fork PR #86 (PC FidelityFX) + fork PR #610 (TEXTURE_DROP_MIPS), Series S profile.
  • Result: the prologue (cell, yard, cutscenes) at ~2.4-2.6 fps (4,000-6,000 draws/frame), the cell lit by its direct lamps with proper shadows (pure bounce-lit areas still stay dark, see §5), faces fully textured up close, no device removal in 30+ minute sessions. Audio is flawless.

What actually mattered on a 6 GB card:

  • --console series-s: render targets ~1.35 GB instead of ~3 GB. On a small card this isn't optional.
  • VICTORY_SHADER_OPT=0, the 14 cascade-shadow hashes in VICTORY_WAVE_DEEP_SKIPS_NOT (from VIcky's README — without them 32-lane GPUs drop walls/ceilings and break shadows), and VICTORY_SHADER_LOOP_LIMIT=16384 (keeps runaway loops from freezing the PC without smearing hair like 32 does).
  • VICTORY_LEVELS_ON_DEMAND=1, VICTORY_CARD_ROOM_FOR_TARGETS_MB=1500 (the 3,072 default is sized for Series X and quietly starves textures on S), VICTORY_TEXTURE_ROOM_PERCENT=94.
  • VICTORY_TEXTURE_DROP_MIPS=1 (PR #610). This one's the black-face fix. Without it ~20,000 textures (10 GB) sat waiting for room, the main character's head among them, so you got a lit body with a black head. Fun detail: another inmate's face went black the exact moment the camera got close enough to ask for her bigger texture. Not lighting, not the skin shader: just no room.
  • VICTORY_CARD_FETCH_INFLIGHT off: on this card it pushed GPU time from ~100 to ~285-300 ms a frame. That matches what VItoriaBr measured on an RTX 5060 Ti, so it's not just a 1660 thing.

2. The 174 MB "GPU-heap buffer" is mostly not per-frame data (for fork #650)

That 174 MB buffer everyone keeps comparing twice a frame? It's three different things glued together, and only one of them actually changes per frame.

The 185 MiB 32-bit pool is made by 0x1e86440 (single caller 0x5c5ff00, from 0x2478440): one placeholder (XMemVirtualAlloc(..., 0x42000, attr 0x7), base [0x75df188]), physical pages from XMemAllocatePhysicalPages(0x280), split into five attr-0x27 windows:

Window Offset Size What it is
0 +0x0000000 10 MiB CBV/SRV/UAV descriptor heap 0
1 +0x0a00000 1 MiB descriptor heap 1
2 +0x0b00000 27 MiB the per-frame dynamic constant/upload ring (216 x 128 KiB chunks)
3 +0x2600000 47 MiB shader / PSO / command-stream heap 0
4 +0x5500000 100 MiB shader / PSO / command-stream heap 1

Windows 2+3+4 are exactly that 174 MB (0xae00000). Windows 3 and 4 barely ever change. Only window 2 is the hot one.

How the ring works (window 2):

  • Base [0x75df1b8] (CPU == GPU address 1:1), chunk count [0x75df1c8] = 216, chunk size [0x75df1cc] = 0x20000, chunk descriptor array [0x75df1c0] (stride 0x58).
  • Per-context bump allocators that grow downward: Direct 0x4d9d990/0x4d9d9a0 (ctx+0x12780), Async 0x31b80 (ctx+0x12300). Cursor fields: [ctx+0x88] current chunk descriptor, [ctx+0x90] write pointer (starts at the chunk top and goes down), [ctx+0x98] bytes left.
  • On submission (0x2a42d0, 0x607530 -> 0x24749d0; 0x1f6130 -> 0x1f75eb0) each used chunk goes onto a fence-tracked queue (tail [0x75df1d8], head [0x75df1e0], mutex 0x75df198) and gets stamped: [chunk+0x18] = packed fence (queueIdx << 56) | value, [chunk+0x50] = frame index [0xa9437ac]. 0x5c280 recycles chunks once their fence completes.
  • Bottom line: only [write pointer .. chunk top] of the chunks a submission touched can have changed. The rest of those 174 MB doesn't need comparing or copying at all.

3. Pools that never hold GPU data (stop tracking them)

Free performance, basically:

  • The 3,520-page SharedPools (0x22163d0, 220 MiB on Series S): CPU-only engine object pools (attr 0x21, prot 4 views via 0x2216390).
  • The RAGE CPU heaps (0,0) 1,162 MiB, (0,4) 194 MiB, (0,5) 258 MiB (attr 0x183), plus the 20 MiB attr-0x181 block.
  • The 4,752-page pool (0x5eb2780, 297 MiB on S / 710 MiB on X): render targets, depth and aliased transient GPU buffers. GPU-only, so the CPU never needs them back.

4. Where every BVH byte lives (for the ray-tracing crew)

If the memory-by-address copies are what's killing the builder, here's the good news: all BVH data sits in exactly two pools.

  1. RAGE GPU heap, Allocator (0,2) at 0x71c2808 (attr 0x283, 1,277 MiB on S / 2,199 MiB on X). BLAS sub-pool base [0x75a47e8], size [0xa943970] (250 MiB S / 500 MiB X); scratch [0x84207b0] (40 MiB S / 64 MiB X).
  2. The dual-mapped streaming pool (0x1e6c110): CPU view [0x9e1dac0], GPU view [0x9e1dad0], span [0x9e1dac8]. Static BLASes are rehydrated in place here (0xea6c60 / 0x2490a20: dest == source + header), not copied into the BLAS pool.

The builder object is XboxBvhBuilder(device, false) at 0x247944f, stored at [0x75df0a8] (the bool means rehydrate-only). The batched build desc has stride 0x50; happy to share the full layout.

5. The RT gate, and why "just turn RT off" won't light your rooms

  • No hidden "RT off" setting or baked probes exist in the exe. The 4-tier quality table (0x6b4d760, indexed by [settings+0x58] via 0x5451e10) only scales probe grid dim (16 -> 32), cascades (3 -> 5) and SR flags; the hardcoded feature bitmask [0x76b8fe0] = 0xDE4F only controls RT directional shadows (0x0004) and async-compute queue selection (0x0040 -> [0x840d8b2]). All probe buffers (0x0cd3b40) are pure VRAM compute UAVs — none of the 38 *Store asset stores hold baked probes or precomputed GI.
  • 0x4fd8550 (HasValidTLAS) is the single check behind all 46 ray-traced call sites. Make it return 0 and every consumer takes its built-in non-RT path. I wired it up locally as VICTORY_NO_RT=1 (byte-checked, so it refuses to patch the wrong build).
  • You can skip the per-frame structure builds too: the trampoline 0x93cd10 turns its argument into a run flag (test edx,edx; setne dl) for 0x16ef290 (enqueued unconditionally with r9d = 1 at 0x0137692 inside 0x0137470), whose cl == 0 branch (0x16f1bd4) skips 0x3260db0 (the builds). Force the flag to 0 rather than stubbing 0x16ef290 directly — that cl == 0 branch is the engine's own maintenance path (used by 0x03c9510) and still flips the double-buffer index [0x840d8a0] and clears the [0x840d870] visibility arrays, while making ~300 dropped builder dispatches a frame vanish.
  • Plot twist: the fallback shaders write zero light. CS_Primary_Gather_Fallback (81560230fcde2b0a) writes (0, 0, 0, 0) radiance + 10000.0f max distance (0x461c4000), CS_ScreenProbes_TraceRays_Fallback (a953d5b93efe8424) stores constant ray-miss sentinels (0xf8003c00 / 0xfffe03ff / 0x0ffff800), and the secondary irradiance cache (0x357b990) has no fallback at all (only alpha probes' CS_GatherAndShadeAlpha_Fallback, 29dc558346584906, actually samples sky/env cubemaps). They're null-guards for the frames before a BVH exists, not a hidden non-RT lighting mode, so rooms lit only by bounce light stay dark with or without RT on PC right now. Sorry.
  • Quick hack target if anyone wants playable dark interiors without RT: under VICTORY_NO_RT=1, only two final-gather permutations actually bind to write the indirect-diffuse UAV read by tiled_lighting: CS_FinalGather_0_1_1_0 (2dc364df5d3278b8) and CS_FinalGather_0_1_1_1 (738350c1a01b713a). Clamping a small ambient floor there (or in CS_Primary_Gather_Fallback) would lift pure-bounce rooms out of #000000 at zero GPU cost.
  • And there's an unused door: the shader pack ships a complete voxel/SDF GI path (voxelization, and *_Voxels passes in indirect_diffuse_lighting, indirect_light_probes and sr_tracing). The retail exe never dispatches it (zero GS_VoxelizeGeneric geometry shaders bind at runtime); only EntityCoarseVoxelization (loaded 0x0cbd670, dispatched 0x32af080) runs. Whoever cracks feeding those passes might get lit interiors without full RT.

6. What I'm digging into next (shout if you want something else)

  1. The title-code crashes in Jason's first missions (fork #863, #811): +0x4f28e0f (read 0x18 on a worker thread, binoculars), +0x4f46cc2 and +0x4f0ed7d (both read 0xFFFFFFFFFFFFFFFF). What those functions do, and what's null or -1 when they blow up.
  2. Every spot where the game's CPU reads results the GPU wrote (readback buffers, query results, exposure, water-height lookups, particle counts). With that list, copy-back could skip literally everything else.
  3. Whether EntityCoarseVoxelization's volume can feed the *_Voxels GI passes.

Questions, corrections, "you're wrong about X": all welcome. Let's get this thing lit.

**@⁠fubukiclears** on GitHub · 2026-11-25 16:45 UTC · [original](https://github.com/Marvisak/VIctory/issues/2609) # How a GTX 1660 SUPER walks into a ray-traced prison: test report + RE notes from the exe Hey all. Huge respect to everyone grinding on this: the fxceless fork, VIcky, VItoriaBr and everyone filing those beautifully detailed reports. This is my way of paying some of that back. I've been pulling apart `game_scarlett_master.exe` 1.0.2.1 statically, and I'm dropping everything below so nobody has to rediscover it. All addresses are RVAs (ImageBase 0x140000000; add whatever base your runtime maps it at). No game data in here, just addresses and behaviour. ## 1. The underdog report: GTX 1660 SUPER (Turing, 6 GB, zero RT cores, 32-lane waves) Yes, the card everyone forgot about. It runs. - Ryzen 5 PRO 4650G, 32 GB RAM, Windows 11, game on an SSD (world loads in ~2.4 min; it took 16-20 min from a hard drive, so do yourself a favour). - Tree: fxceless/victory-fork `9376fd6` + Xeltax/VIcky `fx-heapmap-8d` + fork PR #86 (PC FidelityFX) + fork PR #610 (`TEXTURE_DROP_MIPS`), Series S profile. - Result: the prologue (cell, yard, cutscenes) at **~2.4-2.6 fps** (4,000-6,000 draws/frame), the cell **lit by its direct lamps with proper shadows** (pure bounce-lit areas still stay dark, see §5), faces fully textured up close, no device removal in 30+ minute sessions. **Audio is flawless.** What actually mattered on a 6 GB card: - `--console series-s`: render targets ~1.35 GB instead of ~3 GB. On a small card this isn't optional. - `VICTORY_SHADER_OPT=0`, the 14 cascade-shadow hashes in `VICTORY_WAVE_DEEP_SKIPS_NOT` (from VIcky's README — without them 32-lane GPUs drop walls/ceilings and break shadows), and `VICTORY_SHADER_LOOP_LIMIT=16384` (keeps runaway loops from freezing the PC without smearing hair like `32` does). - `VICTORY_LEVELS_ON_DEMAND=1`, `VICTORY_CARD_ROOM_FOR_TARGETS_MB=1500` (the 3,072 default is sized for Series X and quietly starves textures on S), `VICTORY_TEXTURE_ROOM_PERCENT=94`. - `VICTORY_TEXTURE_DROP_MIPS=1` (PR #610). **This one's the black-face fix.** Without it ~20,000 textures (10 GB) sat waiting for room, the main character's head among them, so you got a lit body with a black head. Fun detail: another inmate's face went black the exact moment the camera got close enough to ask for her bigger texture. Not lighting, not the skin shader: just no room. - `VICTORY_CARD_FETCH_INFLIGHT` **off**: on this card it pushed GPU time from ~100 to ~285-300 ms a frame. That matches what VItoriaBr measured on an RTX 5060 Ti, so it's not just a 1660 thing. ## 2. The 174 MB "GPU-heap buffer" is mostly not per-frame data (for fork #650) That 174 MB buffer everyone keeps comparing twice a frame? It's three different things glued together, and only one of them actually changes per frame. The 185 MiB 32-bit pool is made by `0x1e86440` (single caller `0x5c5ff00`, from `0x2478440`): one placeholder (`XMemVirtualAlloc(..., 0x42000, attr 0x7)`, base `[0x75df188]`), physical pages from `XMemAllocatePhysicalPages(0x280)`, split into five attr-0x27 windows: | Window | Offset | Size | What it is | |---|---|---|---| | 0 | +0x0000000 | 10 MiB | CBV/SRV/UAV descriptor heap 0 | | 1 | +0x0a00000 | 1 MiB | descriptor heap 1 | | 2 | +0x0b00000 | 27 MiB | **the per-frame dynamic constant/upload ring** (216 x 128 KiB chunks) | | 3 | +0x2600000 | 47 MiB | shader / PSO / command-stream heap 0 | | 4 | +0x5500000 | 100 MiB | shader / PSO / command-stream heap 1 | Windows 2+3+4 are exactly that 174 MB (`0xae00000`). Windows 3 and 4 barely ever change. **Only window 2 is the hot one.** How the ring works (window 2): - Base `[0x75df1b8]` (CPU == GPU address 1:1), chunk count `[0x75df1c8]` = 216, chunk size `[0x75df1cc]` = 0x20000, chunk descriptor array `[0x75df1c0]` (stride 0x58). - Per-context bump allocators that grow **downward**: Direct `0x4d9d990`/`0x4d9d9a0` (ctx+0x12780), Async `0x31b80` (ctx+0x12300). Cursor fields: `[ctx+0x88]` current chunk descriptor, `[ctx+0x90]` write pointer (starts at the chunk top and goes down), `[ctx+0x98]` bytes left. - On submission (`0x2a42d0`, `0x607530 -> 0x24749d0`; `0x1f6130 -> 0x1f75eb0`) each used chunk goes onto a fence-tracked queue (tail `[0x75df1d8]`, head `[0x75df1e0]`, mutex `0x75df198`) and gets stamped: `[chunk+0x18]` = packed fence `(queueIdx << 56) | value`, `[chunk+0x50]` = frame index `[0xa9437ac]`. `0x5c280` recycles chunks once their fence completes. - Bottom line: **only `[write pointer .. chunk top]` of the chunks a submission touched can have changed.** The rest of those 174 MB doesn't need comparing or copying at all. ## 3. Pools that never hold GPU data (stop tracking them) Free performance, basically: - The 3,520-page SharedPools (`0x22163d0`, 220 MiB on Series S): CPU-only engine object pools (attr 0x21, prot 4 views via `0x2216390`). - The RAGE CPU heaps (0,0) 1,162 MiB, (0,4) 194 MiB, (0,5) 258 MiB (attr 0x183), plus the 20 MiB attr-0x181 block. - The 4,752-page pool (`0x5eb2780`, 297 MiB on S / 710 MiB on X): render targets, depth and aliased transient GPU buffers. GPU-only, so the CPU never needs them back. ## 4. Where every BVH byte lives (for the ray-tracing crew) If the memory-by-address copies are what's killing the builder, here's the good news: all BVH data sits in exactly two pools. 1. **RAGE GPU heap, Allocator (0,2)** at `0x71c2808` (attr 0x283, 1,277 MiB on S / 2,199 MiB on X). BLAS sub-pool base `[0x75a47e8]`, size `[0xa943970]` (250 MiB S / 500 MiB X); scratch `[0x84207b0]` (40 MiB S / 64 MiB X). 2. **The dual-mapped streaming pool** (`0x1e6c110`): CPU view `[0x9e1dac0]`, GPU view `[0x9e1dad0]`, span `[0x9e1dac8]`. Static BLASes are **rehydrated in place** here (`0xea6c60` / `0x2490a20`: dest == source + header), not copied into the BLAS pool. The builder object is `XboxBvhBuilder(device, false)` at `0x247944f`, stored at `[0x75df0a8]` (the bool means rehydrate-only). The batched build desc has stride 0x50; happy to share the full layout. ## 5. The RT gate, and why "just turn RT off" won't light your rooms - **No hidden "RT off" setting or baked probes exist in the exe.** The 4-tier quality table (`0x6b4d760`, indexed by `[settings+0x58]` via `0x5451e10`) only scales probe grid dim (`16 -> 32`), cascades (`3 -> 5`) and SR flags; the hardcoded feature bitmask `[0x76b8fe0] = 0xDE4F` only controls RT directional shadows (`0x0004`) and async-compute queue selection (`0x0040` -> `[0x840d8b2]`). All probe buffers (`0x0cd3b40`) are pure VRAM compute UAVs — none of the 38 `*Store` asset stores hold baked probes or precomputed GI. - `0x4fd8550` (HasValidTLAS) is the single check behind **all 46** ray-traced call sites. Make it return 0 and every consumer takes its built-in non-RT path. I wired it up locally as `VICTORY_NO_RT=1` (byte-checked, so it refuses to patch the wrong build). - You can skip the per-frame structure builds too: the trampoline `0x93cd10` turns its argument into a run flag (`test edx,edx; setne dl`) for `0x16ef290` (enqueued unconditionally with `r9d = 1` at `0x0137692` inside `0x0137470`), whose `cl == 0` branch (`0x16f1bd4`) skips `0x3260db0` (the builds). **Force the flag to 0 rather than stubbing `0x16ef290` directly** — that `cl == 0` branch is the engine's own maintenance path (used by `0x03c9510`) and still flips the double-buffer index `[0x840d8a0]` and clears the `[0x840d870]` visibility arrays, while making ~300 dropped builder dispatches a frame vanish. - **Plot twist: the fallback shaders write zero light.** `CS_Primary_Gather_Fallback` (`81560230fcde2b0a`) writes `(0, 0, 0, 0)` radiance + `10000.0f` max distance (`0x461c4000`), `CS_ScreenProbes_TraceRays_Fallback` (`a953d5b93efe8424`) stores constant ray-miss sentinels (`0xf8003c00` / `0xfffe03ff` / `0x0ffff800`), and the secondary irradiance cache (`0x357b990`) has no fallback at all (only alpha probes' `CS_GatherAndShadeAlpha_Fallback`, `29dc558346584906`, actually samples sky/env cubemaps). They're null-guards for the frames before a BVH exists, not a hidden non-RT lighting mode, so rooms lit only by bounce light stay dark with or without RT on PC right now. Sorry. - **Quick hack target if anyone wants playable dark interiors without RT:** under `VICTORY_NO_RT=1`, only two final-gather permutations actually bind to write the indirect-diffuse UAV read by `tiled_lighting`: `CS_FinalGather_0_1_1_0` (`2dc364df5d3278b8`) and `CS_FinalGather_0_1_1_1` (`738350c1a01b713a`). Clamping a small ambient floor there (or in `CS_Primary_Gather_Fallback`) would lift pure-bounce rooms out of `#000000` at zero GPU cost. - **And there's an unused door:** the shader pack ships a complete voxel/SDF GI path (`voxelization`, and `*_Voxels` passes in `indirect_diffuse_lighting`, `indirect_light_probes` and `sr_tracing`). The retail exe never dispatches it (zero `GS_VoxelizeGeneric` geometry shaders bind at runtime); only `EntityCoarseVoxelization` (loaded `0x0cbd670`, dispatched `0x32af080`) runs. Whoever cracks feeding those passes might get lit interiors without full RT. ## 6. What I'm digging into next (shout if you want something else) 1. The title-code crashes in Jason's first missions (fork #863, #811): `+0x4f28e0f` (read 0x18 on a worker thread, binoculars), `+0x4f46cc2` and `+0x4f0ed7d` (both read 0xFFFFFFFFFFFFFFFF). What those functions do, and what's null or -1 when they blow up. 2. Every spot where the game's CPU reads results the GPU wrote (readback buffers, query results, exposure, water-height lookups, particle counts). With that list, copy-back could skip literally everything else. 3. Whether `EntityCoarseVoxelization`'s volume can feed the `*_Voxels` GI passes. Questions, corrections, "you're wrong about X": all welcome. Let's get this thing lit.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:10:14 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 18:48 UTC · original

Automated triage for the maintainers.

Material reverse-engineered from the title's executable and the console SDK (addresses, internal function and data layouts, SDK function names, shader names and constants) must not be posted here; this is flagged for the maintainer.

On the run report itself (GTX 1660 SUPER, Windows 11): it was made on a combination of third-party fork trees and options that main does not have, so it says nothing about main. A run report this project can use needs a run of unmodified current main with:

  • GPU and driver version
  • the VIctory commit
  • how far the title got
  • any crashes.log lines or error text

Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 18:48 UTC · [original](https://github.com/Marvisak/VIctory/issues/2609#issuecomment-7171418710) <!-- victory-issue-triage v1 verdict=needs-info seen=2026-11-25T16:45:59Z at=2026-11-25T19:25:00Z --> Automated triage for the maintainers. Material reverse-engineered from the title's executable and the console SDK (addresses, internal function and data layouts, SDK function names, shader names and constants) must not be posted here; this is flagged for the maintainer. On the run report itself (GTX 1660 SUPER, Windows 11): it was made on a combination of third-party fork trees and options that main does not have, so it says nothing about main. A run report this project can use needs a run of unmodified current main with: - GPU and driver version - the VIctory commit - how far the title got - any `crashes.log` lines or error text --- _Generated by [Claude Code](https://claude.ai/code)_
This discussion has been locked. Commenting is limited to contributors.
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/Marvisak--VIctory#2609
No description provided.