mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-13 10:51:35 +00:00
Handle access control on var declarations instead of via [[access]] decorations. This change does the minimal work to migrate the WGSL parser over to the new syntax. Additional changes will be needed to correctly generate defaulted access qualifiers, as well as validating access usage. The [[access]] decorations are still supported by the WGSL parser, with new deprecated warnings, but not for aliases. Example: var x : [[access(x)]] alias_to_struct; Making this work is far more effort than I want to dedicate to backwards compatibility, and I do not beleive any real-world usage will be doing this. Still TODO: * Adding access control as the optional, third parameter to ptr<>. * Calculating default accesses for the various storage types. * Validating usage of variables against the different accesses. Bug: tint:846 Change-Id: If8ca82e5d16ec319ecd01f9a2cafffd930963bde Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53088 Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: James Price <jrprice@google.com> Reviewed-by: David Neto <dneto@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
42 lines
892 B
WebGPU Shading Language
42 lines
892 B
WebGPU Shading Language
type ArrayType = [[stride(16)]] array<i32, 4>;
|
|
|
|
[[block]]
|
|
struct S {
|
|
arr : ArrayType;
|
|
};
|
|
|
|
var<private> src_private : ArrayType;
|
|
|
|
var<workgroup> src_workgroup : ArrayType;
|
|
|
|
[[group(0), binding(0)]] var<uniform> src_uniform : S;
|
|
|
|
[[group(0), binding(1)]] var<storage, read_write> src_storage : S;
|
|
|
|
fn ret_arr() -> ArrayType {
|
|
return ArrayType();
|
|
}
|
|
|
|
fn ret_struct_arr() -> S {
|
|
return S();
|
|
}
|
|
|
|
fn foo(src_param : ArrayType) {
|
|
var src_function : ArrayType;
|
|
var dst : ArrayType;
|
|
dst = ArrayType(1, 2, 3, 3);
|
|
dst = src_param;
|
|
dst = ret_arr();
|
|
let src_let : ArrayType = ArrayType();
|
|
dst = src_let;
|
|
dst = src_function;
|
|
dst = src_private;
|
|
dst = src_workgroup;
|
|
dst = ret_struct_arr().arr;
|
|
dst = src_uniform.arr;
|
|
dst = src_storage.arr;
|
|
var dst_nested : array<array<array<i32, 2>, 3>, 4>;
|
|
var src_nested : array<array<array<i32, 2>, 3>, 4>;
|
|
dst_nested = src_nested;
|
|
}
|