Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DXC compiler fails with custom paths #3433

Closed
daxpedda opened this issue Jan 28, 2023 · 1 comment · Fixed by #3434
Closed

DXC compiler fails with custom paths #3433

daxpedda opened this issue Jan 28, 2023 · 1 comment · Fixed by #3434

Comments

@daxpedda
Copy link
Contributor

daxpedda commented Jan 28, 2023

Description
When using a custom path in wgpu::Dx12Compiler::Dxc pipeline creation fails.

When using no custom path, everything works as expected.

I'm still in the process of debugging this and finding out the exact cause, unfortunately I don't have access to a Windows PC right now.

Repro steps
Any example should work, I tried the hello-triangle example, change the Instance creation to:

    let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
        backends: wgpu::Backends::DX12,
        dx12_shader_compiler: wgpu::Dx12Compiler::Dxc {
            dxil_path: Some("shared".into()),
            dxc_path: Some("shared".into()),
        },
    });

Expected vs observed behavior
This will fail with:

2023-01-26T23:08:03.110466Z ERROR wgpu::backend::direct: Shader translation error for stage VERTEX | FRAGMENT | VERTEX_FRAGMENT: invalid argument
2023-01-26T23:08:03.110692Z ERROR wgpu::backend::direct: Please report it to https://github.com/gfx-rs/naga
2023-01-26T23:08:03.111341Z ERROR wgpu::backend::direct: Handling wgpu errors as fatal by default

Which points to:

if let wgc::pipeline::CreateRenderPipelineError::Internal { stage, ref error } = cause {
log::error!("Shader translation error for stage {:?}: {}", stage, error);
log::error!("Please report it to https://github.com/gfx-rs/naga");
}
self.handle_error(
&device_data.error_sink,
cause,
LABEL,
desc.label,
"Device::create_render_pipeline",
);

Platform
I tried this with wgpu 0.15 and the latest master (b31069f) which didn't change much since the last release.

I did attempt to reproduce this locally with Wine but wasn't able to.
So the only place I could reproduce this is on an actual Windows OS, Windows 10 in my case.

@daxpedda daxpedda changed the title DXC compiler fails if using a custom path DXC compiler fails with custom paths Jan 28, 2023
@Elabajaba
Copy link
Contributor

Elabajaba commented Jan 28, 2023

Strange, it seems to be finding the DLLs or it would be outputting a warning.

edit: bad reading skills Does it work if you put the DLLs into the folder and just pass in None for both paths?

My first thought was maybe dxcompiler is failing to properly validate the shaders due to not being able to find dxil.dll (when you call compile dxcompiler implicitly validates the shader, but maybe it's looking for dxil.dll in the local scope), but that output a different error on my machine. It does currently validate that dxil.dll is available where the path points to.

Another potential issue could be that your drivers and/or GPU don't support shadermodel 6.0, and checking for that is something I overlooked in the DXC pr. (edit: But if it works without custom paths, then it should be fine?)

I'll try to reproduce, and then see if disabling compile time validation (there's a DXC flag for it) and using explicit validation fixes it.

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 a pull request may close this issue.

2 participants