cts icon indicating copy to clipboard operation
cts copied to clipboard

wgsl: address space names are not keywords

Open dneto0 opened this issue 3 years ago • 2 comments

Example: this should work:

const function = 1;
const private = 1;
const workgroup = 1;
const storage = 1;
const uniform = 1;
const handle = 1;

@group(0) @binding(0) var<storage,read_write> buf: array<i32,6>;

@compute @workgroup_size(1)
fn main() {
  buf[0] = function;
  buf[1] = private;
  buf[2] = workgroup;
  buf[3] = storage;
  buf[4] = uniform;
  buf[5] = handle;
}

dneto0 avatar Oct 07 '22 19:10 dneto0

In general, we can do this for context-dependent names.

dneto0 avatar Oct 07 '22 19:10 dneto0

I suggest we update https://github.com/gpuweb/cts/blob/main/src/webgpu/shader/validation/parse/identifiers.spec.ts to:

  • add anything that is a predeclared 'enum' to the kValidIdentifiers
    • But we have to be careful to avoid clashes, e.g. in the module-scope var test, it currently does var<private> ...

dneto0 avatar May 02 '24 21:05 dneto0

This is covered in #3600

alan-baker avatar Jun 27 '24 15:06 alan-baker