WGSL: Migrate access control to var<>

Spec change: https://github.com/gpuweb/gpuweb/pull/1735

Bug: tint:846
Change-Id: Id2eddc4e8f3bdb86027db8d61bb96b9b8ef9778f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/53386
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton
2021-06-08 15:36:44 +00:00
committed by Dawn LUCI CQ
parent 3a07f7410f
commit 15eba9a048
31 changed files with 103 additions and 110 deletions

View File

@@ -1278,8 +1278,8 @@ class SetBindGroupValidationTest : public ValidationTest {
[[group(0), binding(0)]] var<uniform> uBufferDynamic : S;
[[group(0), binding(1)]] var<uniform> uBuffer : S;
[[group(0), binding(2)]] var<storage> sBufferDynamic : [[access(read_write)]] S;
[[group(0), binding(3)]] var<storage> sReadonlyBufferDynamic : [[access(read)]] S;
[[group(0), binding(2)]] var<storage, read_write> sBufferDynamic : S;
[[group(0), binding(3)]] var<storage, read> sReadonlyBufferDynamic : S;
[[stage(fragment)]] fn main() {
})");
@@ -1301,8 +1301,8 @@ class SetBindGroupValidationTest : public ValidationTest {
[[group(0), binding(0)]] var<uniform> uBufferDynamic : S;
[[group(0), binding(1)]] var<uniform> uBuffer : S;
[[group(0), binding(2)]] var<storage> sBufferDynamic : [[access(read_write)]] S;
[[group(0), binding(3)]] var<storage> sReadonlyBufferDynamic : [[access(read)]] S;
[[group(0), binding(2)]] var<storage, read_write> sBufferDynamic : S;
[[group(0), binding(3)]] var<storage, read> sReadonlyBufferDynamic : S;
[[stage(compute), workgroup_size(4, 4, 1)]] fn main() {
})");
@@ -1728,8 +1728,7 @@ class SetBindGroupPersistenceValidationTest : public ValidationTest {
ss << "[[group(" << l << "), binding(" << b << ")]] ";
switch (binding) {
case wgpu::BufferBindingType::Storage:
ss << "var<storage> set" << l << "_binding" << b
<< " : [[access(read_write)]] S;";
ss << "var<storage, read_write> set" << l << "_binding" << b << " : S;";
break;
case wgpu::BufferBindingType::Uniform:
ss << "var<uniform> set" << l << "_binding" << b << " : S;";
@@ -1897,8 +1896,8 @@ class BindGroupLayoutCompatibilityTest : public ValidationTest {
value : vec2<f32>;
};
[[group(0), binding(0)]] var<storage> sBufferDynamic : [[access(read_write)]] S;
[[group(1), binding(0)]] var<storage> sReadonlyBufferDynamic : [[access(read)]] S;
[[group(0), binding(0)]] var<storage, read_write> sBufferDynamic : S;
[[group(1), binding(0)]] var<storage, read> sReadonlyBufferDynamic : S;
[[stage(fragment)]] fn main() {
var val : vec2<f32> = sBufferDynamic.value;
@@ -1932,8 +1931,8 @@ class BindGroupLayoutCompatibilityTest : public ValidationTest {
value : vec2<f32>;
};
[[group(0), binding(0)]] var<storage> sBufferDynamic : [[access(read_write)]] S;
[[group(1), binding(0)]] var<storage> sReadonlyBufferDynamic : [[access(read)]] S;
[[group(0), binding(0)]] var<storage, read_write> sBufferDynamic : S;
[[group(1), binding(0)]] var<storage, read> sReadonlyBufferDynamic : S;
[[stage(compute), workgroup_size(4, 4, 1)]] fn main() {
var val : vec2<f32> = sBufferDynamic.value;

View File

@@ -66,7 +66,7 @@ TEST_F(GetBindGroupLayoutTests, SameObject) {
[[block]] struct S3 {
pos : mat4x4<f32>;
};
[[group(3), binding(0)]] var<storage> storage3 : [[access(read_write)]] S3;
[[group(3), binding(0)]] var<storage, read_write> storage3 : S3;
[[stage(fragment)]] fn main() {
var pos_u : vec4<f32> = uniform2.pos;
@@ -202,7 +202,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
[[block]] struct S {
pos : vec4<f32>;
};
[[group(0), binding(0)]] var<storage> ssbo : [[access(read_write)]] S;
[[group(0), binding(0)]] var<storage, read_write> ssbo : S;
[[stage(fragment)]] fn main() {
var pos : vec4<f32> = ssbo.pos;
@@ -229,7 +229,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
[[block]] struct S {
pos : vec4<f32>;
};
[[group(0), binding(0)]] var<storage> ssbo : [[access(read)]] S;
[[group(0), binding(0)]] var<storage, read> ssbo : S;
[[stage(fragment)]] fn main() {
var pos : vec4<f32> = ssbo.pos;
@@ -707,7 +707,7 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingType) {
[[block]] struct S {
pos : vec4<f32>;
};
[[group(0), binding(0)]] var<storage> ssbo : [[access(read_write)]] S;
[[group(0), binding(0)]] var<storage, read_write> ssbo : S;
[[stage(fragment)]] fn main() {
var pos : vec4<f32> = ssbo.pos;
@@ -912,8 +912,8 @@ TEST_F(GetBindGroupLayoutTests, FromCorrectEntryPoint) {
[[block]] struct Data {
data : f32;
};
[[group(0), binding(0)]] var<storage> data0 : [[access(read_write)]] Data;
[[group(0), binding(1)]] var<storage> data1 : [[access(read_write)]] Data;
[[group(0), binding(0)]] var<storage, read_write> data0 : Data;
[[group(0), binding(1)]] var<storage, read_write> data1 : Data;
[[stage(compute)]] fn compute0() {
data0.data = 0.0;

View File

@@ -80,12 +80,10 @@ namespace {
ostream << "var<uniform> b" << index << " : S" << index << ";\n";
break;
case wgpu::BufferBindingType::Storage:
ostream << "var<storage> b" << index << " : [[access(read_write)]] S" << index
<< ";\n";
ostream << "var<storage, read_write> b" << index << " : S" << index << ";\n";
break;
case wgpu::BufferBindingType::ReadOnlyStorage:
ostream << "var<storage> b" << index << " : [[access(read)]] S" << index
<< ";\n";
ostream << "var<storage, read> b" << index << " : S" << index << ";\n";
break;
default:
UNREACHABLE();

View File

@@ -46,7 +46,7 @@ namespace {
[[block]] struct Storage {
dummy : array<f32>;
};
[[group(1), binding(1)]] var<storage> ssbo : [[access(read_write)]] Storage;
[[group(1), binding(1)]] var<storage, read_write> ssbo : Storage;
[[stage(fragment)]] fn main() {
})");

View File

@@ -460,7 +460,7 @@ TEST_F(RenderPipelineValidationTest, StorageBufferInVertexShaderNoLayout) {
[[block]] struct Dst {
data : array<u32, 100>;
};
[[group(0), binding(0)]] var<storage> dst : [[access(read_write)]] Dst;
[[group(0), binding(0)]] var<storage, read_write> dst : Dst;
[[stage(vertex)]] fn main([[builtin(vertex_index)]] VertexIndex : u32) -> [[builtin(position)]] vec4<f32> {
dst.data[VertexIndex] = 0x1234u;
return vec4<f32>();

View File

@@ -762,7 +762,7 @@ namespace {
[[block]] struct RBuffer {
value : f32;
};
[[group(0), binding(0)]] var<storage> rBuffer : [[access(read)]] RBuffer;
[[group(0), binding(0)]] var<storage, read> rBuffer : RBuffer;
[[stage(fragment)]] fn main() {
})");
utils::ComboRenderPipelineDescriptor pipelineDescriptor;

View File

@@ -82,9 +82,8 @@ class StorageTextureValidationTests : public ValidationTest {
}
std::ostringstream ostream;
ostream << "[[group(0), binding(0)]] var image0 : "
<< "[[access(" << access << ")]] " << imageTypeDeclaration << "<"
<< imageFormatQualifier
ostream << "[[group(0), binding(0)]] var image0 : " << imageTypeDeclaration << "<"
<< imageFormatQualifier << ", " << access
<< ">;\n"
"[[stage(compute)]] fn main() {\n"
" textureDimensions(image0);\n"
@@ -193,7 +192,7 @@ TEST_F(StorageTextureValidationTests, ComputePipeline) {
[[block]] struct Buf {
data : f32;
};
[[group(0), binding(1)]] var<storage> buf : [[access(read_write)]] Buf;
[[group(0), binding(1)]] var<storage, read_write> buf : Buf;
[[stage(compute)]] fn main([[builtin(local_invocation_id)]] LocalInvocationID : vec3<u32>) {
buf.data = textureLoad(image0, vec2<i32>(LocalInvocationID.xy)).x;