From 72f3df66be05f4c8ff83413802d8b72a030c9189 Mon Sep 17 00:00:00 2001 From: luciechoi Date: Tue, 14 Apr 2026 21:49:08 +0000 Subject: [PATCH] Add SampledTexture3D type --- include/dxc/dxcapi.internal.h | 3 +- tools/clang/lib/SPIRV/LowerTypeVisitor.cpp | 4 +- tools/clang/lib/SPIRV/SpirvEmitter.cpp | 1 + tools/clang/lib/Sema/SemaHLSL.cpp | 20 +++- .../vk.sampledtexture3d.access.hlsl | 34 ++++++ ...pledtexture3d.calculate-lod-unclamped.hlsl | 18 +++ .../vk.sampledtexture3d.calculate-lod.hlsl | 18 +++ .../vk.sampledtexture3d.get-dimensions.hlsl | 113 ++++++++++++++++++ .../vk.sampledtexture3d.load.hlsl | 46 +++++++ .../vk.sampledtexture3d.mips-access.hlsl | 17 +++ .../vk.sampledtexture3d.sample-bias.hlsl | 35 ++++++ .../vk.sampledtexture3d.sample-grad.hlsl | 39 ++++++ .../vk.sampledtexture3d.sample-level.hlsl | 30 +++++ .../vk.sampledtexture3d.sample.hlsl | 44 +++++++ utils/hct/gen_intrin_main.txt | 29 +++++ 15 files changed, 447 insertions(+), 4 deletions(-) create mode 100644 tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.access.hlsl create mode 100644 tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.calculate-lod-unclamped.hlsl create mode 100644 tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.calculate-lod.hlsl create mode 100644 tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.get-dimensions.hlsl create mode 100644 tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.load.hlsl create mode 100644 tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.mips-access.hlsl create mode 100644 tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.sample-bias.hlsl create mode 100644 tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.sample-grad.hlsl create mode 100644 tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.sample-level.hlsl create mode 100644 tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.sample.hlsl diff --git a/include/dxc/dxcapi.internal.h b/include/dxc/dxcapi.internal.h index 5d84e64e30..7a8d5204e5 100644 --- a/include/dxc/dxcapi.internal.h +++ b/include/dxc/dxcapi.internal.h @@ -146,7 +146,8 @@ enum LEGAL_INTRINSIC_COMPTYPES { LICOMPTYPE_VK_SAMPLED_TEXTURE2D_ARRAY = 60, LICOMPTYPE_VK_SAMPLED_TEXTURE2DMS = 61, LICOMPTYPE_VK_SAMPLED_TEXTURE2DMS_ARRAY = 62, - LICOMPTYPE_COUNT = 63 + LICOMPTYPE_VK_SAMPLED_TEXTURE3D = 63, + LICOMPTYPE_COUNT = 64 #else LICOMPTYPE_COUNT = 56 #endif diff --git a/tools/clang/lib/SPIRV/LowerTypeVisitor.cpp b/tools/clang/lib/SPIRV/LowerTypeVisitor.cpp index 00c8e90874..4718c88f35 100644 --- a/tools/clang/lib/SPIRV/LowerTypeVisitor.cpp +++ b/tools/clang/lib/SPIRV/LowerTypeVisitor.cpp @@ -864,7 +864,9 @@ const SpirvType *LowerTypeVisitor::lowerVkTypeInVkNamespace( constexpr size_t sampledTexturePrefixLength = sizeof("SampledTexture") - 1; StringRef suffix = name.drop_front(sampledTexturePrefixLength); const spv::Dim dimension = - suffix.startswith("1D") ? spv::Dim::Dim1D : spv::Dim::Dim2D; + suffix.startswith("1D") + ? spv::Dim::Dim1D + : (suffix.startswith("2D") ? spv::Dim::Dim2D : spv::Dim::Dim3D); const bool isArray = suffix.endswith("Array"); const bool isMS = suffix.find("MS") != StringRef::npos; diff --git a/tools/clang/lib/SPIRV/SpirvEmitter.cpp b/tools/clang/lib/SPIRV/SpirvEmitter.cpp index f39272b074..049139af11 100644 --- a/tools/clang/lib/SPIRV/SpirvEmitter.cpp +++ b/tools/clang/lib/SPIRV/SpirvEmitter.cpp @@ -4417,6 +4417,7 @@ SpirvEmitter::processBufferTextureGetDimensions(const CXXMemberCallExpr *expr) { (typeName == "SampledTexture1DArray" && numArgs > 2) || (typeName == "SampledTexture2D" && numArgs > 2) || (typeName == "SampledTexture2DArray" && numArgs > 3) || + (typeName == "SampledTexture3D" && numArgs > 3) || (typeName == "TextureCube" && numArgs > 2) || (typeName == "Texture3D" && numArgs > 3) || (typeName == "Texture1DArray" && numArgs > 2) || diff --git a/tools/clang/lib/Sema/SemaHLSL.cpp b/tools/clang/lib/Sema/SemaHLSL.cpp index 2d3eb85a6a..3900c37238 100644 --- a/tools/clang/lib/Sema/SemaHLSL.cpp +++ b/tools/clang/lib/Sema/SemaHLSL.cpp @@ -206,6 +206,7 @@ enum ArBasicKind { AR_OBJECT_VK_SAMPLED_TEXTURE2D_ARRAY, AR_OBJECT_VK_SAMPLED_TEXTURE2DMS, AR_OBJECT_VK_SAMPLED_TEXTURE2DMS_ARRAY, + AR_OBJECT_VK_SAMPLED_TEXTURE3D, #endif // ENABLE_SPIRV_CODEGEN // SPIRV change ends @@ -572,6 +573,7 @@ const UINT g_uBasicKindProps[] = { BPROP_OBJECT | BPROP_RBUFFER, // AR_OBJECT_VK_SAMPLED_TEXTURE2D_ARRAY BPROP_OBJECT | BPROP_RBUFFER, // AR_OBJECT_VK_SAMPLED_TEXTURE2DMS BPROP_OBJECT | BPROP_RBUFFER, // AR_OBJECT_VK_SAMPLED_TEXTURE2DMS_ARRAY + BPROP_OBJECT | BPROP_RBUFFER, // AR_OBJECT_VK_SAMPLED_TEXTURE3D #endif // ENABLE_SPIRV_CODEGEN // SPIRV change ends @@ -1292,6 +1294,8 @@ static const ArBasicKind g_VKSampledTexture2DMSCT[] = { AR_OBJECT_VK_SAMPLED_TEXTURE2DMS, AR_BASIC_UNKNOWN}; static const ArBasicKind g_VKSampledTexture2DMSArrayCT[] = { AR_OBJECT_VK_SAMPLED_TEXTURE2DMS_ARRAY, AR_BASIC_UNKNOWN}; +static const ArBasicKind g_VKSampledTexture3DCT[] = { + AR_OBJECT_VK_SAMPLED_TEXTURE3D, AR_BASIC_UNKNOWN}; #endif // Basic kinds, indexed by a LEGAL_INTRINSIC_COMPTYPES value. @@ -1361,6 +1365,7 @@ const ArBasicKind *g_LegalIntrinsicCompTypes[] = { g_VKSampledTexture2DArrayCT, // LICOMPTYPE_VK_SAMPLED_TEXTURE2D_ARRAY g_VKSampledTexture2DMSCT, // LICOMPTYPE_VK_SAMPLED_TEXTURE2DMS g_VKSampledTexture2DMSArrayCT, // LICOMPTYPE_VK_SAMPLED_TEXTURE2DMS_ARRAY + g_VKSampledTexture3DCT, // LICOMPTYPE_VK_SAMPLED_TEXTURE3D #endif }; static_assert( @@ -1423,7 +1428,7 @@ static const ArBasicKind g_ArBasicKindsAsTypes[] = { AR_OBJECT_VK_BUFFER_POINTER, AR_OBJECT_VK_SAMPLED_TEXTURE1D, AR_OBJECT_VK_SAMPLED_TEXTURE1D_ARRAY, AR_OBJECT_VK_SAMPLED_TEXTURE2D, AR_OBJECT_VK_SAMPLED_TEXTURE2D_ARRAY, AR_OBJECT_VK_SAMPLED_TEXTURE2DMS, - AR_OBJECT_VK_SAMPLED_TEXTURE2DMS_ARRAY, + AR_OBJECT_VK_SAMPLED_TEXTURE2DMS_ARRAY, AR_OBJECT_VK_SAMPLED_TEXTURE3D, #endif // ENABLE_SPIRV_CODEGEN // SPIRV change ends @@ -1541,6 +1546,7 @@ static const uint8_t g_ArBasicKindsTemplateCount[] = { 1, // AR_OBJECT_VK_SAMPLED_TEXTURE2D_ARRAY 1, // AR_OBJECT_VK_SAMPLED_TEXTURE2DMS 1, // AR_OBJECT_VK_SAMPLED_TEXTURE2DMS_ARRAY + 1, // AR_OBJECT_VK_SAMPLED_TEXTURE3D #endif // ENABLE_SPIRV_CODEGEN // SPIRV change ends @@ -1700,6 +1706,7 @@ static const SubscriptOperatorRecord g_ArBasicKindsSubscripts[] = { {3, MipsTrue, SampleFalse}, // AR_OBJECT_VK_SAMPLED_TEXTURE2D_ARRAY {2, MipsFalse, SampleTrue}, // AR_OBJECT_VK_SAMPLED_TEXTURE2DMS {3, MipsFalse, SampleTrue}, // AR_OBJECT_VK_SAMPLED_TEXTURE2DMS_ARRAY + {3, MipsTrue, SampleFalse}, // AR_OBJECT_VK_SAMPLED_TEXTURE3D #endif // ENABLE_SPIRV_CODEGEN // SPIRV change ends @@ -1875,6 +1882,7 @@ static const char *g_ArBasicTypeNames[] = { "SampledTexture2DArray", "SampledTexture2DMS", "SampledTexture2DMSArray", + "SampledTexture3D", #endif // ENABLE_SPIRV_CODEGEN // SPIRV change ends @@ -2555,6 +2563,10 @@ static void GetIntrinsicMethods(ArBasicKind kind, *intrinsics = g_VkSampledTexture2DMSArrayMethods; *intrinsicCount = _countof(g_VkSampledTexture2DMSArrayMethods); break; + case AR_OBJECT_VK_SAMPLED_TEXTURE3D: + *intrinsics = g_VkSampledTexture3DMethods; + *intrinsicCount = _countof(g_VkSampledTexture3DMethods); + break; #endif case AR_OBJECT_HIT_OBJECT: *intrinsics = g_DxHitObjectMethods; @@ -4165,7 +4177,8 @@ class HLSLExternalSource : public ExternalSemaSource { kind == AR_OBJECT_VK_SAMPLED_TEXTURE2D || kind == AR_OBJECT_VK_SAMPLED_TEXTURE2D_ARRAY || kind == AR_OBJECT_VK_SAMPLED_TEXTURE2DMS || - kind == AR_OBJECT_VK_SAMPLED_TEXTURE2DMS_ARRAY) { + kind == AR_OBJECT_VK_SAMPLED_TEXTURE2DMS_ARRAY || + kind == AR_OBJECT_VK_SAMPLED_TEXTURE3D) { if (!m_vkNSDecl) continue; QualType float4Type = @@ -5153,6 +5166,9 @@ class HLSLExternalSource : public ExternalSemaSource { ResClass = DXIL::ResourceClass::UAV; return true; case AR_OBJECT_TEXTURE3D: +#ifdef ENABLE_SPIRV_CODEGEN + case AR_OBJECT_VK_SAMPLED_TEXTURE3D: +#endif ResKind = DXIL::ResourceKind::Texture3D; ResClass = DXIL::ResourceClass::SRV; return true; diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.access.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.access.hlsl new file mode 100644 index 0000000000..ac3f717dbd --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.access.hlsl @@ -0,0 +1,34 @@ +// RUN: %dxc -T ps_6_7 -E main -fcgl %s -spirv | FileCheck %s +// RUN: not %dxc -T ps_6_7 -E main -fcgl %s -spirv -DERROR 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR + +// CHECK: %type_3d_image = OpTypeImage %float 3D 0 0 0 1 Unknown +// CHECK: %type_sampled_image = OpTypeSampledImage %type_3d_image + +vk::SampledTexture3D tex3d; + +struct S { int a; }; + +void main() { + uint3 pos1 = uint3(1, 2, 3); + +// CHECK: [[pos1:%[a-zA-Z0-9_]+]] = OpLoad %v3uint %pos1 +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex3d +// CHECK: [[tex_image:%[a-zA-Z0-9_]+]] = OpImage %type_3d_image [[tex1_load]] +// CHECK: [[fetch_result:%[a-zA-Z0-9_]+]] = OpImageFetch %v4float [[tex_image]] [[pos1]] Lod %uint_0 +// CHECK: OpStore %a1 [[fetch_result]] + float4 a1 = tex3d[pos1]; + +#ifdef ERROR + S s = { 1 }; +// CHECK-ERROR: error: no viable overloaded operator[] + float4 val2 = tex3d[s]; + + int2 i2 = int2(1, 2); +// CHECK-ERROR: error: no viable overloaded operator[] + float4 val3 = tex3d[i2]; + + int i1 = 1; +// CHECK-ERROR: error: no viable overloaded operator[] + float4 val4 = tex3d[i1]; +#endif +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.calculate-lod-unclamped.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.calculate-lod-unclamped.hlsl new file mode 100644 index 0000000000..8da3a51674 --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.calculate-lod-unclamped.hlsl @@ -0,0 +1,18 @@ +// RUN: %dxc -T ps_6_8 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: OpCapability ImageQuery + +// 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 tex3d; + +void main() { + float3 xyz = float3(0.5, 0.5, 0.5); + +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_3d_sampled_image]] %tex3d +// CHECK-NEXT: [[xyz_load:%[a-zA-Z0-9_]+]] = OpLoad %v3float %xyz +// CHECK-NEXT: [[query:%[a-zA-Z0-9_]+]] = OpImageQueryLod %v2float [[tex1_load]] [[xyz_load]] +// CHECK-NEXT: {{%[0-9]+}} = OpCompositeExtract %float [[query]] 1 + float lod1 = tex3d.CalculateLevelOfDetailUnclamped(xyz); +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.calculate-lod.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.calculate-lod.hlsl new file mode 100644 index 0000000000..de93ccf639 --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.calculate-lod.hlsl @@ -0,0 +1,18 @@ +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: OpCapability ImageQuery + +// 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 tex3d; + +void main() { + float3 xyz = float3(0.5, 0.5, 0.5); + +// CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpLoad [[type_3d_sampled_image]] %tex3d +// CHECK-NEXT: [[xyz_load:%[a-zA-Z0-9_]+]] = OpLoad %v3float %xyz +// CHECK-NEXT: [[query:%[a-zA-Z0-9_]+]] = OpImageQueryLod %v2float [[tex1]] [[xyz_load]] +// CHECK-NEXT: {{%[0-9]+}} = OpCompositeExtract %float [[query]] 0 + float lod = tex3d.CalculateLevelOfDetail(xyz); +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.get-dimensions.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.get-dimensions.hlsl new file mode 100644 index 0000000000..51331d1254 --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.get-dimensions.hlsl @@ -0,0 +1,113 @@ +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s +// RUN: not %dxc -T ps_6_0 -E main -fcgl %s -spirv -DERROR 2>&1 | FileCheck %s --check-prefix=ERROR + +// CHECK: OpCapability ImageQuery + +// 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 tex3d; + +void main() { + uint mipLevel = 1; + uint width, height, depth, numLevels; + +// CHECK: [[t1_load:%[0-9]+]] = OpLoad [[type_3d_sampled_image]] %tex3d +// CHECK-NEXT: [[image1:%[0-9]+]] = OpImage [[type_3d_image]] [[t1_load]] +// CHECK-NEXT: [[query1:%[0-9]+]] = OpImageQuerySizeLod %v3uint [[image1]] %int_0 +// CHECK-NEXT: [[query1_0:%[0-9]+]] = OpCompositeExtract %uint [[query1]] 0 +// CHECK-NEXT: OpStore %width [[query1_0]] +// CHECK-NEXT: [[query1_1:%[0-9]+]] = OpCompositeExtract %uint [[query1]] 1 +// CHECK-NEXT: OpStore %height [[query1_1]] +// CHECK-NEXT: [[query1_2:%[0-9]+]] = OpCompositeExtract %uint [[query1]] 2 +// CHECK-NEXT: OpStore %depth [[query1_2]] + tex3d.GetDimensions(width, height, depth); + +// CHECK: [[t2_load:%[0-9]+]] = OpLoad [[type_3d_sampled_image]] %tex3d +// CHECK-NEXT: [[image2:%[0-9]+]] = OpImage [[type_3d_image]] [[t2_load]] +// CHECK-NEXT: [[mip:%[0-9]+]] = OpLoad %uint %mipLevel +// CHECK-NEXT: [[query2:%[0-9]+]] = OpImageQuerySizeLod %v3uint [[image2]] [[mip]] +// CHECK-NEXT: [[query2_0:%[0-9]+]] = OpCompositeExtract %uint [[query2]] 0 +// CHECK-NEXT: OpStore %width [[query2_0]] +// CHECK-NEXT: [[query2_1:%[0-9]+]] = OpCompositeExtract %uint [[query2]] 1 +// CHECK-NEXT: OpStore %height [[query2_1]] +// CHECK-NEXT: [[query2_2:%[0-9]+]] = OpCompositeExtract %uint [[query2]] 2 +// CHECK-NEXT: OpStore %depth [[query2_2]] +// CHECK-NEXT: [[query_level_2:%[0-9]+]] = OpImageQueryLevels %uint [[image2]] +// CHECK-NEXT: OpStore %numLevels [[query_level_2]] + tex3d.GetDimensions(mipLevel, width, height, depth, numLevels); + + float f_width, f_height, f_depth, f_numLevels; +// CHECK: [[t3_load:%[0-9]+]] = OpLoad [[type_3d_sampled_image]] %tex3d +// CHECK-NEXT: [[image3:%[0-9]+]] = OpImage [[type_3d_image]] [[t3_load]] +// CHECK-NEXT: [[query3:%[0-9]+]] = OpImageQuerySizeLod %v3uint [[image3]] %int_0 +// CHECK-NEXT: [[query3_0:%[0-9]+]] = OpCompositeExtract %uint [[query3]] 0 +// CHECK-NEXT: [[f_query3_0:%[0-9]+]] = OpConvertUToF %float [[query3_0]] +// CHECK-NEXT: OpStore %f_width [[f_query3_0]] +// CHECK-NEXT: [[query3_1:%[0-9]+]] = OpCompositeExtract %uint [[query3]] 1 +// CHECK-NEXT: [[f_query3_1:%[0-9]+]] = OpConvertUToF %float [[query3_1]] +// CHECK-NEXT: OpStore %f_height [[f_query3_1]] +// CHECK-NEXT: [[query3_2:%[0-9]+]] = OpCompositeExtract %uint [[query3]] 2 +// CHECK-NEXT: [[f_query3_2:%[0-9]+]] = OpConvertUToF %float [[query3_2]] +// CHECK-NEXT: OpStore %f_depth [[f_query3_2]] + tex3d.GetDimensions(f_width, f_height, f_depth); + +// CHECK: [[t4_load:%[0-9]+]] = OpLoad [[type_3d_sampled_image]] %tex3d +// CHECK-NEXT: [[image4:%[0-9]+]] = OpImage [[type_3d_image]] [[t4_load]] +// CHECK-NEXT: [[mip4:%[0-9]+]] = OpLoad %uint %mipLevel +// CHECK-NEXT: [[query4:%[0-9]+]] = OpImageQuerySizeLod %v3uint [[image4]] [[mip4]] +// CHECK-NEXT: [[query4_0:%[0-9]+]] = OpCompositeExtract %uint [[query4]] 0 +// CHECK-NEXT: [[f_query4_0:%[0-9]+]] = OpConvertUToF %float [[query4_0]] +// CHECK-NEXT: OpStore %f_width [[f_query4_0]] +// CHECK-NEXT: [[query4_1:%[0-9]+]] = OpCompositeExtract %uint [[query4]] 1 +// CHECK-NEXT: [[f_query4_1:%[0-9]+]] = OpConvertUToF %float [[query4_1]] +// CHECK-NEXT: OpStore %f_height [[f_query4_1]] +// CHECK-NEXT: [[query4_2:%[0-9]+]] = OpCompositeExtract %uint [[query4]] 2 +// CHECK-NEXT: [[f_query4_2:%[0-9]+]] = OpConvertUToF %float [[query4_2]] +// CHECK-NEXT: OpStore %f_depth [[f_query4_2]] +// CHECK-NEXT: [[query_level_4:%[0-9]+]] = OpImageQueryLevels %uint [[image4]] +// CHECK-NEXT: [[f_query_level_4:%[0-9]+]] = OpConvertUToF %float [[query_level_4]] +// CHECK-NEXT: OpStore %f_numLevels [[f_query_level_4]] + tex3d.GetDimensions(mipLevel, f_width, f_height, f_depth, f_numLevels); + + int i_width, i_height, i_depth, i_numLevels; +// CHECK: [[t5_load:%[0-9]+]] = OpLoad [[type_3d_sampled_image]] %tex3d +// CHECK-NEXT: [[image5:%[0-9]+]] = OpImage [[type_3d_image]] [[t5_load]] +// CHECK-NEXT: [[query5:%[0-9]+]] = OpImageQuerySizeLod %v3uint [[image5]] %int_0 +// CHECK-NEXT: [[query5_0:%[0-9]+]] = OpCompositeExtract %uint [[query5]] 0 +// CHECK-NEXT: [[query5_0_i:%[0-9]+]] = OpBitcast %int [[query5_0]] +// CHECK-NEXT: OpStore %i_width [[query5_0_i]] +// CHECK-NEXT: [[query5_1:%[0-9]+]] = OpCompositeExtract %uint [[query5]] 1 +// CHECK-NEXT: [[query5_1_i:%[0-9]+]] = OpBitcast %int [[query5_1]] +// CHECK-NEXT: OpStore %i_height [[query5_1_i]] +// CHECK-NEXT: [[query5_2:%[0-9]+]] = OpCompositeExtract %uint [[query5]] 2 +// CHECK-NEXT: [[query5_2_i:%[0-9]+]] = OpBitcast %int [[query5_2]] +// CHECK-NEXT: OpStore %i_depth [[query5_2_i]] + tex3d.GetDimensions(i_width, i_height, i_depth); + +// CHECK: [[t6_load:%[0-9]+]] = OpLoad [[type_3d_sampled_image]] %tex3d +// CHECK-NEXT: [[image6:%[0-9]+]] = OpImage [[type_3d_image]] [[t6_load]] +// CHECK-NEXT: [[mip6:%[0-9]+]] = OpLoad %uint %mipLevel +// CHECK-NEXT: [[query6:%[0-9]+]] = OpImageQuerySizeLod %v3uint [[image6]] [[mip6]] +// CHECK-NEXT: [[query6_0:%[0-9]+]] = OpCompositeExtract %uint [[query6]] 0 +// CHECK-NEXT: [[query6_0_i:%[0-9]+]] = OpBitcast %int [[query6_0]] +// CHECK-NEXT: OpStore %i_width [[query6_0_i]] +// CHECK-NEXT: [[query6_1:%[0-9]+]] = OpCompositeExtract %uint [[query6]] 1 +// CHECK-NEXT: [[query6_1_i:%[0-9]+]] = OpBitcast %int [[query6_1]] +// CHECK-NEXT: OpStore %i_height [[query6_1_i]] +// CHECK-NEXT: [[query6_2:%[0-9]+]] = OpCompositeExtract %uint [[query6]] 2 +// CHECK-NEXT: [[query6_2_i:%[0-9]+]] = OpBitcast %int [[query6_2]] +// CHECK-NEXT: OpStore %i_depth [[query6_2_i]] +// CHECK-NEXT: [[query_level_6:%[0-9]+]] = OpImageQueryLevels %uint [[image6]] +// CHECK-NEXT: [[query_level_6_i:%[0-9]+]] = OpBitcast %int [[query_level_6]] +// CHECK-NEXT: OpStore %i_numLevels [[query_level_6_i]] + tex3d.GetDimensions(mipLevel, i_width, i_height, i_depth, i_numLevels); + +#ifdef ERROR +// ERROR: error: Output argument must be an l-value + tex3d.GetDimensions(mipLevel, 0, height, depth, numLevels); + +// ERROR: error: Output argument must be an l-value + tex3d.GetDimensions(width, 20, depth); +#endif +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.load.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.load.hlsl new file mode 100644 index 0000000000..aa9c17ed24 --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.load.hlsl @@ -0,0 +1,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 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; +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.mips-access.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.mips-access.hlsl new file mode 100644 index 0000000000..d860d10dc8 --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.mips-access.hlsl @@ -0,0 +1,17 @@ +// RUN: %dxc -T ps_6_7 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: %type_3d_image = OpTypeImage %float 3D 0 0 0 1 Unknown +// CHECK: %type_sampled_image = OpTypeSampledImage %type_3d_image + +vk::SampledTexture3D tex3d; + +void main() { + uint3 pos1 = uint3(1, 2, 3); + +// CHECK: [[pos1:%[a-zA-Z0-9_]+]] = OpLoad %v3uint %pos1 +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex3d +// CHECK: [[tex_image:%[a-zA-Z0-9_]+]] = OpImage %type_3d_image [[tex1_load]] +// CHECK: [[fetch_result:%[a-zA-Z0-9_]+]] = OpImageFetch %v4float [[tex_image]] [[pos1]] Lod %uint_2 +// CHECK: OpStore %a1 [[fetch_result]] + float4 a1 = tex3d.mips[2][pos1]; +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.sample-bias.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.sample-bias.hlsl new file mode 100644 index 0000000000..07b887e18f --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.sample-bias.hlsl @@ -0,0 +1,35 @@ +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: OpCapability MinLod +// CHECK: OpCapability SparseResidency + +// CHECK: [[v3fc:%[0-9]+]] = OpConstantComposite %v3float %float_0_5 %float_0_25 %float_0 +// CHECK: [[v3ic:%[0-9]+]] = OpConstantComposite %v3int %int_2 %int_3 %int_1 + +// 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 tex3d; + +float4 main() : SV_Target { +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_3d_sampled_image]] %tex3d +// CHECK: [[sampled_result1:%[a-zA-Z0-9_]+]] = OpImageSampleImplicitLod %v4float [[tex1_load]] [[v3fc]] Bias %float_0_5 + float4 val1 = tex3d.SampleBias(float3(0.5, 0.25, 0), 0.5f); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_3d_sampled_image]] %tex3d +// CHECK: [[sampled_result2:%[a-zA-Z0-9_]+]] = OpImageSampleImplicitLod %v4float [[tex2_load]] [[v3fc]] Bias|ConstOffset %float_0_5 [[v3ic]] + float4 val2 = tex3d.SampleBias(float3(0.5, 0.25, 0), 0.5f, int3(2, 3, 1)); + +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_3d_sampled_image]] %tex3d +// CHECK: [[sampled_result3:%[a-zA-Z0-9_]+]] = OpImageSampleImplicitLod %v4float [[tex3_load]] [[v3fc]] Bias|ConstOffset|MinLod %float_0_5 [[v3ic]] %float_2_5 + float4 val3 = tex3d.SampleBias(float3(0.5, 0.25, 0), 0.5f, int3(2, 3, 1), 2.5f); + +// CHECK: [[tex4_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_3d_sampled_image]] %tex3d +// CHECK: [[sampled_result4:%[a-zA-Z0-9_]+]] = OpImageSparseSampleImplicitLod %SparseResidencyStruct [[tex4_load]] [[v3fc]] Bias|ConstOffset|MinLod %float_0_5 [[v3ic]] %float_2_5 +// CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result4]] 0 +// CHECK: OpStore %status [[status_0]] + uint status; + float4 val4 = tex3d.SampleBias(float3(0.5, 0.25, 0), 0.5f, int3(2, 3, 1), 2.5f, status); + + return 1.0; +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.sample-grad.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.sample-grad.hlsl new file mode 100644 index 0000000000..408748a2a8 --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.sample-grad.hlsl @@ -0,0 +1,39 @@ +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: OpCapability MinLod +// CHECK: OpCapability SparseResidency + +// CHECK: [[v3fc:%[0-9]+]] = OpConstantComposite %v3float %float_0_5 %float_0_25 %float_0 +// CHECK: [[v3f_1:%[0-9]+]] = OpConstantComposite %v3float %float_1 %float_1 %float_1 +// CHECK: [[v3f_2:%[0-9]+]] = OpConstantComposite %v3float %float_2 %float_2 %float_2 +// CHECK: [[v3ic:%[0-9]+]] = OpConstantComposite %v3int %int_2 %int_3 %int_1 + +// 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 tex3d; + +float4 main() : SV_Target { +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_3d_sampled_image]] %tex3d +// CHECK: [[sampled_result1:%[a-zA-Z0-9_]+]] = OpImageSampleExplicitLod %v4float [[tex1_load]] [[v3fc]] Grad [[v3f_1]] [[v3f_2]] + float4 val1 = tex3d.SampleGrad(float3(0.5, 0.25, 0), float3(1, 1, 1), float3(2, 2, 2)); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_3d_sampled_image]] %tex3d +// CHECK: [[sampled_result2:%[a-zA-Z0-9_]+]] = OpImageSampleExplicitLod %v4float [[tex2_load]] [[v3fc]] Grad|ConstOffset [[v3f_1]] [[v3f_2]] [[v3ic]] + float4 val2 = tex3d.SampleGrad(float3(0.5, 0.25, 0), float3(1, 1, 1), float3(2, 2, 2), int3(2, 3, 1)); + +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_3d_sampled_image]] %tex3d +// CHECK: [[sampled_result3:%[a-zA-Z0-9_]+]] = OpImageSampleExplicitLod %v4float [[tex3_load]] [[v3fc]] Grad|ConstOffset|MinLod [[v3f_1]] [[v3f_2]] [[v3ic]] %float_0_5 + float4 val3 = tex3d.SampleGrad(float3(0.5, 0.25, 0), float3(1, 1, 1), float3(2, 2, 2), int3(2, 3, 1), 0.5); + +// CHECK: [[tex4_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_3d_sampled_image]] %tex3d +// CHECK: [[sampled_result4:%[a-zA-Z0-9_]+]] = OpImageSparseSampleExplicitLod %SparseResidencyStruct [[tex4_load]] [[v3fc]] Grad|ConstOffset|MinLod [[v3f_1]] [[v3f_2]] [[v3ic]] %float_0_5 +// CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result4]] 0 +// CHECK: OpStore %status [[status_0]] +// CHECK: [[sampled_texel:%[a-zA-Z0-9_]+]] = OpCompositeExtract %v4float [[sampled_result4]] 1 +// CHECK: OpStore %val4 [[sampled_texel]] + uint status; + float4 val4 = tex3d.SampleGrad(float3(0.5, 0.25, 0), float3(1, 1, 1), float3(2, 2, 2), int3(2, 3, 1), 0.5, status); + + return 1.0; +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.sample-level.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.sample-level.hlsl new file mode 100644 index 0000000000..ee296a6816 --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.sample-level.hlsl @@ -0,0 +1,30 @@ +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: OpCapability SparseResidency + +// CHECK: [[v3fc:%[0-9]+]] = OpConstantComposite %v3float %float_0_5 %float_0_25 %float_0 +// CHECK: [[v3ic:%[0-9]+]] = OpConstantComposite %v3int %int_2 %int_3 %int_1 + +// 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 tex3d; + +float4 main() : SV_Target { +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_3d_sampled_image]] %tex3d +// CHECK: [[sampled_result1:%[a-zA-Z0-9_]+]] = OpImageSampleExplicitLod %v4float [[tex1_load]] [[v3fc]] Lod %float_0_5 + float4 val1 = tex3d.SampleLevel(float3(0.5, 0.25, 0), 0.5f); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_3d_sampled_image]] %tex3d +// CHECK: [[sampled_result2:%[a-zA-Z0-9_]+]] = OpImageSampleExplicitLod %v4float [[tex2_load]] [[v3fc]] Lod|ConstOffset %float_0_5 [[v3ic]] + float4 val2 = tex3d.SampleLevel(float3(0.5, 0.25, 0), 0.5f, int3(2, 3, 1)); + +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_3d_sampled_image]] %tex3d +// CHECK: [[sampled_result3:%[a-zA-Z0-9_]+]] = OpImageSparseSampleExplicitLod %SparseResidencyStruct [[tex3_load]] [[v3fc]] Lod|ConstOffset %float_0_5 [[v3ic]] +// CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result3]] 0 +// CHECK: OpStore %status [[status_0]] + uint status; + float4 val3 = tex3d.SampleLevel(float3(0.5, 0.25, 0), 0.5f, int3(2, 3, 1), status); + + return 1.0; +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.sample.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.sample.hlsl new file mode 100644 index 0000000000..82beb00d25 --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture3D/vk.sampledtexture3d.sample.hlsl @@ -0,0 +1,44 @@ +// RUN: %dxc -T ps_6_7 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: OpCapability MinLod +// CHECK: OpCapability SparseResidency + +// CHECK: [[v3fc:%[0-9]+]] = OpConstantComposite %v3float %float_0_5 %float_0_25 %float_0 +// CHECK: [[v3ic:%[0-9]+]] = OpConstantComposite %v3int %int_2 %int_3 %int_1 + +// 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]] +// CHECK: [[type_3d_image_uint:%[a-zA-Z0-9_]+]] = OpTypeImage %uint 3D 0 0 0 1 Unknown +// CHECK: [[type_3d_sampled_image_uint:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_3d_image_uint]] + +vk::SampledTexture3D tex3df4; +vk::SampledTexture3D tex3duint; +vk::SampledTexture3D tex3d_default; + +float4 main() : SV_Target { +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_3d_sampled_image]] %tex3df4 +// CHECK: [[sampled_result1:%[a-zA-Z0-9_]+]] = OpImageSampleImplicitLod %v4float [[tex1_load]] [[v3fc]] None + float4 val1 = tex3df4.Sample(float3(0.5, 0.25, 0)); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_3d_sampled_image]] %tex3d_default +// CHECK: [[sampled_result2:%[a-zA-Z0-9_]+]] = OpImageSampleImplicitLod %v4float [[tex2_load]] [[v3fc]] ConstOffset [[v3ic]] + float4 val2 = tex3d_default.Sample(float3(0.5, 0.25, 0), int3(2, 3, 1)); + +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_3d_sampled_image]] %tex3df4 +// CHECK: [[sampled_result3:%[a-zA-Z0-9_]+]] = OpImageSampleImplicitLod %v4float [[tex3_load]] [[v3fc]] ConstOffset|MinLod [[v3ic]] %float_1 + float4 val3 = tex3df4.Sample(float3(0.5, 0.25, 0), int3(2, 3, 1), 1.0f); + +// CHECK: [[tex4_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_3d_sampled_image]] %tex3df4 +// CHECK: [[sampled_result4:%[a-zA-Z0-9_]+]] = OpImageSparseSampleImplicitLod %SparseResidencyStruct [[tex4_load]] [[v3fc]] ConstOffset|MinLod [[v3ic]] %float_1 +// CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result4]] 0 +// CHECK: OpStore %status [[status_0]] + uint status; + float4 val4 = tex3df4.Sample(float3(0.5, 0.25, 0), int3(2, 3, 1), 1.0f, status); + +// CHECK: [[tex5_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_3d_sampled_image_uint]] %tex3duint +// CHECK: [[sampled_result5:%[a-zA-Z0-9_]+]] = OpImageSampleImplicitLod %v4uint [[tex5_load]] [[v3fc]] None +// CHECK: [[val5:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result5]] 0 + uint val5 = tex3duint.Sample(float3(0.5, 0.25, 0)); + + return 1.0; +} diff --git a/utils/hct/gen_intrin_main.txt b/utils/hct/gen_intrin_main.txt index 25560792ed..f688204aee 100644 --- a/utils/hct/gen_intrin_main.txt +++ b/utils/hct/gen_intrin_main.txt @@ -1512,4 +1512,33 @@ namespace VkSampledTexture2DMSArrayMethods { $classT [[]] Load(in int<3> x, in int s, in int<2> o, out uint_only status) : texture2darray_ms_o_s; } namespace +namespace VkSampledTexture3DMethods { + +float [[ro]] CalculateLevelOfDetail(in float<3> x) : tex3d_t_calc_lod; +float [[ro]] CalculateLevelOfDetailUnclamped(in float<3> x) : tex3d_t_calc_lod_unclamped; +void [[]] GetDimensions(in uint x, out uint_only width, out $type2 height, out $type2 depth, out $type2 levels) : resinfo_uint; +void [[]] GetDimensions(in uint x, out float_like width, out $type2 height, out $type2 depth, out $type2 levels) : resinfo; +void [[]] GetDimensions(out uint_only width, out $type1 height, out $type1 depth) : resinfo_uint_o; +void [[]] GetDimensions(out float_like width, out $type1 height, out $type1 depth) : resinfo_o; +$classT [[ro]] Load(in int<4> x) : tex3d_t_load; +$classT [[ro]] Load(in int<4> x, in int<3> o) : tex3d_t_load_o; +$classT [[]] Load(in int<4> x, in int<3> o, out uint_only status) : tex3d_t_load_o_s; +$classT [[ro]] Sample(in float<3> x) : tex3d_t; +$classT [[ro]] Sample(in float<3> x, in int<3> o) : tex3d_t_o; +$classT [[ro]] SampleBias(in float<3> x, in float bias) : tex3d_t_bias; +$classT [[ro]] SampleBias(in float<3> x, in float bias, in int<3> o) : tex3d_t_bias_o; +$classT [[ro]] SampleGrad(in float<3> x, in $type1 ddx, in $type1 ddy) : tex3d_t_dd; +$classT [[ro]] SampleGrad(in float<3> x, in $type1 ddx, in $type1 ddy, in int<3> o) : tex3d_t_dd_o; +$classT [[ro]] SampleLevel(in float<3> x, in float lod) : tex3d_t_lod; +$classT [[ro]] SampleLevel(in float<3> x, in float lod, in int<3> o) : tex3d_t_lod_o; +$classT [[ro]] Sample(in float<3> x, in int<3> o, in float clamp) : tex3d_t_o_cl; +$classT [[]] Sample(in float<3> x, in int<3> o, in float clamp, out uint_only status) : tex3d_t_o_cl_s; +$classT [[]] SampleLevel(in float<3> x, in float lod, in int<3> o, out uint_only status) : tex3d_t_lod_o_s; +$classT [[ro]] SampleBias(in float<3> x, in float bias, in int<3> o, in float clamp) : tex3d_t_bias_o_cl; +$classT [[]] SampleBias(in float<3> x, in float bias, in int<3> o, in float clamp, out uint_only status) : tex3d_t_bias_o_cl_s; +$classT [[]] SampleGrad(in float<3> x, in $type1 ddx, in $type1 ddy, in int<3> o, in float clamp) : tex3d_t_dd_o_cl; +$classT [[]] SampleGrad(in float<3> x, in $type1 ddx, in $type1 ddy, in int<3> o, in float clamp, out uint_only status) : tex3d_t_dd_o_cl_s; +} namespace + + // SPIRV Change Ends