[pr-fix][shaders][linux-proton][NVIDIA] Constant tables from a root SRV under Wine, not in-shader arrays (#298) #394
Loading…
Reference in a new issue
No description provided.
Delete branch "uuwf0/Darner:pr-fix/code-table-root-srv"
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?
Run in the game on Linux/Proton only (RTX 5090). Not run on Windows, where nothing changes unless
DARNER_CODE_TABLE_ROOT=1is set.Fixes #298
Contributor role (optional)
What it changes
Xid 13 ... MMU Faulton driver 620.73,Xid 109 CTX SWITCH TIMEOUTon 615.78, and vkd3d-proton only logsFailed to wait for Vulkan timeline semaphore, vr 2. The same PC under Windows 11 runs fine.A program's constant table (the data the console compiler appends to the code and reads through
s_getpc_b64) is lowered to an internal constant array in the shader (constant_global("code", …)inLower::code_dword). vkd3d-proton turns that into a SPIR-VPrivateper-thread array, which NVIDIA's Linux driver keeps in per-thread scratch memory (about 125 MB per KB of table).This change ports VictoryArch's "M16a" fix (branch darner-up94, 7bc606d), on its own: under Wine, the table is read from a raw root SRV that the host fills once per distinct table.
darner-shader:SLOT_CODE_TABLE(t249) andSLOT_CODE_TABLE_PS(t248, pixel shaders) inROOT_CBV_SPACE.code_dwordreads the dword withrawBufferLoadinstead of indexing the array, using the same clamp to the last dword.HostShader::code_tablecarries the dwords to the host.darner-gpu:code_table_addresspacks the tables into default-heap buffers (4 MiB chunks, 256-byte steps), copies them in once withinplace::Rigand waits for the copy. Identical tables share one copy.draw.rsbinds the address as a root SRV, and the slot is skipped where title roots are read. A pipeline whose table cannot be placed is refused with a reason (logged once).set_host_wine(on_wine()), at device start-up and indarner translate/warm), off elsewhere.DARNER_CODE_TABLE_ROOT=1turns it on anywhere,=0off anywhere. The log saysconstant tables read from root SRVswhen it is on.host_settings(), so it is in the shader cache key.shader_cache::FORMATis now 2, because entries now carry the table.How it was tested
Tested revision:
ab1c30d(on mainf3840d7)Commands and results (Linux, cross-built with
cargo xwin, Wine for the tests):cargo xwin clippy --workspace --all-targets --locked --target x86_64-pc-windows-msvc -- -D warnings: clean.--all-features: clean.cargo xwin test --workspace --locked --target x86_64-pc-windows-msvc --no-fail-fast -- --skip oracle64::legacy_mul_forms_are_exactunder Wine (no D3D12 in the prefix, so tests that need a card fail or skip). Branch: 3238 passed, 108 failed; mainf3840d7with the same command: 3238 passed, 107 failed. The lists match except 3 tests that failed only on the branch and 2 only on main, all timing tests (fence::tests::a_null_event_blocks_until_the_value_is_reached,modules::xmem::tests::a_title_thread_goes_on_using_the_rest_of_a_view,run::tests::late_dll_publishes_to_other_threads_only_after_attach_succeeds; on maincrash::tests::concurrent_crash_records_stay_together,queue::tests::a_queued_wait_or_signal_keeps_its_fence). Rerun alone on the branch, 3 times each: 3/3, 2/3 and 3/3 pass. The skipped test walks all 2^32 floats and had not finished after 14 minutes in a debug build under Wine; it is untouched here.pipeline::host::tests::constant_tables_live_in_the_cards_memory, under Wine with vkd3d-proton 0959f0e on the RTX 5090: passes and reaches its last check (tables in a default heap, read back as written, 256-byte steps, the same table at the same address).cargo xtask policy: 555 files ok.Changes a default: yes, under Wine/Proton only. Windows is unchanged.
A/B result, same PC (RTX 5090), Proton Experimental, driver 615.78.08, the same automated input each run:
DARNER_CODE_TABLE_PRIVATE=1)ab1c30d), run 1DARNER_CODE_TABLE_ROOT=0)constant tables read from root SRVsab1c30d), run 2VictoryArch reports no frame-time change from this fix (46 ms against 44 to 46 ms around it, under Proton).
Gates run on that revision: 1, 2 and 3 (3 under Wine, see above), all cross-built on Linux. Not run on Windows.
Gameplay: RTX 5090, Series X profile, 1080p to 1440p, DLSS quality, no frame generation, ray tracing off; the settings from #298 (
DARNER_AMBIENT=0.8,DARNER_PORT_CONSTANTS=1), the same in A and B. Runs are automated: the profile picker is passed with scripted Enter presses (DARNER_KEYS,DARNER_CONTROLS=keyboard,DARNER_MNK=1), then the world loads with no further input; PASS means 2048 frames shown in the world with no Xid injournalctl -k. No frame-time comparison was made (A never gets that far).Shader wave sizes tested: 32 lanes (the host reports
host wave lanes min=32 max=32).Hardware dependence: the hang is seen on NVIDIA's Linux driver (620.73 and 615.78). Untested on other cards under Proton (AMD/RADV, Intel). The switch is on for them too under Wine, since the table read is the same either way.
Coverage gaps: no translator unit test lowers a program through the root-SRV path (the lowering is exercised in the game only). Not run on Windows with
DARNER_CODE_TABLE_ROOT=1.Checklist
main.docs/asset-policy.md.Checked for overlap
lower.rs/shader.rs/shader_cache.rs), #303 and #312 (shader_cache.rskeys), #349 (Wine test fixes inpipeline/host.rs). None moves constant tables.[pr-fix][shaders][linux-proton][NVIDIA] Constant tables from a root SRV under Wine, not in-shader arrays (#298)to [pr-fix][shaders][linux-proton][NVIDIA] Constant tables from a root SRV under Wine, not in-shader arrays (#298)View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.