1; SPIR-V
2; Version: 1.0
3; Generator: Khronos Glslang Reference Front End; 2
4; Bound: 131
5; Schema: 0
6               OpCapability Shader
7          %1 = OpExtInstImport "GLSL.std.450"
8               OpMemoryModel Logical GLSL450
9               OpEntryPoint Fragment %main "main" %fragWorld_1 %_entryPointOutput
10               OpExecutionMode %main OriginUpperLeft
11               OpSource HLSL 500
12               OpName %main "main"
13               OpName %GetClip2TexMatrix_ "GetClip2TexMatrix("
14               OpName %GetCascade_vf3_ "GetCascade(vf3;"
15               OpName %fragWorldPosition "fragWorldPosition"
16               OpName %_main_vf3_ "@main(vf3;"
17               OpName %fragWorld "fragWorld"
18               OpName %Foo "Foo"
19               OpMemberName %Foo 0 "lightVP"
20               OpMemberName %Foo 1 "shadowCascadesNum"
21               OpMemberName %Foo 2 "test"
22               OpName %_ ""
23               OpName %cascadeIndex "cascadeIndex"
24               OpName %worldToShadowMap "worldToShadowMap"
25               OpName %fragShadowMapPos "fragShadowMapPos"
26               OpName %param "param"
27               OpName %fragWorld_0 "fragWorld"
28               OpName %fragWorld_1 "fragWorld"
29               OpName %_entryPointOutput "@entryPointOutput"
30               OpName %param_0 "param"
31               OpDecorate %_arr_mat4v4float_uint_64 ArrayStride 64
32               OpMemberDecorate %Foo 0 RowMajor
33               OpMemberDecorate %Foo 0 Offset 0
34               OpMemberDecorate %Foo 0 MatrixStride 16
35               OpMemberDecorate %Foo 1 Offset 4096
36               OpMemberDecorate %Foo 2 Offset 4100
37               OpDecorate %Foo Block
38               OpDecorate %_ DescriptorSet 0
39               OpDecorate %_ Binding 0
40               OpDecorate %fragWorld_1 Location 0
41               OpDecorate %_entryPointOutput Location 0
42       %void = OpTypeVoid
43          %3 = OpTypeFunction %void
44      %float = OpTypeFloat 32
45    %v4float = OpTypeVector %float 4
46%mat4v4float = OpTypeMatrix %v4float 4
47          %9 = OpTypeFunction %mat4v4float
48    %v3float = OpTypeVector %float 3
49%_ptr_Function_v3float = OpTypePointer Function %v3float
50        %int = OpTypeInt 32 1
51         %15 = OpTypeFunction %int %_ptr_Function_v3float
52       %uint = OpTypeInt 32 0
53    %uint_64 = OpConstant %uint 64
54%_arr_mat4v4float_uint_64 = OpTypeArray %mat4v4float %uint_64
55        %Foo = OpTypeStruct %_arr_mat4v4float_uint_64 %uint %int
56%_ptr_Uniform_Foo = OpTypePointer Uniform %Foo
57          %_ = OpVariable %_ptr_Uniform_Foo Uniform
58      %int_2 = OpConstant %int 2
59%_ptr_Uniform_int = OpTypePointer Uniform %int
60      %int_0 = OpConstant %int 0
61       %bool = OpTypeBool
62  %float_0_5 = OpConstant %float 0.5
63    %float_0 = OpConstant %float 0
64         %39 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_0
65         %40 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_0
66         %41 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_0
67    %float_1 = OpConstant %float 1
68         %43 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
69         %44 = OpConstantComposite %mat4v4float %39 %40 %41 %43
70         %46 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_0
71         %47 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_0
72         %48 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_0
73         %49 = OpConstantComposite %mat4v4float %46 %47 %48 %43
74%_ptr_Function_uint = OpTypePointer Function %uint
75     %uint_0 = OpConstant %uint 0
76      %int_1 = OpConstant %int 1
77%_ptr_Uniform_uint = OpTypePointer Uniform %uint
78%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float
79%_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float
80%_ptr_Function_v4float = OpTypePointer Function %v4float
81     %uint_2 = OpConstant %uint 2
82%_ptr_Function_float = OpTypePointer Function %float
83     %uint_1 = OpConstant %uint 1
84     %int_n1 = OpConstant %int -1
85%_ptr_Input_v3float = OpTypePointer Input %v3float
86%fragWorld_1 = OpVariable %_ptr_Input_v3float Input
87%_ptr_Output_int = OpTypePointer Output %int
88%_entryPointOutput = OpVariable %_ptr_Output_int Output
89       %main = OpFunction %void None %3
90          %5 = OpLabel
91%fragWorld_0 = OpVariable %_ptr_Function_v3float Function
92    %param_0 = OpVariable %_ptr_Function_v3float Function
93        %125 = OpLoad %v3float %fragWorld_1
94               OpStore %fragWorld_0 %125
95        %129 = OpLoad %v3float %fragWorld_0
96               OpStore %param_0 %129
97        %130 = OpFunctionCall %int %_main_vf3_ %param_0
98               OpStore %_entryPointOutput %130
99               OpReturn
100               OpFunctionEnd
101%GetClip2TexMatrix_ = OpFunction %mat4v4float None %9
102         %11 = OpLabel
103         %30 = OpAccessChain %_ptr_Uniform_int %_ %int_2
104         %31 = OpLoad %int %30
105         %34 = OpIEqual %bool %31 %int_0
106               OpSelectionMerge %36 None
107               OpBranchConditional %34 %35 %36
108         %35 = OpLabel
109               OpReturnValue %44
110         %36 = OpLabel
111               OpReturnValue %49
112               OpFunctionEnd
113%GetCascade_vf3_ = OpFunction %int None %15
114%fragWorldPosition = OpFunctionParameter %_ptr_Function_v3float
115         %18 = OpLabel
116%cascadeIndex = OpVariable %_ptr_Function_uint Function
117%worldToShadowMap = OpVariable %_ptr_Function_mat4v4float Function
118%fragShadowMapPos = OpVariable %_ptr_Function_v4float Function
119               OpStore %cascadeIndex %uint_0
120               OpBranch %55
121         %55 = OpLabel
122               OpLoopMerge %57 %58 Unroll
123               OpBranch %59
124         %59 = OpLabel
125         %60 = OpLoad %uint %cascadeIndex
126         %63 = OpAccessChain %_ptr_Uniform_uint %_ %int_1
127         %64 = OpLoad %uint %63
128         %65 = OpULessThan %bool %60 %64
129               OpBranchConditional %65 %56 %57
130         %56 = OpLabel
131         %68 = OpFunctionCall %mat4v4float %GetClip2TexMatrix_
132         %69 = OpLoad %uint %cascadeIndex
133         %71 = OpAccessChain %_ptr_Uniform_mat4v4float %_ %int_0 %69
134         %72 = OpLoad %mat4v4float %71
135         %73 = OpMatrixTimesMatrix %mat4v4float %68 %72
136               OpStore %worldToShadowMap %73
137         %76 = OpLoad %mat4v4float %worldToShadowMap
138         %77 = OpLoad %v3float %fragWorldPosition
139         %78 = OpCompositeExtract %float %77 0
140         %79 = OpCompositeExtract %float %77 1
141         %80 = OpCompositeExtract %float %77 2
142         %81 = OpCompositeConstruct %v4float %78 %79 %80 %float_1
143         %82 = OpMatrixTimesVector %v4float %76 %81
144               OpStore %fragShadowMapPos %82
145         %85 = OpAccessChain %_ptr_Function_float %fragShadowMapPos %uint_2
146         %86 = OpLoad %float %85
147         %87 = OpFOrdGreaterThanEqual %bool %86 %float_0
148         %88 = OpAccessChain %_ptr_Function_float %fragShadowMapPos %uint_2
149         %89 = OpLoad %float %88
150         %90 = OpFOrdLessThanEqual %bool %89 %float_1
151         %91 = OpLogicalAnd %bool %87 %90
152         %92 = OpAccessChain %_ptr_Function_float %fragShadowMapPos %uint_0
153         %93 = OpLoad %float %92
154         %95 = OpAccessChain %_ptr_Function_float %fragShadowMapPos %uint_1
155         %96 = OpLoad %float %95
156         %97 = OpExtInst %float %1 FMax %93 %96
157         %98 = OpFOrdLessThanEqual %bool %97 %float_1
158         %99 = OpLogicalAnd %bool %91 %98
159        %100 = OpAccessChain %_ptr_Function_float %fragShadowMapPos %uint_0
160        %101 = OpLoad %float %100
161        %102 = OpAccessChain %_ptr_Function_float %fragShadowMapPos %uint_1
162        %103 = OpLoad %float %102
163        %104 = OpExtInst %float %1 FMin %101 %103
164        %105 = OpFOrdGreaterThanEqual %bool %104 %float_0
165        %106 = OpLogicalAnd %bool %99 %105
166               OpSelectionMerge %108 None
167               OpBranchConditional %106 %107 %108
168        %107 = OpLabel
169        %109 = OpLoad %uint %cascadeIndex
170        %110 = OpBitcast %int %109
171               OpReturnValue %110
172        %108 = OpLabel
173               OpBranch %58
174         %58 = OpLabel
175        %112 = OpLoad %uint %cascadeIndex
176        %113 = OpIAdd %uint %112 %int_1
177               OpStore %cascadeIndex %113
178               OpBranch %55
179         %57 = OpLabel
180               OpReturnValue %int_n1
181               OpFunctionEnd
182 %_main_vf3_ = OpFunction %int None %15
183  %fragWorld = OpFunctionParameter %_ptr_Function_v3float
184         %21 = OpLabel
185      %param = OpVariable %_ptr_Function_v3float Function
186        %118 = OpLoad %v3float %fragWorld
187               OpStore %param %118
188        %119 = OpFunctionCall %int %GetCascade_vf3_ %param
189               OpReturnValue %119
190               OpFunctionEnd
191