Skip to content

D3D12.X: a 3-D texture XG cannot size is taken at its texels' bytes - #2753

Open
MacieGx wants to merge 1 commit into
xcl-dev:mainfrom
MacieGx:d3d12x/volume-texture-size
Open

MacieGx wants to merge 1 commit into
xcl-dev:mainfrom
MacieGx:d3d12x/volume-texture-size

Conversation

@MacieGx

@MacieGx MacieGx commented Nov 26, 2026

Copy link
Copy Markdown

A 3-D texture XG does not lay out (a 3-D render target: xg::Texture::volume refuses flags 1 / 2 with E_NOTIMPL) got no console size in CreatePlacedResourceX, so vram gave it every tile of the PC texture as a 64 KiB page at its address. The newer retail title of #505 places thirteen 33x33x33 RGBA16F colour LUTs (render target + UAV, flags 0x5) 512 KiB apart; the PC texture has 18 tiles of 64 KiB, so each LUT shared 10 pages with the next one. A LUT's bake overwrote rows of its neighbour, the tone map sampled another LUT's rows (LUT[black] = cyan) and the whole picture came out teal. Such a texture is now taken at the bytes of its texels (287,496 here: 5 pages of its own), which no console layout of it is smaller than.

Part of #505.

Why not the console's layout: what the console's library does with a 3-D render target is not known here. The xg_oracle volume test covers flags 0 and 4 only, and no console library was at hand to ask. The 2-D rule for render targets (64KB_R_X, thin for 3-D in our tiling model) would give 33 x 64 KiB = 2.06 MiB, which cannot be right for textures the title packs 512 KiB apart, and it would keep the overlap. 4KB_S thick (500 KiB) fits, but that is a guess. Teaching XG this would also change what XGCreateTextureComputer and GetResourceAllocationInfo tell titles. The texels' bytes are a lower bound of any layout, so the pages taken are always the texture's own.

What is in it

  • D3D12.X: a 3-D texture XG cannot size is taken at its texels' bytes (crates/xcl/src/hle/d3d12x/device_x.rs: console_bytes / volume_texel_bytes, used by create_placed_resource_x; vram::owned_pages made pub(super) for the test), with the unit test volume_targets_xg_does_not_lay_out_keep_to_their_texels: two such LUTs 512 KiB apart do not share a page, a full mip chain is summed, and a sampled 3-D texture keeps XG's size.

Tested

  • Without the fix (the fallback disabled, so console_bytes is XG's size only) the new test fails: assertion left == right failed, left: None, right: Some(287496); with it, it passes
  • cargo test --release -p xcl --lib -- volume_targets owned_pages hle::xg on e07d03b: 80 passed, 0 failed, 0 ignored, 1257 filtered out (CPU tests; the filter also matches hle::xgameruntime)
  • NVIDIA GeForce RTX 5080 (driver 621.24 = 32.0.16.2124), AMD Ryzen 7 5800X3D, 32 GB, Windows 11 Pro 10.0.26200, Rust 1.100.0 stable-x86_64-pc-windows-msvc, release. On e07d03b (this PR, on main b49be18).
  • cargo build --release --workspace && cargo test --release --workspace --no-fail-fast -- --test-threads=4 on e07d03b: 1432 passed, 4 failed, 47 ignored. The 4 failures are gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3 (CreateComputePipelineState: out of memory (0x8007000E)), which fail on main as well.
  • SKIPPED (the same as on main): 21 "no wave64", 3 refused by the per-lane form, heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows), pso_measurement_compiles_an_exact_synthetic_record (needs Developer Mode).
  • Lab (the same change behind a switch, on our lab branch, NVIDIA): the Newer retail title (TitleID 7952987A): reaches world loading, then the title's GPU watchdog ("GPU Loc Sig") after ListX #101 stub #505 title went from a teal picture to the game's colours (cell wall in grey, the yard and sunset light in the window, a photo in colour; run W1, 470 s, no device removal). The title places thirteen such 33x33x33 RGBA16F render-target / UAV textures 512 KiB apart; before the change each took 18 tiles of 64 KiB, so neighbours shared 10.

Regression run
main:

xcl-smoke v1
commit: 568e7db7729c8fa6c8f0f4b32d798faaf11462bb
gpu: NVIDIA GeForce RTX 5080
title: 16b5e5d4
seconds: 60
exit: 0x0
frames shown: 1383 (PresentX 1383)
presents per 2 s (last 3): 35 52 56
device removals: 0
crashes: 0
peak commit: 19703 MB

this PR:

xcl-smoke v1
commit: e07d03bf0fc1bcbfac3d369d2f7eeed5eba6afd7
gpu: NVIDIA GeForce RTX 5080
title: 16b5e5d4
seconds: 60
exit: 0x0
frames shown: 1615 (PresentX 1615)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15692 MB

Not tested

  • The console's own size for 3-D render targets: no console xg_xs.dll (XCL_SAMPLE_XG) was at hand.
  • AMD GPUs. The lab run was on NVIDIA.
  • Other textures XG cannot size (MSAA, unknown formats) still get the PC's tile count. This PR covers 3-D textures only.

AI use

  • Claude Code. Claude Opus 5.5 coordinated the work. A Claude Fable 5.2 lab subagent found the bug and wrote the lab fix. A Claude Opus 5.5 subagent wrote this port, its test and this description.

🤖 Generated with Claude Code

xg::Texture::volume refuses 3-D render targets (flags 1 / 2: E_NOTIMPL),
so CreatePlacedResourceX had no console size for them and vram gave such a
texture every tile of the PC texture as a 64 KiB page at its address. The
newer retail title of xcl-dev#505 places thirteen 33x33x33 RGBA16F colour LUTs
(flags 0x5) 512 KiB apart. The PC texture has 18 tiles, so each LUT shared
10 pages with the next one. A LUT's bake overwrote its neighbour's rows and
the tone map sampled the wrong LUT (black -> cyan): the picture was teal. On
our lab branch the same change turned the picture into the game's colours.

The fallback is the bytes of the texels of every level (287,496 bytes, 5
pages of its own, for that LUT) and not a console layout. What the console's
library does with a 3-D render target is not known: the xg oracle covers 3-D
flags 0 and 4 only, and no console library was at hand. The 2-D render
target rule (64KB_R_X, thin for 3-D) gives 2.06 MiB, which cannot be right
for textures packed 512 KiB apart and keeps the overlap. 4KB_S thick (500 KiB)
fits but is a guess. Teaching XG would also change what XGCreateTextureComputer
and GetResourceAllocationInfo tell titles. No layout is smaller than its
texels, so the pages taken are always the texture's own.

Part of xcl-dev#505.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@GodlyBDS

Copy link
Copy Markdown

Independent Ampere validation of the NVIDIA-branch precursor b59d263

RTX 3090 Ti 24 GiB, driver 621.40, Windows 10, 32 GiB RAM. Both release builds use e877812e390cad68f9082445c43a397ebf8a00bf and the same local Agility path scope and #662 XG startup adapter. The treatment adds only b59d2638. The relevant settings are XCL_TEXTURE_LEVEL_PAGES=1 XCL_DIRECT_DXIL=1 XCL_PREPARE=0 XCL_PSO_PRELOAD=0 XCL_DRED=1 XCL_COHERENT_MB=4095 XCL_UMA_WINDOWS=4 XCL_HEAP_WINDOWS=1 XCL_TWO_PASS_MB=4096, with the verified app-only 1 GiB NVIDIA shader heap. Both arms cloned the same 11,721 native PSOs and matching shader cache, used the same starting profile and scripted inputs, and had no fixed runtime timeout. Cache manifest hashes and environment settings matched.

  • Without the tile-placement fix: a cyan-white image with scene details at 207.754 s. Device removal at 252.834 s.
  • With the tile-placement fix: the city-light horizon was predominantly dark with gold highlights at 323.222 s. Device removal at 323.288 s.
  • The exact NVIDIA-branch overlap regression a_3d_texture_of_unknown_console_size_keeps_off_the_next_textures_pages passed (1 pass, 0 failures, no skips).
  • Both removals were 0x887a0005. DRED returned VA zero with no matched allocation and no breadcrumbs. Neither removal had a corresponding Display 4101/nvlddmkm 153 in the event window.

The direction of the color change is consistent with correcting cyan sampled from the wrong LUT. The frames are from different points in the opening and this is one run per arm. The control also recorded 153 two-pass mesh allocation refusals at the same 4 GiB cap, while the treatment recorded zero. No claim about a matched-frame color error, correct geometry, sustained rendering or device-removal prevention. The exact #2753 head has not been run here. Memory details are in the existing #2688 report.

AI use: Codex (GPT-6) built and ran the pair, reviewed the backbuffer samples and wrote this report.

@emirduran707

Copy link
Copy Markdown
Contributor

Independent AMD RDNA4 (native wave64) verification of exact PR head e07d03bf0fc1bcbfac3d369d2f7eeed5eba6afd7 on Windows 11 Pro 26300 (AMD Radeon RX 9060 XT 16 GB, driver 32.0.31044.16, Ryzen 5 5600, Rust 1.100.0 MSVC, DXC 1.9.2602.17).

Tested

  • cargo build --workspace (debug): passed (0 errors).
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 1434 passed, 2 failed, 47 ignored (8 SKIPPED: 6 per-lane DXIL forms refused by host adapter/driver, 1 heap_window_out_of_memory_falls_back_to_the_switch_form no heap windows, 1 pso_measurement_compiles_an_exact_synthetic_record Windows Developer Mode off).
    • The new test hle::d3d12x::device_x::tests::volume_targets_xg_does_not_lay_out_keep_to_their_texels passed.
    • The 2 failures (gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 and fuzz_validate_and_gpu_3) are pre-existing on unmodified main on this RX 9060 XT / driver 32.0.31044.16.
  • cargo build --release -p xcl + 60 s retail-title smoke test (scripts/smoke.ps1, offline):
xcl-smoke v1
commit: e07d03bf0fc1bcbfac3d369d2f7eeed5eba6afd7
gpu: AMD Radeon RX 9060 XT
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1591 (PresentX 1591)
presents per 2 s (last 3): 60 61 60
device removals: 0
crashes: 0
peak commit: 18654 MB

(Compare against main b49be183 on this machine: 1603 frames, 18576 MB peak, 0 device removals, 0 crashes.)

Not tested

  • NVIDIA / Intel GPUs, Linux / Wine.

AI use

  • Verification run and report prepared with Antigravity (Gemini 4 Neon); all build, test, and smoke results are from live runs on this machine.

@Decodere

Copy link
Copy Markdown
Contributor

Independent RTX 4060 (8 GB) / Windows 11 release verification of PR #2753 at e07d03bf0fc1bcbfac3d369d2f7eeed5eba6afd7 (exact parent origin/main b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7). Measurements and targeted test results only; not a full source review.

Setup

  • GPU: NVIDIA GeForce RTX 4060 (8 GB / 7956 MiB reported by D3D12), driver 32.0.16.2114 (NVIDIA 621.14, WDDM 3.2)
  • CPU / RAM / OS: Intel Core i5-11400F (6 cores / 12 threads), 32 GB RAM (31.9 GiB usable), Windows 11 Home 26200
  • Toolchain / caches: rustc 1.100.0 (0ef1bc386 2026-11-09), DXC 1.9.2609.5, release builds, warm DXIL/pipeline caches, quiet machine (zero concurrent builds/tests during timed runs)
  • Workload: Retail workload title: 29640639 via scripts/smoke.ps1 -Seconds 60 (XCL_NETWORK=0 XCL_ACTIVITY=1, default flags, no input)

Targeted RTX 4060 release unit tests (e07d03bf)

  • cargo test --release -p xcl --lib volume_targets_xg_does_not_lay_out_keep_to_their_texels -- --nocapture: 1 passed, 0 failed, 0 ignored (0.00 s, exit 0).
  • cargo test --release -p xcl --lib hle::d3d12x::vram:: -- --test-threads=4: 19 passed, 0 failed, 1 ignored (2.55 s, churn_update_tile_mappings_timing ignored, 0 skipped, exit 0).
  • cargo test --release -p xcl --lib hle::d3d12x::device_x:: -- --test-threads=4: 15 passed, 0 failed, 0 ignored (0.19 s, 0 skipped, exit 0).

Observations

  • The new 3-D volume-texture sizing fallback (volume_texel_bytes / console_bytes) passes volume_targets_xg_does_not_lay_out_keep_to_their_texels and all 34 targeted hle::d3d12x::vram:: and hle::d3d12x::device_x:: tests cleanly in --release on this RTX 4060 (8 GB) host with 0 skips.
  • Quiet 60 s retail smoke ran cleanly (exit: 0x0, 1556 frames shown, 60 60 60 steady-state presents per 2 s, 0 device removals, 0 crashes, 14009 MB peak commit vs parent b49be183's 14018 MB / 1518 frames).

Paired 60 s RTX 4060 smoke (b49be183 vs e07d03bf)

Parent origin/main (b49be183):

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1518 (PresentX 1518)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14018 MB

PR #2753 head (e07d03bf):

xcl-smoke v1
commit: e07d03bf0fc1bcbfac3d369d2f7eeed5eba6afd7
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1556 (PresentX 1556)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14009 MB

Limits of coverage

  • Full workspace test suite was not re-run on e07d03bf (only targeted hle::d3d12x::vram:: and hle::d3d12x::device_x:: release tests plus paired quiet 60 s smoke).
  • The quiet 60 s no-input menu/intro smoke verifies no runtime regression on the baseline path rather than extended world-load 3-D volume-target VRAM savings (the XG fallback sizing path itself is covered by volume_targets_xg_does_not_lay_out_keep_to_their_texels).
  • Single discrete NVIDIA 8 GB GPU (RTX 4060) on native Windows 11; no AMD, Intel, or Wine/Linux run on this host.

AI use

Ran the targeted release unit tests and paired quiet 60 s smoke runs with assistance from Google Antigravity (Gemini 4 Neon); all test counts and smoke blocks were taken directly from cargo test and scripts/smoke.ps1 outputs.

@Gevroska

Copy link
Copy Markdown

I compared stock b49be183 with PR head e07d03bf using two 33 × 33 × 33 RGBA16F textures, first on WARP and then on a physical RTX 3080.

On stock, adjacent placements shared 10 backing pages. I stopped that case before issuing texture commands, so I have no readback result for the overlapping pair. With the placements farther apart, stock shared zero pages and both textures read back correctly.

On the PR head, both placement cases shared zero pages. After waiting for GPU completion, I read back every component of every texel: 0.25 throughout the first texture and 0.75 throughout the second. An independent repeat of the adjacent pair on the RTX 3080 reproduced the stock overlap and the successful PR readback, with zero skips. These were synthetic tests; whether GTA VI uses this placement pattern remains open.

I used Codex GPT-6 Sol Daybreak for the WARP fixture and GPT-6.2 Sol for physical GPU verification and independent review. Codex GPT-6.2 Astra wrote this comment.

I reviewed and approved this comment before posting.

@jennydeth

Copy link
Copy Markdown

Windows / NVIDIA results for e07d03b with the retail title (1.0.2.1) on an RTX 3060 12 GB. This is a regression check only: my title (9cc6a39e) is not the one in the PR's runs (16b5e5d4).

Regression run (default settings, 600 s)

main b49be18:

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 3060
title: 9cc6a39e
seconds: 600
exit: 0x0
frames shown: 2047 (PresentX 2047)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 35859 MB

This PR, e07d03b:

xcl-smoke v1
commit: e07d03bf0fc1bcbfac3d369d2f7eeed5eba6afd7
gpu: NVIDIA GeForce RTX 3060
title: 9cc6a39e
seconds: 600
exit: 0x0
frames shown: 1978 (PresentX 1978)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 35177 MB
  • This PR has 1,978 frames against main's 2,047 (97 %) and peak commit of 35,177 MB against 35,859 MB (98 %), with no removal and no crash in either. Neither run reaches the world: presents stop at 100.3 s on main and at 94.2 s with this PR, while big compute programs are still compiling.
  • I can't tell from the logs whether this title creates a 3-D texture XG refuses: not every CreatePlacedResourceX is logged, and the new path logs nothing. The frames dumped in the pair are start-up and loading screens, so they don't show colour grading.
  • Direct DXIL (XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_DRED=1, warm caches, 900 s): the device was lost (0x887a0005, NVIDIA: the device is removed when the pipelines in use need more than 512 MB of shader code (0x887a0005) #2403) at 194.3 s, last present at 124.7 s, with the same DRED line as on main (page fault at GPU VA 0x0; allocations there: []; recently freed: []). Three b49be18 runs today with the same switches lost it at 110.6, 211.2 and 216.0 s, so one run can't tell this PR apart from main there.

Tested

  • NVIDIA GeForce RTX 3060 12 GB, driver 32.0.16.2101 (32-lane waves only); Ryzen 5 5600X; 32 GB RAM; Windows 11 Pro 10.0.26300.9974; Rust 1.100.0 (stable-x86_64-pc-windows-msvc); release; DXC 1.9.2609.5.
  • cargo test --workspace --release --no-fail-fast -- --test-threads=4 on e07d03b: 1436 passed, 0 failed, 47 ignored. SKIPPED (29): 21 × no wave64; 3 × per-lane form refused; 3 × no D3D12 debug layer / d3d12SDKLayers.dll; 1 × no heap windows; 1 × pso_measurement_compiles_an_exact_synthetic_record (cannot disable the driver cache).
  • Retail title 1.0.2.1, scripts/smoke.ps1 -Game <folder> (XCL_NETWORK=0), the same scripted pad presses into the story load in every run; XCL_FRAME_DUMP=300 in the pair, 100 in the direct DXIL runs. Every run was of a copy named xcl-noprofile.exe: this machine has xcl run: xcl nvprofile puts xcl.exe in an NVIDIA profile with a bigger shader heap (#2403) #2590's 1 GiB shader-heap profile on xcl.exe, and a copy under another name does not match it.

Not tested: #505's title; a frame of the world (no run gets that far); AMD / wave64.

AI use: Claude Code (Claude Opus 5.5) built the commit, ran the suite and the runs on my machine, read the logs and wrote this.

@Royalflamejlh

Copy link
Copy Markdown
Contributor

On Linux + NVIDIA (RTX 4060 Ti 16 GB), this PR took away the large white shapes over the title's opening scenes that we reported on #505 (7199770263): with it, 0 of 25 frames dumped after the world load were over 20 % near-white (2 of 2 runs); without it, 43 of 48 were (5 of 5 runs).

Setup: NVIDIA 615.71.09, Wine 11.21 Staging, vkd3d-proton v3.1-90-g30b0eb9b with the relaxed-vtable patch from #175, a local dxil-spirv patch, and its allocator Reset releasing the command pool's memory (#2404, 7189698499); main b49be18 + #684, #751, #1599, #1860, #2082, #2404 5b9d4ff, #2633 db34184, #2707 dff6edc, #1803 cb007514, #2229 d2dee320, #1975 72960386 and a log line of ours (the tree of that report), ± this PR e07d03bf; two of the four runs without it also had #2513, or #2513 + #768; XCL_DIRECT_DXIL=1 XCL_HUGE_PSO_WANTED_CONCURRENCY=6; 300 s; a frame dumped every 10th present (every 30th in 035941-a). Near-white: all three channels > 230, every 4th pixel.

this PR run the skyline over the sea: near-white dumped frames after the world load over 20 % near-white
without 035941-a 31.4 % (162.0 s) 4 of 4
without 102821-a 38.9 % (156.0 s) 11 of 13
without 101117-a not among its kept frames (only the last 10 kept) 9 of 10
without (+ #2513) 115242-a 38.7 % (178.6 s) 9 of 9
without (+ #2513 + #768) 121152-a 30.5 % (131.5 s) 10 of 12
with 122418-a 0.1 % (163.2 s) 0 of 12
with 123029-a not among its dumped frames 0 of 13 (at most 0.9 %: the title card's letters)
  • The white was faintly cyan: its pixels average (239, 250, 255) in all four skyline frames without the PR.
  • No device removal in any of the six runs.
  • Read: only a 3-D texture that XG gives no size for gets one now, the bytes of its texels (device_x.rs:1089, console_bytes falling back to volume_texel_bytes); every other texture is placed as before. The path logs nothing, so these runs show the frames, not the placements.

Not tested: Windows; AMD; this PR on main alone.

AI use: Claude Code (Claude Opus 5.5) merged the trees, made and read the runs, and wrote this.

Posted without review by a person: the account owner was away and reads replies later.

@razormontana

Copy link
Copy Markdown
Contributor

Independent native Windows validation of #2753 for #505

Tested

  • Clean PR head e07d03bf0fc1bcbfac3d369d2f7eeed5eba6afd7, parent b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7. Windows 11 Pro 22631, Core i7-10700K, NVIDIA GeForce RTX 3070 8 GB, driver 617.42 (32.0.16.1742), Rust 1.100.0 MSVC, debug.

  • cargo test --offline --locked -j 1 -p xcl --lib --no-run succeeded with two existing Rust deprecation warnings. Each filter below ran with cargo test --offline --locked -j 1 -p xcl --lib <filter> -- --exact --test-threads=1 --nocapture. The five runs reported 5 passed, 0 failed, 0 ignored, 0 skips in total.

  • hle::d3d12x::device_x::tests::volume_targets_xg_does_not_lay_out_keep_to_their_texels (CPU)

  • hle::d3d12x::vram::tests::owned_pages_never_alias_disjoint_ranges (CPU)

  • hle::d3d12x::vram::tests::packed_console_3d_mip_tails_use_the_detile_upload_path (CPU)

  • gpu::texture::tests::gpu_console_textures_upload_every_mip_and_slice (GPU)

  • hle::d3d12x::device_x::tests::gpu_depth_buffer_created_for_unordered_access_is_placed (GPU)

  • A standalone native D3D12 probe selected the RTX 3070 by name and queried a reserved 33×33×33 one-mip RGBA16F render target with UAV access. It reported tiled-resource tier 3 and 18 tiles with 32×16×16 texels per tile and a 2×3×3 grid. Build and run from the probe directory with cl.exe /nologo /W4 /EHsc /std:c++17 volume-footprint.cpp /Fe:volume-footprint.exe /link d3d12.lib dxgi.lib and .\volume-footprint.exe.

  • The focused CPU test checks XG's size fallback and ownership of two targets 512 KiB apart. The 287,496-byte fallback covers five guest-address pages per target, so their owned ranges are disjoint. Using the driver’s 18-tile count as the guest span on the parent would overlap ten pages. The GPU readback test covers tiled volume uploads separately. The two Rust GPU fixtures use the default D3D12 adapter.

Not tested

The exact adjacent 3D render-target pair in a GPU readback, retail world rendering, whole-workspace or parent runs, and net VRAM usage. The footprint query measures tile count. The fallback changes which addresses own those tiles.

AI use

Codex GPT-6.2 reviewed the diff, wrote the standalone footprint probe, ran the checks and drafted this report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants