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

311 lines
14 KiB
Plaintext

; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 188
; Schema: 0
OpCapability Shader
%74 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %fClipDistance3_param_1 %fClipDistance4_param_1 %glFragColor_1_1
OpExecutionMode %main OriginUpperLeft
OpName %tint_discarded "tint_discarded"
OpName %fClipDistance3_param_1 "fClipDistance3_param_1"
OpName %fClipDistance4_param_1 "fClipDistance4_param_1"
OpName %glFragColor_1_1 "glFragColor_1_1"
OpName %fClipDistance3 "fClipDistance3"
OpName %fClipDistance4 "fClipDistance4"
OpName %x_29_block "x_29_block"
OpMemberName %x_29_block 0 "inner"
OpName %Scene "Scene"
OpMemberName %Scene 0 "vEyePosition"
OpName %x_29 "x_29"
OpName %x_49_block "x_49_block"
OpMemberName %x_49_block 0 "inner"
OpName %Material "Material"
OpMemberName %Material 0 "vDiffuseColor"
OpMemberName %Material 1 "vAmbientColor"
OpMemberName %Material 2 "placeholder"
OpMemberName %Material 3 "vEmissiveColor"
OpMemberName %Material 4 "placeholder2"
OpName %x_49 "x_49"
OpName %x_137_block "x_137_block"
OpMemberName %x_137_block 0 "inner"
OpName %Mesh "Mesh"
OpMemberName %Mesh 0 "visibility"
OpName %x_137 "x_137"
OpName %glFragColor "glFragColor"
OpName %main_1 "main_1"
OpName %viewDirectionW "viewDirectionW"
OpName %baseColor "baseColor"
OpName %diffuseColor "diffuseColor"
OpName %alpha "alpha"
OpName %normalW "normalW"
OpName %uvOffset "uvOffset"
OpName %baseAmbientColor "baseAmbientColor"
OpName %glossiness "glossiness"
OpName %diffuseBase "diffuseBase"
OpName %shadow "shadow"
OpName %refractionColor "refractionColor"
OpName %reflectionColor "reflectionColor"
OpName %emissiveColor "emissiveColor"
OpName %finalDiffuse "finalDiffuse"
OpName %finalSpecular "finalSpecular"
OpName %color "color"
OpName %main_out "main_out"
OpMemberName %main_out 0 "glFragColor_1"
OpName %main_inner "main_inner"
OpName %fClipDistance3_param "fClipDistance3_param"
OpName %fClipDistance4_param "fClipDistance4_param"
OpName %main "main"
OpDecorate %fClipDistance3_param_1 Location 2
OpDecorate %fClipDistance4_param_1 Location 3
OpDecorate %glFragColor_1_1 Location 0
OpDecorate %x_29_block Block
OpMemberDecorate %x_29_block 0 Offset 0
OpMemberDecorate %Scene 0 Offset 0
OpDecorate %x_29 NonWritable
OpDecorate %x_29 DescriptorSet 0
OpDecorate %x_29 Binding 0
OpDecorate %x_49_block Block
OpMemberDecorate %x_49_block 0 Offset 0
OpMemberDecorate %Material 0 Offset 0
OpMemberDecorate %Material 1 Offset 16
OpMemberDecorate %Material 2 Offset 28
OpMemberDecorate %Material 3 Offset 32
OpMemberDecorate %Material 4 Offset 44
OpDecorate %x_49 NonWritable
OpDecorate %x_49 DescriptorSet 0
OpDecorate %x_49 Binding 1
OpDecorate %x_137_block Block
OpMemberDecorate %x_137_block 0 Offset 0
OpMemberDecorate %Mesh 0 Offset 0
OpDecorate %x_137 NonWritable
OpDecorate %x_137 DescriptorSet 0
OpDecorate %x_137 Binding 2
OpMemberDecorate %main_out 0 Offset 0
%bool = OpTypeBool
%2 = OpConstantNull %bool
%_ptr_Private_bool = OpTypePointer Private %bool
%tint_discarded = OpVariable %_ptr_Private_bool Private %2
%float = OpTypeFloat 32
%_ptr_Input_float = OpTypePointer Input %float
%fClipDistance3_param_1 = OpVariable %_ptr_Input_float Input
%fClipDistance4_param_1 = OpVariable %_ptr_Input_float Input
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%12 = OpConstantNull %v4float
%glFragColor_1_1 = OpVariable %_ptr_Output_v4float Output %12
%_ptr_Private_float = OpTypePointer Private %float
%15 = OpConstantNull %float
%fClipDistance3 = OpVariable %_ptr_Private_float Private %15
%fClipDistance4 = OpVariable %_ptr_Private_float Private %15
%Scene = OpTypeStruct %v4float
%x_29_block = OpTypeStruct %Scene
%_ptr_Uniform_x_29_block = OpTypePointer Uniform %x_29_block
%x_29 = OpVariable %_ptr_Uniform_x_29_block Uniform
%v3float = OpTypeVector %float 3
%Material = OpTypeStruct %v4float %v3float %float %v3float %float
%x_49_block = OpTypeStruct %Material
%_ptr_Uniform_x_49_block = OpTypePointer Uniform %x_49_block
%x_49 = OpVariable %_ptr_Uniform_x_49_block Uniform
%Mesh = OpTypeStruct %float
%x_137_block = OpTypeStruct %Mesh
%_ptr_Uniform_x_137_block = OpTypePointer Uniform %x_137_block
%x_137 = OpVariable %_ptr_Uniform_x_137_block Uniform
%_ptr_Private_v4float = OpTypePointer Private %v4float
%glFragColor = OpVariable %_ptr_Private_v4float Private %12
%void = OpTypeVoid
%32 = OpTypeFunction %void
%_ptr_Function_v3float = OpTypePointer Function %v3float
%38 = OpConstantNull %v3float
%_ptr_Function_v4float = OpTypePointer Function %v4float
%_ptr_Function_float = OpTypePointer Function %float
%v2float = OpTypeVector %float 2
%_ptr_Function_v2float = OpTypePointer Function %v2float
%48 = OpConstantNull %v2float
%true = OpConstantTrue %bool
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
%float_1 = OpConstant %float 1
%81 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%uint_3 = OpConstant %uint 3
%_ptr_Uniform_float = OpTypePointer Uniform %float
%108 = OpConstantComposite %v3float %float_1 %float_1 %float_1
%109 = OpConstantComposite %v4float %15 %15 %15 %float_1
%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float
%uint_1 = OpConstant %uint 1
%main_out = OpTypeStruct %v4float
%170 = OpTypeFunction %main_out %float %float
%main_1 = OpFunction %void None %32
%35 = OpLabel
%viewDirectionW = OpVariable %_ptr_Function_v3float Function %38
%baseColor = OpVariable %_ptr_Function_v4float Function %12
%diffuseColor = OpVariable %_ptr_Function_v3float Function %38
%alpha = OpVariable %_ptr_Function_float Function %15
%normalW = OpVariable %_ptr_Function_v3float Function %38
%uvOffset = OpVariable %_ptr_Function_v2float Function %48
%baseAmbientColor = OpVariable %_ptr_Function_v3float Function %38
%glossiness = OpVariable %_ptr_Function_float Function %15
%diffuseBase = OpVariable %_ptr_Function_v3float Function %38
%shadow = OpVariable %_ptr_Function_float Function %15
%refractionColor = OpVariable %_ptr_Function_v4float Function %12
%reflectionColor = OpVariable %_ptr_Function_v4float Function %12
%emissiveColor = OpVariable %_ptr_Function_v3float Function %38
%finalDiffuse = OpVariable %_ptr_Function_v3float Function %38
%finalSpecular = OpVariable %_ptr_Function_v3float Function %38
%color = OpVariable %_ptr_Function_v4float Function %12
%59 = OpLoad %float %fClipDistance3
%60 = OpFOrdGreaterThan %bool %59 %15
OpSelectionMerge %61 None
OpBranchConditional %60 %62 %61
%62 = OpLabel
OpStore %tint_discarded %true
OpBranch %61
%61 = OpLabel
%64 = OpLoad %float %fClipDistance4
%65 = OpFOrdGreaterThan %bool %64 %15
OpSelectionMerge %66 None
OpBranchConditional %65 %67 %66
%67 = OpLabel
OpStore %tint_discarded %true
OpBranch %66
%66 = OpLabel
%71 = OpAccessChain %_ptr_Uniform_v4float %x_29 %uint_0 %uint_0
%72 = OpLoad %v4float %71
%75 = OpCompositeExtract %float %72 0
%76 = OpCompositeExtract %float %72 1
%77 = OpCompositeExtract %float %72 2
%78 = OpCompositeConstruct %v3float %75 %76 %77
%79 = OpFSub %v3float %78 %38
%73 = OpExtInst %v3float %74 Normalize %79
OpStore %viewDirectionW %73
OpStore %baseColor %81
%82 = OpAccessChain %_ptr_Uniform_v4float %x_49 %uint_0 %uint_0
%83 = OpLoad %v4float %82
%84 = OpCompositeExtract %float %83 0
%85 = OpCompositeExtract %float %83 1
%86 = OpCompositeExtract %float %83 2
%87 = OpCompositeConstruct %v3float %84 %85 %86
OpStore %diffuseColor %87
%90 = OpAccessChain %_ptr_Uniform_float %x_49 %uint_0 %uint_0 %uint_3
%91 = OpLoad %float %90
OpStore %alpha %91
OpStore %uvOffset %48
%92 = OpLoad %v4float %baseColor
%93 = OpCompositeExtract %float %92 0
%94 = OpCompositeExtract %float %92 1
%95 = OpCompositeExtract %float %92 2
%96 = OpCompositeConstruct %v3float %93 %94 %95
%97 = OpCompositeExtract %float %12 0
%98 = OpCompositeExtract %float %12 1
%99 = OpCompositeExtract %float %12 2
%100 = OpCompositeConstruct %v3float %97 %98 %99
%101 = OpFMul %v3float %96 %100
%102 = OpLoad %v4float %baseColor
%103 = OpCompositeExtract %float %101 0
%104 = OpCompositeExtract %float %101 1
%105 = OpCompositeExtract %float %101 2
%106 = OpCompositeExtract %float %102 3
%107 = OpCompositeConstruct %v4float %103 %104 %105 %106
OpStore %baseColor %107
OpStore %baseAmbientColor %108
OpStore %glossiness %15
OpStore %diffuseBase %38
OpStore %shadow %float_1
OpStore %refractionColor %109
OpStore %reflectionColor %109
%111 = OpAccessChain %_ptr_Uniform_v3float %x_49 %uint_0 %uint_3
%112 = OpLoad %v3float %111
OpStore %emissiveColor %112
%113 = OpLoad %v3float %diffuseBase
%114 = OpLoad %v3float %diffuseColor
%115 = OpLoad %v3float %emissiveColor
%117 = OpAccessChain %_ptr_Uniform_v3float %x_49 %uint_0 %uint_1
%118 = OpLoad %v3float %117
%119 = OpLoad %v4float %baseColor
%121 = OpFMul %v3float %113 %114
%122 = OpFAdd %v3float %121 %115
%123 = OpFAdd %v3float %122 %118
%120 = OpExtInst %v3float %74 NClamp %123 %38 %108
%124 = OpCompositeExtract %float %119 0
%125 = OpCompositeExtract %float %119 1
%126 = OpCompositeExtract %float %119 2
%127 = OpCompositeConstruct %v3float %124 %125 %126
%128 = OpFMul %v3float %120 %127
OpStore %finalDiffuse %128
OpStore %finalSpecular %38
%129 = OpLoad %v3float %finalDiffuse
%130 = OpLoad %v3float %baseAmbientColor
%131 = OpLoad %v3float %finalSpecular
%132 = OpLoad %v4float %reflectionColor
%133 = OpLoad %v4float %refractionColor
%134 = OpFMul %v3float %129 %130
%135 = OpFAdd %v3float %134 %131
%136 = OpCompositeExtract %float %132 0
%137 = OpCompositeExtract %float %132 1
%138 = OpCompositeExtract %float %132 2
%139 = OpCompositeConstruct %v3float %136 %137 %138
%140 = OpFAdd %v3float %135 %139
%141 = OpCompositeExtract %float %133 0
%142 = OpCompositeExtract %float %133 1
%143 = OpCompositeExtract %float %133 2
%144 = OpCompositeConstruct %v3float %141 %142 %143
%145 = OpFAdd %v3float %140 %144
%146 = OpLoad %float %alpha
%147 = OpCompositeExtract %float %145 0
%148 = OpCompositeExtract %float %145 1
%149 = OpCompositeExtract %float %145 2
%150 = OpCompositeConstruct %v4float %147 %148 %149 %146
OpStore %color %150
%151 = OpLoad %v4float %color
%153 = OpCompositeExtract %float %151 0
%154 = OpCompositeExtract %float %151 1
%155 = OpCompositeExtract %float %151 2
%156 = OpCompositeConstruct %v3float %153 %154 %155
%152 = OpExtInst %v3float %74 NMax %156 %38
%157 = OpLoad %v4float %color
%158 = OpCompositeExtract %float %152 0
%159 = OpCompositeExtract %float %152 1
%160 = OpCompositeExtract %float %152 2
%161 = OpCompositeExtract %float %157 3
%162 = OpCompositeConstruct %v4float %158 %159 %160 %161
OpStore %color %162
%163 = OpAccessChain %_ptr_Uniform_float %x_137 %uint_0 %uint_0
%164 = OpLoad %float %163
%165 = OpAccessChain %_ptr_Function_float %color %uint_3
%166 = OpLoad %float %165
%167 = OpAccessChain %_ptr_Function_float %color %uint_3
%168 = OpFMul %float %166 %164
OpStore %167 %168
%169 = OpLoad %v4float %color
OpStore %glFragColor %169
OpReturn
OpFunctionEnd
%main_inner = OpFunction %main_out None %170
%fClipDistance3_param = OpFunctionParameter %float
%fClipDistance4_param = OpFunctionParameter %float
%175 = OpLabel
OpStore %fClipDistance3 %fClipDistance3_param
OpStore %fClipDistance4 %fClipDistance4_param
%176 = OpFunctionCall %void %main_1
%177 = OpLoad %v4float %glFragColor
%178 = OpCompositeConstruct %main_out %177
OpReturnValue %178
OpFunctionEnd
%main = OpFunction %void None %32
%180 = OpLabel
%182 = OpLoad %float %fClipDistance3_param_1
%183 = OpLoad %float %fClipDistance4_param_1
%181 = OpFunctionCall %main_out %main_inner %182 %183
%184 = OpCompositeExtract %v4float %181 0
OpStore %glFragColor_1_1 %184
%185 = OpLoad %bool %tint_discarded
OpSelectionMerge %186 None
OpBranchConditional %185 %187 %186
%187 = OpLabel
OpKill
%186 = OpLabel
OpReturn
OpFunctionEnd