|
| 1 | +// RUN: %dxc -T ps_6_7 -E main -fcgl %s -spirv | FileCheck %s |
| 2 | + |
| 3 | +// CHECK: OpCapability SparseResidency |
| 4 | + |
| 5 | +// CHECK: [[v2fc:%[0-9]+]] = OpConstantComposite %v2float %float_0_5 %float_0_25 |
| 6 | +// CHECK: [[v2ic:%[0-9]+]] = OpConstantComposite %v2int %int_2 %int_3 |
| 7 | + |
| 8 | +// CHECK: [[type_2d_image_1:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown |
| 9 | +// CHECK: [[type_sampled_image_1:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_1]] |
| 10 | +// CHECK: [[ptr_type_1:%[a-zA-Z0-9_]+]] = OpTypePointer UniformConstant [[type_sampled_image_1]] |
| 11 | + |
| 12 | +// CHECK: [[type_2d_image_2:%[a-zA-Z0-9_]+]] = OpTypeImage %uint 2D 0 0 0 1 Unknown |
| 13 | +// CHECK: [[type_sampled_image_2:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_2]] |
| 14 | +// CHECK: [[ptr_type_2:%[a-zA-Z0-9_]+]] = OpTypePointer UniformConstant [[type_sampled_image_2]] |
| 15 | + |
| 16 | +// CHECK: %SparseResidencyStruct = OpTypeStruct %uint %v4float |
| 17 | + |
| 18 | +// CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpVariable [[ptr_type_1]] UniformConstant |
| 19 | +// CHECK: [[tex2:%[a-zA-Z0-9_]+]] = OpVariable [[ptr_type_2]] UniformConstant |
| 20 | + |
| 21 | +vk::SampledTexture2D<float4> tex1 : register(t1); |
| 22 | +vk::SampledTexture2D<uint> tex2 : register(t2); |
| 23 | + |
| 24 | +float4 main() : SV_Target { |
| 25 | + |
| 26 | +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] |
| 27 | +// CHECK: [[val1:%[a-zA-Z0-9_]+]] = OpImageGather %v4float [[tex1_load]] [[v2fc]] %int_0 None |
| 28 | + float4 val1 = tex1.Gather(float2(0.5, 0.25)); |
| 29 | + |
| 30 | +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_2]] [[tex2]] |
| 31 | +// CHECK: [[val2:%[a-zA-Z0-9_]+]] = OpImageGather %v4uint [[tex2_load]] [[v2fc]] %int_0 ConstOffset [[v2ic]] |
| 32 | + uint4 val2 = tex2.Gather(float2(0.5, 0.25), int2(2, 3)); |
| 33 | + |
| 34 | +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] |
| 35 | +// CHECK: [[val3:%[a-zA-Z0-9_]+]] = OpImageSparseGather %SparseResidencyStruct [[tex3_load]] [[v2fc]] %int_0 ConstOffset [[v2ic]] |
| 36 | +// CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[val3]] 0 |
| 37 | +// CHECK: OpStore %status [[status_0]] |
| 38 | + uint status; |
| 39 | + float4 val3 = tex1.Gather(float2(0.5, 0.25), int2(2, 3), status); |
| 40 | + |
| 41 | + return 1.0; |
| 42 | +} |
0 commit comments