mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-07-14 00:56:05 +00:00
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>
226 lines
10 KiB
Plaintext
226 lines
10 KiB
Plaintext
; SPIR-V
|
|
; Version: 1.3
|
|
; Generator: Google Tint Compiler; 0
|
|
; Bound: 137
|
|
; Schema: 0
|
|
OpCapability Shader
|
|
%118 = OpExtInstImport "GLSL.std.450"
|
|
OpMemoryModel Logical GLSL450
|
|
OpEntryPoint Vertex %vs_main "vs_main" %VertexIndex_1 %texcoords_1 %position_1 %vertex_point_size
|
|
OpEntryPoint Fragment %fs_main "fs_main" %texcoord_1 %value
|
|
OpExecutionMode %fs_main OriginUpperLeft
|
|
OpName %tint_discarded "tint_discarded"
|
|
OpName %VertexIndex_1 "VertexIndex_1"
|
|
OpName %texcoords_1 "texcoords_1"
|
|
OpName %position_1 "position_1"
|
|
OpName %vertex_point_size "vertex_point_size"
|
|
OpName %texcoord_1 "texcoord_1"
|
|
OpName %value "value"
|
|
OpName %uniforms_block "uniforms_block"
|
|
OpMemberName %uniforms_block 0 "inner"
|
|
OpName %Uniforms "Uniforms"
|
|
OpMemberName %Uniforms 0 "u_scale"
|
|
OpMemberName %Uniforms 1 "u_offset"
|
|
OpName %uniforms "uniforms"
|
|
OpName %mySampler "mySampler"
|
|
OpName %myTexture "myTexture"
|
|
OpName %VertexOutputs "VertexOutputs"
|
|
OpMemberName %VertexOutputs 0 "texcoords"
|
|
OpMemberName %VertexOutputs 1 "position"
|
|
OpName %vs_main_inner "vs_main_inner"
|
|
OpName %VertexIndex "VertexIndex"
|
|
OpName %texcoord "texcoord"
|
|
OpName %output "output"
|
|
OpName %flipY "flipY"
|
|
OpName %vs_main "vs_main"
|
|
OpName %fs_main_inner "fs_main_inner"
|
|
OpName %texcoord_0 "texcoord"
|
|
OpName %clampedTexcoord "clampedTexcoord"
|
|
OpName %srcColor "srcColor"
|
|
OpName %fs_main "fs_main"
|
|
OpDecorate %VertexIndex_1 BuiltIn VertexIndex
|
|
OpDecorate %texcoords_1 Location 0
|
|
OpDecorate %position_1 BuiltIn Position
|
|
OpDecorate %vertex_point_size BuiltIn PointSize
|
|
OpDecorate %texcoord_1 Location 0
|
|
OpDecorate %value Location 0
|
|
OpDecorate %uniforms_block Block
|
|
OpMemberDecorate %uniforms_block 0 Offset 0
|
|
OpMemberDecorate %Uniforms 0 Offset 0
|
|
OpMemberDecorate %Uniforms 1 Offset 8
|
|
OpDecorate %uniforms NonWritable
|
|
OpDecorate %uniforms Binding 0
|
|
OpDecorate %uniforms DescriptorSet 0
|
|
OpDecorate %mySampler Binding 1
|
|
OpDecorate %mySampler DescriptorSet 0
|
|
OpDecorate %myTexture Binding 2
|
|
OpDecorate %myTexture DescriptorSet 0
|
|
OpMemberDecorate %VertexOutputs 0 Offset 0
|
|
OpMemberDecorate %VertexOutputs 1 Offset 16
|
|
OpDecorate %_arr_v2float_uint_3 ArrayStride 8
|
|
%bool = OpTypeBool
|
|
%2 = OpConstantNull %bool
|
|
%_ptr_Private_bool = OpTypePointer Private %bool
|
|
%tint_discarded = OpVariable %_ptr_Private_bool Private %2
|
|
%uint = OpTypeInt 32 0
|
|
%_ptr_Input_uint = OpTypePointer Input %uint
|
|
%VertexIndex_1 = OpVariable %_ptr_Input_uint Input
|
|
%float = OpTypeFloat 32
|
|
%v2float = OpTypeVector %float 2
|
|
%_ptr_Output_v2float = OpTypePointer Output %v2float
|
|
%12 = OpConstantNull %v2float
|
|
%texcoords_1 = OpVariable %_ptr_Output_v2float Output %12
|
|
%v4float = OpTypeVector %float 4
|
|
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
|
%16 = OpConstantNull %v4float
|
|
%position_1 = OpVariable %_ptr_Output_v4float Output %16
|
|
%_ptr_Output_float = OpTypePointer Output %float
|
|
%19 = OpConstantNull %float
|
|
%vertex_point_size = OpVariable %_ptr_Output_float Output %19
|
|
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
|
%texcoord_1 = OpVariable %_ptr_Input_v2float Input
|
|
%value = OpVariable %_ptr_Output_v4float Output %16
|
|
%Uniforms = OpTypeStruct %v2float %v2float
|
|
%uniforms_block = OpTypeStruct %Uniforms
|
|
%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block
|
|
%uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform
|
|
%29 = OpTypeSampler
|
|
%_ptr_UniformConstant_29 = OpTypePointer UniformConstant %29
|
|
%mySampler = OpVariable %_ptr_UniformConstant_29 UniformConstant
|
|
%32 = OpTypeImage %float 2D 0 0 0 1 Unknown
|
|
%_ptr_UniformConstant_32 = OpTypePointer UniformConstant %32
|
|
%myTexture = OpVariable %_ptr_UniformConstant_32 UniformConstant
|
|
%VertexOutputs = OpTypeStruct %v2float %v4float
|
|
%33 = OpTypeFunction %VertexOutputs %uint
|
|
%uint_3 = OpConstant %uint 3
|
|
%_arr_v2float_uint_3 = OpTypeArray %v2float %uint_3
|
|
%float_n0_5 = OpConstant %float -0.5
|
|
%41 = OpConstantComposite %v2float %float_n0_5 %19
|
|
%float_1_5 = OpConstant %float 1.5
|
|
%43 = OpConstantComposite %v2float %float_1_5 %19
|
|
%float_0_5 = OpConstant %float 0.5
|
|
%float_2 = OpConstant %float 2
|
|
%46 = OpConstantComposite %v2float %float_0_5 %float_2
|
|
%47 = OpConstantComposite %_arr_v2float_uint_3 %41 %43 %46
|
|
%_ptr_Function__arr_v2float_uint_3 = OpTypePointer Function %_arr_v2float_uint_3
|
|
%50 = OpConstantNull %_arr_v2float_uint_3
|
|
%_ptr_Function_VertexOutputs = OpTypePointer Function %VertexOutputs
|
|
%53 = OpConstantNull %VertexOutputs
|
|
%uint_1 = OpConstant %uint 1
|
|
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
|
%_ptr_Function_v2float = OpTypePointer Function %v2float
|
|
%float_1 = OpConstant %float 1
|
|
%62 = OpConstantComposite %v2float %float_1 %float_1
|
|
%uint_0 = OpConstant %uint 0
|
|
%_ptr_Uniform_float = OpTypePointer Uniform %float
|
|
%_ptr_Function_bool = OpTypePointer Function %bool
|
|
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
|
|
%float_n1 = OpConstant %float -1
|
|
%89 = OpConstantComposite %v2float %float_1 %float_n1
|
|
%91 = OpConstantComposite %v2float %19 %float_1
|
|
%void = OpTypeVoid
|
|
%105 = OpTypeFunction %void
|
|
%113 = OpTypeFunction %v4float %v2float
|
|
%v2bool = OpTypeVector %bool 2
|
|
%true = OpConstantTrue %bool
|
|
%vs_main_inner = OpFunction %VertexOutputs None %33
|
|
%VertexIndex = OpFunctionParameter %uint
|
|
%37 = OpLabel
|
|
%texcoord = OpVariable %_ptr_Function__arr_v2float_uint_3 Function %50
|
|
%output = OpVariable %_ptr_Function_VertexOutputs Function %53
|
|
%flipY = OpVariable %_ptr_Function_bool Function %2
|
|
OpStore %texcoord %47
|
|
%56 = OpAccessChain %_ptr_Function_v4float %output %uint_1
|
|
%58 = OpAccessChain %_ptr_Function_v2float %texcoord %VertexIndex
|
|
%59 = OpLoad %v2float %58
|
|
%60 = OpVectorTimesScalar %v2float %59 %float_2
|
|
%63 = OpFSub %v2float %60 %62
|
|
%64 = OpCompositeExtract %float %63 0
|
|
%65 = OpCompositeExtract %float %63 1
|
|
%66 = OpCompositeConstruct %v4float %64 %65 %19 %float_1
|
|
OpStore %56 %66
|
|
%69 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_0 %uint_1
|
|
%70 = OpLoad %float %69
|
|
%71 = OpFOrdLessThan %bool %70 %19
|
|
OpStore %flipY %71
|
|
%74 = OpLoad %bool %flipY
|
|
OpSelectionMerge %75 None
|
|
OpBranchConditional %74 %76 %77
|
|
%76 = OpLabel
|
|
%78 = OpAccessChain %_ptr_Function_v2float %output %uint_0
|
|
%79 = OpAccessChain %_ptr_Function_v2float %texcoord %VertexIndex
|
|
%80 = OpLoad %v2float %79
|
|
%82 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_0 %uint_0
|
|
%83 = OpLoad %v2float %82
|
|
%84 = OpFMul %v2float %80 %83
|
|
%85 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_0 %uint_1
|
|
%86 = OpLoad %v2float %85
|
|
%87 = OpFAdd %v2float %84 %86
|
|
%90 = OpFMul %v2float %87 %89
|
|
%92 = OpFAdd %v2float %90 %91
|
|
OpStore %78 %92
|
|
OpBranch %75
|
|
%77 = OpLabel
|
|
%93 = OpAccessChain %_ptr_Function_v2float %output %uint_0
|
|
%94 = OpAccessChain %_ptr_Function_v2float %texcoord %VertexIndex
|
|
%95 = OpLoad %v2float %94
|
|
%96 = OpFMul %v2float %95 %89
|
|
%97 = OpFAdd %v2float %96 %91
|
|
%98 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_0 %uint_0
|
|
%99 = OpLoad %v2float %98
|
|
%100 = OpFMul %v2float %97 %99
|
|
%101 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_0 %uint_1
|
|
%102 = OpLoad %v2float %101
|
|
%103 = OpFAdd %v2float %100 %102
|
|
OpStore %93 %103
|
|
OpBranch %75
|
|
%75 = OpLabel
|
|
%104 = OpLoad %VertexOutputs %output
|
|
OpReturnValue %104
|
|
OpFunctionEnd
|
|
%vs_main = OpFunction %void None %105
|
|
%108 = OpLabel
|
|
%110 = OpLoad %uint %VertexIndex_1
|
|
%109 = OpFunctionCall %VertexOutputs %vs_main_inner %110
|
|
%111 = OpCompositeExtract %v2float %109 0
|
|
OpStore %texcoords_1 %111
|
|
%112 = OpCompositeExtract %v4float %109 1
|
|
OpStore %position_1 %112
|
|
OpStore %vertex_point_size %float_1
|
|
OpReturn
|
|
OpFunctionEnd
|
|
%fs_main_inner = OpFunction %v4float None %113
|
|
%texcoord_0 = OpFunctionParameter %v2float
|
|
%116 = OpLabel
|
|
%clampedTexcoord = OpVariable %_ptr_Function_v2float Function %12
|
|
%srcColor = OpVariable %_ptr_Function_v4float Function %16
|
|
%117 = OpExtInst %v2float %118 NClamp %texcoord_0 %12 %62
|
|
OpStore %clampedTexcoord %117
|
|
%122 = OpLoad %v2float %clampedTexcoord
|
|
%123 = OpFOrdEqual %v2bool %122 %texcoord_0
|
|
%121 = OpAll %bool %123
|
|
%120 = OpLogicalNot %bool %121
|
|
OpSelectionMerge %125 None
|
|
OpBranchConditional %120 %126 %125
|
|
%126 = OpLabel
|
|
OpStore %tint_discarded %true
|
|
OpBranch %125
|
|
%125 = OpLabel
|
|
OpStore %srcColor %16
|
|
%129 = OpLoad %v4float %srcColor
|
|
OpReturnValue %129
|
|
OpFunctionEnd
|
|
%fs_main = OpFunction %void None %105
|
|
%131 = OpLabel
|
|
%133 = OpLoad %v2float %texcoord_1
|
|
%132 = OpFunctionCall %v4float %fs_main_inner %133
|
|
OpStore %value %132
|
|
%134 = OpLoad %bool %tint_discarded
|
|
OpSelectionMerge %135 None
|
|
OpBranchConditional %134 %136 %135
|
|
%136 = OpLabel
|
|
OpKill
|
|
%135 = OpLabel
|
|
OpReturn
|
|
OpFunctionEnd
|