Move texture_storage access into type

Instead of having it as a decoration.
The old style is now deprecated and will be removed soon.

See  https://github.com/gpuweb/gpuweb/pull/1735 for the WGSL spec change.

Bug: tint:846
Change-Id: Id2fa681ddf7b97cd3fa41d7b5538029d96db7e28
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/53082
Reviewed-by: Corentin Wallez <cwallez@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton
2021-06-03 13:21:36 +00:00
committed by Dawn LUCI CQ
parent b66f630f81
commit b3c371031c
6 changed files with 23 additions and 23 deletions

View File

@@ -1508,7 +1508,7 @@ namespace {
})");
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[group(0), binding(0)]] var tex : [[access(read)]] texture_storage_2d<rgba8unorm>;
[[group(0), binding(0)]] var tex : texture_storage_2d<rgba8unorm, read>;
[[stage(fragment)]] fn main() {
})");
utils::ComboRenderPipelineDescriptor pipelineDescriptor;

View File

@@ -120,7 +120,7 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) {
// Readonly storage texture can be declared in a vertex shader.
{
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[group(0), binding(0)]] var image0 : [[access(read)]] texture_storage_2d<rgba8unorm>;
[[group(0), binding(0)]] var image0 : texture_storage_2d<rgba8unorm, read>;
[[stage(vertex)]] fn main(
[[builtin(vertex_index)]] VertexIndex : u32
) -> [[builtin(position)]] vec4<f32> {
@@ -137,7 +137,7 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) {
// Read-only storage textures can be declared in a fragment shader.
{
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[group(0), binding(0)]] var image0 : [[access(read)]] texture_storage_2d<rgba8unorm>;
[[group(0), binding(0)]] var image0 : texture_storage_2d<rgba8unorm, read>;
[[stage(fragment)]] fn main(
[[builtin(position)]] FragCoord : vec4<f32>
) -> [[location(0)]] vec4<f32> {
@@ -154,7 +154,7 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) {
// Write-only storage textures cannot be declared in a vertex shader.
if ((false) /* TODO(https://crbug.com/tint/449) */) {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[group(0), binding(0)]] var image0 : [[access(write)]] texture_storage_2d<rgba8unorm>;
[[group(0), binding(0)]] var image0 : texture_storage_2d<rgba8unorm, write>;
[[stage(vertex)]] fn main([[builtin(vertex_index)]] vertex_index : u32) {
textureStore(image0, vec2<i32>(i32(vertex_index), 0), vec4<f32>(1.0, 0.0, 0.0, 1.0));
})");
@@ -169,7 +169,7 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) {
// Write-only storage textures can be declared in a fragment shader.
{
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[group(0), binding(0)]] var image0 : [[access(write)]] texture_storage_2d<rgba8unorm>;
[[group(0), binding(0)]] var image0 : texture_storage_2d<rgba8unorm, write>;
[[stage(fragment)]] fn main([[builtin(position)]] position : vec4<f32>) {
textureStore(image0, vec2<i32>(position.xy), vec4<f32>(1.0, 0.0, 0.0, 1.0));
})");
@@ -188,7 +188,7 @@ TEST_F(StorageTextureValidationTests, ComputePipeline) {
// Read-only storage textures can be declared in a compute shader.
{
wgpu::ShaderModule csModule = utils::CreateShaderModule(device, R"(
[[group(0), binding(0)]] var image0 : [[access(read)]] texture_storage_2d<rgba8unorm>;
[[group(0), binding(0)]] var image0 : texture_storage_2d<rgba8unorm, read>;
[[block]] struct Buf {
data : f32;
@@ -210,7 +210,7 @@ TEST_F(StorageTextureValidationTests, ComputePipeline) {
// Write-only storage textures can be declared in a compute shader.
{
wgpu::ShaderModule csModule = utils::CreateShaderModule(device, R"(
[[group(0), binding(0)]] var image0 : [[access(write)]] texture_storage_2d<rgba8unorm>;
[[group(0), binding(0)]] var image0 : texture_storage_2d<rgba8unorm, write>;
[[stage(compute)]] fn main([[builtin(local_invocation_id)]] LocalInvocationID : vec3<u32>) {
textureStore(image0, vec2<i32>(LocalInvocationID.xy), vec4<f32>(0.0, 0.0, 0.0, 0.0));
@@ -230,7 +230,7 @@ TEST_F(StorageTextureValidationTests, ReadWriteStorageTexture) {
// Read-write storage textures cannot be declared in a vertex shader by default.
{
ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"(
[[group(0), binding(0)]] var image0 : [[access(read_write)]] texture_storage_2d<rgba8unorm>;
[[group(0), binding(0)]] var image0 : texture_storage_2d<rgba8unorm, read_write>;
[[stage(vertex)]] fn main() {
textureDimensions(image0);
})"));
@@ -239,7 +239,7 @@ TEST_F(StorageTextureValidationTests, ReadWriteStorageTexture) {
// Read-write storage textures cannot be declared in a fragment shader by default.
{
ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"(
[[group(0), binding(0)]] var image0 : [[access(read_write)]] texture_storage_2d<rgba8unorm>;
[[group(0), binding(0)]] var image0 : texture_storage_2d<rgba8unorm, read_write>;
[[stage(fragment)]] fn main() {
textureDimensions(image0);
})"));
@@ -248,7 +248,7 @@ TEST_F(StorageTextureValidationTests, ReadWriteStorageTexture) {
// Read-write storage textures cannot be declared in a compute shader by default.
{
ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"(
[[group(0), binding(0)]] var image0 : [[access(read_write)]] texture_storage_2d<rgba8unorm>;
[[group(0), binding(0)]] var image0 : texture_storage_2d<rgba8unorm, read_write>;
[[stage(compute)]] fn main() {
textureDimensions(image0);
})"));