Skip to content

D3D12.X: size large BC texture addresses from the guest layout - #935

Open
Gevroska wants to merge 1 commit into
xcl-dev:mainfrom
Gevroska:xcl-local/committed-bc-texture-size
Open

Gevroska wants to merge 1 commit into
xcl-dev:mainfrom
Gevroska:xcl-local/committed-bc-texture-size

Conversation

@Gevroska

Copy link
Copy Markdown

A valid committed BC texture could receive a zero CPU address (#548).

What is in it
real.rs uses the guest XG layout for the fallback reservation. Adds a BC1 regression and updates README.md.

Tested
RTX 3080 616.92, Ryzen 7 5700X, Win11 26200.9457, Rust 1.100.0 MSVC. Debug scripts/test.ps1 --nocapture: 685 passed, 0 failed, 41 ignored. Four runtime skips: two native wave64 and two debug-layer cases. The BC1 test failed on main and passed here with a 512 MiB guest layout and 128 MiB PC allocation.

Regression run
Release, same title, 60 s, no input.

xcl-smoke v1
commit: 9ce2070eccf436d7bd38601c90407da447df34f3
gpu: NVIDIA GeForce RTX 3080
title: retail-title
seconds: 60
exit: 0x0
frames shown: 600 (PresentX 601)
presents per 2 s (last 3): 27 34 19
device removals: 0
crashes: 0
peak commit: 15613 MB
xcl-smoke v1
commit: 96a56e0ba7127fdb89c47f60bf8f987ec1c9b553
gpu: NVIDIA GeForce RTX 3080
title: retail-title
seconds: 60
exit: 0x0
frames shown: 767 (PresentX 767)
presents per 2 s (last 3): 28 23 33
device removals: 0
crashes: 0
peak commit: 15592 MB

Not tested
AMD, Intel, Windows 10 or use of this fallback by the retail title.

AI use
Codex GPT-6.2 Sol high wrote and tested the patch. GPT-6.2 Sol xhigh prepared the comparisons and description; a separate Sol xhigh independently reviewed and GPU-tested it.

The texel estimate can exceed 1 GiB for committed BC textures that fit once swizzled. The normalized PC description discards the guest layout, and a tightly packed block count can miss guest tile padding.

Record the supported XG size on a BC resource when the legacy estimate rejects it. Keep the lazy reservation limit and existing addresses. On an RTX 3080, the 128 by 16384 BC1 array had a 128 MiB D3D12 allocation and a 512 MiB guest layout.

Assisted-by: Codex (GPT-6.2 Sol high)
@ettehn

ettehn commented Nov 24, 2026

Copy link
Copy Markdown

The two BC1 fixtures on 96a56e0 pass on my RTX 5070 Ti Laptop. There is one more sizing case worth covering: a supported tiled layout can need more space than the legacy estimate even when that estimate fits under the 1 GiB cap. The current early return then discards the XG size. This appears to be a remaining limitation of the original sizing path.

A local change compared the padded guest requirement with the legacy reservation before discarding the original description. It kept the legacy reservation when sufficient and used the recorded layout when more space was needed, with the same cap at reservation time. All four console_format_query_tests passed on Windows, including an additional narrow BC array checked with VirtualQuery. This verifies the reserved CPU range; retail loading and texture upload were outside the test.

OpenAI Codex (GPT-6.2 Astra) assisted with verification.

@dcastell1

Copy link
Copy Markdown

Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on clean main@beaa245 (713 passed, 0 failed, 41 ignored on this box):

patch -p1 < this PR            # clean, no fuzz
cargo test --workspace -- --test-threads=4
714 passed; 0 failed; 41 ignored   (exit 0)

One more passing test than main: sizing large BC texture addresses from the guest layout is covered and green.

Tree restored afterwards (md5 and a full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.

@SlopTart

Copy link
Copy Markdown

Linux / AMD RDNA3 datapoint.

Merged state: head 96a56e0 onto main 9aec53d, clean merge.

Full suite, cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4: 718 passed, 7 failed, 41 ignored; failures are the known Wine-lane set from my #42 rows. large-BC-texture address sizing green.

Not tested: retail titles (none here), Windows, RDNA4.
Counts only, no game data.

Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross x86_64-pc-windows-gnu, XCL_NETWORK=0, release profile, --test-threads=4. My Linux rows: #42 / #718.

AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.

@Gevroska

Copy link
Copy Markdown
Author

Thanks for testing this. The current fix covers the large-allocation fallback. Your example points to a separate early return that can discard a larger layout size below the cap. I’ll check that path with the narrow BC array before deciding whether to include it in this PR.

@thaqiart139-alt

Copy link
Copy Markdown

Test report for this PR's head 96a56e0, merged into main 689f2db (no conflicts), on AMD RDNA2 with native 64-lane waves and on a 32-lane NVIDIA card.

Tested

  • GPUs: AMD Radeon(TM) Graphics, the RDNA2 iGPU of a Ryzen 7 7800X3D (native wave64, driver 32.0.21045.29003), and NVIDIA GeForce RTX 5070 (driver 32.0.16.2101), chosen with XCL_ADAPTER.
  • System: 32 GB, Windows 11 Home build 26300, Rust 1.100.0, debug, DXC 1.9.2602.17.
  • cargo test --workspace --no-fail-fast -- --test-threads=4:
main 689f2db with this PR
RTX 5070 971 passed, 4 failed, 45 ignored 972 passed, 4 failed, 45 ignored
Radeon iGPU 974 passed, 1 failed, 45 ignored 975 passed, 1 failed, 45 ignored
SKIPPED tests (the same on main and with this PR)
  • RTX 5070:
    • no wave64:
      • gpu::recomp::lower::tests: a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu, coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu, cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu, the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu
      • gpu::recomp::lower_dxil::tests::a_per_lane_2d_or_3d_group_runs_on_the_gpu, and the wave64 cases of its f16 / f32 / f64 / integer_programs_on_the_gpu
      • gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware
    • the wave32 per-lane cases of lower_dxil's f16 arithmetic, f16 packed and f32 conversions: refused ("its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's")
    • heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows)
    • pso_measurement_compiles_an_exact_synthetic_record (Windows Developer Mode is off)
  • Radeon iGPU:
    • no mesh shaders: gpu::dxil::geometry_tests::gpu_geometry_direct_records, emitted_ms_primitive_attribute_reaches_the_pixel_shader, emitted_ms_ps_draw_a_triangle, gpu_geometry_mode_es_gs_strip, gpu_geometry_mode_es_gs_strip_with_branches, gpu_mesh_mode_two_passes
    • the wave32 and wave64 per-lane cases of lower_dxil's f16 arithmetic, f16 packed and f32 conversions: refused, as above
    • heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows)
    • pso_measurement_compiles_an_exact_synthetic_record (Developer Mode is off)

Not tested

  • a title run (whether a title takes this fallback), Intel, Windows 10; other GPUs; Linux / Wine.

AI use

  • Claude Code (Claude Opus 5.5) ran the builds and tests and wrote 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.

5 participants