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 <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
dan sinclair 2021-01-14 14:50:16 +00:00 committed by Commit Bot service account
parent 3c2e5afd95
commit 1c6082149a
3 changed files with 7 additions and 6 deletions

View File

@ -1237,7 +1237,8 @@ TEST_P(BindGroupTests, ReallyLargeBindGroup) {
bgEntries.push_back({binding, nullptr, 0, 0, nullptr, texture.CreateView()}); bgEntries.push_back({binding, nullptr, 0, 0, nullptr, texture.CreateView()});
interface << "[[set(0), binding(" << binding++ << ")]] " interface << "[[set(0), binding(" << binding++ << ")]] "
<< "var<uniform_constant> image" << i << " : texture_storage_ro_2d<r32uint>;\n"; << "var<uniform_constant> image" << i
<< " : [[access(read)]] texture_storage_2d<r32uint>;\n";
body << "if (textureLoad(image" << i << ", vec2<i32>(0, 0)).r != " << expectedValue++ body << "if (textureLoad(image" << i << ", vec2<i32>(0, 0)).r != " << expectedValue++
<< "u) {\n"; << "u) {\n";

View File

@ -1554,7 +1554,7 @@ namespace {
})"); })");
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"( wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[set(0), binding(0)]] var<uniform_constant> tex : texture_storage_ro_2d<rgba8unorm>; [[set(0), binding(0)]] var<uniform_constant> tex : [[access(read)]] texture_storage_2d<rgba8unorm>;
[[stage(fragment)]] fn main() -> void { [[stage(fragment)]] fn main() -> void {
})"); })");
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device); utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
@ -1580,7 +1580,7 @@ namespace {
{ {
// Create a passthrough compute pipeline with a readonly storage texture // Create a passthrough compute pipeline with a readonly storage texture
wgpu::ShaderModule csModule = utils::CreateShaderModuleFromWGSL(device, R"( wgpu::ShaderModule csModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[set(0), binding(0)]] var<uniform_constant> tex : texture_storage_ro_2d<rgba8unorm>; [[set(0), binding(0)]] var<uniform_constant> tex : [[access(read)]] texture_storage_2d<rgba8unorm>;
[[stage(compute)]] fn main() -> void { [[stage(compute)]] fn main() -> void {
})"); })");
wgpu::ComputePipelineDescriptor pipelineDescriptor; wgpu::ComputePipelineDescriptor pipelineDescriptor;

View File

@ -125,7 +125,7 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) {
// Readonly storage texture can be declared in a vertex shader. // Readonly storage texture can be declared in a vertex shader.
{ {
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"( wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[set(0), binding(0)]] var<uniform_constant> image0 : texture_storage_ro_2d<rgba8unorm>; [[set(0), binding(0)]] var<uniform_constant> image0 : [[access(read)]] texture_storage_2d<rgba8unorm>;
[[builtin(vertex_idx)]] var<in> VertexIndex : u32; [[builtin(vertex_idx)]] var<in> VertexIndex : u32;
[[builtin(position)]] var<out> Position : vec4<f32>; [[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void { [[stage(vertex)]] fn main() -> void {
@ -142,7 +142,7 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) {
// Read-only storage textures can be declared in a fragment shader. // Read-only storage textures can be declared in a fragment shader.
{ {
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"( wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[set(0), binding(0)]] var<uniform_constant> image0 : texture_storage_ro_2d<rgba8unorm>; [[set(0), binding(0)]] var<uniform_constant> image0 : [[access(read)]] texture_storage_2d<rgba8unorm>;
[[builtin(frag_coord)]] var<in> FragCoord : vec4<f32>; [[builtin(frag_coord)]] var<in> FragCoord : vec4<f32>;
[[location(0)]] var<out> fragColor : vec4<f32>; [[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void { [[stage(fragment)]] fn main() -> void {
@ -197,7 +197,7 @@ TEST_F(StorageTextureValidationTests, ComputePipeline) {
// Read-only storage textures can be declared in a compute shader. // Read-only storage textures can be declared in a compute shader.
{ {
wgpu::ShaderModule csModule = utils::CreateShaderModuleFromWGSL(device, R"( wgpu::ShaderModule csModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[set(0), binding(0)]] var<uniform_constant> image0 : texture_storage_ro_2d<rgba8unorm>; [[set(0), binding(0)]] var<uniform_constant> image0 : [[access(read)]] texture_storage_2d<rgba8unorm>;
[[builtin(local_invocation_id)]] var<in> LocalInvocationID : vec3<u32>; [[builtin(local_invocation_id)]] var<in> LocalInvocationID : vec3<u32>;
[[block]] struct Buf { [[block]] struct Buf {