diff --git a/include/dxc/dxcapi.internal.h b/include/dxc/dxcapi.internal.h index 7a83dd6d01..ca4b892748 100644 --- a/include/dxc/dxcapi.internal.h +++ b/include/dxc/dxcapi.internal.h @@ -141,7 +141,8 @@ enum LEGAL_INTRINSIC_COMPTYPES { #ifdef ENABLE_SPIRV_CODEGEN LICOMPTYPE_VK_BUFFER_POINTER = 56, LICOMPTYPE_VK_SAMPLED_TEXTURE2D = 57, - LICOMPTYPE_COUNT = 58 + LICOMPTYPE_VK_SAMPLED_TEXTURE2D_ARRAY = 58, + LICOMPTYPE_COUNT = 59 #else LICOMPTYPE_COUNT = 56 #endif diff --git a/tools/clang/lib/AST/ASTContextHLSL.cpp b/tools/clang/lib/AST/ASTContextHLSL.cpp index 1482d09a3f..bc9aa85ad6 100644 --- a/tools/clang/lib/AST/ASTContextHLSL.cpp +++ b/tools/clang/lib/AST/ASTContextHLSL.cpp @@ -1376,8 +1376,6 @@ CXXRecordDecl *hlsl::DeclareVkSampledTextureType(ASTContext &context, DeclContext *declContext, llvm::StringRef hlslTypeName, QualType defaultParamType) { - // TODO(https://github.com/microsoft/DirectXShaderCompiler/issues/7979): Later - // generalize these to all SampledTexture types. BuiltinTypeDeclBuilder Builder(declContext, hlslTypeName, TagDecl::TagKind::TTK_Struct); diff --git a/tools/clang/lib/SPIRV/AstTypeProbe.cpp b/tools/clang/lib/SPIRV/AstTypeProbe.cpp index 48c3012501..6833b443f9 100644 --- a/tools/clang/lib/SPIRV/AstTypeProbe.cpp +++ b/tools/clang/lib/SPIRV/AstTypeProbe.cpp @@ -931,7 +931,7 @@ bool isSampledTexture(QualType type) { const auto name = rt->getDecl()->getName(); // TODO(https://github.com/microsoft/DirectXShaderCompiler/issues/7979): Add // other sampled texture types as needed. - if (name == "SampledTexture2D") + if (name == "SampledTexture2D" || name == "SampledTexture2DArray") return true; } return false; diff --git a/tools/clang/lib/SPIRV/LowerTypeVisitor.cpp b/tools/clang/lib/SPIRV/LowerTypeVisitor.cpp index 38d2adf166..f057507834 100644 --- a/tools/clang/lib/SPIRV/LowerTypeVisitor.cpp +++ b/tools/clang/lib/SPIRV/LowerTypeVisitor.cpp @@ -849,7 +849,7 @@ const SpirvType *LowerTypeVisitor::lowerVkTypeInVkNamespace( assert(visitedTypeStack.size() == visitedTypeStackSize); return pointerType; } - if (name == "SampledTexture2D") { + if (name == "SampledTexture2D" || name == "SampledTexture2DArray") { const auto sampledType = hlsl::GetHLSLResourceResultType(type); auto loweredType = lowerType(getElementType(astContext, sampledType), rule, /*isRowMajor*/ llvm::None, srcLoc); @@ -860,10 +860,11 @@ const SpirvType *LowerTypeVisitor::lowerVkTypeInVkNamespace( loweredType = spvContext.getUIntType(32); } + const bool isArray = (name == "SampledTexture2DArray"); + const auto *imageType = spvContext.getImageType( - loweredType, spv::Dim::Dim2D, ImageType::WithDepth::No, - false /* array */, false /* ms */, ImageType::WithSampler::Yes, - spv::ImageFormat::Unknown); + loweredType, spv::Dim::Dim2D, ImageType::WithDepth::No, isArray, + false /* ms */, ImageType::WithSampler::Yes, spv::ImageFormat::Unknown); return spvContext.getSampledImageType(imageType); } emitError("unknown type %0 in vk namespace", srcLoc) << type; diff --git a/tools/clang/lib/SPIRV/SpirvEmitter.cpp b/tools/clang/lib/SPIRV/SpirvEmitter.cpp index ad4fe19238..7eedd5de99 100644 --- a/tools/clang/lib/SPIRV/SpirvEmitter.cpp +++ b/tools/clang/lib/SPIRV/SpirvEmitter.cpp @@ -4394,6 +4394,7 @@ SpirvEmitter::processBufferTextureGetDimensions(const CXXMemberCallExpr *expr) { if ((typeName == "Texture1D" && numArgs > 1) || (typeName == "Texture2D" && numArgs > 2) || (typeName == "SampledTexture2D" && numArgs > 2) || + (typeName == "SampledTexture2DArray" && 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 d3ed9482de..1ab813afb0 100644 --- a/tools/clang/lib/Sema/SemaHLSL.cpp +++ b/tools/clang/lib/Sema/SemaHLSL.cpp @@ -201,6 +201,7 @@ enum ArBasicKind { AR_OBJECT_VK_SPV_INTRINSIC_RESULT_ID, AR_OBJECT_VK_BUFFER_POINTER, AR_OBJECT_VK_SAMPLED_TEXTURE2D, + AR_OBJECT_VK_SAMPLED_TEXTURE2D_ARRAY, #endif // ENABLE_SPIRV_CODEGEN // SPIRV change ends @@ -562,6 +563,7 @@ const UINT g_uBasicKindProps[] = { BPROP_OBJECT, // AR_OBJECT_VK_SPV_INTRINSIC_RESULT_ID use recordType BPROP_OBJECT, // AR_OBJECT_VK_BUFFER_POINTER use recordType BPROP_OBJECT | BPROP_RBUFFER, // AR_OBJECT_VK_SAMPLED_TEXTURE2D + BPROP_OBJECT | BPROP_RBUFFER, // AR_OBJECT_VK_SAMPLED_TEXTURE2D_ARRAY #endif // ENABLE_SPIRV_CODEGEN // SPIRV change ends @@ -1272,6 +1274,8 @@ static const ArBasicKind g_VKBufferPointerCT[] = {AR_OBJECT_VK_BUFFER_POINTER, AR_BASIC_UNKNOWN}; static const ArBasicKind g_VKSampledTexture2DCT[] = { AR_OBJECT_VK_SAMPLED_TEXTURE2D, AR_BASIC_UNKNOWN}; +static const ArBasicKind g_VKSampledTexture2DArrayCT[] = { + AR_OBJECT_VK_SAMPLED_TEXTURE2D_ARRAY, AR_BASIC_UNKNOWN}; #endif // Basic kinds, indexed by a LEGAL_INTRINSIC_COMPTYPES value. @@ -1334,8 +1338,9 @@ const ArBasicKind *g_LegalIntrinsicCompTypes[] = { g_LinAlgCT, // LICOMPTYPE_LINALG g_BuiltInTrianglePositionsCT, // LICOMPTYPE_BUILTIN_TRIANGLE_POSITIONS #ifdef ENABLE_SPIRV_CODEGEN - g_VKBufferPointerCT, // LICOMPTYPE_VK_BUFFER_POINTER - g_VKSampledTexture2DCT, // LICOMPTYPE_VK_SAMPLED_TEXTURE2D + g_VKBufferPointerCT, // LICOMPTYPE_VK_BUFFER_POINTER + g_VKSampledTexture2DCT, // LICOMPTYPE_VK_SAMPLED_TEXTURE2D + g_VKSampledTexture2DArrayCT, // LICOMPTYPE_VK_SAMPLED_TEXTURE2D_ARRAY #endif }; static_assert( @@ -1396,6 +1401,7 @@ static const ArBasicKind g_ArBasicKindsAsTypes[] = { AR_OBJECT_VK_INTEGRAL_CONSTANT, AR_OBJECT_VK_LITERAL, AR_OBJECT_VK_SPV_INTRINSIC_TYPE, AR_OBJECT_VK_SPV_INTRINSIC_RESULT_ID, AR_OBJECT_VK_BUFFER_POINTER, AR_OBJECT_VK_SAMPLED_TEXTURE2D, + AR_OBJECT_VK_SAMPLED_TEXTURE2D_ARRAY, #endif // ENABLE_SPIRV_CODEGEN // SPIRV change ends @@ -1508,6 +1514,7 @@ static const uint8_t g_ArBasicKindsTemplateCount[] = { 1, // AR_OBJECT_VK_SPV_INTRINSIC_RESULT_ID 2, // AR_OBJECT_VK_BUFFER_POINTER 1, // AR_OBJECT_VK_SAMPLED_TEXTURE2D + 1, // AR_OBJECT_VK_SAMPLED_TEXTURE2D_ARRAY #endif // ENABLE_SPIRV_CODEGEN // SPIRV change ends @@ -1662,6 +1669,7 @@ static const SubscriptOperatorRecord g_ArBasicKindsSubscripts[] = { {0, MipsFalse, SampleFalse}, // AR_OBJECT_VK_SPV_INTRINSIC_RESULT_ID {0, MipsFalse, SampleFalse}, // AR_OBJECT_VK_BUFFER_POINTER {2, MipsTrue, SampleFalse}, // AR_OBJECT_VK_SAMPLED_TEXTURE2D + {3, MipsTrue, SampleFalse}, // AR_OBJECT_VK_SAMPLED_TEXTURE2D_ARRAY #endif // ENABLE_SPIRV_CODEGEN // SPIRV change ends @@ -1832,6 +1840,7 @@ static const char *g_ArBasicTypeNames[] = { "ext_result_id", "BufferPointer", "SampledTexture2D", + "SampledTexture2DArray", #endif // ENABLE_SPIRV_CODEGEN // SPIRV change ends @@ -2489,6 +2498,10 @@ static void GetIntrinsicMethods(ArBasicKind kind, *intrinsics = g_VkSampledTexture2DMethods; *intrinsicCount = _countof(g_VkSampledTexture2DMethods); break; + case AR_OBJECT_VK_SAMPLED_TEXTURE2D_ARRAY: + *intrinsics = g_VkSampledTexture2DArrayMethods; + *intrinsicCount = _countof(g_VkSampledTexture2DArrayMethods); + break; #endif case AR_OBJECT_HIT_OBJECT: *intrinsics = g_DxHitObjectMethods; @@ -4094,13 +4107,14 @@ class HLSLExternalSource : public ExternalSemaSource { recordDecl = DeclareVkBufferPointerType(*m_context, m_vkNSDecl); recordDecl->setImplicit(true); m_vkBufferPointerTemplateDecl = recordDecl->getDescribedClassTemplate(); - } else if (kind == AR_OBJECT_VK_SAMPLED_TEXTURE2D) { + } else if (kind == AR_OBJECT_VK_SAMPLED_TEXTURE2D || + kind == AR_OBJECT_VK_SAMPLED_TEXTURE2D_ARRAY) { if (!m_vkNSDecl) continue; QualType float4Type = LookupVectorType(HLSLScalarType::HLSLScalarType_float, 4); recordDecl = DeclareVkSampledTextureType( - *m_context, m_vkNSDecl, "SampledTexture2D", float4Type); + *m_context, m_vkNSDecl, g_ArBasicTypeNames[kind], float4Type); if (Attr) recordDecl->addAttr(Attr); m_vkSampledTextureTemplateDecl = @@ -5060,6 +5074,9 @@ class HLSLExternalSource : public ExternalSemaSource { ResClass = DXIL::ResourceClass::UAV; return true; case AR_OBJECT_TEXTURE2D_ARRAY: +#ifdef ENABLE_SPIRV_CODEGEN + case AR_OBJECT_VK_SAMPLED_TEXTURE2D_ARRAY: +#endif ResKind = DXIL::ResourceKind::Texture2DArray; ResClass = DXIL::ResourceClass::SRV; return true; diff --git a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.access.hlsl b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.access.hlsl index cd5d443eeb..afd60d101a 100644 --- a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.access.hlsl +++ b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.access.hlsl @@ -2,21 +2,29 @@ // CHECK: [[cu12:%[0-9]+]] = OpConstantComposite %v2uint %uint_1 %uint_2 -// CHECK: [[type_2d_image_1:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown -// CHECK: [[type_sampled_image_1:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_1]] -// CHECK: [[ptr_type_1:%[a-zA-Z0-9_]+]] = OpTypePointer UniformConstant [[type_sampled_image_1]] +// CHECK: [[type_2d_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown +// CHECK: [[type_2d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image]] +// CHECK: [[type_2d_image_array:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 1 0 1 Unknown +// CHECK: [[type_2d_sampled_image_array:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_array]] -// CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpVariable [[ptr_type_1]] UniformConstant - -vk::SampledTexture2D tex1 : register(t1); +vk::SampledTexture2D tex2d; +vk::SampledTexture2DArray tex2dArray; void main() { // CHECK: OpStore %pos1 [[cu12]] // CHECK-NEXT: [[pos1:%[0-9]+]] = OpLoad %v2uint %pos1 -// CHECK-NEXT: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] -// CHECK-NEXT: [[tex_img:%[0-9]+]] = OpImage [[type_2d_image_1]] [[tex1_load]] +// CHECK-NEXT: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d +// CHECK-NEXT: [[tex_img:%[0-9]+]] = OpImage [[type_2d_image]] [[tex1_load]] // CHECK-NEXT: [[result1:%[0-9]+]] = OpImageFetch %v4float [[tex_img]] [[pos1]] Lod %uint_0 // CHECK-NEXT: OpStore %a1 [[result1]] uint2 pos1 = uint2(1,2); - float4 a1 = tex1[pos1]; + float4 a1 = tex2d[pos1]; + +// CHECK: [[pos2:%[0-9]+]] = OpLoad %v3uint %pos2 +// CHECK-NEXT: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image_array]] %tex2dArray +// CHECK-NEXT: [[tex2_img:%[0-9]+]] = OpImage [[type_2d_image_array]] [[tex2_load]] +// CHECK-NEXT: [[result2:%[0-9]+]] = OpImageFetch %v4float [[tex2_img]] [[pos2]] Lod %uint_0 +// CHECK-NEXT: OpStore %a2 [[result2]] + uint3 pos2 = uint3(1,2,3); + float4 a2 = tex2dArray[pos2]; } diff --git a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.calculate-lod-unclamped.hlsl b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.calculate-lod-unclamped.hlsl index aebc57738b..e390cf26f3 100644 --- a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.calculate-lod-unclamped.hlsl +++ b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.calculate-lod-unclamped.hlsl @@ -2,20 +2,26 @@ // CHECK: OpCapability ImageQuery -vk::SampledTexture2D t1 : register(t0); +// CHECK: [[type_2d_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown +// CHECK: [[type_2d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image]] +// CHECK: [[type_2d_image_array:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 1 0 1 Unknown +// CHECK: [[type_2d_sampled_image_array:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_array]] -// CHECK: %type_2d_image = OpTypeImage %float 2D 0 0 0 1 Unknown -// CHECK: %type_sampled_image = OpTypeSampledImage %type_2d_image -// CHECK: [[ptr:%[a-zA-Z0-9_]+]] = OpTypePointer UniformConstant %type_sampled_image - -// CHECK: %t1 = OpVariable [[ptr]] UniformConstant +vk::SampledTexture2D tex2d; +vk::SampledTexture2DArray tex2dArray; void main() { float2 xy = float2(0.5, 0.5); -//CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %t1 +//CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d //CHECK-NEXT: [[xy_load:%[a-zA-Z0-9_]+]] = OpLoad %v2float %xy -//CHECK-NEXT: [[query:%[a-zA-Z0-9_]+]] = OpImageQueryLod %v2float [[tex1]] [[xy_load]] +//CHECK-NEXT: [[query:%[a-zA-Z0-9_]+]] = OpImageQueryLod %v2float [[tex1_load]] [[xy_load]] //CHECK-NEXT: {{%[0-9]+}} = OpCompositeExtract %float [[query]] 1 - float lod1 = t1.CalculateLevelOfDetailUnclamped(xy); + float lod1 = tex2d.CalculateLevelOfDetailUnclamped(xy); + +//CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image_array]] %tex2dArray +//CHECK-NEXT: [[xy_load_2:%[a-zA-Z0-9_]+]] = OpLoad %v2float %xy +//CHECK-NEXT: [[query2:%[a-zA-Z0-9_]+]] = OpImageQueryLod %v2float [[tex2_load]] [[xy_load_2]] +//CHECK-NEXT: {{%[0-9]+}} = OpCompositeExtract %float [[query2]] 1 + float lod2 = tex2dArray.CalculateLevelOfDetailUnclamped(xy); } \ No newline at end of file diff --git a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.calculate-lod.hlsl b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.calculate-lod.hlsl index 01d3efb5aa..15aaaf1956 100644 --- a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.calculate-lod.hlsl +++ b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.calculate-lod.hlsl @@ -2,20 +2,26 @@ // CHECK: OpCapability ImageQuery -vk::SampledTexture2D t1 : register(t0); +// CHECK: [[type_2d_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown +// CHECK: [[type_2d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image]] +// CHECK: [[type_2d_image_array:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 1 0 1 Unknown +// CHECK: [[type_2d_sampled_image_array:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_array]] -// CHECK: %type_2d_image = OpTypeImage %float 2D 0 0 0 1 Unknown -// CHECK: %type_sampled_image = OpTypeSampledImage %type_2d_image -// CHECK: [[ptr:%[a-zA-Z0-9_]+]] = OpTypePointer UniformConstant %type_sampled_image - -// CHECK: %t1 = OpVariable [[ptr]] UniformConstant +vk::SampledTexture2D tex2d; +vk::SampledTexture2DArray tex2dArray; void main() { float2 xy = float2(0.5, 0.5); -//CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %t1 +//CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d //CHECK-NEXT: [[xy_load:%[a-zA-Z0-9_]+]] = OpLoad %v2float %xy //CHECK-NEXT: [[query:%[a-zA-Z0-9_]+]] = OpImageQueryLod %v2float [[tex1]] [[xy_load]] //CHECK-NEXT: {{%[0-9]+}} = OpCompositeExtract %float [[query]] 0 - float lod = t1.CalculateLevelOfDetail(xy); + float lod = tex2d.CalculateLevelOfDetail(xy); + +//CHECK: [[tex2:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image_array]] %tex2dArray +//CHECK-NEXT: [[xy_load_2:%[a-zA-Z0-9_]+]] = OpLoad %v2float %xy +//CHECK-NEXT: [[query2:%[a-zA-Z0-9_]+]] = OpImageQueryLod %v2float [[tex2]] [[xy_load_2]] +//CHECK-NEXT: {{%[0-9]+}} = OpCompositeExtract %float [[query2]] 0 + float lod2 = tex2dArray.CalculateLevelOfDetail(xy); } diff --git a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.cmp-level.hlsl b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.cmp-level.hlsl index 4dd8dec8af..d645ce5464 100644 --- a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.cmp-level.hlsl +++ b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.cmp-level.hlsl @@ -4,29 +4,35 @@ // CHECK: [[v2fc:%[0-9]+]] = OpConstantComposite %v2float %float_0_5 %float_0_25 // CHECK: [[v2ic:%[0-9]+]] = OpConstantComposite %v2int %int_2 %int_3 +// CHECK: [[v3fc:%[0-9]+]] = OpConstantComposite %v3float %float_0_5 %float_0_25 %float_0 -// CHECK: [[type_2d_image_1:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown -// CHECK: [[type_sampled_image_1:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_1]] -// CHECK: [[ptr_type_1:%[a-zA-Z0-9_]+]] = OpTypePointer UniformConstant [[type_sampled_image_1]] +// CHECK: [[type_2d_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown +// CHECK: [[type_2d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image]] +// CHECK: [[type_2d_image_array:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 1 0 1 Unknown +// CHECK: [[type_2d_sampled_image_array:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_array]] -// CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpVariable [[ptr_type_1]] UniformConstant - -vk::SampledTexture2D tex1 : register(t0); +vk::SampledTexture2D tex2d; +vk::SampledTexture2DArray tex2dArray; float4 main() : SV_Target { -// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[sampled_result1:%[a-zA-Z0-9_]+]] = OpImageSampleDrefExplicitLod %float [[tex1_load]] [[v2fc]] %float_2 Lod %float_1 - float val1 = tex1.SampleCmpLevel(float2(0.5, 0.25), 2.0f, 1.0f); + float val1 = tex2d.SampleCmpLevel(float2(0.5, 0.25), 2.0f, 1.0f); -// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[sampled_result2:%[a-zA-Z0-9_]+]] = OpImageSampleDrefExplicitLod %float [[tex2_load]] [[v2fc]] %float_2 Lod|ConstOffset %float_1 [[v2ic]] - float val2 = tex1.SampleCmpLevel(float2(0.5, 0.25), 2.0f, 1.0f, int2(2,3)); + float val2 = tex2d.SampleCmpLevel(float2(0.5, 0.25), 2.0f, 1.0f, int2(2,3)); -// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[sampled_result3:%[a-zA-Z0-9_]+]] = OpImageSparseSampleDrefExplicitLod %SparseResidencyStruct [[tex3_load]] [[v2fc]] %float_2 Lod|ConstOffset %float_1 [[v2ic]] // CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result3]] 0 // CHECK: OpStore %status [[status_0]] uint status; - float val3 = tex1.SampleCmpLevel(float2(0.5, 0.25), 2.0f, 1.0f, int2(2,3), status); + float val3 = tex2d.SampleCmpLevel(float2(0.5, 0.25), 2.0f, 1.0f, int2(2,3), status); + +// CHECK: [[load_arr1:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image_array]] %tex2dArray +// CHECK: [[sampled_arr1:%[a-zA-Z0-9_]+]] = OpImageSampleDrefExplicitLod %float [[load_arr1]] [[v3fc]] %float_2 Lod %float_1 + float val4 = tex2dArray.SampleCmpLevel(float3(0.5, 0.25, 0), 2.0f, 1.0f); + return 1.0; } diff --git a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.gather-alpha.hlsl b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.gather-alpha.hlsl index e08c9a770c..f4faea0f8a 100644 --- a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.gather-alpha.hlsl +++ b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.gather-alpha.hlsl @@ -4,51 +4,54 @@ // CHECK: [[v2fc:%[0-9]+]] = OpConstantComposite %v2float %float_0_5 %float_0_25 // CHECK: [[v2ic:%[0-9]+]] = OpConstantComposite %v2int %int_2 %int_3 +// CHECK: [[v3fc:%[0-9]+]] = OpConstantComposite %v3float %float_0_5 %float_0_25 %float_0 -// CHECK: [[type_2d_image_1:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown -// CHECK: [[type_sampled_image_1:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_1]] -// CHECK: [[ptr_type_1:%[a-zA-Z0-9_]+]] = OpTypePointer UniformConstant [[type_sampled_image_1]] +// CHECK: [[type_2d_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown +// CHECK: [[type_2d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image]] +// CHECK: [[type_2d_image_array:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 1 0 1 Unknown +// CHECK: [[type_2d_sampled_image_array:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_array]] -// CHECK: [[type_struct_result:%[a-zA-Z0-9_]+]] = OpTypeStruct %uint %v4float - -// CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpVariable [[ptr_type_1]] UniformConstant - -vk::SampledTexture2D tex1 : register(t1); +vk::SampledTexture2D tex2d; +vk::SampledTexture2DArray tex2dArray; float4 main() : SV_Target { uint status; float4 val = 0; -// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[val_alpha:%[a-zA-Z0-9_]+]] = OpImageGather %v4float [[tex1_load]] [[v2fc]] %int_3 // CHECK: OpStore %val [[val_alpha]] - val = tex1.GatherAlpha(float2(0.5, 0.25)); + val = tex2d.GatherAlpha(float2(0.5, 0.25)); -// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[val_alpha_o:%[a-zA-Z0-9_]+]] = OpImageGather %v4float [[tex1_load]] [[v2fc]] %int_3 ConstOffset [[v2ic]] // CHECK: OpStore %val [[val_alpha_o]] - val = tex1.GatherAlpha(float2(0.5, 0.25), int2(2, 3)); + val = tex2d.GatherAlpha(float2(0.5, 0.25), int2(2, 3)); -// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[val_alpha_o4:%[a-zA-Z0-9_]+]] = OpImageGather %v4float [[tex1_load]] [[v2fc]] %int_3 ConstOffsets [[const_offsets:%[a-zA-Z0-9_]+]] // CHECK: OpStore %val [[val_alpha_o4]] - val = tex1.GatherAlpha(float2(0.5, 0.25), int2(1, 2), int2(3, 4), int2(5, 6), int2(7, 8)); + val = tex2d.GatherAlpha(float2(0.5, 0.25), int2(1, 2), int2(3, 4), int2(5, 6), int2(7, 8)); -// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] -// CHECK: [[val_alpha_s:%[a-zA-Z0-9_]+]] = OpImageSparseGather [[type_struct_result]] [[tex1_load]] [[v2fc]] %int_3 ConstOffset [[v2ic]] +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d +// CHECK: [[val_alpha_s:%[a-zA-Z0-9_]+]] = OpImageSparseGather %SparseResidencyStruct [[tex1_load]] [[v2fc]] %int_3 ConstOffset [[v2ic]] // CHECK: [[status_alpha_s:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[val_alpha_s]] 0 // CHECK: OpStore %status [[status_alpha_s]] // CHECK: [[res_alpha_s:%[a-zA-Z0-9_]+]] = OpCompositeExtract %v4float [[val_alpha_s]] 1 // CHECK: OpStore %val [[res_alpha_s]] - val = tex1.GatherAlpha(float2(0.5, 0.25), int2(2, 3), status); + val = tex2d.GatherAlpha(float2(0.5, 0.25), int2(2, 3), status); -// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] -// CHECK: [[val_alpha_o4_s:%[a-zA-Z0-9_]+]] = OpImageSparseGather [[type_struct_result]] [[tex1_load]] [[v2fc]] %int_3 ConstOffsets [[const_offsets]] +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d +// CHECK: [[val_alpha_o4_s:%[a-zA-Z0-9_]+]] = OpImageSparseGather %SparseResidencyStruct [[tex1_load]] [[v2fc]] %int_3 ConstOffsets [[const_offsets]] // CHECK: [[status_alpha_o4_s:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[val_alpha_o4_s]] 0 // CHECK: OpStore %status [[status_alpha_o4_s]] // CHECK: [[res_alpha_o4_s:%[a-zA-Z0-9_]+]] = OpCompositeExtract %v4float [[val_alpha_o4_s]] 1 // CHECK: OpStore %val [[res_alpha_o4_s]] - val = tex1.GatherAlpha(float2(0.5, 0.25), int2(1, 2), int2(3, 4), int2(5, 6), int2(7, 8), status); + val = tex2d.GatherAlpha(float2(0.5, 0.25), int2(1, 2), int2(3, 4), int2(5, 6), int2(7, 8), status); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image_array]] %tex2dArray +// CHECK: [[val_alpha_array:%[a-zA-Z0-9_]+]] = OpImageGather %v4float [[tex2_load]] [[v3fc]] %int_3 None + val = tex2dArray.GatherAlpha(float3(0.5, 0.25, 0)); return val; } diff --git a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.gather-blue.hlsl b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.gather-blue.hlsl index cdf3e1eb6b..387b1cf71f 100644 --- a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.gather-blue.hlsl +++ b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.gather-blue.hlsl @@ -4,51 +4,55 @@ // CHECK: [[v2fc:%[0-9]+]] = OpConstantComposite %v2float %float_0_5 %float_0_25 // CHECK: [[v2ic:%[0-9]+]] = OpConstantComposite %v2int %int_2 %int_3 +// CHECK: [[v3fc:%[0-9]+]] = OpConstantComposite %v3float %float_0_5 %float_0_25 %float_0 -// CHECK: [[type_2d_image_1:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown -// CHECK: [[type_sampled_image_1:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_1]] -// CHECK: [[ptr_type_1:%[a-zA-Z0-9_]+]] = OpTypePointer UniformConstant [[type_sampled_image_1]] +// CHECK: [[type_2d_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown +// CHECK: [[type_2d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image]] +// CHECK: [[type_2d_image_array:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 1 0 1 Unknown +// CHECK: [[type_2d_sampled_image_array:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_array]] -// CHECK: [[type_struct_result:%[a-zA-Z0-9_]+]] = OpTypeStruct %uint %v4float +vk::SampledTexture2D tex2d; +vk::SampledTexture2DArray tex2dArray; -// CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpVariable [[ptr_type_1]] UniformConstant - -vk::SampledTexture2D tex1 : register(t1); float4 main() : SV_Target { uint status; float4 val = 0; -// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[val_blue:%[a-zA-Z0-9_]+]] = OpImageGather %v4float [[tex1_load]] [[v2fc]] %int_2 // CHECK: OpStore %val [[val_blue]] - val = tex1.GatherBlue(float2(0.5, 0.25)); + val = tex2d.GatherBlue(float2(0.5, 0.25)); -// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[val_blue_o:%[a-zA-Z0-9_]+]] = OpImageGather %v4float [[tex1_load]] [[v2fc]] %int_2 ConstOffset [[v2ic]] // CHECK: OpStore %val [[val_blue_o]] - val = tex1.GatherBlue(float2(0.5, 0.25), int2(2, 3)); + val = tex2d.GatherBlue(float2(0.5, 0.25), int2(2, 3)); -// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[val_blue_o4:%[a-zA-Z0-9_]+]] = OpImageGather %v4float [[tex1_load]] [[v2fc]] %int_2 ConstOffsets [[const_offsets:%[a-zA-Z0-9_]+]] // CHECK: OpStore %val [[val_blue_o4]] - val = tex1.GatherBlue(float2(0.5, 0.25), int2(1, 2), int2(3, 4), int2(5, 6), int2(7, 8)); + val = tex2d.GatherBlue(float2(0.5, 0.25), int2(1, 2), int2(3, 4), int2(5, 6), int2(7, 8)); -// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] -// CHECK: [[val_blue_s:%[a-zA-Z0-9_]+]] = OpImageSparseGather [[type_struct_result]] [[tex1_load]] [[v2fc]] %int_2 ConstOffset [[v2ic]] +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d +// CHECK: [[val_blue_s:%[a-zA-Z0-9_]+]] = OpImageSparseGather %SparseResidencyStruct [[tex1_load]] [[v2fc]] %int_2 ConstOffset [[v2ic]] // CHECK: [[status_blue_s:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[val_blue_s]] 0 // CHECK: OpStore %status [[status_blue_s]] // CHECK: [[res_blue_s:%[a-zA-Z0-9_]+]] = OpCompositeExtract %v4float [[val_blue_s]] 1 // CHECK: OpStore %val [[res_blue_s]] - val = tex1.GatherBlue(float2(0.5, 0.25), int2(2, 3), status); + val = tex2d.GatherBlue(float2(0.5, 0.25), int2(2, 3), status); -// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] -// CHECK: [[val_blue_o4_s:%[a-zA-Z0-9_]+]] = OpImageSparseGather [[type_struct_result]] [[tex1_load]] [[v2fc]] %int_2 ConstOffsets [[const_offsets]] +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d +// CHECK: [[val_blue_o4_s:%[a-zA-Z0-9_]+]] = OpImageSparseGather %SparseResidencyStruct [[tex1_load]] [[v2fc]] %int_2 ConstOffsets [[const_offsets]] // CHECK: [[status_blue_o4_s:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[val_blue_o4_s]] 0 // CHECK: OpStore %status [[status_blue_o4_s]] // CHECK: [[res_blue_o4_s:%[a-zA-Z0-9_]+]] = OpCompositeExtract %v4float [[val_blue_o4_s]] 1 // CHECK: OpStore %val [[res_blue_o4_s]] - val = tex1.GatherBlue(float2(0.5, 0.25), int2(1, 2), int2(3, 4), int2(5, 6), int2(7, 8), status); + val = tex2d.GatherBlue(float2(0.5, 0.25), int2(1, 2), int2(3, 4), int2(5, 6), int2(7, 8), status); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image_array]] %tex2dArray +// CHECK: [[val_blue_array:%[a-zA-Z0-9_]+]] = OpImageGather %v4float [[tex2_load]] [[v3fc]] %int_2 None + val = tex2dArray.GatherBlue(float3(0.5, 0.25, 0)); return val; } diff --git a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.gather-cmp-red.hlsl b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.gather-cmp-red.hlsl index fb3fd22114..a742f28820 100644 --- a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.gather-cmp-red.hlsl +++ b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.gather-cmp-red.hlsl @@ -4,51 +4,55 @@ // CHECK: [[v2fc:%[0-9]+]] = OpConstantComposite %v2float %float_0_5 %float_0_25 // CHECK: [[v2ic:%[0-9]+]] = OpConstantComposite %v2int %int_2 %int_3 +// CHECK: [[v3fc:%[0-9]+]] = OpConstantComposite %v3float %float_0_5 %float_0_25 %float_0 -// CHECK: [[type_2d_image_1:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown -// CHECK: [[type_sampled_image_1:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_1]] -// CHECK: [[ptr_type_1:%[a-zA-Z0-9_]+]] = OpTypePointer UniformConstant [[type_sampled_image_1]] +// CHECK: [[type_2d_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown +// CHECK: [[type_2d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image]] +// CHECK: [[type_2d_image_array:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 1 0 1 Unknown +// CHECK: [[type_2d_sampled_image_array:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_array]] -// CHECK: [[type_struct_result:%[a-zA-Z0-9_]+]] = OpTypeStruct %uint %v4float - -// CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpVariable [[ptr_type_1]] UniformConstant - -vk::SampledTexture2D tex1 : register(t1); +vk::SampledTexture2D tex2d; +vk::SampledTexture2DArray tex2dArray; float4 main() : SV_Target { uint status; float4 val = 0; -// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[val_red:%[a-zA-Z0-9_]+]] = OpImageDrefGather %v4float [[tex1_load]] [[v2fc]] %float_0_5 None // CHECK: OpStore %val [[val_red]] - val = tex1.GatherCmpRed(float2(0.5, 0.25), 0.5); + val = tex2d.GatherCmpRed(float2(0.5, 0.25), 0.5); -// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[val_red_o:%[a-zA-Z0-9_]+]] = OpImageDrefGather %v4float [[tex1_load]] [[v2fc]] %float_0_5 ConstOffset [[v2ic]] // CHECK: OpStore %val [[val_red_o]] - val = tex1.GatherCmpRed(float2(0.5, 0.25), 0.5, int2(2, 3)); + val = tex2d.GatherCmpRed(float2(0.5, 0.25), 0.5, int2(2, 3)); -// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[val_red_o4:%[a-zA-Z0-9_]+]] = OpImageDrefGather %v4float [[tex1_load]] [[v2fc]] %float_0_5 ConstOffsets [[const_offsets:%[a-zA-Z0-9_]+]] // CHECK: OpStore %val [[val_red_o4]] - val = tex1.GatherCmpRed(float2(0.5, 0.25), 0.5, int2(1, 2), int2(3, 4), int2(5, 6), int2(7, 8)); + val = tex2d.GatherCmpRed(float2(0.5, 0.25), 0.5, int2(1, 2), int2(3, 4), int2(5, 6), int2(7, 8)); -// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] -// CHECK: [[val_cmp_s:%[a-zA-Z0-9_]+]] = OpImageSparseDrefGather [[type_struct_result]] [[tex1_load]] [[v2fc]] %float_0_5 ConstOffset [[v2ic]] +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d +// CHECK: [[val_cmp_s:%[a-zA-Z0-9_]+]] = OpImageSparseDrefGather %SparseResidencyStruct [[tex1_load]] [[v2fc]] %float_0_5 ConstOffset [[v2ic]] // CHECK: [[status_cmp_s:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[val_cmp_s]] 0 // CHECK: OpStore %status [[status_cmp_s]] // CHECK: [[res_cmp_s:%[a-zA-Z0-9_]+]] = OpCompositeExtract %v4float [[val_cmp_s]] 1 // CHECK: OpStore %val [[res_cmp_s]] - val = tex1.GatherCmpRed(float2(0.5, 0.25), 0.5, int2(2, 3), status); + val = tex2d.GatherCmpRed(float2(0.5, 0.25), 0.5, int2(2, 3), status); -// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] -// CHECK: [[val_cmp_o4_s:%[a-zA-Z0-9_]+]] = OpImageSparseDrefGather [[type_struct_result]] [[tex1_load]] [[v2fc]] %float_0_5 ConstOffsets [[const_offsets]] +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d +// CHECK: [[val_cmp_o4_s:%[a-zA-Z0-9_]+]] = OpImageSparseDrefGather %SparseResidencyStruct [[tex1_load]] [[v2fc]] %float_0_5 ConstOffsets [[const_offsets]] // CHECK: [[status_cmp_o4_s:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[val_cmp_o4_s]] 0 // CHECK: OpStore %status [[status_cmp_o4_s]] // CHECK: [[res_cmp_o4_s:%[a-zA-Z0-9_]+]] = OpCompositeExtract %v4float [[val_cmp_o4_s]] 1 // CHECK: OpStore %val [[res_cmp_o4_s]] - val = tex1.GatherCmpRed(float2(0.5, 0.25), 0.5, int2(1, 2), int2(3, 4), int2(5, 6), int2(7, 8), status); + val = tex2d.GatherCmpRed(float2(0.5, 0.25), 0.5, int2(1, 2), int2(3, 4), int2(5, 6), int2(7, 8), status); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image_array]] %tex2dArray +// CHECK: [[val_red_array:%[a-zA-Z0-9_]+]] = OpImageDrefGather %v4float [[tex2_load]] [[v3fc]] %float_0_5 None +// CHECK: OpStore %val [[val_red_array]] + val = tex2dArray.GatherCmpRed(float3(0.5, 0.25, 0), 0.5); return val; } diff --git a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.gather-cmp.hlsl b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.gather-cmp.hlsl index 346669f05d..199e89f721 100644 --- a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.gather-cmp.hlsl +++ b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.gather-cmp.hlsl @@ -4,37 +4,42 @@ // CHECK: [[v2fc:%[0-9]+]] = OpConstantComposite %v2float %float_0_5 %float_0_25 // CHECK: [[v2ic:%[0-9]+]] = OpConstantComposite %v2int %int_1 %int_2 +// CHECK: [[v3fc:%[0-9]+]] = OpConstantComposite %v3float %float_0_5 %float_0_25 %float_0 -// CHECK: [[type_2d_image_1:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown -// CHECK: [[type_sampled_image_1:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_1]] -// CHECK: [[ptr_type_1:%[a-zA-Z0-9_]+]] = OpTypePointer UniformConstant [[type_sampled_image_1]] -// CHECK: [[type_struct_result:%[a-zA-Z0-9_]+]] = OpTypeStruct %uint %v4float +// CHECK: [[type_2d_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown +// CHECK: [[type_2d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image]] +// CHECK: [[type_2d_image_array:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 1 0 1 Unknown +// CHECK: [[type_2d_sampled_image_array:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_array]] -// CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpVariable [[ptr_type_1]] UniformConstant - -vk::SampledTexture2D tex1 : register(t1); +vk::SampledTexture2D tex2d; +vk::SampledTexture2DArray tex2dArray; float4 main() : SV_Target { uint status; float4 val = 0; -// CHECK: [[tex1_load_1:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex1_load_1:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[val_1:%[a-zA-Z0-9_]+]] = OpImageDrefGather %v4float [[tex1_load_1]] [[v2fc]] %float_0_5 // CHECK: OpStore %val [[val_1]] - val = tex1.GatherCmp(float2(0.5, 0.25), 0.5); + val = tex2d.GatherCmp(float2(0.5, 0.25), 0.5); -// CHECK: [[tex1_load_2:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex1_load_2:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[val_2:%[a-zA-Z0-9_]+]] = OpImageDrefGather %v4float [[tex1_load_2]] [[v2fc]] %float_0_5 ConstOffset [[v2ic]] // CHECK: OpStore %val [[val_2]] - val = tex1.GatherCmp(float2(0.5, 0.25), 0.5, int2(1, 2)); + val = tex2d.GatherCmp(float2(0.5, 0.25), 0.5, int2(1, 2)); -// CHECK: [[tex1_load_3:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] -// CHECK: [[val_struct:%[a-zA-Z0-9_]+]] = OpImageSparseDrefGather [[type_struct_result]] [[tex1_load_3]] [[v2fc]] %float_0_5 ConstOffset [[v2ic]] +// CHECK: [[tex1_load_3:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d +// CHECK: [[val_struct:%[a-zA-Z0-9_]+]] = OpImageSparseDrefGather %SparseResidencyStruct [[tex1_load_3]] [[v2fc]] %float_0_5 ConstOffset [[v2ic]] // CHECK: [[status_1:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[val_struct]] 0 // CHECK: OpStore %status [[status_1]] // CHECK: [[res_1:%[a-zA-Z0-9_]+]] = OpCompositeExtract %v4float [[val_struct]] 1 // CHECK: OpStore %val [[res_1]] - val = tex1.GatherCmp(float2(0.5, 0.25), 0.5, int2(1, 2), status); + val = tex2d.GatherCmp(float2(0.5, 0.25), 0.5, int2(1, 2), status); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image_array]] %tex2dArray +// CHECK: [[val_3:%[a-zA-Z0-9_]+]] = OpImageDrefGather %v4float [[tex2_load]] [[v3fc]] %float_0_5 None +// CHECK: OpStore %val [[val_3]] + val = tex2dArray.GatherCmp(float3(0.5, 0.25, 0), 0.5); return val; } diff --git a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.gather-green.hlsl b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.gather-green.hlsl index d9fd0cb94d..29e87b9214 100644 --- a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.gather-green.hlsl +++ b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.gather-green.hlsl @@ -4,51 +4,54 @@ // CHECK: [[v2fc:%[0-9]+]] = OpConstantComposite %v2float %float_0_5 %float_0_25 // CHECK: [[v2ic:%[0-9]+]] = OpConstantComposite %v2int %int_2 %int_3 +// CHECK: [[v3fc:%[0-9]+]] = OpConstantComposite %v3float %float_0_5 %float_0_25 %float_0 -// CHECK: [[type_2d_image_1:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown -// CHECK: [[type_sampled_image_1:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_1]] -// CHECK: [[ptr_type_1:%[a-zA-Z0-9_]+]] = OpTypePointer UniformConstant [[type_sampled_image_1]] +// CHECK: [[type_2d_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown +// CHECK: [[type_2d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image]] +// CHECK: [[type_2d_image_array:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 1 0 1 Unknown +// CHECK: [[type_2d_sampled_image_array:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_array]] -// CHECK: [[type_struct_result:%[a-zA-Z0-9_]+]] = OpTypeStruct %uint %v4float - -// CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpVariable [[ptr_type_1]] UniformConstant - -vk::SampledTexture2D tex1 : register(t1); +vk::SampledTexture2D tex2d; +vk::SampledTexture2DArray tex2dArray; float4 main() : SV_Target { uint status; float4 val = 0; -// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[val_green:%[a-zA-Z0-9_]+]] = OpImageGather %v4float [[tex1_load]] [[v2fc]] %int_1 // CHECK: OpStore %val [[val_green]] - val = tex1.GatherGreen(float2(0.5, 0.25)); + val = tex2d.GatherGreen(float2(0.5, 0.25)); -// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[val_green_o:%[a-zA-Z0-9_]+]] = OpImageGather %v4float [[tex1_load]] [[v2fc]] %int_1 ConstOffset [[v2ic]] // CHECK: OpStore %val [[val_green_o]] - val = tex1.GatherGreen(float2(0.5, 0.25), int2(2, 3)); + val = tex2d.GatherGreen(float2(0.5, 0.25), int2(2, 3)); -// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[val_green_o4:%[a-zA-Z0-9_]+]] = OpImageGather %v4float [[tex1_load]] [[v2fc]] %int_1 ConstOffsets [[const_offsets:%[a-zA-Z0-9_]+]] // CHECK: OpStore %val [[val_green_o4]] - val = tex1.GatherGreen(float2(0.5, 0.25), int2(1, 2), int2(3, 4), int2(5, 6), int2(7, 8)); + val = tex2d.GatherGreen(float2(0.5, 0.25), int2(1, 2), int2(3, 4), int2(5, 6), int2(7, 8)); -// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] -// CHECK: [[val_green_s:%[a-zA-Z0-9_]+]] = OpImageSparseGather [[type_struct_result]] [[tex1_load]] [[v2fc]] %int_1 ConstOffset [[v2ic]] +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d +// CHECK: [[val_green_s:%[a-zA-Z0-9_]+]] = OpImageSparseGather %SparseResidencyStruct [[tex1_load]] [[v2fc]] %int_1 ConstOffset [[v2ic]] // CHECK: [[status_green_s:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[val_green_s]] 0 // CHECK: OpStore %status [[status_green_s]] // CHECK: [[res_green_s:%[a-zA-Z0-9_]+]] = OpCompositeExtract %v4float [[val_green_s]] 1 // CHECK: OpStore %val [[res_green_s]] - val = tex1.GatherGreen(float2(0.5, 0.25), int2(2, 3), status); + val = tex2d.GatherGreen(float2(0.5, 0.25), int2(2, 3), status); -// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] -// CHECK: [[val_green_o4_s:%[a-zA-Z0-9_]+]] = OpImageSparseGather [[type_struct_result]] [[tex1_load]] [[v2fc]] %int_1 ConstOffsets [[const_offsets]] +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d +// CHECK: [[val_green_o4_s:%[a-zA-Z0-9_]+]] = OpImageSparseGather %SparseResidencyStruct [[tex1_load]] [[v2fc]] %int_1 ConstOffsets [[const_offsets]] // CHECK: [[status_green_o4_s:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[val_green_o4_s]] 0 // CHECK: OpStore %status [[status_green_o4_s]] // CHECK: [[res_green_o4_s:%[a-zA-Z0-9_]+]] = OpCompositeExtract %v4float [[val_green_o4_s]] 1 // CHECK: OpStore %val [[res_green_o4_s]] - val = tex1.GatherGreen(float2(0.5, 0.25), int2(1, 2), int2(3, 4), int2(5, 6), int2(7, 8), status); + val = tex2d.GatherGreen(float2(0.5, 0.25), int2(1, 2), int2(3, 4), int2(5, 6), int2(7, 8), status); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image_array]] %tex2dArray +// CHECK: [[val_green_array:%[a-zA-Z0-9_]+]] = OpImageGather %v4float [[tex2_load]] [[v3fc]] %int_1 None + val = tex2dArray.GatherGreen(float3(0.5, 0.25, 0)); return val; } diff --git a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.gather-red.hlsl b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.gather-red.hlsl index 5a70e3fb63..a449e11577 100644 --- a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.gather-red.hlsl +++ b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.gather-red.hlsl @@ -4,51 +4,54 @@ // CHECK: [[v2fc:%[0-9]+]] = OpConstantComposite %v2float %float_0_5 %float_0_25 // CHECK: [[v2ic:%[0-9]+]] = OpConstantComposite %v2int %int_2 %int_3 +// CHECK: [[v3fc:%[0-9]+]] = OpConstantComposite %v3float %float_0_5 %float_0_25 %float_0 -// CHECK: [[type_2d_image_1:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown -// CHECK: [[type_sampled_image_1:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_1]] -// CHECK: [[ptr_type_1:%[a-zA-Z0-9_]+]] = OpTypePointer UniformConstant [[type_sampled_image_1]] +// CHECK: [[type_2d_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown +// CHECK: [[type_2d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image]] +// CHECK: [[type_2d_image_array:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 1 0 1 Unknown +// CHECK: [[type_2d_sampled_image_array:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_array]] -// CHECK: [[type_struct_result:%[a-zA-Z0-9_]+]] = OpTypeStruct %uint %v4float - -// CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpVariable [[ptr_type_1]] UniformConstant - -vk::SampledTexture2D tex1 : register(t1); +vk::SampledTexture2D tex2d; +vk::SampledTexture2DArray tex2dArray; float4 main() : SV_Target { uint status; float4 val = 0; -// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[val_red:%[a-zA-Z0-9_]+]] = OpImageGather %v4float [[tex1_load]] [[v2fc]] %int_0 // CHECK: OpStore %val [[val_red]] - val = tex1.GatherRed(float2(0.5, 0.25)); + val = tex2d.GatherRed(float2(0.5, 0.25)); -// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[val_red_o:%[a-zA-Z0-9_]+]] = OpImageGather %v4float [[tex1_load]] [[v2fc]] %int_0 ConstOffset [[v2ic]] // CHECK: OpStore %val [[val_red_o]] - val = tex1.GatherRed(float2(0.5, 0.25), int2(2, 3)); + val = tex2d.GatherRed(float2(0.5, 0.25), int2(2, 3)); -// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[val_red_o4:%[a-zA-Z0-9_]+]] = OpImageGather %v4float [[tex1_load]] [[v2fc]] %int_0 ConstOffsets [[const_offsets:%[a-zA-Z0-9_]+]] // CHECK: OpStore %val [[val_red_o4]] - val = tex1.GatherRed(float2(0.5, 0.25), int2(1, 2), int2(3, 4), int2(5, 6), int2(7, 8)); + val = tex2d.GatherRed(float2(0.5, 0.25), int2(1, 2), int2(3, 4), int2(5, 6), int2(7, 8)); -// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] -// CHECK: [[val_red_s:%[a-zA-Z0-9_]+]] = OpImageSparseGather [[type_struct_result]] [[tex1_load]] [[v2fc]] %int_0 ConstOffset [[v2ic]] +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d +// CHECK: [[val_red_s:%[a-zA-Z0-9_]+]] = OpImageSparseGather %SparseResidencyStruct [[tex1_load]] [[v2fc]] %int_0 ConstOffset [[v2ic]] // CHECK: [[status_red_s:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[val_red_s]] 0 // CHECK: OpStore %status [[status_red_s]] // CHECK: [[res_red_s:%[a-zA-Z0-9_]+]] = OpCompositeExtract %v4float [[val_red_s]] 1 // CHECK: OpStore %val [[res_red_s]] - val = tex1.GatherRed(float2(0.5, 0.25), int2(2, 3), status); + val = tex2d.GatherRed(float2(0.5, 0.25), int2(2, 3), status); -// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] -// CHECK: [[val_red_o4_s:%[a-zA-Z0-9_]+]] = OpImageSparseGather [[type_struct_result]] [[tex1_load]] [[v2fc]] %int_0 ConstOffsets [[const_offsets]] +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d +// CHECK: [[val_red_o4_s:%[a-zA-Z0-9_]+]] = OpImageSparseGather %SparseResidencyStruct [[tex1_load]] [[v2fc]] %int_0 ConstOffsets [[const_offsets]] // CHECK: [[status_red_o4_s:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[val_red_o4_s]] 0 // CHECK: OpStore %status [[status_red_o4_s]] // CHECK: [[res_red_o4_s:%[a-zA-Z0-9_]+]] = OpCompositeExtract %v4float [[val_red_o4_s]] 1 // CHECK: OpStore %val [[res_red_o4_s]] - val = tex1.GatherRed(float2(0.5, 0.25), int2(1, 2), int2(3, 4), int2(5, 6), int2(7, 8), status); + val = tex2d.GatherRed(float2(0.5, 0.25), int2(1, 2), int2(3, 4), int2(5, 6), int2(7, 8), status); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image_array]] %tex2dArray +// CHECK: [[val_red_array:%[a-zA-Z0-9_]+]] = OpImageGather %v4float [[tex2_load]] [[v3fc]] %int_0 None + val = tex2dArray.GatherRed(float3(0.5, 0.25, 0)); return val; } diff --git a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.gather.hlsl b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.gather.hlsl index f7a26c153a..b2a4536368 100644 --- a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.gather.hlsl +++ b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.gather.hlsl @@ -4,39 +4,39 @@ // CHECK: [[v2fc:%[0-9]+]] = OpConstantComposite %v2float %float_0_5 %float_0_25 // CHECK: [[v2ic:%[0-9]+]] = OpConstantComposite %v2int %int_2 %int_3 +// CHECK: [[v3fc:%[0-9]+]] = OpConstantComposite %v3float %float_0_5 %float_0_25 %float_0 -// CHECK: [[type_2d_image_1:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown -// CHECK: [[type_sampled_image_1:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_1]] -// CHECK: [[ptr_type_1:%[a-zA-Z0-9_]+]] = OpTypePointer UniformConstant [[type_sampled_image_1]] +// CHECK: [[type_2d_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown +// CHECK: [[type_2d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image]] +// CHECK: [[type_2d_image_uint:%[a-zA-Z0-9_]+]] = OpTypeImage %uint 2D 0 0 0 1 Unknown +// CHECK: [[type_2d_sampled_image_uint:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_uint]] +// CHECK: [[type_2d_image_array:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 1 0 1 Unknown +// CHECK: [[type_2d_sampled_image_array:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_array]] -// CHECK: [[type_2d_image_2:%[a-zA-Z0-9_]+]] = OpTypeImage %uint 2D 0 0 0 1 Unknown -// CHECK: [[type_sampled_image_2:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_2]] -// CHECK: [[ptr_type_2:%[a-zA-Z0-9_]+]] = OpTypePointer UniformConstant [[type_sampled_image_2]] - -// CHECK: %SparseResidencyStruct = OpTypeStruct %uint %v4float - -// CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpVariable [[ptr_type_1]] UniformConstant -// CHECK: [[tex2:%[a-zA-Z0-9_]+]] = OpVariable [[ptr_type_2]] UniformConstant - -vk::SampledTexture2D tex1 : register(t1); -vk::SampledTexture2D tex2 : register(t2); +vk::SampledTexture2D tex2df4; +vk::SampledTexture2D tex2duint; +vk::SampledTexture2DArray tex2dArray; float4 main() : SV_Target { -// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2df4 // CHECK: [[val1:%[a-zA-Z0-9_]+]] = OpImageGather %v4float [[tex1_load]] [[v2fc]] %int_0 None - float4 val1 = tex1.Gather(float2(0.5, 0.25)); + float4 val1 = tex2df4.Gather(float2(0.5, 0.25)); -// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_2]] [[tex2]] +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image_uint]] %tex2duint // CHECK: [[val2:%[a-zA-Z0-9_]+]] = OpImageGather %v4uint [[tex2_load]] [[v2fc]] %int_0 ConstOffset [[v2ic]] - uint4 val2 = tex2.Gather(float2(0.5, 0.25), int2(2, 3)); + uint4 val2 = tex2duint.Gather(float2(0.5, 0.25), int2(2, 3)); -// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2df4 // CHECK: [[val3:%[a-zA-Z0-9_]+]] = OpImageSparseGather %SparseResidencyStruct [[tex3_load]] [[v2fc]] %int_0 ConstOffset [[v2ic]] // CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[val3]] 0 // CHECK: OpStore %status [[status_0]] uint status; - float4 val3 = tex1.Gather(float2(0.5, 0.25), int2(2, 3), status); + float4 val3 = tex2df4.Gather(float2(0.5, 0.25), int2(2, 3), status); + +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image_array]] %tex2dArray +// CHECK: [[val4:%[a-zA-Z0-9_]+]] = OpImageGather %v4float [[tex3_load]] [[v3fc]] %int_0 None + float4 val4 = tex2dArray.Gather(float3(0.5, 0.25, 0)); return 1.0; } diff --git a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.get-dimensions.hlsl b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.get-dimensions.hlsl index cf98bd8649..fb7fff01f1 100644 --- a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.get-dimensions.hlsl +++ b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.get-dimensions.hlsl @@ -3,23 +3,29 @@ // CHECK: OpCapability ImageQuery -vk::SampledTexture2D t1; +// CHECK: [[type_2d_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown +// CHECK: [[type_2d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image]] +// CHECK: [[type_2d_image_array:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 1 0 1 Unknown +// CHECK: [[type_2d_sampled_image_array:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_array]] + +vk::SampledTexture2D tex2d; +vk::SampledTexture2DArray tex2dArray; void main() { uint mipLevel = 1; - uint width, height, numLevels; + uint width, height, numLevels, elements; -// CHECK: [[t1_load:%[0-9]+]] = OpLoad %type_sampled_image %t1 -// CHECK-NEXT: [[image1:%[0-9]+]] = OpImage %type_2d_image [[t1_load]] +// CHECK: [[t1_load:%[0-9]+]] = OpLoad [[type_2d_sampled_image]] %tex2d +// CHECK-NEXT: [[image1:%[0-9]+]] = OpImage [[type_2d_image]] [[t1_load]] // CHECK-NEXT: [[query1:%[0-9]+]] = OpImageQuerySizeLod %v2uint [[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]] - t1.GetDimensions(width, height); + tex2d.GetDimensions(width, height); -// CHECK: [[t1_load:%[0-9]+]] = OpLoad %type_sampled_image %t1 -// CHECK-NEXT: [[image2:%[0-9]+]] = OpImage %type_2d_image [[t1_load]] +// CHECK: [[t1_load:%[0-9]+]] = OpLoad [[type_2d_sampled_image]] %tex2d +// CHECK-NEXT: [[image2:%[0-9]+]] = OpImage [[type_2d_image]] [[t1_load]] // CHECK-NEXT: [[mip:%[0-9]+]] = OpLoad %uint %mipLevel // CHECK-NEXT: [[query2:%[0-9]+]] = OpImageQuerySizeLod %v2uint [[image2]] [[mip]] // CHECK-NEXT: [[query2_0:%[0-9]+]] = OpCompositeExtract %uint [[query2]] 0 @@ -28,11 +34,36 @@ void main() { // CHECK-NEXT: OpStore %height [[query2_1]] // CHECK-NEXT: [[query_level_2:%[0-9]+]] = OpImageQueryLevels %uint [[image2]] // CHECK-NEXT: OpStore %numLevels [[query_level_2]] - t1.GetDimensions(mipLevel, width, height, numLevels); + tex2d.GetDimensions(mipLevel, width, height, numLevels); + +// CHECK: [[t2_load:%[0-9]+]] = OpLoad [[type_2d_sampled_image_array]] %tex2dArray +// CHECK-NEXT: [[image3:%[0-9]+]] = OpImage [[type_2d_image_array]] [[t2_load]] +// CHECK-NEXT: [[query3:%[0-9]+]] = OpImageQuerySizeLod %v3uint [[image3]] %int_0 +// CHECK-NEXT: [[query3_0:%[0-9]+]] = OpCompositeExtract %uint [[query3]] 0 +// CHECK-NEXT: OpStore %width [[query3_0]] +// CHECK-NEXT: [[query3_1:%[0-9]+]] = OpCompositeExtract %uint [[query3]] 1 +// CHECK-NEXT: OpStore %height [[query3_1]] +// CHECK-NEXT: [[query3_2:%[0-9]+]] = OpCompositeExtract %uint [[query3]] 2 +// CHECK-NEXT: OpStore %elements [[query3_2]] + tex2dArray.GetDimensions(width, height, elements); + +// CHECK: [[t2_load:%[0-9]+]] = OpLoad [[type_2d_sampled_image_array]] %tex2dArray +// CHECK-NEXT: [[image4:%[0-9]+]] = OpImage [[type_2d_image_array]] [[t2_load]] +// CHECK-NEXT: [[mip:%[0-9]+]] = OpLoad %uint %mipLevel +// CHECK-NEXT: [[query4:%[0-9]+]] = OpImageQuerySizeLod %v3uint [[image4]] [[mip]] +// CHECK-NEXT: [[query4_0:%[0-9]+]] = OpCompositeExtract %uint [[query4]] 0 +// CHECK-NEXT: OpStore %width [[query4_0]] +// CHECK-NEXT: [[query4_1:%[0-9]+]] = OpCompositeExtract %uint [[query4]] 1 +// CHECK-NEXT: OpStore %height [[query4_1]] +// CHECK-NEXT: [[query4_2:%[0-9]+]] = OpCompositeExtract %uint [[query4]] 2 +// CHECK-NEXT: OpStore %elements [[query4_2]] +// CHECK-NEXT: [[query_level_4:%[0-9]+]] = OpImageQueryLevels %uint [[image4]] +// CHECK-NEXT: OpStore %numLevels [[query_level_4]] + tex2dArray.GetDimensions(mipLevel, width, height, elements, numLevels); float f_width, f_height, f_numLevels; -// CHECK: [[t1_load:%[0-9]+]] = OpLoad %type_sampled_image %t1 -// CHECK-NEXT: [[image1:%[0-9]+]] = OpImage %type_2d_image [[t1_load]] +// CHECK: [[t1_load:%[0-9]+]] = OpLoad [[type_2d_sampled_image]] %tex2d +// CHECK-NEXT: [[image1:%[0-9]+]] = OpImage [[type_2d_image]] [[t1_load]] // CHECK-NEXT: [[query1:%[0-9]+]] = OpImageQuerySizeLod %v2uint [[image1]] %int_0 // CHECK-NEXT: [[query1_0:%[0-9]+]] = OpCompositeExtract %uint [[query1]] 0 // CHECK-NEXT: [[f_query1_0:%[0-9]+]] = OpConvertUToF %float [[query1_0]] @@ -40,10 +71,10 @@ void main() { // CHECK-NEXT: [[query1_1:%[0-9]+]] = OpCompositeExtract %uint [[query1]] 1 // CHECK-NEXT: [[f_query1_1:%[0-9]+]] = OpConvertUToF %float [[query1_1]] // CHECK-NEXT: OpStore %f_height [[f_query1_1]] - t1.GetDimensions(f_width, f_height); + tex2d.GetDimensions(f_width, f_height); -// CHECK: [[t1_load:%[0-9]+]] = OpLoad %type_sampled_image %t1 -// CHECK-NEXT: [[image2:%[0-9]+]] = OpImage %type_2d_image [[t1_load]] +// CHECK: [[t1_load:%[0-9]+]] = OpLoad [[type_2d_sampled_image]] %tex2d +// CHECK-NEXT: [[image2:%[0-9]+]] = OpImage [[type_2d_image]] [[t1_load]] // CHECK-NEXT: [[mip:%[0-9]+]] = OpLoad %uint %mipLevel // CHECK-NEXT: [[query2:%[0-9]+]] = OpImageQuerySizeLod %v2uint [[image2]] [[mip]] // CHECK-NEXT: [[query2_0:%[0-9]+]] = OpCompositeExtract %uint [[query2]] 0 @@ -55,11 +86,11 @@ void main() { // CHECK-NEXT: [[query_level_2:%[0-9]+]] = OpImageQueryLevels %uint [[image2]] // CHECK-NEXT: [[f_query_level_2:%[0-9]+]] = OpConvertUToF %float [[query_level_2]] // CHECK-NEXT: OpStore %f_numLevels [[f_query_level_2]] - t1.GetDimensions(mipLevel, f_width, f_height, f_numLevels); + tex2d.GetDimensions(mipLevel, f_width, f_height, f_numLevels); int i_width, i_height, i_numLevels; -// CHECK: [[t1_load:%[0-9]+]] = OpLoad %type_sampled_image %t1 -// CHECK-NEXT: [[image1:%[0-9]+]] = OpImage %type_2d_image [[t1_load]] +// CHECK: [[t1_load:%[0-9]+]] = OpLoad [[type_2d_sampled_image]] %tex2d +// CHECK-NEXT: [[image1:%[0-9]+]] = OpImage [[type_2d_image]] [[t1_load]] // CHECK-NEXT: [[query1:%[0-9]+]] = OpImageQuerySizeLod %v2uint [[image1]] %int_0 // CHECK-NEXT: [[query1_0:%[0-9]+]] = OpCompositeExtract %uint [[query1]] 0 // CHECK-NEXT: [[query_0_int:%[0-9]+]] = OpBitcast %int [[query1_0]] @@ -67,10 +98,10 @@ void main() { // CHECK-NEXT: [[query1_1:%[0-9]+]] = OpCompositeExtract %uint [[query1]] 1 // CHECK-NEXT: [[query_1_int:%[0-9]+]] = OpBitcast %int [[query1_1]] // CHECK-NEXT: OpStore %i_height [[query_1_int]] - t1.GetDimensions(i_width, i_height); + tex2d.GetDimensions(i_width, i_height); -// CHECK: [[t1_load:%[0-9]+]] = OpLoad %type_sampled_image %t1 -// CHECK-NEXT: [[image2:%[0-9]+]] = OpImage %type_2d_image [[t1_load]] +// CHECK: [[t1_load:%[0-9]+]] = OpLoad [[type_2d_sampled_image]] %tex2d +// CHECK-NEXT: [[image2:%[0-9]+]] = OpImage [[type_2d_image]] [[t1_load]] // CHECK-NEXT: [[mip:%[0-9]+]] = OpLoad %uint %mipLevel // CHECK-NEXT: [[query2:%[0-9]+]] = OpImageQuerySizeLod %v2uint [[image2]] [[mip]] // CHECK-NEXT: [[query2_0:%[0-9]+]] = OpCompositeExtract %uint [[query2]] 0 @@ -82,13 +113,13 @@ void main() { // CHECK-NEXT: [[query_level_2:%[0-9]+]] = OpImageQueryLevels %uint [[image2]] // CHECK-NEXT: [[query_level_2_int:%[0-9]+]] = OpBitcast %int [[query_level_2]] // CHECK-NEXT: OpStore %i_numLevels [[query_level_2_int]] - t1.GetDimensions(mipLevel, i_width, i_height, i_numLevels); + tex2d.GetDimensions(mipLevel, i_width, i_height, i_numLevels); #ifdef ERROR // ERROR: error: Output argument must be an l-value - t1.GetDimensions(mipLevel, 0, height, numLevels); + tex2d.GetDimensions(mipLevel, 0, height, numLevels); // ERROR: error: Output argument must be an l-value - t1.GetDimensions(width, 20); + tex2d.GetDimensions(width, 20); #endif } \ No newline at end of file diff --git a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.load.hlsl b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.load.hlsl index 8ecd9e70a3..930b4a96f4 100644 --- a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.load.hlsl +++ b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.load.hlsl @@ -1,48 +1,57 @@ // RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s - -vk::SampledTexture2D tex2D_F4 : register(t1); - -// CHECK: OpCapability SparseResidency - // CHECK: [[v2ic:%[0-9]+]] = OpConstantComposite %v2int %int_1 %int_2 -// CHECK: %SparseResidencyStruct = OpTypeStruct %uint %v4float +// CHECK: [[type_2d_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown +// CHECK: [[type_2d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image]] +// CHECK: [[type_2d_image_array:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 1 0 1 Unknown +// CHECK: [[type_2d_sampled_image_array:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_array]] -float4 main(int3 location: A) : SV_Target { +vk::SampledTexture2D tex2d; +vk::SampledTexture2DArray tex2dArray; + +float4 main(int3 location3: A, int4 location4: B) : SV_Target { uint status; -// CHECK: [[loc:%[0-9]+]] = OpLoad %v3int %location +// CHECK: [[loc:%[0-9]+]] = OpLoad %v3int %location3 // CHECK-NEXT: [[coord_0:%[0-9]+]] = OpVectorShuffle %v2int [[loc]] [[loc]] 0 1 // CHECK-NEXT: [[lod_0:%[0-9]+]] = OpCompositeExtract %int [[loc]] 2 -// CHECK-NEXT: [[tex:%[0-9]+]] = OpLoad %type_sampled_image %tex2D_F4 -// CHECK-NEXT: [[tex_img:%[0-9]+]] = OpImage %type_2d_image [[tex]] +// CHECK-NEXT: [[tex:%[0-9]+]] = OpLoad [[type_2d_sampled_image]] %tex2d +// CHECK-NEXT: [[tex_img:%[0-9]+]] = OpImage [[type_2d_image]] [[tex]] // CHECK-NEXT: {{%[0-9]+}} = OpImageFetch %v4float [[tex_img]] [[coord_0]] Lod [[lod_0]] - float4 val1 = tex2D_F4.Load(location); + float4 val1 = tex2d.Load(location3); -// CHECK: [[loc:%[0-9]+]] = OpLoad %v3int %location +// CHECK: [[loc:%[0-9]+]] = OpLoad %v3int %location3 // CHECK-NEXT: [[coord_0:%[0-9]+]] = OpVectorShuffle %v2int [[loc]] [[loc]] 0 1 // CHECK-NEXT: [[lod_0:%[0-9]+]] = OpCompositeExtract %int [[loc]] 2 -// CHECK-NEXT: [[tex:%[0-9]+]] = OpLoad %type_sampled_image %tex2D_F4 -// CHECK-NEXT: [[tex_img:%[0-9]+]] = OpImage %type_2d_image [[tex]] +// CHECK-NEXT: [[tex:%[0-9]+]] = OpLoad [[type_2d_sampled_image]] %tex2d +// CHECK-NEXT: [[tex_img:%[0-9]+]] = OpImage [[type_2d_image]] [[tex]] // CHECK-NEXT: {{%[0-9]+}} = OpImageFetch %v4float [[tex_img]] [[coord_0]] Lod|ConstOffset [[lod_0]] [[v2ic]] - float4 val2 = tex2D_F4.Load(location, int2(1, 2)); + float4 val2 = tex2d.Load(location3, int2(1, 2)); ///////////////////////////////// /// Using the Status argument /// ///////////////////////////////// -// CHECK: [[loc:%[0-9]+]] = OpLoad %v3int %location +// CHECK: [[loc:%[0-9]+]] = OpLoad %v3int %location3 // CHECK-NEXT: [[coord_0:%[0-9]+]] = OpVectorShuffle %v2int [[loc]] [[loc]] 0 1 // CHECK-NEXT: [[lod_0:%[0-9]+]] = OpCompositeExtract %int [[loc]] 2 -// CHECK-NEXT: [[tex:%[0-9]+]] = OpLoad %type_sampled_image %tex2D_F4 -// CHECK-NEXT: [[tex_img:%[0-9]+]] = OpImage %type_2d_image [[tex]] +// CHECK-NEXT: [[tex:%[0-9]+]] = OpLoad [[type_2d_sampled_image]] %tex2d +// CHECK-NEXT: [[tex_img:%[0-9]+]] = OpImage [[type_2d_image]] [[tex]] // CHECK-NEXT:[[structResult:%[0-9]+]] = OpImageSparseFetch %SparseResidencyStruct [[tex_img]] [[coord_0]] Lod|ConstOffset [[lod_0]] [[v2ic]] // 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 = tex2D_F4.Load(location, int2(1, 2), status); + float4 val3 = tex2d.Load(location3, int2(1, 2), 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_2d_sampled_image_array]] %tex2dArray +// CHECK-NEXT: [[tex_img:%[0-9]+]] = OpImage [[type_2d_image_array]] [[tex]] +// CHECK-NEXT: {{%[0-9]+}} = OpImageFetch %v4float [[tex_img]] [[coord_0]] Lod [[lod_0]] + float4 val4 = tex2dArray.Load(location4); return 1.0; } diff --git a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.mips-access.hlsl b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.mips-access.hlsl index 2e76fe4b61..7858278db9 100644 --- a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.mips-access.hlsl +++ b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.mips-access.hlsl @@ -2,21 +2,28 @@ // CHECK: [[cu12:%[0-9]+]] = OpConstantComposite %v2uint %uint_1 %uint_2 -// CHECK: [[type_2d_image_1:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown -// CHECK: [[type_sampled_image_1:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_1]] -// CHECK: [[ptr_type_1:%[a-zA-Z0-9_]+]] = OpTypePointer UniformConstant [[type_sampled_image_1]] +// CHECK: [[type_2d_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown +// CHECK: [[type_2d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image]] +// CHECK: [[type_2d_image_array:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 1 0 1 Unknown +// CHECK: [[type_2d_sampled_image_array:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_array]] -// CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpVariable [[ptr_type_1]] UniformConstant - -vk::SampledTexture2D tex1 : register(t1); +vk::SampledTexture2D tex2d; +vk::SampledTexture2DArray tex2dArray; void main() { // CHECK: OpStore %pos1 [[cu12]] // CHECK-NEXT: [[pos1:%[0-9]+]] = OpLoad %v2uint %pos1 -// CHECK-NEXT: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] -// CHECK-NEXT: [[tex_img:%[0-9]+]] = OpImage [[type_2d_image_1]] [[tex1_load]] +// CHECK-NEXT: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d +// CHECK-NEXT: [[tex_img:%[0-9]+]] = OpImage [[type_2d_image]] [[tex1_load]] // CHECK-NEXT: [[result1:%[0-9]+]] = OpImageFetch %v4float [[tex_img]] [[pos1]] Lod %uint_2 // CHECK-NEXT: OpStore %a1 [[result1]] uint2 pos1 = uint2(1,2); - float4 a1 = tex1.mips[2][pos1]; + float4 a1 = tex2d.mips[2][pos1]; + +// CHECK: [[pos2:%[0-9]+]] = OpLoad %v3uint %pos2 +// CHECK-NEXT: [[load_arr:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image_array]] %tex2dArray +// CHECK-NEXT: [[img_arr:%[a-zA-Z0-9_]+]] = OpImage [[type_2d_image_array]] [[load_arr]] +// CHECK-NEXT: [[res_arr:%[0-9]+]] = OpImageFetch %v4float [[img_arr]] [[pos2]] Lod %uint_3 + uint3 pos2 = uint3(1, 2, 4); + float4 a2 = tex2dArray.mips[3][pos2]; } diff --git a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-bias.hlsl b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-bias.hlsl index a233394f6e..bd10307de7 100644 --- a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-bias.hlsl +++ b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-bias.hlsl @@ -5,29 +5,35 @@ // CHECK: [[v2fc:%[0-9]+]] = OpConstantComposite %v2float %float_0_5 %float_0_25 // CHECK: [[v2ic:%[0-9]+]] = OpConstantComposite %v2int %int_2 %int_3 +// CHECK: [[v3fc:%[0-9]+]] = OpConstantComposite %v3float %float_0_5 %float_0_25 %float_0 -// CHECK: [[type_2d_image_1:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown -// CHECK: [[type_sampled_image_1:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_1]] -// CHECK: [[ptr_type_1:%[a-zA-Z0-9_]+]] = OpTypePointer UniformConstant [[type_sampled_image_1]] +// CHECK: [[type_2d_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown +// CHECK: [[type_2d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image]] +// CHECK: [[type_2d_image_array:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 1 0 1 Unknown +// CHECK: [[type_2d_sampled_image_array:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_array]] -// CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpVariable [[ptr_type_1]] UniformConstant - -vk::SampledTexture2D tex1 : register(t0); +vk::SampledTexture2D tex2d; +vk::SampledTexture2DArray tex2dArray; float4 main() : SV_Target { -// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[sampled_result1:%[a-zA-Z0-9_]+]] = OpImageSampleImplicitLod %v4float [[tex1_load]] [[v2fc]] Bias|ConstOffset %float_0_5 [[v2ic]] - float4 val1 = tex1.SampleBias(float2(0.5, 0.25), 0.5f, int2(2, 3)); + float4 val1 = tex2d.SampleBias(float2(0.5, 0.25), 0.5f, int2(2, 3)); -// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[sampled_result2:%[a-zA-Z0-9_]+]] = OpImageSampleImplicitLod %v4float [[tex2_load]] [[v2fc]] Bias|ConstOffset|MinLod %float_0_5 [[v2ic]] %float_2_5 - float4 val2 = tex1.SampleBias(float2(0.5, 0.25), 0.5f, int2(2, 3), 2.5f); + float4 val2 = tex2d.SampleBias(float2(0.5, 0.25), 0.5f, int2(2, 3), 2.5f); -// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[sampled_result3:%[a-zA-Z0-9_]+]] = OpImageSparseSampleImplicitLod %SparseResidencyStruct [[tex3_load]] [[v2fc]] Bias|ConstOffset|MinLod %float_0_5 [[v2ic]] %float_2_5 // CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result3]] 0 // CHECK: OpStore %status [[status_0]] uint status; - float4 val3 = tex1.SampleBias(float2(0.5, 0.25), 0.5f, int2(2, 3), 2.5f, status); + float4 val3 = tex2d.SampleBias(float2(0.5, 0.25), 0.5f, int2(2, 3), 2.5f, status); + +// CHECK: [[load_arr1:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image_array]] %tex2dArray +// CHECK: [[sampled_arr1:%[a-zA-Z0-9_]+]] = OpImageSampleImplicitLod %v4float [[load_arr1]] [[v3fc]] Bias|ConstOffset %float_0_5 [[v2ic]] + float4 val4 = tex2dArray.SampleBias(float3(0.5, 0.25, 0), 0.5f, int2(2, 3)); + return 1.0; } diff --git a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-cmp-bias.hlsl b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-cmp-bias.hlsl index e302d88a50..0180f2c7b3 100644 --- a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-cmp-bias.hlsl +++ b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-cmp-bias.hlsl @@ -5,29 +5,35 @@ // CHECK: [[v2fc:%[0-9]+]] = OpConstantComposite %v2float %float_0_5 %float_0_25 // CHECK: [[v2ic:%[0-9]+]] = OpConstantComposite %v2int %int_2 %int_3 +// CHECK: [[v3fc:%[0-9]+]] = OpConstantComposite %v3float %float_0_5 %float_0_25 %float_0 -// CHECK: [[type_2d_image_1:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown -// CHECK: [[type_sampled_image_1:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_1]] -// CHECK: [[ptr_type_1:%[a-zA-Z0-9_]+]] = OpTypePointer UniformConstant [[type_sampled_image_1]] +// CHECK: [[type_2d_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown +// CHECK: [[type_2d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image]] +// CHECK: [[type_2d_image_array:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 1 0 1 Unknown +// CHECK: [[type_2d_sampled_image_array:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_array]] -// CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpVariable [[ptr_type_1]] UniformConstant - -vk::SampledTexture2D tex1 : register(t0); +vk::SampledTexture2D tex2d; +vk::SampledTexture2DArray tex2dArray; float4 main() : SV_Target { -// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[sampled_result1:%[a-zA-Z0-9_]+]] = OpImageSampleDrefImplicitLod %float [[tex1_load]] [[v2fc]] %float_1 Bias|ConstOffset %float_0_5 [[v2ic]] - float val1 = tex1.SampleCmpBias(float2(0.5, 0.25), 1.0f, 0.5f, int2(2, 3)); + float val1 = tex2d.SampleCmpBias(float2(0.5, 0.25), 1.0f, 0.5f, int2(2, 3)); -// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[sampled_result2:%[a-zA-Z0-9_]+]] = OpImageSampleDrefImplicitLod %float [[tex2_load]] [[v2fc]] %float_1 Bias|ConstOffset|MinLod %float_0_5 [[v2ic]] %float_2_5 - float val2 = tex1.SampleCmpBias(float2(0.5, 0.25), 1.0f, 0.5f, int2(2, 3), 2.5f); + float val2 = tex2d.SampleCmpBias(float2(0.5, 0.25), 1.0f, 0.5f, int2(2, 3), 2.5f); -// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[sampled_result3:%[a-zA-Z0-9_]+]] = OpImageSparseSampleDrefImplicitLod %SparseResidencyStruct [[tex3_load]] [[v2fc]] %float_1 Bias|ConstOffset|MinLod %float_0_5 [[v2ic]] %float_2_5 // CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result3]] 0 // CHECK: OpStore %status [[status_0]] uint status; - float val3 = tex1.SampleCmpBias(float2(0.5, 0.25), 1.0f, 0.5f, int2(2, 3), 2.5f, status); + float val3 = tex2d.SampleCmpBias(float2(0.5, 0.25), 1.0f, 0.5f, int2(2, 3), 2.5f, status); + +// CHECK: [[load_arr1:%[a-zA-Z0-9_]+]] = OpLoad {{.*}} %tex2dArray +// CHECK: [[sampled_arr1:%[a-zA-Z0-9_]+]] = OpImageSampleDrefImplicitLod %float [[load_arr1]] [[v3fc]] %float_1 Bias|ConstOffset %float_0_5 [[v2ic]] + float val4 = tex2dArray.SampleCmpBias(float3(0.5, 0.25, 0), 1.0f, 0.5f, int2(2, 3)); + return 1.0; } diff --git a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-cmp-grad.hlsl b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-cmp-grad.hlsl index 4acca8a42e..efec4730cb 100644 --- a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-cmp-grad.hlsl +++ b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-cmp-grad.hlsl @@ -8,32 +8,33 @@ // CHECK: [[v2f_2:%[0-9]+]] = OpConstantComposite %v2float %float_2 %float_2 // CHECK: [[v2ic:%[0-9]+]] = OpConstantComposite %v2int %int_2 %int_3 -// CHECK: [[type_2d_image_1:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown -// CHECK: [[type_sampled_image_1:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_1]] -// CHECK: [[ptr_type_1:%[a-zA-Z0-9_]+]] = OpTypePointer UniformConstant [[type_sampled_image_1]] +// CHECK: [[type_2d_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown +// CHECK: [[type_2d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image]] +// CHECK: [[type_2d_image_array:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 1 0 1 Unknown +// CHECK: [[type_2d_sampled_image_array:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_array]] -// CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpVariable [[ptr_type_1]] UniformConstant - -vk::SampledTexture2D tex1 : register(t0); +vk::SampledTexture2D tex2d; +vk::SampledTexture2DArray tex2dArray; float4 main() : SV_Target { -// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[sampled_result1:%[a-zA-Z0-9_]+]] = OpImageSampleDrefExplicitLod %float [[tex1_load]] [[v2fc]] %float_1 Grad [[v2f_1]] [[v2f_2]] - float val1 = tex1.SampleCmpGrad(float2(0.5, 0.25), 1.0f, float2(1, 1), float2(2, 2)); + float val1 = tex2d.SampleCmpGrad(float2(0.5, 0.25), 1.0f, float2(1, 1), float2(2, 2)); -// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[sampled_result2:%[a-zA-Z0-9_]+]] = OpImageSampleDrefExplicitLod %float [[tex2_load]] [[v2fc]] %float_1 Grad|ConstOffset [[v2f_1]] [[v2f_2]] [[v2ic]] - float val2 = tex1.SampleCmpGrad(float2(0.5, 0.25), 1.0f, float2(1, 1), float2(2, 2), int2(2,3)); + float val2 = tex2d.SampleCmpGrad(float2(0.5, 0.25), 1.0f, float2(1, 1), float2(2, 2), int2(2,3)); -// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[sampled_result3:%[a-zA-Z0-9_]+]] = OpImageSampleDrefExplicitLod %float [[tex3_load]] [[v2fc]] %float_1 Grad|ConstOffset|MinLod [[v2f_1]] [[v2f_2]] [[v2ic]] %float_0_5 - float val3 = tex1.SampleCmpGrad(float2(0.5, 0.25), 1.0f, float2(1, 1), float2(2, 2), int2(2,3), 0.5); + float val3 = tex2d.SampleCmpGrad(float2(0.5, 0.25), 1.0f, float2(1, 1), float2(2, 2), int2(2,3), 0.5); -// CHECK: [[tex4_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex4_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[sampled_result4:%[a-zA-Z0-9_]+]] = OpImageSparseSampleDrefExplicitLod %SparseResidencyStruct [[tex4_load]] [[v2fc]] %float_1 Grad|ConstOffset|MinLod [[v2f_1]] [[v2f_2]] [[v2ic]] %float_0_5 // CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result4]] 0 // CHECK: OpStore %status [[status_0]] uint status; - float val4 = tex1.SampleCmpGrad(float2(0.5, 0.25), 1.0f, float2(1, 1), float2(2, 2), int2(2,3), 0.5, status); + float val4 = tex2d.SampleCmpGrad(float2(0.5, 0.25), 1.0f, float2(1, 1), float2(2, 2), int2(2,3), 0.5, status); + return 1.0; } diff --git a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-cmp-level-zero.hlsl b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-cmp-level-zero.hlsl index b7475a7fca..39b525b888 100644 --- a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-cmp-level-zero.hlsl +++ b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-cmp-level-zero.hlsl @@ -4,29 +4,35 @@ // CHECK: [[v2fc:%[0-9]+]] = OpConstantComposite %v2float %float_0_5 %float_0_25 // CHECK: [[v2ic:%[0-9]+]] = OpConstantComposite %v2int %int_2 %int_3 +// CHECK: [[v3fc:%[0-9]+]] = OpConstantComposite %v3float %float_0_5 %float_0_25 %float_0 -// CHECK: [[type_2d_image_1:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown -// CHECK: [[type_sampled_image_1:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_1]] -// CHECK: [[ptr_type_1:%[a-zA-Z0-9_]+]] = OpTypePointer UniformConstant [[type_sampled_image_1]] +// CHECK: [[type_2d_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown +// CHECK: [[type_2d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image]] +// CHECK: [[type_2d_image_array:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 1 0 1 Unknown +// CHECK: [[type_2d_sampled_image_array:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_array]] -// CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpVariable [[ptr_type_1]] UniformConstant - -vk::SampledTexture2D tex1 : register(t0); +vk::SampledTexture2D tex2d; +vk::SampledTexture2DArray tex2dArray; float4 main() : SV_Target { -// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[sampled_result1:%[a-zA-Z0-9_]+]] = OpImageSampleDrefExplicitLod %float [[tex1_load]] [[v2fc]] %float_2 Lod %float_0 - float val1 = tex1.SampleCmpLevelZero(float2(0.5, 0.25), 2.0f); + float val1 = tex2d.SampleCmpLevelZero(float2(0.5, 0.25), 2.0f); -// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[sampled_result2:%[a-zA-Z0-9_]+]] = OpImageSampleDrefExplicitLod %float [[tex2_load]] [[v2fc]] %float_2 Lod|ConstOffset %float_0 [[v2ic]] - float val2 = tex1.SampleCmpLevelZero(float2(0.5, 0.25), 2.0f, int2(2,3)); + float val2 = tex2d.SampleCmpLevelZero(float2(0.5, 0.25), 2.0f, int2(2,3)); -// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[sampled_result3:%[a-zA-Z0-9_]+]] = OpImageSparseSampleDrefExplicitLod %SparseResidencyStruct [[tex3_load]] [[v2fc]] %float_2 Lod|ConstOffset %float_0 [[v2ic]] // CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result3]] 0 // CHECK: OpStore %status [[status_0]] uint status; - float val3 = tex1.SampleCmpLevelZero(float2(0.5, 0.25), 2.0f, int2(2,3), status); + float val3 = tex2d.SampleCmpLevelZero(float2(0.5, 0.25), 2.0f, int2(2,3), status); + +// CHECK: [[load_arr1:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image_array]] %tex2dArray +// CHECK: [[sampled_arr1:%[a-zA-Z0-9_]+]] = OpImageSampleDrefExplicitLod %float [[load_arr1]] [[v3fc]] %float_2 Lod %float_0 + float val4 = tex2dArray.SampleCmpLevelZero(float3(0.5, 0.25, 0), 2.0f); + return 1.0; } diff --git a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-cmp.hlsl b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-cmp.hlsl index 3fc5798b09..8d6da78479 100644 --- a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-cmp.hlsl +++ b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-cmp.hlsl @@ -5,33 +5,38 @@ // CHECK: [[v2fc:%[0-9]+]] = OpConstantComposite %v2float %float_0_5 %float_0_25 // CHECK: [[v2ic:%[0-9]+]] = OpConstantComposite %v2int %int_2 %int_3 +// CHECK: [[v3fc:%[0-9]+]] = OpConstantComposite %v3float %float_0_5 %float_0_25 %float_0 -// CHECK: [[type_2d_image_1:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown -// CHECK: [[type_sampled_image_1:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_1]] -// CHECK: [[ptr_type_1:%[a-zA-Z0-9_]+]] = OpTypePointer UniformConstant [[type_sampled_image_1]] +// CHECK: [[type_2d_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown +// CHECK: [[type_2d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image]] +// CHECK: [[type_2d_image_array:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 1 0 1 Unknown +// CHECK: [[type_2d_sampled_image_array:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_array]] -// CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpVariable [[ptr_type_1]] UniformConstant - -vk::SampledTexture2D tex1 : register(t0); +vk::SampledTexture2D tex2d; +vk::SampledTexture2DArray tex2dArray; float4 main() : SV_Target { -// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[sampled_result1:%[a-zA-Z0-9_]+]] = OpImageSampleDrefImplicitLod %float [[tex1_load]] [[v2fc]] %float_2 - float val1 = tex1.SampleCmp(float2(0.5, 0.25), 2.0f); + float val1 = tex2d.SampleCmp(float2(0.5, 0.25), 2.0f); -// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[sampled_result2:%[a-zA-Z0-9_]+]] = OpImageSampleDrefImplicitLod %float [[tex2_load]] [[v2fc]] %float_2 ConstOffset [[v2ic]] - float val2 = tex1.SampleCmp(float2(0.5, 0.25), 2.0f, int2(2,3)); + float val2 = tex2d.SampleCmp(float2(0.5, 0.25), 2.0f, int2(2,3)); -// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[sampled_result3:%[a-zA-Z0-9_]+]] = OpImageSampleDrefImplicitLod %float [[tex3_load]] [[v2fc]] %float_2 ConstOffset|MinLod [[v2ic]] %float_0_5 - float val3 = tex1.SampleCmp(float2(0.5, 0.25), 2.0f, int2(2,3), 0.5); + float val3 = tex2d.SampleCmp(float2(0.5, 0.25), 2.0f, int2(2,3), 0.5); -// CHECK: [[tex4_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex4_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[sampled_result4:%[a-zA-Z0-9_]+]] = OpImageSparseSampleDrefImplicitLod %SparseResidencyStruct [[tex4_load]] [[v2fc]] %float_2 ConstOffset|MinLod [[v2ic]] %float_0_5 // CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result4]] 0 // CHECK: OpStore %status [[status_0]] uint status; - float val4 = tex1.SampleCmp(float2(0.5, 0.25), 2.0f, int2(2,3), 0.5, status); - return 1.0; + float val4 = tex2d.SampleCmp(float2(0.5, 0.25), 2.0f, int2(2,3), 0.5, status); + +// CHECK: [[load_arr1:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image_array]] %tex2dArray +// CHECK: [[sampled_arr1:%[a-zA-Z0-9_]+]] = OpImageSampleDrefImplicitLod %float [[load_arr1]] [[v3fc]] %float_2 + float val5 = tex2dArray.SampleCmp(float3(0.5, 0.25, 0), 2.0f); + return 1.0; } diff --git a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-grad.hlsl b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-grad.hlsl index 829e148c02..94bb03e7e4 100644 --- a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-grad.hlsl +++ b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-grad.hlsl @@ -7,32 +7,39 @@ // CHECK: [[v2f_1:%[0-9]+]] = OpConstantComposite %v2float %float_1 %float_1 // CHECK: [[v2f_2:%[0-9]+]] = OpConstantComposite %v2float %float_2 %float_2 // CHECK: [[v2ic:%[0-9]+]] = OpConstantComposite %v2int %int_2 %int_3 +// CHECK: [[v3fc:%[0-9]+]] = OpConstantComposite %v3float %float_0_5 %float_0_25 %float_0 -// CHECK: [[type_2d_image_1:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown -// CHECK: [[type_sampled_image_1:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_1]] -// CHECK: [[ptr_type_1:%[a-zA-Z0-9_]+]] = OpTypePointer UniformConstant [[type_sampled_image_1]] +// CHECK: [[type_2d_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown +// CHECK: [[type_2d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image]] +// CHECK: [[type_2d_image_array:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 1 0 1 Unknown +// CHECK: [[type_2d_sampled_image_array:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_array]] -// CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpVariable [[ptr_type_1]] UniformConstant - -vk::SampledTexture2D tex1 : register(t0); +vk::SampledTexture2D tex2d; +vk::SampledTexture2DArray tex2dArray; float4 main() : SV_Target { -// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[sampled_result1:%[a-zA-Z0-9_]+]] = OpImageSampleExplicitLod %v4float [[tex1_load]] [[v2fc]] Grad [[v2f_1]] [[v2f_2]] - float4 val1 = tex1.SampleGrad(float2(0.5, 0.25), float2(1, 1), float2(2, 2)); + float4 val1 = tex2d.SampleGrad(float2(0.5, 0.25), float2(1, 1), float2(2, 2)); -// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[sampled_result2:%[a-zA-Z0-9_]+]] = OpImageSampleExplicitLod %v4float [[tex2_load]] [[v2fc]] Grad|ConstOffset [[v2f_1]] [[v2f_2]] [[v2ic]] - float4 val2 = tex1.SampleGrad(float2(0.5, 0.25), float2(1, 1), float2(2, 2), int2(2,3)); + float4 val2 = tex2d.SampleGrad(float2(0.5, 0.25), float2(1, 1), float2(2, 2), int2(2,3)); -// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[sampled_result3:%[a-zA-Z0-9_]+]] = OpImageSampleExplicitLod %v4float [[tex3_load]] [[v2fc]] Grad|ConstOffset|MinLod [[v2f_1]] [[v2f_2]] [[v2ic]] %float_0_5 - float4 val3 = tex1.SampleGrad(float2(0.5, 0.25), float2(1, 1), float2(2, 2), int2(2,3), 0.5); -// CHECK: [[tex4_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] + float4 val3 = tex2d.SampleGrad(float2(0.5, 0.25), float2(1, 1), float2(2, 2), int2(2,3), 0.5); + +// CHECK: [[tex4_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[sampled_result4:%[a-zA-Z0-9_]+]] = OpImageSparseSampleExplicitLod %SparseResidencyStruct [[tex4_load]] [[v2fc]] Grad|ConstOffset|MinLod [[v2f_1]] [[v2f_2]] [[v2ic]] %float_0_5 // CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result4]] 0 // CHECK: OpStore %status [[status_0]] uint status; - float4 val4 = tex1.SampleGrad(float2(0.5, 0.25), float2(1, 1), float2(2, 2), int2(2,3), 0.5, status); + float4 val4 = tex2d.SampleGrad(float2(0.5, 0.25), float2(1, 1), float2(2, 2), int2(2,3), 0.5, status); + +// CHECK: [[load_arr1:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image_array]] %tex2dArray +// CHECK: [[sampled_arr1:%[a-zA-Z0-9_]+]] = OpImageSampleExplicitLod %v4float [[load_arr1]] [[v3fc]] Grad [[v2f_1]] [[v2f_2]] + float4 val5 = tex2dArray.SampleGrad(float3(0.5, 0.25, 0), float2(1, 1), float2(2, 2)); + return 1.0; } diff --git a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-level.hlsl b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-level.hlsl index a0c885b9ed..ee10dc3878 100644 --- a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-level.hlsl +++ b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-level.hlsl @@ -4,29 +4,35 @@ // CHECK: [[v2fc:%[0-9]+]] = OpConstantComposite %v2float %float_0_5 %float_0_25 // CHECK: [[v2ic:%[0-9]+]] = OpConstantComposite %v2int %int_2 %int_3 +// CHECK: [[v3fc:%[0-9]+]] = OpConstantComposite %v3float %float_0_5 %float_0_25 %float_0 -// CHECK: [[type_2d_image_1:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown -// CHECK: [[type_sampled_image_1:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_1]] -// CHECK: [[ptr_type_1:%[a-zA-Z0-9_]+]] = OpTypePointer UniformConstant [[type_sampled_image_1]] +// CHECK: [[type_2d_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown +// CHECK: [[type_2d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image]] +// CHECK: [[type_2d_image_array:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 1 0 1 Unknown +// CHECK: [[type_2d_sampled_image_array:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_array]] -// CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpVariable [[ptr_type_1]] UniformConstant - -vk::SampledTexture2D tex1 : register(t0); +vk::SampledTexture2D tex2d; +vk::SampledTexture2DArray tex2dArray; float4 main() : SV_Target { -// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] -// CHECK: [[sampled_result1:%[a-zA-Z0-9_]+]] = OpImageSampleExplicitLod %v4float [[tex1_load]] [[v2fc]] Lod|ConstOffset %float_0_5 [[v2ic]] - float4 val1 = tex1.SampleLevel(float2(0.5, 0.25), 0.5f, int2(2, 3)); +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d +// CHECK: [[sampled_result1:%[a-zA-Z0-9_]+]] = OpImageSampleExplicitLod %v4float [[tex1_load]] [[v2fc]] Lod %float_0_5 + float4 val1 = tex2d.SampleLevel(float2(0.5, 0.25), 0.5f); -// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[sampled_result2:%[a-zA-Z0-9_]+]] = OpImageSampleExplicitLod %v4float [[tex2_load]] [[v2fc]] Lod|ConstOffset %float_0_5 [[v2ic]] - float4 val2 = tex1.SampleLevel(float2(0.5, 0.25), 0.5f, int2(2, 3)); + float4 val2 = tex2d.SampleLevel(float2(0.5, 0.25), 0.5f, int2(2, 3)); -// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d // CHECK: [[sampled_result3:%[a-zA-Z0-9_]+]] = OpImageSparseSampleExplicitLod %SparseResidencyStruct [[tex3_load]] [[v2fc]] Lod|ConstOffset %float_0_5 [[v2ic]] // CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result3]] 0 // CHECK: OpStore %status [[status_0]] uint status; - float4 val3 = tex1.SampleLevel(float2(0.5, 0.25), 0.5f, int2(2, 3), status); + float4 val3 = tex2d.SampleLevel(float2(0.5, 0.25), 0.5f, int2(2, 3), status); + +// CHECK: [[load_arr1:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image_array]] %tex2dArray +// CHECK: [[sampled_arr1:%[a-zA-Z0-9_]+]] = OpImageSampleExplicitLod %v4float [[load_arr1]] [[v3fc]] Lod %float_0_5 + float4 val4 = tex2dArray.SampleLevel(float3(0.5, 0.25, 0), 0.5f); + return 1.0; } diff --git a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample.hlsl b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample.hlsl index ee4051f45c..2d1654d30e 100644 --- a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample.hlsl +++ b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample.hlsl @@ -5,46 +5,48 @@ // CHECK: [[v2fc:%[0-9]+]] = OpConstantComposite %v2float %float_0_5 %float_0_25 // CHECK: [[v2ic:%[0-9]+]] = OpConstantComposite %v2int %int_2 %int_3 +// CHECK: [[v3fc:%[0-9]+]] = OpConstantComposite %v3float %float_0_5 %float_0_25 %float_0 -// CHECK: [[type_2d_image_1:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown -// CHECK: [[type_sampled_image_1:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_1]] -// CHECK: [[ptr_type_1:%[a-zA-Z0-9_]+]] = OpTypePointer UniformConstant [[type_sampled_image_1]] +// CHECK: [[type_2d_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown +// CHECK: [[type_2d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image]] +// CHECK: [[type_2d_image_uint:%[a-zA-Z0-9_]+]] = OpTypeImage %uint 2D 0 0 0 1 Unknown +// CHECK: [[type_2d_sampled_image_uint:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_uint]] +// CHECK: [[type_2d_image_array:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 1 0 1 Unknown +// CHECK: [[type_2d_sampled_image_array:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_array]] -// CHECK: [[type_2d_image_2:%[a-zA-Z0-9_]+]] = OpTypeImage %uint 2D 0 0 0 1 Unknown -// CHECK: [[type_sampled_image_2:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_2]] -// CHECK: [[ptr_type_2:%[a-zA-Z0-9_]+]] = OpTypePointer UniformConstant [[type_sampled_image_2]] - -// CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpVariable [[ptr_type_1]] UniformConstant -// CHECK: [[tex2:%[a-zA-Z0-9_]+]] = OpVariable [[ptr_type_1]] UniformConstant -// CHECK: [[tex3:%[a-zA-Z0-9_]+]] = OpVariable [[ptr_type_2]] UniformConstant - -vk::SampledTexture2D tex1 : register(t0); -vk::SampledTexture2D tex2 : register(t1); -vk::SampledTexture2D tex3 : register(t2); +vk::SampledTexture2D tex2df4; +vk::SampledTexture2D tex2duint; +vk::SampledTexture2DArray tex2dArray; +vk::SampledTexture2D tex2d_default; float4 main() : SV_Target { -// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2df4 // CHECK: [[sampled_result1:%[a-zA-Z0-9_]+]] = OpImageSampleImplicitLod %v4float [[tex1_load]] [[v2fc]] None - float4 val1 = tex1.Sample(float2(0.5, 0.25)); + float4 val1 = tex2df4.Sample(float2(0.5, 0.25)); -// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex2]] +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2d_default // CHECK: [[sampled_result2:%[a-zA-Z0-9_]+]] = OpImageSampleImplicitLod %v4float [[tex2_load]] [[v2fc]] ConstOffset [[v2ic]] - float4 val2 = tex2.Sample(float2(0.5, 0.25), int2(2, 3)); + float4 val2 = tex2d_default.Sample(float2(0.5, 0.25), int2(2, 3)); -// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex2]] +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2df4 // CHECK: [[sampled_result3:%[a-zA-Z0-9_]+]] = OpImageSampleImplicitLod %v4float [[tex3_load]] [[v2fc]] ConstOffset|MinLod [[v2ic]] %float_1 - float4 val3 = tex2.Sample(float2(0.5, 0.25), int2(2, 3), 1.0f); + float4 val3 = tex2df4.Sample(float2(0.5, 0.25), int2(2, 3), 1.0f); -// CHECK: [[tex4_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex2]] +// CHECK: [[tex4_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image]] %tex2df4 // CHECK: [[sampled_result4:%[a-zA-Z0-9_]+]] = OpImageSparseSampleImplicitLod %SparseResidencyStruct [[tex4_load]] [[v2fc]] ConstOffset|MinLod [[v2ic]] %float_1 // CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result4]] 0 // CHECK: OpStore %status [[status_0]] uint status; - float4 val4 = tex2.Sample(float2(0.5, 0.25), int2(2, 3), 1.0f, status); + float4 val4 = tex2df4.Sample(float2(0.5, 0.25), int2(2, 3), 1.0f, status); -// CHECK: [[tex5_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_2]] [[tex3]] +// CHECK: [[tex5_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image_uint]] %tex2duint // CHECK: [[sampled_result5:%[a-zA-Z0-9_]+]] = OpImageSampleImplicitLod %v4uint [[tex5_load]] [[v2fc]] None // CHECK: [[val5:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result5]] 0 - uint val5 = tex3.Sample(float2(0.5, 0.25)); + uint val5 = tex2duint.Sample(float2(0.5, 0.25)); + +// CHECK: [[texArr_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_2d_sampled_image_array]] %tex2dArray +// CHECK: [[sampled_arr1:%[a-zA-Z0-9_]+]] = OpImageSampleImplicitLod %v4float [[texArr_load]] [[v3fc]] None + float4 val6 = tex2dArray.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 b37b1fb7e3..59e4c9382f 100644 --- a/utils/hct/gen_intrin_main.txt +++ b/utils/hct/gen_intrin_main.txt @@ -1318,3 +1318,99 @@ namespace VkSampledTexture2DMethods { $match<0, -1> void<4> [[]] GatherCmpBlue(in float<2> x, in float compareValue, in int<2> o1, in int<2> o2, in int<2> o3, in int<2> o4, out uint_only status) : tex2d_t_gather_comp_blue_o4_s; $match<0, -1> void<4> [[]] GatherCmpAlpha(in float<2> x, in float compareValue, in int<2> o1, in int<2> o2, in int<2> o3, in int<2> o4, out uint_only status) : tex2d_t_gather_comp_alpha_o4_s; } namespace + + +namespace VkSampledTexture2DArrayMethods { + float [[ro]] CalculateLevelOfDetail(in float<2> x) : tex2d_t_calc_lod_array; + float [[ro]] CalculateLevelOfDetailUnclamped(in float<2> x) : tex2d_t_calc_lod_unclamped_array; + $match<0, -1> void<4> [[ro]] Gather(in float<3> x) : tex2d_t_gather_array; + $match<0, -1> void<4> [[ro]] Gather(in float<3> x, in int<2> o) : tex2d_t_gather_array_o; + $match<0, -1> void<4> [[ro]] GatherAlpha(in float<3> x) : tex2d_t_gather_alpha_array; + $match<0, -1> void<4> [[ro]] GatherAlpha(in float<3> x, in int<2> o) : tex2d_t_gather_alpha_array_o; + $match<0, -1> void<4> [[ro]] GatherAlpha(in float<3> x, in int<2> o1, in int<2> o2, in int<2> o3, in int<2> o4) : tex2d_t_gather_alpha_array_o4; + $match<0, -1> void<4> [[ro]] GatherBlue(in float<3> x) : tex2d_t_gather_blue_array; + $match<0, -1> void<4> [[ro]] GatherBlue(in float<3> x, in int<2> o) : tex2d_t_gather_blue_array_o; + $match<0, -1> void<4> [[ro]] GatherBlue(in float<3> x, in int<2> o1, in int<2> o2, in int<2> o3, in int<2> o4) : tex2d_t_gather_blue_array_o4; + $match<0, -1> void<4> [[ro]] GatherCmp(in float<3> x, in float compareValue) : tex2d_t_gather_comp_array; + $match<0, -1> void<4> [[ro]] GatherCmp(in float<3> x, in float compareValue, in int<2> o) : tex2d_t_gather_comp_array_o; + $match<0, -1> void<4> [[ro]] GatherCmpAlpha(in float<3> x, in float compareValue) : tex2d_t_gather_comp_alpha_array; + $match<0, -1> void<4> [[ro]] GatherCmpAlpha(in float<3> x, in float compareValue, in int<2> o) : tex2d_t_gather_comp_alpha_array_o; + $match<0, -1> void<4> [[ro]] GatherCmpAlpha(in float<3> x, in float compareValue, in int<2> o1, in int<2> o2, in int<2> o3, in int<2> o4) : tex2d_t_gather_comp_alpha_array_o4; + $match<0, -1> void<4> [[ro]] GatherCmpBlue(in float<3> x, in float compareValue) : tex2d_t_gather_comp_blue_array; + $match<0, -1> void<4> [[ro]] GatherCmpBlue(in float<3> x, in float compareValue, in int<2> o) : tex2d_t_gather_comp_blue_array_o; + $match<0, -1> void<4> [[ro]] GatherCmpBlue(in float<3> x, in float compareValue, in int<2> o1, in int<2> o2, in int<2> o3, in int<2> o4) : tex2d_t_gather_comp_blue_array_o4; + $match<0, -1> void<4> [[ro]] GatherCmpGreen(in float<3> x, in float compareValue) : tex2d_t_gather_comp_green_array; + $match<0, -1> void<4> [[ro]] GatherCmpGreen(in float<3> x, in float compareValue, in int<2> o) : tex2d_t_gather_comp_green_array_o; + $match<0, -1> void<4> [[ro]] GatherCmpGreen(in float<3> x, in float compareValue, in int<2> o1, in int<2> o2, in int<2> o3, in int<2> o4) : tex2d_t_gather_comp_green_array_o4; + $match<0, -1> void<4> [[ro]] GatherCmpRed(in float<3> x, in float compareValue) : tex2d_t_gather_comp_red_array; + $match<0, -1> void<4> [[ro]] GatherCmpRed(in float<3> x, in float compareValue, in int<2> o) : tex2d_t_gather_comp_red_array_o; + $match<0, -1> void<4> [[ro]] GatherCmpRed(in float<3> x, in float compareValue, in int<2> o1, in int<2> o2, in int<2> o3, in int<2> o4) : tex2d_t_gather_comp_red_array_o4; + $match<0, -1> void<4> [[ro]] GatherGreen(in float<3> x) : tex2d_t_gather_green_array; + $match<0, -1> void<4> [[ro]] GatherGreen(in float<3> x, in int<2> o) : tex2d_t_gather_green_array_o; + $match<0, -1> void<4> [[ro]] GatherGreen(in float<3> x, in int<2> o1, in int<2> o2, in int<2> o3, in int<2> o4) : tex2d_t_gather_green_array_o4; + $match<0, -1> void<4> [[ro]] GatherRed(in float<3> x) : tex2d_t_gather_red_array; + $match<0, -1> void<4> [[ro]] GatherRed(in float<3> x, in int<2> o) : tex2d_t_gather_red_array_o; + $match<0, -1> void<4> [[ro]] GatherRed(in float<3> x, in int<2> o1, in int<2> o2, in int<2> o3, in int<2> o4) : tex2d_t_gather_red_array_o4; + void [[]] GetDimensions(in uint x, out uint_only width, out $type2 height, out $type2 elements, out $type2 levels) : resinfo_uint; + void [[]] GetDimensions(in uint x, out float_like width, out $type2 height, out $type2 elements, out $type2 levels) : resinfo; + void [[]] GetDimensions(out uint_only width, out $type1 height, out $type1 elements) : resinfo_uint_o; + void [[]] GetDimensions(out float_like width, out $type1 height, out $type1 elements) : resinfo_o; + $classT [[ro]] Load(in int<4> x) : tex2d_t_load_array; + $classT [[ro]] Load(in int<4> x, in int<2> o) : tex2d_t_load_array_o; + $classT [[]] Load(in int<4> x, in int<2> o, out uint_only status) : tex2d_t_load_array_o_s; + $classT [[ro]] Sample(in float<3> x) : tex2d_t_array; + $classT [[ro]] Sample(in float<3> x, in int<2> o) : tex2d_t_array_o; + $classT [[ro]] SampleBias(in float<3> x, in float bias) : tex2d_t_bias_array; + $classT [[ro]] SampleBias(in float<3> x, in float bias, in int<2> o) : tex2d_t_bias_array_o; + float_like [[ro]] SampleCmp(in float<3> x, in float compareValue) : tex2d_t_comp_array; + float_like [[ro]] SampleCmp(in float<3> x, in float compareValue, in int<2> o) : tex2d_t_comp_array_o; + float_like [[ro]] SampleCmpBias(in float<3> x, in float compareValue, in float bias) : tex2d_t_comp_bias_array; + float_like [[ro]] SampleCmpBias(in float<3> x, in float compareValue, in float bias, in int<2> o) : tex2d_t_comp_bias_array_o; + float_like [[ro]] SampleCmpGrad(in float<3> x, in float compareValue, in $match<2, 2> float<2> ddx, in $match<2, 2> float<2> ddy) : tex2d_t_comp_dd_array; + float_like [[ro]] SampleCmpGrad(in float<3> x, in float compareValue, in $match<2, 2> float<2> ddx, in $match<2, 2> float<2> ddy, in int<2> o) : tex2d_t_comp_dd_array_o; + float_like [[ro]] SampleCmpLevel(in float<3> x, in float compareValue, in float lod); + float_like [[ro]] SampleCmpLevel(in float<3> x, in float compareValue, in float lod, in int<2> o); + float_like [[ro]] SampleCmpLevelZero(in float<3> x, in float compareValue) : tex2d_t_comp_lz_array; + float_like [[ro]] SampleCmpLevelZero(in float<3> x, in float compareValue, in int<2> o) : tex2d_t_comp_lz_array_o; + $classT [[ro]] SampleGrad(in float<3> x, in $match<2, 2> float<2> ddx, in $match<2, 2> float<2> ddy) : tex2d_t_dd_array; + $classT [[ro]] SampleGrad(in float<3> x, in $match<2, 2> float<2> ddx, in $match<2, 2> float<2> ddy, in int<2> o) : tex2d_t_dd_array_o; + $classT [[ro]] SampleLevel(in float<3> x, in float lod) : tex2d_t_lod_array; + $classT [[ro]] SampleLevel(in float<3> x, in float lod, in int<2> o) : tex2d_t_lod_array_o; + $classT [[ro]] Sample(in float<3> x, in int<2> o, in float clamp) : tex2d_t_array_o_cl; + $classT [[]] Sample(in float<3> x, in int<2> o, in float clamp, out uint_only status) : tex2d_t_array_o_cl_s; + float_like [[ro]] SampleCmp(in float<3> x, in float compareValue, in int<2> o, in float clamp) : tex2d_t_comp_array_o_cl; + float_like [[]] SampleCmp(in float<3> x, in float compareValue, in int<2> o, in float clamp, out uint_only status) : tex2d_t_comp_array_o_cl_s; + float_like [[ro]] SampleCmpBias(in float<3> x, in float compareValue, in float bias, in int<2> o, in float clamp) : tex2d_t_comp_bias_array_o_cl; + float_like [[]] SampleCmpBias(in float<3> x, in float compareValue, in float bias, in int<2> o, in float clamp, out uint_only status) : tex2d_t_comp_bias_array_o_cl_s; + float_like [[ro]] SampleCmpGrad(in float<3> x, in float compareValue, in $match<2, 2> float<2> ddx, in $match<2, 2> float<2> ddy, in int<2> o, in float clamp) : tex2d_t_comp_dd_array_o_cl; + float_like [[]] SampleCmpGrad(in float<3> x, in float compareValue, in $match<2, 2> float<2> ddx, in $match<2, 2> float<2> ddy, in int<2> o, in float clamp, out uint_only status) : tex2d_t_comp_dd_array_o_cl_s; + float_like [[]] SampleCmpLevel(in float<3> x, in float compareValue, in float lod, in int<2> o, out uint_only status); + float_like [[]] SampleCmpLevelZero(in float<3> x, in float compareValue, in int<2> o, out uint_only status) : tex2d_t_comp_array_o_s; + $classT [[]] SampleLevel(in float<3> x, in float lod, in int<2> o, out uint_only status) : tex2d_t_lod_array_o_s; + $classT [[ro]] SampleBias(in float<3> x, in float bias, in int<2> o, in float clamp) : tex2d_t_bias_array_o_cl; + $classT [[]] SampleBias(in float<3> x, in float bias, in int<2> o, in float clamp, out uint_only status) : tex2d_t_bias_array_o_cl_s; + $classT [[ro]] SampleGrad(in float<3> x, in $match<2, 2> float<2> ddx, in $match<2, 2> float<2> ddy, in int<2> o, in float clamp) : tex2d_t_dd_array_o_cl; + $classT [[]] SampleGrad(in float<3> x, in $match<2, 2> float<2> ddx, in $match<2, 2> float<2> ddy, in int<2> o, in float clamp, out uint_only status) : tex2d_t_dd_array_o_cl_s; + $match<0, -1> void<4> [[]] Gather(in float<3> x, in int<2> o, out uint_only status) : tex2d_t_gather_array_o_s; + $match<0, -1> void<4> [[]] GatherRed(in float<3> x, in int<2> o, out uint_only status) : tex2d_t_gather_red_array_o_s; + $match<0, -1> void<4> [[]] GatherRed(in float<3> x, in int<2> o1, in int<2> o2, in int<2> o3, in int<2> o4, out uint_only status) : tex2d_t_gather_red_array_o4_s; + $match<0, -1> void<4> [[]] GatherGreen(in float<3> x, in int<2> o, out uint_only status) : tex2d_t_gather_green_array_o_s; + $match<0, -1> void<4> [[]] GatherGreen(in float<3> x, in int<2> o1, in int<2> o2, in int<2> o3, in int<2> o4, out uint_only status) : tex2d_t_gather_green_array_o4_s; + $match<0, -1> void<4> [[]] GatherBlue(in float<3> x, in int<2> o, out uint_only status) : tex2d_t_gather_blue_array_o_s; + $match<0, -1> void<4> [[]] GatherBlue(in float<3> x, in int<2> o1, in int<2> o2, in int<2> o3, in int<2> o4, out uint_only status) : tex2d_t_gather_blue_array_o4_s; + $match<0, -1> void<4> [[]] GatherAlpha(in float<3> x, in int<2> o, out uint_only status) : tex2d_t_gather_alpha_array_o_s; + $match<0, -1> void<4> [[]] GatherAlpha(in float<3> x, in int<2> o1, in int<2> o2, in int<2> o3, in int<2> o4, out uint_only status) : tex2d_t_gather_alpha_array_o4_s; + $match<0, -1> void<4> [[]] GatherCmp(in float<3> x, in float compareValue, in int<2> o, out uint_only status) : tex2d_t_gather_comp_array_o_s; + $match<0, -1> void<4> [[]] GatherCmpRed(in float<3> x, in float compareValue, in int<2> o, out uint_only status) : tex2d_t_gather_comp_red_array_o_s; + $match<0, -1> void<4> [[]] GatherCmpGreen(in float<3> x, in float compareValue, in int<2> o, out uint_only status) : tex2d_t_gather_comp_green_array_o_s; + $match<0, -1> void<4> [[]] GatherCmpBlue(in float<3> x, in float compareValue, in int<2> o, out uint_only status) : tex2d_t_gather_comp_blue_array_o_s; + $match<0, -1> void<4> [[]] GatherCmpAlpha(in float<3> x, in float compareValue, in int<2> o, out uint_only status) : tex2d_t_gather_comp_alpha_array_o_s; + $match<0, -1> void<4> [[]] GatherCmpRed(in float<3> x, in float compareValue, in int<2> o1, in int<2> o2, in int<2> o3, in int<2> o4, out uint_only status) : tex2d_t_gather_comp_red_array_o4_s; + $match<0, -1> void<4> [[]] GatherCmpGreen(in float<3> x, in float compareValue, in int<2> o1, in int<2> o2, in int<2> o3, in int<2> o4, out uint_only status) : tex2d_t_gather_comp_green_array_o4_s; + $match<0, -1> void<4> [[]] GatherCmpBlue(in float<3> x, in float compareValue, in int<2> o1, in int<2> o2, in int<2> o3, in int<2> o4, out uint_only status) : tex2d_t_gather_comp_blue_array_o4_s; + $match<0, -1> void<4> [[]] GatherCmpAlpha(in float<3> x, in float compareValue, in int<2> o1, in int<2> o2, in int<2> o3, in int<2> o4, out uint_only status) : tex2d_t_gather_comp_alpha_array_o4_s; + $match<0, -1> void<4> [[ro]] GatherRaw(in float<3> x); + $match<0, -1> void<4> [[ro]] GatherRaw(in float<3> x, in int<2> o); + $match<0, -1> void<4> [[]] GatherRaw(in float<3> x, in int<2> o, out uint_only status); +} namespace + diff --git a/utils/hct/hctdb.py b/utils/hct/hctdb.py index 2675ab5c5c..71f035e059 100644 --- a/utils/hct/hctdb.py +++ b/utils/hct/hctdb.py @@ -9651,7 +9651,7 @@ def load_intrinsics(self, intrinsic_defs): acceleration_struct | ray_desc | RayQuery | DxHitObject | Node\w* | RWNode\w* | EmptyNode\w* | AnyNodeOutput\w* | NodeOutputRecord\w* | GroupShared\w* | - VkBufferPointer | LinAlgMatrix | VkSampledTexture2D + VkBufferPointer | LinAlgMatrix | VkSampledTexture2D | VkSampledTexture2DArray $)""", flags=re.VERBOSE, )