Shader Error Message contains no actual error message...? #1723
-
Hi! I'm trying to compile the simplest WGSL shader module with WGPU. There's an error but I can't figure out what it is caused by. Googling didn't yield any useful results for me. The error:
Why I can't figure this out on my own
BackgroundI'm trying to use For completeness, here's the full shader source: struct VertexOutput {
[[builtin(position)]] clip_position: vec4<f32>;
};
[[stage(vertex)]]
fn vertex_shader(
[[builtin(vertex_index)]] in_vertex_index: u32,
) -> VertexOutput
{
let x = f32(1 - i32(in_vertex_index)) * 0.5;
let y = f32(i32(in_vertex_index & 1u) * 2 - 1) * 0.5;
var out: VertexOutput;
out.clip_position = vec4<f32>(x, y, 0.0, 1.0);
return out;
}
[[stage(fragment)]]
fn fragment_shader(in: VertexOutput) -> [[location(0)]] vec4<f32> {
return vec4<f32>(0.3, 0.2, 0.1, 1.0);
} Here's the Rust code I'm trying to compile the shader with: let shader_module =
device.create_shader_module(&wgpu::ShaderModuleDescriptor { // this call panics
label: None,
source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!("simple-shader.wgsl"))),
flags: ShaderFlags::empty() // previously: ShaderFlags::VALIDATION
}); Note: I will open an issue because the error message should probably be improved. If this is a naga problem, I will also open an Issue there. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 10 replies
-
It does feel like the error is incomplete here, even though it shows the exact location. What happens if you just do
|
Beta Was this translation helpful? Give feedback.
-
Using the newest version solved the problem of the (incorrect) error. However, most errors are still quite unspecific. Nevertheless, thanks for the pointers, @kvark I would like to open an issue to collect examples where the error messages could be improved. Is this a naga issue or a wgpu issue? |
Beta Was this translation helpful? Give feedback.
Using the newest version solved the problem of the (incorrect) error. However, most errors are still quite unspecific. Nevertheless, thanks for the pointers, @kvark
I would like to open an issue to collect examples where the error messages could be improved. Is this a naga issue or a wgpu issue?