Add optional access to ptr<>

This also completes the work to resolve the access controls for each
storage type.

Fixed: tint:846
Change-Id: Iab24057ec14620a2978ec63c4a91ba12d1bc6e9b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53381
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
Ben Clayton
2021-06-04 22:17:37 +00:00
committed by Tint LUCI CQ
parent 3db1820f0b
commit 1858854f7e
248 changed files with 7332 additions and 2027 deletions

View File

@@ -13,7 +13,7 @@ fn main() {
var i : u32 = 0u;
loop {
if (i >= b.count) { break; }
let p : ptr<storage, u32> = &b.data[i];
let p : ptr<storage, u32, read_write> = &b.data[i];
if ((i % 2u) == 0u) { continue; }
*p = 0u; // Set odd elements of the array to 0
continuing {

View File

@@ -2,6 +2,6 @@
[[group(0), binding(0)]] var<storage, read_write> buf : S;
[[stage(compute)]] fn main() {
let p : ptr<storage, i32> = &buf.a;
let p : ptr<storage, i32, read_write> = &buf.a;
*p = 12;
}

View File

@@ -37,6 +37,7 @@
OpMemberDecorate %Uniforms 0 Offset 0
OpMemberDecorate %Uniforms 1 Offset 8
OpMemberDecorate %Uniforms 2 Offset 16
OpDecorate %uniforms NonWritable
OpDecorate %uniforms DescriptorSet 0
OpDecorate %uniforms Binding 3
OpDecorate %tint_symbol BuiltIn GlobalInvocationId

View File

@@ -49,6 +49,7 @@
OpDecorate %gl_FragCoord BuiltIn FragCoord
OpDecorate %buf0 Block
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %x_188 NonWritable
OpDecorate %x_188 DescriptorSet 0
OpDecorate %x_188 Binding 0
OpDecorate %x_GLF_color Location 0