Watch
1
0
Fork
You've already forked codec-d--cool_fox-OPTIMIZED
0
Read-only copy of github.com/codec-d/cool_fox
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-26 12:33:10 +00:00
.cargo Initial commit 2026-11-23 01:15:26 +01:00
.githooks Initial commit 2026-11-23 01:15:26 +01:00
.github/workflows CI: clippy and tests on pull requests and main 2026-11-24 09:55:29 +01:00
apps/victory Optimize 4GB VRAM / 16GB RAM runtime, fix shaders, add real-time live stream 2026-11-26 15:39:52 +03:30
crates Optimize 4GB VRAM / 16GB RAM runtime, fix shaders, add real-time live stream 2026-11-26 15:39:52 +03:30
docs Publish the pareto-residency Windows build and portable launcher 2026-11-25 22:33:14 -08:00
scripts README, findings and a start script of this fork; fxceless' README kept in docs; the translator's file may be 640 KiB 2026-11-25 16:13:05 -06:00
tests/fixtures/hle-probe Run Grand Theft Auto VI from first boot into the world 2026-11-23 23:10:01 +01:00
xtask README, findings and a start script of this fork; fxceless' README kept in docs; the translator's file may be 640 KiB 2026-11-25 16:13:05 -06:00
.gitattributes Initial commit 2026-11-23 01:15:26 +01:00
.gitignore Run Grand Theft Auto VI from first boot into the world 2026-11-23 23:10:01 +01:00
.victory-root Initial commit 2026-11-23 01:15:26 +01:00
Cargo.lock Take the test/fx-prs branch of asdaasdsaddf's fork (as one commit) 2026-11-24 19:00:31 -05:00
Cargo.toml Take the test/fx-prs branch of asdaasdsaddf's fork (as one commit) 2026-11-24 19:00:31 -05:00
LICENSE Initial commit 2026-11-23 01:15:26 +01:00
Play-VIctory.cmd Publish the pareto-residency Windows build and portable launcher 2026-11-25 22:33:14 -08:00
README.md Update README with quick-start run guide and 4-6 GB VRAM / 16 GB RAM optimization details 2026-11-26 12:33:10 +00:00
rust-toolchain.toml Initial commit 2026-11-23 01:15:26 +01:00
rustfmt.toml Initial commit 2026-11-23 01:15:26 +01:00
victory.example.toml The game is no longer named in the tree 2026-11-24 15:45:05 -05:00

VIctory — Optimized for 4–6 GB VRAM & 16 GB RAM (cool_fox Fork)

How to Run It

Requirements

  • OS: Windows 10 / 11 x64
  • CPU: x86-64 with AVX2 (8 cores / 16 threads recommended)
  • GPU: Direct3D 12 GPU with Shader Model 6.6 and Mesh Shaders (works down to 4 GB VRAM / 16 GB system RAM with the low-VRAM profile below)
  • Build tools (if building from source): Rust (pinned via rust-toolchain.toml) + Visual Studio C++ Build Tools & Windows SDK
  • Game files: Your own complete, intact Xbox Series dump (this repository contains zero game files, code, or assets)

1. Clone & Build

git clone https://git.gtahub.st/Mskh/codec-d--cool_fox-OPTIMIZED.git
cd codec-d--cool_fox-OPTIMIZED
cargo build --release --locked -p victory

(Optional, recommended before first launch) Pre-translate all shaders once into %LOCALAPPDATA%\VIctory\cache-pareto so runtime shader misses are 0:

$env:VICTORY_CACHE_DIR = "$env:LOCALAPPDATA\VIctory\cache-pareto"
.\target\release\victory.exe shaders "D:\Games\YourDump"

Hybrid Laptop GPU Note: On laptops with both integrated graphics and a discrete GPU (e.g. AMD Radeon iGPU + NVIDIA RTX 3050), bind target\release\victory.exe to High Performance in Windows Settings -> System -> Display -> Graphics (or set GpuPreference=2; under HKCU:\Software\Microsoft\DirectX\UserGpuPreferences). Also verify none of your dump's .rpf archives are truncated or zero-filled (a zero-filled archive triggers 0x80000003 at startup).

2A. Run on 4–6 GB VRAM / 16 GB RAM Systems (Low-VRAM / Max-FPS Profile)

Save the following as Run-LowVRAM.cmd inside the repository folder (next to Play-VIctory.cmd), edit VICTORY_GAME_DIR to point to your dump folder, and run it:

@echo off
setlocal
set "VICTORY_GAME_DIR=D:\Games\YourDump"
set "VICTORY_CACHE_DIR=%LOCALAPPDATA%\VIctory\cache-pareto"
set "VICTORY_DISPLAY_MODE=1024x576"
set "VICTORY_WINDOW_MAX=1920x1080"
set "VICTORY_PORT_DESCRIPTORS=1"
set "VICTORY_HEAP_SYNC_EARLY=0"
set "VICTORY_HEAP_ROUND=64"
set "VICTORY_HEAP_RECHECK=0"
set "VICTORY_RELAY=2"
set "VICTORY_RELAY_COPY=1"
set "VICTORY_WIDE_BACK=1"
set "VICTORY_CARD_STEPS=2"
set "VICTORY_WAIT_RESIDENT=0"
set "VICTORY_RIPE_BLOCKS=2"
set "VICTORY_INDIRECT_BATCH=2"
set "VICTORY_INDIRECT_WINDOW=1"
set "VICTORY_CARD_REHASH_RUNS=1"
set "VICTORY_JOIN_COPIES=1"
set "VICTORY_JOIN_PARTS=8"
set "VICTORY_UPLOAD_AHEAD=1"
set "VICTORY_SHOW_AFTER=1"
set "VICTORY_CARD_AWAKE=1"
set "VICTORY_THIN=1"
set "VICTORY_THIN_THREADS=6"
set "VICTORY_LAND_THREADS=4"
set "VICTORY_PIPELINE_WORKERS=4"
set "VICTORY_MAP_THREADS=1"
set "VICTORY_TEXTURE_NO_WAIT=1"
set "VICTORY_LEVELS_ON_DEMAND=0"
set "VICTORY_MAX_TEXTURE_DIM=512"
set "VICTORY_TEXTURE_BUDGET_MB=650"
set "VICTORY_TEXTURE_STAGE_MB=32"
set "VICTORY_TEXTURE_STAGE_MS=12"
set "VICTORY_TEXTURE_CATCHUP=0"
set "VICTORY_CARD_BUFFERS_MIN_KB=256"
set "VICTORY_CARD_BUFFERS_MB=850"
set "VICTORY_MEMORY_CARD_MB=64"
set "VICTORY_DSTORAGE_STAGING_MB=64"
set "VICTORY_AMBIENT=0.6"
set "VICTORY_AMBIENT_FLOOR=0.015"
set "VICTORY_AMBIENT_AIR=1.5"
set "VICTORY_LOG=warn"
call "%~dp0Play-VIctory.cmd" pareto-residency
exit /b %errorlevel%

(Keep VICTORY_DISPLAY_MODE at a 64-pixel-aligned 16:9 size such as 1024x576 or 1280x720 with FSR disabled in settings.xml so mip chains stay 4x4 BC-block aligned.)

2B. Run on 8–24+ GB VRAM / 32–64 GB RAM Systems

All low-VRAM / tight-RAM caps automatically stay out of the way on > 6 GiB VRAM and > 18 GiB RAM hosts:

$env:VICTORY_GAME_DIR = 'D:\Games\YourDump'
.\Play-VIctory.cmd pareto-residency

What We Did in This Fork

Upstream cool_fox targeted 24–32 GB VRAM GPUs and 32–64 GB system RAM (40–46 GB private commit). On a 4 GB VRAM / 16 GB RAM laptop, upstream either ran out of commit (0x8007000E), faulted the D3D12 device (0x887A0001 / 0x887A0006), stalled for 620–1070 ms/frame in CPU/residency housekeeping, or ran at 0.7 FPS in the 3D world.

Across 30 Rust source files in victory-shader, victory-gpu, victory-hle, and victory-loader, we made the following changes:

1. 16 GB Host RAM Protection & Upload Chunk Pooling (crates/victory-gpu)

  • HostList::upload bucketed chunk pool (host.rs): Added SHARED_SPARE power-of-two upload pooling (4 KiB .. 8 MiB buckets, 48 MiB cap, integrated with Deferred::shared_uploads and trim_spare_chunks()) for both card_steps > 1 and <= 1. Eliminated tens of thousands of unpooled per-frame committed upload allocations and 80s+ synchronous MakeResident / mapped() stalls.
  • Tight-RAM spare & staging caps (residency.rs, host/send.rs, pool.rs): Added tight_host_ram() (<= 18 GiB RAM hysteresis), capped send.rs spare upload memory from 768 MiB down to 128 MiB (64 MiB under pressure, 0 under critical commit), and capped idle STAGING blocks in pool.rs to 2 (128 MiB).
  • Async card steps unlocked (VICTORY_RELAY=2 + VICTORY_CARD_STEPS=2): With upload and relay memory bounded on 16 GB RAM, exact relay (VICTORY_RELAY=2) safely enables GPU-side upload fills (~4,500–5,000 fills/frame on the card), dropping CPU->GPU settle waits from 76.8 ms/frame to 0.0 ms median.

2. 4–6 GB VRAM Residency, Texture Clamping, & Copy Bounds Safety (crates/victory-gpu)

  • 4–6 GB VRAM budgets (resource.rs, pool.rs, shadow.rs, descriptor/host.rs):
    • Lowered targets_room_kept() to 512 MiB on <= 6 GiB local VRAM budgets.
    • Added VICTORY_MAX_TEXTURE_DIM (min_mip_for_max_dim, restricted to placed textures) so streamed world textures fit comfortably inside 600–650 MiB on 4 GB cards instead of oversubscribing WDDM local VRAM (3,367 MB budget).
    • Scaled pool.rs spares() and ahead() (VICTORY_RIPE_BLOCKS default) to 2 (128 MiB) on <= 6 GiB VRAM.
    • Raised shadow.rs give_back cap_bytes to 256 MiB (snapshots_kept = 256), cutting ranges done with stalls from 620 ms/frame down to 0.5 ms/frame, and scaled default_card_limits_mb to (16, 320) for <= 4608 MiB VRAM budgets.
    • Set CAPPED_TITLE_SLOTS = 393_215, fixed from_base mip-level counting, and guarded keep_shown with room_lately() in descriptor/host.rs.
  • D3D12 copy bounds guards (list.rs): Validated subresource counts and mip dimensions prior to CopyResource and CopyTextureRegion, preventing 0x887A0001 (DXGI_ERROR_INVALID_CALL) crashes on sub-720p mip chains.

3. Fast Descriptor Sync & Bindless Heap Sweep (victory-loader, victory-hle, victory-gpu)

  • Patched descriptor-store hooks (descriptor_sites.rs, port_descriptors.rs, port.rs, xmem.rs): Hooked title descriptor-heap store sites (VICTORY_PORT_DESCRIPTORS=1) with page-level fallback, reducing per-frame descriptor heap synchronization from ~90 ms to 0.5–1.5 ms.
  • Configurable bindless buffer sweep round (draw.rs): Added VICTORY_HEAP_ROUND (64 vs 16 default) alongside VICTORY_HEAP_RECHECK=0, cutting background unchanged buffer-slot re-mirroring to ~2.8 ms/frame while still mirroring all changed slots immediately every frame.

4. RDNA2 Shader Translator & Indoor Lighting Fixes (crates/victory-shader, ambient.rs)

  • same_mode_per_row interpolation packing (emit/container.rs, emit/shader.rs): Prevents DXIL validation failures when guest shaders pack mixed interpolation modes into one signature row.
  • image_get_lod array-slice clamping (emit/lower.rs, emit/mod.rs): Fixes out-of-bounds coordinate counts on arrayed get_lod intrinsics.
  • RDNA2 VOP1 & VOP3 v_cmpx* EXEC fixes (gfx10/fields.rs, gfx10/mod.rs): Fixes operandless VOP1 word lengths and VOP3 v_cmpx EXEC mask writes so previously dropped shaders translate and validate cleanly (25,663 cached shaders, 0 runtime misses).
  • Ambient floor & probe filter (ambient.rs): Added VICTORY_AMBIENT_FLOOR and filtered uninitialized magenta sky/probe values so indoor rooms without -RayTracing stay visible without milky haze.

5. Release Capture & Zero-Stall 1:1 Live Stream (capture.rs, host.rs, queue.rs)

  • Enabled opt-in VICTORY_CAPTURE / VICTORY_CAPTURE_WORLD in --release builds on a background victory-png thread, plus VICTORY_LIVE_DIR (async pooled D3D12 readback writing a 16-slot half-res BMP ring + frame_meta.js on a detached victory-live thread for 1:1 real-time browser monitoring with zero overhead when unset).

Measured Performance on 4 GB VRAM / 16 GB RAM Hardware

Tested on Windows 11 x64, AMD Ryzen 7 6800H (8C/16T), 16 GB DDR5 RAM, NVIDIA GeForce RTX 3050 Laptop GPU (4 GB VRAM / 3,367 MB D3D12 local budget) at 1024x576 (Series S profile):

Metric Initial Baseline on 4 GB / 16 GB Current rtx3050-opt Build
Startup / world stability Crashed (E_OUTOFMEMORY / device removal) 0 crashes across full world runs
Menus & loading screens 30 FPS 30 FPS
3D world (4,500–5,733 draws/frame) 0.7 median / 1.2 max FPS (~1,400 ms/frame) 4.1 median / 6.9–7.0 peak FPS (~145–243 ms/frame)
GPU settle wait on submit thread 76.8–152 ms/frame 0.0 ms median (card_steps=2 + relay=2)
Descriptor sync + heap buffer pass ~90 ms + 417 ms ~1.0 ms + 2.8 ms

Known Issues (Work in Progress)

  • Under aggressive low-VRAM texture clamping (VICTORY_MAX_TEXTURE_DIM=512) and minimum shadow settings, close-up character faces/skin and certain shadow edges can render pitch-black or blocky in indoor lighting — actively being fixed next.
  • Sustaining 10+ FPS on 4 GB VRAM / 16 GB RAM remains bounded by CPU-side command-list preparation (~104–152 ms/frame) and shader writeback merging (~49 ms/frame) across 4,500+ draws/frame.

Asset Policy & Credits

Nothing from the game is ever stored in this repository (see docs/asset-policy.md and cargo xtask policy). Everything derived is generated locally on the user's machine outside the repository.

Built on top of codec-d/cool_fox, VIctory (Marvisak and contributors), fxceless/victory-fork, DexNom/VIctory, Belobug/VIctory-Belobug-AMD, FQY55kai/ZJOU-VICTORY, myokex/victory-amd, Geckomacabre, and cxy0072019-sketch.

License

GPL-3.0-or-later, as VIctory. See LICENSE and docs/asset-policy.md.