`*get!(UNIFORM)` compiles succesfully but generates invalid wgsl
- Dominant language
- Rust
- Stars
- 61
- Forks
- 4
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 9
Description
if you write:
```rust
#[wgsl]
pub my_shader{
uniform!(group(0), binding(0), U: Vec3f);
// ...
let x: Vec3f = *get!(U);
// ...
}
```
it compiles successfully, but when you try to run the wgsl shader:
```
wgpu error: Validation Error
Caused by:
In Device::create_shader_module, label = 'compute'
Shader 'compute' parsing error: the operand of the `*` operator must be a pointer
┌─ wgsl:834:20
│
834 │ let x: vec3f = *U;
│ ^^ expression is not a pointer
```
Issue [Uniform access ergonomics: get!() returns a guard, not a value](https://github.com/schell/wgsl-rs/issues/86) talks about changing how uniforms are accessed, so movement on that could make this issue irrelevant
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the #[wgsl] expansion and the get! macro path used by the uniform!(...) example, then reproduce the generated WGSL and validation error. Check issue #86 before settling on a fix, since its proposed uniform-access change may supersede this behavior; done means the example still compiles and its generated shader passes WGSL validation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers, computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100