From 1c6082149ad1cd22bc50322d5b112d2412b218c3 Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Thu, 14 Jan 2021 14:50:16 +0000 Subject: [PATCH] Update texture storage syntax. This CL updates the WGSL texture storage syntax to use the access decoration. Bug: tint:286 Change-Id: I0024a0682c6a6479eb7a8436f8df4c9a76ec5e2a Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37880 Commit-Queue: dan sinclair Commit-Queue: Ben Clayton Auto-Submit: dan sinclair Reviewed-by: Corentin Wallez Reviewed-by: Ben Clayton --- src/tests/end2end/BindGroupTests.cpp | 3 ++- .../unittests/validation/ResourceUsageTrackingTests.cpp | 4 ++-- .../unittests/validation/StorageTextureValidationTests.cpp | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/tests/end2end/BindGroupTests.cpp b/src/tests/end2end/BindGroupTests.cpp index 268677560d..8597924033 100644 --- a/src/tests/end2end/BindGroupTests.cpp +++ b/src/tests/end2end/BindGroupTests.cpp @@ -1237,7 +1237,8 @@ TEST_P(BindGroupTests, ReallyLargeBindGroup) { bgEntries.push_back({binding, nullptr, 0, 0, nullptr, texture.CreateView()}); interface << "[[set(0), binding(" << binding++ << ")]] " - << "var image" << i << " : texture_storage_ro_2d;\n"; + << "var image" << i + << " : [[access(read)]] texture_storage_2d;\n"; body << "if (textureLoad(image" << i << ", vec2(0, 0)).r != " << expectedValue++ << "u) {\n"; diff --git a/src/tests/unittests/validation/ResourceUsageTrackingTests.cpp b/src/tests/unittests/validation/ResourceUsageTrackingTests.cpp index 2b8950fefa..3b01ca61cc 100644 --- a/src/tests/unittests/validation/ResourceUsageTrackingTests.cpp +++ b/src/tests/unittests/validation/ResourceUsageTrackingTests.cpp @@ -1554,7 +1554,7 @@ namespace { })"); wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"( - [[set(0), binding(0)]] var tex : texture_storage_ro_2d; + [[set(0), binding(0)]] var tex : [[access(read)]] texture_storage_2d; [[stage(fragment)]] fn main() -> void { })"); utils::ComboRenderPipelineDescriptor pipelineDescriptor(device); @@ -1580,7 +1580,7 @@ namespace { { // Create a passthrough compute pipeline with a readonly storage texture wgpu::ShaderModule csModule = utils::CreateShaderModuleFromWGSL(device, R"( - [[set(0), binding(0)]] var tex : texture_storage_ro_2d; + [[set(0), binding(0)]] var tex : [[access(read)]] texture_storage_2d; [[stage(compute)]] fn main() -> void { })"); wgpu::ComputePipelineDescriptor pipelineDescriptor; diff --git a/src/tests/unittests/validation/StorageTextureValidationTests.cpp b/src/tests/unittests/validation/StorageTextureValidationTests.cpp index a5701d8f8d..ce63cd269d 100644 --- a/src/tests/unittests/validation/StorageTextureValidationTests.cpp +++ b/src/tests/unittests/validation/StorageTextureValidationTests.cpp @@ -125,7 +125,7 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) { // Readonly storage texture can be declared in a vertex shader. { wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"( - [[set(0), binding(0)]] var image0 : texture_storage_ro_2d; + [[set(0), binding(0)]] var image0 : [[access(read)]] texture_storage_2d; [[builtin(vertex_idx)]] var VertexIndex : u32; [[builtin(position)]] var Position : vec4; [[stage(vertex)]] fn main() -> void { @@ -142,7 +142,7 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) { // Read-only storage textures can be declared in a fragment shader. { wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"( - [[set(0), binding(0)]] var image0 : texture_storage_ro_2d; + [[set(0), binding(0)]] var image0 : [[access(read)]] texture_storage_2d; [[builtin(frag_coord)]] var FragCoord : vec4; [[location(0)]] var fragColor : vec4; [[stage(fragment)]] fn main() -> void { @@ -197,7 +197,7 @@ TEST_F(StorageTextureValidationTests, ComputePipeline) { // Read-only storage textures can be declared in a compute shader. { wgpu::ShaderModule csModule = utils::CreateShaderModuleFromWGSL(device, R"( - [[set(0), binding(0)]] var image0 : texture_storage_ro_2d; + [[set(0), binding(0)]] var image0 : [[access(read)]] texture_storage_2d; [[builtin(local_invocation_id)]] var LocalInvocationID : vec3; [[block]] struct Buf {