Skip to content

unhelpful diagnostic from naga regarding missing & #6983

Open
@crowlKats

Description

wgpu version 24.0.0

While working on the reworked webgpu bindings for Deno, I attempted to run a test, which is a 1-1 copy of hello-compute but written in javascript.

So using this shader, I am getting this diagnostic:

Device::create_shader_module error: 
Shader validation error: 
   ┌─ :20:36
   │
20 │     let array_length = arrayLength(input);
   │                                    ^^^^^ naga::Expression [4]


error: GPUValidationError: 
Shader validation error: 
   ┌─ :20:36
   │
20 │     let array_length = arrayLength(input);
   │                                    ^^^^^ naga::Expression [4]

: Entry point doubleMe at Compute is invalid: Expression [4] is invalid: Loading of [3] can't be done

Apparently, thanks to @teoxoy the solution is to do arrayLength(&input). The diagnostic is not very helpful here.
Also unsure why this is happening, since the wgpu repo itself is using the shader as-is without this change, yet the example works fine.

Metadata

Assignees

No one assigned

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions