Skip to content

Commit a06a5a6

Browse files
committed
SampledTexture3d
1 parent 26674de commit a06a5a6

14 files changed

Lines changed: 125 additions & 6 deletions

include/dxc/dxcapi.internal.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ enum LEGAL_INTRINSIC_COMPTYPES {
146146
LICOMPTYPE_VK_SAMPLED_TEXTURE2D_ARRAY = 60,
147147
LICOMPTYPE_VK_SAMPLED_TEXTURE2DMS = 61,
148148
LICOMPTYPE_VK_SAMPLED_TEXTURE2DMS_ARRAY = 62,
149-
LICOMPTYPE_COUNT = 63
149+
LICOMPTYPE_VK_SAMPLED_TEXTURE3D = 63,
150+
LICOMPTYPE_COUNT = 64
150151
#else
151152
LICOMPTYPE_COUNT = 56
152153
#endif

tools/clang/lib/SPIRV/AstTypeProbe.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,8 @@ bool isSampledTexture(QualType type) {
934934

935935
if (name == "SampledTexture1D" || name == "SampledTexture1DArray" ||
936936
name == "SampledTexture2D" || name == "SampledTexture2DArray" ||
937-
name == "SampledTexture2DMS" || name == "SampledTexture2DMSArray")
937+
name == "SampledTexture2DMS" || name == "SampledTexture2DMSArray" ||
938+
name == "SampledTexture3D")
938939
return true;
939940
}
940941
return false;

tools/clang/lib/SPIRV/LowerTypeVisitor.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,8 @@ const SpirvType *LowerTypeVisitor::lowerVkTypeInVkNamespace(
851851
}
852852
if (name == "SampledTexture1D" || name == "SampledTexture1DArray" ||
853853
name == "SampledTexture2D" || name == "SampledTexture2DArray" ||
854-
name == "SampledTexture2DMS" || name == "SampledTexture2DMSArray") {
854+
name == "SampledTexture2DMS" || name == "SampledTexture2DMSArray" ||
855+
name == "SampledTexture3D") {
855856
const auto sampledType = hlsl::GetHLSLResourceResultType(type);
856857
auto loweredType = lowerType(getElementType(astContext, sampledType), rule,
857858
/*isRowMajor*/ llvm::None, srcLoc);
@@ -863,7 +864,9 @@ const SpirvType *LowerTypeVisitor::lowerVkTypeInVkNamespace(
863864
}
864865

865866
const spv::Dim dimension =
866-
name.count("1D") > 0 ? spv::Dim::Dim1D : spv::Dim::Dim2D;
867+
name.count("1D") > 0
868+
? spv::Dim::Dim1D
869+
: (name.count("3D") > 0 ? spv::Dim::Dim3D : spv::Dim::Dim2D);
867870
const bool isArray = name.count("Array") > 0;
868871
const bool isMS = name.count("MS") > 0;
869872

tools/clang/lib/SPIRV/SpirvEmitter.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4409,6 +4409,7 @@ SpirvEmitter::processBufferTextureGetDimensions(const CXXMemberCallExpr *expr) {
44094409
(typeName == "SampledTexture1DArray" && numArgs > 2) ||
44104410
(typeName == "SampledTexture2D" && numArgs > 2) ||
44114411
(typeName == "SampledTexture2DArray" && numArgs > 3) ||
4412+
(typeName == "SampledTexture3D" && numArgs > 3) ||
44124413
(typeName == "TextureCube" && numArgs > 2) ||
44134414
(typeName == "Texture3D" && numArgs > 3) ||
44144415
(typeName == "Texture1DArray" && numArgs > 2) ||

tools/clang/lib/Sema/SemaHLSL.cpp

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ enum ArBasicKind {
206206
AR_OBJECT_VK_SAMPLED_TEXTURE2D_ARRAY,
207207
AR_OBJECT_VK_SAMPLED_TEXTURE2DMS,
208208
AR_OBJECT_VK_SAMPLED_TEXTURE2DMS_ARRAY,
209+
AR_OBJECT_VK_SAMPLED_TEXTURE3D,
209210
#endif // ENABLE_SPIRV_CODEGEN
210211
// SPIRV change ends
211212

@@ -572,6 +573,7 @@ const UINT g_uBasicKindProps[] = {
572573
BPROP_OBJECT | BPROP_RBUFFER, // AR_OBJECT_VK_SAMPLED_TEXTURE2D_ARRAY
573574
BPROP_OBJECT | BPROP_RBUFFER, // AR_OBJECT_VK_SAMPLED_TEXTURE2DMS
574575
BPROP_OBJECT | BPROP_RBUFFER, // AR_OBJECT_VK_SAMPLED_TEXTURE2DMS_ARRAY
576+
BPROP_OBJECT | BPROP_RBUFFER, // AR_OBJECT_VK_SAMPLED_TEXTURE3D
575577
#endif // ENABLE_SPIRV_CODEGEN
576578
// SPIRV change ends
577579

@@ -1292,6 +1294,8 @@ static const ArBasicKind g_VKSampledTexture2DMSCT[] = {
12921294
AR_OBJECT_VK_SAMPLED_TEXTURE2DMS, AR_BASIC_UNKNOWN};
12931295
static const ArBasicKind g_VKSampledTexture2DMSArrayCT[] = {
12941296
AR_OBJECT_VK_SAMPLED_TEXTURE2DMS_ARRAY, AR_BASIC_UNKNOWN};
1297+
static const ArBasicKind g_VKSampledTexture3DCT[] = {
1298+
AR_OBJECT_VK_SAMPLED_TEXTURE3D, AR_BASIC_UNKNOWN};
12951299
#endif
12961300

12971301
// Basic kinds, indexed by a LEGAL_INTRINSIC_COMPTYPES value.
@@ -1361,6 +1365,7 @@ const ArBasicKind *g_LegalIntrinsicCompTypes[] = {
13611365
g_VKSampledTexture2DArrayCT, // LICOMPTYPE_VK_SAMPLED_TEXTURE2D_ARRAY
13621366
g_VKSampledTexture2DMSCT, // LICOMPTYPE_VK_SAMPLED_TEXTURE2DMS
13631367
g_VKSampledTexture2DMSArrayCT, // LICOMPTYPE_VK_SAMPLED_TEXTURE2DMS_ARRAY
1368+
g_VKSampledTexture3DCT, // LICOMPTYPE_VK_SAMPLED_TEXTURE3D
13641369
#endif
13651370
};
13661371
static_assert(
@@ -1423,7 +1428,7 @@ static const ArBasicKind g_ArBasicKindsAsTypes[] = {
14231428
AR_OBJECT_VK_BUFFER_POINTER, AR_OBJECT_VK_SAMPLED_TEXTURE1D,
14241429
AR_OBJECT_VK_SAMPLED_TEXTURE1D_ARRAY, AR_OBJECT_VK_SAMPLED_TEXTURE2D,
14251430
AR_OBJECT_VK_SAMPLED_TEXTURE2D_ARRAY, AR_OBJECT_VK_SAMPLED_TEXTURE2DMS,
1426-
AR_OBJECT_VK_SAMPLED_TEXTURE2DMS_ARRAY,
1431+
AR_OBJECT_VK_SAMPLED_TEXTURE2DMS_ARRAY, AR_OBJECT_VK_SAMPLED_TEXTURE3D,
14271432
#endif // ENABLE_SPIRV_CODEGEN
14281433
// SPIRV change ends
14291434

@@ -1541,6 +1546,7 @@ static const uint8_t g_ArBasicKindsTemplateCount[] = {
15411546
1, // AR_OBJECT_VK_SAMPLED_TEXTURE2D_ARRAY
15421547
1, // AR_OBJECT_VK_SAMPLED_TEXTURE2DMS
15431548
1, // AR_OBJECT_VK_SAMPLED_TEXTURE2DMS_ARRAY
1549+
1, // AR_OBJECT_VK_SAMPLED_TEXTURE3D
15441550
#endif // ENABLE_SPIRV_CODEGEN
15451551
// SPIRV change ends
15461552

@@ -1700,6 +1706,7 @@ static const SubscriptOperatorRecord g_ArBasicKindsSubscripts[] = {
17001706
{3, MipsTrue, SampleFalse}, // AR_OBJECT_VK_SAMPLED_TEXTURE2D_ARRAY
17011707
{2, MipsFalse, SampleTrue}, // AR_OBJECT_VK_SAMPLED_TEXTURE2DMS
17021708
{3, MipsFalse, SampleTrue}, // AR_OBJECT_VK_SAMPLED_TEXTURE2DMS_ARRAY
1709+
{3, MipsTrue, SampleFalse}, // AR_OBJECT_VK_SAMPLED_TEXTURE3D
17031710
#endif // ENABLE_SPIRV_CODEGEN
17041711
// SPIRV change ends
17051712

@@ -1875,6 +1882,7 @@ static const char *g_ArBasicTypeNames[] = {
18751882
"SampledTexture2DArray",
18761883
"SampledTexture2DMS",
18771884
"SampledTexture2DMSArray",
1885+
"SampledTexture3D",
18781886
#endif // ENABLE_SPIRV_CODEGEN
18791887
// SPIRV change ends
18801888

@@ -2552,6 +2560,10 @@ static void GetIntrinsicMethods(ArBasicKind kind,
25522560
*intrinsics = g_VkSampledTexture2DMSArrayMethods;
25532561
*intrinsicCount = _countof(g_VkSampledTexture2DMSArrayMethods);
25542562
break;
2563+
case AR_OBJECT_VK_SAMPLED_TEXTURE3D:
2564+
*intrinsics = g_VkSampledTexture3DMethods;
2565+
*intrinsicCount = _countof(g_VkSampledTexture3DMethods);
2566+
break;
25552567
#endif
25562568
case AR_OBJECT_HIT_OBJECT:
25572569
*intrinsics = g_DxHitObjectMethods;
@@ -4162,7 +4174,8 @@ class HLSLExternalSource : public ExternalSemaSource {
41624174
kind == AR_OBJECT_VK_SAMPLED_TEXTURE2D ||
41634175
kind == AR_OBJECT_VK_SAMPLED_TEXTURE2D_ARRAY ||
41644176
kind == AR_OBJECT_VK_SAMPLED_TEXTURE2DMS ||
4165-
kind == AR_OBJECT_VK_SAMPLED_TEXTURE2DMS_ARRAY) {
4177+
kind == AR_OBJECT_VK_SAMPLED_TEXTURE2DMS_ARRAY ||
4178+
kind == AR_OBJECT_VK_SAMPLED_TEXTURE3D) {
41664179
if (!m_vkNSDecl)
41674180
continue;
41684181
QualType float4Type =
@@ -4998,6 +5011,7 @@ class HLSLExternalSource : public ExternalSemaSource {
49985011
case AR_OBJECT_VK_SAMPLED_TEXTURE1D_ARRAY:
49995012
case AR_OBJECT_TEXTURE2D:
50005013
case AR_OBJECT_TEXTURE2D_ARRAY:
5014+
case AR_OBJECT_VK_SAMPLED_TEXTURE3D:
50015015
case AR_OBJECT_TEXTURE3D:
50025016
case AR_OBJECT_TEXTURECUBE:
50035017
case AR_OBJECT_TEXTURECUBE_ARRAY:
@@ -5148,6 +5162,9 @@ class HLSLExternalSource : public ExternalSemaSource {
51485162
ResClass = DXIL::ResourceClass::UAV;
51495163
return true;
51505164
case AR_OBJECT_TEXTURE3D:
5165+
#ifdef ENABLE_SPIRV_CODEGEN
5166+
case AR_OBJECT_VK_SAMPLED_TEXTURE3D:
5167+
#endif
51515168
ResKind = DXIL::ResourceKind::Texture3D;
51525169
ResClass = DXIL::ResourceClass::SRV;
51535170
return true;
@@ -11709,6 +11726,7 @@ void hlsl::DiagnoseRegisterType(clang::Sema *self, clang::SourceLocation loc,
1170911726
case AR_OBJECT_VK_SAMPLED_TEXTURE1D_ARRAY:
1171011727
case AR_OBJECT_TEXTURE2D:
1171111728
case AR_OBJECT_TEXTURE2D_ARRAY:
11729+
case AR_OBJECT_VK_SAMPLED_TEXTURE3D:
1171211730
case AR_OBJECT_TEXTURE3D:
1171311731
case AR_OBJECT_TEXTURECUBE:
1171411732
case AR_OBJECT_TEXTURECUBE_ARRAY:

tools/clang/test/CodeGenSPIRV/vk.sampledtexture.calculate-lod-unclamped.hlsl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@
1010
// CHECK: [[type_2d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image]]
1111
// CHECK: [[type_2d_image_array:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 1 0 1 Unknown
1212
// CHECK: [[type_2d_sampled_image_array:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_array]]
13+
// CHECK: [[type_3d_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float 3D 0 0 0 1 Unknown
14+
// CHECK: [[type_3d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_3d_image]]
1315

1416
vk::SampledTexture1D<float4> tex1d;
1517
vk::SampledTexture1DArray<float4> tex1dArray;
1618
vk::SampledTexture2D<float4> tex2d;
1719
vk::SampledTexture2DArray<float4> tex2dArray;
20+
vk::SampledTexture3D<float4> tex3d;
1821

1922
void main() {
2023
float2 xy = float2(0.5, 0.5);
@@ -40,4 +43,9 @@ void main() {
4043
// CHECK-NEXT: [[query1da:%[a-zA-Z0-9_]+]] = OpImageQueryLod %v2float [[tex1da_load]] %float_0_5
4144
// CHECK-NEXT: {{%[0-9]+}} = OpCompositeExtract %float [[query1da]] 1
4245
float lod4 = tex1dArray.CalculateLevelOfDetailUnclamped(0.5);
46+
47+
// CHECK: [[tex3d_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_3d_sampled_image]] %tex3d
48+
// CHECK-NEXT: [[query3d:%[a-zA-Z0-9_]+]] = OpImageQueryLod %v2float [[tex3d_load]] %{{[0-9]+}}
49+
// CHECK-NEXT: {{%[0-9]+}} = OpCompositeExtract %float [[query3d]] 1
50+
float lod5 = tex3d.CalculateLevelOfDetailUnclamped(float3(0.5, 0.25, 0));
4351
}

tools/clang/test/CodeGenSPIRV/vk.sampledtexture.calculate-lod.hlsl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@
1010
// CHECK: [[type_2d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image]]
1111
// CHECK: [[type_2d_image_array:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 1 0 1 Unknown
1212
// CHECK: [[type_2d_sampled_image_array:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_array]]
13+
// CHECK: [[type_3d_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float 3D 0 0 0 1 Unknown
14+
// CHECK: [[type_3d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_3d_image]]
1315

1416
vk::SampledTexture1D<float4> tex1d;
1517
vk::SampledTexture1DArray<float4> tex1dArray;
1618
vk::SampledTexture2D<float4> tex2d;
1719
vk::SampledTexture2DArray<float4> tex2dArray;
20+
vk::SampledTexture3D<float4> tex3d;
1821

1922
void main() {
2023
float2 xy = float2(0.5, 0.5);
@@ -40,4 +43,9 @@ void main() {
4043
// CHECK-NEXT: [[query1da:%[a-zA-Z0-9_]+]] = OpImageQueryLod %v2float [[tex1da_load]] %float_0_5
4144
// CHECK-NEXT: {{%[0-9]+}} = OpCompositeExtract %float [[query1da]] 0
4245
float lod4 = tex1dArray.CalculateLevelOfDetail(0.5);
46+
47+
// CHECK: [[tex3d_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_3d_sampled_image]] %tex3d
48+
// CHECK-NEXT: [[query3d:%[a-zA-Z0-9_]+]] = OpImageQueryLod %v2float [[tex3d_load]] %{{[0-9]+}}
49+
// CHECK-NEXT: {{%[0-9]+}} = OpCompositeExtract %float [[query3d]] 0
50+
float lod5 = tex3d.CalculateLevelOfDetail(float3(0.5, 0.25, 0));
4351
}

tools/clang/test/CodeGenSPIRV/vk.sampledtexture.get-dimensions.hlsl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
// CHECK: [[type_2d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image]]
1212
// CHECK: [[type_2d_image_array:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 1 0 1 Unknown
1313
// CHECK: [[type_2d_sampled_image_array:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_array]]
14+
// CHECK: [[type_3d_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float 3D 0 0 0 1 Unknown
15+
// CHECK: [[type_3d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_3d_image]]
1416
// CHECK: [[type_2d_image_ms:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 1 1 Unknown
1517
// CHECK: [[type_2d_sampled_image_ms:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_ms]]
1618
// CHECK: [[type_2d_image_ms_array:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 1 1 1 Unknown
@@ -20,6 +22,7 @@ vk::SampledTexture1D<float4> tex1d;
2022
vk::SampledTexture1DArray<float4> tex1dArray;
2123
vk::SampledTexture2D<float4> tex2d;
2224
vk::SampledTexture2DArray<float4> tex2dArray;
25+
vk::SampledTexture3D<float4> tex3d;
2326
vk::SampledTexture2DMS<float4> tex2dMS;
2427
vk::SampledTexture2DMSArray<float4> tex2dMSArray;
2528

@@ -166,6 +169,13 @@ void main() {
166169
// CHECK-NEXT: OpStore %i_numLevels [[query_level_2_int]]
167170
tex2d.GetDimensions(mipLevel, i_width, i_height, i_numLevels);
168171

172+
// CHECK: [[t3d_load:%[0-9]+]] = OpLoad [[type_3d_sampled_image]] %tex3d
173+
// CHECK-NEXT: [[image3d:%[0-9]+]] = OpImage [[type_3d_image]] [[t3d_load]]
174+
// CHECK-NEXT: [[query3d:%[0-9]+]] = OpImageQuerySizeLod %v3uint [[image3d]] %int_0
175+
// CHECK-NEXT: [[query3d_0:%[0-9]+]] = OpCompositeExtract %uint [[query3d]] 0
176+
// CHECK-NEXT: OpStore %width [[query3d_0]]
177+
tex3d.GetDimensions(width, height, elements);
178+
169179
#ifdef ERROR
170180
// ERROR: error: Output argument must be an l-value
171181
tex2d.GetDimensions(mipLevel, 0, height, numLevels);

tools/clang/test/CodeGenSPIRV/vk.sampledtexture.load.hlsl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
// CHECK: [[type_2d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image]]
1111
// CHECK: [[type_2d_image_array:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 1 0 1 Unknown
1212
// CHECK: [[type_2d_sampled_image_array:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_array]]
13+
// CHECK: [[type_3d_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float 3D 0 0 0 1 Unknown
14+
// CHECK: [[type_3d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_3d_image]]
1315
// CHECK: [[type_2d_image_ms:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 1 1 Unknown
1416
// CHECK: [[type_2d_sampled_image_ms:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_ms]]
1517
// CHECK: [[type_2d_image_ms_array:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 1 1 1 Unknown
@@ -19,6 +21,7 @@ vk::SampledTexture1D<float4> tex1d;
1921
vk::SampledTexture1DArray<float4> tex1dArray;
2022
vk::SampledTexture2D<float4> tex2d;
2123
vk::SampledTexture2DArray<float4> tex2dArray;
24+
vk::SampledTexture3D<float4> tex3d;
2225
vk::SampledTexture2DMS<float4> tex2dMS;
2326
vk::SampledTexture2DMSArray<float4> tex2dMSArray;
2427

@@ -101,5 +104,13 @@ float4 main(int3 location3: A, int4 location4: B) : SV_Target {
101104
// CHECK-NEXT: {{[%0-9]+}} = OpImageFetch %v4float [[tex_1d_arr_img]] [[coord_1]] Lod [[lod_0]]
102105
float4 val8 = tex1dArray.Load(location4.xyz);
103106

107+
// CHECK: [[loc3d:%[0-9]+]] = OpLoad %v4int %location4
108+
// CHECK-NEXT: [[coord3d:%[0-9]+]] = OpVectorShuffle %v3int [[loc3d]] [[loc3d]] 0 1 2
109+
// CHECK-NEXT: [[lod3d:%[0-9]+]] = OpCompositeExtract %int [[loc3d]] 3
110+
// CHECK-NEXT: [[tex3d_load:%[0-9]+]] = OpLoad [[type_3d_sampled_image]] %tex3d
111+
// CHECK-NEXT: [[img3d:%[0-9]+]] = OpImage [[type_3d_image]] [[tex3d_load]]
112+
// CHECK-NEXT: {{%[0-9]+}} = OpImageFetch %v4float [[img3d]] [[coord3d]] Lod [[lod3d]]
113+
float4 val9 = tex3d.Load(location4);
114+
104115
return 1.0;
105116
}

tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-bias.hlsl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// CHECK: [[v2fc:%[0-9]+]] = OpConstantComposite %v2float %float_0_5 %float_0_25
77
// CHECK: [[v2ic:%[0-9]+]] = OpConstantComposite %v2int %int_2 %int_3
88
// CHECK: [[v3fc:%[0-9]+]] = OpConstantComposite %v3float %float_0_5 %float_0_25 %float_0
9+
// CHECK: [[v3ic:%[0-9]+]] = OpConstantComposite %v3int %int_1 %int_2 %int_3
910

1011
// CHECK: [[type_1d_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float 1D 0 0 0 1 Unknown
1112
// CHECK: [[type_1d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_1d_image]]
@@ -15,11 +16,14 @@
1516
// CHECK: [[type_2d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image]]
1617
// CHECK: [[type_2d_image_array:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 1 0 1 Unknown
1718
// CHECK: [[type_2d_sampled_image_array:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_array]]
19+
// CHECK: [[type_3d_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float 3D 0 0 0 1 Unknown
20+
// CHECK: [[type_3d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_3d_image]]
1821

1922
vk::SampledTexture1D<float4> tex1d;
2023
vk::SampledTexture1DArray<float4> tex1dArray;
2124
vk::SampledTexture2D<float4> tex2d;
2225
vk::SampledTexture2DArray<float4> tex2dArray;
26+
vk::SampledTexture3D<float4> tex3d;
2327

2428
float4 main() : SV_Target {
2529
// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d
@@ -49,5 +53,9 @@ float4 main() : SV_Target {
4953
// CHECK: [[sampled_1da:%[a-zA-Z0-9_]+]] = OpImageSampleImplicitLod %v4float [[tex1da_load]] {{%[0-9]+}} Bias|ConstOffset %float_0_5 %int_1
5054
float4 val6 = tex1dArray.SampleBias(float2(0.5, 0), 0.5f, 1);
5155

56+
// CHECK: [[tex3d_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_3d_sampled_image]] %tex3d
57+
// CHECK: [[sampled_3d:%[a-zA-Z0-9_]+]] = OpImageSampleImplicitLod %v4float [[tex3d_load]] [[v3fc]] Bias|ConstOffset %float_0_5 [[v3ic]]
58+
float4 val7 = tex3d.SampleBias(float3(0.5, 0.25, 0), 0.5f, int3(1, 2, 3));
59+
5260
return 1.0;
5361
}

0 commit comments

Comments
 (0)