d3d12-gpu: castable R9G9B9E5 views over R32_UINT/SINT textures without copying (D3D12-ALIAS-CAST-R9G9B9E5) #2660

Closed
zmasi wants to merge 12 commits from upstream-pr/2660 into main
zmasi commented 2026-11-29 23:56:20 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-29T23:56:20Z.


Claimed in the coordination issue as: D3D12-ALIAS-CAST-R9G9B9E5 (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7249716729, https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7264381245)

What and why

Eliminates the per-frame GPU copy and duplicate VRAM cost of DXGI_FORMAT_R9G9B9E5_SHAREDEXP (67) shader views placed in the memory of shader-written DXGI_FORMAT_R32_UINT (42) and DXGI_FORMAT_R32_SINT (43) textures (d3d12/docs/findings.md "Aliased views of GPU-written textures: R9G9B9E5 over R32_UINT" and "Open: the copies behind aliased views could go"):

  • All 59 aliased views in the waterside scene (86 reads, ~390-395.6 MiB/frame across radiance/reflection/fog targets, 4-mip probe atlases, and 6-face sky cubes) are R9G9B9E5 SRVs placed over shader-written R32_UINT textures because console shaders pack RGB9E5 manually for RWTexture stores while D3D12_RESOURCE_DESC puts R32_UINT and R9G9B9E5_SHAREDEXP in different legacy typeless families.
  • Previously, every read copied the source texture into a second Default-heap R9G9B9E5 HostTexture (directly when LEONIDA_ALIAS_DIRECT=1 or through an intermediate staging buffer when LEONIDA_ALIAS_DIRECT=0), costing 1.6-3.6 ms/frame of GPU copy time plus duplicate texture and staging-buffer VRAM.
  1. Castable R32_UINT/R32_SINT Default-heap committed and placed texture creation (texture.rs, pool.rs, resource.rs):

    • Queries D3D12_FEATURE_D3D12_OPTIONS12 (EnhancedBarriersSupported && RelaxedFormatCastingSupported) via ID3D12Device10 (texture::relaxed_format_casting / texture::castable_r9g9b9e5, cached per adapter LUID without touching host.rs).
    • Creates single-sample, shader-readable R32_UINT and R32_SINT 1D/2D/3D/array textures via both ID3D12Device10::CreateCommittedResource3 (create_committed_r9g9b9e5_or_legacy) and ID3D12Device10::CreatePlacedResource2 (pool::texture_with_cast + create_placed_r9g9b9e5_or_legacy with ID3D12Device12::GetResourceAllocationInfo3 sizing/alignment) using D3D12_BARRIER_LAYOUT_COMMON (HostTexture initial state 0 = COMMON) and pCastableFormats = &[DXGI_FORMAT_R9G9B9E5_SHAREDEXP], preserving legacy D3D12_RESOURCE_STATES transitions (ResourceBarrier) everywhere else and falling back cleanly to CreateCommittedResource / CreatePlacedResource when unavailable or refused.
    • Controlled at runtime by LEONIDA_ALIAS_CAST (default on; LEONIDA_ALIAS_CAST=0 restores the copy path; LEONIDA_AB can switch LEONIDA_ALIAS_CAST live at Present).
  2. Zero-copy in-place R9G9B9E5 SRV creation & stale-descriptor invalidation (descriptor/host.rs, resource.rs, draw.rs):

    • make_twinned_info creates DXGI_FORMAT_R9G9B9E5_SHAREDEXP SRVs (including default None / DXGI_FORMAT_UNKNOWN, 2D mip-range, 2D array, TextureCube, and 3D volume views via r9g9b9e5_srv_desc) directly on &source_copy.texture, skipping allocation of placed's duplicate HostTexture and Through staging buffer.
    • Tracks HostTexture::serial in HostHeap::cast_serials, HostHeap::last_cast_on, ListViews::cast_serials, State::tables fresh_tables keys (table_r9g9b9e5_views), and State entry_once RecordHash keys, plus TARGETS_CHANGED + levels_changed notifications on TARGETS_AT insert/drop, so mid-frame or mid-list console virtual-address reuse and live LEONIDA_AB flips invalidate cached static and dynamic SRVs immediately (and failed stale rebuilds in make_listed overwrite s0 with null_for and return None while staying retryable).
  3. Same-pass UAV/RTV write + aliased SRV read hazard fallback (draw.rs):

    • Tracks shader-written castable textures bound as RTVs or UAVs in the active draw/dispatch via WRITTEN_CAST_SOURCES (State::bind RAII guard, covering both direct and group.indexed entries with heap/alignment/bounds checks).
    • If a single draw or compute dispatch simultaneously writes source (e.g. mip m+1 UAV) and samples a placed R9G9B9E5 view of source (e.g. mip m SRV), State::tables routes that pass through dynamic table slots and placed's separate copy so whole-resource legacy barriers keep source in UNORDERED_ACCESS/RENDER_TARGET and placed in SHADER_RESOURCE, resuming zero-copy casting on subsequent read-only passes.

Tested

  • RTX 3090 --release D3D12 timestamp & VRAM benchmark (59 views, 86 reads = 395.6 MiB/frame, 30 measured frames after 5 warmup frames):
    • cargo test --manifest-path d3d12/Cargo.toml --release -p leonida-gpu waterside_alias_cast_vs_copy_gpu_benchmark -- --ignored --nocapture --test-threads=1:
      • castable-zero-copy (CAST=1): gpu_mean = 0.178 ms, gpu_median = 0.175 ms, cpu_record_median = 214.2 us, copies/frame = 0, dup_tex_vram = 0.0 MiB, stage_buf_vram = 0.0 MiB, extra_vram = 0.0 MiB
      • copy-direct-texture (CAST=0, DIRECT=1): gpu_mean = 1.115 ms, gpu_median = 1.063 ms (6.1x slower GPU, -0.888 ms/frame median saved), cpu_record_median = 472.4 us (2.2x slower CPU), copies/frame = 86, extra_vram = 260.5 MiB
      • copy-through-buffer (CAST=0, DIRECT=0): gpu_mean = 2.417 ms, gpu_median = 2.212 ms (12.6x slower GPU, -2.037 ms/frame median saved), cpu_record_median = 1009.8 us (4.7x slower CPU), copies/frame = 86, dup_tex_vram = 260.5 MiB, stage_buf_vram = 255.2 MiB, extra_vram = 515.7 MiB
  • D3D12 debug-layer GPU correctness suite (0 diff lines in host.rs):
    • LEONIDA_D3D12_DEBUG=1 cargo test --manifest-path d3d12/Cargo.toml -p leonida-gpu --features diagnostics --lib alias -- --test-threads=4 -> 10 passed; 0 failed; 1 ignored with 0 D3D12 debug-layer errors:
      • committed_and_placed_r32_uint_textures_cast_to_r9g9b9e5_under_legacy_barriers (verifies both CreateCommittedResource3 and CreatePlacedResource2 via pool::texture_with_cast + GetResourceAllocationInfo3 and direct non-zero-offset ID3D12Heap placement across 2D 2-mip, 2D 3-slice array, and 3D 8x8x4 R32_UINT textures starting in D3D12_BARRIER_LAYOUT_COMMON, written via UAV, transitioned with legacy D3D12_RESOURCE_STATES barriers, and sampled via DXGI_FORMAT_R9G9B9E5_SHAREDEXP SRVs with 0 alias copies)
      • make_listed_stale_rebuild_flushes_batched_copies_before_overwrite (verifies HostHeap::make_listed flushes deferred LISTED_COPIES before overwriting views.slot(at) on mid-table VA reuse)
      • castable_r9g9b9e5_views_sample_written_r32_uint_and_sint_without_copying (2D R32_UINT & R32_SINT, DXGI_FORMAT_UNKNOWN default SRV, 4-mip probe atlas, 6-face TextureCube, and 3D volume; 0 copies, made_copy(placed).is_none(), bit-exact match vs CAST=0)
      • cast_alias_switches_live_and_tracks_replaced_source_at_same_address
      • same_dispatch_source_uav_and_aliased_srv_falls_back_to_copy_without_state_conflict
      • state_tables_fresh_cache_tracks_mid_list_va_reuse_and_live_cast_flip
      • Existing resource::tests::*alias* (4/4), a_texture_made_where_nothing_lay_is_found_by_the_quick_way, partial_tests, pool::tests, and book::tests (3/3) all passed.
  • Crate, lint, & hygiene checks:
    • cargo clippy --manifest-path d3d12/Cargo.toml -p leonida-gpu --tests & --features diagnostics --tests, plus cargo check --manifest-path d3d12/Cargo.toml -p leonida --features diagnostics -> 0 warnings in all new/modified code.
    • python -I scripts/check_no_game_data.py -> clean (0 issues).

GPUs tested: NVIDIA GeForce RTX 3090, driver 610.88, Windows 11 Pro (26200)

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5556541944 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2660). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-29T23:56:20Z. --- Claimed in the coordination issue as: D3D12-ALIAS-CAST-R9G9B9E5 (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7249716729, https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7264381245) ### What and why Eliminates the per-frame GPU copy and duplicate VRAM cost of `DXGI_FORMAT_R9G9B9E5_SHAREDEXP` (`67`) shader views placed in the memory of shader-written `DXGI_FORMAT_R32_UINT` (`42`) and `DXGI_FORMAT_R32_SINT` (`43`) textures (`d3d12/docs/findings.md` "Aliased views of GPU-written textures: `R9G9B9E5` over `R32_UINT`" and "Open: the copies behind aliased views could go"): - All 59 aliased views in the waterside scene (`86` reads, `~390-395.6 MiB/frame` across radiance/reflection/fog targets, 4-mip probe atlases, and 6-face sky cubes) are `R9G9B9E5` SRVs placed over shader-written `R32_UINT` textures because console shaders pack `RGB9E5` manually for `RWTexture` stores while `D3D12_RESOURCE_DESC` puts `R32_UINT` and `R9G9B9E5_SHAREDEXP` in different legacy typeless families. - Previously, every read copied the source texture into a second Default-heap `R9G9B9E5` `HostTexture` (directly when `LEONIDA_ALIAS_DIRECT=1` or through an intermediate staging buffer when `LEONIDA_ALIAS_DIRECT=0`), costing `1.6-3.6 ms/frame` of GPU copy time plus duplicate texture and staging-buffer VRAM. 1. **Castable `R32_UINT`/`R32_SINT` Default-heap committed and placed texture creation (`texture.rs`, `pool.rs`, `resource.rs`)**: - Queries `D3D12_FEATURE_D3D12_OPTIONS12` (`EnhancedBarriersSupported && RelaxedFormatCastingSupported`) via `ID3D12Device10` (`texture::relaxed_format_casting` / `texture::castable_r9g9b9e5`, cached per adapter LUID without touching `host.rs`). - Creates single-sample, shader-readable `R32_UINT` and `R32_SINT` 1D/2D/3D/array textures via both `ID3D12Device10::CreateCommittedResource3` (`create_committed_r9g9b9e5_or_legacy`) and `ID3D12Device10::CreatePlacedResource2` (`pool::texture_with_cast` + `create_placed_r9g9b9e5_or_legacy` with `ID3D12Device12::GetResourceAllocationInfo3` sizing/alignment) using `D3D12_BARRIER_LAYOUT_COMMON` (`HostTexture` initial state `0 = COMMON`) and `pCastableFormats = &[DXGI_FORMAT_R9G9B9E5_SHAREDEXP]`, preserving legacy `D3D12_RESOURCE_STATES` transitions (`ResourceBarrier`) everywhere else and falling back cleanly to `CreateCommittedResource` / `CreatePlacedResource` when unavailable or refused. - Controlled at runtime by `LEONIDA_ALIAS_CAST` (default on; `LEONIDA_ALIAS_CAST=0` restores the copy path; `LEONIDA_AB` can switch `LEONIDA_ALIAS_CAST` live at `Present`). 2. **Zero-copy in-place `R9G9B9E5` SRV creation & stale-descriptor invalidation (`descriptor/host.rs`, `resource.rs`, `draw.rs`)**: - `make_twinned_info` creates `DXGI_FORMAT_R9G9B9E5_SHAREDEXP` SRVs (including default `None` / `DXGI_FORMAT_UNKNOWN`, 2D mip-range, 2D array, `TextureCube`, and 3D volume views via `r9g9b9e5_srv_desc`) directly on `&source_copy.texture`, skipping allocation of `placed`'s duplicate `HostTexture` and `Through` staging buffer. - Tracks `HostTexture::serial` in `HostHeap::cast_serials`, `HostHeap::last_cast_on`, `ListViews::cast_serials`, `State::tables` `fresh_tables` keys (`table_r9g9b9e5_views`), and `State` `entry_once` `RecordHash` keys, plus `TARGETS_CHANGED` + `levels_changed` notifications on `TARGETS_AT` insert/drop, so mid-frame or mid-list console virtual-address reuse and live `LEONIDA_AB` flips invalidate cached static and dynamic SRVs immediately (and failed stale rebuilds in `make_listed` overwrite `s0` with `null_for` and return `None` while staying retryable). 3. **Same-pass UAV/RTV write + aliased SRV read hazard fallback (`draw.rs`)**: - Tracks shader-written castable textures bound as RTVs or UAVs in the active draw/dispatch via `WRITTEN_CAST_SOURCES` (`State::bind` RAII guard, covering both direct and `group.indexed` entries with heap/alignment/bounds checks). - If a single draw or compute dispatch simultaneously writes `source` (e.g. `mip m+1` UAV) and samples a placed `R9G9B9E5` view of `source` (e.g. `mip m` SRV), `State::tables` routes that pass through dynamic table slots and `placed`'s separate copy so whole-resource legacy barriers keep `source` in `UNORDERED_ACCESS`/`RENDER_TARGET` and `placed` in `SHADER_RESOURCE`, resuming zero-copy casting on subsequent read-only passes. ### Tested - **RTX 3090 `--release` D3D12 timestamp & VRAM benchmark (`59` views, `86` reads = `395.6 MiB/frame`, `30` measured frames after `5` warmup frames)**: - `cargo test --manifest-path d3d12/Cargo.toml --release -p leonida-gpu waterside_alias_cast_vs_copy_gpu_benchmark -- --ignored --nocapture --test-threads=1`: - `castable-zero-copy (CAST=1)`: `gpu_mean = 0.178 ms`, `gpu_median = 0.175 ms`, `cpu_record_median = 214.2 us`, `copies/frame = 0`, `dup_tex_vram = 0.0 MiB`, `stage_buf_vram = 0.0 MiB`, `extra_vram = 0.0 MiB` - `copy-direct-texture (CAST=0, DIRECT=1)`: `gpu_mean = 1.115 ms`, `gpu_median = 1.063 ms` (`6.1x` slower GPU, `-0.888 ms/frame` median saved), `cpu_record_median = 472.4 us` (`2.2x` slower CPU), `copies/frame = 86`, `extra_vram = 260.5 MiB` - `copy-through-buffer (CAST=0, DIRECT=0)`: `gpu_mean = 2.417 ms`, `gpu_median = 2.212 ms` (`12.6x` slower GPU, `-2.037 ms/frame` median saved), `cpu_record_median = 1009.8 us` (`4.7x` slower CPU), `copies/frame = 86`, `dup_tex_vram = 260.5 MiB`, `stage_buf_vram = 255.2 MiB`, `extra_vram = 515.7 MiB` - **D3D12 debug-layer GPU correctness suite (`0` diff lines in `host.rs`)**: - `LEONIDA_D3D12_DEBUG=1 cargo test --manifest-path d3d12/Cargo.toml -p leonida-gpu --features diagnostics --lib alias -- --test-threads=4` -> `10 passed; 0 failed; 1 ignored` with `0` D3D12 debug-layer errors: - `committed_and_placed_r32_uint_textures_cast_to_r9g9b9e5_under_legacy_barriers` (verifies both `CreateCommittedResource3` and `CreatePlacedResource2` via `pool::texture_with_cast` + `GetResourceAllocationInfo3` and direct non-zero-offset `ID3D12Heap` placement across 2D 2-mip, 2D 3-slice array, and 3D `8x8x4` `R32_UINT` textures starting in `D3D12_BARRIER_LAYOUT_COMMON`, written via UAV, transitioned with legacy `D3D12_RESOURCE_STATES` barriers, and sampled via `DXGI_FORMAT_R9G9B9E5_SHAREDEXP` SRVs with `0` alias copies) - `make_listed_stale_rebuild_flushes_batched_copies_before_overwrite` (verifies `HostHeap::make_listed` flushes deferred `LISTED_COPIES` before overwriting `views.slot(at)` on mid-table VA reuse) - `castable_r9g9b9e5_views_sample_written_r32_uint_and_sint_without_copying` (2D `R32_UINT` & `R32_SINT`, `DXGI_FORMAT_UNKNOWN` default SRV, 4-mip probe atlas, 6-face `TextureCube`, and 3D volume; `0` copies, `made_copy(placed).is_none()`, bit-exact match vs `CAST=0`) - `cast_alias_switches_live_and_tracks_replaced_source_at_same_address` - `same_dispatch_source_uav_and_aliased_srv_falls_back_to_copy_without_state_conflict` - `state_tables_fresh_cache_tracks_mid_list_va_reuse_and_live_cast_flip` - Existing `resource::tests::*alias*` (`4/4`), `a_texture_made_where_nothing_lay_is_found_by_the_quick_way`, `partial_tests`, `pool::tests`, and `book::tests` (`3/3`) all passed. - **Crate, lint, & hygiene checks**: - `cargo clippy --manifest-path d3d12/Cargo.toml -p leonida-gpu --tests` & `--features diagnostics --tests`, plus `cargo check --manifest-path d3d12/Cargo.toml -p leonida --features diagnostics` -> `0` warnings in all new/modified code. - `python -I scripts/check_no_game_data.py` -> clean (`0` issues). GPUs tested: NVIDIA GeForce RTX 3090, driver 610.88, Windows 11 Pro (26200) AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change)
merzleckeier commented 2026-11-30 00:14:49 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-30T00:14:49Z.


Independent Wine A/B of the alias-cast tests on fdfe5ccbf (GitHub merge db94e6ab5). Same Win64 test binary and prefix, Wine 11.22 with VKD3D-Proton 71cae091, RTX 4070 SUPER (620.73.04) and Radeon Raphael (RADV 26.3.1).

  • With Wine’s builtin d3dcompiler_47, all six tests failed in each of three runs per GPU. D3DCompile returned successfully, then CreateRootSignature rejected the resulting shader blob with E_FAIL at texture.rs:3848, before PSO creation.
  • With Microsoft d3dcompiler_47 10.0.17134.12 selected via WINEDLLOVERRIDES, all six passed in each of three runs per GPU. That includes the live UINT/SINT views, committed and placed textures under legacy barriers, and the same-dispatch copy fallback. The ignored benchmark stayed ignored.

Synthetic fixtures only. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7265096739 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2660#issuecomment-7265096739). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-30T00:14:49Z. --- Independent Wine A/B of the alias-cast tests on `fdfe5ccbf` (GitHub merge `db94e6ab5`). Same Win64 test binary and prefix, Wine 11.22 with VKD3D-Proton `71cae091`, RTX 4070 SUPER (620.73.04) and Radeon Raphael (RADV 26.3.1). - With Wine’s builtin `d3dcompiler_47`, all six tests failed in each of three runs per GPU. `D3DCompile` returned successfully, then `CreateRootSignature` rejected the resulting shader blob with `E_FAIL` at `texture.rs:3848`, before PSO creation. - With Microsoft `d3dcompiler_47` 10.0.17134.12 selected via `WINEDLLOVERRIDES`, all six passed in each of three runs per GPU. That includes the live UINT/SINT views, committed and placed textures under legacy barriers, and the same-dispatch copy fallback. The ignored benchmark stayed ignored. Synthetic fixtures only. AI-assisted with OpenAI Codex.
zmasi commented 2026-11-30 00:28:06 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-30T00:28:06Z.


Thanks for running the dual-GPU Wine A/B across RTX 4070 SUPER and Radeon Raphael!

Wine's builtin d3dcompiler_47 (vkd3d-shader) drops HLSL [RootSignature(...)] attributes instead of emitting an RTS0 DXBC chunk, which is why passing the shader bytecode straight to CreateRootSignature returned E_FAIL. Pushed f9d9312241 updating alias_cast_tests (texture.rs test module only) to serialize each test's D3D12_ROOT_SIGNATURE_DESC explicitly via D3D12SerializeRootSignature (D3D_ROOT_SIGNATURE_VERSION_1) so the suite runs without needing a native d3dcompiler_47 override (10/10 passing with LEONIDA_D3D12_DEBUG=1).

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7265295051 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2660#issuecomment-7265295051). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-30T00:28:06Z. --- Thanks for running the dual-GPU Wine A/B across RTX 4070 SUPER and Radeon Raphael! Wine's builtin `d3dcompiler_47` (`vkd3d-shader`) drops HLSL `[RootSignature(...)]` attributes instead of emitting an `RTS0` DXBC chunk, which is why passing the shader bytecode straight to `CreateRootSignature` returned `E_FAIL`. Pushed `f9d9312241` updating `alias_cast_tests` (`texture.rs` test module only) to serialize each test's `D3D12_ROOT_SIGNATURE_DESC` explicitly via `D3D12SerializeRootSignature` (`D3D_ROOT_SIGNATURE_VERSION_1`) so the suite runs without needing a native `d3dcompiler_47` override (`10/10` passing with `LEONIDA_D3D12_DEBUG=1`). AI-assisted.
ItsYusei99 commented 2026-11-30 00:29:00 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ItsYusei99 on 2026-11-30T00:29:00Z.


RUN: an in-game test on Windows, AI-assisted (Claude).

Setup:

  • RTX 4070 12 GB, driver 621.40, Ryzen 7 9800X3D, 32 GB RAM, Windows 11.
  • Build: main at 452d1d1b6 plus this PR's diff (head fdfe5ccbf), applied with git apply --3way without conflicts; diag profile with DLSS.
  • Also applied: #2617 and local changes that don't touch textures (MFG Unlocker loading, prompt glyphs).
  • Series S, DLSS, frame generation 3x.
  • A full pipeline warm-up before playing.

Log, with LEONIDA_ALIAS_CAST at its default:

INFO leonida_gpu::texture: relaxed format casting supported=true
INFO leonida_gpu::texture: aliased views per frame: 1512.2 read in place, 1.0 asked for their copy and 0.0 needed none (their list had it); ...
INFO leonida_gpu::draw: aliased textures a list took as ready ...: 12.1 views of new tables made readable again, 0.0 of them with their copy made again (a stale read before); 110.5 tables read again, 0.0 of them with ...

No device removed, no panic.

Picture: open sea from a boat in daylight, plus the area around a dock. The sky, clouds, sun glint, water and reflections looked normal. I saw no black or wrongly coloured patches where the radiance, fog or probe views are read. That was only a few minutes of play, and I have not yet looked at interiors or at night.

Numbers, compared with the previous build (dd87aa405, no PR). The scenes were similar but not identical, so this is not a strict A/B:

before with this PR
rendered fps ~25 22-30 (~27)
VRAM used (nvidia-smi) 10.2 GB 9.7 GB
free system RAM 2.6 GB 3.2 GB

On this machine the frame is limited by the CPU: 22-28 ms a frame is spent preparing, and the GPU sits at about 73 %. So the copy time saved shows up mostly as less VRAM and GPU work, not as fps. An A/B with LEONIDA_ALIAS_CAST=0 on the same build and save would give a cleaner number. I haven't run that yet.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7265307872 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2660#issuecomment-7265307872). Originally posted by [ItsYusei99](https://github.com/ItsYusei99) on 2026-11-30T00:29:00Z. --- RUN: an in-game test on Windows, AI-assisted (Claude). **Setup:** - RTX 4070 12 GB, driver 621.40, Ryzen 7 9800X3D, 32 GB RAM, Windows 11. - Build: `main` at `452d1d1b6` plus this PR's diff (head `fdfe5ccbf`), applied with `git apply --3way` without conflicts; diag profile with DLSS. - Also applied: #2617 and local changes that don't touch textures (MFG Unlocker loading, prompt glyphs). - Series S, DLSS, frame generation 3x. - A full pipeline warm-up before playing. **Log, with `LEONIDA_ALIAS_CAST` at its default:** ``` INFO leonida_gpu::texture: relaxed format casting supported=true INFO leonida_gpu::texture: aliased views per frame: 1512.2 read in place, 1.0 asked for their copy and 0.0 needed none (their list had it); ... INFO leonida_gpu::draw: aliased textures a list took as ready ...: 12.1 views of new tables made readable again, 0.0 of them with their copy made again (a stale read before); 110.5 tables read again, 0.0 of them with ... ``` No device removed, no panic. **Picture:** open sea from a boat in daylight, plus the area around a dock. The sky, clouds, sun glint, water and reflections looked normal. I saw no black or wrongly coloured patches where the radiance, fog or probe views are read. That was only a few minutes of play, and I have not yet looked at interiors or at night. **Numbers, compared with the previous build (`dd87aa405`, no PR).** The scenes were similar but not identical, so this is not a strict A/B: | | before | with this PR | |---|---|---| | rendered fps | ~25 | 22-30 (~27) | | VRAM used (`nvidia-smi`) | 10.2 GB | 9.7 GB | | free system RAM | 2.6 GB | 3.2 GB | On this machine the frame is limited by the CPU: 22-28 ms a frame is spent preparing, and the GPU sits at about 73 %. So the copy time saved shows up mostly as less VRAM and GPU work, not as fps. An A/B with `LEONIDA_ALIAS_CAST=0` on the same build and save would give a cleaner number. I haven't run that yet.
zmasi commented 2026-11-30 00:33:10 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-30T00:33:10Z.


Awesome live telemetry — 1,512.2 aliased views/frame read in place with 1.0 same-pass write+read hazard caught cleanly by WRITTEN_CAST_SOURCES (-500 MB VRAM on a 12 GB card, 0 device removals) is great confirmation. If you want a same-scene A/B without restarting, LEONIDA_ALIAS_CAST is wired into LEONIDA_AB so it can toggle 1 <-> 0 live across Present phases on the same camera.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7265369786 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2660#issuecomment-7265369786). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-30T00:33:10Z. --- Awesome live telemetry — `1,512.2` aliased views/frame read in place with `1.0` same-pass write+read hazard caught cleanly by `WRITTEN_CAST_SOURCES` (`-500 MB` VRAM on a 12 GB card, `0` device removals) is great confirmation. If you want a same-scene A/B without restarting, `LEONIDA_ALIAS_CAST` is wired into `LEONIDA_AB` so it can toggle `1 <-> 0` live across `Present` phases on the same camera. AI-assisted.
merzleckeier commented 2026-11-30 00:38:00 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-30T00:38:00Z.


Same-tree Wine retest of the explicit root-signature fix 8aaf91fd9 on f9d931224 (GitHub merge 37b30335a onto b8bd37111). Wine 11.22 with VKD3D-Proton 71cae091, RTX 4070 SUPER (620.73.04) and Radeon Raphael (RADV 26.3.1). The loader trace confirmed Wine’s builtin d3dcompiler_47 in both arms on both GPUs.

  • MEASURED With the current fixture, all six alias tests passed in each of three runs per GPU, including committed/placed castable textures and the same-dispatch copy fallback. The benchmark was ignored.
  • MEASURED Reverting only 8aaf91fd9 on the same merge made all six tests fail in each of three runs per GPU. Each failed at CreateRootSignature with E_FAIL after D3DCompile succeeded.

The explicit serialization lets the fixture run with the builtin compiler on both adapters. Synthetic fixtures only. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7265442619 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2660#issuecomment-7265442619). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-30T00:38:00Z. --- Same-tree Wine retest of the explicit root-signature fix `8aaf91fd9` on `f9d931224` (GitHub merge `37b30335a` onto `b8bd37111`). Wine 11.22 with VKD3D-Proton `71cae091`, RTX 4070 SUPER (620.73.04) and Radeon Raphael (RADV 26.3.1). The loader trace confirmed Wine’s builtin `d3dcompiler_47` in both arms on both GPUs. - **MEASURED** With the current fixture, all six `alias` tests passed in each of three runs per GPU, including committed/placed castable textures and the same-dispatch copy fallback. The benchmark was ignored. - **MEASURED** Reverting only `8aaf91fd9` on the same merge made all six tests fail in each of three runs per GPU. Each failed at `CreateRootSignature` with `E_FAIL` after `D3DCompile` succeeded. The explicit serialization lets the fixture run with the builtin compiler on both adapters. Synthetic fixtures only. AI-assisted with OpenAI Codex.
lixonik commented 2026-11-30 01:22:50 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-30T01:22:50Z.


Native Windows 10 retest of f9d93122413289069645bc9cc63bc1c4ffe98995 merged locally into 0eab02a8bcffbb9d1609f9c2fba40c2357513d06. Windows 10 22H2 (build 19045), RTX 5070, NVIDIA 610.88, Rust 1.98.1 MSVC, local test-executable loader exports for Agility SDK 1.614.1. Synthetic fixtures only.

  • RTX 5070: cargo test --locked --offline --profile diag -p leonida-gpu --features diagnostics --lib alias -- --nocapture --test-threads=1 and two fresh-process reruns each reported 10 passed. The six new fixtures exercised UINT/SINT cast-versus-copy readback, live toggling and address reuse, committed and placed textures, the same-dispatch UAV conflict fallback, and descriptor re-batching.
  • Forced system WARP 10.0.19041.7811: the adapter lacks relaxed format casting, so the six guarded casting tests returned early. The four existing alias tests passed, including the direct and staged copy cases.
  • The ignored benchmark stayed ignored. This run checks the native casting and copy paths, with no frame-time or VRAM measurements.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7266087298 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2660#issuecomment-7266087298). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-30T01:22:50Z. --- Native Windows 10 retest of `f9d93122413289069645bc9cc63bc1c4ffe98995` merged locally into `0eab02a8bcffbb9d1609f9c2fba40c2357513d06`. Windows 10 22H2 (build 19045), RTX 5070, NVIDIA 610.88, Rust 1.98.1 MSVC, local test-executable loader exports for Agility SDK 1.614.1. Synthetic fixtures only. - RTX 5070: `cargo test --locked --offline --profile diag -p leonida-gpu --features diagnostics --lib alias -- --nocapture --test-threads=1` and two fresh-process reruns each reported 10 passed. The six new fixtures exercised UINT/SINT cast-versus-copy readback, live toggling and address reuse, committed and placed textures, the same-dispatch UAV conflict fallback, and descriptor re-batching. - Forced system WARP `10.0.19041.7811`: the adapter lacks relaxed format casting, so the six guarded casting tests returned early. The four existing alias tests passed, including the direct and staged copy cases. - The ignored benchmark stayed ignored. This run checks the native casting and copy paths, with no frame-time or VRAM measurements. AI-assisted.
lixonik commented 2026-11-30 03:31:56 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-30T03:31:56Z.


Retested merge head 4a4fc668c157a967bcfaabfbc66fc5f63659da88 with current main 1d22590b9fb5c0f51a6a7c0405f1f136e0696c0d to cover the raw-twin conflict resolution in descriptor/host.rs. Windows 10 22H2 (build 19045), RTX 5070, NVIDIA 610.88, Rust 1.98.1 MSVC, --profile diag --features diagnostics, local test-executable loader exports for Agility SDK 1.614.1.

  • With LEONIDA_TWIN_BIAS=1, the alias filter had 10 passes and descriptor::host had 53 passes. The six casting cases reached their assertions on the hardware path. The default run left the ignored microbenchmarks and descriptor probes alone.
  • I ran the existing ignored listed_off_alignment_raw_twin_readback probe separately with LEONIDA_RAW_VIEWS=1 and LEONIDA_TWIN_BIAS=1. It stopped at the raw-twin heap prerequisite (heap.raw == 0) on both current main and main plus the PR. Coverage on this adapter includes casting, copy fallback and descriptor tests. End-to-end raw-twin readback remains unverified here.

Synthetic fixtures only.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7267973022 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2660#issuecomment-7267973022). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-30T03:31:56Z. --- Retested merge head `4a4fc668c157a967bcfaabfbc66fc5f63659da88` with current `main` `1d22590b9fb5c0f51a6a7c0405f1f136e0696c0d` to cover the raw-twin conflict resolution in `descriptor/host.rs`. Windows 10 22H2 (build 19045), RTX 5070, NVIDIA 610.88, Rust 1.98.1 MSVC, `--profile diag --features diagnostics`, local test-executable loader exports for Agility SDK 1.614.1. - With `LEONIDA_TWIN_BIAS=1`, the `alias` filter had **10 passes** and `descriptor::host` had **53 passes**. The six casting cases reached their assertions on the hardware path. The default run left the ignored microbenchmarks and descriptor probes alone. - I ran the existing ignored `listed_off_alignment_raw_twin_readback` probe separately with `LEONIDA_RAW_VIEWS=1` and `LEONIDA_TWIN_BIAS=1`. It stopped at the raw-twin heap prerequisite (`heap.raw == 0`) on both current main and main plus the PR. Coverage on this adapter includes casting, copy fallback and descriptor tests. End-to-end raw-twin readback remains unverified here. Synthetic fixtures only. AI-assisted.
ammonium231 commented 2026-11-30 05:59:53 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ammonium231 on 2026-11-30T05:59:53Z.


RTX 3090 / 621.40, validation on, 4a4fc668c merged onto main 1d22590b9: alias tests 10 pass, 1 ignored (main 4). Release waterside bench, debug layer off, GPU median: cast 0.157 ms vs direct copy 1.125 ms (7.2x, +260.5 MiB) and copy through buffer 2.254 ms (14.4x, +515.7 MiB).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7270202436 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2660#issuecomment-7270202436). Originally posted by [ammonium231](https://github.com/ammonium231) on 2026-11-30T05:59:53Z. --- RTX 3090 / 621.40, validation on, 4a4fc668c merged onto main 1d22590b9: alias tests 10 pass, 1 ignored (main 4). Release waterside bench, debug layer off, GPU median: cast 0.157 ms vs direct copy 1.125 ms (7.2x, +260.5 MiB) and copy through buffer 2.254 ms (14.4x, +515.7 MiB).
zmasi commented 2026-11-30 07:47:53 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-30T07:47:53Z.


Merged into main via d9a75eb8f / ce8118dfb (and measured live in 6d26716aa) — closing since only the post-merge sync commit 4a4fc668c remained on the branch. Thanks @ItsYusei99, @merzleckeier, @lixonik, and @ammonium231 for the hardware runs!

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7272134344 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2660#issuecomment-7272134344). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-30T07:47:53Z. --- Merged into `main` via `d9a75eb8f` / `ce8118dfb` (and measured live in `6d26716aa`) — closing since only the post-merge sync commit `4a4fc668c` remained on the branch. Thanks `@ItsYusei99`, `@merzleckeier`, `@lixonik`, and `@ammonium231` for the hardware runs! AI-assisted.

Pull request closed

Sign in to join this conversation.
No reviewers
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
ProjectLeonida/mandy!2660
No description provided.