wgsl: Deprecate [[access]] decorations

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>
This commit is contained in:
Ben Clayton
2021-06-04 20:41:47 +00:00
committed by Tint LUCI CQ
parent b175d91c7e
commit 93e8f527ee
450 changed files with 2651 additions and 2213 deletions

View File

@@ -96,21 +96,21 @@ analysis, but can also greatly aid simple diagnostics like symbol collision erro
**Don't:**
```
shader.wgsl:7:1 error: the originating variable of the left-hand side must not have an access(read) access attribute.
shader.wgsl:7:1 error: the originating variable of the left-hand side of an assignment expression must not be declared with read access control.
```
**Do:**
```
shader.wgsl:7:1 error: cannot assign to variable with [[access(read)]] decoration
shader.wgsl:7:1 error: cannot assign to variable with read access control
x = 1;
^
x.y = 1;
^^^^^^^
shader.wgsl:2:8 note: [[access(read)]] declared here
shader.wgsl:2:8 note: read access control declared here
var x : [[access(read)]] i32;
^^^^^^^^^^^^^^^^
var<storage, read> x : i32;
^^^^
```
**Justification:**