wgsl: Remove [[access]] and [[offset]] decorations

These have been deprecated, and their usages in Dawn, CTS and samples have been updated.

Fixed: tint:846
Change-Id: I74b831fd5be2e7ca02e8208835eac8beddcef9af
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54325
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
Ben Clayton
2021-06-16 09:19:36 +00:00
committed by Ben Clayton
parent fe66cbe7bb
commit 7e00263c01
40 changed files with 43 additions and 852 deletions

View File

@@ -145,7 +145,6 @@ tint_unittests_source_set("tint_unittests_core_sem_src") {
tint_unittests_source_set("tint_unittests_core_src") {
sources = [
"../src/ast/access_decoration_test.cc",
"../src/ast/alias_test.cc",
"../src/ast/array_accessor_expression_test.cc",
"../src/ast/array_test.cc",

View File

@@ -5,4 +5,4 @@ struct Light {
[[block]] struct Lights {
light : [[stride(32)]] array<Light>;
};
[[set(0), binding(1)]] var<storage> lights : [[access(read)]] Lights;
[[set(0), binding(1)]] var<storage, read> lights : Lights;

View File

@@ -1,7 +1,3 @@
bug/tint/294.wgsl:8:24 warning: use of deprecated language feature: declare access with var<storage, read> instead of using [[access]] decoration
[[set(0), binding(1)]] var<storage> lights : [[access(read)]] Lights;
^^^
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;

View File

@@ -1,7 +1,3 @@
bug/tint/294.wgsl:8:24 warning: use of deprecated language feature: declare access with var<storage, read> instead of using [[access]] decoration
[[set(0), binding(1)]] var<storage> lights : [[access(read)]] Lights;
^^^
#include <metal_stdlib>
using namespace metal;

View File

@@ -1,7 +1,3 @@
bug/tint/294.wgsl:8:24 warning: use of deprecated language feature: declare access with var<storage, read> instead of using [[access]] decoration
[[set(0), binding(1)]] var<storage> lights : [[access(read)]] Lights;
^^^
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0

View File

@@ -1,7 +1,3 @@
bug/tint/294.wgsl:8:24 warning: use of deprecated language feature: declare access with var<storage, read> instead of using [[access]] decoration
[[set(0), binding(1)]] var<storage> lights : [[access(read)]] Lights;
^^^
struct Light {
position : vec3<f32>;
colour : vec3<f32>;

View File

@@ -1,5 +1,5 @@
[[group(0), binding(0)]] var Src : [[access(read)]] texture_storage_2d<r32uint>;
[[group(0), binding(1)]] var Dst : [[access(write)]] texture_storage_2d<r32uint>;
[[group(0), binding(0)]] var Src : texture_storage_2d<r32uint, read>;
[[group(0), binding(1)]] var Dst : texture_storage_2d<r32uint, write>;
[[stage(compute)]]
fn main() {

View File

@@ -1,11 +1,3 @@
bug/tint/453.wgsl:1:79 warning: use of deprecated language feature: access control is expected as last parameter of storage textures
[[group(0), binding(0)]] var Src : [[access(read)]] texture_storage_2d<r32uint>;
^
bug/tint/453.wgsl:2:80 warning: use of deprecated language feature: access control is expected as last parameter of storage textures
[[group(0), binding(1)]] var Dst : [[access(write)]] texture_storage_2d<r32uint>;
^
Texture2D<uint4> Src : register(t0, space0);
RWTexture2D<uint4> Dst : register(u1, space0);

View File

@@ -1,11 +1,3 @@
bug/tint/453.wgsl:1:79 warning: use of deprecated language feature: access control is expected as last parameter of storage textures
[[group(0), binding(0)]] var Src : [[access(read)]] texture_storage_2d<r32uint>;
^
bug/tint/453.wgsl:2:80 warning: use of deprecated language feature: access control is expected as last parameter of storage textures
[[group(0), binding(1)]] var Dst : [[access(write)]] texture_storage_2d<r32uint>;
^
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0

View File

@@ -1,11 +1,3 @@
bug/tint/453.wgsl:1:79 warning: use of deprecated language feature: access control is expected as last parameter of storage textures
[[group(0), binding(0)]] var Src : [[access(read)]] texture_storage_2d<r32uint>;
^
bug/tint/453.wgsl:2:80 warning: use of deprecated language feature: access control is expected as last parameter of storage textures
[[group(0), binding(1)]] var Dst : [[access(write)]] texture_storage_2d<r32uint>;
^
[[group(0), binding(0)]] var Src : texture_storage_2d<r32uint, read>;
[[group(0), binding(1)]] var Dst : texture_storage_2d<r32uint, write>;

View File

@@ -1,13 +1,13 @@
[[block]] struct Constants {
[[offset(0)]] level : i32;
level : i32;
};
[[group(0), binding(0)]] var<uniform> constants : Constants;
[[group(0), binding(1)]] var myTexture : texture_2d_array<f32>;
[[block]] struct Result {
[[offset(0)]] values : [[stride(4)]] array<f32>;
values : [[stride(4)]] array<f32>;
};
[[group(0), binding(3)]] var<storage, read_write> result : Result;

View File

@@ -1,11 +1,3 @@
bug/tint/757.wgsl:3:5 warning: use of deprecated language feature: [[offset]] has been replaced with [[size]] and [[align]]
[[offset(0)]] level : i32;
^^^^^^
bug/tint/757.wgsl:10:5 warning: use of deprecated language feature: [[offset]] has been replaced with [[size]] and [[align]]
[[offset(0)]] values : [[stride(4)]] array<f32>;
^^^^^^
struct Constants {
int level;
};

View File

@@ -1,11 +1,3 @@
bug/tint/757.wgsl:3:5 warning: use of deprecated language feature: [[offset]] has been replaced with [[size]] and [[align]]
[[offset(0)]] level : i32;
^^^^^^
bug/tint/757.wgsl:10:5 warning: use of deprecated language feature: [[offset]] has been replaced with [[size]] and [[align]]
[[offset(0)]] values : [[stride(4)]] array<f32>;
^^^^^^
[[block]]
struct Constants {
level : i32;

View File

@@ -5,7 +5,7 @@
let width : u32 = 128u;
[[group(0), binding(0)]] var tex : texture_depth_2d;
[[group(0), binding(1)]] var<storage> result : [[access(read_write)]] Result;
[[group(0), binding(1)]] var<storage, read_write> result : Result;
[[stage(compute)]] fn main(
[[builtin(global_invocation_id)]] GlobalInvocationId : vec3<u32>

View File

@@ -1,7 +1,3 @@
bug/tint/827.wgsl:8:26 warning: use of deprecated language feature: declare access with var<storage, read_write> instead of using [[access]] decoration
[[group(0), binding(1)]] var<storage> result : [[access(read_write)]] Result;
^^^
static const uint width = 128u;
Texture2D tex : register(t0, space0);
RWByteAddressBuffer result : register(u1, space0);

View File

@@ -1,7 +1,3 @@
bug/tint/827.wgsl:8:26 warning: use of deprecated language feature: declare access with var<storage, read_write> instead of using [[access]] decoration
[[group(0), binding(1)]] var<storage> result : [[access(read_write)]] Result;
^^^
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0

View File

@@ -1,7 +1,3 @@
bug/tint/827.wgsl:8:26 warning: use of deprecated language feature: declare access with var<storage, read_write> instead of using [[access]] decoration
[[group(0), binding(1)]] var<storage> result : [[access(read_write)]] Result;
^^^
[[block]]
struct Result {
values : array<f32>;

View File

@@ -1,12 +0,0 @@
[[block]]
struct SB {
a : f32;
};
[[group(0), binding(0)]] var<storage> sb : [[access(read_write)]] SB;
[[stage(compute)]]
fn main() {
var x : f32 = sb.a;
}

View File

@@ -1,11 +0,0 @@
deprecated/access_deco/storage_buffer.wgsl:7:26 warning: use of deprecated language feature: declare access with var<storage, read_write> instead of using [[access]] decoration
[[group(0), binding(0)]] var<storage> sb : [[access(read_write)]] SB;
^^^
RWByteAddressBuffer sb : register(u0, space0);
[numthreads(1, 1, 1)]
void main() {
float x = asfloat(sb.Load(0u));
return;
}

View File

@@ -1,16 +0,0 @@
deprecated/access_deco/storage_buffer.wgsl:7:26 warning: use of deprecated language feature: declare access with var<storage, read_write> instead of using [[access]] decoration
[[group(0), binding(0)]] var<storage> sb : [[access(read_write)]] SB;
^^^
#include <metal_stdlib>
using namespace metal;
struct SB {
/* 0x0000 */ float a;
};
kernel void tint_symbol(device SB& sb [[buffer(0)]]) {
float x = sb.a;
return;
}

View File

@@ -1,41 +0,0 @@
deprecated/access_deco/storage_buffer.wgsl:7:26 warning: use of deprecated language feature: declare access with var<storage, read_write> instead of using [[access]] decoration
[[group(0), binding(0)]] var<storage> sb : [[access(read_write)]] SB;
^^^
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 17
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %SB "SB"
OpMemberName %SB 0 "a"
OpName %sb "sb"
OpName %main "main"
OpName %x "x"
OpDecorate %SB Block
OpMemberDecorate %SB 0 Offset 0
OpDecorate %sb DescriptorSet 0
OpDecorate %sb Binding 0
%float = OpTypeFloat 32
%SB = OpTypeStruct %float
%_ptr_StorageBuffer_SB = OpTypePointer StorageBuffer %SB
%sb = OpVariable %_ptr_StorageBuffer_SB StorageBuffer
%void = OpTypeVoid
%5 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%_ptr_Function_float = OpTypePointer Function %float
%16 = OpConstantNull %float
%main = OpFunction %void None %5
%8 = OpLabel
%x = OpVariable %_ptr_Function_float Function %16
%12 = OpAccessChain %_ptr_StorageBuffer_float %sb %uint_0
%13 = OpLoad %float %12
OpStore %x %13
OpReturn
OpFunctionEnd

View File

@@ -1,15 +0,0 @@
deprecated/access_deco/storage_buffer.wgsl:7:26 warning: use of deprecated language feature: declare access with var<storage, read_write> instead of using [[access]] decoration
[[group(0), binding(0)]] var<storage> sb : [[access(read_write)]] SB;
^^^
[[block]]
struct SB {
a : f32;
};
[[group(0), binding(0)]] var<storage, read_write> sb : SB;
[[stage(compute)]]
fn main() {
var x : f32 = sb.a;
}

View File

@@ -1,6 +0,0 @@
[[group(0), binding(0)]] var tex : [[access(write)]] texture_storage_2d<rgba32float>;
[[stage(compute)]]
fn main() {
var x : vec2<i32> = textureDimensions(tex);
}

View File

@@ -1,13 +0,0 @@
deprecated/access_deco/storage_texture.wgsl:1:84 warning: use of deprecated language feature: access control is expected as last parameter of storage textures
[[group(0), binding(0)]] var tex : [[access(write)]] texture_storage_2d<rgba32float>;
^
RWTexture2D<float4> tex : register(u0, space0);
[numthreads(1, 1, 1)]
void main() {
int2 tint_tmp;
tex.GetDimensions(tint_tmp.x, tint_tmp.y);
int2 x = tint_tmp;
return;
}

View File

@@ -1,12 +0,0 @@
deprecated/access_deco/storage_texture.wgsl:1:84 warning: use of deprecated language feature: access control is expected as last parameter of storage textures
[[group(0), binding(0)]] var tex : [[access(write)]] texture_storage_2d<rgba32float>;
^
#include <metal_stdlib>
using namespace metal;
kernel void tint_symbol(texture2d<float, access::write> tint_symbol_1 [[texture(0)]]) {
int2 x = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
return;
}

View File

@@ -1,38 +0,0 @@
deprecated/access_deco/storage_texture.wgsl:1:84 warning: use of deprecated language feature: access control is expected as last parameter of storage textures
[[group(0), binding(0)]] var tex : [[access(write)]] texture_storage_2d<rgba32float>;
^
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 16
; Schema: 0
OpCapability Shader
OpCapability ImageQuery
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %tex "tex"
OpName %main "main"
OpName %x "x"
OpDecorate %tex NonReadable
OpDecorate %tex DescriptorSet 0
OpDecorate %tex Binding 0
%float = OpTypeFloat 32
%3 = OpTypeImage %float 2D 0 0 0 2 Rgba32f
%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
%tex = OpVariable %_ptr_UniformConstant_3 UniformConstant
%void = OpTypeVoid
%5 = OpTypeFunction %void
%int = OpTypeInt 32 1
%v2int = OpTypeVector %int 2
%_ptr_Function_v2int = OpTypePointer Function %v2int
%15 = OpConstantNull %v2int
%main = OpFunction %void None %5
%8 = OpLabel
%x = OpVariable %_ptr_Function_v2int Function %15
%12 = OpLoad %3 %tex
%9 = OpImageQuerySize %v2int %12
OpStore %x %9
OpReturn
OpFunctionEnd

View File

@@ -1,10 +0,0 @@
deprecated/access_deco/storage_texture.wgsl:1:84 warning: use of deprecated language feature: access control is expected as last parameter of storage textures
[[group(0), binding(0)]] var tex : [[access(write)]] texture_storage_2d<rgba32float>;
^
[[group(0), binding(0)]] var tex : texture_storage_2d<rgba32float, write>;
[[stage(compute)]]
fn main() {
var x : vec2<i32> = textureDimensions(tex);
}