33// Check the names
44//
55// CHECK: OpName %secondGlobal_t "secondGlobal.t"
6- // CHECK: OpName %firstGlobal_0__0__t "firstGlobal[0][0] .t"
7- // CHECK: OpName %firstGlobal_0__1__t "firstGlobal[0][1] .t"
8- // CHECK: OpName %firstGlobal_1__0__t "firstGlobal[1][0] .t"
9- // CHECK: OpName %firstGlobal_1__1__t "firstGlobal[1][1] .t"
6+ // CHECK: OpName %[[fg0:firstGlobal_[0-9]+__t]] "firstGlobal{{.*}} .t"
7+ // CHECK: OpName %[[fg1:firstGlobal_[0-9]+__t]] "firstGlobal{{.*}} .t"
8+ // CHECK: OpName %[[fg2:firstGlobal_[0-9]+__t]] "firstGlobal{{.*}} .t"
9+ // CHECK: OpName %[[fg3:firstGlobal_[0-9]+__t]] "firstGlobal{{.*}} .t"
1010// CHECK: OpName %secondGlobal_tt_0__s "secondGlobal.tt[0].s"
1111// CHECK: OpName %secondGlobal_tt_1__s "secondGlobal.tt[1].s"
12- // CHECK: OpName %firstGlobal_0__0__tt_0__s "firstGlobal[0][0] .tt[0].s"
13- // CHECK: OpName %firstGlobal_0__0__tt_1__s "firstGlobal[0][0] .tt[1].s"
14- // CHECK: OpName %firstGlobal_0__1__tt_0__s "firstGlobal[0][1] .tt[0].s"
15- // CHECK: OpName %firstGlobal_0__1__tt_1__s "firstGlobal[0][1] .tt[1].s"
16- // CHECK: OpName %firstGlobal_1__0__tt_0__s "firstGlobal[1][0] .tt[0].s"
17- // CHECK: OpName %firstGlobal_1__0__tt_1__s "firstGlobal[1][0] .tt[1].s"
18- // CHECK: OpName %firstGlobal_1__1__tt_0__s "firstGlobal[1][1] .tt[0].s"
19- // CHECK: OpName %firstGlobal_1__1__tt_1__s "firstGlobal[1][1] .tt[1].s"
12+ // CHECK: OpName %[[fgtt0_0:firstGlobal_[0-9]+__tt_0__s]] "firstGlobal{{.*}} .tt[0].s"
13+ // CHECK: OpName %[[fgtt0_1:firstGlobal_[0-9]+__tt_1__s]] "firstGlobal{{.*}} .tt[1].s"
14+ // CHECK: OpName %[[fgtt1_0:firstGlobal_[0-9]+__tt_0__s]] "firstGlobal{{.*}} .tt[0].s"
15+ // CHECK: OpName %[[fgtt1_1:firstGlobal_[0-9]+__tt_1__s]] "firstGlobal{{.*}} .tt[1].s"
16+ // CHECK: OpName %[[fgtt2_0:firstGlobal_[0-9]+__tt_0__s]] "firstGlobal{{.*}} .tt[0].s"
17+ // CHECK: OpName %[[fgtt2_1:firstGlobal_[0-9]+__tt_1__s]] "firstGlobal{{.*}} .tt[1].s"
18+ // CHECK: OpName %[[fgtt3_0:firstGlobal_[0-9]+__tt_0__s]] "firstGlobal{{.*}} .tt[0].s"
19+ // CHECK: OpName %[[fgtt3_1:firstGlobal_[0-9]+__tt_1__s]] "firstGlobal{{.*}} .tt[1].s"
2020
2121// Check flattening of bindings
2222// Explanation: Only the resources that are used will have a binding assignment
7070//
7171// CHECK: OpDecorate %secondGlobal_t DescriptorSet 0
7272// CHECK: OpDecorate %secondGlobal_t Binding 32
73- // CHECK: OpDecorate %firstGlobal_0__0__t DescriptorSet 0
74- // CHECK: OpDecorate %firstGlobal_0__0__t Binding 0
75- // CHECK: OpDecorate %firstGlobal_0__1__t DescriptorSet 0
76- // CHECK: OpDecorate %firstGlobal_0__1__t Binding 8
77- // CHECK: OpDecorate %firstGlobal_1__0__t DescriptorSet 0
78- // CHECK: OpDecorate %firstGlobal_1__0__t Binding 16
79- // CHECK: OpDecorate %firstGlobal_1__1__t DescriptorSet 0
80- // CHECK: OpDecorate %firstGlobal_1__1__t Binding 24
73+ // CHECK: OpDecorate %[[fg0]] DescriptorSet 0
74+ // CHECK: OpDecorate %[[fg0]] Binding 0
75+ // CHECK: OpDecorate %[[fg1]] DescriptorSet 0
76+ // CHECK: OpDecorate %[[fg1]] Binding 8
77+ // CHECK: OpDecorate %[[fg2]] DescriptorSet 0
78+ // CHECK: OpDecorate %[[fg2]] Binding 16
79+ // CHECK: OpDecorate %[[fg3]] DescriptorSet 0
80+ // CHECK: OpDecorate %[[fg3]] Binding 24
8181// CHECK: OpDecorate %secondGlobal_tt_0__s DescriptorSet 0
8282// CHECK: OpDecorate %secondGlobal_tt_0__s Binding 34
8383// CHECK: OpDecorate %secondGlobal_tt_1__s DescriptorSet 0
8484// CHECK: OpDecorate %secondGlobal_tt_1__s Binding 37
85- // CHECK: OpDecorate %firstGlobal_0__0__tt_0__s DescriptorSet 0
86- // CHECK: OpDecorate %firstGlobal_0__0__tt_0__s Binding 2
87- // CHECK: OpDecorate %firstGlobal_0__0__tt_1__s DescriptorSet 0
88- // CHECK: OpDecorate %firstGlobal_0__0__tt_1__s Binding 5
89- // CHECK: OpDecorate %firstGlobal_0__1__tt_0__s DescriptorSet 0
90- // CHECK: OpDecorate %firstGlobal_0__1__tt_0__s Binding 10
91- // CHECK: OpDecorate %firstGlobal_0__1__tt_1__s DescriptorSet 0
92- // CHECK: OpDecorate %firstGlobal_0__1__tt_1__s Binding 13
93- // CHECK: OpDecorate %firstGlobal_1__0__tt_0__s DescriptorSet 0
94- // CHECK: OpDecorate %firstGlobal_1__0__tt_0__s Binding 18
95- // CHECK: OpDecorate %firstGlobal_1__0__tt_1__s DescriptorSet 0
96- // CHECK: OpDecorate %firstGlobal_1__0__tt_1__s Binding 21
97- // CHECK: OpDecorate %firstGlobal_1__1__tt_0__s DescriptorSet 0
98- // CHECK: OpDecorate %firstGlobal_1__1__tt_0__s Binding 26
99- // CHECK: OpDecorate %firstGlobal_1__1__tt_1__s DescriptorSet 0
100- // CHECK: OpDecorate %firstGlobal_1__1__tt_1__s Binding 29
85+ // CHECK: OpDecorate %[[fgtt0_0]] DescriptorSet 0
86+ // CHECK: OpDecorate %[[fgtt0_0]] Binding 2
87+ // CHECK: OpDecorate %[[fgtt0_1]] DescriptorSet 0
88+ // CHECK: OpDecorate %[[fgtt0_1]] Binding 5
89+ // CHECK: OpDecorate %[[fgtt1_0]] DescriptorSet 0
90+ // CHECK: OpDecorate %[[fgtt1_0]] Binding 10
91+ // CHECK: OpDecorate %[[fgtt1_1]] DescriptorSet 0
92+ // CHECK: OpDecorate %[[fgtt1_1]] Binding 13
93+ // CHECK: OpDecorate %[[fgtt2_0]] DescriptorSet 0
94+ // CHECK: OpDecorate %[[fgtt2_0]] Binding 18
95+ // CHECK: OpDecorate %[[fgtt2_1]] DescriptorSet 0
96+ // CHECK: OpDecorate %[[fgtt2_1]] Binding 21
97+ // CHECK: OpDecorate %[[fgtt3_0]] DescriptorSet 0
98+ // CHECK: OpDecorate %[[fgtt3_0]] Binding 26
99+ // CHECK: OpDecorate %[[fgtt3_1]] DescriptorSet 0
100+ // CHECK: OpDecorate %[[fgtt3_1]] Binding 29
101101
102102// Check existence of replacement variables
103103//
104104// CHECK: %secondGlobal_t = OpVariable %_ptr_UniformConstant__arr_type_2d_image_uint_2 UniformConstant
105- // CHECK: %firstGlobal_0__0__t = OpVariable %_ptr_UniformConstant__arr_type_2d_image_uint_2 UniformConstant
106- // CHECK: %firstGlobal_0__1__t = OpVariable %_ptr_UniformConstant__arr_type_2d_image_uint_2 UniformConstant
107- // CHECK: %firstGlobal_1__0__t = OpVariable %_ptr_UniformConstant__arr_type_2d_image_uint_2 UniformConstant
108- // CHECK: %firstGlobal_1__1__t = OpVariable %_ptr_UniformConstant__arr_type_2d_image_uint_2 UniformConstant
105+ // CHECK: %[[fg0]] = OpVariable %_ptr_UniformConstant__arr_type_2d_image_uint_2 UniformConstant
106+ // CHECK: %[[fg1]] = OpVariable %_ptr_UniformConstant__arr_type_2d_image_uint_2 UniformConstant
107+ // CHECK: %[[fg2]] = OpVariable %_ptr_UniformConstant__arr_type_2d_image_uint_2 UniformConstant
108+ // CHECK: %[[fg3]] = OpVariable %_ptr_UniformConstant__arr_type_2d_image_uint_2 UniformConstant
109109// CHECK: %secondGlobal_tt_0__s = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant
110110// CHECK: %secondGlobal_tt_1__s = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant
111- // CHECK: %firstGlobal_0__0__tt_0__s = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant
112- // CHECK: %firstGlobal_0__0__tt_1__s = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant
113- // CHECK: %firstGlobal_0__1__tt_0__s = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant
114- // CHECK: %firstGlobal_0__1__tt_1__s = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant
115- // CHECK: %firstGlobal_1__0__tt_0__s = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant
116- // CHECK: %firstGlobal_1__0__tt_1__s = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant
117- // CHECK: %firstGlobal_1__1__tt_0__s = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant
118- // CHECK: %firstGlobal_1__1__tt_1__s = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant
111+ // CHECK: %[[fgtt0_0]] = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant
112+ // CHECK: %[[fgtt0_1]] = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant
113+ // CHECK: %[[fgtt1_0]] = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant
114+ // CHECK: %[[fgtt1_1]] = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant
115+ // CHECK: %[[fgtt2_0]] = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant
116+ // CHECK: %[[fgtt2_1]] = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant
117+ // CHECK: %[[fgtt3_0]] = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant
118+ // CHECK: %[[fgtt3_1]] = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant
119119
120120struct T {
121121 SamplerState s[3 ];
@@ -135,12 +135,12 @@ S secondGlobal;
135135
136136float4 main () : SV_Target {
137137 return
138- // CHECK: [[fg_0_0_t:%[0-9]+]] = OpLoad %_arr_type_2d_image_uint_2 %firstGlobal_0__0__t
138+ // CHECK: [[fg_0_0_t:%[0-9]+]] = OpLoad %_arr_type_2d_image_uint_2 %[[fg0]]
139139// CHECK: [[fg_1_t_0:%[0-9]+]] = OpCompositeExtract %type_2d_image [[fg_0_0_t]] 0
140140// CHECK: [[fg_1_t_1:%[0-9]+]] = OpCompositeExtract %type_2d_image [[fg_0_0_t]] 1
141- // CHECK: [[tmp:%[0-9]+]] = OpAccessChain %_ptr_UniformConstant_type_sampler %firstGlobal_0__0__tt_0__s %uint_1
141+ // CHECK: [[tmp:%[0-9]+]] = OpAccessChain %_ptr_UniformConstant_type_sampler %[[fgtt0_0]] %uint_1
142142// CHECK: [[fg_1_tt_0_s_1:%[0-9]+]] = OpLoad %type_sampler [[tmp]]
143- // CHECK: [[tmp:%[0-9]+]] = OpAccessChain %_ptr_UniformConstant_type_sampler %firstGlobal_0__0__tt_1__s %uint_2
143+ // CHECK: [[tmp:%[0-9]+]] = OpAccessChain %_ptr_UniformConstant_type_sampler %[[fgtt0_1]] %uint_2
144144// CHECK: [[fg_1_tt_1_s_2:%[0-9]+]] = OpLoad %type_sampler [[tmp]]
145145// CHECK: [[sampled_img_1:%[0-9]+]] = OpSampledImage %type_sampled_image [[fg_1_t_0]] [[fg_1_tt_0_s_1]]
146146// CHECK: {{%[0-9]+}} = OpImageSampleImplicitLod %v4float [[sampled_img_1]]
@@ -149,38 +149,38 @@ float4 main() : SV_Target {
149149// CHECK: OpFAdd
150150 tex2D (firstGlobal[0 ][0 ], float2 (0 ,0 )) +
151151
152- // CHECK: [[fg_0_1_t:%[0-9]+]] = OpLoad %_arr_type_2d_image_uint_2 %firstGlobal_0__1__t
152+ // CHECK: [[fg_0_1_t:%[0-9]+]] = OpLoad %_arr_type_2d_image_uint_2 %[[fg1]]
153153// CHECK: [[fg_0_1_t_0:%[0-9]+]] = OpCompositeExtract %type_2d_image [[fg_0_1_t]] 0
154154// CHECK: [[fg_0_1_t_1:%[0-9]+]] = OpCompositeExtract %type_2d_image [[fg_0_1_t]] 1
155- // CHECK: [[tmp:%[0-9]+]] = OpAccessChain %_ptr_UniformConstant_type_sampler %firstGlobal_0__1__tt_0__s %uint_1
155+ // CHECK: [[tmp:%[0-9]+]] = OpAccessChain %_ptr_UniformConstant_type_sampler %[[fgtt1_0]] %uint_1
156156// CHECK: [[fg_0_1_tt_0_s_1:%[0-9]+]] = OpLoad %type_sampler [[tmp]]
157- // CHECK: [[tmp:%[0-9]+]] = OpAccessChain %_ptr_UniformConstant_type_sampler %firstGlobal_0__1__tt_1__s %uint_2
157+ // CHECK: [[tmp:%[0-9]+]] = OpAccessChain %_ptr_UniformConstant_type_sampler %[[fgtt1_1]] %uint_2
158158// CHECK: [[fg_0_1_tt_1_s_2:%[0-9]+]] = OpLoad %type_sampler [[tmp]]
159159// CHECK: [[sampled_img_3:%[0-9]+]] = OpSampledImage %type_sampled_image [[fg_0_1_t_0]] [[fg_0_1_tt_0_s_1]]
160160// CHECK: {{%[0-9]+}} = OpImageSampleImplicitLod %v4float [[sampled_img_3]]
161161// CHECK: [[sampled_img_4:%[0-9]+]] = OpSampledImage %type_sampled_image [[fg_0_1_t_1]] [[fg_0_1_tt_1_s_2]]
162162// CHECK: {{%[0-9]+}} = OpImageSampleImplicitLod %v4float [[sampled_img_4]]
163163// CHECK: OpFAdd
164164 tex2D (firstGlobal[0 ][1 ], float2 (0 ,0 )) +
165- // CHECK: [[fg_1_0_t:%[0-9]+]] = OpLoad %_arr_type_2d_image_uint_2 %firstGlobal_1__0__t
165+ // CHECK: [[fg_1_0_t:%[0-9]+]] = OpLoad %_arr_type_2d_image_uint_2 %[[fg2]]
166166// CHECK: [[fg_1_0_t_0:%[0-9]+]] = OpCompositeExtract %type_2d_image [[fg_1_0_t]] 0
167167// CHECK: [[fg_1_0_t_1:%[0-9]+]] = OpCompositeExtract %type_2d_image [[fg_1_0_t]] 1
168- // CHECK: [[tmp:%[0-9]+]] = OpAccessChain %_ptr_UniformConstant_type_sampler %firstGlobal_1__0__tt_0__s %uint_1
168+ // CHECK: [[tmp:%[0-9]+]] = OpAccessChain %_ptr_UniformConstant_type_sampler %[[fgtt2_0]] %uint_1
169169// CHECK: [[fg_1_0_tt_0_s_1:%[0-9]+]] = OpLoad %type_sampler [[tmp]]
170- // CHECK: [[tmp:%[0-9]+]] = OpAccessChain %_ptr_UniformConstant_type_sampler %firstGlobal_1__0__tt_1__s %uint_2
170+ // CHECK: [[tmp:%[0-9]+]] = OpAccessChain %_ptr_UniformConstant_type_sampler %[[fgtt2_1]] %uint_2
171171// CHECK: [[fg_1_0_tt_1_s_2:%[0-9]+]] = OpLoad %type_sampler [[tmp]]
172172// CHECK: [[sampled_img_5:%[0-9]+]] = OpSampledImage %type_sampled_image [[fg_1_0_t_0]] [[fg_1_0_tt_0_s_1]]
173173// CHECK: {{%[0-9]+}} = OpImageSampleImplicitLod %v4float [[sampled_img_5]]
174174// CHECK: [[sampled_img_6:%[0-9]+]] = OpSampledImage %type_sampled_image [[fg_1_0_t_1]] [[fg_1_0_tt_1_s_2]]
175175// CHECK: {{%[0-9]+}} = OpImageSampleImplicitLod %v4float [[sampled_img_6]]
176176// CHECK: OpFAdd
177177 tex2D (firstGlobal[1 ][0 ], float2 (0 ,0 )) +
178- // CHECK: [[fg_1_1_t:%[0-9]+]] = OpLoad %_arr_type_2d_image_uint_2 %firstGlobal_1__1__t
178+ // CHECK: [[fg_1_1_t:%[0-9]+]] = OpLoad %_arr_type_2d_image_uint_2 %[[fg3]]
179179// CHECK: [[fg_1_1_t_0:%[0-9]+]] = OpCompositeExtract %type_2d_image [[fg_1_1_t]] 0
180180// CHECK: [[fg_1_1_t_1:%[0-9]+]] = OpCompositeExtract %type_2d_image [[fg_1_1_t]] 1
181- // CHECK: [[tmp:%[0-9]+]] = OpAccessChain %_ptr_UniformConstant_type_sampler %firstGlobal_1__1__tt_0__s %uint_1
181+ // CHECK: [[tmp:%[0-9]+]] = OpAccessChain %_ptr_UniformConstant_type_sampler %[[fgtt3_0]] %uint_1
182182// CHECK: [[fg_1_1_tt_0_s_1:%[0-9]+]] = OpLoad %type_sampler [[tmp]]
183- // CHECK: [[tmp:%[0-9]+]] = OpAccessChain %_ptr_UniformConstant_type_sampler %firstGlobal_1__1__tt_1__s %uint_2
183+ // CHECK: [[tmp:%[0-9]+]] = OpAccessChain %_ptr_UniformConstant_type_sampler %[[fgtt3_1]] %uint_2
184184// CHECK: [[fg_1_1_tt_1_s_2:%[0-9]+]] = OpLoad %type_sampler [[tmp]]
185185// CHECK: [[sampled_img_7:%[0-9]+]] = OpSampledImage %type_sampled_image [[fg_1_1_t_0]] [[fg_1_1_tt_0_s_1]]
186186// CHECK: {{%[0-9]+}} = OpImageSampleImplicitLod %v4float [[sampled_img_7]]
@@ -204,4 +204,3 @@ float4 main() : SV_Target {
204204// CHECK: {{%[0-9]+}} = OpImageSampleImplicitLod %v4float [[sampled_img_10]]
205205 secondGlobal.t[1 ].Sample (secondGlobal.tt[1 ].s[2 ], float2 (0 ,0 ));
206206}
207-
0 commit comments