dawn-cmake/test/tint/statements/discard/helper_functions.wgsl.expected.spvasm
James Price 744d0eb4aa tint: Use "demote-to-helper" semantics for discard
Discard statements no longer affect the behavior or uniformity
analysis. Update the resolver, validator, and several tests to reflect
this.

Some E2E tests were removed as they had loops that are now considered
to be infinite.

Use the DemoteToHelper transform to emulate the correct semantics on
platforms where discard is (or may) terminate the invocation in a
manner that would affect derivative operations.

We no longer need the UnwindDiscardFunctions transform for HLSL, which
already implements the correct semantics. However, we still run the
DemoteToHelper transform for the HLSL backend due to issues with FXC's
handling of discard statements (see crbug.com/tint/1118).

Fixed: tint:1723
Change-Id: Ib49ff187919ae81c4af8675e1b66acd57e2ff7d2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109003
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
2022-11-09 19:58:59 +00:00

88 lines
3.5 KiB
Plaintext

; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 44
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main"
OpExecutionMode %main OriginUpperLeft
OpName %tint_discarded "tint_discarded"
OpName %non_uniform_global_block "non_uniform_global_block"
OpMemberName %non_uniform_global_block 0 "inner"
OpName %non_uniform_global "non_uniform_global"
OpName %output_block "output_block"
OpMemberName %output_block 0 "inner"
OpName %output "output"
OpName %foo "foo"
OpName %bar "bar"
OpName %main "main"
OpDecorate %non_uniform_global_block Block
OpMemberDecorate %non_uniform_global_block 0 Offset 0
OpDecorate %non_uniform_global DescriptorSet 0
OpDecorate %non_uniform_global Binding 0
OpDecorate %output_block Block
OpMemberDecorate %output_block 0 Offset 0
OpDecorate %output DescriptorSet 0
OpDecorate %output Binding 1
%bool = OpTypeBool
%2 = OpConstantNull %bool
%_ptr_Private_bool = OpTypePointer Private %bool
%tint_discarded = OpVariable %_ptr_Private_bool Private %2
%int = OpTypeInt 32 1
%non_uniform_global_block = OpTypeStruct %int
%_ptr_StorageBuffer_non_uniform_global_block = OpTypePointer StorageBuffer %non_uniform_global_block
%non_uniform_global = OpVariable %_ptr_StorageBuffer_non_uniform_global_block StorageBuffer
%float = OpTypeFloat 32
%output_block = OpTypeStruct %float
%_ptr_StorageBuffer_output_block = OpTypePointer StorageBuffer %output_block
%output = OpVariable %_ptr_StorageBuffer_output_block StorageBuffer
%void = OpTypeVoid
%13 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%22 = OpConstantNull %int
%true = OpConstantTrue %bool
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%float_1 = OpConstant %float 1
%foo = OpFunction %void None %13
%16 = OpLabel
%20 = OpAccessChain %_ptr_StorageBuffer_int %non_uniform_global %uint_0
%21 = OpLoad %int %20
%23 = OpSLessThan %bool %21 %22
OpSelectionMerge %24 None
OpBranchConditional %23 %25 %24
%25 = OpLabel
OpStore %tint_discarded %true
OpBranch %24
%24 = OpLabel
OpReturn
OpFunctionEnd
%bar = OpFunction %void None %13
%28 = OpLabel
%30 = OpLoad %bool %tint_discarded
%29 = OpLogicalNot %bool %30
OpSelectionMerge %31 None
OpBranchConditional %29 %32 %31
%32 = OpLabel
%34 = OpAccessChain %_ptr_StorageBuffer_float %output %uint_0
%35 = OpDPdx %float %float_1
OpStore %34 %35
OpBranch %31
%31 = OpLabel
OpReturn
OpFunctionEnd
%main = OpFunction %void None %13
%38 = OpLabel
%39 = OpFunctionCall %void %foo
%40 = OpFunctionCall %void %bar
%41 = OpLoad %bool %tint_discarded
OpSelectionMerge %42 None
OpBranchConditional %41 %43 %42
%43 = OpLabel
OpKill
%42 = OpLabel
OpReturn
OpFunctionEnd