dawn-cmake/test/tint/bug/tint/1081.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

91 lines
3.1 KiB
Plaintext

; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 47
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %x_1 %value
OpExecutionMode %main OriginUpperLeft
OpName %tint_discarded "tint_discarded"
OpName %x_1 "x_1"
OpName %value "value"
OpName %f "f"
OpName %x "x"
OpName %main_inner "main_inner"
OpName %x_0 "x"
OpName %y "y"
OpName %main "main"
OpDecorate %x_1 Location 1
OpDecorate %x_1 Flat
OpDecorate %value Location 2
%bool = OpTypeBool
%2 = OpConstantNull %bool
%_ptr_Private_bool = OpTypePointer Private %bool
%tint_discarded = OpVariable %_ptr_Private_bool Private %2
%int = OpTypeInt 32 1
%v3int = OpTypeVector %int 3
%_ptr_Input_v3int = OpTypePointer Input %v3int
%x_1 = OpVariable %_ptr_Input_v3int Input
%_ptr_Output_int = OpTypePointer Output %int
%11 = OpConstantNull %int
%value = OpVariable %_ptr_Output_int Output %11
%12 = OpTypeFunction %int %int
%int_10 = OpConstant %int 10
%true = OpConstantTrue %bool
%21 = OpTypeFunction %int %v3int
%_ptr_Function_int = OpTypePointer Function %int
%void = OpTypeVoid
%38 = OpTypeFunction %void
%f = OpFunction %int None %12
%x = OpFunctionParameter %int
%15 = OpLabel
%17 = OpIEqual %bool %x %int_10
OpSelectionMerge %18 None
OpBranchConditional %17 %19 %18
%19 = OpLabel
OpStore %tint_discarded %true
OpBranch %18
%18 = OpLabel
OpReturnValue %x
OpFunctionEnd
%main_inner = OpFunction %int None %21
%x_0 = OpFunctionParameter %v3int
%24 = OpLabel
%y = OpVariable %_ptr_Function_int Function %11
%25 = OpCompositeExtract %int %x_0 0
OpStore %y %25
OpBranch %28
%28 = OpLabel
OpLoopMerge %29 %30 None
OpBranch %31
%31 = OpLabel
%33 = OpLoad %int %y
%32 = OpFunctionCall %int %f %33
%34 = OpIEqual %bool %32 %11
OpSelectionMerge %35 None
OpBranchConditional %34 %36 %35
%36 = OpLabel
OpBranch %29
%35 = OpLabel
OpBranch %30
%30 = OpLabel
OpBranch %28
%29 = OpLabel
%37 = OpLoad %int %y
OpReturnValue %37
OpFunctionEnd
%main = OpFunction %void None %38
%41 = OpLabel
%43 = OpLoad %v3int %x_1
%42 = OpFunctionCall %int %main_inner %43
OpStore %value %42
%44 = OpLoad %bool %tint_discarded
OpSelectionMerge %45 None
OpBranchConditional %44 %46 %45
%46 = OpLabel
OpKill
%45 = OpLabel
OpReturn
OpFunctionEnd