Closed francesco-cattoglio closed 3 years ago
I spent so much time trying to figure out the error that I never realised the shader code that I create is probably invalid GLSL code, because it contains the following line:
mat3 A;
<matrix A initialisation code>
float determinant = determinant(A);
which might be invalid because I am using a function as a variable name. This issue can be closed, or perhaps can be useful for improvements on the error message to the user.
Could you try to confirm if changing the name fixes it?
Yes, if a different name for the variable is used, then the code does not panic and no error gets produced.
hmm, ok. I wonder if SPIR-V was valid to begin with. Do you have access to that SPIR-V produced by shaderc? If you do, we'd want to run spirv-val
on it and see if it was valid.
Actually, I see what's going on. SPIRV-Cross has a problem with determinant
, hence the actual panic.
The failed validation is a red herring here. We'll work on it, and eventually Naga will be able to process these.
Description When I call
wgpu::Device::create_compute_pipeline()
with a compute shader containing the GLSLdeterminant()
function, my application crashes with the following:even though I created the shader module with the
flags: wgpu::ShaderFlags::empty()
flags.Repro steps This is the api trace of the application crashing. Running it under the wgpu player correctly reproduces the crash on my machine. naga_validation_crash.zip
Expected vs observed behavior The program panics, while I would expect naga to simply ignore the validation error.
Platform This only happens under MacOS, metal backend. The same code running on linux, Vulkan backend does not have the same issue. MacOS version 11.2.2, MacBook Pro (13-inch, 2020), wgpu-rs version used is revision 96ca1e41dd4ede12bcb3220712ab5c8c2fd688ad I am using a custom imgui-wgpu-rs https://github.com/francesco-cattoglio/imgui-wgpu-rs/tree/tracking_wgpu_master to make sure that even imgui-wgpu does call
create_shader_module()
function with theShaderFlags::empty()
flag.