forked from microsoft/DirectXShaderCompiler
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvk.sampledtexture3d.load.hlsl
More file actions
46 lines (37 loc) · 2.39 KB
/
vk.sampledtexture3d.load.hlsl
File metadata and controls
46 lines (37 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s
// CHECK: [[v3ic:%[0-9]+]] = OpConstantComposite %v3int %int_1 %int_2 %int_3
// CHECK: [[type_3d_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float 3D 0 0 0 1 Unknown
// CHECK: [[type_3d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_3d_image]]
vk::SampledTexture3D<float4> tex3d;
float4 main(int4 location4: A) : SV_Target {
uint status;
// CHECK: [[loc:%[0-9]+]] = OpLoad %v4int %location4
// CHECK-NEXT: [[coord_0:%[0-9]+]] = OpVectorShuffle %v3int [[loc]] [[loc]] 0 1 2
// CHECK-NEXT: [[lod_0:%[0-9]+]] = OpCompositeExtract %int [[loc]] 3
// CHECK-NEXT: [[tex:%[0-9]+]] = OpLoad [[type_3d_sampled_image]] %tex3d
// CHECK-NEXT: [[tex_img:%[0-9]+]] = OpImage [[type_3d_image]] [[tex]]
// CHECK-NEXT: {{%[0-9]+}} = OpImageFetch %v4float [[tex_img]] [[coord_0]] Lod [[lod_0]]
float4 val1 = tex3d.Load(location4);
// CHECK: [[loc:%[0-9]+]] = OpLoad %v4int %location4
// CHECK-NEXT: [[coord_0:%[0-9]+]] = OpVectorShuffle %v3int [[loc]] [[loc]] 0 1 2
// CHECK-NEXT: [[lod_0:%[0-9]+]] = OpCompositeExtract %int [[loc]] 3
// CHECK-NEXT: [[tex:%[0-9]+]] = OpLoad [[type_3d_sampled_image]] %tex3d
// CHECK-NEXT: [[tex_img:%[0-9]+]] = OpImage [[type_3d_image]] [[tex]]
// CHECK-NEXT: {{%[0-9]+}} = OpImageFetch %v4float [[tex_img]] [[coord_0]] Lod|ConstOffset [[lod_0]] [[v3ic]]
float4 val2 = tex3d.Load(location4, int3(1, 2, 3));
/////////////////////////////////
/// Using the Status argument ///
/////////////////////////////////
// CHECK: [[loc:%[0-9]+]] = OpLoad %v4int %location4
// CHECK-NEXT: [[coord_0:%[0-9]+]] = OpVectorShuffle %v3int [[loc]] [[loc]] 0 1 2
// CHECK-NEXT: [[lod_0:%[0-9]+]] = OpCompositeExtract %int [[loc]] 3
// CHECK-NEXT: [[tex:%[0-9]+]] = OpLoad [[type_3d_sampled_image]] %tex3d
// CHECK-NEXT: [[tex_img:%[0-9]+]] = OpImage [[type_3d_image]] [[tex]]
// CHECK-NEXT:[[structResult:%[0-9]+]] = OpImageSparseFetch %SparseResidencyStruct [[tex_img]] [[coord_0]] Lod|ConstOffset [[lod_0]] [[v3ic]]
// CHECK-NEXT: [[status:%[0-9]+]] = OpCompositeExtract %uint [[structResult]] 0
// CHECK-NEXT: OpStore %status [[status]]
// CHECK-NEXT: [[v4result:%[0-9]+]] = OpCompositeExtract %v4float [[structResult]] 1
// CHECK-NEXT: OpStore %val3 [[v4result]]
float4 val3 = tex3d.Load(location4, int3(1, 2, 3), status);
return 1.0;
}