Repository navigation
GPU: compile internal HLSL and serialize root signatures natively under Wine/Proton - #127
BitWuehler wants to merge 1 commit into
Conversation
Wine can compile the pixel shader while dropping its embedded root signature. Create the signature explicitly for the depth pass and its readback test. Adapted from BitWuehler’s depth-plane changes in fxceless#127 (cc79860).
|
Additional in-world confirmation from |
ErRusso
left a comment
There was a problem hiding this comment.
Reviewed at cc79860 against 2119b0e.
The no-DLL approach is interesting, but it is a competing implementation of #20 and is not complete:
- It rewrites the internal shaders to structured word buffers and serializes root signatures, but it does not touch
inplace.rs, so the in-place probe still usesRWByteAddressBuffer/Load/Storeand still fails under Wine. - It replaces the shaders rather than falling back, so every shader change has to preserve byte/word offsets and root layouts manually; #20 keeps the existing HLSL and is validated on Proton Experimental and GE-Proton11-14.
- The world run is from a prior commit on
4e17478with extra switches, not this head.
Please close/coordinate with #20, or add the in-place probe and a current-head integration run. As a duplicate, it should not merge alongside #20.
|
Confirmed the card-compare fix on an RTX 5060 Laptop GPU (8 GB), Bazzite 44, NVIDIA 615.78.08, Proton Experimental 11.0-20261112 and vkd3d-proton In the running Series S account picker, the control reported zero GPU-side buffer copies and logged the card-compare initialization failure. With this PR applied it reported one 174 MiB GPU-side copy. Gameplay performance was outside this comparison. OpenAI Codex assisted with testing and this report. |
What & Why
Under Wine/Proton, built-in
d3dcompiler_47(vkd3d-shader) refusesvictory-gpu's internal HLSL in two ways (see #20, #28):ByteAddressBuffer/RWByteAddressBuffermethods (E5005) and[allow_uav_condition](E5017) fail compilation in the indirect-argument clamp (indirect.rs) andCARD_COMPARE(host.rs).[RootSignature(RS)]annotations are stripped (noRTS0chunk), causingID3D12Device::CreateRootSignatureover the shader bytecode to fail withE_FAIL (0x80004005)inCARD_COMPARE,PlanePass(no pipeline to draw a depth plane from its twin), and unit tests (resource::tests::a_depth_planes_twin_is_drawn_into_the_plane,indirect::tests::WORKER_CS).Rather than requiring an external DXC/DXIL SDK fallback at runtime, this change adjusts the four small internal shaders and serializes their root signatures in Rust so Wine's built-in
d3dcompiler_47(vkd3d-shader) compiles everything natively with zero external DLLs:host.rs,indirect.rs):ByteAddressBuffer/RWByteAddressBuffer(Load/Store/atomic methods) with 32-bit word-indexedStructuredBuffer<uint>/RWStructuredBuffer<uint>inCARD_COMPARE,indirect.rs's clamp shaderSOURCE, and testWORKER_CS. Since D3D12 root SRVs/UAVs bind raw buffer GPU VAs with identical descriptors for 4-byte-aligned word buffers, no pipeline binding changes are needed (>> 2/* 4preserves exact byte offsets).[allow_uav_condition]inindirect.rs.make_card_workinhost.rs(matchinghost::compile).host.rs,indirect.rs,resource.rs):crate::host::root_signature_from_params(plusroot_param_constantsandroot_param_descriptor) usingD3D12SerializeRootSignature, and removed#define RS/[RootSignature(RS)]acrossCARD_COMPARE,PlanePass(PLANE_STEPS/PLANE_FLOATS),indirect.rs(SOURCE,WORKER_CS), andresource.rs(a_depth_planes_twin_is_drawn_into_the_plane).indirect.rs):indirect::tests::system_d3dcompile_builds_internal_hlslcompiling all 6 internal HLSL entrypoints (clamp,card_compare,plane_corners,plane_steps,plane_floats,worker_cs) throughcrate::host::compile.Verification
Tested on CachyOS Linux (
GE-Proton11-14,vkd3d-proton, NVIDIA RTX 5080, driver620.73.4,VKD3D_DISABLE_EXTENSIONS=VK_NV_raw_access_chains):cargo xtask policy:169 files okcargo clippy -p victory-gpu --all-targets --target x86_64-pc-windows-msvc -- -D warnings: passed (0 warnings)cargo build --release -p victory --target x86_64-pc-windows-msvc: passedvictory-gputest suite under Proton (GE-Proton11-14): 110 passed, 1 ignored, 1 failedindirect::tests::system_d3dcompile_builds_internal_hlsl,indirect::tests::argument_clamp_builds,indirect::tests::warp_card_compare_stores_the_hash_it_made_when_told,resource::tests::a_depth_planes_twin_is_drawn_into_the_plane, etc.).pipeline::library::tests::a_rejected_blob_gives_an_empty_library(ID3D12Device1::CreatePipelineLibraryunimplemented stub invkd3d-proton, same unrelated failure noted in GPU: compile our run-time HLSL with DXC when the system compiler refuses it (Wine/Proton) #20).CARD_COMPARE+indirectfixes active on4e17478+VICTORY_RELAY=2+ upstream#454): reached playable lit world for 464s / 3,815 frames with zero device losses and zerono argument clamp/no host copies in the cardwarnings. Loggingno pipeline to draw a depth plane from its twin (0x80004005)in that run led to includingPlanePassin this PR as well.(Prepared and tested with AI assistance.)