Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion external/SPIRV-Headers
2 changes: 1 addition & 1 deletion external/SPIRV-Tools
Submodule SPIRV-Tools updated 51 files
+1 −1 .github/workflows/autoroll.yml
+4 −4 .github/workflows/bazel.yml
+2 −2 .github/workflows/ios.yml
+1 −1 .github/workflows/release.yml
+2 −2 .github/workflows/scorecard.yml
+1 −1 .github/workflows/wasm.yml
+4 −0 Android.mk
+1 −0 BUILD.bazel
+5 −0 BUILD.gn
+4 −1 CHANGES
+3 −3 DEPS
+5 −0 include/spirv-tools/optimizer.hpp
+3 −0 source/CMakeLists.txt
+2 −0 source/opt/CMakeLists.txt
+233 −27 source/opt/folding_rules.cpp
+275 −0 source/opt/legalize_multidim_array_pass.cpp
+55 −0 source/opt/legalize_multidim_array_pass.h
+9 −0 source/opt/optimizer.cpp
+1 −0 source/opt/passes.h
+3 −2 source/val/validate.cpp
+9 −0 source/val/validate.h
+9 −0 source/val/validate_annotation.cpp
+72 −16 source/val/validate_builtins.cpp
+32 −0 source/val/validate_cfg.cpp
+17 −1 source/val/validate_decorations.cpp
+220 −0 source/val/validate_dot_product.cpp
+229 −0 source/val/validate_group.cpp
+1 −4 source/val/validate_image.cpp
+2 −0 source/val/validate_mode_setting.cpp
+353 −0 source/val/validate_pipe.cpp
+20 −0 source/val/validate_ray_query.cpp
+163 −158 source/val/validate_ray_tracing.cpp
+9 −2 source/val/validation_state.cpp
+1 −0 test/opt/CMakeLists.txt
+1,339 −3 test/opt/fold_test.cpp
+639 −0 test/opt/legalize_multidim_array_test.cpp
+3 −3 test/opt/pass_fixture.h
+2 −0 test/tools/opt/flags.py
+2 −0 test/val/CMakeLists.txt
+82 −0 test/val/val_builtins_test.cpp
+151 −1 test/val/val_cfg_test.cpp
+65 −0 test/val/val_decoration_test.cpp
+55 −0 test/val/val_extension_spv_ext_descriptor_heap.cpp
+332 −49 test/val/val_extension_spv_khr_integer_dot_product_test.cpp
+448 −0 test/val/val_group_test.cpp
+15 −1 test/val/val_image_test.cpp
+36 −0 test/val/val_modes_test.cpp
+493 −0 test/val/val_pipe_test.cpp
+113 −0 test/val/val_ray_query_test.cpp
+31 −0 test/val/val_ray_tracing_test.cpp
+5 −1 tools/opt/opt.cpp
15 changes: 15 additions & 0 deletions tools/clang/lib/SPIRV/DeclResultIdMapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1263,6 +1263,21 @@ SpirvVariable *DeclResultIdMapper::createExternVar(const VarDecl *var,
// another variable or function parameter
needsLegalization = true;
}

// If we have a multi-dimensional array of resources, we need to run
// legalization to flatten the array.
if (const auto *arrayType = astContext.getAsConstantArrayType(type)) {
if (astContext.getAsConstantArrayType(arrayType->getElementType())) {
QualType elemType = arrayType->getElementType();
while (const auto *innerArrayType =
astContext.getAsConstantArrayType(elemType)) {
elemType = innerArrayType->getElementType();
}
if (hlsl::IsHLSLResourceType(elemType))
needsLegalization = true;
}
}

if (vkImgFeatures.isCombinedImageSampler || vkImgFeatures.format) {
spvContext.registerVkImageFeaturesForSpvVariable(varInstr, vkImgFeatures);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@ void func(RWStructuredBuffer<uint> local) {

float4 main(PSInput input) : SV_TARGET
{
// CHECK: [[ac1:%[0-9]+]] = OpAccessChain %_ptr_Uniform_type_ACSBuffer_counter %counter_var_g_rwbuffer {{%[0-9]+}}
// CHECK: [[ac2:%[0-9]+]] = OpAccessChain %_ptr_Uniform_int [[ac1]] %uint_0
// CHECK: [[ac2:%[0-9]+]] = OpAccessChain %_ptr_Uniform_int %counter_var_g_rwbuffer {{%[0-9]+}} %uint_0
// CHECK: OpAtomicIAdd %int [[ac2]] %uint_1 %uint_0 %int_1
func(g_rwbuffer[input.idx]);

// CHECK: [[ac1_0:%[0-9]+]] = OpAccessChain %_ptr_Uniform_type_RWStructuredBuffer_uint %g_rwbuffer {{%[0-9]+}}
// CHECK: [[ac2_0:%[0-9]+]] = OpAccessChain %_ptr_Uniform_uint [[ac1_0]] %int_0 %uint_0
// CHECK: [[ac2_0:%[0-9]+]] = OpAccessChain %_ptr_Uniform_uint %g_rwbuffer {{%[0-9]+}} %int_0 %uint_0
// CHECK: OpLoad %uint [[ac2_0]]
return g_rwbuffer[input.idx][0];
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ float4 main(PSInput input) : SV_TARGET
{
RWStructuredBuffer<uint> l_rwbuffer[5] = g_rwbuffer;

// CHECK: [[ac1:%[0-9]+]] = OpAccessChain %_ptr_Uniform_type_ACSBuffer_counter %counter_var_g_rwbuffer %int_0
// CHECK: [[ac2:%[0-9]+]] = OpAccessChain %_ptr_Uniform_int [[ac1]] %uint_0
// CHECK: [[ac2:%[0-9]+]] = OpAccessChain %_ptr_Uniform_int %counter_var_g_rwbuffer %int_0 %uint_0
// CHECK: OpAtomicIAdd %int [[ac2]] %uint_1 %uint_0 %int_1
l_rwbuffer[0].IncrementCounter();

// CHECK: [[ac1_0:%[0-9]+]] = OpAccessChain %_ptr_Uniform_type_RWStructuredBuffer_uint %g_rwbuffer {{%[0-9]+}}
// CHECK: [[ac2_0:%[0-9]+]] = OpAccessChain %_ptr_Uniform_uint [[ac1_0]] %int_0 %uint_0
// CHECK: [[ac2_0:%[0-9]+]] = OpAccessChain %_ptr_Uniform_uint %g_rwbuffer {{%[0-9]+}} %int_0 %uint_0
// CHECK: OpLoad %uint [[ac2_0]]
return l_rwbuffer[input.idx][0];
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
// Check the names
//
// CHECK: OpName %secondGlobal_t "secondGlobal.t"
// CHECK: OpName %firstGlobal_0__0__t "firstGlobal[0][0].t"
// CHECK: OpName %firstGlobal_0__1__t "firstGlobal[0][1].t"
// CHECK: OpName %firstGlobal_1__0__t "firstGlobal[1][0].t"
// CHECK: OpName %firstGlobal_1__1__t "firstGlobal[1][1].t"
// CHECK: OpName %[[fg0:firstGlobal_[0-9]+__t]] "firstGlobal{{.*}}.t"
// CHECK: OpName %[[fg1:firstGlobal_[0-9]+__t]] "firstGlobal{{.*}}.t"
// CHECK: OpName %[[fg2:firstGlobal_[0-9]+__t]] "firstGlobal{{.*}}.t"
// CHECK: OpName %[[fg3:firstGlobal_[0-9]+__t]] "firstGlobal{{.*}}.t"
// CHECK: OpName %secondGlobal_tt_0__s "secondGlobal.tt[0].s"
// CHECK: OpName %secondGlobal_tt_1__s "secondGlobal.tt[1].s"
// CHECK: OpName %firstGlobal_0__0__tt_0__s "firstGlobal[0][0].tt[0].s"
// CHECK: OpName %firstGlobal_0__0__tt_1__s "firstGlobal[0][0].tt[1].s"
// CHECK: OpName %firstGlobal_0__1__tt_0__s "firstGlobal[0][1].tt[0].s"
// CHECK: OpName %firstGlobal_0__1__tt_1__s "firstGlobal[0][1].tt[1].s"
// CHECK: OpName %firstGlobal_1__0__tt_0__s "firstGlobal[1][0].tt[0].s"
// CHECK: OpName %firstGlobal_1__0__tt_1__s "firstGlobal[1][0].tt[1].s"
// CHECK: OpName %firstGlobal_1__1__tt_0__s "firstGlobal[1][1].tt[0].s"
// CHECK: OpName %firstGlobal_1__1__tt_1__s "firstGlobal[1][1].tt[1].s"
// CHECK: OpName %[[fgtt0_0:firstGlobal_[0-9]+__tt_0__s]] "firstGlobal{{.*}}.tt[0].s"
// CHECK: OpName %[[fgtt0_1:firstGlobal_[0-9]+__tt_1__s]] "firstGlobal{{.*}}.tt[1].s"
// CHECK: OpName %[[fgtt1_0:firstGlobal_[0-9]+__tt_0__s]] "firstGlobal{{.*}}.tt[0].s"
// CHECK: OpName %[[fgtt1_1:firstGlobal_[0-9]+__tt_1__s]] "firstGlobal{{.*}}.tt[1].s"
// CHECK: OpName %[[fgtt2_0:firstGlobal_[0-9]+__tt_0__s]] "firstGlobal{{.*}}.tt[0].s"
// CHECK: OpName %[[fgtt2_1:firstGlobal_[0-9]+__tt_1__s]] "firstGlobal{{.*}}.tt[1].s"
// CHECK: OpName %[[fgtt3_0:firstGlobal_[0-9]+__tt_0__s]] "firstGlobal{{.*}}.tt[0].s"
// CHECK: OpName %[[fgtt3_1:firstGlobal_[0-9]+__tt_1__s]] "firstGlobal{{.*}}.tt[1].s"

// Check flattening of bindings
// Explanation: Only the resources that are used will have a binding assignment
Expand Down Expand Up @@ -70,52 +70,52 @@
//
// CHECK: OpDecorate %secondGlobal_t DescriptorSet 0
// CHECK: OpDecorate %secondGlobal_t Binding 32
// CHECK: OpDecorate %firstGlobal_0__0__t DescriptorSet 0
// CHECK: OpDecorate %firstGlobal_0__0__t Binding 0
// CHECK: OpDecorate %firstGlobal_0__1__t DescriptorSet 0
// CHECK: OpDecorate %firstGlobal_0__1__t Binding 8
// CHECK: OpDecorate %firstGlobal_1__0__t DescriptorSet 0
// CHECK: OpDecorate %firstGlobal_1__0__t Binding 16
// CHECK: OpDecorate %firstGlobal_1__1__t DescriptorSet 0
// CHECK: OpDecorate %firstGlobal_1__1__t Binding 24
// CHECK: OpDecorate %[[fg0]] DescriptorSet 0
// CHECK: OpDecorate %[[fg0]] Binding 0
// CHECK: OpDecorate %[[fg1]] DescriptorSet 0
// CHECK: OpDecorate %[[fg1]] Binding 8
// CHECK: OpDecorate %[[fg2]] DescriptorSet 0
// CHECK: OpDecorate %[[fg2]] Binding 16
// CHECK: OpDecorate %[[fg3]] DescriptorSet 0
// CHECK: OpDecorate %[[fg3]] Binding 24
// CHECK: OpDecorate %secondGlobal_tt_0__s DescriptorSet 0
// CHECK: OpDecorate %secondGlobal_tt_0__s Binding 34
// CHECK: OpDecorate %secondGlobal_tt_1__s DescriptorSet 0
// CHECK: OpDecorate %secondGlobal_tt_1__s Binding 37
// CHECK: OpDecorate %firstGlobal_0__0__tt_0__s DescriptorSet 0
// CHECK: OpDecorate %firstGlobal_0__0__tt_0__s Binding 2
// CHECK: OpDecorate %firstGlobal_0__0__tt_1__s DescriptorSet 0
// CHECK: OpDecorate %firstGlobal_0__0__tt_1__s Binding 5
// CHECK: OpDecorate %firstGlobal_0__1__tt_0__s DescriptorSet 0
// CHECK: OpDecorate %firstGlobal_0__1__tt_0__s Binding 10
// CHECK: OpDecorate %firstGlobal_0__1__tt_1__s DescriptorSet 0
// CHECK: OpDecorate %firstGlobal_0__1__tt_1__s Binding 13
// CHECK: OpDecorate %firstGlobal_1__0__tt_0__s DescriptorSet 0
// CHECK: OpDecorate %firstGlobal_1__0__tt_0__s Binding 18
// CHECK: OpDecorate %firstGlobal_1__0__tt_1__s DescriptorSet 0
// CHECK: OpDecorate %firstGlobal_1__0__tt_1__s Binding 21
// CHECK: OpDecorate %firstGlobal_1__1__tt_0__s DescriptorSet 0
// CHECK: OpDecorate %firstGlobal_1__1__tt_0__s Binding 26
// CHECK: OpDecorate %firstGlobal_1__1__tt_1__s DescriptorSet 0
// CHECK: OpDecorate %firstGlobal_1__1__tt_1__s Binding 29
// CHECK: OpDecorate %[[fgtt0_0]] DescriptorSet 0
// CHECK: OpDecorate %[[fgtt0_0]] Binding 2
// CHECK: OpDecorate %[[fgtt0_1]] DescriptorSet 0
// CHECK: OpDecorate %[[fgtt0_1]] Binding 5
// CHECK: OpDecorate %[[fgtt1_0]] DescriptorSet 0
// CHECK: OpDecorate %[[fgtt1_0]] Binding 10
// CHECK: OpDecorate %[[fgtt1_1]] DescriptorSet 0
// CHECK: OpDecorate %[[fgtt1_1]] Binding 13
// CHECK: OpDecorate %[[fgtt2_0]] DescriptorSet 0
// CHECK: OpDecorate %[[fgtt2_0]] Binding 18
// CHECK: OpDecorate %[[fgtt2_1]] DescriptorSet 0
// CHECK: OpDecorate %[[fgtt2_1]] Binding 21
// CHECK: OpDecorate %[[fgtt3_0]] DescriptorSet 0
// CHECK: OpDecorate %[[fgtt3_0]] Binding 26
// CHECK: OpDecorate %[[fgtt3_1]] DescriptorSet 0
// CHECK: OpDecorate %[[fgtt3_1]] Binding 29

// Check existence of replacement variables
//
// CHECK: %secondGlobal_t = OpVariable %_ptr_UniformConstant__arr_type_2d_image_uint_2 UniformConstant
// CHECK: %firstGlobal_0__0__t = OpVariable %_ptr_UniformConstant__arr_type_2d_image_uint_2 UniformConstant
// CHECK: %firstGlobal_0__1__t = OpVariable %_ptr_UniformConstant__arr_type_2d_image_uint_2 UniformConstant
// CHECK: %firstGlobal_1__0__t = OpVariable %_ptr_UniformConstant__arr_type_2d_image_uint_2 UniformConstant
// CHECK: %firstGlobal_1__1__t = OpVariable %_ptr_UniformConstant__arr_type_2d_image_uint_2 UniformConstant
// CHECK: %[[fg0]] = OpVariable %_ptr_UniformConstant__arr_type_2d_image_uint_2 UniformConstant
// CHECK: %[[fg1]] = OpVariable %_ptr_UniformConstant__arr_type_2d_image_uint_2 UniformConstant
// CHECK: %[[fg2]] = OpVariable %_ptr_UniformConstant__arr_type_2d_image_uint_2 UniformConstant
// CHECK: %[[fg3]] = OpVariable %_ptr_UniformConstant__arr_type_2d_image_uint_2 UniformConstant
// CHECK: %secondGlobal_tt_0__s = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant
// CHECK: %secondGlobal_tt_1__s = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant
// CHECK: %firstGlobal_0__0__tt_0__s = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant
// CHECK: %firstGlobal_0__0__tt_1__s = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant
// CHECK: %firstGlobal_0__1__tt_0__s = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant
// CHECK: %firstGlobal_0__1__tt_1__s = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant
// CHECK: %firstGlobal_1__0__tt_0__s = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant
// CHECK: %firstGlobal_1__0__tt_1__s = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant
// CHECK: %firstGlobal_1__1__tt_0__s = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant
// CHECK: %firstGlobal_1__1__tt_1__s = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant
// CHECK: %[[fgtt0_0]] = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant
// CHECK: %[[fgtt0_1]] = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant
// CHECK: %[[fgtt1_0]] = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant
// CHECK: %[[fgtt1_1]] = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant
// CHECK: %[[fgtt2_0]] = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant
// CHECK: %[[fgtt2_1]] = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant
// CHECK: %[[fgtt3_0]] = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant
// CHECK: %[[fgtt3_1]] = OpVariable %_ptr_UniformConstant__arr_type_sampler_uint_3 UniformConstant

struct T {
SamplerState s[3];
Expand All @@ -135,12 +135,12 @@ S secondGlobal;

float4 main() : SV_Target {
return
// CHECK: [[fg_0_0_t:%[0-9]+]] = OpLoad %_arr_type_2d_image_uint_2 %firstGlobal_0__0__t
// CHECK: [[fg_0_0_t:%[0-9]+]] = OpLoad %_arr_type_2d_image_uint_2 %[[fg0]]
// CHECK: [[fg_1_t_0:%[0-9]+]] = OpCompositeExtract %type_2d_image [[fg_0_0_t]] 0
// CHECK: [[fg_1_t_1:%[0-9]+]] = OpCompositeExtract %type_2d_image [[fg_0_0_t]] 1
// CHECK: [[tmp:%[0-9]+]] = OpAccessChain %_ptr_UniformConstant_type_sampler %firstGlobal_0__0__tt_0__s %uint_1
// CHECK: [[tmp:%[0-9]+]] = OpAccessChain %_ptr_UniformConstant_type_sampler %[[fgtt0_0]] %uint_1
// CHECK: [[fg_1_tt_0_s_1:%[0-9]+]] = OpLoad %type_sampler [[tmp]]
// CHECK: [[tmp:%[0-9]+]] = OpAccessChain %_ptr_UniformConstant_type_sampler %firstGlobal_0__0__tt_1__s %uint_2
// CHECK: [[tmp:%[0-9]+]] = OpAccessChain %_ptr_UniformConstant_type_sampler %[[fgtt0_1]] %uint_2
// CHECK: [[fg_1_tt_1_s_2:%[0-9]+]] = OpLoad %type_sampler [[tmp]]
// CHECK: [[sampled_img_1:%[0-9]+]] = OpSampledImage %type_sampled_image [[fg_1_t_0]] [[fg_1_tt_0_s_1]]
// CHECK: {{%[0-9]+}} = OpImageSampleImplicitLod %v4float [[sampled_img_1]]
Expand All @@ -149,38 +149,38 @@ float4 main() : SV_Target {
// CHECK: OpFAdd
tex2D(firstGlobal[0][0], float2(0,0)) +

// CHECK: [[fg_0_1_t:%[0-9]+]] = OpLoad %_arr_type_2d_image_uint_2 %firstGlobal_0__1__t
// CHECK: [[fg_0_1_t:%[0-9]+]] = OpLoad %_arr_type_2d_image_uint_2 %[[fg1]]
// CHECK: [[fg_0_1_t_0:%[0-9]+]] = OpCompositeExtract %type_2d_image [[fg_0_1_t]] 0
// CHECK: [[fg_0_1_t_1:%[0-9]+]] = OpCompositeExtract %type_2d_image [[fg_0_1_t]] 1
// CHECK: [[tmp:%[0-9]+]] = OpAccessChain %_ptr_UniformConstant_type_sampler %firstGlobal_0__1__tt_0__s %uint_1
// CHECK: [[tmp:%[0-9]+]] = OpAccessChain %_ptr_UniformConstant_type_sampler %[[fgtt1_0]] %uint_1
// CHECK: [[fg_0_1_tt_0_s_1:%[0-9]+]] = OpLoad %type_sampler [[tmp]]
// CHECK: [[tmp:%[0-9]+]] = OpAccessChain %_ptr_UniformConstant_type_sampler %firstGlobal_0__1__tt_1__s %uint_2
// CHECK: [[tmp:%[0-9]+]] = OpAccessChain %_ptr_UniformConstant_type_sampler %[[fgtt1_1]] %uint_2
// CHECK: [[fg_0_1_tt_1_s_2:%[0-9]+]] = OpLoad %type_sampler [[tmp]]
// CHECK: [[sampled_img_3:%[0-9]+]] = OpSampledImage %type_sampled_image [[fg_0_1_t_0]] [[fg_0_1_tt_0_s_1]]
// CHECK: {{%[0-9]+}} = OpImageSampleImplicitLod %v4float [[sampled_img_3]]
// CHECK: [[sampled_img_4:%[0-9]+]] = OpSampledImage %type_sampled_image [[fg_0_1_t_1]] [[fg_0_1_tt_1_s_2]]
// CHECK: {{%[0-9]+}} = OpImageSampleImplicitLod %v4float [[sampled_img_4]]
// CHECK: OpFAdd
tex2D(firstGlobal[0][1], float2(0,0)) +
// CHECK: [[fg_1_0_t:%[0-9]+]] = OpLoad %_arr_type_2d_image_uint_2 %firstGlobal_1__0__t
// CHECK: [[fg_1_0_t:%[0-9]+]] = OpLoad %_arr_type_2d_image_uint_2 %[[fg2]]
// CHECK: [[fg_1_0_t_0:%[0-9]+]] = OpCompositeExtract %type_2d_image [[fg_1_0_t]] 0
// CHECK: [[fg_1_0_t_1:%[0-9]+]] = OpCompositeExtract %type_2d_image [[fg_1_0_t]] 1
// CHECK: [[tmp:%[0-9]+]] = OpAccessChain %_ptr_UniformConstant_type_sampler %firstGlobal_1__0__tt_0__s %uint_1
// CHECK: [[tmp:%[0-9]+]] = OpAccessChain %_ptr_UniformConstant_type_sampler %[[fgtt2_0]] %uint_1
// CHECK: [[fg_1_0_tt_0_s_1:%[0-9]+]] = OpLoad %type_sampler [[tmp]]
// CHECK: [[tmp:%[0-9]+]] = OpAccessChain %_ptr_UniformConstant_type_sampler %firstGlobal_1__0__tt_1__s %uint_2
// CHECK: [[tmp:%[0-9]+]] = OpAccessChain %_ptr_UniformConstant_type_sampler %[[fgtt2_1]] %uint_2
// CHECK: [[fg_1_0_tt_1_s_2:%[0-9]+]] = OpLoad %type_sampler [[tmp]]
// CHECK: [[sampled_img_5:%[0-9]+]] = OpSampledImage %type_sampled_image [[fg_1_0_t_0]] [[fg_1_0_tt_0_s_1]]
// CHECK: {{%[0-9]+}} = OpImageSampleImplicitLod %v4float [[sampled_img_5]]
// CHECK: [[sampled_img_6:%[0-9]+]] = OpSampledImage %type_sampled_image [[fg_1_0_t_1]] [[fg_1_0_tt_1_s_2]]
// CHECK: {{%[0-9]+}} = OpImageSampleImplicitLod %v4float [[sampled_img_6]]
// CHECK: OpFAdd
tex2D(firstGlobal[1][0], float2(0,0)) +
// CHECK: [[fg_1_1_t:%[0-9]+]] = OpLoad %_arr_type_2d_image_uint_2 %firstGlobal_1__1__t
// CHECK: [[fg_1_1_t:%[0-9]+]] = OpLoad %_arr_type_2d_image_uint_2 %[[fg3]]
// CHECK: [[fg_1_1_t_0:%[0-9]+]] = OpCompositeExtract %type_2d_image [[fg_1_1_t]] 0
// CHECK: [[fg_1_1_t_1:%[0-9]+]] = OpCompositeExtract %type_2d_image [[fg_1_1_t]] 1
// CHECK: [[tmp:%[0-9]+]] = OpAccessChain %_ptr_UniformConstant_type_sampler %firstGlobal_1__1__tt_0__s %uint_1
// CHECK: [[tmp:%[0-9]+]] = OpAccessChain %_ptr_UniformConstant_type_sampler %[[fgtt3_0]] %uint_1
// CHECK: [[fg_1_1_tt_0_s_1:%[0-9]+]] = OpLoad %type_sampler [[tmp]]
// CHECK: [[tmp:%[0-9]+]] = OpAccessChain %_ptr_UniformConstant_type_sampler %firstGlobal_1__1__tt_1__s %uint_2
// CHECK: [[tmp:%[0-9]+]] = OpAccessChain %_ptr_UniformConstant_type_sampler %[[fgtt3_1]] %uint_2
// CHECK: [[fg_1_1_tt_1_s_2:%[0-9]+]] = OpLoad %type_sampler [[tmp]]
// CHECK: [[sampled_img_7:%[0-9]+]] = OpSampledImage %type_sampled_image [[fg_1_1_t_0]] [[fg_1_1_tt_0_s_1]]
// CHECK: {{%[0-9]+}} = OpImageSampleImplicitLod %v4float [[sampled_img_7]]
Expand All @@ -204,4 +204,3 @@ float4 main() : SV_Target {
// CHECK: {{%[0-9]+}} = OpImageSampleImplicitLod %v4float [[sampled_img_10]]
secondGlobal.t[1].Sample(secondGlobal.tt[1].s[2], float2(0,0));
}

6 changes: 3 additions & 3 deletions tools/clang/unittests/SPIRV/CodeGenSpirvTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ float4 main(VertexOutput v) : SV_Position
}
)";
std::string spirv = compileCodeAndGetSpirvAsm(code);
EXPECT_THAT(spirv, ContainsRegex("%23 = OpString \"// RUN: %dxc -T vs_6_0 -E "
EXPECT_THAT(spirv, ContainsRegex("%24 = OpString \"// RUN: %dxc -T vs_6_0 -E "
"main -fspv-debug=vulkan-with-source"));
EXPECT_THAT(spirv, ContainsRegex("DebugSource %5 %23\n"));
EXPECT_THAT(spirv, ContainsRegex("DebugSource %28\n"));
EXPECT_THAT(spirv, ContainsRegex("DebugSource %5 %24\n"));
EXPECT_THAT(spirv, ContainsRegex("DebugSource %23 %24\n"));
}
} // namespace
Loading