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

Failed to parse WGSL when specifying var access mode #1777

Closed
gliderkite opened this issue Aug 8, 2021 · 1 comment
Closed

Failed to parse WGSL when specifying var access mode #1777

gliderkite opened this issue Aug 8, 2021 · 1 comment
Labels
type: question Further information is requested

Comments

@gliderkite
Copy link

If I specify the storage access mode (read/write/read_write) in a WGSL shader:

[[block]] struct PositionsBuffer {
  pos: array<vec2<f32>>;
};

[[group(0), binding(0)]]
var<storage,read_write> pbuf: PositionsBuffer;

Example taken from www.w3.org/TR/WGSL.

when I call Device::create_shader_module as:

device.create_shader_module(&ShaderModuleDescriptor {
   label: Some("Shader"),
   flags: ShaderFlags::all(),
   source: ShaderSource::Wgsl(shader.into()),
});

I get the following error:

ERROR: ValidationError { source: ContextError { string: "Device::create_shader_module", cause: Parsing, label_key: "label", label: "Shader" }, description: "Validation Error\n\nCaused by:\n    In Device::create_shader_module\n      note: label = `Shader`\n    Failed to parse WGSL\n" }'

Note, I've just started learning about computer graphics, so my knowledge is very limited. However, I seem to understand that the above should be valid syntax, also when I run the validation using naga it is successful.

I'm on Ubuntu 20.04 using wgpu version 0.9.

@kvark
Copy link
Member

kvark commented Aug 8, 2021

wgpu-0.9 doesn't have this WGSL syntax supported. Since WGSL is a moving target, our stable releases can't update its API.
It's best for us if you use master, but if you have to use v0.9, then take a look at the relevant example code - https://github.com/gfx-rs/wgpu/tree/v0.9/wgpu/examples

@kvark kvark closed this as completed Aug 8, 2021
@kvark kvark added the type: question Further information is requested label Aug 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants