dawn-cmake/test/bug/tint/1136.wgsl.expected.spvasm
Ben Clayton 9021eb5594 resolver: Allow parameters to shadow globals
In https://dawn-review.googlesource.com/c/tint/+/62444 the Resolver validated that there are no parameters of the same function with the same name, but this also introduced validation that errors if parameters shadow a module-scope variable.

The WGSL spec allows for shadowing, but Tint so far has not implemented this support.

There are transforms that generate functions that presume parameter <-> module-scope variable shadowing is okay. DecomposeMemoryAccess is one of these.

This fixes those transforms which could generate programs that fail validation.

Bug: chromium:1242330
Fixed: tint:1136
Change-Id: Id6ec59bbdb398b3b2a23312115a7c1dadf433e98
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/62900
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-08-26 15:40:06 +00:00

41 lines
1.5 KiB
Plaintext

; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 18
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
OpExecutionMode %unused_entry_point LocalSize 1 1 1
OpName %Buffer "Buffer"
OpMemberName %Buffer 0 "data"
OpName %buffer "buffer"
OpName %unused_entry_point "unused_entry_point"
OpName %main "main"
OpDecorate %Buffer Block
OpMemberDecorate %Buffer 0 Offset 0
OpDecorate %buffer DescriptorSet 0
OpDecorate %buffer Binding 0
%uint = OpTypeInt 32 0
%Buffer = OpTypeStruct %uint
%_ptr_StorageBuffer_Buffer = OpTypePointer StorageBuffer %Buffer
%buffer = OpVariable %_ptr_StorageBuffer_Buffer StorageBuffer
%void = OpTypeVoid
%5 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
%uint_1 = OpConstant %uint 1
%unused_entry_point = OpFunction %void None %5
%8 = OpLabel
OpReturn
OpFunctionEnd
%main = OpFunction %void None %5
%10 = OpLabel
%13 = OpAccessChain %_ptr_StorageBuffer_uint %buffer %uint_0
%14 = OpAccessChain %_ptr_StorageBuffer_uint %buffer %uint_0
%15 = OpLoad %uint %14
%17 = OpIAdd %uint %15 %uint_1
OpStore %13 %17
OpReturn
OpFunctionEnd