mesh_rest and gpudetile call D3DCompile directly: the mesh "rest" pipeline and the GPU detile are never made under Wine/Proton #2030

Closed
opened 2026-11-29 08:04:04 +00:00 by github-bot · 3 comments
Owner

@⁠birdneststream on GitHub · 2026-11-29 08:00 UTC · original

Found while running the layer under Proton on an RTX 5090 (Linux); the fix is in our fork's tree and tested there. Diffs are against current main (e1f2eb60) and compile there.

What happens

hlsl.rs routes every helper shader through the system compiler and then DXC, with the reason in its own comment: Wine's builtin compiler leaves [RootSignature] out of the code, and every helper that reads its root signature out of its code was off under Wine for that. Two helpers were missed: mesh_rest.rs and gpudetile.rs call D3DCompile straight.

Under Proton: WARN victory_gpu::gpudetile: VICTORY_GPU_DETILE: the detile shader could not be made; textures are detiled on the PC error=Call failed. (0x80004005) in every play log, and mesh_rest::tests::rest_pipeline_binds_draws_and_runs fails with E_FAIL (the same under plain wine-staging 11.22 with the vkd3d-proton master build beside the test binary).

The change

Both go through crate::host::compile and crate::hlsl::blob, as the composer does.

diff --git a/crates/victory-gpu/src/gpudetile.rs b/crates/victory-gpu/src/gpudetile.rs
index ac10870ba..cd5755a75 100644
--- a/crates/victory-gpu/src/gpudetile.rs
+++ b/crates/victory-gpu/src/gpudetile.rs
@@ -158,36 +158,10 @@ unsafe impl Sync for Detiler {}
 
 /// Compiles [`SOURCE`] (`cs_5_1`, the root signature inside it) on `device`.
 pub(crate) fn make(device: &ID3D12Device) -> windows::core::Result<Detiler> {
-    use windows::Win32::Graphics::Direct3D::Fxc::D3DCompile;
-    use windows::Win32::Graphics::Direct3D::ID3DBlob;
-    let mut code: Option<ID3DBlob> = None;
-    let mut errors: Option<ID3DBlob> = None;
-    // SAFETY: the source and names live through the call; the out
-    // pointers are ours.
-    let compiled = unsafe {
-        D3DCompile(
-            SOURCE.as_ptr().cast(),
-            SOURCE.len(),
-            windows::core::s!("texture detile"),
-            None,
-            None,
-            windows::core::s!("main"),
-            windows::core::s!("cs_5_1"),
-            0,
-            0,
-            &mut code,
-            Some(&mut errors),
-        )
-    };
-    if let Err(e) = compiled {
-        if let Some(errors) = errors {
-            // SAFETY: the blob's own bytes.
-            let text = unsafe { std::slice::from_raw_parts(errors.GetBufferPointer().cast::<u8>(), errors.GetBufferSize()) };
-            tracing::warn!("the texture detile shader: {}", String::from_utf8_lossy(text));
-        }
-        return Err(e);
-    }
-    let code = code.ok_or_else(windows::core::Error::empty)?;
+    // The system's compiler, then DXC (`crate::hlsl`), as every helper shader:
+    // a direct `D3DCompile` failed under Wine/Proton's builtin compiler and
+    // the GPU detile was never made there (2026-11-29).
+    let code = crate::hlsl::blob(&crate::host::compile(SOURCE, windows::core::s!("main"), windows::core::s!("cs_5_1"))?)?;
     // SAFETY: the blob's own bytes; the root signature is inside the shader.
     unsafe {
         let bytes = std::slice::from_raw_parts(code.GetBufferPointer().cast::<u8>(), code.GetBufferSize());
diff --git a/crates/victory-gpu/src/mesh_rest.rs b/crates/victory-gpu/src/mesh_rest.rs
index b7d5605c2..fdd803de9 100644
--- a/crates/victory-gpu/src/mesh_rest.rs
+++ b/crates/victory-gpu/src/mesh_rest.rs
@@ -46,8 +46,7 @@ pub(crate) fn line(frames: f64) {
     }
 }
 
-use windows::Win32::Graphics::Direct3D::Fxc::D3DCompile;
-use windows::Win32::Graphics::Direct3D::{D3D_PRIMITIVE_TOPOLOGY_POINTLIST, ID3DBlob};
+use windows::Win32::Graphics::Direct3D::D3D_PRIMITIVE_TOPOLOGY_POINTLIST;
 use windows::Win32::Graphics::Direct3D12::*;
 use windows::Win32::Graphics::Dxgi::Common::DXGI_SAMPLE_DESC;
 use windows::core::s;
@@ -125,24 +124,12 @@ pub(crate) fn rest() -> Option<&'static Rest> {
 }
 
 fn make(device: &ID3D12Device) -> windows::core::Result<Rest> {
-    let mut code: Option<ID3DBlob> = None;
-    // SAFETY: the source and names live through the calls; the blob's bytes
-    // live while it does.
+    // The system's compiler, then DXC (`crate::hlsl`), as every helper shader:
+    // a direct `D3DCompile` made this pipeline fail to be created under
+    // Wine/Proton, where the builtin compiler is not enough (2026-11-29).
+    let vs = crate::hlsl::blob(&crate::host::compile(SOURCE, s!("vs"), s!("vs_5_1"))?)?;
+    // SAFETY: the blob's bytes live while it does.
     unsafe {
-        D3DCompile(
-            SOURCE.as_ptr().cast(),
-            SOURCE.len(),
-            s!("mesh_rest"),
-            None,
-            None,
-            s!("vs"),
-            s!("vs_5_1"),
-            0,
-            0,
-            &mut code,
-            None,
-        )?;
-        let vs = code.ok_or_else(windows::core::Error::empty)?;
         let bytes = std::slice::from_raw_parts(vs.GetBufferPointer().cast::<u8>(), vs.GetBufferSize());
         let root: ID3D12RootSignature = device.CreateRootSignature(0, bytes)?;
         let desc = D3D12_GRAPHICS_PIPELINE_STATE_DESC {

Rig (wine-staging 11.22, RTX 5090): rest_pipeline_binds_draws_and_runs passes after; no other test moved. The detile warning is gone from the play log.

**@⁠birdneststream** on GitHub · 2026-11-29 08:00 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/2030) Found while running the layer under Proton on an RTX 5090 (Linux); the fix is in our fork's tree and tested there. Diffs are against current `main` (`e1f2eb60`) and compile there. ## What happens `hlsl.rs` routes every helper shader through the system compiler and then DXC, with the reason in its own comment: Wine's builtin compiler leaves `[RootSignature]` out of the code, and *every helper that reads its root signature out of its code was off under Wine for that*. Two helpers were missed: `mesh_rest.rs` and `gpudetile.rs` call `D3DCompile` straight. Under Proton: `WARN victory_gpu::gpudetile: VICTORY_GPU_DETILE: the detile shader could not be made; textures are detiled on the PC error=Call failed. (0x80004005)` in every play log, and `mesh_rest::tests::rest_pipeline_binds_draws_and_runs` fails with `E_FAIL` (the same under plain wine-staging 11.22 with the vkd3d-proton master build beside the test binary). ## The change Both go through `crate::host::compile` and `crate::hlsl::blob`, as the composer does. ```diff diff --git a/crates/victory-gpu/src/gpudetile.rs b/crates/victory-gpu/src/gpudetile.rs index ac10870ba..cd5755a75 100644 --- a/crates/victory-gpu/src/gpudetile.rs +++ b/crates/victory-gpu/src/gpudetile.rs @@ -158,36 +158,10 @@ unsafe impl Sync for Detiler {} /// Compiles [`SOURCE`] (`cs_5_1`, the root signature inside it) on `device`. pub(crate) fn make(device: &ID3D12Device) -> windows::core::Result<Detiler> { - use windows::Win32::Graphics::Direct3D::Fxc::D3DCompile; - use windows::Win32::Graphics::Direct3D::ID3DBlob; - let mut code: Option<ID3DBlob> = None; - let mut errors: Option<ID3DBlob> = None; - // SAFETY: the source and names live through the call; the out - // pointers are ours. - let compiled = unsafe { - D3DCompile( - SOURCE.as_ptr().cast(), - SOURCE.len(), - windows::core::s!("texture detile"), - None, - None, - windows::core::s!("main"), - windows::core::s!("cs_5_1"), - 0, - 0, - &mut code, - Some(&mut errors), - ) - }; - if let Err(e) = compiled { - if let Some(errors) = errors { - // SAFETY: the blob's own bytes. - let text = unsafe { std::slice::from_raw_parts(errors.GetBufferPointer().cast::<u8>(), errors.GetBufferSize()) }; - tracing::warn!("the texture detile shader: {}", String::from_utf8_lossy(text)); - } - return Err(e); - } - let code = code.ok_or_else(windows::core::Error::empty)?; + // The system's compiler, then DXC (`crate::hlsl`), as every helper shader: + // a direct `D3DCompile` failed under Wine/Proton's builtin compiler and + // the GPU detile was never made there (2026-11-29). + let code = crate::hlsl::blob(&crate::host::compile(SOURCE, windows::core::s!("main"), windows::core::s!("cs_5_1"))?)?; // SAFETY: the blob's own bytes; the root signature is inside the shader. unsafe { let bytes = std::slice::from_raw_parts(code.GetBufferPointer().cast::<u8>(), code.GetBufferSize()); diff --git a/crates/victory-gpu/src/mesh_rest.rs b/crates/victory-gpu/src/mesh_rest.rs index b7d5605c2..fdd803de9 100644 --- a/crates/victory-gpu/src/mesh_rest.rs +++ b/crates/victory-gpu/src/mesh_rest.rs @@ -46,8 +46,7 @@ pub(crate) fn line(frames: f64) { } } -use windows::Win32::Graphics::Direct3D::Fxc::D3DCompile; -use windows::Win32::Graphics::Direct3D::{D3D_PRIMITIVE_TOPOLOGY_POINTLIST, ID3DBlob}; +use windows::Win32::Graphics::Direct3D::D3D_PRIMITIVE_TOPOLOGY_POINTLIST; use windows::Win32::Graphics::Direct3D12::*; use windows::Win32::Graphics::Dxgi::Common::DXGI_SAMPLE_DESC; use windows::core::s; @@ -125,24 +124,12 @@ pub(crate) fn rest() -> Option<&'static Rest> { } fn make(device: &ID3D12Device) -> windows::core::Result<Rest> { - let mut code: Option<ID3DBlob> = None; - // SAFETY: the source and names live through the calls; the blob's bytes - // live while it does. + // The system's compiler, then DXC (`crate::hlsl`), as every helper shader: + // a direct `D3DCompile` made this pipeline fail to be created under + // Wine/Proton, where the builtin compiler is not enough (2026-11-29). + let vs = crate::hlsl::blob(&crate::host::compile(SOURCE, s!("vs"), s!("vs_5_1"))?)?; + // SAFETY: the blob's bytes live while it does. unsafe { - D3DCompile( - SOURCE.as_ptr().cast(), - SOURCE.len(), - s!("mesh_rest"), - None, - None, - s!("vs"), - s!("vs_5_1"), - 0, - 0, - &mut code, - None, - )?; - let vs = code.ok_or_else(windows::core::Error::empty)?; let bytes = std::slice::from_raw_parts(vs.GetBufferPointer().cast::<u8>(), vs.GetBufferSize()); let root: ID3D12RootSignature = device.CreateRootSignature(0, bytes)?; let desc = D3D12_GRAPHICS_PIPELINE_STATE_DESC { ``` Rig (wine-staging 11.22, RTX 5090): `rest_pipeline_binds_draws_and_runs` passes after; no other test moved. The detile warning is gone from the play log.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 08:04:04 +00:00
Author
Owner

@⁠birdneststream on GitHub · 2026-11-29 08:02 UTC · original

PR with the change: #2034 (one commit on main).

**@⁠birdneststream** on GitHub · 2026-11-29 08:02 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/2030#issuecomment-7252845692) PR with the change: #2034 (one commit on `main`).
Author
Owner

@⁠birdneststream on GitHub · 2026-11-29 08:08 UTC · original

The logs the template asks for, as excerpts (no crash in either run): https://gist.github.com/birdneststream/e60405af82d7ec9ca720265ba2877657

RTX 5090, Linux/Proton (the environment is in the gist). Before: VICTORY_GPU_DETILE: the detile shader could not be made in every play log and the mesh rest pipeline never made; with the change neither appears and the textures detile on the card.

**@⁠birdneststream** on GitHub · 2026-11-29 08:08 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/2030#issuecomment-7252911098) The logs the template asks for, as excerpts (no crash in either run): https://gist.github.com/birdneststream/e60405af82d7ec9ca720265ba2877657 RTX 5090, Linux/Proton (the environment is in the gist). Before: `VICTORY_GPU_DETILE: the detile shader could not be made` in every play log and the mesh rest pipeline never made; with the change neither appears and the textures detile on the card.
Author
Owner

@⁠trustno1-coder on GitHub · 2026-11-30 15:37 UTC · original

Closing this because it was opened before v2026.11.29.01, and a great deal has changed since then. The latest release is v2026.11.30.01.

If this still happens, or still applies, on the latest release, please open a new issue. For a bug, attach both logs from that run:

  1. The play log: the newest victory-nvidia-play-<date>-<time>-<number>.log in %LOCALAPPDATA%\victory\logs\.
  2. The crash log: %LOCALAPPDATA%\VIctory\data\7952987A\crashes.log, plus the newest .crash.log in %LOCALAPPDATA%\VIctory\data\7952987A\temp\ if there is one from that run.
**@⁠trustno1-coder** on GitHub · 2026-11-30 15:37 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/2030#issuecomment-7283305726) Closing this because it was opened before v2026.11.29.01, and a great deal has changed since then. The latest release is [v2026.11.30.01](https://github.com/trustno1-coder/VIctory-NVIDIA/releases/tag/v2026.11.30.01). If this still happens, or still applies, on the latest release, please open a new issue. For a bug, attach both logs from that run: 1. The play log: the newest `victory-nvidia-play-<date>-<time>-<number>.log` in `%LOCALAPPDATA%\victory\logs\`. 2. The crash log: `%LOCALAPPDATA%\VIctory\data\7952987A\crashes.log`, plus the newest `.crash.log` in `%LOCALAPPDATA%\VIctory\data\7952987A\temp\` if there is one from that run.
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA#2030
No description provided.