[TRACKING & ARCHITECTURE] Master Breakthrough Audit: 30-60+ FPS Pipeline, 6-8 GB Low-End RAM/VRAM Compression, NVIDIA Zero-Crash Stability & Native PC Control #3715

Open
opened 2026-12-02 18:48:52 +00:00 by hyperland956-lgtm · 0 comments
hyperland956-lgtm commented 2026-12-02 18:48:52 +00:00 (Migrated from github.com)
Contributor

Imported from ivall/xcl. Originally posted by hyperland956-lgtm on 2026-12-02T18:48:52Z.


Master Breakthrough Audit: 30–60+ FPS Pipeline, 6–8 GB Low-End RAM/VRAM Compression, NVIDIA Zero-Crash Stability & Native PC Controls

Baseline: xcl-dev/xcl main (817eb1fc, 2026-12-02) | Target: Windows x64 — NVIDIA RTX 20/30/40/50 + low-end 6–8 GB VRAM / 16 GB RAM laptops & desktops (alongside AMD)
Live Anchor Trackers: #2688 (RAM/VRAM & 30 FPS Swarm), #2088 (Cold PSO Swarm), #2403 (NVIDIA 512 MB Shader-Code Heap), #1773 (VRAM Mirroring), #582 (GetWriteWatch Tax), #1452 / #505 (Watchdog & Device Removal), #2639 (Memory Backpressure), #3222 (D3D12.X Index), #1833 (World-Load Roadmap), #1607 (PR Triage)

Executive Diagnosis — Why XCL Is Stuck at 1–4 FPS & 27–50 GB Memory

XCL has cleared the hardest correctness milestone: large retail workloads reach the world with accurate colors and lighting. Yet main still runs at 1–4 FPS while consuming 16–27 GB local VRAM and 36–50 GB committed RAM (#2688, #1773, #646), and NVIDIA GPUs continue hitting silent 0x887a0005 removals (#2403, #1452), multi-minute nvgpucomp64 stalls (#156, #2088), or silent present freezes.

Line-level auditing of xcl/crates/xcl/src/ (Cargo.toml, vram.rs, sparse.rs, pso_async.rs, present.rs, title_textures.rs, list_x.rs, bind.rs, real.rs, submit_cost.rs, ram_budget.rs, dstorage.rs, gameinput.rs, kbm.rs, playstation.rs) and full deduplication against all 3,775+ XCL issues, PRs, and code-review comments isolate six structural walls that surface micro-patches cannot solve:

  1. CPU Submission, Per-Draw Churn & Lock Contention: xcl/Cargo.toml release builds still omit Thin LTO and codegen-units = 1 (leaving 1.5–2× submission-path speed on the table); the recording thread still suffers per-draw heap allocations, redundant constant/descriptor copies, unbatched mesh/indirect draws, write-combined (WC) console-heap scans, and PAGES.lock() contention (including newly merged #3553 holding PAGES during QueryInterface/allocations).
  2. GetWriteWatch 1.5 GiB Pre-Submit Tax & Full-Texture Detiling: GetWriteWatch burns 26–35 s per 200 s (#582) scaling with watched address space; write-watched textures detile whole textures instead of only written mip levels; read-only root UAVs trigger multi-GB unnecessary guest-memory comparisons per frame; and STREAM_RECHECK leaks retired entries (#2578).
  3. Unconditional VRAM Mirroring, 64 MiB Pool Fragmentation & Non-Evicting Budget Stub: Sparse tiles default to D3D12_HEAP_TYPE_DEFAULT (sparse.rs:3536, 3714), placed textures are duplicated (#1773), 64 MiB pool heaps trap 1.5–2.0 GB in wholly free 4 MiB chunks (#1773), vram.rs:135–150 confirms XCL_TEXTURE_BUDGET_EVICT=1 tracks SRV metadata only without evicting anything, and #3587's fixed 2,048 MiB margin permanently traps 6–8 GB GPUs in Over-Pressure!
  4. NVIDIA 512 MB Shader-Code Heap Wall & Unresolved Driver Edge Cases (#2403): pso_async.rs:495 hardcodes is_evictable() to PipelineKind::Compute only (Graphics PSOs are never evicted, and the eviction stage is still #[allow(dead_code)]). Even raising the driver heap to 2,048 MB did not prevent silent present freezes on RTX 5070 Ti driver 610.88 after 1,800 frames (#2403), proving Graphics+Compute LRU PSO eviction + persistent pipeline libraries (#3633) are mandatory.
  5. Zero Hardware Upscaling / Frame Generation / Reflex Bridge: XCL has 0 open PRs for intercepting native ffxCreateContext/ffxDispatch upscaler calls (which already provide jittered color, depth, and motion vectors) into NVIDIA Streamline DLSS Super Resolution + DLSS-G Frame Gen + Reflex or AMD FSR 3.1 FG, and present.rs:1661 still calls sc.Present(0, DXGI_PRESENT(0)) without ALLOW_TEARING (#2756).
  6. Windows PC Controls & UX Gaps: kbm.rs whips the camera after >100 ms poll gaps (#963), ignores absolute mice (#962), and has no mouse-wheel bindings; playstation.rs:111 hardcodes a 128-byte ReadFile buffer that fails immediately on 547-byte DualShock 4 Bluetooth reports (#2465); gameinput.rs hits 0x80000003 on device callbacks (#3583); and present.rs uses jagged DWM bilinear scaling (#554) with no live F1/F3 tuning HUD.

Proven Dead-Ends & Measured Traps (Do Not Repeat!)

  • DO NOT multithread GetWriteWatch resets (#582): Measured on Ryzen 7 9800X3D — sibling threads contend on the kernel page-table lock, making each reset 2.5–3× slower. Win by eliminating/narrowing watched ranges (XCL_SPARSE_DIRECT, refused-range caching, VEH read-only physical blocks, written-mip-only detiling).
  • DO NOT optimize cached_watch_ranges rebuilds (#582): Costs 0.2 µs; 99.7% of wall time is inside GetWriteWatch.
  • DO NOT enforce blunt process memory caps that refuse title commits (#1566, #2639): A 13,824 MB cap refused required startup texture pages and killed the title at 11.7 s. Reduce XCL-owned mirrors/pools/staging and report truthful XMem headroom instead.
  • DO NOT chase minor pixel-shader instruction-count cuts for FPS right now (#3535): Shrinking 301 of 1,714 pixel shaders on an RTX 4090 left world FPS frozen at ~0.2 FPS. The bottleneck is CPU submission, write-watch/memory traffic, VRAM thrashing, and missing upscaling/FG.
  • DO NOT blindly shard cold guard tables without profiling: 64-sharding opened-guard sets produced 0 FPS gain in benchmarked runs.
  • DO NOT duplicate already-merged work: CLZERO loop AOT patching (#2892), XCL_UMA_DRIVER=mixed (#3005–#3007), NVIDIA driver-heap UMA windows (#2844), XCL_RESIDENCY_PRIORITY (#3156), DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE (gpu/adapter.rs:129), and cursor release while dragging (#176) are already on main.

Master Workstream Matrix & Agent Claim Board (28 Deduplicated Workstreams)

How to claim: Comment Claiming <ID> — <branch/PR> — <GPU / RAM> (e.g., Claiming PERF-02 — pr/zero-alloc-submit — RTX 4050 6GB / 16GB RAM). Include before/after telemetry from submit_cost.rs, XCL_GPU_PROFILE=1, and DXGI QueryVideoMemoryInfo.

ID Track Prio Target Breakthrough Primary XCL Files Related Live Issues / PRs
PERF-01 A — FPS P0 Thin LTO + codegen-units = 1 default release profile (1.5–2× submit win) Cargo.toml Open PR #3604
PERF-02 A — FPS P0 Zero-alloc per-draw recording, CBV_ONCE, lockless desc heap & InitHeaders replay hle/d3d12x/{list_x.rs,bind.rs,real.rs} #2688, #3222
PERF-03 A — FPS P0 Per-draw parameter SRV mesh batching (~70× CPU / ~2× GPU) & indirect barrier batching (~48×) hle/d3d12x/{list_x.rs,barrier_groups.rs,indirect_guard.rs} #2688 (net-new)
PERF-04 A — FPS P0 Host-RAM V# bitset (65× faster, 0 WC reads) & read-only root UAV skip (12.8→2.7 GB/frame) hle/d3d12x/{console_heap.rs,bind.rs,real.rs} #2688 (net-new)
PERF-05 A — FPS P0 Escape 1.5 GiB GetWriteWatch tax (refused cache, VEH RO blocks, interval-skip, AVX2 merge) hle/d3d12x/{watch.rs,sparse.rs,title_textures.rs} #582, open #3649, #3677
PERF-06 A — FPS P0 Async GPU submission relay, non-blocking mip uploads, EnqueueMakeResident & Wait64 elision hle/d3d12x/{queue_submit.rs,real.rs,fence_x.rs} #2688, #505, open #2523
PERF-07 A — FPS P0 Coalesce dirty copy ranges, written-mip-only detile (7–12×) & threaded UpdateTileMappings hle/d3d12x/{sparse.rs,texture_upload.rs} #2688, open #3651, #3701
PERF-08 A — FPS P0 Intercept native ffxCreateContext/ffxDispatch → DLSS SR + DLSS-G / FSR 3.1 FG + Reflex hle/d3d12x/present.rs, new gpu/upscale.rs Net-new (0 open PRs)
PERF-09 A — FPS P1 Land ALLOW_TEARING (#2756) + 3-buffer waitable flip-discard + QPC frame pacing hle/d3d12x/{present.rs,frame.rs} Open PR #2756, #554
PERF-10 A — FPS P1 Zero-cost XCL_RAYTRACING=off BVH bypass, Intel P-core/CCD0 affinity, DirectStorage & XMA speed gpu/bvh.rs, hle/{kernelx.rs,dstorage.rs,xma2/mod.rs} #2688 (net-new)
MEM-01 B — RAM/VRAM P0 Eliminate VRAM double-mirroring: default lazy tiles, L0/L1 tiering & idle CPU tile drop hle/d3d12x/{sparse.rs,title_textures.rs,uma_driver.rs} #1773, #2825, #646, open #3695
MEM-02 B — RAM/VRAM P0 Make XCL_TEXTURE_BUDGET_EVICT (vram.rs:135) perform monotonic, fence-safe LRU eviction hle/d3d12x/{vram.rs,bind.rs,late_release.rs} #1773, #2688
MEM-03 B — RAM/VRAM P0 Fix #3587 6–8 GB Over-Pressure trap, dynamic RT reserve & 85% empty-block pool cap hle/d3d12x/{vram.rs,memory_report.rs,alloc_pool.rs} Open #3587, #1773
MEM-04 B — RAM/VRAM P0 4 MiB sparse pool chunks (reclaim 1.5–2 GB), 64 MB section split & fix #3553 PAGES lock hle/d3d12x/{sparse.rs,vram.rs,sharded.rs} #1773, #3553, #3593, #3011
MEM-05 B — RAM/VRAM P0 Host-memory admission control, indirect scratch pooling, trim protection & truthful XMem stats ram_budget.rs, hle/d3d12x/alloc_pool.rs, hle/kernelx.rs #2639, #646, #2688
MEM-06 B — RAM/VRAM P1 File-backed cold shadow memory, DirectStorage semaphore & fix #2578/#1049 leaks hle/d3d12x/{title_textures.rs,uma_driver.rs}, hle/dstorage.rs #2578, #1049, #2639
NV-01 C — NVIDIA/Crash P0 Break 512 MB NVIDIA shader-code wall: Graphics+Compute PSO LRU (pso_async.rs:495) + 610.88 guard hle/d3d12x/pso_async.rs, shaders/pipeline_library.rs #2403, #1452, open #3633
NV-02 C — NVIDIA/Crash P0 Kill nvgpucomp64 stalls, prune unused compute PSOs (#3442) & persist libraries (#3633) hle/d3d12x/pso_async.rs, gpu/recomp/{dxc.rs,pso.rs} #156, #2088, #2595, #3633
NV-03 C — NVIDIA/Crash P0 Fix live Dec 2 review regressions: #3561 (IO_LOOP_BUDGET), #3591 (HLSL execz), #3549 gpu/dxil/{kernel.rs,lower.rs}, hle/d3d12x/sparse.rs #3561, #3591, #3549, #3553
NV-04 C — NVIDIA/Crash P0 Eradicate producerless Wait64BitValueX hangs, panic-stuck PSO queues & watchdog kills hle/d3d12x/{fence_x.rs,gpu_awake.rs,pso_async.rs} #505, #1452, open #3670
NV-05 C — NVIDIA/Crash P1 Fix Series S uma_coherent.txt (#3568), GPU indirect validation, shared-tex size & 0xC0000005 hle/d3d12x/{uma_driver.rs,indirect_guard.rs,guard.rs} #3568, #675, #846, #662
NV-06 C — NVIDIA/Crash P1 Upgrade dred.rs with automatic root-cause classification & light-DRED diagnostic default hle/d3d12x/dred.rs, stall.rs #2403, #1452
CTRL-01 D — PC Controls P0 Fix kbm.rs >100 ms camera whip (#963), absolute mouse (#962) & wheel/deadzone/GTA preset hle/kbm.rs #963, #962
CTRL-02 D — PC Controls P0 Fix playstation.rs:111 128B→547B DualShock 4 BT crash (#2465) & callback trap (#3583) hle/playstation.rs, hle/gameinput.rs #2465, #3583
CTRL-03 D — PC Controls P1 Modern multi-controller backend (SDL3 / DualSense / hotplug / ghost-pad filter / trigger rumble) hle/gameinput.rs, hle/playstation.rs #692
CTRL-04 D — PC Controls P1 High-quality present scaling (#554), DPI awareness & Alt+Enter borderless fullscreen hle/d3d12x/present.rs, hle/kbm.rs #554, open #3672
CTRL-05 D — PC Controls P1 Built-in lightweight F3 Telemetry HUD & F1 Live Settings Menu (saved to xcl.toml) hle/d3d12x/present.rs, config.rs Net-new
CTRL-06 D — PC Controls P2 Audio thread priority & XMA2/Opus stutter immunity during heavy CPU streaming hle/xaudio2.rs, hle/xma2/mod.rs, hle/opus.rs #1728, #926

Track A — Aggressive FPS Architecture (Target: 3–4 FPS → 30–60+ FPS)

PERF-01 — Promote Thin LTO + codegen-units = 1 to Default Release Profile

  • Priority: P0 | Files: Cargo.toml | Related: Open PR #3604
  • Code Audit: Cargo.toml currently sets only debug = 2 under [profile.release], leaving default codegen-units = 16 and no LTO. Cross-module hot calls across list_x.rs, bind.rs, real.rs, sparse.rs, and vram.rs lose inlining opportunities worth 1.5–2× on the CPU submission path.
  • Action: Land #3604 and make lto = "thin" + codegen-units = 1 (retaining debug = 2 for crash symbolication) the standard release profile.
  • Target: 25–50% drop in CPU recording/submission time in submit_cost.rs with zero debug-symbol loss.

PERF-02 — Zero-Alloc Per-Draw Submission, CBV_ONCE, Lockless Descriptor Heap & InitHeaders Replay

  • Priority: P0 | Files: crates/xcl/src/hle/d3d12x/{list_x.rs,bind.rs,real.rs,alloc_pool.rs} | Related: #2688, #3222
  • Think HARD — Breakthrough Investigation:
    1. Analyze meticulously every Vec allocation and mutex lock on the per-draw path in list_x.rs and bind.rs (10,000+ draws/frame).
    2. Replace per-draw root-constant and descriptor-table slot allocations with per-command-list bump/arena scratch slabs reset cleanly on Reset().
    3. CBV_ONCE & unaligned root-CBV dedup: Reuse a single upload copy for all draws in a list referencing identical unchanged CBV bytes until next written; copy unaligned root constant buffers once per list; reuse own-byte copy buffers across descriptor binds.
    4. Lockless descriptor-heap host lookup & fast-hash table cache: Once a console heap's host ID3D12DescriptorHeap exists, return it lock-free; cache rebuilt descriptor tables by fast 64-bit hash + exact compare.
    5. Keep pipelines and shader-written range declarations once per list, use SSE2 moves for < 1 KiB updates, and batch InitHeaders title-memory stores from a compact record.
  • Target: Single-thread submit recording drops ≥ 50% (to < 12 ms/frame on 10k-draw scenes).

PERF-03 — Per-Draw Parameter SRV Mesh Batching & Indirect Draw Barrier Batching

  • Priority: P0 | Files: crates/xcl/src/hle/d3d12x/{list_x.rs,barrier_groups.rs,indirect_guard.rs} | Related: #2688 (Net-new — 0 open PRs)
  • Think HARD — Breakthrough Investigation:
    1. Mesh Draw Batching Beyond Strict State Adjacency: When consecutive mesh/graphics draws share pipeline & root signature and differ only in per-draw root constants/parameters, pack per-draw parameters into a single SRV table and issue one batched ExecuteIndirect / multi-draw — proven in synthetic D3D12 benchmarks on RTX 5070 Ti (4,096 mesh draws) to cut CPU recording ~70× (0.118 → 0.0016 ms) and GPU execution ~2× (0.068 → 0.035 ms).
    2. Batch Indirect Draw Barriers (barrier_groups.rs): Coalesce per-draw resource barriers across compatible indirect draw sequences into single batched barrier submissions — proven on 3,200 indirect draws to cut barrier overhead ~48× (30.54 → 0.64 ms).
    3. Run small spread dispatches (≤ 65,535 groups) through the plain direct signature without extra indirection.
  • Target: ≥ 50% drop in list_x.rs draw/barrier submission overhead on dense city scenes.

PERF-04 — Host-RAM Bitset for Live Console-Heap V# Slots & Read-Only Root UAV Write-Back Elision

  • Priority: P0 | Files: crates/xcl/src/hle/d3d12x/{console_heap.rs,bind.rs,real.rs}, crates/xcl/src/gpu/recomp/ | Related: #2688 (Net-new)
  • Think HARD — Breakthrough Investigation:
    1. Host-RAM Live V# Slot Bitset (console_heap.rs): Track live console-heap V# slots in a compact host-RAM bitset instead of linearly scanning write-combined (WC) heap copies — eliminates 100% of catastrophic WC CPU reads (~65× faster, 60.30 µs → 0.93 µs).
    2. Read-Only Root UAV Detection: Analyze translated shader metadata to identify root UAVs that a shader only reads (never writes), skipping them completely from post-dispatch write-back / dirty-comparison scans — capable of slashing per-frame guest memory comparisons by ~75–80% (e.g., 12.8 GB → 2.7 GB/frame).
  • Target: Zero WC heap scans on the submit thread; ≥ 60% drop in per-frame UAV readback/compare traffic.

PERF-05 — Escape the 1.5 GiB GetWriteWatch Storm & Lock-Free Watch/Refresh Hot Paths

  • Priority: P0 | Files: crates/xcl/src/hle/d3d12x/{watch.rs,sparse.rs,title_textures.rs,submit_cost.rs} | Related: #582, open PRs #3649, #3677
  • Diagnosis: #582 measured 35,369 ms of GetWriteWatch per 200 s on RTX 5080 (still 26,190 ms with XCL_WATCH_HOT=1). Do NOT multithread GetWriteWatch (proven 2.5–3× slower in #582).
  • Think HARD — Breakthrough Investigation:
    1. Land & tune #3649 / #3677 (2–4 MiB watch-range blocks + adaptive hot-block retention) and cache kernel-refused ranges so GetWriteWatch is never re-called on rejected view memory; eliminate VirtualQuery in write-fault waits.
    2. Interval-skip absent placeholders (RangeSet) & coalesce VirtualProtect runs (~5.9× faster on sparse views) + O(1) envelope fast path on title_textures::refresh_once (~8× faster on localized dirty ranges).
    3. Two-tier dirty tracking: Leave uploaded 64 KiB physical-section blocks PAGE_READONLY with a lock-free VEH dirty-bitset handler (0.00 µs/submit when untouched) + AVX2 fast-path skip-unchanged writes (~1.7× faster, 6.8 GB/s) + incremental card hashing for ≥ 64 KiB hot buffers.
    4. Split hot lock contention & sift refresh batches with a scoped worker pool (eliminating 60 ms idle-sweep stutters) and scope pre-submit scans strictly to ranges referenced by the current batch (used_journal.rs / view_want.rs).
  • Target: Pre-submit write-watch + chunk scan drops ≥ 10× (to < 12 ms/s in submit_cost.rs).

PERF-06 — Async GPU Submission Relay, Non-Blocking Mip Uploads, EnqueueMakeResident & Wait64 Elision

  • Priority: P0 | Files: crates/xcl/src/hle/d3d12x/{queue_submit.rs,real.rs,texture_upload.rs,fence_x.rs} | Related: #2688, #505, open PR #2523
  • Think HARD — Breakthrough Investigation:
    1. Decoupled Async Submission Relay (2–3 batches in flight): Let the title's ExecuteCommandLists hand prepared lists to a dedicated high-priority sender thread and return immediately, overlapping next-frame recording with upload/dispatch execution.
    2. Non-Blocking Streamed Mip Uploads (NO_WAIT + UPLOAD_AHEAD): Never stall the direct graphics queue waiting for a streamed mip to detile/upload; bind the next-lower resident mip and atomically swap the SRV once the copy-queue fence completes (verifying fence completion before publication!).
    3. Async ID3D12Device3::EnqueueMakeResident: Replace synchronous CPU-blocking MakeResident calls with async EnqueueMakeResident waited on by the GPU queue before first use.
    4. Elide Already-Satisfied Wait64BitValueX Waits & Track Cross-Queue Wakeups: Check CPU-visible fence state before emitting GPU Queue::Wait — proven up to 26× faster (eliding ~1,000 redundant fences) with 5.8× faster cross-queue wakeups.
  • Target: Title submit thread < 8 ms/frame; sustained GPU utilization > 85%.

PERF-07 — Coalesced Dirty Copy Ranges, Written-Mip-Only Detiling & Threaded UpdateTileMappings

  • Priority: P0 | Files: crates/xcl/src/hle/d3d12x/{sparse.rs,texture_upload.rs,title_textures.rs} | Related: #2688, open PRs #3651, #3701
  • Think HARD — Breakthrough Investigation:
    1. Read & detile ONLY the written mip levels of write-watched textures (0 open XCL PRs — proven 7–12× faster, 54–66 µs vs 385–496 µs), paired with landing #3651 (GPU compute 2D detiling) and #3701 (direct-upload volume-mip detiling).
    2. Coalesce contiguous dirty page parts (8–16 adjacent runs → one CopyBufferRegion / CopyTextureRegion + one barrier) and parallelize independent small copy runs.
    3. Compact unpublished remap bursts & thread UpdateTileMappings (sparse.rs:3636–3702): Merge contiguous tile coordinates into multi-range calls on a dedicated mapping thread outside PAGES.lock().
  • Target: ≥ 50% reduction in Copy* and UpdateTileMappings D3D12 calls/frame; 7–12× faster partial texture updates.

PERF-08 — Native Upscaler & Frame-Generation Bridge at ffxCreateContext / ffxDispatch (DLSS SR + DLSS-G / FSR 3.1 FG + Reflex)

  • Priority: P0 | Files: crates/xcl/src/hle/d3d12x/present.rs, crates/xcl/src/gpu/adapter.rs, new crates/xcl/src/gpu/upscale.rs | Related: Net-new (0 open PRs in all 3,775 XCL items!)
  • Think HARD — Breakthrough Investigation:
    1. Intercept the FidelityFX Upscaling Seam (ffxCreateContext, ffxDestroyContext, ffxDispatch, ffxQuery): Console titles already pass jittered low-res color, depth, motion vectors, exposure, reactive mask, and camera constants straight into ffxDispatch.
    2. Build a clean-room, opt-in Host Upscaling & Frame-Gen Backend (dynamically loading user-supplied official NVIDIA Streamline or AMD FidelityFX SDK DLLs with signature/hash validation — zero proprietary binaries in repo):
      • NVIDIA RTX 20/30/40/50: Streamline DLSS Super Resolution (DLAA / Quality / Balanced / Performance / Ultra Performance) + NVIDIA Reflex low-latency markers + DLSS Frame Generation (2× on RTX 40, up to 4× on RTX 50).
      • RTX 20/30, AMD & Universal Fallback: AMD FidelityFX SDK FSR 3.1 Super Resolution + 2× Frame Generation.
      • Low-End 6–8 GB VRAM Render-Scale Clamping: Allow 720p/900p internal render targets upscaled cleanly to 1080p/1440p — cutting pixel-shader GPU cost AND render-target VRAM together.
    3. Guard against 8 GB FG device-removal spikes (monitor DXGI headroom before enabling FG; gracefully drop FG if VRAM headroom falls below safe threshold) and composite HUD/UI cleanly after upscaling/FG.
  • Target: 1.6×–2.2× native FPS gain via DLSS/FSR SR + 2× smoothness via DLSS-G / FSR 3.1 FG (30–60+ FPS on 6–8 GB RTX 4050/4060/3060 cards).

PERF-09 — Land ALLOW_TEARING (#2756), 3-Buffer Waitable Flip-Discard & QPC Frame Pacing

  • Priority: P1 | Files: crates/xcl/src/hle/d3d12x/{present.rs,frame.rs} | Related: Open PR #2756, #554
  • Code Audit: present.rs:1661 calls sc.Present(0, DXGI_PRESENT(0)).ok() without DXGI_PRESENT_ALLOW_TEARING.
  • Action: Land #2756, upgrade to 3-buffer DXGI_SWAP_EFFECT_FLIP_DISCARD with DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT (max latency 2–3), add a hybrid sleep+spin XCL_FPS_CAP, and hold SetThreadExecutionState(ES_DISPLAY_REQUIRED) during play so gamepad-only sessions never trigger sleep/screensaver.
  • Target: Zero DWM composition stalls; p95/p99 frame-time jitter cut ≥ 40%.

PERF-10 — Zero-Cost XCL_RAYTRACING=off BVH Bypass, Intel P-Core/CCD0 Affinity & DirectStorage/XMA Speed

  • Priority: P1 | Files: crates/xcl/src/gpu/bvh.rs, crates/xcl/src/hle/{kernelx.rs,dstorage.rs,xma2/mod.rs} | Related: #2688
  • Think HARD — Breakthrough Investigation:
    1. Zero-Cost XCL_RAYTRACING=off BVH Bypass: When RT is disabled, elide batched BVH build/rehydrate/copy dispatches cleanly (returning minimal prebuild sizes and advancing fences immediately) to reclaim both GPU frame time and hundreds of MB of BVH scratch VRAM.
    2. Hybrid Intel P-Core / AMD V-Cache CCD0 Affinity (kernelx.rs): Translate SetThreadGroupAffinity / SetThreadAffinityMask via GetSystemCpuSetInformation so title render/submit/audio threads stay on P-cores / CCD0, while XCL's background PSO-compile and detile workers run on E-cores / secondary CCD.
    3. DirectStorage & XMA2 Hot-Path Wins: Reuse per-worker DecompressorOxide + scratch buffers in dstorage.rs (~1.74× faster decompression, zero per-request heap churn), add sorted 3-worker read scheduling for HDDs, and add a single-packet fast path in xma2/mod.rs (2–11× faster XMA frame extraction).
  • Target: Zero BVH overhead under XCL_RAYTRACING=off; zero E-core preemption spikes on Intel 12th–14th Gen HX/desktop CPUs.

Track B — Aggressive RAM & VRAM Compression (Target: 27 GB VRAM / 50 GB Commit → ≤ 6–8 GB VRAM / ≤ 16 GB RAM)

MEM-01 — Eliminate VRAM Double-Mirroring: Default Lazy Tiles, L0/L1 Tiering & Idle CPU Mirror Drop

  • Priority: P0 | Files: crates/xcl/src/hle/d3d12x/{sparse.rs,title_textures.rs,uma_driver.rs} | Related: #1773, #2825, #646, open PR #3695
  • Diagnosis: Every 64 KiB sparse tile defaults to D3D12_HEAP_TYPE_DEFAULT (sparse.rs:3536, 3714), placed textures are duplicated (#1773), and idle CPU tile copies stay committed (#2825). On RTX 3080 10 GB, even XCL_TEXTURE_LEVEL_PAGES=1 still sits at 15.9 GB local VRAM against a 9.0 GB budget (#1773); meanwhile, placing title GPU heaps in local VRAM and cold sparse buffers/streamed levels in system memory (L0) let RTX 3080 10 GB run 900 s crash-free (#1452/#2688).
  • Think HARD — Breakthrough Investigation:
    1. Promote XCL_SPARSE_LAZY=1 and XCL_TEXTURE_LEVEL_PAGES=1 to safe defaults.
    2. Automatic L1 (VRAM) vs. L0 (System Memory) Tiering: Keep render targets, depth/stencil, active shaders, and hot top-mip textures in L1; automatically place cold sparse buffers, coherent windows, and non-hot streamed mips in L0 (D3D12_HEAP_TYPE_CUSTOM / MEMORY_POOL_L0) when DXGI local budget ≤ 10 GB.
    3. De-duplicate Placed Textures & Drop Idle CPU Tile Copies (#2825): Reclaim redundant sparse tiles once detiled and VirtualFree(MEM_DECOMMIT) idle CPU tile mirrors (reading back only on rare CPU touch). Land #3695 (coherent window sized by live GPU heaps).
  • Target: Local VRAM cut ≥ 55% (≤ 5.5–7.2 GB on 6–8 GB cards in Lockhart/Series S mode).

MEM-02 — Turn XCL_TEXTURE_BUDGET_EVICT (vram.rs:135–150) Into Real, Monotonic, Fence-Safe LRU Eviction

  • Priority: P0 | Files: crates/xcl/src/hle/d3d12x/{vram.rs,bind.rs,late_release.rs} | Related: #1773, #2688
  • Code Audit: vram.rs:135–150 explicitly states XCL_TEXTURE_BUDGET_EVICT=1 tracks SRV metadata only — it does zero actual eviction or safe descriptor replacement.
  • Think HARD — Breakthrough Investigation:
    1. Poll IDXGIAdapter3::QueryVideoMemoryInfo (Local & Non-Local) every ~100 ms; trigger soft trim at 82% of Budget and aggressive LRU eviction at 90% of Budget.
    2. Monotonic, Fence-Safe LRU Texture Eviction + Safe Fallback SRV: Track last_used_frame in bind.rs; evict coldest top-mip textures via ID3D12Device::Evict or fence-deferred release (late_release.rs) while atomically repointing their descriptors to a resident lower-mip / 1×1 fallback SRV (preventing GPU page faults), enforcing eviction monotonicity + a 4 MiB progress floor with a 2,000 ms cooldown to avoid thrashing (proven to cut streaming eviction stalls from 10.87 ms → 2.04 ms).
    3. Scale texture allocation floor / mip bias dynamically to the real VRAM budget on 4–6 GB GPUs.
  • Target: On 6–8 GB GPUs, DXGI CurrentUsage stabilizes ≤ 92% of Budget across 30+ min of roaming with zero WDDM thrashing.

MEM-03 — Fix #3587 6–8 GB Over-Pressure Trap, Dynamic Render-Target Reserve & 85% Empty-Block Pool Cap

  • Priority: P0 | Files: crates/xcl/src/hle/d3d12x/{vram.rs,memory_report.rs,alloc_pool.rs} | Related: Open PR #3587, #1773
  • Code-Review Audit (#3587):
    • Fixed 2,048 MiB margin in target.saturating_sub(HYSTERESIS) causes 6–8 GB GPUs to get permanently stuck in Over-Pressure and never return to Room!
    • When local_segment() returns None, refresh() never resets PRESSURE.
    • take_tiles_with_fallback's L0 path never falls back to DEFAULT when L0 CreateHeap fails.
    • sweep_and_reclaim clears vram_oom_until when reclaiming L0 (system-RAM) heaps that freed 0 bytes of VRAM.
  • Action: Fix all 4 #3587 defects; scale render-target headroom reserve proportionally to DXGI budget (e.g., 512 MiB–1.5 GiB on 6–8 GB cards instead of a fixed 2–3 GiB reserve); and cap retained empty texture-pool blocks strictly under the 85% budget line (reclaiming ~512 MB at peak on 8 GB cards).
  • Target: Clean pressure-state hysteresis and ≥ 512 MB lower peak VRAM on 6–8 GB GPUs.

MEM-04 — 4 MiB Sparse Pool Chunks (Reclaim 1.5–2 GB), 64 MB Section Split & Fix #3553 PAGES Lock

  • Priority: P0 | Files: crates/xcl/src/hle/d3d12x/{sparse.rs,vram.rs,sharded.rs,console_heap.rs} | Related: #1773, #3553, #3593, #3011 (C115)
  • Measured Evidence:
    • #1773 (@imnicho): 64 MiB sparse pool heaps trap 1.5–2.0 GB of VRAM and commit after the title frees tiles, with most free space sitting in wholly free 4 MiB pieces!
    • #3011 (C115): Lazily committed allocations in one giant section caused 225 per-page lock waits taking 342 of 367 ms; splitting into ≤ 64 MiB sections eliminates the lock bottleneck.
    • #3553 (just merged Dec 2, flagged by @bmjask): live_reserved_for runs QueryInterface/allocations inside the global PAGES mutex, and timed-out wait_new_placement returns an unready texture anyway!
  • Action: Shrink sparse pool heap granularity from 64 MiB → 4 MiB (or 8 MiB); split lazy-commit regions into ≤ 64 MiB sections; shard PAGES.lock() by 64 MiB buckets (sharded.rs); move live_reserved_for, COM Release, UpdateTileMappings, and zero-fills (#3593) strictly outside all page locks; and fix timed-out wait_new_placement handling.
  • Target: 1.5–2.0 GB immediate VRAM/commit savings; refresh lock wait < 0.1 ms/submit; zero AB-BA deadlocks.

MEM-05 — Host-Memory Admission Control, Indirect Scratch Pooling, Working-Set Trim Protection & Truthful XMem Stats

  • Priority: P0 | Files: crates/xcl/src/ram_budget.rs, crates/xcl/src/hle/d3d12x/alloc_pool.rs, crates/xcl/src/hle/kernelx.rs | Related: #2639, #646, #2688
  • Think HARD — Breakthrough Investigation:
    1. Admission Control & Indirect Scratch Pooling (alloc_pool.rs, ram_budget.rs): Pool indirect-batch scratch buffers back on list completion (unpooled indirect scratch has been measured leaking 3.2 GB VRAM and spiking GPU time 4×!). Enforce commit headroom floors (e.g., 512 MiB for speculative uploads, 1 GiB for fresh 64 MiB upload-block growth) so speculative prefetch yields to mandatory game allocations without refusing title commits (#1566).
    2. Working-Set Trim Protection (ram_budget.rs): Prevent Windows from abruptly trimming XCL's working set from ~15 GB → 2 GB under momentary RAM pressure (which tanks FPS by 50–70% for minutes while paging back in).
    3. Truthful, Host-Scaled XMemGetWorkingSetStatistics (kernelx.rs): Scale reported working-set capacity to the host PC's actual RAM/VRAM tier (especially 16 GB RAM / Lockhart mode) so the game's own streamer naturally evicts distant LODs.
  • Target: Peak process commit stays ≤ 14–16 GB on 16 GB RAM PCs with zero Windows working-set cliff drops.

MEM-06 — File-Backed Cold Shadow Memory, DirectStorage Cap & Fix #2578 / #1049

  • Priority: P1 | Files: crates/xcl/src/hle/d3d12x/{title_textures.rs,uma_driver.rs}, crates/xcl/src/hle/dstorage.rs | Related: #2578, #1049, #2639
  • Code Audit:
    • title_textures.rs:994–1009 (#2578): retire_overlapping never removes retired entries from STREAM_RECHECK, leaking CPU re-hash work and memory over long sessions.
    • #1049: UI glyph atlases in XCL_UMA_DRIVER=mixed's unwatched GPU_UPLOAD segment miss updates after first upload, dropping menu letters and drawing black HUD blocks.
  • Action: Purge retired entries from STREAM_RECHECK in retire_overlapping (#2578); re-check dynamic glyph/UI atlases in GPU_UPLOAD segments (#1049); add opt-in sparse temporary file backing (FILE_ATTRIBUTE_TEMPORARY) for cold >4 MiB shadow buffers on 16 GB RAM hosts; and enforce XCL_DSTORAGE_MEMORY_BUDGET_MIB as a strict semaphore on in-flight decompression scratch.
  • Target: Bounded STREAM_RECHECK over multi-hour runs; zero missing UI glyphs; zero ERROR_COMMITMENT_LIMIT (1455) crashes on 16 GB RAM.

Track C — NVIDIA Compatibility & Zero-Crash Stability

NV-01 — Break the 512 MB NVIDIA Shader-Code Heap Wall (pso_async.rs:495) & 610.88 Silent Freeze

  • Priority: P0 | Files: crates/xcl/src/hle/d3d12x/pso_async.rs, crates/xcl/src/shaders/pipeline_library.rs | Related: #2403, #1452, open PR #3633
  • Code & Field Audit (#2403):
    • pso_async.rs:495 hardcodes fn is_evictable(&self) -> bool { self.kind == PipelineKind::Compute }, leaving Graphics PSOs pinned forever while the eviction/rebuild stage remains #[allow(dead_code)] (pso_async.rs:142).
    • Raising the NVIDIA driver shader heap to 1–2 GiB eliminated 0x887a0005 for 600 s+ on RTX 4080/5080/GTX 1650 — but on RTX 5070 Ti driver 610.88, even a 2,048 MB reserve still silently froze presents after 1,800 frames (#2403, @brainhay5).
  • Think HARD — Breakthrough Investigation:
    1. Extend is_evictable() to BOTH Graphics AND Compute PSOs (pso_async.rs:495).
    2. Automatic Fence-Safe LRU PSO Eviction on NVIDIA: Track resident shader-code bytes (GetCachedBlob / calibrated estimator) and evict coldest completed-fence ID3D12PipelineState objects whenever resident code crosses ~384–416 MiB (scaling with detected heap profile), retaining their recipe + persistent ID3D12PipelineLibrary entry (#3633) for <1–2 ms re-hydration (or 1-frame safe async rebuild).
    3. Investigate the 610.88 silent present freeze (#2403): Add a 10-second present-stall detector that dumps live PSO count, resident shader-code MB, pending queue fences, and driver version.
  • Target: Zero 0x887a0005 removals and zero silent present freezes across 60-min retail runs on 6–16 GB NVIDIA GPUs (drivers 610.88 & 621.40+).

NV-02 — Kill nvgpucomp64 Multi-Minute Stalls, Prune Unused PSOs & Persist Pipeline Libraries

  • Priority: P0 | Files: crates/xcl/src/hle/d3d12x/pso_async.rs, crates/xcl/src/gpu/recomp/{dxc.rs,pso.rs}, crates/xcl/src/shaders/pipeline_library.rs | Related: #156, #2088, #2595, open PRs #3633, #3442, #3670
  • Diagnosis: A ~4 MB translated shader stalled nvgpucomp64 for 951 s (#2088); half of cold compute compile time goes to unused builds (#3442); 80k+ queued graphics PSOs starve 8 GB Ampere / RTX 3070 into black screens (#2595, #2688); and minor runtime rebuilds invalidate warm pipeline libraries (#3633).
  • Think HARD — Breakthrough Investigation:
    1. Land #3633 (cross-build ID3D12PipelineLibrary persistence) keyed by (adapter_luid, driver_version, dxil_blake3, root_sig_hash, pso_state_hash).
    2. Land #3442 (prune unused compute PSOs) and #3670 (fault-tolerant preload workers); add a reserved fast worker lane for small/medium foreground draws (proven ~38× faster small-request completion, 901 → 23.5 ms) so >1 MB compute outliers can never starve world rendering.
    3. Cap/outline DXIL constructs that trigger super-linear nvgpucomp64 compiles and ensure panicking builds always complete their queue entry and log to a version-scoped warm-bad.txt.
  • Target: Cold-to-world time drops ≥ 5×; warm-cache startup reaches world in < 15 s with zero >50 ms compile hitches.

NV-03 — Fix Live Dec 2 Code-Review Regressions (#3561, #3591, #3549)

  • Priority: P0 | Files: crates/xcl/src/gpu/dxil/{kernel.rs,lower.rs}, crates/xcl/src/hle/d3d12x/sparse.rs | Related: #3561, #3591, #3549
  • Verified Code-Review Findings (@bmjask, Dec 2):
    1. #3561 (Critical): Lane-loop CFG walk drops the per-dispatch IO_LOOP_BUDGET loop-pass cap (kernel.rs:558), re-exposing infinite GPU loops / TDR hangs.
    2. #3591 (High): The NVIDIA execz miscompile workaround exists only in the direct DXIL pixel path, leaving the HLSL fallback path broken on NVIDIA, and flat_skips does not reject regions modifying HW_REG_MODE (s_round_mode / s_denorm_mode).
    3. #3549 (Medium): Permanently skipping MEM_RESERVE/MEM_FREE pages drops GPU results if the title commits that page concurrently.
  • Action: Patch all three before they compound into intermittent NVIDIA TDRs or silent rendering corruption.
  • Target: All three review findings closed with unit/GPU regression tests.

NV-04 — Eradicate Producerless Wait64BitValueX Hangs & "GPU Loc Sig" Watchdog Kills

  • Priority: P0 | Files: crates/xcl/src/hle/d3d12x/{fence_x.rs,gpu_awake.rs,watch.rs,real.rs} | Related: #505 (573 comments), #1452 (77 comments)
  • Think HARD — Breakthrough Investigation:
    1. Discard unsubmitted waits immediately when a command list is reset or released without submission.
    2. Cross-Queue Producer Registry (fence_x.rs): Track every queued Signal / WriteValueImmediate VA + value across all queues; if a producer was skipped (uncompiled PSO or RT-off bypass), never emit an unfulfillable GPU Queue::Wait — log once and resolve safely.
    3. Harden gpu_awake.rs + bounded frame-hold timeout: Keep GPU heartbeat timestamps advancing during bounded PSO waits, and stop waiting on slow pipelines once a frame has waited past a configurable threshold so the title's "GPU Loc Sig" watchdog never kills an actively progressing run.
  • Target: Zero producerless Wait64BitValueX hangs and zero false "GPU Loc Sig" watchdog terminations over 60-minute runs.

NV-05 — Fix Series S uma_coherent.txt (#3568), GPU Indirect Validation, Shared-Texture Sizing & 0xC0000005

  • Priority: P1 | Files: crates/xcl/src/hle/d3d12x/{uma_driver.rs,indirect_guard.rs,guard.rs,vram.rs}, crates/xcl/src/hle/xg.rs | Related: #3568, #675, #846, #662, #232
  • Action:
    1. Fix #3568: Key uma_coherent.txt by (title_id, console_profile, adapter_luid) and bounds-check before mapping so Series X sizes never crash Series S (lockhart) runs at ~37 s.
    2. Zero-readback GPU pre-validation (indirect_guard.rs): Clamp indirect draw counts/offsets via lightweight compute before ExecuteIndirect so malformed indirect buffers never page-fault NVIDIA GPUs (#675).
    3. Audit shared-texture allocation size queries (always query allocation info from the texture's own description to prevent NVIDIA device removal) and close remaining 0xC0000005 ABI traps (#662, #846, #232).
  • Target: Multi-hour crash-free stability on both Series S (lockhart) and Series X (anaconda) profiles.

NV-06 — Actionable NVIDIA DRED Correlation & Automatic Crash Root-Cause Classifier

  • Priority: P1 | Files: crates/xcl/src/hle/d3d12x/dred.rs, stall.rs | Related: #2403, #1452
  • Action: Default to light DRED only in diagnostic launches (zero runtime tax on normal runs), and on any 0x887A0005/0x887A0006/watchdog exit print a 10-line Pre-Crash Classifier Banner: (1) resident NVIDIA shader-code MB & live PSO count, (2) DXGI Local/Non-Local Usage vs. Budget, (3) pending producerless Wait64BitValueX entries, (4) last 16 submitted PSO hashes + list types, and (5) explicit root-cause class (NVIDIA_SHADER_HEAP_EXHAUSTION | VRAM_BUDGET_OOM | PRODUCERLESS_FENCE_HANG | GPU_PAGE_FAULT with owning resource).
  • Target: Every crash log self-identifies its exact root cause in <10 lines.

Track D — PC Controls, Windowing & Windows UX

CTRL-01 — Fix kbm.rs >100 ms Camera Whip (#963), Absolute Mouse (#962) & Wheel/Deadzone/GTA Keymap

  • Priority: P0 | Files: crates/xcl/src/hle/kbm.rs | Related: #963, #962
  • Action:
    1. Fix #963: Expire stale accumulated mouse deltas whenever dt > 50 ms or across focus/menu transitions so camera whip cannot happen.
    2. Fix #962: Convert MOUSE_MOVE_ABSOLUTE WM_INPUT coordinates cleanly into per-frame deltas (RDP, VMs, tablets).
    3. PC Mouse-Look & Bindings: Add bindable WheelUp / WheelDown and side buttons (XBUTTON1/XBUTTON2, currently 0 hits in XCL), configurable inner-deadzone compensation, separate X/Y & ADS sensitivity multipliers, optional GTA V PC-style default keymap preset in xcl.toml, and crash-safe ClipCursor release on Alt-Tab / panic.
  • Target: Crisp, whip-free PC mouse control across relative and absolute devices.

CTRL-02 — Fix playstation.rs:111 128B→547B DualShock 4 BT Crash (#2465) & Callback Trap (#3583)

  • Priority: P0 | Files: crates/xcl/src/hle/playstation.rs, crates/xcl/src/hle/gameinput.rs | Related: #2465, #3583
  • Code Audit: playstation.rs:111 hardcodes let mut buf = [0u8; 128]; while DualShock 4 over Bluetooth requires a 547-byte HIDP_CAPS.InputReportByteLength buffer (#2465), and gameinput.rs hits 0x80000003 on RegisterDeviceCallback (#3583).
  • Action: Query HidP_GetCaps dynamically in playstation.rs (buffer ≥ max(caps.InputReportByteLength, 547)), ensure NUL-terminated HID paths for CreateFileW, decode both BT (0x11) and USB (0x01) DualShock 4 / DualSense reports, and fix RegisterDeviceCallback + COM QueryInterface (IID_IUnknown + own IID) in gameinput.rs.
  • Target: Plug-and-play DualShock 4 & DualSense over USB & Bluetooth; zero callback traps.

CTRL-03 — Modern Multi-Controller Backend (SDL3 / Native HID, Hotplug, Ghost-Pad Filter & Trigger Rumble)

  • Priority: P1 | Files: crates/xcl/src/hle/gameinput.rs, crates/xcl/src/hle/playstation.rs | Related: #692
  • Action: Add an opt-in SDL3 / native HID backend (#692) replacing slow empty-slot XInputGetState(0..3) polling (gameinput.rs:149–193), filter all-zero wireless receiver ghost pads, support mid-session hotplug/reconnect, impulse trigger rumble, DualSense/Switch Pro/generic pads, and seamless Controller ↔ KB+M auto-switching.
  • Target: Zero empty-XInput polling lag; working hotplug + trigger rumble across Xbox, PlayStation, and generic PC controllers.

CTRL-04 — High-Quality Present Scaling (#554), DPI Awareness & Alt+Enter Borderless Fullscreen

  • Priority: P1 | Files: crates/xcl/src/hle/d3d12x/present.rs, crates/xcl/src/hle/kbm.rs | Related: #554, open PR #3672
  • Action: Land #3672, enable PER_MONITOR_AWARE_V2 DPI awareness, add freeze-free Alt+Enter Borderless Fullscreen, and replace DWM's single bilinear tap (#554) with a lightweight bicubic/Lanczos or CAS-sharpen blit pass whenever window_size != render_size.
  • Target: Razor-sharp UI/text at any window size or Windows DPI scaling.

CTRL-05 — Built-In Lightweight F3 Telemetry HUD & F1 Live Settings Menu

  • Priority: P1 | Files: crates/xcl/src/hle/d3d12x/present.rs, crates/xcl/src/config.rs | Related: Net-new
  • Action: Add an opt-in, zero-dependency pre-present D3D12 overlay:
    • F3 Telemetry Bar: Live FPS, avg/p95 ms, CPU submit ms vs. GPU ms, DXGI Local Usage / OS Budget / Dedicated Capacity, Process Commit, and Resident NVIDIA Shader-Code MB.
    • F1 Live Settings Menu: Runtime toggles for Upscaler (Off/DLSS/FSR 3.1), Frame Gen, Render Scale, XCL_FPS_CAP, VSync/Tearing, Mouse Sensitivity/Deadzone, and VRAM Budget Target — saved directly to xcl.toml.
  • Target: < 0.15 ms overhead when open, 0.00 ms when hidden; live tuning without restarting.

CTRL-06 — Time-Critical Audio Thread Priority & XMA2/Opus Stutter Immunity

  • Priority: P2 | Files: crates/xcl/src/hle/xaudio2.rs, crates/xcl/src/hle/xma2/mod.rs, crates/xcl/src/hle/opus.rs | Related: #1728, #926
  • Action: Run the XMA2/Opus decode thread at THREAD_PRIORITY_TIME_CRITICAL so heavy shader-compile or streaming bursts never starve audio buffers, and treat PacketSkipCount == 0xff cleanly as end-of-stream.
  • Target: Zero audio crackle/dropouts during heavy streaming or shader compilation.

Verification & Benchmarking Standard (Required for Every PR)

Metric Measurement Source Low-End Target (6–8 GB VRAM / 16 GB RAM) Mid/High Target (12+ GB VRAM)
Steady World FPS (avg / p95 ms) XCL_GPU_PROFILE=1 / present.rs ≥ 30 FPS (native/upscaled), ≥ 60 FPS w/ FG ≥ 60 FPS native/upscaled
CPU Submit Cost (avg ms/submit) submit_cost.rs < 2.0 ms (look < 0.2 ms) < 1.0 ms
DXGI Local VRAM Peak QueryVideoMemoryInfo ≤ 5.5–7.2 GB (≤ 92% budget) ≤ 10–12 GB
Process Private Commit Peak GetProcessMemoryInfo ≤ 14–16 GB ≤ 20 GB
NVIDIA Resident Shader-Code Peak pso_async.rs (#2403) ≤ 416 MB (0 0x887a0005 removals) ≤ 416 MB (0 removals)
Crash-Free Soak World roam + camera + Alt-Tab ≥ 30 min (0 TDR / 0 AV / 0 watchdog) ≥ 60 min

[NOTE: You may go with your own open-ended proper tested solutions. The starting hypotheses provided are just for initial test runs]

<!-- greyfinch-sync:ivall/xcl:issue:6752138835 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/issues/3715). Originally posted by [hyperland956-lgtm](https://github.com/hyperland956-lgtm) on 2026-12-02T18:48:52Z. --- # Master Breakthrough Audit: 30–60+ FPS Pipeline, 6–8 GB Low-End RAM/VRAM Compression, NVIDIA Zero-Crash Stability & Native PC Controls > **Baseline:** `xcl-dev/xcl` `main` (`817eb1fc`, 2026-12-02) | **Target:** Windows x64 — NVIDIA RTX 20/30/40/50 + low-end **6–8 GB VRAM / 16 GB RAM** laptops & desktops (alongside AMD) > **Live Anchor Trackers:** `#2688` (RAM/VRAM & 30 FPS Swarm), `#2088` (Cold PSO Swarm), `#2403` (NVIDIA 512 MB Shader-Code Heap), `#1773` (VRAM Mirroring), `#582` (`GetWriteWatch` Tax), `#1452` / `#505` (Watchdog & Device Removal), `#2639` (Memory Backpressure), `#3222` (D3D12.X Index), `#1833` (World-Load Roadmap), `#1607` (PR Triage) ## Executive Diagnosis — Why XCL Is Stuck at 1–4 FPS & 27–50 GB Memory XCL has cleared the hardest correctness milestone: large retail workloads reach the world with accurate colors and lighting. Yet `main` still runs at **1–4 FPS** while consuming **16–27 GB local VRAM** and **36–50 GB committed RAM** (`#2688`, `#1773`, `#646`), and NVIDIA GPUs continue hitting silent `0x887a0005` removals (`#2403`, `#1452`), multi-minute `nvgpucomp64` stalls (`#156`, `#2088`), or silent present freezes. Line-level auditing of `xcl/crates/xcl/src/` (`Cargo.toml`, `vram.rs`, `sparse.rs`, `pso_async.rs`, `present.rs`, `title_textures.rs`, `list_x.rs`, `bind.rs`, `real.rs`, `submit_cost.rs`, `ram_budget.rs`, `dstorage.rs`, `gameinput.rs`, `kbm.rs`, `playstation.rs`) and full deduplication against all 3,775+ XCL issues, PRs, and code-review comments isolate **six structural walls** that surface micro-patches cannot solve: 1. **CPU Submission, Per-Draw Churn & Lock Contention:** `xcl/Cargo.toml` release builds still omit Thin LTO and `codegen-units = 1` (leaving 1.5–2× submission-path speed on the table); the recording thread still suffers per-draw heap allocations, redundant constant/descriptor copies, unbatched mesh/indirect draws, write-combined (WC) console-heap scans, and `PAGES.lock()` contention (including newly merged `#3553` holding `PAGES` during `QueryInterface`/allocations). 2. **`GetWriteWatch` 1.5 GiB Pre-Submit Tax & Full-Texture Detiling:** `GetWriteWatch` burns **26–35 s per 200 s** (`#582`) scaling with watched address space; write-watched textures detile whole textures instead of only written mip levels; read-only root UAVs trigger multi-GB unnecessary guest-memory comparisons per frame; and `STREAM_RECHECK` leaks retired entries (`#2578`). 3. **Unconditional VRAM Mirroring, 64 MiB Pool Fragmentation & Non-Evicting Budget Stub:** Sparse tiles default to `D3D12_HEAP_TYPE_DEFAULT` (`sparse.rs:3536, 3714`), placed textures are duplicated (`#1773`), 64 MiB pool heaps trap **1.5–2.0 GB** in wholly free 4 MiB chunks (`#1773`), `vram.rs:135–150` confirms `XCL_TEXTURE_BUDGET_EVICT=1` **tracks SRV metadata only without evicting anything**, and `#3587`'s fixed 2,048 MiB margin permanently traps 6–8 GB GPUs in Over-Pressure! 4. **NVIDIA 512 MB Shader-Code Heap Wall & Unresolved Driver Edge Cases (`#2403`):** `pso_async.rs:495` hardcodes `is_evictable()` to **`PipelineKind::Compute` only** (Graphics PSOs are never evicted, and the eviction stage is still `#[allow(dead_code)]`). Even raising the driver heap to 2,048 MB did not prevent silent present freezes on RTX 5070 Ti driver `610.88` after 1,800 frames (`#2403`), proving Graphics+Compute LRU PSO eviction + persistent pipeline libraries (`#3633`) are mandatory. 5. **Zero Hardware Upscaling / Frame Generation / Reflex Bridge:** XCL has **0 open PRs** for intercepting native `ffxCreateContext`/`ffxDispatch` upscaler calls (which already provide jittered color, depth, and motion vectors) into NVIDIA Streamline DLSS Super Resolution + DLSS-G Frame Gen + Reflex or AMD FSR 3.1 FG, and `present.rs:1661` still calls `sc.Present(0, DXGI_PRESENT(0))` without `ALLOW_TEARING` (`#2756`). 6. **Windows PC Controls & UX Gaps:** `kbm.rs` whips the camera after >100 ms poll gaps (`#963`), ignores absolute mice (`#962`), and has no mouse-wheel bindings; `playstation.rs:111` hardcodes a **128-byte `ReadFile` buffer** that fails immediately on 547-byte DualShock 4 Bluetooth reports (`#2465`); `gameinput.rs` hits `0x80000003` on device callbacks (`#3583`); and `present.rs` uses jagged DWM bilinear scaling (`#554`) with no live F1/F3 tuning HUD. --- ## Proven Dead-Ends & Measured Traps (Do Not Repeat!) * **DO NOT multithread `GetWriteWatch` resets (`#582`):** Measured on Ryzen 7 9800X3D — sibling threads contend on the kernel page-table lock, making each reset **2.5–3× slower**. Win by *eliminating/narrowing* watched ranges (`XCL_SPARSE_DIRECT`, refused-range caching, VEH read-only physical blocks, written-mip-only detiling). * **DO NOT optimize `cached_watch_ranges` rebuilds (`#582`):** Costs 0.2 µs; 99.7% of wall time is inside `GetWriteWatch`. * **DO NOT enforce blunt process memory caps that refuse title commits (`#1566`, `#2639`):** A 13,824 MB cap refused required startup texture pages and killed the title at 11.7 s. Reduce XCL-owned mirrors/pools/staging and report truthful `XMem` headroom instead. * **DO NOT chase minor pixel-shader instruction-count cuts for FPS right now (`#3535`):** Shrinking 301 of 1,714 pixel shaders on an RTX 4090 left world FPS frozen at **~0.2 FPS**. The bottleneck is CPU submission, write-watch/memory traffic, VRAM thrashing, and missing upscaling/FG. * **DO NOT blindly shard cold guard tables without profiling:** 64-sharding opened-guard sets produced **0 FPS gain** in benchmarked runs. * **DO NOT duplicate already-merged work:** `CLZERO` loop AOT patching (`#2892`), `XCL_UMA_DRIVER=mixed` (`#3005–#3007`), NVIDIA driver-heap UMA windows (`#2844`), `XCL_RESIDENCY_PRIORITY` (`#3156`), `DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE` (`gpu/adapter.rs:129`), and cursor release while dragging (`#176`) are already on `main`. --- ## Master Workstream Matrix & Agent Claim Board (28 Deduplicated Workstreams) **How to claim:** Comment `Claiming <ID> — <branch/PR> — <GPU / RAM>` (e.g., `Claiming PERF-02 — pr/zero-alloc-submit — RTX 4050 6GB / 16GB RAM`). Include before/after telemetry from `submit_cost.rs`, `XCL_GPU_PROFILE=1`, and DXGI `QueryVideoMemoryInfo`. | ID | Track | Prio | Target Breakthrough | Primary XCL Files | Related Live Issues / PRs | |---|---|---|---|---|---| | `PERF-01` | A — FPS | **P0** | Thin LTO + `codegen-units = 1` default release profile (1.5–2× submit win) | `Cargo.toml` | Open PR `#3604` | | `PERF-02` | A — FPS | **P0** | Zero-alloc per-draw recording, `CBV_ONCE`, lockless desc heap & `InitHeaders` replay | `hle/d3d12x/{list_x.rs,bind.rs,real.rs}` | `#2688`, `#3222` | | `PERF-03` | A — FPS | **P0** | Per-draw parameter SRV mesh batching (~70× CPU / ~2× GPU) & indirect barrier batching (~48×) | `hle/d3d12x/{list_x.rs,barrier_groups.rs,indirect_guard.rs}` | `#2688` (net-new) | | `PERF-04` | A — FPS | **P0** | Host-RAM V# bitset (65× faster, 0 WC reads) & read-only root UAV skip (12.8→2.7 GB/frame) | `hle/d3d12x/{console_heap.rs,bind.rs,real.rs}` | `#2688` (net-new) | | `PERF-05` | A — FPS | **P0** | Escape 1.5 GiB `GetWriteWatch` tax (refused cache, VEH RO blocks, interval-skip, AVX2 merge) | `hle/d3d12x/{watch.rs,sparse.rs,title_textures.rs}` | `#582`, open `#3649`, `#3677` | | `PERF-06` | A — FPS | **P0** | Async GPU submission relay, non-blocking mip uploads, `EnqueueMakeResident` & `Wait64` elision | `hle/d3d12x/{queue_submit.rs,real.rs,fence_x.rs}` | `#2688`, `#505`, open `#2523` | | `PERF-07` | A — FPS | **P0** | Coalesce dirty copy ranges, written-mip-only detile (7–12×) & threaded `UpdateTileMappings` | `hle/d3d12x/{sparse.rs,texture_upload.rs}` | `#2688`, open `#3651`, `#3701` | | `PERF-08` | A — FPS | **P0** | Intercept native `ffxCreateContext`/`ffxDispatch` → DLSS SR + DLSS-G / FSR 3.1 FG + Reflex | `hle/d3d12x/present.rs`, new `gpu/upscale.rs` | Net-new (0 open PRs) | | `PERF-09` | A — FPS | **P1** | Land `ALLOW_TEARING` (`#2756`) + 3-buffer waitable flip-discard + QPC frame pacing | `hle/d3d12x/{present.rs,frame.rs}` | Open PR `#2756`, `#554` | | `PERF-10` | A — FPS | **P1** | Zero-cost `XCL_RAYTRACING=off` BVH bypass, Intel P-core/CCD0 affinity, DirectStorage & XMA speed | `gpu/bvh.rs`, `hle/{kernelx.rs,dstorage.rs,xma2/mod.rs}` | `#2688` (net-new) | | `MEM-01` | B — RAM/VRAM | **P0** | Eliminate VRAM double-mirroring: default lazy tiles, L0/L1 tiering & idle CPU tile drop | `hle/d3d12x/{sparse.rs,title_textures.rs,uma_driver.rs}` | `#1773`, `#2825`, `#646`, open `#3695` | | `MEM-02` | B — RAM/VRAM | **P0** | Make `XCL_TEXTURE_BUDGET_EVICT` (`vram.rs:135`) perform monotonic, fence-safe LRU eviction | `hle/d3d12x/{vram.rs,bind.rs,late_release.rs}` | `#1773`, `#2688` | | `MEM-03` | B — RAM/VRAM | **P0** | Fix `#3587` 6–8 GB Over-Pressure trap, dynamic RT reserve & 85% empty-block pool cap | `hle/d3d12x/{vram.rs,memory_report.rs,alloc_pool.rs}` | Open `#3587`, `#1773` | | `MEM-04` | B — RAM/VRAM | **P0** | 4 MiB sparse pool chunks (reclaim 1.5–2 GB), 64 MB section split & fix `#3553` `PAGES` lock | `hle/d3d12x/{sparse.rs,vram.rs,sharded.rs}` | `#1773`, `#3553`, `#3593`, `#3011` | | `MEM-05` | B — RAM/VRAM | **P0** | Host-memory admission control, indirect scratch pooling, trim protection & truthful `XMem` stats | `ram_budget.rs`, `hle/d3d12x/alloc_pool.rs`, `hle/kernelx.rs` | `#2639`, `#646`, `#2688` | | `MEM-06` | B — RAM/VRAM | **P1** | File-backed cold shadow memory, DirectStorage semaphore & fix `#2578`/`#1049` leaks | `hle/d3d12x/{title_textures.rs,uma_driver.rs}`, `hle/dstorage.rs` | `#2578`, `#1049`, `#2639` | | `NV-01` | C — NVIDIA/Crash | **P0** | Break 512 MB NVIDIA shader-code wall: Graphics+Compute PSO LRU (`pso_async.rs:495`) + 610.88 guard | `hle/d3d12x/pso_async.rs`, `shaders/pipeline_library.rs` | `#2403`, `#1452`, open `#3633` | | `NV-02` | C — NVIDIA/Crash | **P0** | Kill `nvgpucomp64` stalls, prune unused compute PSOs (`#3442`) & persist libraries (`#3633`) | `hle/d3d12x/pso_async.rs`, `gpu/recomp/{dxc.rs,pso.rs}` | `#156`, `#2088`, `#2595`, `#3633` | | `NV-03` | C — NVIDIA/Crash | **P0** | Fix live Dec 2 review regressions: `#3561` (`IO_LOOP_BUDGET`), `#3591` (HLSL `execz`), `#3549` | `gpu/dxil/{kernel.rs,lower.rs}`, `hle/d3d12x/sparse.rs` | `#3561`, `#3591`, `#3549`, `#3553` | | `NV-04` | C — NVIDIA/Crash | **P0** | Eradicate producerless `Wait64BitValueX` hangs, panic-stuck PSO queues & watchdog kills | `hle/d3d12x/{fence_x.rs,gpu_awake.rs,pso_async.rs}` | `#505`, `#1452`, open `#3670` | | `NV-05` | C — NVIDIA/Crash | **P1** | Fix Series S `uma_coherent.txt` (`#3568`), GPU indirect validation, shared-tex size & `0xC0000005` | `hle/d3d12x/{uma_driver.rs,indirect_guard.rs,guard.rs}` | `#3568`, `#675`, `#846`, `#662` | | `NV-06` | C — NVIDIA/Crash | **P1** | Upgrade `dred.rs` with automatic root-cause classification & light-DRED diagnostic default | `hle/d3d12x/dred.rs`, `stall.rs` | `#2403`, `#1452` | | `CTRL-01` | D — PC Controls | **P0** | Fix `kbm.rs` >100 ms camera whip (`#963`), absolute mouse (`#962`) & wheel/deadzone/GTA preset | `hle/kbm.rs` | `#963`, `#962` | | `CTRL-02` | D — PC Controls | **P0** | Fix `playstation.rs:111` 128B→547B DualShock 4 BT crash (`#2465`) & callback trap (`#3583`) | `hle/playstation.rs`, `hle/gameinput.rs` | `#2465`, `#3583` | | `CTRL-03` | D — PC Controls | **P1** | Modern multi-controller backend (SDL3 / DualSense / hotplug / ghost-pad filter / trigger rumble) | `hle/gameinput.rs`, `hle/playstation.rs` | `#692` | | `CTRL-04` | D — PC Controls | **P1** | High-quality present scaling (`#554`), DPI awareness & Alt+Enter borderless fullscreen | `hle/d3d12x/present.rs`, `hle/kbm.rs` | `#554`, open `#3672` | | `CTRL-05` | D — PC Controls | **P1** | Built-in lightweight F3 Telemetry HUD & F1 Live Settings Menu (saved to `xcl.toml`) | `hle/d3d12x/present.rs`, `config.rs` | Net-new | | `CTRL-06` | D — PC Controls | **P2** | Audio thread priority & XMA2/Opus stutter immunity during heavy CPU streaming | `hle/xaudio2.rs`, `hle/xma2/mod.rs`, `hle/opus.rs` | `#1728`, `#926` | --- ## Track A — Aggressive FPS Architecture (Target: 3–4 FPS → 30–60+ FPS) ### `PERF-01` — Promote Thin LTO + `codegen-units = 1` to Default Release Profile - **Priority:** `P0` | **Files:** `Cargo.toml` | **Related:** Open PR `#3604` - **Code Audit:** `Cargo.toml` currently sets only `debug = 2` under `[profile.release]`, leaving default `codegen-units = 16` and no LTO. Cross-module hot calls across `list_x.rs`, `bind.rs`, `real.rs`, `sparse.rs`, and `vram.rs` lose inlining opportunities worth **1.5–2× on the CPU submission path**. - **Action:** Land `#3604` and make `lto = "thin"` + `codegen-units = 1` (retaining `debug = 2` for crash symbolication) the standard release profile. - **Target:** 25–50% drop in CPU recording/submission time in `submit_cost.rs` with zero debug-symbol loss. ### `PERF-02` — Zero-Alloc Per-Draw Submission, `CBV_ONCE`, Lockless Descriptor Heap & `InitHeaders` Replay - **Priority:** `P0` | **Files:** `crates/xcl/src/hle/d3d12x/{list_x.rs,bind.rs,real.rs,alloc_pool.rs}` | **Related:** `#2688`, `#3222` - **Think HARD — Breakthrough Investigation:** 1. **Analyze meticulously** every `Vec` allocation and mutex lock on the per-draw path in `list_x.rs` and `bind.rs` (10,000+ draws/frame). 2. Replace per-draw root-constant and descriptor-table slot allocations with per-command-list bump/arena scratch slabs reset cleanly on `Reset()`. 3. **`CBV_ONCE` & unaligned root-CBV dedup:** Reuse a single upload copy for all draws in a list referencing identical unchanged CBV bytes until next written; copy unaligned root constant buffers once per list; reuse own-byte copy buffers across descriptor binds. 4. **Lockless descriptor-heap host lookup & fast-hash table cache:** Once a console heap's host `ID3D12DescriptorHeap` exists, return it lock-free; cache rebuilt descriptor tables by fast 64-bit hash + exact compare. 5. Keep pipelines and shader-written range declarations once per list, use SSE2 moves for `< 1 KiB` updates, and batch `InitHeaders` title-memory stores from a compact record. - **Target:** Single-thread submit recording drops **≥ 50%** (to **< 12 ms/frame** on 10k-draw scenes). ### `PERF-03` — Per-Draw Parameter SRV Mesh Batching & Indirect Draw Barrier Batching - **Priority:** `P0` | **Files:** `crates/xcl/src/hle/d3d12x/{list_x.rs,barrier_groups.rs,indirect_guard.rs}` | **Related:** `#2688` (Net-new — 0 open PRs) - **Think HARD — Breakthrough Investigation:** 1. **Mesh Draw Batching Beyond Strict State Adjacency:** When consecutive mesh/graphics draws share pipeline & root signature and differ only in per-draw root constants/parameters, pack per-draw parameters into a single SRV table and issue one batched `ExecuteIndirect` / multi-draw — proven in synthetic D3D12 benchmarks on RTX 5070 Ti (4,096 mesh draws) to cut **CPU recording ~70× (`0.118 → 0.0016 ms`)** and **GPU execution ~2× (`0.068 → 0.035 ms`)**. 2. **Batch Indirect Draw Barriers (`barrier_groups.rs`):** Coalesce per-draw resource barriers across compatible indirect draw sequences into single batched barrier submissions — proven on 3,200 indirect draws to cut barrier overhead **~48× (`30.54 → 0.64 ms`)**. 3. Run small spread dispatches (`≤ 65,535` groups) through the plain direct signature without extra indirection. - **Target:** ≥ 50% drop in `list_x.rs` draw/barrier submission overhead on dense city scenes. ### `PERF-04` — Host-RAM Bitset for Live Console-Heap V# Slots & Read-Only Root UAV Write-Back Elision - **Priority:** `P0` | **Files:** `crates/xcl/src/hle/d3d12x/{console_heap.rs,bind.rs,real.rs}`, `crates/xcl/src/gpu/recomp/` | **Related:** `#2688` (Net-new) - **Think HARD — Breakthrough Investigation:** 1. **Host-RAM Live V# Slot Bitset (`console_heap.rs`):** Track live console-heap V# slots in a compact host-RAM bitset instead of linearly scanning write-combined (WC) heap copies — eliminates 100% of catastrophic WC CPU reads (**~65× faster**, `60.30 µs → 0.93 µs`). 2. **Read-Only Root UAV Detection:** Analyze translated shader metadata to identify root UAVs that a shader only *reads* (never writes), skipping them completely from post-dispatch write-back / dirty-comparison scans — capable of slashing per-frame guest memory comparisons by **~75–80%** (e.g., `12.8 GB → 2.7 GB/frame`). - **Target:** Zero WC heap scans on the submit thread; ≥ 60% drop in per-frame UAV readback/compare traffic. ### `PERF-05` — Escape the 1.5 GiB `GetWriteWatch` Storm & Lock-Free Watch/Refresh Hot Paths - **Priority:** `P0` | **Files:** `crates/xcl/src/hle/d3d12x/{watch.rs,sparse.rs,title_textures.rs,submit_cost.rs}` | **Related:** `#582`, open PRs `#3649`, `#3677` - **Diagnosis:** `#582` measured **35,369 ms** of `GetWriteWatch` per 200 s on RTX 5080 (still **26,190 ms** with `XCL_WATCH_HOT=1`). Do **NOT** multithread `GetWriteWatch` (proven 2.5–3× slower in `#582`). - **Think HARD — Breakthrough Investigation:** 1. **Land & tune `#3649` / `#3677`** (2–4 MiB watch-range blocks + adaptive hot-block retention) and **cache kernel-refused ranges** so `GetWriteWatch` is never re-called on rejected view memory; eliminate `VirtualQuery` in write-fault waits. 2. **Interval-skip absent placeholders (`RangeSet`) & coalesce `VirtualProtect` runs** (~5.9× faster on sparse views) + **O(1) envelope fast path** on `title_textures::refresh_once` (~8× faster on localized dirty ranges). 3. **Two-tier dirty tracking:** Leave uploaded 64 KiB physical-section blocks `PAGE_READONLY` with a lock-free VEH dirty-bitset handler (0.00 µs/submit when untouched) + **AVX2 fast-path skip-unchanged writes** (~1.7× faster, `6.8 GB/s`) + incremental card hashing for ≥ 64 KiB hot buffers. 4. **Split hot lock contention & sift refresh batches with a scoped worker pool** (eliminating 60 ms idle-sweep stutters) and scope pre-submit scans strictly to ranges referenced by the current batch (`used_journal.rs` / `view_want.rs`). - **Target:** Pre-submit `write-watch` + `chunk scan` drops **≥ 10×** (to **< 12 ms/s** in `submit_cost.rs`). ### `PERF-06` — Async GPU Submission Relay, Non-Blocking Mip Uploads, `EnqueueMakeResident` & `Wait64` Elision - **Priority:** `P0` | **Files:** `crates/xcl/src/hle/d3d12x/{queue_submit.rs,real.rs,texture_upload.rs,fence_x.rs}` | **Related:** `#2688`, `#505`, open PR `#2523` - **Think HARD — Breakthrough Investigation:** 1. **Decoupled Async Submission Relay (2–3 batches in flight):** Let the title's `ExecuteCommandLists` hand prepared lists to a dedicated high-priority sender thread and return immediately, overlapping next-frame recording with upload/dispatch execution. 2. **Non-Blocking Streamed Mip Uploads (`NO_WAIT` + `UPLOAD_AHEAD`):** Never stall the direct graphics queue waiting for a streamed mip to detile/upload; bind the next-lower resident mip and atomically swap the SRV once the copy-queue fence completes (verifying fence completion before publication!). 3. **Async `ID3D12Device3::EnqueueMakeResident`:** Replace synchronous CPU-blocking `MakeResident` calls with async `EnqueueMakeResident` waited on by the GPU queue before first use. 4. **Elide Already-Satisfied `Wait64BitValueX` Waits & Track Cross-Queue Wakeups:** Check CPU-visible fence state before emitting GPU `Queue::Wait` — proven up to **26× faster** (eliding ~1,000 redundant fences) with **5.8× faster** cross-queue wakeups. - **Target:** Title submit thread < **8 ms/frame**; sustained GPU utilization > **85%**. ### `PERF-07` — Coalesced Dirty Copy Ranges, Written-Mip-Only Detiling & Threaded `UpdateTileMappings` - **Priority:** `P0` | **Files:** `crates/xcl/src/hle/d3d12x/{sparse.rs,texture_upload.rs,title_textures.rs}` | **Related:** `#2688`, open PRs `#3651`, `#3701` - **Think HARD — Breakthrough Investigation:** 1. **Read & detile ONLY the written mip levels of write-watched textures** (0 open XCL PRs — proven **7–12× faster**, `54–66 µs` vs `385–496 µs`), paired with landing `#3651` (GPU compute 2D detiling) and `#3701` (direct-upload volume-mip detiling). 2. **Coalesce contiguous dirty page parts** (8–16 adjacent runs → one `CopyBufferRegion` / `CopyTextureRegion` + one barrier) and parallelize independent small copy runs. 3. **Compact unpublished remap bursts & thread `UpdateTileMappings` (`sparse.rs:3636–3702`):** Merge contiguous tile coordinates into multi-range calls on a dedicated mapping thread outside `PAGES.lock()`. - **Target:** ≥ 50% reduction in `Copy*` and `UpdateTileMappings` D3D12 calls/frame; 7–12× faster partial texture updates. ### `PERF-08` — Native Upscaler & Frame-Generation Bridge at `ffxCreateContext` / `ffxDispatch` (DLSS SR + DLSS-G / FSR 3.1 FG + Reflex) - **Priority:** `P0` | **Files:** `crates/xcl/src/hle/d3d12x/present.rs`, `crates/xcl/src/gpu/adapter.rs`, new `crates/xcl/src/gpu/upscale.rs` | **Related:** Net-new (0 open PRs in all 3,775 XCL items!) - **Think HARD — Breakthrough Investigation:** 1. **Intercept the FidelityFX Upscaling Seam (`ffxCreateContext`, `ffxDestroyContext`, `ffxDispatch`, `ffxQuery`):** Console titles already pass jittered low-res color, depth, motion vectors, exposure, reactive mask, and camera constants straight into `ffxDispatch`. 2. **Build a clean-room, opt-in Host Upscaling & Frame-Gen Backend** (dynamically loading user-supplied official NVIDIA Streamline or AMD FidelityFX SDK DLLs with signature/hash validation — zero proprietary binaries in repo): - **NVIDIA RTX 20/30/40/50:** Streamline **DLSS Super Resolution** (DLAA / Quality / Balanced / Performance / Ultra Performance) + **NVIDIA Reflex** low-latency markers + **DLSS Frame Generation** (2× on RTX 40, up to 4× on RTX 50). - **RTX 20/30, AMD & Universal Fallback:** AMD FidelityFX SDK **FSR 3.1 Super Resolution + 2× Frame Generation**. - **Low-End 6–8 GB VRAM Render-Scale Clamping:** Allow 720p/900p internal render targets upscaled cleanly to 1080p/1440p — cutting pixel-shader GPU cost AND render-target VRAM together. 3. Guard against 8 GB FG device-removal spikes (monitor DXGI headroom before enabling FG; gracefully drop FG if VRAM headroom falls below safe threshold) and composite HUD/UI cleanly after upscaling/FG. - **Target:** **1.6×–2.2× native FPS gain** via DLSS/FSR SR + **2× smoothness** via DLSS-G / FSR 3.1 FG (30–60+ FPS on 6–8 GB RTX 4050/4060/3060 cards). ### `PERF-09` — Land `ALLOW_TEARING` (`#2756`), 3-Buffer Waitable Flip-Discard & QPC Frame Pacing - **Priority:** `P1` | **Files:** `crates/xcl/src/hle/d3d12x/{present.rs,frame.rs}` | **Related:** Open PR `#2756`, `#554` - **Code Audit:** `present.rs:1661` calls `sc.Present(0, DXGI_PRESENT(0)).ok()` without `DXGI_PRESENT_ALLOW_TEARING`. - **Action:** Land `#2756`, upgrade to **3-buffer `DXGI_SWAP_EFFECT_FLIP_DISCARD`** with `DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT` (max latency 2–3), add a hybrid sleep+spin `XCL_FPS_CAP`, and hold `SetThreadExecutionState(ES_DISPLAY_REQUIRED)` during play so gamepad-only sessions never trigger sleep/screensaver. - **Target:** Zero DWM composition stalls; p95/p99 frame-time jitter cut **≥ 40%**. ### `PERF-10` — Zero-Cost `XCL_RAYTRACING=off` BVH Bypass, Intel P-Core/CCD0 Affinity & DirectStorage/XMA Speed - **Priority:** `P1` | **Files:** `crates/xcl/src/gpu/bvh.rs`, `crates/xcl/src/hle/{kernelx.rs,dstorage.rs,xma2/mod.rs}` | **Related:** `#2688` - **Think HARD — Breakthrough Investigation:** 1. **Zero-Cost `XCL_RAYTRACING=off` BVH Bypass:** When RT is disabled, elide batched BVH build/rehydrate/copy dispatches cleanly (returning minimal prebuild sizes and advancing fences immediately) to reclaim both GPU frame time and hundreds of MB of BVH scratch VRAM. 2. **Hybrid Intel P-Core / AMD V-Cache CCD0 Affinity (`kernelx.rs`):** Translate `SetThreadGroupAffinity` / `SetThreadAffinityMask` via `GetSystemCpuSetInformation` so title render/submit/audio threads stay on **P-cores / CCD0**, while XCL's background PSO-compile and detile workers run on **E-cores / secondary CCD**. 3. **DirectStorage & XMA2 Hot-Path Wins:** Reuse per-worker `DecompressorOxide` + scratch buffers in `dstorage.rs` (~1.74× faster decompression, zero per-request heap churn), add sorted 3-worker read scheduling for HDDs, and add a single-packet fast path in `xma2/mod.rs` (2–11× faster XMA frame extraction). - **Target:** Zero BVH overhead under `XCL_RAYTRACING=off`; zero E-core preemption spikes on Intel 12th–14th Gen HX/desktop CPUs. --- ## Track B — Aggressive RAM & VRAM Compression (Target: 27 GB VRAM / 50 GB Commit → ≤ 6–8 GB VRAM / ≤ 16 GB RAM) ### `MEM-01` — Eliminate VRAM Double-Mirroring: Default Lazy Tiles, L0/L1 Tiering & Idle CPU Mirror Drop - **Priority:** `P0` | **Files:** `crates/xcl/src/hle/d3d12x/{sparse.rs,title_textures.rs,uma_driver.rs}` | **Related:** `#1773`, `#2825`, `#646`, open PR `#3695` - **Diagnosis:** Every 64 KiB sparse tile defaults to `D3D12_HEAP_TYPE_DEFAULT` (`sparse.rs:3536, 3714`), placed textures are duplicated (`#1773`), and idle CPU tile copies stay committed (`#2825`). On RTX 3080 10 GB, even `XCL_TEXTURE_LEVEL_PAGES=1` still sits at **15.9 GB local VRAM** against a 9.0 GB budget (`#1773`); meanwhile, placing title GPU heaps in local VRAM and cold sparse buffers/streamed levels in **system memory (`L0`)** let RTX 3080 10 GB run **900 s crash-free** (`#1452`/`#2688`). - **Think HARD — Breakthrough Investigation:** 1. Promote `XCL_SPARSE_LAZY=1` and `XCL_TEXTURE_LEVEL_PAGES=1` to safe defaults. 2. **Automatic L1 (VRAM) vs. L0 (System Memory) Tiering:** Keep render targets, depth/stencil, active shaders, and hot top-mip textures in `L1`; automatically place cold sparse buffers, coherent windows, and non-hot streamed mips in `L0` (`D3D12_HEAP_TYPE_CUSTOM` / `MEMORY_POOL_L0`) when DXGI local budget ≤ 10 GB. 3. **De-duplicate Placed Textures & Drop Idle CPU Tile Copies (`#2825`):** Reclaim redundant sparse tiles once detiled and `VirtualFree(MEM_DECOMMIT)` idle CPU tile mirrors (reading back only on rare CPU touch). Land `#3695` (coherent window sized by live GPU heaps). - **Target:** Local VRAM cut **≥ 55%** (**≤ 5.5–7.2 GB** on 6–8 GB cards in Lockhart/Series S mode). ### `MEM-02` — Turn `XCL_TEXTURE_BUDGET_EVICT` (`vram.rs:135–150`) Into Real, Monotonic, Fence-Safe LRU Eviction - **Priority:** `P0` | **Files:** `crates/xcl/src/hle/d3d12x/{vram.rs,bind.rs,late_release.rs}` | **Related:** `#1773`, `#2688` - **Code Audit:** `vram.rs:135–150` explicitly states `XCL_TEXTURE_BUDGET_EVICT=1` **tracks SRV metadata only** — it does zero actual eviction or safe descriptor replacement. - **Think HARD — Breakthrough Investigation:** 1. Poll `IDXGIAdapter3::QueryVideoMemoryInfo` (Local & Non-Local) every ~100 ms; trigger soft trim at **82% of `Budget`** and aggressive LRU eviction at **90% of `Budget`**. 2. **Monotonic, Fence-Safe LRU Texture Eviction + Safe Fallback SRV:** Track `last_used_frame` in `bind.rs`; evict coldest top-mip textures via `ID3D12Device::Evict` or fence-deferred release (`late_release.rs`) while atomically repointing their descriptors to a **resident lower-mip / 1×1 fallback SRV** (preventing GPU page faults), enforcing eviction monotonicity + a **4 MiB progress floor** with a **2,000 ms cooldown** to avoid thrashing (proven to cut streaming eviction stalls from **10.87 ms → 2.04 ms**). 3. Scale texture allocation floor / mip bias dynamically to the real VRAM budget on 4–6 GB GPUs. - **Target:** On 6–8 GB GPUs, DXGI `CurrentUsage` stabilizes **≤ 92% of `Budget`** across 30+ min of roaming with zero WDDM thrashing. ### `MEM-03` — Fix `#3587` 6–8 GB Over-Pressure Trap, Dynamic Render-Target Reserve & 85% Empty-Block Pool Cap - **Priority:** `P0` | **Files:** `crates/xcl/src/hle/d3d12x/{vram.rs,memory_report.rs,alloc_pool.rs}` | **Related:** Open PR `#3587`, `#1773` - **Code-Review Audit (`#3587`):** - Fixed 2,048 MiB margin in `target.saturating_sub(HYSTERESIS)` causes **6–8 GB GPUs to get permanently stuck in Over-Pressure** and never return to `Room`! - When `local_segment()` returns `None`, `refresh()` never resets `PRESSURE`. - `take_tiles_with_fallback`'s L0 path never falls back to `DEFAULT` when L0 `CreateHeap` fails. - `sweep_and_reclaim` clears `vram_oom_until` when reclaiming L0 (system-RAM) heaps that freed **0 bytes of VRAM**. - **Action:** Fix all 4 `#3587` defects; scale render-target headroom reserve proportionally to DXGI budget (e.g., **512 MiB–1.5 GiB on 6–8 GB cards** instead of a fixed 2–3 GiB reserve); and cap retained empty texture-pool blocks strictly under the **85% budget line** (reclaiming ~512 MB at peak on 8 GB cards). - **Target:** Clean pressure-state hysteresis and ≥ 512 MB lower peak VRAM on 6–8 GB GPUs. ### `MEM-04` — 4 MiB Sparse Pool Chunks (Reclaim 1.5–2 GB), 64 MB Section Split & Fix `#3553` `PAGES` Lock - **Priority:** `P0` | **Files:** `crates/xcl/src/hle/d3d12x/{sparse.rs,vram.rs,sharded.rs,console_heap.rs}` | **Related:** `#1773`, `#3553`, `#3593`, `#3011` (`C115`) - **Measured Evidence:** - `#1773` (`@imnicho`): **64 MiB sparse pool heaps trap 1.5–2.0 GB of VRAM and commit** after the title frees tiles, with most free space sitting in wholly free **4 MiB pieces**! - `#3011` (`C115`): Lazily committed allocations in one giant section caused 225 per-page lock waits taking **342 of 367 ms**; splitting into **≤ 64 MiB sections** eliminates the lock bottleneck. - `#3553` (just merged Dec 2, flagged by `@bmjask`): `live_reserved_for` runs `QueryInterface`/allocations **inside the global `PAGES` mutex**, and timed-out `wait_new_placement` returns an unready texture anyway! - **Action:** Shrink sparse pool heap granularity from 64 MiB → **4 MiB (or 8 MiB)**; split lazy-commit regions into ≤ 64 MiB sections; shard `PAGES.lock()` by 64 MiB buckets (`sharded.rs`); move `live_reserved_for`, COM `Release`, `UpdateTileMappings`, and zero-fills (`#3593`) **strictly outside all page locks**; and fix timed-out `wait_new_placement` handling. - **Target:** **1.5–2.0 GB immediate VRAM/commit savings**; `refresh lock wait` < **0.1 ms/submit**; zero AB-BA deadlocks. ### `MEM-05` — Host-Memory Admission Control, Indirect Scratch Pooling, Working-Set Trim Protection & Truthful `XMem` Stats - **Priority:** `P0` | **Files:** `crates/xcl/src/ram_budget.rs`, `crates/xcl/src/hle/d3d12x/alloc_pool.rs`, `crates/xcl/src/hle/kernelx.rs` | **Related:** `#2639`, `#646`, `#2688` - **Think HARD — Breakthrough Investigation:** 1. **Admission Control & Indirect Scratch Pooling (`alloc_pool.rs`, `ram_budget.rs`):** Pool indirect-batch scratch buffers back on list completion (unpooled indirect scratch has been measured leaking **3.2 GB VRAM** and spiking GPU time 4×!). Enforce commit headroom floors (e.g., 512 MiB for speculative uploads, 1 GiB for fresh 64 MiB upload-block growth) so speculative prefetch yields to mandatory game allocations without refusing title commits (`#1566`). 2. **Working-Set Trim Protection (`ram_budget.rs`):** Prevent Windows from abruptly trimming XCL's working set from ~15 GB → 2 GB under momentary RAM pressure (which tanks FPS by 50–70% for minutes while paging back in). 3. **Truthful, Host-Scaled `XMemGetWorkingSetStatistics` (`kernelx.rs`):** Scale reported working-set capacity to the host PC's actual RAM/VRAM tier (especially 16 GB RAM / Lockhart mode) so the game's own streamer naturally evicts distant LODs. - **Target:** Peak process commit stays **≤ 14–16 GB** on 16 GB RAM PCs with zero Windows working-set cliff drops. ### `MEM-06` — File-Backed Cold Shadow Memory, DirectStorage Cap & Fix `#2578` / `#1049` - **Priority:** `P1` | **Files:** `crates/xcl/src/hle/d3d12x/{title_textures.rs,uma_driver.rs}`, `crates/xcl/src/hle/dstorage.rs` | **Related:** `#2578`, `#1049`, `#2639` - **Code Audit:** - `title_textures.rs:994–1009` (`#2578`): `retire_overlapping` never removes retired entries from `STREAM_RECHECK`, leaking CPU re-hash work and memory over long sessions. - `#1049`: UI glyph atlases in `XCL_UMA_DRIVER=mixed`'s unwatched `GPU_UPLOAD` segment miss updates after first upload, dropping menu letters and drawing black HUD blocks. - **Action:** Purge retired entries from `STREAM_RECHECK` in `retire_overlapping` (`#2578`); re-check dynamic glyph/UI atlases in `GPU_UPLOAD` segments (`#1049`); add opt-in sparse temporary file backing (`FILE_ATTRIBUTE_TEMPORARY`) for cold >4 MiB shadow buffers on 16 GB RAM hosts; and enforce `XCL_DSTORAGE_MEMORY_BUDGET_MIB` as a strict semaphore on in-flight decompression scratch. - **Target:** Bounded `STREAM_RECHECK` over multi-hour runs; zero missing UI glyphs; zero `ERROR_COMMITMENT_LIMIT (1455)` crashes on 16 GB RAM. --- ## Track C — NVIDIA Compatibility & Zero-Crash Stability ### `NV-01` — Break the 512 MB NVIDIA Shader-Code Heap Wall (`pso_async.rs:495`) & `610.88` Silent Freeze - **Priority:** `P0` | **Files:** `crates/xcl/src/hle/d3d12x/pso_async.rs`, `crates/xcl/src/shaders/pipeline_library.rs` | **Related:** `#2403`, `#1452`, open PR `#3633` - **Code & Field Audit (`#2403`):** - `pso_async.rs:495` hardcodes `fn is_evictable(&self) -> bool { self.kind == PipelineKind::Compute }`, leaving Graphics PSOs pinned forever while the eviction/rebuild stage remains `#[allow(dead_code)]` (`pso_async.rs:142`). - Raising the NVIDIA driver shader heap to 1–2 GiB eliminated `0x887a0005` for 600 s+ on RTX 4080/5080/GTX 1650 — **but on RTX 5070 Ti driver `610.88`, even a 2,048 MB reserve still silently froze presents after 1,800 frames** (`#2403`, `@brainhay5`). - **Think HARD — Breakthrough Investigation:** 1. **Extend `is_evictable()` to BOTH Graphics AND Compute PSOs (`pso_async.rs:495`).** 2. **Automatic Fence-Safe LRU PSO Eviction on NVIDIA:** Track resident shader-code bytes (`GetCachedBlob` / calibrated estimator) and evict coldest completed-fence `ID3D12PipelineState` objects whenever resident code crosses ~384–416 MiB (scaling with detected heap profile), **retaining their recipe + persistent `ID3D12PipelineLibrary` entry (`#3633`)** for <1–2 ms re-hydration (or 1-frame safe async rebuild). 3. **Investigate the `610.88` silent present freeze (`#2403`):** Add a 10-second present-stall detector that dumps live PSO count, resident shader-code MB, pending queue fences, and driver version. - **Target:** Zero `0x887a0005` removals and zero silent present freezes across 60-min retail runs on 6–16 GB NVIDIA GPUs (drivers `610.88` & `621.40+`). ### `NV-02` — Kill `nvgpucomp64` Multi-Minute Stalls, Prune Unused PSOs & Persist Pipeline Libraries - **Priority:** `P0` | **Files:** `crates/xcl/src/hle/d3d12x/pso_async.rs`, `crates/xcl/src/gpu/recomp/{dxc.rs,pso.rs}`, `crates/xcl/src/shaders/pipeline_library.rs` | **Related:** `#156`, `#2088`, `#2595`, open PRs `#3633`, `#3442`, `#3670` - **Diagnosis:** A ~4 MB translated shader stalled `nvgpucomp64` for **951 s** (`#2088`); half of cold compute compile time goes to unused builds (`#3442`); 80k+ queued graphics PSOs starve 8 GB Ampere / RTX 3070 into black screens (`#2595`, `#2688`); and minor runtime rebuilds invalidate warm pipeline libraries (`#3633`). - **Think HARD — Breakthrough Investigation:** 1. **Land `#3633` (cross-build `ID3D12PipelineLibrary` persistence)** keyed by `(adapter_luid, driver_version, dxil_blake3, root_sig_hash, pso_state_hash)`. 2. **Land `#3442` (prune unused compute PSOs) and `#3670` (fault-tolerant preload workers)**; add a **reserved fast worker lane** for small/medium foreground draws (proven **~38× faster** small-request completion, `901 → 23.5 ms`) so >1 MB compute outliers can never starve world rendering. 3. Cap/outline DXIL constructs that trigger super-linear `nvgpucomp64` compiles and ensure panicking builds always complete their queue entry and log to a version-scoped `warm-bad.txt`. - **Target:** Cold-to-world time drops **≥ 5×**; warm-cache startup reaches world in **< 15 s** with zero >50 ms compile hitches. ### `NV-03` — Fix Live Dec 2 Code-Review Regressions (`#3561`, `#3591`, `#3549`) - **Priority:** `P0` | **Files:** `crates/xcl/src/gpu/dxil/{kernel.rs,lower.rs}`, `crates/xcl/src/hle/d3d12x/sparse.rs` | **Related:** `#3561`, `#3591`, `#3549` - **Verified Code-Review Findings (`@bmjask`, Dec 2):** 1. **`#3561` (Critical):** Lane-loop CFG walk drops the per-dispatch `IO_LOOP_BUDGET` loop-pass cap (`kernel.rs:558`), re-exposing infinite GPU loops / TDR hangs. 2. **`#3591` (High):** The NVIDIA `execz` miscompile workaround exists only in the direct DXIL pixel path, leaving the HLSL fallback path broken on NVIDIA, and `flat_skips` does not reject regions modifying `HW_REG_MODE` (`s_round_mode` / `s_denorm_mode`). 3. **`#3549` (Medium):** Permanently skipping `MEM_RESERVE`/`MEM_FREE` pages drops GPU results if the title commits that page concurrently. - **Action:** Patch all three before they compound into intermittent NVIDIA TDRs or silent rendering corruption. - **Target:** All three review findings closed with unit/GPU regression tests. ### `NV-04` — Eradicate Producerless `Wait64BitValueX` Hangs & `"GPU Loc Sig"` Watchdog Kills - **Priority:** `P0` | **Files:** `crates/xcl/src/hle/d3d12x/{fence_x.rs,gpu_awake.rs,watch.rs,real.rs}` | **Related:** `#505` (573 comments), `#1452` (77 comments) - **Think HARD — Breakthrough Investigation:** 1. **Discard unsubmitted waits immediately** when a command list is reset or released without submission. 2. **Cross-Queue Producer Registry (`fence_x.rs`):** Track every queued `Signal` / `WriteValueImmediate` VA + value across all queues; if a producer was skipped (uncompiled PSO or RT-off bypass), **never emit an unfulfillable GPU `Queue::Wait`** — log once and resolve safely. 3. **Harden `gpu_awake.rs` + bounded frame-hold timeout:** Keep GPU heartbeat timestamps advancing during bounded PSO waits, and stop waiting on slow pipelines once a frame has waited past a configurable threshold so the title's `"GPU Loc Sig"` watchdog never kills an actively progressing run. - **Target:** Zero producerless `Wait64BitValueX` hangs and zero false `"GPU Loc Sig"` watchdog terminations over 60-minute runs. ### `NV-05` — Fix Series S `uma_coherent.txt` (`#3568`), GPU Indirect Validation, Shared-Texture Sizing & `0xC0000005` - **Priority:** `P1` | **Files:** `crates/xcl/src/hle/d3d12x/{uma_driver.rs,indirect_guard.rs,guard.rs,vram.rs}`, `crates/xcl/src/hle/xg.rs` | **Related:** `#3568`, `#675`, `#846`, `#662`, `#232` - **Action:** 1. **Fix `#3568`:** Key `uma_coherent.txt` by `(title_id, console_profile, adapter_luid)` and bounds-check before mapping so Series X sizes never crash Series S (`lockhart`) runs at ~37 s. 2. **Zero-readback GPU pre-validation (`indirect_guard.rs`):** Clamp indirect draw counts/offsets via lightweight compute before `ExecuteIndirect` so malformed indirect buffers never page-fault NVIDIA GPUs (`#675`). 3. **Audit shared-texture allocation size queries** (always query allocation info from the texture's own description to prevent NVIDIA device removal) and close remaining `0xC0000005` ABI traps (`#662`, `#846`, `#232`). - **Target:** Multi-hour crash-free stability on both Series S (`lockhart`) and Series X (`anaconda`) profiles. ### `NV-06` — Actionable NVIDIA DRED Correlation & Automatic Crash Root-Cause Classifier - **Priority:** `P1` | **Files:** `crates/xcl/src/hle/d3d12x/dred.rs`, `stall.rs` | **Related:** `#2403`, `#1452` - **Action:** Default to light DRED only in diagnostic launches (zero runtime tax on normal runs), and on any `0x887A0005`/`0x887A0006`/watchdog exit print a 10-line **Pre-Crash Classifier Banner**: (1) resident NVIDIA shader-code MB & live PSO count, (2) DXGI Local/Non-Local Usage vs. Budget, (3) pending producerless `Wait64BitValueX` entries, (4) last 16 submitted PSO hashes + list types, and (5) explicit root-cause class (`NVIDIA_SHADER_HEAP_EXHAUSTION` | `VRAM_BUDGET_OOM` | `PRODUCERLESS_FENCE_HANG` | `GPU_PAGE_FAULT` with owning resource). - **Target:** Every crash log self-identifies its exact root cause in <10 lines. --- ## Track D — PC Controls, Windowing & Windows UX ### `CTRL-01` — Fix `kbm.rs` >100 ms Camera Whip (`#963`), Absolute Mouse (`#962`) & Wheel/Deadzone/GTA Keymap - **Priority:** `P0` | **Files:** `crates/xcl/src/hle/kbm.rs` | **Related:** `#963`, `#962` - **Action:** 1. **Fix `#963`:** Expire stale accumulated mouse deltas whenever `dt > 50 ms` or across focus/menu transitions so camera whip cannot happen. 2. **Fix `#962`:** Convert `MOUSE_MOVE_ABSOLUTE` `WM_INPUT` coordinates cleanly into per-frame deltas (RDP, VMs, tablets). 3. **PC Mouse-Look & Bindings:** Add bindable `WheelUp` / `WheelDown` and side buttons (`XBUTTON1`/`XBUTTON2`, currently 0 hits in XCL), configurable inner-deadzone compensation, separate X/Y & ADS sensitivity multipliers, optional GTA V PC-style default keymap preset in `xcl.toml`, and crash-safe `ClipCursor` release on Alt-Tab / panic. - **Target:** Crisp, whip-free PC mouse control across relative and absolute devices. ### `CTRL-02` — Fix `playstation.rs:111` 128B→547B DualShock 4 BT Crash (`#2465`) & Callback Trap (`#3583`) - **Priority:** `P0` | **Files:** `crates/xcl/src/hle/playstation.rs`, `crates/xcl/src/hle/gameinput.rs` | **Related:** `#2465`, `#3583` - **Code Audit:** `playstation.rs:111` hardcodes `let mut buf = [0u8; 128];` while DualShock 4 over Bluetooth requires a **547-byte** `HIDP_CAPS.InputReportByteLength` buffer (`#2465`), and `gameinput.rs` hits `0x80000003` on `RegisterDeviceCallback` (`#3583`). - **Action:** Query `HidP_GetCaps` dynamically in `playstation.rs` (buffer ≥ `max(caps.InputReportByteLength, 547)`), ensure NUL-terminated HID paths for `CreateFileW`, decode both BT (`0x11`) and USB (`0x01`) DualShock 4 / DualSense reports, and fix `RegisterDeviceCallback` + COM `QueryInterface` (`IID_IUnknown` + own IID) in `gameinput.rs`. - **Target:** Plug-and-play DualShock 4 & DualSense over USB & Bluetooth; zero callback traps. ### `CTRL-03` — Modern Multi-Controller Backend (SDL3 / Native HID, Hotplug, Ghost-Pad Filter & Trigger Rumble) - **Priority:** `P1` | **Files:** `crates/xcl/src/hle/gameinput.rs`, `crates/xcl/src/hle/playstation.rs` | **Related:** `#692` - **Action:** Add an opt-in SDL3 / native HID backend (`#692`) replacing slow empty-slot `XInputGetState(0..3)` polling (`gameinput.rs:149–193`), filter all-zero wireless receiver ghost pads, support mid-session hotplug/reconnect, impulse trigger rumble, DualSense/Switch Pro/generic pads, and seamless Controller ↔ KB+M auto-switching. - **Target:** Zero empty-XInput polling lag; working hotplug + trigger rumble across Xbox, PlayStation, and generic PC controllers. ### `CTRL-04` — High-Quality Present Scaling (`#554`), DPI Awareness & Alt+Enter Borderless Fullscreen - **Priority:** `P1` | **Files:** `crates/xcl/src/hle/d3d12x/present.rs`, `crates/xcl/src/hle/kbm.rs` | **Related:** `#554`, open PR `#3672` - **Action:** Land `#3672`, enable `PER_MONITOR_AWARE_V2` DPI awareness, add freeze-free **Alt+Enter Borderless Fullscreen**, and replace DWM's single bilinear tap (`#554`) with a lightweight bicubic/Lanczos or CAS-sharpen blit pass whenever `window_size != render_size`. - **Target:** Razor-sharp UI/text at any window size or Windows DPI scaling. ### `CTRL-05` — Built-In Lightweight F3 Telemetry HUD & F1 Live Settings Menu - **Priority:** `P1` | **Files:** `crates/xcl/src/hle/d3d12x/present.rs`, `crates/xcl/src/config.rs` | **Related:** Net-new - **Action:** Add an opt-in, zero-dependency pre-present D3D12 overlay: - **F3 Telemetry Bar:** Live FPS, avg/p95 ms, CPU submit ms vs. GPU ms, DXGI Local Usage / OS Budget / Dedicated Capacity, Process Commit, and Resident NVIDIA Shader-Code MB. - **F1 Live Settings Menu:** Runtime toggles for Upscaler (Off/DLSS/FSR 3.1), Frame Gen, Render Scale, `XCL_FPS_CAP`, VSync/Tearing, Mouse Sensitivity/Deadzone, and VRAM Budget Target — saved directly to `xcl.toml`. - **Target:** < 0.15 ms overhead when open, 0.00 ms when hidden; live tuning without restarting. ### `CTRL-06` — Time-Critical Audio Thread Priority & XMA2/Opus Stutter Immunity - **Priority:** `P2` | **Files:** `crates/xcl/src/hle/xaudio2.rs`, `crates/xcl/src/hle/xma2/mod.rs`, `crates/xcl/src/hle/opus.rs` | **Related:** `#1728`, `#926` - **Action:** Run the XMA2/Opus decode thread at `THREAD_PRIORITY_TIME_CRITICAL` so heavy shader-compile or streaming bursts never starve audio buffers, and treat `PacketSkipCount == 0xff` cleanly as end-of-stream. - **Target:** Zero audio crackle/dropouts during heavy streaming or shader compilation. --- ## Verification & Benchmarking Standard (Required for Every PR) | Metric | Measurement Source | Low-End Target (6–8 GB VRAM / 16 GB RAM) | Mid/High Target (12+ GB VRAM) | |---|---|---|---| | **Steady World FPS (avg / p95 ms)** | `XCL_GPU_PROFILE=1` / `present.rs` | **≥ 30 FPS** (native/upscaled), **≥ 60 FPS** w/ FG | **≥ 60 FPS** native/upscaled | | **CPU Submit Cost (avg ms/submit)** | `submit_cost.rs` | **< 2.0 ms** (`look` < 0.2 ms) | **< 1.0 ms** | | **DXGI Local VRAM Peak** | `QueryVideoMemoryInfo` | **≤ 5.5–7.2 GB** (≤ 92% budget) | **≤ 10–12 GB** | | **Process Private Commit Peak** | `GetProcessMemoryInfo` | **≤ 14–16 GB** | **≤ 20 GB** | | **NVIDIA Resident Shader-Code Peak** | `pso_async.rs` (`#2403`) | **≤ 416 MB** (0 `0x887a0005` removals) | **≤ 416 MB** (0 removals) | | **Crash-Free Soak** | World roam + camera + Alt-Tab | **≥ 30 min** (0 TDR / 0 AV / 0 watchdog) | **≥ 60 min** | [NOTE: You may go with your own open-ended proper tested solutions. The starting hypotheses provided are just for initial test runs]
Sign in to join this conversation.
No labels
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.

Reference
xcl-dev/xcl#3715
No description provided.