Skip to content
RedLightDOWNPublic

About

No description, website, or topics provided.

Resources

Stars

7 stars

Watchers

0 watching

Forks

Latest commit

 

History

14 Commits

Folders and files

Repository files navigation

VIvidia

VIvidia is an experimental, research-oriented Xbox Series (Scarlett) compatibility runtime, HLE layer, and GFX10/RDNA2-to-DXIL shader translator targeting native Windows x86-64 execution on NVIDIA GeForce RTX GPUs (Direct3D 12, Shader Model 6.6+, Wave32). It currently focuses on running GTA VI (game_scarlett_master.exe, Xbox Series build v1.0.2.1) using user-supplied title files.

Legal & Asset Safety Notice This repository contains zero proprietary game files, binaries, shaders, textures, archives, keys, or screenshots. Users must supply their own legally obtained dump of the title outside the repository directory. See Asset Policy.
VIvidia is an independent technical project and is not affiliated with, endorsed by, or supported by the title's developer or publisher, Microsoft, AMD, or NVIDIA.


Table of Contents


Project Scope & Architecture

VIvidia executes native console x86-64 title code under Windows while translating console graphics, system APIs, and asset formats on the fly:

  1. PE Mapping & TLS Redirection (victory-pe, victory-loader): Validates and maps the title executable and companion DLLs into the host address space, redirects static TLS slot accesses, and installs a structured crash handler (module+rva unwind reporting).
  2. Console High-Level Emulation (victory-hle): Implements console-only runtime modules (xgameruntime.dll, virtual storage path mapping under VICTORY_DATA_DIR, offline service stubs, audio, and GameInput/DualSense/DualShock 4 USB & Bluetooth support) while enforcing a strict host DLL pass-through policy (HostPolicy).
  3. GFX10/RDNA2 → DXIL Shader Translation (victory-shader): Lifts native GPU shader binaries to an SSA IR, strips hardware EXEC masks via control-flow structurization, traces descriptor/memory lineage back to root signatures, performs Wave64 → Wave32 lowering (widen, with_pair_meetings, split_lds_kernel with SLOT_GROUP_SCRATCH, and SLOT_VIEW_ADDRESSES), and emits Shader Model 6.6 DXIL bitcode validated against dxil.dll. Since commit 17303ca, VICTORY_NAN_GUARD is disabled by default (and keyed in shader_cache.rs) so valid ±Inf values exported by shadow-mask pixel shaders are preserved intact.
  4. D3D12.X Memory & Command Bridge (victory-gpu, victory-formats):
    • Coherency & View Guards (watch.rs, shadow.rs, inplace.rs, safecopy.rs): Tracks unified-memory writes via Windows GetWriteWatch, read-only view guards, and beside copy/store fast paths.
    • Class 2 GPU-Resident Ownership (gpu_owned.rs, VICTORY_GPU_RESIDENT=1): Keeps GPU-written 64 KiB pieces of VRAM-backed (Card) title buffers authoritative in local VRAM without periodic GPU piece-hashing, PCIe readback, or CPU land.rs merges, while arming PAGE_NOACCESS VEH traps on the CPU mirror for on-demand synchronous FastCopy (COPY queue) pull-back and automatic circuit-breaking (MAX_BUFFER_VEH_FAULTS = 8, 4 MiB sub-region batch demotion).
    • Submission & Staging Offloads (host.rs, host/fast.rs, shadow/par_refresh.rs, texture.rs): Asynchronous retired D3D12 object destruction (VICTORY_BURY_ASIDE, victory-bury worker), R8 single-level linear plane deduplication (VICTORY_PLANE_SAME), and longest-first + batched front-pass scheduling (VICTORY_FRONT_FAST=1).
    • Allocators, Textures & BVH (pool.rs, book.rs, residency.rs, indirect.rs): Block-pooled VRAM and staging allocators with OS commit-headroom admission, AMD-only gated SQ descriptor address decoding in book.rs, tiled-to-linear texture detiling / BCPack decoding, and console compute/BVH ray tracing (VICTORY_BVH_BUILDER=1).

All converted caches, pipeline libraries, and runtime save data are written strictly outside the source tree via victory_core::ensure_outside_repo.


Workspace Crates

Component Responsibility
crates/victory-core Configuration (victory.toml), asset-policy path guards, logging initialization
crates/victory-pe Read-only PE32+ and import-library inspection
crates/victory-loader Console image mapping, import binding, TLS redirection, crash diagnostics
crates/victory-hle Console OS/WinRT/XGameRuntime/filesystem/input HLE and HostPolicy
crates/victory-gpu D3D12.X command replay, Class 2 GPU ownership (gpu_owned), write-watch guards, pools, descriptors
crates/victory-shader GFX10/RDNA2 disassembler, SSA IR, structurizer, Wave32 lowering, DXIL emitter
crates/victory-formats Console texture tiling/detiling, BCPack decompression, audio format decoding
crates/victory-pipeline Converter trait and content-addressed conversion cache
crates/victory-game Build identities (v1.0.2.1), title-specific format hooks and patches
apps/victory CLI front end (play, run, shaders, translate, warm, preload, census)
xtask Asset-policy verifier (cargo xtask policy) and git hook installer
tests/fixtures/hle-probe Self-authored synthetic PE fixture for loader verification tests

Milestones & Recently Resolved Issues

Self-Reported Verification Note: All measurements and stability observations below are self-reported from local testing on the hardware profile documented below using native rendering (no DLSS, no Frame Generation).

Milestone / Fix Status Technical Notes
Executable boot & HLE ✅ Verified game_scarlett_master.exe (Xbox Series v1.0.2.1) boots, handles menu/DualSense/DS4/XInput input, and enters open-world gameplay.
Stair-step / blocky shadow artifacts ✅ Fixed (17303ca) Root cause: nan_guard clamped ±Inf in pixel-shader exports inside shadow masks. Disabled VICTORY_NAN_GUARD by default and keyed it into shader_cache.rs.
NVIDIA POOL: diagnostic false positive ✅ Fixed (ca92822) book::texture_address() decoded CPU descriptor heaps using AMD SQ_IMG_RSRC layout; gated by crate::indirect::amd(&host.device) (0 errors in diag and release logs).
Retired D3D12 drop stalls & R8 plane churn ✅ Fixed (ca92822) Offloaded bury() D3D12 drops onto victory-bury (VICTORY_BURY_ASIDE=1 default) and deduplicated unchanged single-level linear R8 uploads (VICTORY_PLANE_SAME=1 default).
Class 2 GPU-resident piece ownership ✅ Verified gpu_owned.rs (VICTORY_GPU_RESIDENT=1) + FastCopy dedicated COPY queue keeps 419 blocks (27.5 MB) VRAM-owned on RTX 4090, skipping 374 compares and 27.0–27.6 MB refreshes per frame with 0 ERROR, 0 WARN.
Target 30 FPS in dense scenes 🔧 Close Light/medium scenes (1,079–1,517 draws) hit 27.9–29.6 FPS; dense street scenes (4,646–6,119 draws) reach 25.9–27.9 FPS cleanly, with 0.0–1.1 ms on GPU and CPU preparing (~30–36 ms) remaining as the sole bottleneck.

Self-Reported Hardware & Performance

Test Environment

  • GPU: NVIDIA GeForce RTX 4090 (24 GB VRAM, native Wave32, SM 6.8)
  • CPU: Intel Core i9-13900K (24 cores / 32 threads)
  • Memory & OS: 64 GB DDR5, Windows 11 (x86_64-pc-windows-msvc)
  • Execution Profile: Series S (1280x720 internal), native rendering (no DLSS / no FrameGen), release build, VICTORY_HOST_WAVE=32, VICTORY_COPY_BESIDE=1, VICTORY_STORE_BESIDE=1

2026-12-01/02 Optimization Progression (Native 720p, Non-RT)

All three checkpoints below were recorded on the same machine, clean shader cache (VICTORY_NAN_GUARD off), and in-world streaming/street traversal (gta6-debug-*.log 0 ERROR, 0 WARN):

Build / Checkpoint Scene Complexity (draws/frame) FPS Frame Time CPU Preparing GPU Time Copy-Back Scene-Load Min FPS
Baseline (17303ca) Heavy (5,665) 20.2 49.5 ms ~39–63 ms 1.7 ms 13.0 ms —
Step 1 (ca92822: BURY_ASIDE + PLANE_SAME + FRONT_FAST) Heavy (4,751) 26.8 37.3 ms 32.8 ms 0.0 ms 10.6 ms 4.4 (225.5 ms)
Step 1 (ca92822) Densest (6,344) 24.3 41.1 ms 36.7 ms 0.0 ms 9.8 ms 4.4 (225.5 ms)
Step 2 (+ GPU_RESIDENT=1, STAGE_MS=8) Light/Stream (1,079–1,517) 27.9–29.6 33.8–35.8 ms 29.7–31.0 ms 0.6–1.1 ms 7.9–8.2 ms 17.8 (56.2 ms)
Step 2 (+ GPU_RESIDENT=1, STAGE_MS=8) Dense Street (4,646–4,779) 25.9–27.9 35.8–38.6 ms 31.7–34.4 ms 0.0–0.1 ms 8.8–9.4 ms 17.8 (56.2 ms)
Step 2 (+ GPU_RESIDENT=1, STAGE_MS=8) Densest (6,098–6,119) 23.9–25.9 38.5–41.8 ms 33.8–36.1 ms 0.3–1.1 ms 9.3–9.9 ms 17.8 (56.2 ms)

Where the remaining CPU preparing (~34.4 ms) goes on the RTX 4090:

  1. refreshes (11.5–12.2 ms): 6.5–6.7 ms synchronous front-pass waits (refreshes in front of the steps) + 2.3 ms per-write flushes (~205 items) + 3.6–4.0 ms copies/fills on bidirectional host-written buffers (66.8–75.1 MB/frame).
  2. copies in the card's memory (5.9–6.3 ms): card_before (3.1–3.3 ms declaring/taking + 1.7 ms sync list).
  3. asking the write watch (3.9–4.1 ms).
  4. Remaining list steps & overhead (~9–10 ms).

Rejected / Reverted Experiments (Do Not Re-Enable)

  • VICTORY_SEND_THREAD=1 (asynchronous submit queue without frozen send snapshots): Lowered sending the lists (1.5 → 0.0 ms), but dynamic skinning/face buffers updated by subsequent submissions caused severe character face corruption because VIvidia only freezes explicit snapshots rather than all dynamic host copies. Removed cleanly before ca92822.
  • VICTORY_ALIAS_TARGETS=1 + VICTORY_GPU_DETILE=1 (732113e): Copy-queue synchronous waits and extra prelude compute dispatches regressed FPS and broke face rendering at frame 9846. Reverted.
  • VICTORY_NAN_GUARD=1 by default: Clamped valid ±Inf values in shadow-mask pixel exports, producing blocky stair-step shadows. Disabled by default (17303ca).
  • VICTORY_COPY_BESIDE / VICTORY_WC_BAR=1 / VICTORY_PORT_CONSTANTS=1 pitfalls: WC_BAR and PORT_CONSTANTS are explicitly avoided due to driver/PCIe stalls and face corruption reported upstream.

Shader & Wave64 → Wave32 Lowering Status

  • Shader Cache Census (victory.exe preload under VICTORY_HOST_WAVE=32, VICTORY_NAN_GUARD off): 25,787 runnable shaders translated and cached in 100 s (198 unsupported containers: 195 unreferenced geometry-only Gs containers and 3 empty containers).
  • Used Pipeline Prewarming (victory.exe warm --used): 3,709 actively drawn pipelines (3,387 + 322) compiled cleanly for NVIDIA GeForce RTX 4090 in 39 s for the incremental pass (0 failures).
  • Dynamic Descriptor View Addresses & Full-LDS Kernels: Dynamic-offset shadow mask variants (SLOT_VIEW_ADDRESSES table t251 + MASK_ELSEWHERE) and 32 KiB LDS vfx_triangleClip compute kernels (SLOT_GROUP_SCRATCH UAV u250) are supported.

Known Issues & Roadmap

Current Known Issues

  1. Heavy-Scene CPU Ceiling (>4,500 draws/frame): GPU time on the RTX 4090 sits at 0.0–1.1 ms, while synchronous refresh_front waiting and bidirectional buffer copies keep dense scenes at 24–28 FPS.
  2. Wave32 Visual Approximations & Material Quirks:
    • Certain vehicles render with solid green fallback textures (VICTORY_HOST_WAVE=32 / untranslated or partial compute/wave paths).
    • Localized black pixel tiles on water transmission lighting (water_tile_append / water_light_writers), blocky hair/character shadows from APPROXIMATE Wave64 local-wave lowering, and missing loose-piece shader pipelines (native/pieces.rs).
  3. Host Commit-Limit Throttling (residency.rs): Speculative texture prefetch throttles automatically if available Windows commit headroom drops below 4 GiB.

Planned Next Steps (From Tested Upstream Forks)

  • Step 3 — Async Front-Pass Join (host/join.rs, VICTORY_REFRESH_JOIN=late): Overlap the 6.5 ms refresh_front work with list step walking to cross the native 30 FPS threshold in dense scenes.
  • Step 4 — Shader & Wave32 Completeness:
    • Folded Wave64 emulation (fold.rs, emit/lds.rs) to make shadow masks & hair shaders exact instead of approximate;
    • foxhound Wave32 water lighting fixes (water_tile_append.rs, water_light_writers.rs);
    • Broadside-RT loose-piece pipeline support (native/pieces.rs) and canon.rs twin shader deduplication;
    • Whiplash sparse_buf.rs (64 KiB Tier-4 virtual sparse buffer pool for LOOSE windows) to reduce host commit usage.

Prerequisites & Building from Source

Requirements

  • OS: Windows 11 (x64), or Windows 10 22H2+ with Direct3D 12 Agility SDK (victory get-d3d12 / D3D12\D3D12Core.dll)
  • GPU: NVIDIA GeForce RTX GPU (or D3D12 SM 6.6 + mesh-shader capable adapter) with current drivers
  • RAM / Storage: 32 GB+ system RAM (64 GB recommended; ensure generous Windows pagefile/commit headroom), NVMe SSD
  • Build Tools:
    • Rust toolchain pinned in rust-toolchain.toml (1.98.1, x86_64-pc-windows-msvc, Rust edition 2024)
    • Visual Studio Build Tools with Desktop development with C++ (MSVC & Windows SDK, including dxil.dll for --validate)

Build Commands

# Verify asset policy compliance before building or committing
cargo xtask policy

# Optional: install git pre-commit asset-policy hook
cargo xtask install-hooks

# Run victory-gpu unit & hardware D3D12 tests
cargo test -p victory-gpu --lib

# Release build (standard runtime — creates target\release\victory.exe)
cargo build --release -p victory

# Diagnostics build (separate target\diag profile with tracing/diagnostics enabled)
cargo build --profile diag -p victory --features diagnostics

Usage & Key Environment Variables

Configure external title/cache paths outside the repository:

# Inspect missing/covered console imports without executing title code
target\release\victory.exe census C:\Path\To\TitleDump --missing

# Pre-translate all shaders into the external cache
$env:VICTORY_HOST_WAVE = "32"
target\release\victory.exe shaders C:\Path\To\TitleDump

# Pre-warm only pipelines previously drawn in-game (fast, ~1 minute)
target\release\victory.exe warm --used

# Or run full shaders + warm + pipeline library preload
target\release\victory.exe preload C:\Path\To\TitleDump

# Direct HLE execution (window title: "VIvidia | <fps> fps ...")
target\release\victory.exe run --execute C:\Path\To\TitleDump\game_scarlett_master.exe --console series-s

Selected Runtime Flags

Variable Default Purpose
VICTORY_GAME_DIR / VICTORY_CACHE_DIR / VICTORY_DATA_DIR From victory.toml External paths for title dump, derived caches, and saves (kept outside the repo)
VICTORY_HOST_WAVE Auto Target wave width override (32 for NVIDIA GeForce RTX Wave32)
VICTORY_GPU_RESIDENT 0 Enables Class 2 64 KiB GPU-resident buffer piece ownership (1) with PAGE_NOACCESS VEH fault handling and FastCopy readback
VICTORY_FRONT_FAST 0 Enables longest-first + batched claiming (1) in Batch::refresh_front
VICTORY_BURY_ASIDE 1 Offloads retired D3D12 object destruction to background victory-bury worker (0 disables)
VICTORY_PLANE_SAME 1 Deduplicates unchanged single-level linear R8 plane uploads across frames (0 disables)
VICTORY_NAN_GUARD 0 Clamps Inf/NaN in translated shader exports (1 enables; off by default to preserve shadow masks)
VICTORY_COPY_BESIDE / VICTORY_STORE_BESIDE 0 Side-channel copy/store fast paths beside write-watch guards (1 enables)
VICTORY_TEXTURE_POOL / VICTORY_POOL_SMALL 1 / 1 Controls 64 MiB heap/staging block pooling
VICTORY_TEXTURE_STAGE_MS / VICTORY_TEXTURE_CATCHUP 250 / 1 Per-pass texture upload millisecond cap (8 smooths scene-load drops) and 3× catch-up (0 disables)
VICTORY_SHOW_NEW_LATER / VICTORY_TEXTURE_NO_WAIT 0 / 0 Delays showing newly pooled textures / avoids blocking texture refreshes during title remaps
VICTORY_CARD_BUFFERS_MIN_KB 1024–16384 Minimum title buffer size (KiB) promoted to Card local VRAM (64 covers sub-1 MiB buffers)
VICTORY_BVH_BUILDER 0 Enables title compute/BVH ray tracing (1)
VICTORY_PIPELINE_BOOK 0 Records created pipelines for victory warm driver-cache prewarming
VICTORY_JOIN_PARTS / VICTORY_TURBO_THREADS Auto Joins submission parts (16–128) and configures Neptune worker thread count (8 on 13900K)

Repository Safety & Policy Enforcement

  1. Pre-commit & CI Policy Check: cargo xtask policy (xtask/src/policy.rs) enforces an allowlist of source/documentation extensions, rejects files ≥ 640 KiB, blocks binary signatures, and flags long hex/base64 sequences.
  2. Permitted Sole Binary Exception: crates/victory-formats/src/bcpack-tables.bin (~78 KB) holds standard BCPack entropy/dictionary tables required for format decoding and is explicitly registered in xtask/src/policy.rs (not covered by the repository source license; see docs/asset-policy.md).
  3. Runtime Path Isolation: Runtime outputs are checked with victory_core::ensure_outside_repo so derived artifacts never enter the git working tree.

License & Upstream Acknowledgements

  • License: Workspace crates are licensed under GPL-3.0-or-later (see Cargo.toml; excluding the documented bcpack-tables.bin format-constant table).
  • Upstream Acknowledgements: VIvidia builds directly upon and gratefully credits the open-source research and engineering of the VIctory community:
    • trustno1-coder/VIctory-NVIDIA — primary upstream base for NVIDIA Wave32 lowering, beside copy/store optimizations, DualSense/DS4 input HLE, Streamline integration, and memory-packing work.
    • Whiplash — Class 2 64 KiB GPU-resident piece ownership (gpu_owned.rs), FastCopy dedicated COPY readback queue, and longest-first/batched front-pass refresh (host/fast.rs).
    • foxhound — background retired D3D12 object destruction (victory-bury) and single-level R8 plane deduplication (VICTORY_PLANE_SAME).
    • Broadside-RT, fxceless/victory-fork, Marvisak/VIctory, DexNom/VIctory, Belobug/VIctory-Belobug-AMD, and FQY55kai/ZJOU-VICTORY — foundational shader translator, GPU memory/write-watch tracking, BVH ray-tracing work, pool diagnostics, and HLE contributions documented in docs/findings.md and docs/bug-journal.md.

About

No description, website, or topics provided.

Resources

Stars

7 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages