diff --git a/include/dxc/dxcapi.internal.h b/include/dxc/dxcapi.internal.h index 80c218ed0d..5d84e64e30 100644 --- a/include/dxc/dxcapi.internal.h +++ b/include/dxc/dxcapi.internal.h @@ -140,11 +140,13 @@ enum LEGAL_INTRINSIC_COMPTYPES { #ifdef ENABLE_SPIRV_CODEGEN LICOMPTYPE_VK_BUFFER_POINTER = 56, - LICOMPTYPE_VK_SAMPLED_TEXTURE2D = 57, - LICOMPTYPE_VK_SAMPLED_TEXTURE2D_ARRAY = 58, - LICOMPTYPE_VK_SAMPLED_TEXTURE2DMS = 59, - LICOMPTYPE_VK_SAMPLED_TEXTURE2DMS_ARRAY = 60, - LICOMPTYPE_COUNT = 61 + LICOMPTYPE_VK_SAMPLED_TEXTURE1D = 57, + LICOMPTYPE_VK_SAMPLED_TEXTURE1D_ARRAY = 58, + LICOMPTYPE_VK_SAMPLED_TEXTURE2D = 59, + LICOMPTYPE_VK_SAMPLED_TEXTURE2D_ARRAY = 60, + LICOMPTYPE_VK_SAMPLED_TEXTURE2DMS = 61, + LICOMPTYPE_VK_SAMPLED_TEXTURE2DMS_ARRAY = 62, + LICOMPTYPE_COUNT = 63 #else LICOMPTYPE_COUNT = 56 #endif diff --git a/tools/clang/lib/SPIRV/AstTypeProbe.cpp b/tools/clang/lib/SPIRV/AstTypeProbe.cpp index ea92107890..f21f5068f2 100644 --- a/tools/clang/lib/SPIRV/AstTypeProbe.cpp +++ b/tools/clang/lib/SPIRV/AstTypeProbe.cpp @@ -929,11 +929,7 @@ bool isTexture(QualType type) { bool isSampledTexture(QualType type) { if (const auto *rt = type->getAs()) { const auto name = rt->getDecl()->getName(); - // TODO(https://github.com/microsoft/DirectXShaderCompiler/issues/7979): Add - // other sampled texture types as needed. - if (name == "SampledTexture2D" || name == "SampledTexture2DArray" || - name == "SampledTexture2DMS" || name == "SampledTexture2DMSArray") - return true; + return name.startswith("SampledTexture"); } return false; } @@ -950,6 +946,9 @@ bool isTextureMS(QualType type) { bool isSampledTextureMS(QualType type) { if (const auto *rt = type->getAs()) { const auto name = rt->getDecl()->getName(); + if (!name.startswith("SampledTexture")) + return false; + if (name == "SampledTexture2DMS" || name == "SampledTexture2DMSArray") return true; } diff --git a/tools/clang/lib/SPIRV/LowerTypeVisitor.cpp b/tools/clang/lib/SPIRV/LowerTypeVisitor.cpp index 8e67da3cb8..00c8e90874 100644 --- a/tools/clang/lib/SPIRV/LowerTypeVisitor.cpp +++ b/tools/clang/lib/SPIRV/LowerTypeVisitor.cpp @@ -850,8 +850,7 @@ const SpirvType *LowerTypeVisitor::lowerVkTypeInVkNamespace( assert(visitedTypeStack.size() == visitedTypeStackSize); return pointerType; } - if (name == "SampledTexture2D" || name == "SampledTexture2DArray" || - name == "SampledTexture2DMS" || name == "SampledTexture2DMSArray") { + if (name.startswith("SampledTexture")) { const auto sampledType = hlsl::GetHLSLResourceResultType(type); auto loweredType = lowerType(getElementType(astContext, sampledType), rule, /*isRowMajor*/ llvm::None, srcLoc); @@ -862,13 +861,15 @@ const SpirvType *LowerTypeVisitor::lowerVkTypeInVkNamespace( loweredType = spvContext.getUIntType(32); } - const bool isArray = - (name == "SampledTexture2DArray" || name == "SampledTexture2DMSArray"); - const bool isMS = - (name == "SampledTexture2DMS" || name == "SampledTexture2DMSArray"); + constexpr size_t sampledTexturePrefixLength = sizeof("SampledTexture") - 1; + StringRef suffix = name.drop_front(sampledTexturePrefixLength); + const spv::Dim dimension = + suffix.startswith("1D") ? spv::Dim::Dim1D : spv::Dim::Dim2D; + const bool isArray = suffix.endswith("Array"); + const bool isMS = suffix.find("MS") != StringRef::npos; const auto *imageType = spvContext.getImageType( - loweredType, spv::Dim::Dim2D, ImageType::WithDepth::No, isArray, isMS, + loweredType, dimension, ImageType::WithDepth::No, isArray, isMS, ImageType::WithSampler::Yes, spv::ImageFormat::Unknown); return spvContext.getSampledImageType(imageType); } diff --git a/tools/clang/lib/SPIRV/SpirvEmitter.cpp b/tools/clang/lib/SPIRV/SpirvEmitter.cpp index 765cd60bbf..aa22cb3922 100644 --- a/tools/clang/lib/SPIRV/SpirvEmitter.cpp +++ b/tools/clang/lib/SPIRV/SpirvEmitter.cpp @@ -4413,6 +4413,8 @@ SpirvEmitter::processBufferTextureGetDimensions(const CXXMemberCallExpr *expr) { if ((typeName == "Texture1D" && numArgs > 1) || (typeName == "Texture2D" && numArgs > 2) || + (typeName == "SampledTexture1D" && numArgs > 1) || + (typeName == "SampledTexture1DArray" && numArgs > 2) || (typeName == "SampledTexture2D" && numArgs > 2) || (typeName == "SampledTexture2DArray" && numArgs > 3) || (typeName == "TextureCube" && numArgs > 2) || diff --git a/tools/clang/lib/Sema/SemaHLSL.cpp b/tools/clang/lib/Sema/SemaHLSL.cpp index 61e4f28318..8f548aa807 100644 --- a/tools/clang/lib/Sema/SemaHLSL.cpp +++ b/tools/clang/lib/Sema/SemaHLSL.cpp @@ -200,6 +200,8 @@ enum ArBasicKind { AR_OBJECT_VK_SPV_INTRINSIC_TYPE, AR_OBJECT_VK_SPV_INTRINSIC_RESULT_ID, AR_OBJECT_VK_BUFFER_POINTER, + AR_OBJECT_VK_SAMPLED_TEXTURE1D, + AR_OBJECT_VK_SAMPLED_TEXTURE1D_ARRAY, AR_OBJECT_VK_SAMPLED_TEXTURE2D, AR_OBJECT_VK_SAMPLED_TEXTURE2D_ARRAY, AR_OBJECT_VK_SAMPLED_TEXTURE2DMS, @@ -564,6 +566,8 @@ const UINT g_uBasicKindProps[] = { BPROP_OBJECT, // AR_OBJECT_VK_SPV_INTRINSIC_TYPE use recordType 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_TEXTURE1D + BPROP_OBJECT | BPROP_RBUFFER, // AR_OBJECT_VK_SAMPLED_TEXTURE1D_ARRAY BPROP_OBJECT | BPROP_RBUFFER, // AR_OBJECT_VK_SAMPLED_TEXTURE2D BPROP_OBJECT | BPROP_RBUFFER, // AR_OBJECT_VK_SAMPLED_TEXTURE2D_ARRAY BPROP_OBJECT | BPROP_RBUFFER, // AR_OBJECT_VK_SAMPLED_TEXTURE2DMS @@ -1276,6 +1280,10 @@ static const ArBasicKind g_LinAlgMatrixCT[] = {AR_OBJECT_LINALG_MATRIX, #ifdef ENABLE_SPIRV_CODEGEN static const ArBasicKind g_VKBufferPointerCT[] = {AR_OBJECT_VK_BUFFER_POINTER, AR_BASIC_UNKNOWN}; +static const ArBasicKind g_VKSampledTexture1DCT[] = { + AR_OBJECT_VK_SAMPLED_TEXTURE1D, AR_BASIC_UNKNOWN}; +static const ArBasicKind g_VKSampledTexture1DArrayCT[] = { + AR_OBJECT_VK_SAMPLED_TEXTURE1D_ARRAY, AR_BASIC_UNKNOWN}; static const ArBasicKind g_VKSampledTexture2DCT[] = { AR_OBJECT_VK_SAMPLED_TEXTURE2D, AR_BASIC_UNKNOWN}; static const ArBasicKind g_VKSampledTexture2DArrayCT[] = { @@ -1347,6 +1355,8 @@ const ArBasicKind *g_LegalIntrinsicCompTypes[] = { g_BuiltInTrianglePositionsCT, // LICOMPTYPE_BUILTIN_TRIANGLE_POSITIONS #ifdef ENABLE_SPIRV_CODEGEN g_VKBufferPointerCT, // LICOMPTYPE_VK_BUFFER_POINTER + g_VKSampledTexture1DCT, // LICOMPTYPE_VK_SAMPLED_TEXTURE1D + g_VKSampledTexture1DArrayCT, // LICOMPTYPE_VK_SAMPLED_TEXTURE1D_ARRAY g_VKSampledTexture2DCT, // LICOMPTYPE_VK_SAMPLED_TEXTURE2D g_VKSampledTexture2DArrayCT, // LICOMPTYPE_VK_SAMPLED_TEXTURE2D_ARRAY g_VKSampledTexture2DMSCT, // LICOMPTYPE_VK_SAMPLED_TEXTURE2DMS @@ -1410,7 +1420,8 @@ static const ArBasicKind g_ArBasicKindsAsTypes[] = { AR_OBJECT_VK_SPIRV_TYPE, AR_OBJECT_VK_SPIRV_OPAQUE_TYPE, 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_BUFFER_POINTER, AR_OBJECT_VK_SAMPLED_TEXTURE1D, + AR_OBJECT_VK_SAMPLED_TEXTURE1D_ARRAY, AR_OBJECT_VK_SAMPLED_TEXTURE2D, AR_OBJECT_VK_SAMPLED_TEXTURE2D_ARRAY, AR_OBJECT_VK_SAMPLED_TEXTURE2DMS, AR_OBJECT_VK_SAMPLED_TEXTURE2DMS_ARRAY, #endif // ENABLE_SPIRV_CODEGEN @@ -1524,6 +1535,8 @@ static const uint8_t g_ArBasicKindsTemplateCount[] = { 1, // AR_OBJECT_VK_SPV_INTRINSIC_TYPE 1, // AR_OBJECT_VK_SPV_INTRINSIC_RESULT_ID 2, // AR_OBJECT_VK_BUFFER_POINTER + 1, // AR_OBJECT_VK_SAMPLED_TEXTURE1D + 1, // AR_OBJECT_VK_SAMPLED_TEXTURE1D_ARRAY 1, // AR_OBJECT_VK_SAMPLED_TEXTURE2D 1, // AR_OBJECT_VK_SAMPLED_TEXTURE2D_ARRAY 1, // AR_OBJECT_VK_SAMPLED_TEXTURE2DMS @@ -1681,6 +1694,8 @@ static const SubscriptOperatorRecord g_ArBasicKindsSubscripts[] = { {0, MipsFalse, SampleFalse}, // AR_OBJECT_VK_SPV_INTRINSIC_TYPE {0, MipsFalse, SampleFalse}, // AR_OBJECT_VK_SPV_INTRINSIC_RESULT_ID {0, MipsFalse, SampleFalse}, // AR_OBJECT_VK_BUFFER_POINTER + {1, MipsTrue, SampleFalse}, // AR_OBJECT_VK_SAMPLED_TEXTURE1D + {2, MipsTrue, SampleFalse}, // AR_OBJECT_VK_SAMPLED_TEXTURE1D_ARRAY {2, MipsTrue, SampleFalse}, // AR_OBJECT_VK_SAMPLED_TEXTURE2D {3, MipsTrue, SampleFalse}, // AR_OBJECT_VK_SAMPLED_TEXTURE2D_ARRAY {2, MipsFalse, SampleTrue}, // AR_OBJECT_VK_SAMPLED_TEXTURE2DMS @@ -1854,6 +1869,8 @@ static const char *g_ArBasicTypeNames[] = { "ext_type", "ext_result_id", "BufferPointer", + "SampledTexture1D", + "SampledTexture1DArray", "SampledTexture2D", "SampledTexture2DArray", "SampledTexture2DMS", @@ -2514,6 +2531,14 @@ static void GetIntrinsicMethods(ArBasicKind kind, *intrinsicCount = _countof(g_RayQueryMethods); break; #ifdef ENABLE_SPIRV_CODEGEN + case AR_OBJECT_VK_SAMPLED_TEXTURE1D: + *intrinsics = g_VkSampledTexture1DMethods; + *intrinsicCount = _countof(g_VkSampledTexture1DMethods); + break; + case AR_OBJECT_VK_SAMPLED_TEXTURE1D_ARRAY: + *intrinsics = g_VkSampledTexture1DArrayMethods; + *intrinsicCount = _countof(g_VkSampledTexture1DArrayMethods); + break; case AR_OBJECT_VK_SAMPLED_TEXTURE2D: *intrinsics = g_VkSampledTexture2DMethods; *intrinsicCount = _countof(g_VkSampledTexture2DMethods); @@ -4135,7 +4160,9 @@ 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_TEXTURE1D || + kind == AR_OBJECT_VK_SAMPLED_TEXTURE1D_ARRAY || + kind == AR_OBJECT_VK_SAMPLED_TEXTURE2D || kind == AR_OBJECT_VK_SAMPLED_TEXTURE2D_ARRAY || kind == AR_OBJECT_VK_SAMPLED_TEXTURE2DMS || kind == AR_OBJECT_VK_SAMPLED_TEXTURE2DMS_ARRAY) { @@ -4969,7 +4996,9 @@ class HLSLExternalSource : public ExternalSemaSource { case AR_OBJECT_LEGACY_EFFECT: // used for all legacy effect object types case AR_OBJECT_TEXTURE1D: + case AR_OBJECT_VK_SAMPLED_TEXTURE1D: case AR_OBJECT_TEXTURE1D_ARRAY: + case AR_OBJECT_VK_SAMPLED_TEXTURE1D_ARRAY: case AR_OBJECT_TEXTURE2D: case AR_OBJECT_TEXTURE2D_ARRAY: case AR_OBJECT_TEXTURE3D: @@ -5074,6 +5103,9 @@ class HLSLExternalSource : public ExternalSemaSource { DXASSERT_VALIDBASICKIND(BasicKind); switch (BasicKind) { case AR_OBJECT_TEXTURE1D: +#ifdef ENABLE_SPIRV_CODEGEN + case AR_OBJECT_VK_SAMPLED_TEXTURE1D: +#endif ResKind = DXIL::ResourceKind::Texture1D; ResClass = DXIL::ResourceClass::SRV; return true; @@ -5083,6 +5115,9 @@ class HLSLExternalSource : public ExternalSemaSource { ResClass = DXIL::ResourceClass::UAV; return true; case AR_OBJECT_TEXTURE1D_ARRAY: +#ifdef ENABLE_SPIRV_CODEGEN + case AR_OBJECT_VK_SAMPLED_TEXTURE1D_ARRAY: +#endif ResKind = DXIL::ResourceKind::Texture1DArray; ResClass = DXIL::ResourceClass::SRV; return true; @@ -11690,7 +11725,9 @@ void hlsl::DiagnoseRegisterType(clang::Sema *self, clang::SourceLocation loc, break; case AR_OBJECT_TEXTURE1D: + case AR_OBJECT_VK_SAMPLED_TEXTURE1D: case AR_OBJECT_TEXTURE1D_ARRAY: + case AR_OBJECT_VK_SAMPLED_TEXTURE1D_ARRAY: case AR_OBJECT_TEXTURE2D: case AR_OBJECT_TEXTURE2D_ARRAY: case AR_OBJECT_TEXTURE3D: diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.access.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.access.hlsl new file mode 100644 index 0000000000..ca1ac5e9a6 --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.access.hlsl @@ -0,0 +1,38 @@ +// RUN: %dxc -T ps_6_7 -E main -fcgl %s -spirv | FileCheck %s +// RUN: not %dxc -T ps_6_7 -E main -fcgl %s -spirv -DERROR 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR + +// CHECK: %type_1d_image = OpTypeImage %float 1D 0 0 0 1 Unknown +// CHECK: %type_sampled_image = OpTypeSampledImage %type_1d_image + +vk::SampledTexture1D tex1d; + +struct S { int a; }; + +void main() { +// CHECK: OpStore %pos1 %uint_1 + uint pos1 = 1; + +// CHECK: [[pos1:%[a-zA-Z0-9_]+]] = OpLoad %uint %pos1 +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[tex_image:%[a-zA-Z0-9_]+]] = OpImage %type_1d_image [[tex1_load]] +// CHECK: [[fetch_result:%[a-zA-Z0-9_]+]] = OpImageFetch %v4float [[tex_image]] [[pos1]] Lod %uint_0 +// CHECK: OpStore %a1 [[fetch_result]] + float4 a1 = tex1d[pos1]; + +#ifdef ERROR + S s = { 1 }; +// CHECK-ERROR: error: no viable overloaded operator[] +// CHECK-ERROR: note: candidate function {{.*}} no known conversion from 'S' to 'unsigned int' for 1st argument + float4 val2 = tex1d[s]; + + int2 i2 = int2(1, 2); +// CHECK-ERROR: error: no viable overloaded operator[] +// CHECK-ERROR: note: candidate function {{.*}} no known conversion from '{{int2|vector}}' to 'unsigned int' for 1st argument + float4 val3 = tex1d[i2]; + + int3 i3 = int3(1, 2, 3); +// CHECK-ERROR: error: no viable overloaded operator[] +// CHECK-ERROR: note: candidate function {{.*}} no known conversion from '{{int3|vector}}' to 'unsigned int' for 1st argument + float4 val4 = tex1d[i3]; +#endif +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.calculate-lod-unclamped.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.calculate-lod-unclamped.hlsl new file mode 100644 index 0000000000..cd5bf905d1 --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.calculate-lod-unclamped.hlsl @@ -0,0 +1,19 @@ +// RUN: %dxc -T ps_6_8 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: %type_1d_image = OpTypeImage %float 1D 0 0 0 1 Unknown +// CHECK: %type_sampled_image = OpTypeSampledImage %type_1d_image + +vk::SampledTexture1D tex1d; + +void main() { +// CHECK: OpStore %x %float_0_5 + float x = 0.5; + +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[x:%[a-zA-Z0-9_]+]] = OpLoad %float %x +// CHECK: [[lod_query:%[a-zA-Z0-9_]+]] = OpImageQueryLod %v2float [[tex1_load]] [[x]] +// CHECK: [[unclamped_lod:%[a-zA-Z0-9_]+]] = OpCompositeExtract %float [[lod_query]] 1 +// CHECK: OpStore %lod1 [[unclamped_lod]] + float lod1 = tex1d.CalculateLevelOfDetailUnclamped(x); + +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.calculate-lod.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.calculate-lod.hlsl new file mode 100644 index 0000000000..456555dbb4 --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.calculate-lod.hlsl @@ -0,0 +1,19 @@ +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: %type_1d_image = OpTypeImage %float 1D 0 0 0 1 Unknown +// CHECK: %type_sampled_image = OpTypeSampledImage %type_1d_image + +vk::SampledTexture1D tex1d; + +void main() { +// CHECK: OpStore %x %float_0_5 + float x = 0.5; + +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[x:%[a-zA-Z0-9_]+]] = OpLoad %float %x +// CHECK: [[lod_query:%[a-zA-Z0-9_]+]] = OpImageQueryLod %v2float [[tex1_load]] [[x]] +// CHECK: [[lod:%[a-zA-Z0-9_]+]] = OpCompositeExtract %float [[lod_query]] 0 +// CHECK: OpStore %lod [[lod]] + float lod = tex1d.CalculateLevelOfDetail(x); + +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.get-dimensions.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.get-dimensions.hlsl new file mode 100644 index 0000000000..6b80814189 --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.get-dimensions.hlsl @@ -0,0 +1,75 @@ +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s +// RUN: not %dxc -T ps_6_0 -E main -fcgl %s -spirv -DERROR 2>&1 | FileCheck %s --check-prefix=ERROR + +// CHECK: OpCapability ImageQuery + +// CHECK: [[type_1d_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float 1D 0 0 0 1 Unknown +// CHECK: [[type_1d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_1d_image]] + +vk::SampledTexture1D tex1d; + +void main() { + uint mipLevel = 1; + uint width, height, numLevels, elements, numSamples; + +// CHECK: [[t1_load:%[0-9]+]] = OpLoad [[type_1d_sampled_image]] %tex1d +// CHECK-NEXT: [[image1:%[0-9]+]] = OpImage [[type_1d_image]] [[t1_load]] +// CHECK-NEXT: [[query1:%[0-9]+]] = OpImageQuerySizeLod %uint [[image1]] %int_0 +// CHECK-NEXT: OpStore %width [[query1]] + tex1d.GetDimensions(width); + +// CHECK: [[t2_load:%[0-9]+]] = OpLoad [[type_1d_sampled_image]] %tex1d +// CHECK-NEXT: [[image2:%[0-9]+]] = OpImage [[type_1d_image]] [[t2_load]] +// CHECK-NEXT: [[mip:%[0-9]+]] = OpLoad %uint %mipLevel +// CHECK-NEXT: [[query2:%[0-9]+]] = OpImageQuerySizeLod %uint [[image2]] [[mip]] +// CHECK-NEXT: OpStore %width [[query2]] +// CHECK-NEXT: [[query_level_2:%[0-9]+]] = OpImageQueryLevels %uint [[image2]] +// CHECK-NEXT: OpStore %numLevels [[query_level_2]] + tex1d.GetDimensions(mipLevel, width, numLevels); + + float f_width, f_height, f_numLevels; +// CHECK: [[t3_load:%[0-9]+]] = OpLoad [[type_1d_sampled_image]] %tex1d +// CHECK-NEXT: [[image3:%[0-9]+]] = OpImage [[type_1d_image]] [[t3_load]] +// CHECK-NEXT: [[query3:%[0-9]+]] = OpImageQuerySizeLod %uint [[image3]] %int_0 +// CHECK-NEXT: [[f_query3:%[0-9]+]] = OpConvertUToF %float [[query3]] +// CHECK-NEXT: OpStore %f_width [[f_query3]] + tex1d.GetDimensions(f_width); + +// CHECK: [[t4_load:%[0-9]+]] = OpLoad [[type_1d_sampled_image]] %tex1d +// CHECK-NEXT: [[image4:%[0-9]+]] = OpImage [[type_1d_image]] [[t4_load]] +// CHECK-NEXT: [[mip4:%[0-9]+]] = OpLoad %uint %mipLevel +// CHECK-NEXT: [[query4:%[0-9]+]] = OpImageQuerySizeLod %uint [[image4]] [[mip4]] +// CHECK-NEXT: [[f_query4:%[0-9]+]] = OpConvertUToF %float [[query4]] +// CHECK-NEXT: OpStore %f_width [[f_query4]] +// CHECK-NEXT: [[query_level_4:%[0-9]+]] = OpImageQueryLevels %uint [[image4]] +// CHECK-NEXT: [[f_query_level_4:%[0-9]+]] = OpConvertUToF %float [[query_level_4]] +// CHECK-NEXT: OpStore %f_numLevels [[f_query_level_4]] + tex1d.GetDimensions(mipLevel, f_width, f_numLevels); + + int i_width, i_height, i_numLevels; +// CHECK: [[t5_load:%[0-9]+]] = OpLoad [[type_1d_sampled_image]] %tex1d +// CHECK-NEXT: [[image5:%[0-9]+]] = OpImage [[type_1d_image]] [[t5_load]] +// CHECK-NEXT: [[query5:%[0-9]+]] = OpImageQuerySizeLod %uint [[image5]] %int_0 +// CHECK-NEXT: [[query5_i:%[0-9]+]] = OpBitcast %int [[query5]] +// CHECK-NEXT: OpStore %i_width [[query5_i]] + tex1d.GetDimensions(i_width); + +// CHECK: [[t6_load:%[0-9]+]] = OpLoad [[type_1d_sampled_image]] %tex1d +// CHECK-NEXT: [[image6:%[0-9]+]] = OpImage [[type_1d_image]] [[t6_load]] +// CHECK-NEXT: [[mip6:%[0-9]+]] = OpLoad %uint %mipLevel +// CHECK-NEXT: [[query6:%[0-9]+]] = OpImageQuerySizeLod %uint [[image6]] [[mip6]] +// CHECK-NEXT: [[query6_i:%[0-9]+]] = OpBitcast %int [[query6]] +// CHECK-NEXT: OpStore %i_width [[query6_i]] +// CHECK-NEXT: [[query_level_6:%[0-9]+]] = OpImageQueryLevels %uint [[image6]] +// CHECK-NEXT: [[query_level_6_i:%[0-9]+]] = OpBitcast %int [[query_level_6]] +// CHECK-NEXT: OpStore %i_numLevels [[query_level_6_i]] + tex1d.GetDimensions(mipLevel, i_width, i_numLevels); + +#ifdef ERROR +// ERROR: error: no matching member function for call to 'GetDimensions' + tex1d.GetDimensions(mipLevel, 0, height, numLevels); + +// ERROR: error: no matching member function for call to 'GetDimensions' + tex1d.GetDimensions(width, 20); +#endif +} \ No newline at end of file diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.load.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.load.hlsl new file mode 100644 index 0000000000..e21a7b7373 --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.load.hlsl @@ -0,0 +1,48 @@ +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: %type_1d_image = OpTypeImage %float 1D 0 0 0 1 Unknown +// CHECK: %type_sampled_image = OpTypeSampledImage %type_1d_image + +vk::SampledTexture1D tex1d; + +float4 main(int2 location3: A) : SV_Target { +// CHECK: %location3 = OpFunctionParameter %_ptr_Function_v2int + +// CHECK: [[location3:%[a-zA-Z0-9_]+]] = OpLoad %v2int %location3 +// CHECK: [[coord:%[a-zA-Z0-9_]+]] = OpCompositeExtract %int [[location3]] 0 +// CHECK: [[mip_level:%[a-zA-Z0-9_]+]] = OpCompositeExtract %int [[location3]] 1 +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[tex_image:%[a-zA-Z0-9_]+]] = OpImage %type_1d_image [[tex1_load]] +// CHECK: [[fetch_result:%[a-zA-Z0-9_]+]] = OpImageFetch %v4float [[tex_image]] [[coord]] Lod [[mip_level]] +// CHECK: OpStore %val1 [[fetch_result]] + float4 val1 = tex1d.Load(location3); + +// CHECK: [[location3_2:%[a-zA-Z0-9_]+]] = OpLoad %v2int %location3 +// CHECK: [[coord_2:%[a-zA-Z0-9_]+]] = OpCompositeExtract %int [[location3_2]] 0 +// CHECK: [[mip_level_2:%[a-zA-Z0-9_]+]] = OpCompositeExtract %int [[location3_2]] 1 +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[tex_image_2:%[a-zA-Z0-9_]+]] = OpImage %type_1d_image [[tex2_load]] +// CHECK: [[fetch_result_2:%[a-zA-Z0-9_]+]] = OpImageFetch %v4float [[tex_image_2]] [[coord_2]] Lod|ConstOffset [[mip_level_2]] %int_1 +// CHECK: OpStore %val2 [[fetch_result_2]] + float4 val2 = tex1d.Load(location3, 1); + +///////////////////////////////// +/// Using the Status argument /// +///////////////////////////////// + +// CHECK: [[location3_3:%[a-zA-Z0-9_]+]] = OpLoad %v2int %location3 +// CHECK: [[coord_3:%[a-zA-Z0-9_]+]] = OpCompositeExtract %int [[location3_3]] 0 +// CHECK: [[mip_level_3:%[a-zA-Z0-9_]+]] = OpCompositeExtract %int [[location3_3]] 1 +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[tex_image_3:%[a-zA-Z0-9_]+]] = OpImage %type_1d_image [[tex3_load]] +// CHECK: [[sparse_fetch_result:%[a-zA-Z0-9_]+]] = OpImageSparseFetch %SparseResidencyStruct [[tex_image_3]] [[coord_3]] Lod|ConstOffset [[mip_level_3]] %int_1 +// CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sparse_fetch_result]] 0 +// CHECK: OpStore %status [[status_0]] + +// CHECK: [[sampled_texel:%[a-zA-Z0-9_]+]] = OpCompositeExtract %v4float [[sparse_fetch_result]] 1 +// CHECK: OpStore %val3 [[sampled_texel]] + uint status; + float4 val3 = tex1d.Load(location3, 1, status); + + return 1.0; +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.mips-access.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.mips-access.hlsl new file mode 100644 index 0000000000..e7fe323b76 --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.mips-access.hlsl @@ -0,0 +1,20 @@ +// RUN: %dxc -T ps_6_7 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: %type_1d_image = OpTypeImage %float 1D 0 0 0 1 Unknown +// CHECK: %type_sampled_image = OpTypeSampledImage %type_1d_image + +vk::SampledTexture1D tex1d; + +void main() { +// CHECK: OpStore %pos1 %uint_1 + + uint pos1 = 1; + +// CHECK: [[pos1:%[a-zA-Z0-9_]+]] = OpLoad %uint %pos1 +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[tex_image:%[a-zA-Z0-9_]+]] = OpImage %type_1d_image [[tex1_load]] +// CHECK: [[fetch_result:%[a-zA-Z0-9_]+]] = OpImageFetch %v4float [[tex_image]] [[pos1]] Lod %uint_2 +// CHECK: OpStore %a1 [[fetch_result]] + float4 a1 = tex1d.mips[2][pos1]; + +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.sample-bias.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.sample-bias.hlsl new file mode 100644 index 0000000000..ec600a583c --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.sample-bias.hlsl @@ -0,0 +1,35 @@ +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: %type_1d_image = OpTypeImage %float 1D 0 0 0 1 Unknown +// CHECK: %type_sampled_image = OpTypeSampledImage %type_1d_image + +vk::SampledTexture1D tex1d; + +float4 main() : SV_Target { +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[sampled_result:%[a-zA-Z0-9_]+]] = OpImageSampleImplicitLod %v4float [[tex1_load]] %float_0_5 Bias %float_0_5 +// CHECK: OpStore %val1 [[sampled_result]] + float4 val1 = tex1d.SampleBias(0.5, 0.5f); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[sampled_result_2:%[a-zA-Z0-9_]+]] = OpImageSampleImplicitLod %v4float [[tex2_load]] %float_0_5 Bias|ConstOffset %float_0_5 %int_2 +// CHECK: OpStore %val2 [[sampled_result_2]] + float4 val2 = tex1d.SampleBias(0.5, 0.5f, 2); + +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[sampled_result_3:%[a-zA-Z0-9_]+]] = OpImageSampleImplicitLod %v4float [[tex3_load]] %float_0_5 Bias|ConstOffset|MinLod %float_0_5 %int_2 %float_2_5 +// CHECK: OpStore %val3 [[sampled_result_3]] + float4 val3 = tex1d.SampleBias(0.5, 0.5f, 2, 2.5f); + + +// CHECK: [[tex4_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[sampled_result_4:%[a-zA-Z0-9_]+]] = OpImageSparseSampleImplicitLod %SparseResidencyStruct [[tex4_load]] %float_0_5 Bias|ConstOffset|MinLod %float_0_5 %int_2 %float_2_5 +// CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result_4]] 0 +// CHECK: OpStore %status [[status_0]] +// CHECK: [[sampled_texel:%[a-zA-Z0-9_]+]] = OpCompositeExtract %v4float [[sampled_result_4]] 1 +// CHECK: OpStore %val4 [[sampled_texel]] + uint status; + float4 val4 = tex1d.SampleBias(0.5, 0.5f, 2, 2.5f, status); + + return 1.0; +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.sample-cmp-bias.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.sample-cmp-bias.hlsl new file mode 100644 index 0000000000..274413dc50 --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.sample-cmp-bias.hlsl @@ -0,0 +1,34 @@ +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: %type_1d_image = OpTypeImage %float 1D 0 0 0 1 Unknown +// CHECK: %type_sampled_image = OpTypeSampledImage %type_1d_image + +vk::SampledTexture1D tex1d; + +float4 main() : SV_Target { +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[sampled_result:%[a-zA-Z0-9_]+]] = OpImageSampleDrefImplicitLod %float [[tex1_load]] %float_0_5 %float_1 Bias %float_0_5 +// CHECK: OpStore %val1 [[sampled_result]] + float val1 = tex1d.SampleCmpBias(0.5, 1.0f, 0.5f); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[sampled_result_2:%[a-zA-Z0-9_]+]] = OpImageSampleDrefImplicitLod %float [[tex2_load]] %float_0_5 %float_1 Bias|ConstOffset %float_0_5 %int_2 +// CHECK: OpStore %val2 [[sampled_result_2]] + float val2 = tex1d.SampleCmpBias(0.5, 1.0f, 0.5f, 2); + +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[sampled_result_3:%[a-zA-Z0-9_]+]] = OpImageSampleDrefImplicitLod %float [[tex3_load]] %float_0_5 %float_1 Bias|ConstOffset|MinLod %float_0_5 %int_2 %float_2_5 +// CHECK: OpStore %val3 [[sampled_result_3]] + float val3 = tex1d.SampleCmpBias(0.5, 1.0f, 0.5f, 2, 2.5f); + +// CHECK: [[tex4_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[sampled_result_4:%[a-zA-Z0-9_]+]] = OpImageSparseSampleDrefImplicitLod %SparseResidencyStruct [[tex4_load]] %float_0_5 %float_1 Bias|ConstOffset|MinLod %float_0_5 %int_2 %float_2_5 +// CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result_4]] 0 +// CHECK: OpStore %status [[status_0]] +// CHECK: [[sampled_value:%[a-zA-Z0-9_]+]] = OpCompositeExtract %float [[sampled_result_4]] 1 +// CHECK: OpStore %val4 [[sampled_value]] + uint status; + float val4 = tex1d.SampleCmpBias(0.5, 1.0f, 0.5f, 2, 2.5f, status); + + return 1.0; +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.sample-cmp-grad.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.sample-cmp-grad.hlsl new file mode 100644 index 0000000000..eeb1a4e02c --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.sample-cmp-grad.hlsl @@ -0,0 +1,34 @@ +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: %type_1d_image = OpTypeImage %float 1D 0 0 0 1 Unknown +// CHECK: %type_sampled_image = OpTypeSampledImage %type_1d_image + +vk::SampledTexture1D tex1d; + +float4 main() : SV_Target { +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[sampled_result:%[a-zA-Z0-9_]+]] = OpImageSampleDrefExplicitLod %float [[tex1_load]] %float_0_5 %float_1 Grad %float_1 %float_2 +// CHECK: OpStore %val1 [[sampled_result]] + float val1 = tex1d.SampleCmpGrad(0.5, 1.0f, 1, 2); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[sampled_result_2:%[a-zA-Z0-9_]+]] = OpImageSampleDrefExplicitLod %float [[tex2_load]] %float_0_5 %float_1 Grad|ConstOffset %float_1 %float_2 %int_2 +// CHECK: OpStore %val2 [[sampled_result_2]] + float val2 = tex1d.SampleCmpGrad(0.5, 1.0f, 1, 2, 2); + +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[sampled_result_3:%[a-zA-Z0-9_]+]] = OpImageSampleDrefExplicitLod %float [[tex3_load]] %float_0_5 %float_1 Grad|ConstOffset|MinLod %float_1 %float_2 %int_2 %float_0_5 +// CHECK: OpStore %val3 [[sampled_result_3]] + float val3 = tex1d.SampleCmpGrad(0.5, 1.0f, 1, 2, 2, 0.5); + +// CHECK: [[tex4_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[sampled_result_4:%[a-zA-Z0-9_]+]] = OpImageSparseSampleDrefExplicitLod %SparseResidencyStruct [[tex4_load]] %float_0_5 %float_1 Grad|ConstOffset|MinLod %float_1 %float_2 %int_2 %float_0_5 +// CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result_4]] 0 +// CHECK: OpStore %status [[status_0]] +// CHECK: [[sampled_value:%[a-zA-Z0-9_]+]] = OpCompositeExtract %float [[sampled_result_4]] 1 +// CHECK: OpStore %val4 [[sampled_value]] + uint status; + float val4 = tex1d.SampleCmpGrad(0.5, 1.0f, 1, 2, 2, 0.5, status); + + return 1.0; +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.sample-cmp-level-zero.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.sample-cmp-level-zero.hlsl new file mode 100644 index 0000000000..2b1a8dafb1 --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.sample-cmp-level-zero.hlsl @@ -0,0 +1,29 @@ +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: %type_1d_image = OpTypeImage %float 1D 0 0 0 1 Unknown +// CHECK: %type_sampled_image = OpTypeSampledImage %type_1d_image + +vk::SampledTexture1D tex1d; + +float4 main() : SV_Target { +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[sampled_result:%[a-zA-Z0-9_]+]] = OpImageSampleDrefExplicitLod %float [[tex1_load]] %float_0_5 %float_2 Lod %float_0 +// CHECK: OpStore %val1 [[sampled_result]] + float val1 = tex1d.SampleCmpLevelZero(0.5, 2.0f); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[sampled_result_2:%[a-zA-Z0-9_]+]] = OpImageSampleDrefExplicitLod %float [[tex2_load]] %float_0_5 %float_2 Lod|ConstOffset %float_0 %int_2 +// CHECK: OpStore %val2 [[sampled_result_2]] + float val2 = tex1d.SampleCmpLevelZero(0.5, 2.0f, 2); + +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[sampled_result_3:%[a-zA-Z0-9_]+]] = OpImageSparseSampleDrefExplicitLod %SparseResidencyStruct [[tex3_load]] %float_0_5 %float_2 Lod|ConstOffset %float_0 %int_2 +// CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result_3]] 0 +// CHECK: OpStore %status [[status_0]] +// CHECK: [[sampled_value:%[a-zA-Z0-9_]+]] = OpCompositeExtract %float [[sampled_result_3]] 1 +// CHECK: OpStore %val3 [[sampled_value]] + uint status; + float val3 = tex1d.SampleCmpLevelZero(0.5, 2.0f, 2, status); + + return 1.0; +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.sample-cmp-level.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.sample-cmp-level.hlsl new file mode 100644 index 0000000000..44d4f22a70 --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.sample-cmp-level.hlsl @@ -0,0 +1,29 @@ +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: %type_1d_image = OpTypeImage %float 1D 0 0 0 1 Unknown +// CHECK: %type_sampled_image = OpTypeSampledImage %type_1d_image + +vk::SampledTexture1D tex1d; + +float4 main() : SV_Target { +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[sampled_result:%[a-zA-Z0-9_]+]] = OpImageSampleDrefExplicitLod %float [[tex1_load]] %float_0_5 %float_2 Lod %float_1 +// CHECK: OpStore %val1 [[sampled_result]] + float val1 = tex1d.SampleCmpLevel(0.5, 2.0f, 1.0f); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[sampled_result_2:%[a-zA-Z0-9_]+]] = OpImageSampleDrefExplicitLod %float [[tex2_load]] %float_0_5 %float_2 Lod|ConstOffset %float_1 %int_2 +// CHECK: OpStore %val2 [[sampled_result_2]] + float val2 = tex1d.SampleCmpLevel(0.5, 2.0f, 1.0f, 2); + +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[sampled_result_3:%[a-zA-Z0-9_]+]] = OpImageSparseSampleDrefExplicitLod %SparseResidencyStruct [[tex3_load]] %float_0_5 %float_2 Lod|ConstOffset %float_1 %int_2 +// CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result_3]] 0 +// CHECK: OpStore %status [[status_0]] +// CHECK: [[sampled_value:%[a-zA-Z0-9_]+]] = OpCompositeExtract %float [[sampled_result_3]] 1 +// CHECK: OpStore %val3 [[sampled_value]] + uint status; + float val3 = tex1d.SampleCmpLevel(0.5, 2.0f, 1.0f, 2, status); + + return 1.0; +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.sample-cmp.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.sample-cmp.hlsl new file mode 100644 index 0000000000..ef82e2b74f --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.sample-cmp.hlsl @@ -0,0 +1,35 @@ +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: %type_1d_image = OpTypeImage %float 1D 0 0 0 1 Unknown +// CHECK: %type_sampled_image = OpTypeSampledImage %type_1d_image + +vk::SampledTexture1D tex1d; + +float4 main() : SV_Target { +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[sampled_result:%[a-zA-Z0-9_]+]] = OpImageSampleDrefImplicitLod %float [[tex1_load]] %float_0_5 %float_2 None +// CHECK: OpStore %val1 [[sampled_result]] + float val1 = tex1d.SampleCmp(0.5, 2.0f); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[sampled_result_2:%[a-zA-Z0-9_]+]] = OpImageSampleDrefImplicitLod %float [[tex2_load]] %float_0_5 %float_2 ConstOffset %int_2 +// CHECK: OpStore %val2 [[sampled_result_2]] + float val2 = tex1d.SampleCmp(0.5, 2.0f, 2); + +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[sampled_result_3:%[a-zA-Z0-9_]+]] = OpImageSampleDrefImplicitLod %float [[tex3_load]] %float_0_5 %float_2 ConstOffset|MinLod %int_2 %float_0_5 +// CHECK: OpStore %val3 [[sampled_result_3]] + float val3 = tex1d.SampleCmp(0.5, 2.0f, 2, 0.5); + +// CHECK: [[tex4_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[sampled_result_4:%[a-zA-Z0-9_]+]] = OpImageSparseSampleDrefImplicitLod %SparseResidencyStruct [[tex4_load]] %float_0_5 %float_2 ConstOffset|MinLod %int_2 %float_0_5 +// CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result_4]] 0 +// CHECK: OpStore %status [[status_0]] +// CHECK: [[sampled_value:%[a-zA-Z0-9_]+]] = OpCompositeExtract %float [[sampled_result_4]] 1 +// CHECK: OpStore %val4 [[sampled_value]] + + uint status; + float val4 = tex1d.SampleCmp(0.5, 2.0f, 2, 0.5, status); + + return 1.0; +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.sample-grad.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.sample-grad.hlsl new file mode 100644 index 0000000000..ec3f2b40b1 --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.sample-grad.hlsl @@ -0,0 +1,34 @@ +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: %type_1d_image = OpTypeImage %float 1D 0 0 0 1 Unknown +// CHECK: %type_sampled_image = OpTypeSampledImage %type_1d_image + +vk::SampledTexture1D tex1d; + +float4 main() : SV_Target { +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[sampled_result:%[a-zA-Z0-9_]+]] = OpImageSampleExplicitLod %v4float [[tex1_load]] %float_0_5 Grad %float_1 %float_2 +// CHECK: OpStore %val1 [[sampled_result]] + float4 val1 = tex1d.SampleGrad(0.5, 1, 2); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[sampled_result_2:%[a-zA-Z0-9_]+]] = OpImageSampleExplicitLod %v4float [[tex2_load]] %float_0_5 Grad|ConstOffset %float_1 %float_2 %int_2 +// CHECK: OpStore %val2 [[sampled_result_2]] + float4 val2 = tex1d.SampleGrad(0.5, 1, 2, 2); + +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[sampled_result_3:%[a-zA-Z0-9_]+]] = OpImageSampleExplicitLod %v4float [[tex3_load]] %float_0_5 Grad|ConstOffset|MinLod %float_1 %float_2 %int_2 %float_0_5 +// CHECK: OpStore %val3 [[sampled_result_3]] + float4 val3 = tex1d.SampleGrad(0.5, 1, 2, 2, 0.5); + +// CHECK: [[tex4_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[sampled_result_4:%[a-zA-Z0-9_]+]] = OpImageSparseSampleExplicitLod %SparseResidencyStruct [[tex4_load]] %float_0_5 Grad|ConstOffset|MinLod %float_1 %float_2 %int_2 %float_0_5 +// CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result_4]] 0 +// CHECK: OpStore %status [[status_0]] +// CHECK: [[sampled_texel:%[a-zA-Z0-9_]+]] = OpCompositeExtract %v4float [[sampled_result_4]] 1 +// CHECK: OpStore %val4 [[sampled_texel]] + uint status; + float4 val4 = tex1d.SampleGrad(0.5, 1, 2, 2, 0.5, status); + + return 1.0; +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.sample-level.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.sample-level.hlsl new file mode 100644 index 0000000000..353627e6a7 --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.sample-level.hlsl @@ -0,0 +1,29 @@ +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: %type_1d_image = OpTypeImage %float 1D 0 0 0 1 Unknown +// CHECK: %type_sampled_image = OpTypeSampledImage %type_1d_image + +vk::SampledTexture1D tex1d; + +float4 main() : SV_Target { +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[sampled_result:%[a-zA-Z0-9_]+]] = OpImageSampleExplicitLod %v4float [[tex1_load]] %float_0_5 Lod %float_0_5 +// CHECK: OpStore %val1 [[sampled_result]] + float4 val1 = tex1d.SampleLevel(0.5, 0.5f); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[sampled_result_2:%[a-zA-Z0-9_]+]] = OpImageSampleExplicitLod %v4float [[tex2_load]] %float_0_5 Lod|ConstOffset %float_0_5 %int_2 +// CHECK: OpStore %val2 [[sampled_result_2]] + float4 val2 = tex1d.SampleLevel(0.5, 0.5f, 2); + +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d +// CHECK: [[sampled_result_3:%[a-zA-Z0-9_]+]] = OpImageSparseSampleExplicitLod %SparseResidencyStruct [[tex3_load]] %float_0_5 Lod|ConstOffset %float_0_5 %int_2 +// CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result_3]] 0 +// CHECK: OpStore %status [[status_0]] +// CHECK: [[sampled_texel:%[a-zA-Z0-9_]+]] = OpCompositeExtract %v4float [[sampled_result_3]] 1 +// CHECK: OpStore %val3 [[sampled_texel]] + uint status; + float4 val3 = tex1d.SampleLevel(0.5, 0.5f, 2, status); + + return 1.0; +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.sample.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.sample.hlsl new file mode 100644 index 0000000000..34fe6ecc16 --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.sample.hlsl @@ -0,0 +1,45 @@ +// RUN: %dxc -T ps_6_7 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: %type_1d_image = OpTypeImage %float 1D 0 0 0 1 Unknown +// CHECK: %type_sampled_image = OpTypeSampledImage %type_1d_image +// CHECK: %type_1d_image_0 = OpTypeImage %uint 1D 0 0 0 1 Unknown +// CHECK: %type_sampled_image_0 = OpTypeSampledImage %type_1d_image_0 + +vk::SampledTexture1D tex1df4; +vk::SampledTexture1D tex1duint; +vk::SampledTexture1D tex1d_default; + +float4 main() : SV_Target { +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1df4 +// CHECK: [[sampled_result:%[a-zA-Z0-9_]+]] = OpImageSampleImplicitLod %v4float [[tex1_load]] %float_0_5 None +// CHECK: OpStore %val1 [[sampled_result]] + float4 val1 = tex1df4.Sample(0.5); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d_default +// CHECK: [[sampled_result_2:%[a-zA-Z0-9_]+]] = OpImageSampleImplicitLod %v4float [[tex2_load]] %float_0_5 ConstOffset %int_2 +// CHECK: OpStore %val2 [[sampled_result_2]] + float4 val2 = tex1d_default.Sample(0.5, 2); + +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1df4 +// CHECK: [[sampled_result_3:%[a-zA-Z0-9_]+]] = OpImageSampleImplicitLod %v4float [[tex3_load]] %float_0_5 ConstOffset|MinLod %int_2 %float_1 +// CHECK: OpStore %val3 [[sampled_result_3]] + float4 val3 = tex1df4.Sample(0.5, 2, 1.0f); + + uint status; +// CHECK: [[tex4_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1df4 +// CHECK: [[sampled_result_4:%[a-zA-Z0-9_]+]] = OpImageSparseSampleImplicitLod %SparseResidencyStruct [[tex4_load]] %float_0_5 ConstOffset|MinLod %int_2 %float_1 +// CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result_4]] 0 +// CHECK: OpStore %status [[status_0]] +// CHECK: [[sampled_texel:%[a-zA-Z0-9_]+]] = OpCompositeExtract %v4float [[sampled_result_4]] 1 +// CHECK: OpStore %val4 [[sampled_texel]] + float4 val4 = tex1df4.Sample(0.5, 2, 1.0f, status); + +// CHECK: [[tex5_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image_0 %tex1duint +// CHECK: [[sampled_result_5:%[a-zA-Z0-9_]+]] = OpImageSampleImplicitLod %v4uint [[tex5_load]] %float_0_5 None +// CHECK: [[status_0_2:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result_5]] 0 +// CHECK: OpStore %val5 [[status_0_2]] + + uint val5 = tex1duint.Sample(0.5); + + return 1.0; +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.access.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.access.hlsl new file mode 100644 index 0000000000..4daa96c18d --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.access.hlsl @@ -0,0 +1,39 @@ +// RUN: %dxc -T ps_6_7 -E main -fcgl %s -spirv | FileCheck %s +// RUN: not %dxc -T ps_6_7 -E main -fcgl %s -spirv -DERROR 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR + +// CHECK: %type_1d_image_array = OpTypeImage %float 1D 0 1 0 1 Unknown +// CHECK: %type_sampled_image = OpTypeSampledImage %type_1d_image_array + +vk::SampledTexture1DArray tex1dArray; + +struct S { int a; }; + +void main() { +// CHECK: OpStore %pos1 [[pos1_init:%[a-zA-Z0-9_]+]] + + uint2 pos1 = uint2(1,2); +// CHECK: [[pos1:%[a-zA-Z0-9_]+]] = OpLoad %v2uint %pos1 +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArray +// CHECK: [[tex_image:%[a-zA-Z0-9_]+]] = OpImage %type_1d_image_array [[tex1_load]] +// CHECK: [[fetch_result:%[a-zA-Z0-9_]+]] = OpImageFetch %v4float [[tex_image]] [[pos1]] Lod %uint_0 +// CHECK: OpStore %a1 [[fetch_result]] + + float4 a1 = tex1dArray[pos1]; + +#ifdef ERROR + S s = { 1 }; +// CHECK-ERROR: error: no viable overloaded operator[] +// CHECK-ERROR: note: candidate function {{.*}} no known conversion from 'S' to 'vector' for 1st argument + float4 val2 = tex1dArray[s]; + + uint pos2 = 2; +// CHECK-ERROR: error: no viable overloaded operator[] +// CHECK-ERROR: note: candidate function {{.*}} no known conversion from '{{uint|unsigned int}}' to 'vector' for 1st argument + float4 val3 = tex1dArray[pos2]; + + int3 i3 = int3(1, 2, 3); +// CHECK-ERROR: error: no viable overloaded operator[] +// CHECK-ERROR: note: candidate function {{.*}} no known conversion from '{{int3|vector}}' to 'vector' for 1st argument + float4 val4 = tex1dArray[i3]; +#endif +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.calculate-lod-unclamped.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.calculate-lod-unclamped.hlsl new file mode 100644 index 0000000000..7d44c11e8b --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.calculate-lod-unclamped.hlsl @@ -0,0 +1,22 @@ +// RUN: %dxc -T ps_6_8 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: %type_1d_image_array = OpTypeImage %float 1D 0 1 0 1 Unknown +// CHECK: %type_sampled_image = OpTypeSampledImage %type_1d_image_array + +vk::SampledTexture1DArray tex1dArray; + +void main() { +// CHECK: OpStore %xy [[xy_init:%[a-zA-Z0-9_]+]] + + float2 xy = float2(0.5, 0.5); + +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArray +// CHECK: [[xy:%[a-zA-Z0-9_]+]] = OpLoad %v2float %xy +// CHECK: [[coord:%[a-zA-Z0-9_]+]] = OpCompositeExtract %float [[xy]] 0 +// CHECK: [[lod_query:%[a-zA-Z0-9_]+]] = OpImageQueryLod %v2float [[tex1_load]] [[coord]] +// CHECK: [[unclamped_lod:%[a-zA-Z0-9_]+]] = OpCompositeExtract %float [[lod_query]] 1 +// CHECK: OpStore %lod1 [[unclamped_lod]] + + float lod1 = tex1dArray.CalculateLevelOfDetailUnclamped(xy); + +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.calculate-lod.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.calculate-lod.hlsl new file mode 100644 index 0000000000..534b60d0d4 --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.calculate-lod.hlsl @@ -0,0 +1,22 @@ +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: %type_1d_image_array = OpTypeImage %float 1D 0 1 0 1 Unknown +// CHECK: %type_sampled_image = OpTypeSampledImage %type_1d_image_array + +vk::SampledTexture1DArray tex1dArray; + +void main() { +// CHECK: OpStore %xy [[xy_init:%[a-zA-Z0-9_]+]] + + float2 xy = float2(0.5, 0.5); + +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArray +// CHECK: [[xy:%[a-zA-Z0-9_]+]] = OpLoad %v2float %xy +// CHECK: [[coord:%[a-zA-Z0-9_]+]] = OpCompositeExtract %float [[xy]] 0 +// CHECK: [[lod_query:%[a-zA-Z0-9_]+]] = OpImageQueryLod %v2float [[tex1_load]] [[coord]] +// CHECK: [[lod:%[a-zA-Z0-9_]+]] = OpCompositeExtract %float [[lod_query]] 0 +// CHECK: OpStore %lod [[lod]] + + float lod = tex1dArray.CalculateLevelOfDetail(xy); + +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.get-dimensions.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.get-dimensions.hlsl new file mode 100644 index 0000000000..3c80e3510f --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.get-dimensions.hlsl @@ -0,0 +1,97 @@ +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s +// RUN: not %dxc -T ps_6_0 -E main -fcgl %s -spirv -DERROR 2>&1 | FileCheck %s --check-prefix=ERROR + +// CHECK: OpCapability ImageQuery + +// CHECK: [[type_1d_image_array:%[a-zA-Z0-9_]+]] = OpTypeImage %float 1D 0 1 0 1 Unknown +// CHECK: [[type_1d_sampled_image_array:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_1d_image_array]] + +vk::SampledTexture1DArray tex1dArray; + +void main() { + uint mipLevel = 1; + uint width, height, numLevels, elements, numSamples; + +// CHECK: [[t1_load:%[0-9]+]] = OpLoad [[type_1d_sampled_image_array]] %tex1dArray +// CHECK-NEXT: [[image1:%[0-9]+]] = OpImage [[type_1d_image_array]] [[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 %elements [[query1_1]] + tex1dArray.GetDimensions(width, elements); + +// CHECK: [[t2_load:%[0-9]+]] = OpLoad [[type_1d_sampled_image_array]] %tex1dArray +// CHECK-NEXT: [[image2:%[0-9]+]] = OpImage [[type_1d_image_array]] [[t2_load]] +// CHECK-NEXT: [[mip2:%[0-9]+]] = OpLoad %uint %mipLevel +// CHECK-NEXT: [[query2:%[0-9]+]] = OpImageQuerySizeLod %v2uint [[image2]] [[mip2]] +// CHECK-NEXT: [[query2_0:%[0-9]+]] = OpCompositeExtract %uint [[query2]] 0 +// CHECK-NEXT: OpStore %width [[query2_0]] +// CHECK-NEXT: [[query2_1:%[0-9]+]] = OpCompositeExtract %uint [[query2]] 1 +// CHECK-NEXT: OpStore %elements [[query2_1]] +// CHECK-NEXT: [[query_level_2:%[0-9]+]] = OpImageQueryLevels %uint [[image2]] +// CHECK-NEXT: OpStore %numLevels [[query_level_2]] + tex1dArray.GetDimensions(mipLevel, width, elements, numLevels); + + float f_width, f_elements, f_numLevels; +// CHECK: [[t3_load:%[0-9]+]] = OpLoad [[type_1d_sampled_image_array]] %tex1dArray +// CHECK-NEXT: [[image3:%[0-9]+]] = OpImage [[type_1d_image_array]] [[t3_load]] +// CHECK-NEXT: [[query3:%[0-9]+]] = OpImageQuerySizeLod %v2uint [[image3]] %int_0 +// CHECK-NEXT: [[query3_0:%[0-9]+]] = OpCompositeExtract %uint [[query3]] 0 +// CHECK-NEXT: [[f_query3_0:%[0-9]+]] = OpConvertUToF %float [[query3_0]] +// CHECK-NEXT: OpStore %f_width [[f_query3_0]] +// CHECK-NEXT: [[query3_1:%[0-9]+]] = OpCompositeExtract %uint [[query3]] 1 +// CHECK-NEXT: [[f_query3_1:%[0-9]+]] = OpConvertUToF %float [[query3_1]] +// CHECK-NEXT: OpStore %f_elements [[f_query3_1]] + tex1dArray.GetDimensions(f_width, f_elements); + +// CHECK: [[t4_load:%[0-9]+]] = OpLoad [[type_1d_sampled_image_array]] %tex1dArray +// CHECK-NEXT: [[image4:%[0-9]+]] = OpImage [[type_1d_image_array]] [[t4_load]] +// CHECK-NEXT: [[mip4:%[0-9]+]] = OpLoad %uint %mipLevel +// CHECK-NEXT: [[query4:%[0-9]+]] = OpImageQuerySizeLod %v2uint [[image4]] [[mip4]] +// CHECK-NEXT: [[query4_0:%[0-9]+]] = OpCompositeExtract %uint [[query4]] 0 +// CHECK-NEXT: [[f_query4_0:%[0-9]+]] = OpConvertUToF %float [[query4_0]] +// CHECK-NEXT: OpStore %f_width [[f_query4_0]] +// CHECK-NEXT: [[query4_1:%[0-9]+]] = OpCompositeExtract %uint [[query4]] 1 +// CHECK-NEXT: [[f_query4_1:%[0-9]+]] = OpConvertUToF %float [[query4_1]] +// CHECK-NEXT: OpStore %f_elements [[f_query4_1]] +// CHECK-NEXT: [[query_level_4:%[0-9]+]] = OpImageQueryLevels %uint [[image4]] +// CHECK-NEXT: [[f_query_level_4:%[0-9]+]] = OpConvertUToF %float [[query_level_4]] +// CHECK-NEXT: OpStore %f_numLevels [[f_query_level_4]] + tex1dArray.GetDimensions(mipLevel, f_width, f_elements, f_numLevels); + + int i_width, i_elements, i_numLevels; +// CHECK: [[t5_load:%[0-9]+]] = OpLoad [[type_1d_sampled_image_array]] %tex1dArray +// CHECK-NEXT: [[image5:%[0-9]+]] = OpImage [[type_1d_image_array]] [[t5_load]] +// CHECK-NEXT: [[query5:%[0-9]+]] = OpImageQuerySizeLod %v2uint [[image5]] %int_0 +// CHECK-NEXT: [[query5_0:%[0-9]+]] = OpCompositeExtract %uint [[query5]] 0 +// CHECK-NEXT: [[query5_0_i:%[0-9]+]] = OpBitcast %int [[query5_0]] +// CHECK-NEXT: OpStore %i_width [[query5_0_i]] +// CHECK-NEXT: [[query5_1:%[0-9]+]] = OpCompositeExtract %uint [[query5]] 1 +// CHECK-NEXT: [[query5_1_i:%[0-9]+]] = OpBitcast %int [[query5_1]] +// CHECK-NEXT: OpStore %i_elements [[query5_1_i]] + tex1dArray.GetDimensions(i_width, i_elements); + +// CHECK: [[t6_load:%[0-9]+]] = OpLoad [[type_1d_sampled_image_array]] %tex1dArray +// CHECK-NEXT: [[image6:%[0-9]+]] = OpImage [[type_1d_image_array]] [[t6_load]] +// CHECK-NEXT: [[mip6:%[0-9]+]] = OpLoad %uint %mipLevel +// CHECK-NEXT: [[query6:%[0-9]+]] = OpImageQuerySizeLod %v2uint [[image6]] [[mip6]] +// CHECK-NEXT: [[query6_0:%[0-9]+]] = OpCompositeExtract %uint [[query6]] 0 +// CHECK-NEXT: [[query6_0_i:%[0-9]+]] = OpBitcast %int [[query6_0]] +// CHECK-NEXT: OpStore %i_width [[query6_0_i]] +// CHECK-NEXT: [[query6_1:%[0-9]+]] = OpCompositeExtract %uint [[query6]] 1 +// CHECK-NEXT: [[query6_1_i:%[0-9]+]] = OpBitcast %int [[query6_1]] +// CHECK-NEXT: OpStore %i_elements [[query6_1_i]] +// CHECK-NEXT: [[query_level_6:%[0-9]+]] = OpImageQueryLevels %uint [[image6]] +// CHECK-NEXT: [[query_level_6_i:%[0-9]+]] = OpBitcast %int [[query_level_6]] +// CHECK-NEXT: OpStore %i_numLevels [[query_level_6_i]] + tex1dArray.GetDimensions(mipLevel, i_width, i_elements, i_numLevels); + +#ifdef ERROR +// ERROR: error: Output argument must be an l-value + tex1dArray.GetDimensions(mipLevel, 0, elements, numLevels); + +// ERROR: error: Output argument must be an l-value + tex1dArray.GetDimensions(width, 20); +#endif +} \ No newline at end of file diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.load.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.load.hlsl new file mode 100644 index 0000000000..f8ce76666f --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.load.hlsl @@ -0,0 +1,50 @@ +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: %type_1d_image_array = OpTypeImage %float 1D 0 1 0 1 Unknown +// CHECK: %type_sampled_image = OpTypeSampledImage %type_1d_image_array + +vk::SampledTexture1DArray tex1dArray; + +float4 main(int3 location3: A, int4 location4: B) : SV_Target { +// CHECK: %location3 = OpFunctionParameter %_ptr_Function_v3int +// CHECK: %location4 = OpFunctionParameter %_ptr_Function_v4int +// CHECK: [[location3:%[a-zA-Z0-9_]+]] = OpLoad %v3int %location3 +// CHECK: [[coords:%[a-zA-Z0-9_]+]] = OpVectorShuffle %v2int [[location3]] [[location3]] 0 1 +// CHECK: [[mip_level:%[a-zA-Z0-9_]+]] = OpCompositeExtract %int [[location3]] 2 +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArray +// CHECK: [[tex_image:%[a-zA-Z0-9_]+]] = OpImage %type_1d_image_array [[tex1_load]] +// CHECK: [[fetch_result:%[a-zA-Z0-9_]+]] = OpImageFetch %v4float [[tex_image]] [[coords]] Lod [[mip_level]] +// CHECK: OpStore %val1 [[fetch_result]] +// CHECK: [[location3_2:%[a-zA-Z0-9_]+]] = OpLoad %v3int %location3 +// CHECK: [[coords_2:%[a-zA-Z0-9_]+]] = OpVectorShuffle %v2int [[location3_2]] [[location3_2]] 0 1 +// CHECK: [[mip_level_2:%[a-zA-Z0-9_]+]] = OpCompositeExtract %int [[location3_2]] 2 +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArray +// CHECK: [[tex_image_2:%[a-zA-Z0-9_]+]] = OpImage %type_1d_image_array [[tex2_load]] +// CHECK: [[fetch_result_2:%[a-zA-Z0-9_]+]] = OpImageFetch %v4float [[tex_image_2]] [[coords_2]] Lod|ConstOffset [[mip_level_2]] %int_1 +// CHECK: OpStore %val2 [[fetch_result_2]] +// CHECK: [[location3_3:%[a-zA-Z0-9_]+]] = OpLoad %v3int %location3 +// CHECK: [[coords_3:%[a-zA-Z0-9_]+]] = OpVectorShuffle %v2int [[location3_3]] [[location3_3]] 0 1 +// CHECK: [[mip_level_3:%[a-zA-Z0-9_]+]] = OpCompositeExtract %int [[location3_3]] 2 +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArray +// CHECK: [[tex_image_3:%[a-zA-Z0-9_]+]] = OpImage %type_1d_image_array [[tex3_load]] +// CHECK: [[sparse_fetch_result:%[a-zA-Z0-9_]+]] = OpImageSparseFetch %SparseResidencyStruct [[tex_image_3]] [[coords_3]] Lod|ConstOffset [[mip_level_3]] %int_1 +// CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sparse_fetch_result]] 0 +// CHECK: OpStore %status [[status_0]] + + uint status; + +// CHECK: [[sampled_texel:%[a-zA-Z0-9_]+]] = OpCompositeExtract %v4float [[sparse_fetch_result]] 1 +// CHECK: OpStore %val3 [[sampled_texel]] + + float4 val1 = tex1dArray.Load(location3); + + float4 val2 = tex1dArray.Load(location3, int2(1, 2)); + +///////////////////////////////// +/// Using the Status argument /// +///////////////////////////////// + + float4 val3 = tex1dArray.Load(location3, int2(1, 2), status); + + return 1.0; +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.mips-access.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.mips-access.hlsl new file mode 100644 index 0000000000..cd8e5561c3 --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.mips-access.hlsl @@ -0,0 +1,20 @@ +// RUN: %dxc -T ps_6_7 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: %type_1d_image_array = OpTypeImage %float 1D 0 1 0 1 Unknown +// CHECK: %type_sampled_image = OpTypeSampledImage %type_1d_image_array + +vk::SampledTexture1DArray tex1dArray; + +void main() { +// CHECK: OpStore %pos1 [[pos1_init:%[a-zA-Z0-9_]+]] + + uint2 pos1 = uint2(1,2); +// CHECK: [[pos1:%[a-zA-Z0-9_]+]] = OpLoad %v2uint %pos1 +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArray +// CHECK: [[tex_image:%[a-zA-Z0-9_]+]] = OpImage %type_1d_image_array [[tex1_load]] +// CHECK: [[fetch_result:%[a-zA-Z0-9_]+]] = OpImageFetch %v4float [[tex_image]] [[pos1]] Lod %uint_2 +// CHECK: OpStore %a1 [[fetch_result]] + + float4 a1 = tex1dArray.mips[2][pos1]; + +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.sample-bias.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.sample-bias.hlsl new file mode 100644 index 0000000000..ed9ff5fc83 --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.sample-bias.hlsl @@ -0,0 +1,39 @@ +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: %type_1d_image_array = OpTypeImage %float 1D 0 1 0 1 Unknown +// CHECK: %type_sampled_image = OpTypeSampledImage %type_1d_image_array + +vk::SampledTexture1DArray tex1dArray; + +float4 main() : SV_Target { +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArray +// CHECK: [[sampled_result:%[a-zA-Z0-9_]+]] = OpImageSampleImplicitLod %v4float [[tex1_load]] [[sample_coord:%[a-zA-Z0-9_]+]] Bias %float_0_5 +// CHECK: OpStore %val1 [[sampled_result]] + + float4 val1 = tex1dArray.SampleBias(float2(0.5, 0.25), 0.5f); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArray +// CHECK: [[sampled_result_2:%[a-zA-Z0-9_]+]] = OpImageSampleImplicitLod %v4float [[tex2_load]] [[sample_coord_2:%[a-zA-Z0-9_]+]] Bias|ConstOffset %float_0_5 %int_2 +// CHECK: OpStore %val2 [[sampled_result_2]] + + float4 val2 = tex1dArray.SampleBias(float2(0.5, 0.25), 0.5f, 2); + +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArray +// CHECK: [[sampled_result_3:%[a-zA-Z0-9_]+]] = OpImageSampleImplicitLod %v4float [[tex3_load]] [[sample_coord_3:%[a-zA-Z0-9_]+]] Bias|ConstOffset|MinLod %float_0_5 %int_2 %float_2_5 +// CHECK: OpStore %val3 [[sampled_result_3]] + + float4 val3 = tex1dArray.SampleBias(float2(0.5, 0.25), 0.5f, 2, 2.5f); + +// CHECK: [[tex4_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArray +// CHECK: [[sampled_result_4:%[a-zA-Z0-9_]+]] = OpImageSparseSampleImplicitLod %SparseResidencyStruct [[tex4_load]] [[sample_coord_4:%[a-zA-Z0-9_]+]] Bias|ConstOffset|MinLod %float_0_5 %int_2 %float_2_5 +// CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result_4]] 0 +// CHECK: OpStore %status [[status_0]] + + uint status; +// CHECK: [[sampled_texel:%[a-zA-Z0-9_]+]] = OpCompositeExtract %v4float [[sampled_result_4]] 1 +// CHECK: OpStore %val4 [[sampled_texel]] + + float4 val4 = tex1dArray.SampleBias(float2(0.5, 0.25), 0.5f, 2, 2.5f, status); + + return 1.0; +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.sample-cmp-bias.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.sample-cmp-bias.hlsl new file mode 100644 index 0000000000..87c81c4f4c --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.sample-cmp-bias.hlsl @@ -0,0 +1,39 @@ +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: %type_1d_image_array = OpTypeImage %float 1D 0 1 0 1 Unknown +// CHECK: %type_sampled_image = OpTypeSampledImage %type_1d_image_array + +vk::SampledTexture1DArray tex1dArray; + +float4 main() : SV_Target { +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArray +// CHECK: [[sampled_result:%[a-zA-Z0-9_]+]] = OpImageSampleDrefImplicitLod %float [[tex1_load]] [[sample_coord:%[a-zA-Z0-9_]+]] %float_1 Bias %float_0_5 +// CHECK: OpStore %val1 [[sampled_result]] + + float val1 = tex1dArray.SampleCmpBias(float2(0.5, 0.25), 1.0f, 0.5f); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArray +// CHECK: [[sampled_result_2:%[a-zA-Z0-9_]+]] = OpImageSampleDrefImplicitLod %float [[tex2_load]] [[sample_coord_2:%[a-zA-Z0-9_]+]] %float_1 Bias|ConstOffset %float_0_5 %int_2 +// CHECK: OpStore %val2 [[sampled_result_2]] + + float val2 = tex1dArray.SampleCmpBias(float2(0.5, 0.25), 1.0f, 0.5f, 2); + +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArray +// CHECK: [[sampled_result_3:%[a-zA-Z0-9_]+]] = OpImageSampleDrefImplicitLod %float [[tex3_load]] [[sample_coord_3:%[a-zA-Z0-9_]+]] %float_1 Bias|ConstOffset|MinLod %float_0_5 %int_2 %float_2_5 +// CHECK: OpStore %val3 [[sampled_result_3]] + + float val3 = tex1dArray.SampleCmpBias(float2(0.5, 0.25), 1.0f, 0.5f, 2, 2.5f); + +// CHECK: [[tex4_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArray +// CHECK: [[sampled_result_4:%[a-zA-Z0-9_]+]] = OpImageSparseSampleDrefImplicitLod %SparseResidencyStruct [[tex4_load]] [[sample_coord_4:%[a-zA-Z0-9_]+]] %float_1 Bias|ConstOffset|MinLod %float_0_5 %int_2 %float_2_5 +// CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result_4]] 0 +// CHECK: OpStore %status [[status_0]] + + uint status; +// CHECK: [[sampled_value:%[a-zA-Z0-9_]+]] = OpCompositeExtract %float [[sampled_result_4]] 1 +// CHECK: OpStore %val4 [[sampled_value]] + + float val4 = tex1dArray.SampleCmpBias(float2(0.5, 0.25), 1.0f, 0.5f, 2, 2.5f, status); + + return 1.0; +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.sample-cmp-grad.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.sample-cmp-grad.hlsl new file mode 100644 index 0000000000..364e6c7d82 --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.sample-cmp-grad.hlsl @@ -0,0 +1,39 @@ +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: %type_1d_image_array = OpTypeImage %float 1D 0 1 0 1 Unknown +// CHECK: %type_sampled_image = OpTypeSampledImage %type_1d_image_array + +vk::SampledTexture1DArray tex1dArray; + +float4 main() : SV_Target { +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArray +// CHECK: [[sampled_result:%[a-zA-Z0-9_]+]] = OpImageSampleDrefExplicitLod %float [[tex1_load]] [[sample_coord:%[a-zA-Z0-9_]+]] %float_1 Grad %float_1 %float_2 +// CHECK: OpStore %val1 [[sampled_result]] + + float val1 = tex1dArray.SampleCmpGrad(float2(0.5, 0.25), 1.0f, 1.0, 2.0); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArray +// CHECK: [[sampled_result_2:%[a-zA-Z0-9_]+]] = OpImageSampleDrefExplicitLod %float [[tex2_load]] [[sample_coord_2:%[a-zA-Z0-9_]+]] %float_1 Grad|ConstOffset %float_1 %float_2 %int_2 +// CHECK: OpStore %val2 [[sampled_result_2]] + + float val2 = tex1dArray.SampleCmpGrad(float2(0.5, 0.25), 1.0f, 1.0, 2.0, 2); + +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArray +// CHECK: [[sampled_result_3:%[a-zA-Z0-9_]+]] = OpImageSampleDrefExplicitLod %float [[tex3_load]] [[sample_coord_3:%[a-zA-Z0-9_]+]] %float_1 Grad|ConstOffset|MinLod %float_1 %float_2 %int_2 %float_0_5 +// CHECK: OpStore %val3 [[sampled_result_3]] + + float val3 = tex1dArray.SampleCmpGrad(float2(0.5, 0.25), 1.0f, 1.0, 2.0, 2, 0.5); + +// CHECK: [[tex4_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArray +// CHECK: [[sampled_result_4:%[a-zA-Z0-9_]+]] = OpImageSparseSampleDrefExplicitLod %SparseResidencyStruct [[tex4_load]] [[sample_coord_4:%[a-zA-Z0-9_]+]] %float_1 Grad|ConstOffset|MinLod %float_1 %float_2 %int_2 %float_0_5 +// CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result_4]] 0 +// CHECK: OpStore %status [[status_0]] + + uint status; +// CHECK: [[sampled_value:%[a-zA-Z0-9_]+]] = OpCompositeExtract %float [[sampled_result_4]] 1 +// CHECK: OpStore %val4 [[sampled_value]] + + float val4 = tex1dArray.SampleCmpGrad(float2(0.5, 0.25), 1.0f, 1.0, 2.0, 2, 0.5, status); + + return 1.0; +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.sample-cmp-level-zero.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.sample-cmp-level-zero.hlsl new file mode 100644 index 0000000000..6c1f36961a --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.sample-cmp-level-zero.hlsl @@ -0,0 +1,33 @@ +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: %type_1d_image_array = OpTypeImage %float 1D 0 1 0 1 Unknown +// CHECK: %type_sampled_image = OpTypeSampledImage %type_1d_image_array + +vk::SampledTexture1DArray tex1dArray; + +float4 main() : SV_Target { +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArray +// CHECK: [[sampled_result:%[a-zA-Z0-9_]+]] = OpImageSampleDrefExplicitLod %float [[tex1_load]] [[sample_coord:%[a-zA-Z0-9_]+]] %float_2 Lod %float_0 +// CHECK: OpStore %val1 [[sampled_result]] + + float val1 = tex1dArray.SampleCmpLevelZero(float2(0.5, 0.25), 2.0f); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArray +// CHECK: [[sampled_result_2:%[a-zA-Z0-9_]+]] = OpImageSampleDrefExplicitLod %float [[tex2_load]] [[sample_coord_2:%[a-zA-Z0-9_]+]] %float_2 Lod|ConstOffset %float_0 %int_2 +// CHECK: OpStore %val2 [[sampled_result_2]] + + float val2 = tex1dArray.SampleCmpLevelZero(float2(0.5, 0.25), 2.0f, int2(2,3)); + +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArray +// CHECK: [[sampled_result_3:%[a-zA-Z0-9_]+]] = OpImageSparseSampleDrefExplicitLod %SparseResidencyStruct [[tex3_load]] [[sample_coord_3:%[a-zA-Z0-9_]+]] %float_2 Lod|ConstOffset %float_0 %int_2 +// CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result_3]] 0 +// CHECK: OpStore %status [[status_0]] + + uint status; +// CHECK: [[sampled_value:%[a-zA-Z0-9_]+]] = OpCompositeExtract %float [[sampled_result_3]] 1 +// CHECK: OpStore %val3 [[sampled_value]] + + float val3 = tex1dArray.SampleCmpLevelZero(float2(0.5, 0.25), 2.0f, int2(2,3), status); + + return 1.0; +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.sample-cmp-level.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.sample-cmp-level.hlsl new file mode 100644 index 0000000000..a5ea59245f --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.sample-cmp-level.hlsl @@ -0,0 +1,33 @@ +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: %type_1d_image_array = OpTypeImage %float 1D 0 1 0 1 Unknown +// CHECK: %type_sampled_image = OpTypeSampledImage %type_1d_image_array + +vk::SampledTexture1DArray tex1dArray; + +float4 main() : SV_Target { +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArray +// CHECK: [[sampled_result:%[a-zA-Z0-9_]+]] = OpImageSampleDrefExplicitLod %float [[tex1_load]] [[sample_coord:%[a-zA-Z0-9_]+]] %float_2 Lod %float_1 +// CHECK: OpStore %val1 [[sampled_result]] + + float val1 = tex1dArray.SampleCmpLevel(float2(0.5, 0.25), 2.0f, 1.0f); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArray +// CHECK: [[sampled_result_2:%[a-zA-Z0-9_]+]] = OpImageSampleDrefExplicitLod %float [[tex2_load]] [[sample_coord_2:%[a-zA-Z0-9_]+]] %float_2 Lod|ConstOffset %float_1 %int_2 +// CHECK: OpStore %val2 [[sampled_result_2]] + + float val2 = tex1dArray.SampleCmpLevel(float2(0.5, 0.25), 2.0f, 1.0f, int2(2,3)); + +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArray +// CHECK: [[sampled_result_3:%[a-zA-Z0-9_]+]] = OpImageSparseSampleDrefExplicitLod %SparseResidencyStruct [[tex3_load]] [[sample_coord_3:%[a-zA-Z0-9_]+]] %float_2 Lod|ConstOffset %float_1 %int_2 +// CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result_3]] 0 +// CHECK: OpStore %status [[status_0]] + + uint status; +// CHECK: [[sampled_value:%[a-zA-Z0-9_]+]] = OpCompositeExtract %float [[sampled_result_3]] 1 +// CHECK: OpStore %val3 [[sampled_value]] + + float val3 = tex1dArray.SampleCmpLevel(float2(0.5, 0.25), 2.0f, 1.0f, int2(2,3), status); + + return 1.0; +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.sample-cmp.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.sample-cmp.hlsl new file mode 100644 index 0000000000..2f1b85c505 --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.sample-cmp.hlsl @@ -0,0 +1,39 @@ +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: %type_1d_image_array = OpTypeImage %float 1D 0 1 0 1 Unknown +// CHECK: %type_sampled_image = OpTypeSampledImage %type_1d_image_array + +vk::SampledTexture1DArray tex1dArray; + +float4 main() : SV_Target { +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArray +// CHECK: [[sampled_result:%[a-zA-Z0-9_]+]] = OpImageSampleDrefImplicitLod %float [[tex1_load]] [[sample_coord:%[a-zA-Z0-9_]+]] %float_2 None +// CHECK: OpStore %val1 [[sampled_result]] + + float val1 = tex1dArray.SampleCmp(float2(0.5, 0.25), 2.0f); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArray +// CHECK: [[sampled_result_2:%[a-zA-Z0-9_]+]] = OpImageSampleDrefImplicitLod %float [[tex2_load]] [[sample_coord_2:%[a-zA-Z0-9_]+]] %float_2 ConstOffset %int_2 +// CHECK: OpStore %val2 [[sampled_result_2]] + + float val2 = tex1dArray.SampleCmp(float2(0.5, 0.25), 2.0f, int2(2,3)); + +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArray +// CHECK: [[sampled_result_3:%[a-zA-Z0-9_]+]] = OpImageSampleDrefImplicitLod %float [[tex3_load]] [[sample_coord_3:%[a-zA-Z0-9_]+]] %float_2 ConstOffset|MinLod %int_2 %float_0_5 +// CHECK: OpStore %val3 [[sampled_result_3]] + + float val3 = tex1dArray.SampleCmp(float2(0.5, 0.25), 2.0f, int2(2,3), 0.5); + +// CHECK: [[tex4_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArray +// CHECK: [[sampled_result_4:%[a-zA-Z0-9_]+]] = OpImageSparseSampleDrefImplicitLod %SparseResidencyStruct [[tex4_load]] [[sample_coord_4:%[a-zA-Z0-9_]+]] %float_2 ConstOffset|MinLod %int_2 %float_0_5 +// CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result_4]] 0 +// CHECK: OpStore %status [[status_0]] + + uint status; +// CHECK: [[sampled_value:%[a-zA-Z0-9_]+]] = OpCompositeExtract %float [[sampled_result_4]] 1 +// CHECK: OpStore %val4 [[sampled_value]] + + float val4 = tex1dArray.SampleCmp(float2(0.5, 0.25), 2.0f, int2(2,3), 0.5, status); + + return 1.0; +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.sample-grad.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.sample-grad.hlsl new file mode 100644 index 0000000000..b1b2c29ed1 --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.sample-grad.hlsl @@ -0,0 +1,47 @@ +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: %type_1d_image_array = OpTypeImage %float 1D 0 1 0 1 Unknown +// CHECK: %type_sampled_image = OpTypeSampledImage %type_1d_image_array + +vk::SampledTexture1DArray tex1dArray; + +float4 main() : SV_Target { +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArray +// CHECK: [[sample_ddx:%[a-zA-Z0-9_]+]] = OpCompositeExtract %float [[grad_vec:%[a-zA-Z0-9_]+]] 0 +// CHECK: [[sample_ddy:%[a-zA-Z0-9_]+]] = OpCompositeExtract %float [[grad_vec_2:%[a-zA-Z0-9_]+]] 0 +// CHECK: [[sampled_result:%[a-zA-Z0-9_]+]] = OpImageSampleExplicitLod %v4float [[tex1_load]] [[sample_coord:%[a-zA-Z0-9_]+]] Grad [[sample_grad:%[a-zA-Z0-9_]+]] [[sample_grad_2:%[a-zA-Z0-9_]+]] +// CHECK: OpStore %val1 [[sampled_result]] + + float4 val1 = tex1dArray.SampleGrad(float2(0.5, 0.25), float2(1, 1), float2(2, 2)); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArray +// CHECK: [[sample_ddx_2:%[a-zA-Z0-9_]+]] = OpCompositeExtract %float [[grad_vec_3:%[a-zA-Z0-9_]+]] 0 +// CHECK: [[sample_ddy_2:%[a-zA-Z0-9_]+]] = OpCompositeExtract %float [[grad_vec_4:%[a-zA-Z0-9_]+]] 0 +// CHECK: [[sampled_result_2:%[a-zA-Z0-9_]+]] = OpImageSampleExplicitLod %v4float [[tex2_load]] [[sample_coord_2:%[a-zA-Z0-9_]+]] Grad|ConstOffset [[sample_grad_3:%[a-zA-Z0-9_]+]] [[sample_grad_4:%[a-zA-Z0-9_]+]] %int_2 +// CHECK: OpStore %val2 [[sampled_result_2]] + + float4 val2 = tex1dArray.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 %tex1dArray +// CHECK: [[sample_ddx_3:%[a-zA-Z0-9_]+]] = OpCompositeExtract %float [[grad_vec_5:%[a-zA-Z0-9_]+]] 0 +// CHECK: [[sample_ddy_3:%[a-zA-Z0-9_]+]] = OpCompositeExtract %float [[grad_vec_6:%[a-zA-Z0-9_]+]] 0 +// CHECK: [[sampled_result_3:%[a-zA-Z0-9_]+]] = OpImageSampleExplicitLod %v4float [[tex3_load]] [[sample_coord_3:%[a-zA-Z0-9_]+]] Grad|ConstOffset|MinLod [[sample_grad_5:%[a-zA-Z0-9_]+]] [[sample_grad_6:%[a-zA-Z0-9_]+]] %int_2 %float_0_5 +// CHECK: OpStore %val3 [[sampled_result_3]] + + float4 val3 = tex1dArray.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 %tex1dArray +// CHECK: [[sample_ddx_4:%[a-zA-Z0-9_]+]] = OpCompositeExtract %float [[grad_vec_7:%[a-zA-Z0-9_]+]] 0 +// CHECK: [[sample_ddy_4:%[a-zA-Z0-9_]+]] = OpCompositeExtract %float [[grad_vec_8:%[a-zA-Z0-9_]+]] 0 +// CHECK: [[sampled_result_4:%[a-zA-Z0-9_]+]] = OpImageSparseSampleExplicitLod %SparseResidencyStruct [[tex4_load]] [[sample_coord_4:%[a-zA-Z0-9_]+]] Grad|ConstOffset|MinLod [[sample_grad_7:%[a-zA-Z0-9_]+]] [[sample_grad_8:%[a-zA-Z0-9_]+]] %int_2 %float_0_5 +// CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result_4]] 0 +// CHECK: OpStore %status [[status_0]] + + uint status; +// CHECK: [[sampled_texel:%[a-zA-Z0-9_]+]] = OpCompositeExtract %v4float [[sampled_result_4]] 1 +// CHECK: OpStore %val4 [[sampled_texel]] + + float4 val4 = tex1dArray.SampleGrad(float2(0.5, 0.25), float2(1, 1), float2(2, 2), int2(2,3), 0.5, status); + + return 1.0; +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.sample-level.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.sample-level.hlsl new file mode 100644 index 0000000000..83b21c6240 --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.sample-level.hlsl @@ -0,0 +1,33 @@ +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: %type_1d_image_array = OpTypeImage %float 1D 0 1 0 1 Unknown +// CHECK: %type_sampled_image = OpTypeSampledImage %type_1d_image_array + +vk::SampledTexture1DArray tex1dArray; + +float4 main() : SV_Target { +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArray +// CHECK: [[sampled_result:%[a-zA-Z0-9_]+]] = OpImageSampleExplicitLod %v4float [[tex1_load]] [[sample_coord:%[a-zA-Z0-9_]+]] Lod %float_0_5 +// CHECK: OpStore %val1 [[sampled_result]] + + float4 val1 = tex1dArray.SampleLevel(float2(0.5, 0.25), 0.5f); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArray +// CHECK: [[sampled_result_2:%[a-zA-Z0-9_]+]] = OpImageSampleExplicitLod %v4float [[tex2_load]] [[sample_coord_2:%[a-zA-Z0-9_]+]] Lod|ConstOffset %float_0_5 %int_2 +// CHECK: OpStore %val2 [[sampled_result_2]] + + float4 val2 = tex1dArray.SampleLevel(float2(0.5, 0.25), 0.5f, 2); + +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArray +// CHECK: [[sampled_result_3:%[a-zA-Z0-9_]+]] = OpImageSparseSampleExplicitLod %SparseResidencyStruct [[tex3_load]] [[sample_coord_3:%[a-zA-Z0-9_]+]] Lod|ConstOffset %float_0_5 %int_2 +// CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result_3]] 0 +// CHECK: OpStore %status [[status_0]] + + uint status; +// CHECK: [[sampled_texel:%[a-zA-Z0-9_]+]] = OpCompositeExtract %v4float [[sampled_result_3]] 1 +// CHECK: OpStore %val3 [[sampled_texel]] + + float4 val3 = tex1dArray.SampleLevel(float2(0.5, 0.25), 0.5f, 2, status); + + return 1.0; +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.sample.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.sample.hlsl new file mode 100644 index 0000000000..201f675c1f --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1DArray/vk.sampledtexture1darray.sample.hlsl @@ -0,0 +1,50 @@ +// RUN: %dxc -T ps_6_7 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: %type_1d_image_array = OpTypeImage %float 1D 0 1 0 1 Unknown +// CHECK: %type_sampled_image = OpTypeSampledImage %type_1d_image_array +// CHECK: %type_1d_image_array_0 = OpTypeImage %uint 1D 0 1 0 1 Unknown +// CHECK: %type_sampled_image_0 = OpTypeSampledImage %type_1d_image_array_0 + +vk::SampledTexture1DArray tex1dArrayf4; +vk::SampledTexture1DArray tex1dArrayuint; +vk::SampledTexture1DArray tex1dArray_default; + +float4 main() : SV_Target { +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArrayf4 +// CHECK: [[sampled_result:%[a-zA-Z0-9_]+]] = OpImageSampleImplicitLod %v4float [[tex1_load]] [[sample_coord:%[a-zA-Z0-9_]+]] None +// CHECK: OpStore %val1 [[sampled_result]] + + float4 val1 = tex1dArrayf4.Sample(float2(0.5, 0.25)); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArray_default +// CHECK: [[sampled_result_2:%[a-zA-Z0-9_]+]] = OpImageSampleImplicitLod %v4float [[tex2_load]] [[sample_coord_2:%[a-zA-Z0-9_]+]] ConstOffset %int_2 +// CHECK: OpStore %val2 [[sampled_result_2]] + + float4 val2 = tex1dArray_default.Sample(float2(0.5, 0.25), 2); + +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArrayf4 +// CHECK: [[sampled_result_3:%[a-zA-Z0-9_]+]] = OpImageSampleImplicitLod %v4float [[tex3_load]] [[sample_coord_3:%[a-zA-Z0-9_]+]] ConstOffset|MinLod %int_2 %float_1 +// CHECK: OpStore %val3 [[sampled_result_3]] + + float4 val3 = tex1dArrayf4.Sample(float2(0.5, 0.25), 2, 1.0f); + +// CHECK: [[tex4_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1dArrayf4 +// CHECK: [[sampled_result_4:%[a-zA-Z0-9_]+]] = OpImageSparseSampleImplicitLod %SparseResidencyStruct [[tex4_load]] [[sample_coord_4:%[a-zA-Z0-9_]+]] ConstOffset|MinLod %int_2 %float_1 +// CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result_4]] 0 +// CHECK: OpStore %status [[status_0]] + + uint status; +// CHECK: [[sampled_texel:%[a-zA-Z0-9_]+]] = OpCompositeExtract %v4float [[sampled_result_4]] 1 +// CHECK: OpStore %val4 [[sampled_texel]] + + float4 val4 = tex1dArrayf4.Sample(float2(0.5, 0.25), 2, 1.0f, status); + +// CHECK: [[tex5_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image_0 %tex1dArrayuint +// CHECK: [[sampled_result_5:%[a-zA-Z0-9_]+]] = OpImageSampleImplicitLod %v4uint [[tex5_load]] [[sample_coord_5:%[a-zA-Z0-9_]+]] None +// CHECK: [[status_0_2:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result_5]] 0 +// CHECK: OpStore %val5 [[status_0_2]] + + uint val5 = tex1dArrayuint.Sample(float2(0.5, 0.25)); + + return 1.0; +} diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture2D/vk.sampledtexture2d.get-dimensions.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture2D/vk.sampledtexture2d.get-dimensions.hlsl index 3fa31b34b6..5fec4a1571 100644 --- a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture2D/vk.sampledtexture2d.get-dimensions.hlsl +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture2D/vk.sampledtexture2d.get-dimensions.hlsl @@ -3,9 +3,15 @@ // CHECK: OpCapability ImageQuery +// CHECK: [[type_1d_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float 1D 0 0 0 1 Unknown +// CHECK: [[type_1d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_1d_image]] +// CHECK: [[type_1d_image_array:%[a-zA-Z0-9_]+]] = OpTypeImage %float 1D 0 1 0 1 Unknown +// CHECK: [[type_1d_sampled_image_array:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_1d_image_array]] // 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]] +vk::SampledTexture1D tex1d; +vk::SampledTexture1DArray tex1dArray; vk::SampledTexture2D tex2d; void main() { @@ -72,6 +78,21 @@ void main() { // CHECK-NEXT: OpStore %i_height [[query_1_int]] tex2d.GetDimensions(i_width, i_height); +// CHECK: [[t1d_load:%[0-9]+]] = OpLoad [[type_1d_sampled_image]] %tex1d +// CHECK-NEXT: [[image1d:%[0-9]+]] = OpImage [[type_1d_image]] [[t1d_load]] +// CHECK-NEXT: [[query1d:%[0-9]+]] = OpImageQuerySizeLod %uint [[image1d]] %int_0 +// CHECK-NEXT: OpStore %width [[query1d]] + tex1d.GetDimensions(width); + +// CHECK: [[t1da_load:%[0-9]+]] = OpLoad [[type_1d_sampled_image_array]] %tex1dArray +// CHECK-NEXT: [[image1da:%[0-9]+]] = OpImage [[type_1d_image_array]] [[t1da_load]] +// CHECK-NEXT: [[query1da:%[0-9]+]] = OpImageQuerySizeLod %v2uint [[image1da]] %int_0 +// CHECK-NEXT: [[query1da0:%[0-9]+]] = OpCompositeExtract %uint [[query1da]] 0 +// CHECK-NEXT: OpStore %width [[query1da0]] +// CHECK-NEXT: [[query1da1:%[0-9]+]] = OpCompositeExtract %uint [[query1da]] 1 +// CHECK-NEXT: OpStore %elements [[query1da1]] + tex1dArray.GetDimensions(width, elements); + // 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 diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture2D/vk.sampledtexture2d.mips-access.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture2D/vk.sampledtexture2d.mips-access.hlsl index 4a0c9ae0db..0ee4a5a8f8 100644 --- a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture2D/vk.sampledtexture2d.mips-access.hlsl +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture2D/vk.sampledtexture2d.mips-access.hlsl @@ -8,8 +8,7 @@ vk::SampledTexture2D tex2d; void main() { -// CHECK: OpStore %pos1 [[cu12]] -// CHECK-NEXT: [[pos1:%[0-9]+]] = OpLoad %v2uint %pos1 +// CHECK: [[pos1:%[0-9]+]] = OpLoad %v2uint %pos1 // 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 diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture2D/vk.sampledtexture2d.sample-bias.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture2D/vk.sampledtexture2d.sample-bias.hlsl index fa5811a084..769f319a8e 100644 --- a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture2D/vk.sampledtexture2d.sample-bias.hlsl +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture2D/vk.sampledtexture2d.sample-bias.hlsl @@ -6,9 +6,15 @@ // CHECK: [[v2fc:%[0-9]+]] = OpConstantComposite %v2float %float_0_5 %float_0_25 // CHECK: [[v2ic:%[0-9]+]] = OpConstantComposite %v2int %int_2 %int_3 +// CHECK: [[type_1d_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float 1D 0 0 0 1 Unknown +// CHECK: [[type_1d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_1d_image]] +// CHECK: [[type_1d_image_array:%[a-zA-Z0-9_]+]] = OpTypeImage %float 1D 0 1 0 1 Unknown +// CHECK: [[type_1d_sampled_image_array:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_1d_image_array]] // 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]] +vk::SampledTexture1D tex1d; +vk::SampledTexture1DArray tex1dArray; vk::SampledTexture2D tex2d; float4 main() : SV_Target { @@ -31,5 +37,13 @@ float4 main() : SV_Target { uint status; float4 val4 = tex2d.SampleBias(float2(0.5, 0.25), 0.5f, int2(2, 3), 2.5f, status); +// CHECK: [[tex1d_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_1d_sampled_image]] %tex1d +// CHECK: [[sampled_1d:%[a-zA-Z0-9_]+]] = OpImageSampleImplicitLod %v4float [[tex1d_load]] %float_0_5 Bias|ConstOffset %float_0_5 %int_1 + float4 val5 = tex1d.SampleBias(0.5, 0.5f, 1); + +// CHECK: [[tex1da_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_1d_sampled_image_array]] %tex1dArray +// CHECK: [[sampled_1da:%[a-zA-Z0-9_]+]] = OpImageSampleImplicitLod %v4float [[tex1da_load]] {{%[0-9]+}} Bias|ConstOffset %float_0_5 %int_1 + float4 val6 = tex1dArray.SampleBias(float2(0.5, 0), 0.5f, 1); + return 1.0; } diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture2D/vk.sampledtexture2d.sample-cmp-bias.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture2D/vk.sampledtexture2d.sample-cmp-bias.hlsl index f7eb32c988..26c6ed8ceb 100644 --- a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture2D/vk.sampledtexture2d.sample-cmp-bias.hlsl +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture2D/vk.sampledtexture2d.sample-cmp-bias.hlsl @@ -6,9 +6,15 @@ // CHECK: [[v2fc:%[0-9]+]] = OpConstantComposite %v2float %float_0_5 %float_0_25 // CHECK: [[v2ic:%[0-9]+]] = OpConstantComposite %v2int %int_2 %int_3 +// CHECK: [[type_1d_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float 1D 0 0 0 1 Unknown +// CHECK: [[type_1d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_1d_image]] +// CHECK: [[type_1d_image_array:%[a-zA-Z0-9_]+]] = OpTypeImage %float 1D 0 1 0 1 Unknown +// CHECK: [[type_1d_sampled_image_array:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_1d_image_array]] // 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]] +vk::SampledTexture1D tex1d; +vk::SampledTexture1DArray tex1dArray; vk::SampledTexture2D tex2d; float4 main() : SV_Target { @@ -31,5 +37,13 @@ float4 main() : SV_Target { uint status; float val4 = tex2d.SampleCmpBias(float2(0.5, 0.25), 1.0f, 0.5f, int2(2, 3), 2.5f, status); +// CHECK: [[tex1d_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_1d_sampled_image]] %tex1d +// CHECK: [[sampled_1d:%[a-zA-Z0-9_]+]] = OpImageSampleDrefImplicitLod %float [[tex1d_load]] %float_0_5 %float_1 Bias %float_0_5 + float val5 = tex1d.SampleCmpBias(0.5, 1.0f, 0.5f); + +// CHECK: [[tex1da_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_1d_sampled_image_array]] %tex1dArray +// CHECK: [[sampled_1da:%[a-zA-Z0-9_]+]] = OpImageSampleDrefImplicitLod %float [[tex1da_load]] {{%[0-9]+}} %float_1 Bias %float_0_5 + float val6 = tex1dArray.SampleCmpBias(float2(0.5, 0), 1.0f, 0.5f); + return 1.0; } diff --git a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture2D/vk.sampledtexture2d.sample-cmp-grad.hlsl b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture2D/vk.sampledtexture2d.sample-cmp-grad.hlsl index ed7f61ec31..b43cdde2eb 100644 --- a/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture2D/vk.sampledtexture2d.sample-cmp-grad.hlsl +++ b/tools/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture2D/vk.sampledtexture2d.sample-cmp-grad.hlsl @@ -8,9 +8,15 @@ // CHECK: [[v2f_2:%[0-9]+]] = OpConstantComposite %v2float %float_2 %float_2 // CHECK: [[v2ic:%[0-9]+]] = OpConstantComposite %v2int %int_2 %int_3 +// CHECK: [[type_1d_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float 1D 0 0 0 1 Unknown +// CHECK: [[type_1d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_1d_image]] +// CHECK: [[type_1d_image_array:%[a-zA-Z0-9_]+]] = OpTypeImage %float 1D 0 1 0 1 Unknown +// CHECK: [[type_1d_sampled_image_array:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_1d_image_array]] // 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]] +vk::SampledTexture1D tex1d; +vk::SampledTexture1DArray tex1dArray; vk::SampledTexture2D tex2d; float4 main() : SV_Target { @@ -33,5 +39,13 @@ float4 main() : SV_Target { uint status; float val4 = tex2d.SampleCmpGrad(float2(0.5, 0.25), 1.0f, float2(1, 1), float2(2, 2), int2(2,3), 0.5, status); +// CHECK: [[tex1d_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_1d_sampled_image]] %tex1d +// CHECK: [[sampled_1d:%[a-zA-Z0-9_]+]] = OpImageSampleDrefExplicitLod %float [[tex1d_load]] %float_0_5 %float_1 Grad %float_1 %float_2 + float val5 = tex1d.SampleCmpGrad(0.5, 1.0f, 1.0f, 2.0f); + +// CHECK: [[tex1da_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_1d_sampled_image_array]] %tex1dArray +// CHECK: [[sampled_1da:%[a-zA-Z0-9_]+]] = OpImageSampleDrefExplicitLod %float [[tex1da_load]] {{%[0-9]+}} %float_1 Grad %float_1 %float_2 + float val6 = tex1dArray.SampleCmpGrad(float2(0.5, 0), 1.0f, 1.0f, 2.0f); + return 1.0; } diff --git a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.access.hlsl b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.access.hlsl new file mode 100644 index 0000000000..afd60d101a --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.access.hlsl @@ -0,0 +1,30 @@ +// RUN: %dxc -T ps_6_7 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: [[cu12:%[0-9]+]] = OpConstantComposite %v2uint %uint_1 %uint_2 + +// 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() { +// CHECK: OpStore %pos1 [[cu12]] +// CHECK-NEXT: [[pos1:%[0-9]+]] = OpLoad %v2uint %pos1 +// 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 = 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/utils/hct/gen_intrin_main.txt b/utils/hct/gen_intrin_main.txt index 239f381614..d7d530a193 100644 --- a/utils/hct/gen_intrin_main.txt +++ b/utils/hct/gen_intrin_main.txt @@ -1218,7 +1218,96 @@ namespace VkSubpassInputMSMethods { $classT [[]] SubpassLoad(in int sample) : subpassinputms_load; } namespace -// SPIRV Change Ends +namespace VkSampledTexture1DMethods { + // Use float for DXIL don't support f16 on CalcLOD. + float [[ro]] CalculateLevelOfDetail(in float<1> x) : tex1d_t_calc_lod; + float [[ro]] CalculateLevelOfDetailUnclamped(in float<1> x) : tex1d_t_calc_lod_unclamped; + void [[]] GetDimensions(in uint x, out uint_only width, out $type2 levels) : resinfo_uint; + void [[]] GetDimensions(in uint x, out float_like width, out $type2 levels) : resinfo; + void [[]] GetDimensions(out uint_only width) : resinfo_o; + void [[]] GetDimensions(out float_like width) : resinfo_o; + $classT [[ro]] Load(in int<2> x) : tex1d_t_load; + $classT [[ro]] Load(in int<2> x, in int<1> o) : tex1d_t_load_o; + $classT [[]] Load(in int<2> x, in int<1> o, out uint_only status) : tex1d_t_load_o_s; + $classT [[ro]] Sample(in float<1> x) : tex1d_t; + $classT [[ro]] Sample(in float<1> x, in int<1> o) : tex1d_t_o; + $classT [[ro]] SampleBias(in float<1> x, in float bias) : tex1d_t_bias; + $classT [[ro]] SampleBias(in float<1> x, in float bias, in int<1> o) : tex1d_t_bias_o; + float_like [[ro]] SampleCmp(in float<1> x, in float compareValue) : tex1d_t_comp; + float_like [[ro]] SampleCmp(in float<1> x, in float compareValue, in int<1> o) : tex1d_t_comp_o; + float_like [[ro]] SampleCmpBias(in float<1> x, in float compareValue, in float bias) : tex1d_t_comp_bias; + float_like [[ro]] SampleCmpBias(in float<1> x, in float compareValue, in float bias, in int<1> o) : tex1d_t_comp_bias_o; + float_like [[ro]] SampleCmpGrad(in float<1> x, in float compareValue, in $type1 ddx, in $type1 ddy) : tex1d_t_comp_dd; + float_like [[ro]] SampleCmpGrad(in float<1> x, in float compareValue, in $type1 ddx, in $type1 ddy, in int<1> o) : tex1d_t_comp_dd_o; + float_like [[ro]] SampleCmpLevel(in float<1> x, in float compareValue, in float lod); + float_like [[ro]] SampleCmpLevel(in float<1> x, in float compareValue, in float lod, in int<1> o); + float_like [[ro]] SampleCmpLevelZero(in float<1> x, in float compareValue) : tex1d_t_comp_lz; + float_like [[ro]] SampleCmpLevelZero(in float<1> x, in float compareValue, in int<1> o) : tex1d_t_comp_lz_o; + $classT [[ro]] SampleGrad(in float<1> x, in $type1 ddx, in $type1 ddy) : tex1d_t_dd; + $classT [[ro]] SampleGrad(in float<1> x, in $type1 ddx, in $type1 ddy, in int<1> o) : tex1d_t_dd_o; + $classT [[ro]] SampleLevel(in float<1> x, in float lod) : tex1d_t_lod; + $classT [[ro]] SampleLevel(in float<1> x, in float lod, in int<1> o) : tex1d_t_lod_o; + $classT [[ro]] Sample(in float<1> x, in int<1> o, in float clamp) : tex1d_t_o_cl; + $classT [[]] Sample(in float<1> x, in int<1> o, in float clamp, out uint_only status) : tex1d_t_o_cl_s; + float_like [[ro]] SampleCmp(in float<1> x, in float compareValue, in int<1> o, in float clamp) : tex1d_t_comp_o_cl; + float_like [[]] SampleCmp(in float<1> x, in float compareValue, in int<1> o, in float clamp, out uint_only status) : tex1d_t_comp_o_cl_s; + float_like [[ro]] SampleCmpBias(in float<1> x, in float compareValue, in float bias, in int<1> o, in float clamp) : tex1d_t_comp_bias_o_cl; + float_like [[]] SampleCmpBias(in float<1> x, in float compareValue, in float bias, in int<1> o, in float clamp, out uint_only status) : tex1d_t_comp_bias_o_cl_s; + float_like [[ro]] SampleCmpGrad(in float<1> x, in float compareValue, in $type1 ddx, in $type1 ddy, in int<1> o, in float clamp) : tex1d_t_comp_dd_o_cl; + float_like [[]] SampleCmpGrad(in float<1> x, in float compareValue, in $type1 ddx, in $type1 ddy, in int<1> o, in float clamp, out uint_only status) : tex1d_t_comp_dd_o_cl_s; + float_like [[]] SampleCmpLevel(in float<1> x, in float compareValue, in float lod, in int<1> o, out uint_only status); + float_like [[]] SampleCmpLevelZero(in float<1> x, in float compareValue, in int<1> o, out uint_only status) : tex1d_t_comp_o_s; + $classT [[]] SampleLevel(in float<1> x, in float lod, in int<1> o, out uint_only status) : tex1d_t_lod_o_s; + $classT [[ro]] SampleBias(in float<1> x, in float bias, in int<1> o, in float clamp) : tex1d_t_bias_o_cl; + $classT [[]] SampleBias(in float<1> x, in float bias, in int<1> o, in float clamp, out uint_only status) : tex1d_t_bias_o_cl_s; + $classT [[]] SampleGrad(in float<1> x, in $type1 ddx, in $type1 ddy, in int<1> o, in float clamp) : tex1d_t_dd_o_cl; + $classT [[]] SampleGrad(in float<1> x, in $type1 ddx, in $type1 ddy, in int<1> o, in float clamp, out uint_only status) : tex1d_t_dd_o_cl_s; +} namespace + +namespace VkSampledTexture1DArrayMethods { + float [[ro]] CalculateLevelOfDetail(in float<1> x) : tex1d_t_calc_lod_array; + float [[ro]] CalculateLevelOfDetailUnclamped(in float<1> x) : tex1d_t_calc_lod_unclamped_array; + void [[]] GetDimensions(in uint x, out uint_only width, out $type2 elements, out $type2 levels) : resinfo_uint; + void [[]] GetDimensions(in uint x, out float_like width, out $type2 elements, out $type2 levels) : resinfo; + void [[]] GetDimensions(out uint_only width, out $type1 elements) : resinfo_uint_o; + void [[]] GetDimensions(out float_like width, out $type1 elements) : resinfo_o; + $classT [[ro]] Load(in int<3> x) : tex1d_t_load_array; + $classT [[ro]] Load(in int<3> x, in int<1> o) : tex1d_t_load_array_o; + $classT [[]] Load(in int<3> x, in int<1> o, out uint_only status) : tex1d_t_load_array_o_s; + $classT [[ro]] Sample(in float<2> x) : tex1d_t_array; + $classT [[ro]] Sample(in float<2> x, in int<1> o) : tex1d_t_array_o; + $classT [[ro]] SampleBias(in float<2> x, in float bias) : tex1d_t_bias_array; + $classT [[ro]] SampleBias(in float<2> x, in float bias, in int<1> o) : tex1d_t_bias_array_o; + float_like [[ro]] SampleCmp(in float<2> x, in float compareValue) : tex1d_t_comp_array; + float_like [[ro]] SampleCmp(in float<2> x, in float compareValue, in int<1> o) : tex1d_t_comp_array_o; + float_like [[ro]] SampleCmpBias(in float<2> x, in float compareValue, in float bias) : tex1d_t_comp_bias_array; + float_like [[ro]] SampleCmpBias(in float<2> x, in float compareValue, in float bias, in int<1> o) : tex1d_t_comp_bias_array_o; + float_like [[ro]] SampleCmpGrad(in float<2> x, in float compareValue, in $match<2, 2> float<1> ddx, in $match<2, 2> float<1> ddy) : tex1d_t_comp_dd_array; + float_like [[ro]] SampleCmpGrad(in float<2> x, in float compareValue, in $match<2, 2> float<1> ddx, in $match<2, 2> float<1> ddy, in int<1> o) : tex1d_t_comp_dd_array_o; + float_like [[ro]] SampleCmpLevel(in float<2> x, in float compareValue, in float lod); + float_like [[ro]] SampleCmpLevel(in float<2> x, in float compareValue, in float lod, in int<1> o); + float_like [[ro]] SampleCmpLevelZero(in float<2> x, in float compareValue) : tex1d_t_comp_lz_array; + float_like [[ro]] SampleCmpLevelZero(in float<2> x, in float compareValue, in int<1> o) : tex1d_t_comp_lz_array_o; + $classT [[ro]] SampleGrad(in float<2> x, in $match<2, 2> float<1> ddx, in $match<2, 2> float<1> ddy) : tex1d_t_dd_array; + $classT [[ro]] SampleGrad(in float<2> x, in $match<2, 2> float<1> ddx, in $match<2, 2> float<1> ddy, in int<1> o) : tex1d_t_dd_array_o; + $classT [[ro]] SampleLevel(in float<2> x, in float lod) : tex1d_t_lod_array; + $classT [[ro]] SampleLevel(in float<2> x, in float lod, in int<1> o) : tex1d_t_lod_array_o; + $classT [[ro]] Sample(in float<2> x, in int<1> o, in float clamp) : tex1d_t_array_o_cl; + $classT [[]] Sample(in float<2> x, in int<1> o, in float clamp, out uint_only status) : tex1d_t_array_o_cl_s; + float_like [[ro]] SampleCmp(in float<2> x, in float compareValue, in int<1> o, in float clamp) : tex1d_t_comp_array_o_cl; + float_like [[]] SampleCmp(in float<2> x, in float compareValue, in int<1> o, in float clamp, out uint_only status) : tex1d_t_comp_array_o_cl_s; + float_like [[ro]] SampleCmpBias(in float<2> x, in float compareValue, in float bias, in int<1> o, in float clamp) : tex1d_t_comp_bias_array_o_cl; + float_like [[]] SampleCmpBias(in float<2> x, in float compareValue, in float bias, in int<1> o, in float clamp, out uint_only status) : tex1d_t_comp_bias_array_o_cl_s; + float_like [[ro]] SampleCmpGrad(in float<2> x, in float compareValue, in $match<2, 2> float<1> ddx, in $match<2, 2> float<1> ddy, in int<1> o, in float clamp) : tex1d_t_comp_dd_array_o_cl; + float_like [[]] SampleCmpGrad(in float<2> x, in float compareValue, in $match<2, 2> float<1> ddx, in $match<2, 2> float<1> ddy, in int<1> o, in float clamp, out uint_only status) : tex1d_t_comp_dd_array_o_cl_s; + float_like [[]] SampleCmpLevel(in float<2> x, in float compareValue, in float lod, in int<1> o, out uint_only status); + float_like [[]] SampleCmpLevelZero(in float<2> x, in float compareValue, in int<1> o, out uint_only status) : tex1d_t_comp_array_o_s; + $classT [[]] SampleLevel(in float<2> x, in float lod, in int<1> o, out uint_only status) : tex1d_t_lod_array_o_s; + $classT [[ro]] SampleBias(in float<2> x, in float bias, in int<1> o, in float clamp) : tex1d_t_bias_array_o_cl; + $classT [[]] SampleBias(in float<2> x, in float bias, in int<1> o, in float clamp, out uint_only status) : tex1d_t_bias_array_o_cl_s; + $classT [[ro]] SampleGrad(in float<2> x, in $match<2, 2> float<1> ddx, in $match<2, 2> float<1> ddy, in int<1> o, in float clamp) : tex1d_t_dd_array_o_cl; + $classT [[]] SampleGrad(in float<2> x, in $match<2, 2> float<1> ddx, in $match<2, 2> float<1> ddy, in int<1> o, in float clamp, out uint_only status) : tex1d_t_dd_array_o_cl_s; +} namespace namespace VkSampledTexture2DMethods { $classT [[ro]] Sample(in float<2> x) : tex2d_t; @@ -1311,7 +1400,6 @@ namespace VkSampledTexture2DMethods { $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; @@ -1415,7 +1503,6 @@ namespace VkSampledTexture2DMSMethods { $classT [[]] Load(in int<2> x, in int s, in int<2> o, out uint_only status) : texture2d_ms_o_s; } namespace - namespace VkSampledTexture2DMSArrayMethods { void [[]] GetDimensions(out uint_only width, out $type1 height, out $type1 elements, out $type1 samples) : resinfo_uint_o; void [[]] GetDimensions(out float_like width, out $type1 height, out $type1 elements, out $type1 samples) : resinfo_o; @@ -1424,3 +1511,5 @@ namespace VkSampledTexture2DMSArrayMethods { $classT [[ro]] Load(in int<3> x, in int s, in int<2> o) : texture2darray_ms_o; $classT [[]] Load(in int<3> x, in int s, in int<2> o, out uint_only status) : texture2darray_ms_o_s; } namespace + +// SPIRV Change Ends diff --git a/utils/hct/hctdb.py b/utils/hct/hctdb.py index d1299c2583..31d5a0e962 100644 --- a/utils/hct/hctdb.py +++ b/utils/hct/hctdb.py @@ -9523,7 +9523,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 | VkSampledTexture2DArray + VkBufferPointer | LinAlgMatrix | VkSampledTexture1D | VkSampledTexture1DArray | VkSampledTexture2D | VkSampledTexture2DArray $)""", flags=re.VERBOSE, )