dawn-cmake/test/deprecated/access_deco/storage_buffer.wgsl.expected.spvasm
Ben Clayton 93e8f527ee wgsl: Deprecate [[access]] decorations
Handle access control on var declarations instead of via [[access]]
decorations. This change does the minimal work to migrate the WGSL
parser over to the new syntax. Additional changes will be needed
to correctly generate defaulted access qualifiers, as well as
validating access usage.

The [[access]] decorations are still supported by the WGSL parser,
with new deprecated warnings, but not for aliases. Example:
   var x : [[access(x)]] alias_to_struct;

Making this work is far more effort than I want to dedicate to backwards
compatibility, and I do not beleive any real-world usage will be doing
this.

Still TODO:
* Adding access control as the optional, third parameter to ptr<>.
* Calculating default accesses for the various storage types.
* Validating usage of variables against the different accesses.

Bug: tint:846
Change-Id: If8ca82e5d16ec319ecd01f9a2cafffd930963bde
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53088
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-06-04 20:41:47 +00:00

42 lines
1.6 KiB
Plaintext

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