D3D12.X: constant buffer views are float4 rows (stride 16), not raw buffers #335
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!335
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/335/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@ozimchuk on GitHub · 2026-11-23 23:47 UTC · original
ozimchuk:cbv-stride→main· +24 −3 · 2 files · 1 commits · merged 2026-11-24 00:03 UTCFixes #307. The black image with a 1-pixel diagonal reported in #175.
CreateConstantBufferView(real.rs,dev_create_cbv_x) wrote every CBV as a raw V#: stride 0, num_records in bytes. Console shaders also read constant-buffer arrays withbuffer_load_* … idxenand the row number as the index. With stride 0 the index is ignored (the recompiler follows the hardware rulebase + stride·index), so every such read returns row 0. A retail game's UI element VS (28d887aa04ffa15a) reads its transform as two rows,4k+2and4k+3. With both equal, every vertex lands on x = y and the whole UI collapses onto the screen's diagonal.Where the title writes this descriptor itself, it writes
[base, 0x00100004, 0x00000060, 0x0002403c]for the same 1536-byte buffer (@FilipeSilvens' trace in #175): stride 16, num_records = size / 16. XCL's CBV now matches that. @notdxbi found the same cause independently in #175; @wiktorekdev carries the same change locally.Discussion
ignore_shared_fence, an audio device).What is in it
desc::cbv_words(address, size): stride 16, num_records = ceil(size / 16), format 32_32_32_32_FLOAT.dev_create_cbv_xuses it instead ofbuffer_words(va, 0, size, 22).s_buffer_loadbounds atnum_records × stride. One difference: a vector load by byte offset is now bounded by the row index (always 0 there), not by the byte size. Reads inside the buffer are unchanged.gpu::desc::tests::cbv_is_float4_rows.Tested
VKD3D_CONFIG=ignore_shared_fence, DXVK dxgi; Rust 1.100.0,x86_64-pc-windows-gnu, release.cargo test -p xcl --libunder Wine, without a GPU, main and this branch: 613 passed / 12 failed / 21 ignored on main, 614 / 12 / 21 here. The extra pass is the new test, and the 12 failures are the same on both: tests that need a D3D12 device or the LLVM corpus.XCL_FRAME_DUMP=1):Regression run
Made under Wine on Linux with the equivalent of
scripts/smoke.ps1:XCL_NETWORK=0 XCL_RUN_SECONDS=120 XCL_ACTIVITY=1 xcl.exe run <title>, the same block read from the log. Both builds come from clean checkouts of the two commits. Peak commit reads 0 under Wine.main:
PR:
Not tested
scripts/smoke.ps1itself (no Windows machine here).CreateConstantBufferViewon others (#307). Either way, the CBV path now writes what the title would.AI use
🤖 Generated with Claude Code
AI-assisted.
idxenreads from a CBV ignore the index – measured on Linux, Windows measurement wanted #307mainreaches on Windows; the obstacle is replaced vtables — proposal: proxies #175@throny on GitHub · 2026-11-23 23:56 UTC · original · edited 2026-11-23 23:58 UTC
Test report for
01a7446, merged onto currentmain2b4bb43(clean merge, merge commitdbbb4cd): pass.Tested
stable-x86_64-pc-windows-msvc, debugcargo build --workspace && cargo test --workspace -- --test-threads=4: 671 passed, 0 failed, 41 ignored (lib: 631 / 0 / 21,gpu::desc::tests::cbv_is_float4_rowsok)SKIPPEDon this adapter:gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(no wave64)cbv_wordsreturningmain's encoding (buffer_words(address, 0, size, 22)),cbv_is_float4_rowsfails (left: (…, 0, 1536, 22),right: (…, 16, 96, 77)).Reviewed (read the whole diff)
smemlimits bynum_records × stridewhen the stride is non-zero, sos_buffer_loadkeeps the 1536-byte limit. Checked.offen, noidxen): with stride 16,in_rangebecomes0 < num_records, so a read past the view's end is no longer zeroed. The description says so already; reads inside the view are unchanged.0x0002403c) has format field 0x24, whilecbv_wordswrites 77 (32_32_32_32_FLOAT). This would only matter for abuffer_load_formaton a CBV.Not tested
scripts/smoke.ps1) on a title, and noXCL_SAMPLE_*game-data tests.AI use
@ivall on GitHub · 2026-11-24 00:03 UTC · original
Merged (
a6f5f7a). Checked on an RX 9070 (RDNA4) on maina6f5f7a, together with #335, #322, #331, #330, #338, #318 and #332:cargo test --workspace -- --test-threads=4- 636 unit tests passed, 0 failed; the retail game reaches its menu and draws it (frame dump) and goes on past it. The menu's UI draws as before on Windows with the stride-16 CBVs.@ryosen0 on GitHub · 2026-11-24 00:06 UTC · original
Test report on our machine with this PR's head (
01a7446) stacked on maindb1ddb2+ #300 + #294 + #273 + #236 + #304: Ryzen 7 9800X3D, RTX 3060 Ti 8 GB (wave32), driver 32.0.16.1742, Windows 11.XCL_NETWORK=0 XCL_RUN_SECONDS=420 XCL_ACTIVITY=1 XCL_TRACE_FAULTS=1 xcl run <retail folder>: clean exit at the timer, 7570 frames shown, no crash, no fault lines, no device removal. The run stayed alive well past the point where an earlier stack died: fps 30 -> ~13-25 while memory grows (t=418 s: 28420 MB committed by the process, 13540 MB local + 4641 MB non-local video memory on the 8 GB card), which looks like continued asset streaming. What is on screen at that point is not something this report can claim - the run was unattended.For comparison, our previous stack without this PR (main
4017f8f+ #300 + #294 + #273/+#208 + #283/+#252) crashed at t=395 s in a 600 s run with 0xc0000005 (write at 0xc43440110, game+0x35a47bc) at ~26.6 GB commit. Different stack, so this is not a controlled A/B of this PR alone - but no regression on our hardware and the run went further.The artwork-intro slow stretch (4.4-8.6 fps, t~45-165 s) is unchanged with this PR; we measured it identical with and without the audio PRs, so it is not this CBV path either.
Not tested: unit tests for this report (run-only data point); the diagonal-collapse case from #175 (we never saw it on NVIDIA).
AI use: GPT-6.2 Astra (API model selector) ran the build and run and wrote this report; the human contributor reviewed it.
mainreaches on Windows; the obstacle is replaced vtables — proposal: proxies #175