From 30a757960b6d8ff792a59638ed826606e5675409 Mon Sep 17 00:00:00 2001 From: Dan Brown <61992655+danbrown-amd@users.noreply.github.com> Date: Tue, 15 Apr 2025 09:29:20 -0600 Subject: [PATCH 1/3] [spirv] Fixes vk::BufferPointer constructor expression construction. (#7331) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Constructors are now properly attached to the template class declaration instead of a specialization. Closes #6489 (again). --------- Co-authored-by: Nathan Gauër --- tools/clang/lib/AST/ASTContextHLSL.cpp | 16 +++-- tools/clang/lib/Sema/SemaExprCXX.cpp | 63 +++++++++++++------ .../vk.buffer-pointer.from-uint.hlsl | 46 ++++++++++++++ 3 files changed, 102 insertions(+), 23 deletions(-) create mode 100644 tools/clang/test/CodeGenSPIRV/vk.buffer-pointer.from-uint.hlsl diff --git a/tools/clang/lib/AST/ASTContextHLSL.cpp b/tools/clang/lib/AST/ASTContextHLSL.cpp index 2c3c20546f..0a688c03fa 100644 --- a/tools/clang/lib/AST/ASTContextHLSL.cpp +++ b/tools/clang/lib/AST/ASTContextHLSL.cpp @@ -1390,19 +1390,27 @@ CXXRecordDecl *hlsl::DeclareVkBufferPointerType(ASTContext &context, DeclarationName(&context.Idents.get("Get")), true); CanQualType canQualType = recordDecl->getTypeForDecl()->getCanonicalTypeUnqualified(); - CreateConstructorDeclarationWithParams( + auto *copyConstructorDecl = CreateConstructorDeclarationWithParams( context, recordDecl, context.VoidTy, {context.getRValueReferenceType(canQualType)}, {"bufferPointer"}, - context.DeclarationNames.getCXXConstructorName(canQualType), false); - CreateConstructorDeclarationWithParams( + context.DeclarationNames.getCXXConstructorName(canQualType), false, true); + auto *addressConstructorDecl = CreateConstructorDeclarationWithParams( context, recordDecl, context.VoidTy, {context.UnsignedIntTy}, {"address"}, - context.DeclarationNames.getCXXConstructorName(canQualType), false); + context.DeclarationNames.getCXXConstructorName(canQualType), false, true); + hlsl::CreateFunctionTemplateDecl( + context, recordDecl, copyConstructorDecl, + Builder.getTemplateDecl()->getTemplateParameters()->begin(), 2); + hlsl::CreateFunctionTemplateDecl( + context, recordDecl, addressConstructorDecl, + Builder.getTemplateDecl()->getTemplateParameters()->begin(), 2); StringRef OpcodeGroup = GetHLOpcodeGroupName(HLOpcodeGroup::HLIntrinsic); unsigned Opcode = static_cast(IntrinsicOp::MOP_GetBufferContents); methodDecl->addAttr( HLSLIntrinsicAttr::CreateImplicit(context, OpcodeGroup, "", Opcode)); methodDecl->addAttr(HLSLCXXOverloadAttr::CreateImplicit(context)); + copyConstructorDecl->addAttr(HLSLCXXOverloadAttr::CreateImplicit(context)); + addressConstructorDecl->addAttr(HLSLCXXOverloadAttr::CreateImplicit(context)); return Builder.completeDefinition(); } diff --git a/tools/clang/lib/Sema/SemaExprCXX.cpp b/tools/clang/lib/Sema/SemaExprCXX.cpp index 4723bc93e9..5113c56205 100644 --- a/tools/clang/lib/Sema/SemaExprCXX.cpp +++ b/tools/clang/lib/Sema/SemaExprCXX.cpp @@ -1057,26 +1057,51 @@ Sema::BuildCXXTypeConstructExpr(TypeSourceInfo *TInfo, Expr *Arg = Exprs[0]; #ifdef ENABLE_SPIRV_CODEGEN if (hlsl::IsVKBufferPointerType(Ty) && Arg->getType()->isIntegerType()) { - for (auto *ctor : Ty->getAsCXXRecordDecl()->ctors()) { - if (auto *functionType = ctor->getType()->getAs()) { - if (functionType->getNumParams() != 1 || - !functionType->getParamType(0)->isIntegerType()) - continue; - - CanQualType argType = Arg->getType()->getCanonicalTypeUnqualified(); - if (!Arg->isRValue()) { - Arg = ImpCastExprToType(Arg, argType, CK_LValueToRValue).get(); - } - if (argType != Context.UnsignedLongLongTy) { - Arg = ImpCastExprToType(Arg, Context.UnsignedLongLongTy, - CK_IntegralCast) - .get(); - } - return CXXConstructExpr::Create( - Context, Ty, TyBeginLoc, ctor, false, {Arg}, false, false, false, - false, CXXConstructExpr::ConstructionKind::CK_Complete, - SourceRange(LParenLoc, RParenLoc)); + typedef DeclContext::specific_decl_iterator ft_iter; + auto *recordDecl = Ty->getAsCXXRecordDecl(); + auto *specDecl = cast(recordDecl); + auto *templatedDecl = + specDecl->getSpecializedTemplate()->getTemplatedDecl(); + auto functionTemplateDecls = + llvm::iterator_range(ft_iter(templatedDecl->decls_begin()), + ft_iter(templatedDecl->decls_end())); + for (auto *ftd : functionTemplateDecls) { + auto *fd = ftd->getTemplatedDecl(); + if (fd->getNumParams() != 1 || + !fd->getParamDecl(0)->getType()->isIntegerType()) + continue; + + void *insertPos; + auto templateArgs = ftd->getInjectedTemplateArgs(); + auto *functionDecl = ftd->findSpecialization(templateArgs, insertPos); + if (!functionDecl) { + DeclarationNameInfo DInfo(ftd->getDeclName(), + recordDecl->getLocation()); + auto *templateArgList = TemplateArgumentList::CreateCopy( + Context, templateArgs.data(), templateArgs.size()); + functionDecl = CXXConstructorDecl::Create( + Context, recordDecl, Arg->getLocStart(), DInfo, Ty, TInfo, false, + false, false, false); + functionDecl->setFunctionTemplateSpecialization(ftd, templateArgList, + insertPos); + } else if (functionDecl->getDeclKind() != Decl::Kind::CXXConstructor) { + continue; + } + + CanQualType argType = Arg->getType()->getCanonicalTypeUnqualified(); + if (!Arg->isRValue()) { + Arg = ImpCastExprToType(Arg, argType, CK_LValueToRValue).get(); + } + if (argType != Context.UnsignedLongLongTy) { + Arg = ImpCastExprToType(Arg, Context.UnsignedLongLongTy, + CK_IntegralCast) + .get(); } + return CXXConstructExpr::Create( + Context, Ty, TyBeginLoc, cast(functionDecl), + false, {Arg}, false, false, false, false, + CXXConstructExpr::ConstructionKind::CK_Complete, + SourceRange(LParenLoc, RParenLoc)); } } #endif diff --git a/tools/clang/test/CodeGenSPIRV/vk.buffer-pointer.from-uint.hlsl b/tools/clang/test/CodeGenSPIRV/vk.buffer-pointer.from-uint.hlsl new file mode 100644 index 0000000000..b44e1eca09 --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/vk.buffer-pointer.from-uint.hlsl @@ -0,0 +1,46 @@ +// RUN: %dxc -spirv -Od -T cs_6_7 %s | FileCheck %s +// RUN: %dxc -spirv -Od -T cs_6_7 -DALIGN_16 %s | FileCheck %s +// RUN: %dxc -spirv -Od -T cs_6_7 -DNO_PC %s | FileCheck %s + +// Was getting bogus type errors with the defined changes + +#ifdef ALIGN_16 +typedef vk::BufferPointer BufferType; +#else +typedef vk::BufferPointer BufferType; +#endif +#ifndef NO_PC +struct PushConstantStruct { + BufferType push_buffer; +}; +[[vk::push_constant]] PushConstantStruct push_constant; +#endif + +RWStructuredBuffer output; + +// CHECK: [[INT:%[_0-9A-Za-z]*]] = OpTypeInt 32 1 +// CHECK: [[I0:%[_0-9A-Za-z]*]] = OpConstant [[INT]] 0 +// CHECK: [[UINT:%[_0-9A-Za-z]*]] = OpTypeInt 32 0 +// CHECK: [[U0:%[_0-9A-Za-z]*]] = OpConstant [[UINT]] 0 +// CHECK: [[PPUINT:%[_0-9A-Za-z]*]] = OpTypePointer PhysicalStorageBuffer [[UINT]] +// CHECK: [[PFPPUINT:%[_0-9A-Za-z]*]] = OpTypePointer Function [[PPUINT]] +// CHECK: [[PUUINT:%[_0-9A-Za-z]*]] = OpTypePointer Uniform [[UINT]] +// CHECK: [[OUTPUT:%[_0-9A-Za-z]*]] = OpVariable %{{[_0-9A-Za-z]*}} Uniform + +[numthreads(1, 1, 1)] +void main() { + uint64_t addr = 123; + vk::BufferPointer test = vk::BufferPointer(addr); + output[0] = test.Get(); +} + +// CHECK: [[TEST:%[_0-9A-Za-z]*]] = OpVariable [[PFPPUINT]] Function +// CHECK: [[X1:%[_0-9A-Za-z]*]] = OpConvertUToPtr [[PPUINT]] +// CHECK: OpStore [[TEST]] [[X1]] +// CHECK: [[X2:%[_0-9A-Za-z]*]] = OpLoad [[PPUINT]] [[TEST]] Aligned 32 +// CHECK: [[X3:%[_0-9A-Za-z]*]] = OpLoad [[UINT]] [[X2]] Aligned 4 +// CHECK: [[X4:%[_0-9A-Za-z]*]] = OpAccessChain [[PUUINT]] [[OUTPUT]] [[I0]] [[U0]] +// CHECK: OpStore [[X4]] [[X3]] +// CHECK: OpReturn +// CHECK: OpFunctionEnd + From ea3d8466d807fccbee1a3dc16d4b15bafd12d4fe Mon Sep 17 00:00:00 2001 From: Simon Moll Date: Tue, 15 Apr 2025 22:30:11 +0200 Subject: [PATCH 2/3] [SER] Declare all SER HLSL intrinsics (#7347) Simplify merging the SER lowering PRs by declaring all missing SER HLSL intrinsics up front. This reserves stable HLSL opcodes similar to what was done for the DXIL opcodes before. Specification: https://github.com/microsoft/hlsl-specs/blob/main/proposals/0027-shader-execution-reordering.md DXC SER implementation tracker: #7214 --- include/dxc/HlslIntrinsicOp.h | 29 +++++- include/dxc/dxcapi.internal.h | 7 +- lib/HLSL/HLOperationLower.cpp | 128 ++++++++++++++++++++++++++ tools/clang/lib/Sema/SemaHLSL.cpp | 10 +- utils/hct/gen_intrin_main.txt | 28 ++++++ utils/hct/hctdb.py | 1 + utils/hct/hlsl_intrinsic_opcodes.json | 31 ++++++- 7 files changed, 225 insertions(+), 9 deletions(-) diff --git a/include/dxc/HlslIntrinsicOp.h b/include/dxc/HlslIntrinsicOp.h index 68b88822e8..d37c27a38e 100644 --- a/include/dxc/HlslIntrinsicOp.h +++ b/include/dxc/HlslIntrinsicOp.h @@ -336,7 +336,34 @@ enum class IntrinsicOp { MOP_TraceRayInline = 325, MOP_WorldRayDirection = 326, MOP_WorldRayOrigin = 327, + MOP_DxHitObject_FromRayQuery = 363, + MOP_DxHitObject_GetAttributes = 364, + MOP_DxHitObject_GetGeometryIndex = 365, + MOP_DxHitObject_GetHitKind = 366, + MOP_DxHitObject_GetInstanceID = 367, + MOP_DxHitObject_GetInstanceIndex = 368, + MOP_DxHitObject_GetObjectRayDirection = 369, + MOP_DxHitObject_GetObjectRayOrigin = 370, + MOP_DxHitObject_GetObjectToWorld3x4 = 371, + MOP_DxHitObject_GetObjectToWorld4x3 = 372, + MOP_DxHitObject_GetPrimitiveIndex = 373, + MOP_DxHitObject_GetRayFlags = 374, + MOP_DxHitObject_GetRayTCurrent = 375, + MOP_DxHitObject_GetRayTMin = 376, + MOP_DxHitObject_GetShaderTableIndex = 377, + MOP_DxHitObject_GetWorldRayDirection = 378, + MOP_DxHitObject_GetWorldRayOrigin = 379, + MOP_DxHitObject_GetWorldToObject3x4 = 380, + MOP_DxHitObject_GetWorldToObject4x3 = 381, + MOP_DxHitObject_Invoke = 382, + MOP_DxHitObject_IsHit = 383, + MOP_DxHitObject_IsMiss = 384, + MOP_DxHitObject_IsNop = 385, + MOP_DxHitObject_LoadLocalRootTableConstant = 386, + MOP_DxHitObject_MakeMiss = 387, MOP_DxHitObject_MakeNop = 358, + MOP_DxHitObject_SetShaderTableIndex = 388, + MOP_DxHitObject_TraceRay = 389, IOP_DxMaybeReorderThread = 359, MOP_Count = 328, MOP_FinishedCrossGroupSharing = 329, @@ -369,7 +396,7 @@ enum class IntrinsicOp { IOP_usign = 355, MOP_InterlockedUMax = 356, MOP_InterlockedUMin = 357, - Num_Intrinsics = 363, + Num_Intrinsics = 390, }; inline bool HasUnsignedIntrinsicOpcode(IntrinsicOp opcode) { switch (opcode) { diff --git a/include/dxc/dxcapi.internal.h b/include/dxc/dxcapi.internal.h index d37054194b..28bd3e7066 100644 --- a/include/dxc/dxcapi.internal.h +++ b/include/dxc/dxcapi.internal.h @@ -131,12 +131,13 @@ enum LEGAL_INTRINSIC_COMPTYPES { LICOMPTYPE_THREAD_NODE_OUTPUT_RECORDS = 50, LICOMPTYPE_HIT_OBJECT = 51, + LICOMPTYPE_RAY_QUERY = 52, #ifdef ENABLE_SPIRV_CODEGEN - LICOMPTYPE_VK_BUFFER_POINTER = 52, - LICOMPTYPE_COUNT = 53 + LICOMPTYPE_VK_BUFFER_POINTER = 53, + LICOMPTYPE_COUNT = 54 #else - LICOMPTYPE_COUNT = 52 + LICOMPTYPE_COUNT = 53 #endif }; diff --git a/lib/HLSL/HLOperationLower.cpp b/lib/HLSL/HLOperationLower.cpp index c0f9d7fddd..b5114fa34b 100644 --- a/lib/HLSL/HLOperationLower.cpp +++ b/lib/HLSL/HLOperationLower.cpp @@ -6197,6 +6197,77 @@ Value *TranslateMaybeReorderThread(CallInst *CI, IntrinsicOp IOP, bool &Translated) { return nullptr; // TODO: Merge SER DXIL patches } + +Value *TranslateHitObjectFromRayQuery(CallInst *CI, IntrinsicOp IOP, + OP::OpCode OpCode, + HLOperationLowerHelper &Helper, + HLObjectOperationLowerHelper *pObjHelper, + bool &Translated) { + return UndefValue::get(CI->getType()); // TODO: Merge SER DXIL patches +} + +Value *TranslateHitObjectTraceRay(CallInst *CI, IntrinsicOp IOP, + OP::OpCode OpCode, + HLOperationLowerHelper &Helper, + HLObjectOperationLowerHelper *pObjHelper, + bool &Translated) { + return UndefValue::get(CI->getType()); // TODO: Merge SER DXIL patches +} + +Value *TranslateHitObjectInvoke(CallInst *CI, IntrinsicOp IOP, + OP::OpCode OpCode, + HLOperationLowerHelper &Helper, + HLObjectOperationLowerHelper *pObjHelper, + bool &Translated) { + return nullptr; // TODO: Merge SER DXIL patches +} + +Value *TranslateHitObjectGetAttributes(CallInst *CI, IntrinsicOp IOP, + OP::OpCode OpCode, + HLOperationLowerHelper &Helper, + HLObjectOperationLowerHelper *pObjHelper, + bool &Translated) { + return UndefValue::get(CI->getType()); // TODO: Merge SER DXIL patches +} + +Value *TranslateHitObjectScalarGetter(CallInst *CI, IntrinsicOp IOP, + OP::OpCode OpCode, + HLOperationLowerHelper &Helper, + HLObjectOperationLowerHelper *pObjHelper, + bool &Translated) { + return UndefValue::get(CI->getType()); // TODO: Merge SER DXIL patches +} + +Value *TranslateHitObjectVectorGetter(CallInst *CI, IntrinsicOp IOP, + OP::OpCode OpCode, + HLOperationLowerHelper &Helper, + HLObjectOperationLowerHelper *pObjHelper, + bool &Translated) { + return UndefValue::get(CI->getType()); // TODO: Merge SER DXIL patches +} + +Value *TranslateHitObjectMatrixGetter(CallInst *CI, IntrinsicOp IOP, + OP::OpCode OpCode, + HLOperationLowerHelper &Helper, + HLObjectOperationLowerHelper *pObjHelper, + bool &Translated) { + return UndefValue::get(CI->getType()); // TODO: Merge SER DXIL patches +} + +Value *TranslateHitObjectLoadLocalRootTableConstant( + CallInst *CI, IntrinsicOp IOP, OP::OpCode OpCode, + HLOperationLowerHelper &Helper, HLObjectOperationLowerHelper *pObjHelper, + bool &Translated) { + return UndefValue::get(CI->getType()); // TODO: Merge SER DXIL patches +} + +Value *TranslateHitObjectSetShaderTableIndex( + CallInst *CI, IntrinsicOp IOP, OP::OpCode OpCode, + HLOperationLowerHelper &Helper, HLObjectOperationLowerHelper *pObjHelper, + bool &Translated) { + return UndefValue::get(CI->getType()); // TODO: Merge SER DXIL patches +} + } // namespace // Resource Handle. @@ -6908,6 +6979,63 @@ IntrinsicLower gLowerTable[] = { DXIL::OpCode::NumOpCodes}, {IntrinsicOp::MOP_GetBufferContents, UnsupportedVulkanIntrinsic, DXIL::OpCode::NumOpCodes}, + {IntrinsicOp::MOP_DxHitObject_FromRayQuery, TranslateHitObjectFromRayQuery, + DXIL::OpCode::HitObject_FromRayQuery}, + {IntrinsicOp::MOP_DxHitObject_GetAttributes, + TranslateHitObjectGetAttributes, DXIL::OpCode::HitObject_Attributes}, + {IntrinsicOp::MOP_DxHitObject_GetGeometryIndex, + TranslateHitObjectScalarGetter, DXIL::OpCode::HitObject_GeometryIndex}, + {IntrinsicOp::MOP_DxHitObject_GetHitKind, TranslateHitObjectScalarGetter, + DXIL::OpCode::HitObject_HitKind}, + {IntrinsicOp::MOP_DxHitObject_GetInstanceID, TranslateHitObjectScalarGetter, + DXIL::OpCode::HitObject_InstanceID}, + {IntrinsicOp::MOP_DxHitObject_GetInstanceIndex, + TranslateHitObjectScalarGetter, DXIL::OpCode::HitObject_InstanceIndex}, + {IntrinsicOp::MOP_DxHitObject_GetObjectRayDirection, + TranslateHitObjectVectorGetter, + DXIL::OpCode::HitObject_ObjectRayDirection}, + {IntrinsicOp::MOP_DxHitObject_GetObjectRayOrigin, + TranslateHitObjectVectorGetter, DXIL::OpCode::HitObject_ObjectRayOrigin}, + {IntrinsicOp::MOP_DxHitObject_GetObjectToWorld3x4, + TranslateHitObjectMatrixGetter, DXIL::OpCode::HitObject_ObjectToWorld3x4}, + {IntrinsicOp::MOP_DxHitObject_GetObjectToWorld4x3, + TranslateHitObjectMatrixGetter, DXIL::OpCode::HitObject_ObjectToWorld3x4}, + {IntrinsicOp::MOP_DxHitObject_GetPrimitiveIndex, + TranslateHitObjectScalarGetter, DXIL::OpCode::HitObject_PrimitiveIndex}, + {IntrinsicOp::MOP_DxHitObject_GetRayFlags, TranslateHitObjectScalarGetter, + DXIL::OpCode::HitObject_RayFlags}, + {IntrinsicOp::MOP_DxHitObject_GetRayTCurrent, + TranslateHitObjectScalarGetter, DXIL::OpCode::HitObject_RayTCurrent}, + {IntrinsicOp::MOP_DxHitObject_GetRayTMin, TranslateHitObjectScalarGetter, + DXIL::OpCode::HitObject_RayTMin}, + {IntrinsicOp::MOP_DxHitObject_GetShaderTableIndex, + TranslateHitObjectScalarGetter, DXIL::OpCode::HitObject_ShaderTableIndex}, + {IntrinsicOp::MOP_DxHitObject_GetWorldRayDirection, + TranslateHitObjectVectorGetter, DXIL::OpCode::HitObject_WorldRayDirection}, + {IntrinsicOp::MOP_DxHitObject_GetWorldRayOrigin, + TranslateHitObjectVectorGetter, DXIL::OpCode::HitObject_WorldRayOrigin}, + {IntrinsicOp::MOP_DxHitObject_GetWorldToObject3x4, + TranslateHitObjectMatrixGetter, DXIL::OpCode::HitObject_WorldToObject3x4}, + {IntrinsicOp::MOP_DxHitObject_GetWorldToObject4x3, + TranslateHitObjectMatrixGetter, DXIL::OpCode::HitObject_WorldToObject3x4}, + {IntrinsicOp::MOP_DxHitObject_Invoke, TranslateHitObjectInvoke, + DXIL::OpCode::HitObject_Invoke}, + {IntrinsicOp::MOP_DxHitObject_IsHit, TranslateHitObjectScalarGetter, + DXIL::OpCode::HitObject_IsHit}, + {IntrinsicOp::MOP_DxHitObject_IsMiss, TranslateHitObjectScalarGetter, + DXIL::OpCode::HitObject_IsMiss}, + {IntrinsicOp::MOP_DxHitObject_IsNop, TranslateHitObjectScalarGetter, + DXIL::OpCode::HitObject_IsNop}, + {IntrinsicOp::MOP_DxHitObject_LoadLocalRootTableConstant, + TranslateHitObjectLoadLocalRootTableConstant, + DXIL::OpCode::HitObject_LoadLocalRootTableConstant}, + {IntrinsicOp::MOP_DxHitObject_MakeMiss, TranslateHitObjectMake, + DXIL::OpCode::HitObject_MakeMiss}, + {IntrinsicOp::MOP_DxHitObject_SetShaderTableIndex, + TranslateHitObjectSetShaderTableIndex, + DXIL::OpCode::HitObject_SetShaderTableIndex}, + {IntrinsicOp::MOP_DxHitObject_TraceRay, TranslateHitObjectTraceRay, + DXIL::OpCode::HitObject_TraceRay}, }; } // namespace static_assert( diff --git a/tools/clang/lib/Sema/SemaHLSL.cpp b/tools/clang/lib/Sema/SemaHLSL.cpp index 5236a1e3c4..230c7e65d9 100644 --- a/tools/clang/lib/Sema/SemaHLSL.cpp +++ b/tools/clang/lib/Sema/SemaHLSL.cpp @@ -580,9 +580,9 @@ const UINT g_uBasicKindProps[] = { 0, // AR_OBJECT_PROCEDURAL_PRIMITIVE_HIT_GROUP, 0, // AR_OBJECT_RAYTRACING_PIPELINE_CONFIG1, - BPROP_OBJECT, // AR_OBJECT_RAY_QUERY, - BPROP_OBJECT, // AR_OBJECT_HEAP_RESOURCE, - BPROP_OBJECT, // AR_OBJECT_HEAP_SAMPLER, + LICOMPTYPE_RAY_QUERY, // AR_OBJECT_RAY_QUERY, + BPROP_OBJECT, // AR_OBJECT_HEAP_RESOURCE, + BPROP_OBJECT, // AR_OBJECT_HEAP_SAMPLER, BPROP_OBJECT | BPROP_RWBUFFER | BPROP_TEXTURE, // AR_OBJECT_RWTEXTURE2DMS BPROP_OBJECT | BPROP_RWBUFFER | @@ -1135,6 +1135,9 @@ static const ArBasicKind g_ResourceCT[] = {AR_OBJECT_HEAP_RESOURCE, static const ArBasicKind g_RayDescCT[] = {AR_OBJECT_RAY_DESC, AR_BASIC_UNKNOWN}; +static const ArBasicKind g_RayQueryCT[] = {AR_OBJECT_RAY_QUERY, + AR_BASIC_UNKNOWN}; + static const ArBasicKind g_AccelerationStructCT[] = { AR_OBJECT_ACCELERATION_STRUCT, AR_BASIC_UNKNOWN}; @@ -1297,6 +1300,7 @@ const ArBasicKind *g_LegalIntrinsicCompTypes[] = { g_GroupNodeOutputRecordsCT, // LICOMPTYPE_GROUP_NODE_OUTPUT_RECORDS g_ThreadNodeOutputRecordsCT, // LICOMPTYPE_THREAD_NODE_OUTPUT_RECORDS g_DxHitObjectCT, // LICOMPTYPE_HIT_OBJECT + g_RayQueryCT, // LICOMPTYPE_RAY_QUERY #ifdef ENABLE_SPIRV_CODEGEN g_VKBufferPointerCT, // LICOMPTYPE_VK_BUFFER_POINTER #endif diff --git a/utils/hct/gen_intrin_main.txt b/utils/hct/gen_intrin_main.txt index 55c3643d95..f1274fd308 100644 --- a/utils/hct/gen_intrin_main.txt +++ b/utils/hct/gen_intrin_main.txt @@ -1101,6 +1101,34 @@ uint [[ro]] CommittedInstanceContributionToHitGroupIndex(); // Shader Execution Reordering namespace DxHitObjectMethods { DxHitObject [[static,class_prefix,min_sm=6.9]] MakeNop(); + DxHitObject [[static,class_prefix,min_sm=6.9]] MakeMiss(in uint RayFlags, in uint MissShaderIndex, in ray_desc Ray); + DxHitObject [[static,class_prefix,min_sm=6.9]] FromRayQuery(in RayQuery rq); + DxHitObject [[static,class_prefix,min_sm=6.9]] FromRayQuery(in RayQuery rq, in uint HitKind, in udt Attributes); + DxHitObject [[static,class_prefix,min_sm=6.9]] TraceRay(in acceleration_struct AccelerationStructure, in uint RayFlags, in uint InstanceInclusionMask, in uint RayContributionToHitGroupIndex, in uint MultiplierForGeometryContributionToHitGroupIndex, in uint MissShaderIndex, in ray_desc Ray, inout udt Payload); + void [[static,class_prefix,min_sm=6.9]] Invoke(in DxHitObject ho, inout udt Payload); + bool [[rn,class_prefix,min_sm=6.9]] IsMiss(); + bool [[rn,class_prefix,min_sm=6.9]] IsHit(); + bool [[rn,class_prefix,min_sm=6.9]] IsNop(); + uint [[rn,class_prefix,min_sm=6.9]] GetRayFlags(); + float [[rn,class_prefix,min_sm=6.9]] GetRayTMin(); + float [[rn,class_prefix,min_sm=6.9]] GetRayTCurrent(); + float<3> [[rn,class_prefix,min_sm=6.9]] GetWorldRayOrigin(); + float<3> [[rn,class_prefix,min_sm=6.9]] GetWorldRayDirection(); + float<3> [[rn,class_prefix,min_sm=6.9]] GetObjectRayOrigin(); + float<3> [[rn,class_prefix,min_sm=6.9]] GetObjectRayDirection(); + float<3,4> [[rn,class_prefix,min_sm=6.9]] GetObjectToWorld3x4(); + float<4,3> [[rn,class_prefix,min_sm=6.9]] GetObjectToWorld4x3(); + float<3,4> [[rn,class_prefix,min_sm=6.9]] GetWorldToObject3x4(); + float<4,3> [[rn,class_prefix,min_sm=6.9]] GetWorldToObject4x3(); + uint [[rn,class_prefix,min_sm=6.9]] GetGeometryIndex(); + uint [[rn,class_prefix,min_sm=6.9]] GetInstanceIndex(); + uint [[rn,class_prefix,min_sm=6.9]] GetInstanceID(); + uint [[rn,class_prefix,min_sm=6.9]] GetPrimitiveIndex(); + uint [[rn,class_prefix,min_sm=6.9]] GetHitKind(); + uint [[rn,class_prefix,min_sm=6.9]] GetShaderTableIndex(); + $funcT [[class_prefix,min_sm=6.9]] GetAttributes(); + void [[class_prefix,min_sm=6.9]] SetShaderTableIndex(in uint RecordIndex); + uint [[ro,class_prefix,min_sm=6.9]] LoadLocalRootTableConstant(in uint RootConstantOffsetInBytes); } namespace namespace DxIntrinsics { diff --git a/utils/hct/hctdb.py b/utils/hct/hctdb.py index 9b2f33727a..6344fb5849 100644 --- a/utils/hct/hctdb.py +++ b/utils/hct/hctdb.py @@ -9183,6 +9183,7 @@ def __init__(self, intrinsic_defs, opcode_data): "ThreadNodeOutputRecords": "LICOMPTYPE_THREAD_NODE_OUTPUT_RECORDS", "DxHitObject": "LICOMPTYPE_HIT_OBJECT", "VkBufferPointer": "LICOMPTYPE_VK_BUFFER_POINTER", + "RayQuery": "LICOMPTYPE_RAY_QUERY", } self.trans_rowcol = {"r": "IA_R", "c": "IA_C", "r2": "IA_R2", "c2": "IA_C2"} diff --git a/utils/hct/hlsl_intrinsic_opcodes.json b/utils/hct/hlsl_intrinsic_opcodes.json index c4527277cd..d99b84b745 100644 --- a/utils/hct/hlsl_intrinsic_opcodes.json +++ b/utils/hct/hlsl_intrinsic_opcodes.json @@ -1,6 +1,6 @@ { "IntrinsicOpCodes": { - "Num_Intrinsics": 363, + "Num_Intrinsics": 390, "IOP_AcceptHitAndEndSearch": 0, "IOP_AddUint64": 1, "IOP_AllMemoryBarrier": 2, @@ -363,6 +363,33 @@ "IOP_DxMaybeReorderThread": 359, "IOP_Vkreinterpret_pointer_cast": 360, "IOP_Vkstatic_pointer_cast": 361, - "MOP_GetBufferContents": 362 + "MOP_GetBufferContents": 362, + "MOP_DxHitObject_FromRayQuery": 363, + "MOP_DxHitObject_GetAttributes": 364, + "MOP_DxHitObject_GetGeometryIndex": 365, + "MOP_DxHitObject_GetHitKind": 366, + "MOP_DxHitObject_GetInstanceID": 367, + "MOP_DxHitObject_GetInstanceIndex": 368, + "MOP_DxHitObject_GetObjectRayDirection": 369, + "MOP_DxHitObject_GetObjectRayOrigin": 370, + "MOP_DxHitObject_GetObjectToWorld3x4": 371, + "MOP_DxHitObject_GetObjectToWorld4x3": 372, + "MOP_DxHitObject_GetPrimitiveIndex": 373, + "MOP_DxHitObject_GetRayFlags": 374, + "MOP_DxHitObject_GetRayTCurrent": 375, + "MOP_DxHitObject_GetRayTMin": 376, + "MOP_DxHitObject_GetShaderTableIndex": 377, + "MOP_DxHitObject_GetWorldRayDirection": 378, + "MOP_DxHitObject_GetWorldRayOrigin": 379, + "MOP_DxHitObject_GetWorldToObject3x4": 380, + "MOP_DxHitObject_GetWorldToObject4x3": 381, + "MOP_DxHitObject_Invoke": 382, + "MOP_DxHitObject_IsHit": 383, + "MOP_DxHitObject_IsMiss": 384, + "MOP_DxHitObject_IsNop": 385, + "MOP_DxHitObject_LoadLocalRootTableConstant": 386, + "MOP_DxHitObject_MakeMiss": 387, + "MOP_DxHitObject_SetShaderTableIndex": 388, + "MOP_DxHitObject_TraceRay": 389 } } From 5f18e2bac0833412ca07637a98d445a84f7d30e2 Mon Sep 17 00:00:00 2001 From: Tex Riddell Date: Tue, 15 Apr 2025 15:43:10 -0700 Subject: [PATCH 3/3] Add HctGen of DXIL.rst back to build without LLVM_BUILD_DOCS required (#7346) HctGen of DXIL.rst should happen on every ordinary build, and be updated with other HctGen modified files. This isn't about building the doc, it's about updating it when definitions change in hctdb.py. We've been missing updates to DXIL.rst for quite a while due to this issue, introduced [here](https://github.com/microsoft/DirectXShaderCompiler/pull/6715/files#diff-1e7de1ae2d059d21e1dd75d5812d5a34b0222cef273b7c3a2af62eb747f9d20aR768-R770). This also brings DXIL.rst up to date. --- CMakeLists.txt | 4 +- docs/DXIL.rst | 698 +++++++++++++++++++++++++++---------------------- 2 files changed, 380 insertions(+), 322 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0977fa1246..5210718005 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -762,9 +762,7 @@ if (LLVM_INCLUDE_DOCS) add_subdirectory(docs) endif() -if (LLVM_BUILD_DOCS) - add_hlsl_hctgen(DxilDocs OUTPUT docs/DXIL.rst CODE_TAG) # HLSL Change -endif() +add_hlsl_hctgen(DxilDocs OUTPUT docs/DXIL.rst CODE_TAG) # HLSL Change add_subdirectory(cmake/modules) diff --git a/docs/DXIL.rst b/docs/DXIL.rst index a68e31d0a9..a1c5055085 100644 --- a/docs/DXIL.rst +++ b/docs/DXIL.rst @@ -1984,54 +1984,57 @@ The following LLVM instructions are valid in a DXIL program, with the specified .. hctdb_instrhelp.get_instrs_rst() .. INSTR-RST:BEGIN -============= ======================================================================= ================= -Instruction Action Operand overloads -============= ======================================================================= ================= -Ret returns a value (possibly void), from a function. vhfd1wil -Br branches (conditional or unconditional) -Switch performs a multiway switch -Add returns the sum of its two operands wil -FAdd returns the sum of its two operands hfd -Sub returns the difference of its two operands wil -FSub returns the difference of its two operands hfd -Mul returns the product of its two operands wil -FMul returns the product of its two operands hfd -UDiv returns the quotient of its two unsigned operands wil -SDiv returns the quotient of its two signed operands wil -FDiv returns the quotient of its two operands hfd -URem returns the remainder from the unsigned division of its two operands wil -SRem returns the remainder from the signed division of its two operands wil -FRem returns the remainder from the division of its two operands hfd -Shl shifts left (logical) wil -LShr shifts right (logical), with zero bit fill wil -AShr shifts right (arithmetic), with 'a' operand sign bit fill wil -And returns a bitwise logical and of its two operands 1wil -Or returns a bitwise logical or of its two operands 1wil -Xor returns a bitwise logical xor of its two operands 1wil -Alloca allocates memory on the stack frame of the currently executing function -Load reads from memory -Store writes to memory -GetElementPtr gets the address of a subelement of an aggregate value -AtomicCmpXchg atomically modifies memory -AtomicRMW atomically modifies memory -Trunc truncates an integer 1wil -ZExt zero extends an integer 1wil -SExt sign extends an integer 1wil -FPToUI converts a floating point to UInt hfd1wil -FPToSI converts a floating point to SInt hfd1wil -UIToFP converts a UInt to floating point hfd1wil -SIToFP converts a SInt to floating point hfd1wil -FPTrunc truncates a floating point hfd -FPExt extends a floating point hfd -BitCast performs a bit-preserving type cast hfd1wil -AddrSpaceCast casts a value addrspace -ICmp compares integers 1wil -FCmp compares floating points hfd -PHI is a PHI node instruction -Call calls a function -Select selects an instruction -ExtractValue extracts from aggregate -============= ======================================================================= ================= +============== ======================================================================= ================= +Instruction Action Operand overloads +============== ======================================================================= ================= +Ret returns a value (possibly void), from a function. vhfd1wil +Br branches (conditional or unconditional) +Switch performs a multiway switch +Add returns the sum of its two operands wil +FAdd returns the sum of its two operands hfd +Sub returns the difference of its two operands wil +FSub returns the difference of its two operands hfd +Mul returns the product of its two operands wil +FMul returns the product of its two operands hfd +UDiv returns the quotient of its two unsigned operands wil +SDiv returns the quotient of its two signed operands wil +FDiv returns the quotient of its two operands hfd +URem returns the remainder from the unsigned division of its two operands wil +SRem returns the remainder from the signed division of its two operands wil +FRem returns the remainder from the division of its two operands hfd +Shl shifts left (logical) wil +LShr shifts right (logical), with zero bit fill wil +AShr shifts right (arithmetic), with 'a' operand sign bit fill wil +And returns a bitwise logical and of its two operands 1wil +Or returns a bitwise logical or of its two operands 1wil +Xor returns a bitwise logical xor of its two operands 1wil +Alloca allocates memory on the stack frame of the currently executing function +Load reads from memory +Store writes to memory +GetElementPtr gets the address of a subelement of an aggregate value +AtomicCmpXchg atomically modifies memory +AtomicRMW atomically modifies memory +Trunc truncates an integer 1wil +ZExt zero extends an integer 1wil +SExt sign extends an integer 1wil +FPToUI converts a floating point to UInt hfd1wil +FPToSI converts a floating point to SInt hfd1wil +UIToFP converts a UInt to floating point hfd1wil +SIToFP converts a SInt to floating point hfd1wil +FPTrunc truncates a floating point hfd +FPExt extends a floating point hfd +BitCast performs a bit-preserving type cast hfd1wil +AddrSpaceCast casts a value addrspace +ICmp compares integers 1wil +FCmp compares floating points hfd +PHI is a PHI node instruction +Call calls a function +Select selects an instruction +ExtractElement extracts from vector +InsertElement inserts into vector +ShuffleVector Shuffle two vectors +ExtractValue extracts from aggregate +============== ======================================================================= ================= FAdd @@ -2369,6 +2372,53 @@ ID Name Description 255 SampleCmpBias samples a texture after applying the input bias to the mipmap level and compares a single component against the specified comparison value 256 StartVertexLocation returns the BaseVertexLocation from DrawIndexedInstanced or StartVertexLocation from DrawInstanced 257 StartInstanceLocation returns the StartInstanceLocation from Draw*Instanced +258 AllocateRayQuery2 allocates space for RayQuery and return handle +259 ReservedA0 reserved +260 ReservedA1 reserved +261 ReservedA2 reserved +262 HitObject_TraceRay Analogous to TraceRay but without invoking CH/MS and returns the intermediate state as a HitObject +263 HitObject_FromRayQuery Creates a new HitObject representing a committed hit from a RayQuery +264 HitObject_FromRayQueryWithAttrs Creates a new HitObject representing a committed hit from a RayQuery and committed attributes +265 HitObject_MakeMiss Creates a new HitObject representing a miss +266 HitObject_MakeNop Creates an empty nop HitObject +267 HitObject_Invoke Represents the invocation of the CH/MS shader represented by the HitObject +268 MaybeReorderThread Reorders the current thread +269 HitObject_IsMiss Returns `true` if the HitObject represents a miss +270 HitObject_IsHit Returns `true` if the HitObject is a NOP-HitObject +271 HitObject_IsNop Returns `true` if the HitObject represents a nop +272 HitObject_RayFlags Returns the ray flags set in the HitObject +273 HitObject_RayTMin Returns the TMin value set in the HitObject +274 HitObject_RayTCurrent Returns the current T value set in the HitObject +275 HitObject_WorldRayOrigin Returns the ray origin in world space +276 HitObject_WorldRayDirection Returns the ray direction in world space +277 HitObject_ObjectRayOrigin Returns the ray origin in object space +278 HitObject_ObjectRayDirection Returns the ray direction in object space +279 HitObject_ObjectToWorld3x4 Returns the object to world space transformation matrix in 3x4 form +280 HitObject_WorldToObject3x4 Returns the world to object space transformation matrix in 3x4 form +281 HitObject_GeometryIndex Returns the geometry index committed on hit +282 HitObject_InstanceIndex Returns the instance index committed on hit +283 HitObject_InstanceID Returns the instance id committed on hit +284 HitObject_PrimitiveIndex Returns the primitive index committed on hit +285 HitObject_HitKind Returns the HitKind of the hit +286 HitObject_ShaderTableIndex Returns the shader table index set for this HitObject +287 HitObject_SetShaderTableIndex Returns a HitObject with updated shader table index +288 HitObject_LoadLocalRootTableConstant Returns the root table constant for this HitObject and offset +289 HitObject_Attributes Returns the attributes set for this HitObject +290 ReservedB28 reserved +291 ReservedB29 reserved +292 ReservedB30 reserved +293 ReservedC0 reserved +294 ReservedC1 reserved +295 ReservedC2 reserved +296 ReservedC3 reserved +297 ReservedC4 reserved +298 ReservedC5 reserved +299 ReservedC6 reserved +300 ReservedC7 reserved +301 ReservedC8 reserved +302 ReservedC9 reserved +303 RawBufferVectorLoad reads from a raw buffer and structured buffer +304 RawBufferVectorStore writes to a RWByteAddressBuffer or RWStructuredBuffer === ===================================================== ======================================================================================================================================================================================================================= @@ -3015,277 +3065,287 @@ The set of validation rules that are known to hold for a DXIL program is identif .. hctdb_instrhelp.get_valrules_rst() .. VALRULES-RST:BEGIN -========================================= ======================================================================================================================================================================================================================================================================================================== -Rule Code Description -========================================= ======================================================================================================================================================================================================================================================================================================== -BITCODE.VALID Module must be bitcode-valid -CONTAINER.PARTINVALID DXIL Container must not contain unknown parts -CONTAINER.PARTMATCHES DXIL Container Parts must match Module -CONTAINER.PARTMISSING DXIL Container requires certain parts, corresponding to module -CONTAINER.PARTREPEATED DXIL Container must have only one of each part type -CONTAINER.ROOTSIGNATUREINCOMPATIBLE Root Signature in DXIL Container must be compatible with shader -DECL.ATTRSTRUCT Attributes parameter must be struct type -DECL.DXILFNEXTERN External function must be a DXIL function -DECL.DXILNSRESERVED The DXIL reserved prefixes must only be used by built-in functions and types -DECL.EXTRAARGS Extra arguments not allowed for shader functions -DECL.FNATTRIBUTE Functions should only contain known function attributes -DECL.FNFLATTENPARAM Function parameters must not use struct types -DECL.FNISCALLED Functions can only be used by call instructions -DECL.MULTIPLENODEINPUTS A node shader may not have more than one input record -DECL.NODELAUNCHINPUTTYPE Invalid input record type for node launch type -DECL.NOTUSEDEXTERNAL External declaration should not be used -DECL.PARAMSTRUCT Callable function parameter must be struct type -DECL.PAYLOADSTRUCT Payload parameter must be struct type -DECL.RAYQUERYINFNSIG Rayquery objects not allowed in function signatures -DECL.RESOURCEINFNSIG Resources not allowed in function signatures -DECL.SHADERMISSINGARG payload/params/attributes parameter is required for certain shader types -DECL.SHADERRETURNVOID Shader functions must return void -DECL.USEDEXTERNALFUNCTION External function must be used -DECL.USEDINTERNAL Internal declaration must be used -FLOW.DEADLOOP Loop must have break. -FLOW.FUNCTIONCALL Function with parameter is not permitted -FLOW.NORECURSION Recursion is not permitted. -FLOW.REDUCIBLE Execution flow must be reducible. -INSTR.ALLOWED Instructions must be of an allowed type. -INSTR.ATOMICCONST Constant destination to atomic. -INSTR.ATOMICINTRINNONUAV Non-UAV destination to atomic intrinsic. -INSTR.ATOMICOPNONGROUPSHAREDORRECORD Non-groupshared or node record destination to atomic operation. -INSTR.ATTRIBUTEATVERTEXNOINTERPOLATION Attribute %0 must have nointerpolation mode in order to use GetAttributeAtVertex function. -INSTR.BARRIERFLAGINVALID Invalid %0 flags on DXIL operation '%1' -INSTR.BARRIERMODEFORNONCS sync in a non-Compute/Amplification/Mesh/Node Shader must only sync UAV (sync_uglobal). -INSTR.BARRIERMODENOMEMORY sync must include some form of memory barrier - _u (UAV) and/or _g (Thread Group Shared Memory). Only _t (thread group sync) is optional. -INSTR.BARRIERMODEUSELESSUGROUP sync can't specify both _ugroup and _uglobal. If both are needed, just specify _uglobal. -INSTR.BARRIERNONCONSTANTFLAGARGUMENT Memory type, access, or sync flag is not constant -INSTR.BARRIERREQUIRESNODE sync in a non-Node Shader must not sync node record memory. -INSTR.BUFFERUPDATECOUNTERONRESHASCOUNTER BufferUpdateCounter valid only when HasCounter is true. -INSTR.BUFFERUPDATECOUNTERONUAV BufferUpdateCounter valid only on UAV. -INSTR.CALLOLOAD Call to DXIL intrinsic must match overload signature -INSTR.CANNOTPULLPOSITION pull-model evaluation of position disallowed -INSTR.CBUFFERCLASSFORCBUFFERHANDLE Expect Cbuffer for CBufferLoad handle. -INSTR.CBUFFEROUTOFBOUND Cbuffer access out of bound. -INSTR.CHECKACCESSFULLYMAPPED CheckAccessFullyMapped should only be used on resource status. -INSTR.COORDINATECOUNTFORRAWTYPEDBUF raw/typed buffer don't need 2 coordinates. -INSTR.COORDINATECOUNTFORSTRUCTBUF structured buffer require 2 coordinates. -INSTR.CREATEHANDLEIMMRANGEID Local resource must map to global resource. -INSTR.DXILSTRUCTUSER Dxil struct types should only be used by ExtractValue. -INSTR.DXILSTRUCTUSEROUTOFBOUND Index out of bound when extract value from dxil struct types. -INSTR.EVALINTERPOLATIONMODE Interpolation mode on %0 used with eval_* instruction must be linear, linear_centroid, linear_noperspective, linear_noperspective_centroid, linear_sample or linear_noperspective_sample. -INSTR.EXTRACTVALUE ExtractValue should only be used on dxil struct types and cmpxchg. -INSTR.FAILTORESLOVETGSMPOINTER TGSM pointers must originate from an unambiguous TGSM global variable. -INSTR.HANDLENOTFROMCREATEHANDLE Resource handle should returned by createHandle. -INSTR.ILLEGALDXILOPCODE DXILOpCode must be [0..%0]. %1 specified. -INSTR.ILLEGALDXILOPFUNCTION '%0' is not a DXILOpFuncition for DXILOpcode '%1'. -INSTR.IMMBIASFORSAMPLEB bias amount for sample_b must be in the range [%0,%1], but %2 was specified as an immediate. -INSTR.INBOUNDSACCESS Access to out-of-bounds memory is disallowed. -INSTR.MINPRECISIONNOTPRECISE Instructions marked precise may not refer to minprecision values. -INSTR.MINPRECISONBITCAST Bitcast on minprecison types is not allowed. -INSTR.MIPLEVELFORGETDIMENSION Use mip level on buffer when GetDimensions. -INSTR.MIPONUAVLOAD uav load don't support mipLevel/sampleIndex. -INSTR.MISSINGSETMESHOUTPUTCOUNTS Missing SetMeshOutputCounts call. -INSTR.MULTIPLEGETMESHPAYLOAD GetMeshPayload cannot be called multiple times. -INSTR.MULTIPLESETMESHOUTPUTCOUNTS SetMeshOUtputCounts cannot be called multiple times. -INSTR.NODERECORDHANDLEUSEAFTERCOMPLETE Invalid use of completed record handle. -INSTR.NOGENERICPTRADDRSPACECAST Address space cast between pointer types must have one part to be generic address space. -INSTR.NOIDIVBYZERO No signed integer division by zero. -INSTR.NOINDEFINITEACOS No indefinite arccosine. -INSTR.NOINDEFINITEASIN No indefinite arcsine. -INSTR.NOINDEFINITEDSXY No indefinite derivative calculation. -INSTR.NOINDEFINITELOG No indefinite logarithm. -INSTR.NONDOMINATINGDISPATCHMESH Non-Dominating DispatchMesh call. -INSTR.NONDOMINATINGSETMESHOUTPUTCOUNTS Non-Dominating SetMeshOutputCounts call. -INSTR.NOREADINGUNINITIALIZED Instructions should not read uninitialized value. -INSTR.NOTONCEDISPATCHMESH DispatchMesh must be called exactly once in an Amplification shader. -INSTR.NOUDIVBYZERO No unsigned integer division by zero. -INSTR.OFFSETONUAVLOAD uav load don't support offset. -INSTR.OLOAD DXIL intrinsic overload must be valid. -INSTR.ONLYONEALLOCCONSUME RWStructuredBuffers may increment or decrement their counters, but not both. -INSTR.OPCODERESERVED Instructions must not reference reserved opcodes. -INSTR.OPCONST DXIL intrinsic requires an immediate constant operand -INSTR.OPCONSTRANGE Constant values must be in-range for operation. -INSTR.OPERANDRANGE DXIL intrinsic operand must be within defined range -INSTR.PTRBITCAST Pointer type bitcast must be have same size. -INSTR.RESOURCECLASSFORLOAD load can only run on UAV/SRV resource. -INSTR.RESOURCECLASSFORSAMPLERGATHER sample, lod and gather should be on srv resource. -INSTR.RESOURCECLASSFORUAVSTORE store should be on uav resource. -INSTR.RESOURCECOORDINATEMISS coord uninitialized. -INSTR.RESOURCECOORDINATETOOMANY out of bound coord must be undef. -INSTR.RESOURCEKINDFORBUFFERLOADSTORE buffer load/store only works on Raw/Typed/StructuredBuffer. -INSTR.RESOURCEKINDFORCALCLOD lod requires resource declared as texture1D/2D/3D/Cube/CubeArray/1DArray/2DArray. -INSTR.RESOURCEKINDFORGATHER gather requires resource declared as texture/2D/Cube/2DArray/CubeArray. -INSTR.RESOURCEKINDFORGETDIM Invalid resource kind on GetDimensions. -INSTR.RESOURCEKINDFORSAMPLE sample/_l/_d requires resource declared as texture1D/2D/3D/Cube/1DArray/2DArray/CubeArray. -INSTR.RESOURCEKINDFORSAMPLEC samplec requires resource declared as texture1D/2D/Cube/1DArray/2DArray/CubeArray. -INSTR.RESOURCEKINDFORTEXTURELOAD texture load only works on Texture1D/1DArray/2D/2DArray/3D/MS2D/MS2DArray. -INSTR.RESOURCEKINDFORTEXTURESTORE texture store only works on Texture1D/1DArray/2D/2DArray/3D. -INSTR.RESOURCEKINDFORTRACERAY TraceRay should only use RTAccelerationStructure. -INSTR.RESOURCEMAPTOSINGLEENTRY Fail to map resource to resource table. -INSTR.RESOURCEOFFSETMISS offset uninitialized. -INSTR.RESOURCEOFFSETTOOMANY out of bound offset must be undef. -INSTR.RESOURCEUSER Resource should only be used by Load/GEP/Call. -INSTR.SAMPLECOMPTYPE sample_* instructions require resource to be declared to return UNORM, SNORM or FLOAT. -INSTR.SAMPLEINDEXFORLOAD2DMS load on Texture2DMS/2DMSArray require sampleIndex. -INSTR.SAMPLERMODEFORLOD lod instruction requires sampler declared in default mode. -INSTR.SAMPLERMODEFORSAMPLE sample/_l/_d/_cl_s/gather instruction requires sampler declared in default mode. -INSTR.SAMPLERMODEFORSAMPLEC sample_c_*/gather_c instructions require sampler declared in comparison mode. -INSTR.SIGNATUREOPERATIONNOTINENTRY Dxil operation for input output signature must be in entryPoints. -INSTR.STATUS Resource status should only be used by CheckAccessFullyMapped. -INSTR.STRUCTBITCAST Bitcast on struct types is not allowed. -INSTR.SVCONFLICTINGLAUNCHMODE Input system values are compatible with node shader launch mode. -INSTR.TEXTUREOFFSET offset texture instructions must take offset which can resolve to integer literal in the range -8 to 7. -INSTR.TGSMRACECOND Race condition writing to shared memory detected, consider making this write conditional. -INSTR.UNDEFINEDVALUEFORUAVSTORE Assignment of undefined values to UAV. -INSTR.UNDEFRESULTFORGETDIMENSION GetDimensions used undef dimension %0 on %1. -INSTR.WRITEMASKFORTYPEDUAVSTORE store on typed uav must write to all four components of the UAV. -INSTR.WRITEMASKGAPFORUAV UAV write mask must be contiguous, starting at x: .x, .xy, .xyz, or .xyzw. -INSTR.WRITEMASKMATCHVALUEFORUAVSTORE uav store write mask must match store value mask, write mask is %0 and store value mask is %1. -META.BARYCENTRICSFLOAT3 only 'float3' type is allowed for SV_Barycentrics. -META.BARYCENTRICSINTERPOLATION SV_Barycentrics cannot be used with 'nointerpolation' type. -META.BARYCENTRICSTWOPERSPECTIVES There can only be up to two input attributes of SV_Barycentrics with different perspective interpolation mode. -META.BRANCHFLATTEN Can't use branch and flatten attributes together. -META.CLIPCULLMAXCOMPONENTS Combined elements of SV_ClipDistance and SV_CullDistance must fit in 8 components -META.CLIPCULLMAXROWS Combined elements of SV_ClipDistance and SV_CullDistance must fit in two rows. -META.COMPUTEWITHNODE Compute entry must not have node metadata -META.CONTROLFLOWHINTNOTONCONTROLFLOW Control flow hint only works on control flow inst. -META.DENSERESIDS Resource identifiers must be zero-based and dense. -META.DUPLICATESYSVALUE System value may only appear once in signature -META.ENTRYFUNCTION entrypoint not found. -META.FLAGSUSAGE Flags must match usage. -META.FORCECASEONSWITCH Attribute forcecase only works for switch. -META.GLCNOTONAPPENDCONSUME globallycoherent cannot be used with append/consume buffers: '%0'. -META.INTEGERINTERPMODE Interpolation mode on integer must be Constant -META.INTERPMODEINONEROW Interpolation mode must be identical for all elements packed into the same row. -META.INTERPMODEVALID Interpolation mode must be valid -META.INVALIDCONTROLFLOWHINT Invalid control flow hint. -META.KNOWN Named metadata should be known -META.MAXTESSFACTOR Hull Shader MaxTessFactor must be [%0..%1]. %2 specified. -META.NOENTRYPROPSFORENTRY Entry point %0 must have entry properties. -META.NOSEMANTICOVERLAP Semantics must not overlap -META.REQUIRED Required metadata missing. -META.SEMAKINDMATCHESNAME Semantic name must match system value, when defined. -META.SEMAKINDVALID Semantic kind must be valid -META.SEMANTICCOMPTYPE %0 must be %1. -META.SEMANTICINDEXMAX System value semantics have a maximum valid semantic index -META.SEMANTICLEN Semantic length must be at least 1 and at most 64. -META.SEMANTICSHOULDBEALLOCATED Semantic should have a valid packing location -META.SEMANTICSHOULDNOTBEALLOCATED Semantic should have a packing location of -1 -META.SIGNATURECOMPTYPE signature %0 specifies unrecognized or invalid component type. -META.SIGNATUREDATAWIDTH Data width must be identical for all elements packed into the same row. -META.SIGNATUREILLEGALCOMPONENTORDER Component ordering for packed elements must be: arbitrary < system value < system generated value -META.SIGNATUREINDEXCONFLICT Only elements with compatible indexing rules may be packed together -META.SIGNATUREOUTOFRANGE Signature elements must fit within maximum signature size -META.SIGNATUREOVERLAP Signature elements may not overlap in packing location. -META.STRUCTBUFALIGNMENT StructuredBuffer stride not aligned -META.STRUCTBUFALIGNMENTOUTOFBOUND StructuredBuffer stride out of bounds -META.SYSTEMVALUEROWS System value may only have 1 row -META.TARGET Target triple must be 'dxil-ms-dx' -META.TESSELLATOROUTPUTPRIMITIVE Invalid Tessellator Output Primitive specified. Must be point, line, triangleCW or triangleCCW. -META.TESSELLATORPARTITION Invalid Tessellator Partitioning specified. Must be integer, pow2, fractional_odd or fractional_even. -META.TEXTURETYPE elements of typed buffers and textures must fit in four 32-bit quantities. -META.USED All metadata must be used by dxil. -META.VALIDSAMPLERMODE Invalid sampler mode on sampler . -META.VALUERANGE Metadata value must be within range. -META.VERSIONSUPPORTED Version in metadata must be supported. -META.WELLFORMED Metadata must be well-formed in operand count and types. -SM.64BITRAWBUFFERLOADSTORE i64/f64 rawBufferLoad/Store overloads are allowed after SM 6.3. -SM.AMPLIFICATIONSHADERPAYLOADSIZE For amplification shader with entry '%0', payload size %1 is greater than maximum size of %2 bytes. -SM.AMPLIFICATIONSHADERPAYLOADSIZEDECLARED For amplification shader with entry '%0', payload size %1 is greater than declared size of %2 bytes. -SM.APPENDANDCONSUMEONSAMEUAV BufferUpdateCounter inc and dec on a given UAV (%d) cannot both be in the same shader for shader model less than 5.1. -SM.CBUFFERARRAYOFFSETALIGNMENT CBuffer array offset must be aligned to 16-bytes -SM.CBUFFERELEMENTOVERFLOW CBuffer elements must not overflow -SM.CBUFFEROFFSETOVERLAP CBuffer offsets must not overlap -SM.CBUFFERSIZE CBuffer size must not exceed 65536 bytes -SM.CBUFFERTEMPLATETYPEMUSTBESTRUCT D3D12 constant/texture buffer template element can only be a struct. -SM.COMPLETEPOSITION Not all elements of SV_Position were written. -SM.CONSTANTINTERPMODE Interpolation mode must be constant for MS primitive output. -SM.COUNTERONLYONSTRUCTBUF BufferUpdateCounter valid only on structured buffers. -SM.CSNOSIGNATURES Compute shaders must not have shader signatures. -SM.DOMAINLOCATIONIDXOOB DomainLocation component index out of bounds for the domain. -SM.DSINPUTCONTROLPOINTCOUNTRANGE DS input control point count must be [0..%0]. %1 specified. -SM.DXILVERSION Target shader model requires specific Dxil Version -SM.GSINSTANCECOUNTRANGE GS instance count must be [1..%0]. %1 specified. -SM.GSOUTPUTVERTEXCOUNTRANGE GS output vertex count must be [0..%0]. %1 specified. -SM.GSTOTALOUTPUTVERTEXDATARANGE Declared output vertex count (%0) multiplied by the total number of declared scalar components of output data (%1) equals %2. This value cannot be greater than %3. -SM.GSVALIDINPUTPRIMITIVE GS input primitive unrecognized. -SM.GSVALIDOUTPUTPRIMITIVETOPOLOGY GS output primitive topology unrecognized. -SM.HSINPUTCONTROLPOINTCOUNTRANGE HS input control point count must be [0..%0]. %1 specified. -SM.HULLPASSTHRUCONTROLPOINTCOUNTMATCH For pass thru hull shader, input control point count must match output control point count -SM.INCOMPATIBLECALLINENTRY Features used in internal function calls must be compatible with entry -SM.INCOMPATIBLEDERIVINCOMPUTESHADERMODEL Derivatives in compute-model shaders require shader model 6.6 and above -SM.INCOMPATIBLEDERIVLAUNCH Node shaders only support derivatives in broadcasting launch mode -SM.INCOMPATIBLEOPERATION Operations used in entry function must be compatible with shader stage and other properties -SM.INCOMPATIBLEREQUIRESGROUP Functions requiring groupshared memory must be called from shaders with a visible group -SM.INCOMPATIBLESHADERMODEL Functions may only use features available in the current shader model -SM.INCOMPATIBLESTAGE Functions may only use features available in the entry function's stage -SM.INCOMPATIBLETHREADGROUPDIM When derivatives are used in compute-model shaders, the thread group dimensions must be compatible -SM.INSIDETESSFACTORSIZEMATCHDOMAIN InsideTessFactor rows, columns (%0, %1) invalid for domain %2. Expected %3 rows and 1 column. -SM.INVALIDRESOURCECOMPTYPE Invalid resource return type. -SM.INVALIDRESOURCEKIND Invalid resources kind. -SM.INVALIDSAMPLERFEEDBACKTYPE Invalid sampler feedback type. -SM.INVALIDTEXTUREKINDONUAV TextureCube[Array] resources are not supported with UAVs. -SM.ISOLINEOUTPUTPRIMITIVEMISMATCH Hull Shader declared with IsoLine Domain must specify output primitive point or line. Triangle_cw or triangle_ccw output are not compatible with the IsoLine Domain. -SM.MAXMSSMSIZE Total Thread Group Shared Memory storage is %0, exceeded %1. -SM.MAXTGSMSIZE Total Thread Group Shared Memory storage is %0, exceeded %1. -SM.MAXTHEADGROUP Declared Thread Group Count %0 (X*Y*Z) is beyond the valid maximum of %1. -SM.MESHPSIGROWCOUNT For shader '%0', primitive output signatures are taking up more than %1 rows. -SM.MESHSHADERINOUTSIZE For shader '%0', payload plus output size is greater than %1. -SM.MESHSHADERMAXPRIMITIVECOUNT MS max primitive output count must be [0..%0]. %1 specified. -SM.MESHSHADERMAXVERTEXCOUNT MS max vertex output count must be [0..%0]. %1 specified. -SM.MESHSHADEROUTPUTSIZE For shader '%0', vertex plus primitive output size is greater than %1. -SM.MESHSHADERPAYLOADSIZE For mesh shader with entry '%0', payload size %1 is greater than maximum size of %2 bytes. -SM.MESHSHADERPAYLOADSIZEDECLARED For mesh shader with entry '%0', payload size %1 is greater than declared size of %2 bytes. -SM.MESHTOTALSIGROWCOUNT For shader '%0', vertex and primitive output signatures are taking up more than %1 rows. -SM.MESHVSIGROWCOUNT For shader '%0', vertex output signatures are taking up more than %1 rows. -SM.MULTISTREAMMUSTBEPOINT When multiple GS output streams are used they must be pointlists -SM.NAME Target shader model name must be known -SM.NOINTERPMODE Interpolation mode must be undefined for VS input/PS output/patch constant. -SM.NOPSOUTPUTIDX Pixel shader output registers are not indexable. -SM.OPCODE Opcode must be defined in target shader model -SM.OPCODEININVALIDFUNCTION Invalid DXIL opcode usage like StorePatchConstant in patch constant function -SM.OPERAND Operand must be defined in target shader model. -SM.OUTPUTCONTROLPOINTCOUNTRANGE output control point count must be [%0..%1]. %2 specified. -SM.OUTPUTCONTROLPOINTSTOTALSCALARS Total number of scalars across all HS output control points must not exceed . -SM.PATCHCONSTANTONLYFORHSDS patch constant signature only valid in HS and DS. -SM.PSCONSISTENTINTERP Interpolation mode for PS input position must be linear_noperspective_centroid or linear_noperspective_sample when outputting oDepthGE or oDepthLE and not running at sample frequency (which is forced by inputting SV_SampleIndex or declaring an input linear_sample or linear_noperspective_sample). -SM.PSCOVERAGEANDINNERCOVERAGE InnerCoverage and Coverage are mutually exclusive. -SM.PSMULTIPLEDEPTHSEMANTIC Pixel Shader only allows one type of depth semantic to be declared. -SM.PSOUTPUTSEMANTIC Pixel Shader allows output semantics to be SV_Target, SV_Depth, SV_DepthGreaterEqual, SV_DepthLessEqual, SV_Coverage or SV_StencilRef, %0 found. -SM.PSTARGETCOL0 SV_Target packed location must start at column 0. -SM.PSTARGETINDEXMATCHESROW SV_Target semantic index must match packed row location. -SM.RAYSHADERPAYLOADSIZE For shader '%0', %1 size is smaller than argument's allocation size. -SM.RAYSHADERSIGNATURES Ray tracing shader '%0' should not have any shader signatures. -SM.RESOURCERANGEOVERLAP Resource ranges must not overlap -SM.ROVONLYINPS RasterizerOrdered objects are only allowed in 5.0+ pixel shaders. -SM.SAMPLECOUNTONLYON2DMS Only Texture2DMS/2DMSArray could has sample count. -SM.SEMANTIC Semantic must be defined in target shader model -SM.STREAMINDEXRANGE Stream index (%0) must between 0 and %1. -SM.TESSFACTORFORDOMAIN Required TessFactor for domain not found declared anywhere in Patch Constant data. -SM.TESSFACTORSIZEMATCHDOMAIN TessFactor rows, columns (%0, %1) invalid for domain %2. Expected %3 rows and 1 column. -SM.TGSMUNSUPPORTED Thread Group Shared Memory not supported %0. -SM.THREADGROUPCHANNELRANGE Declared Thread Group %0 size %1 outside valid range [%2..%3]. -SM.TRIOUTPUTPRIMITIVEMISMATCH Hull Shader declared with Tri Domain must specify output primitive point, triangle_cw or triangle_ccw. Line output is not compatible with the Tri domain. -SM.UNDEFINEDOUTPUT Not all elements of output %0 were written. -SM.VALIDDOMAIN Invalid Tessellator Domain specified. Must be isoline, tri or quad. -SM.VIEWIDNEEDSSLOT ViewID requires compatible space in pixel shader input signature -SM.WAVESIZEALLZEROWHENUNDEFINED WaveSize Max and Preferred must be 0 when Min is 0 -SM.WAVESIZEEXPECTSONEPARAM WaveSize tag expects exactly 1 parameter. -SM.WAVESIZEMAXANDPREFERREDZEROWHENNORANGE WaveSize Max and Preferred must be 0 to encode min==max -SM.WAVESIZEMAXGREATERTHANMIN WaveSize Max must greater than Min -SM.WAVESIZENEEDSCONSTANTOPERANDS WaveSize metadata operands must be constant values. -SM.WAVESIZENEEDSSM66OR67 WaveSize is valid only for Shader Model 6.6 and 6.7. -SM.WAVESIZEONCOMPUTEORNODE WaveSize only allowed on compute or node shaders -SM.WAVESIZEPREFERREDINRANGE WaveSize Preferred must be within Min..Max range -SM.WAVESIZERANGEEXPECTSTHREEPARAMS WaveSize Range tag expects exactly 3 parameters. -SM.WAVESIZERANGENEEDSSM68PLUS WaveSize Range is valid only for Shader Model 6.8 and higher. -SM.WAVESIZETAGDUPLICATE WaveSize or WaveSizeRange tag may only appear once per entry point. -SM.WAVESIZEVALUE WaveSize value must be a power of 2 in range [4..128] -SM.ZEROHSINPUTCONTROLPOINTWITHINPUT When HS input control point count is 0, no input signature should exist. -TYPES.DEFINED Type must be defined based on DXIL primitives -TYPES.I8 I8 can only be used as immediate value for intrinsic or as i8* via bitcast by lifetime intrinsics. -TYPES.INTWIDTH Int type must be of valid width -TYPES.NOMULTIDIM Only one dimension allowed for array type. -TYPES.NOPTRTOPTR Pointers to pointers, or pointers in structures are not allowed. -TYPES.NOVECTOR Vector types must not be present -========================================= ======================================================================================================================================================================================================================================================================================================== +===================================================== ======================================================================================================================================================================================================================================================================================================== +Rule Code Description +===================================================== ======================================================================================================================================================================================================================================================================================================== +BITCODE.VALID Module must be bitcode-valid +CONTAINER.CONTENTINVALID DXIL Container Content is well-formed +CONTAINER.CONTENTMATCHES DXIL Container Content must match Module +CONTAINER.PARTINVALID DXIL Container must not contain unknown parts +CONTAINER.PARTMATCHES DXIL Container Parts must match Module +CONTAINER.PARTMISSING DXIL Container requires certain parts, corresponding to module +CONTAINER.PARTREPEATED DXIL Container must have only one of each part type +CONTAINER.ROOTSIGNATUREINCOMPATIBLE Root Signature in DXIL Container must be compatible with shader +CONTAINER.UNUSEDITEMINTABLE Items in Table must be used +DECL.ALLOCATERAYQUERY2FLAGSARECONST constRayFlags and RayQueryFlags for AllocateRayQuery2 must be constant +DECL.ALLOCATERAYQUERYFLAGSARECONST RayFlags for AllocateRayQuery must be constant +DECL.ALLOWOPACITYMICROMAPSEXPECTEDGIVENFORCEOMM2STATE When the ForceOMM2State ConstRayFlag is given as an argument to a RayQuery object, AllowOpacityMicromaps is expected as a RayQueryFlag argument +DECL.ATTRSTRUCT Attributes parameter must be struct type +DECL.DXILFNEXTERN External function must be a DXIL function +DECL.DXILNSRESERVED The DXIL reserved prefixes must only be used by built-in functions and types +DECL.EXTRAARGS Extra arguments not allowed for shader functions +DECL.FNATTRIBUTE Functions should only contain known function attributes +DECL.FNFLATTENPARAM Function parameters must not use struct types +DECL.FNISCALLED Functions can only be used by call instructions +DECL.MULTIPLENODEINPUTS A node shader may not have more than one input record +DECL.NODELAUNCHINPUTTYPE Invalid input record type for node launch type +DECL.NOTUSEDEXTERNAL External declaration should not be used +DECL.PARAMSTRUCT Callable function parameter must be struct type +DECL.PAYLOADSTRUCT Payload parameter must be struct type +DECL.RAYQUERYINFNSIG Rayquery objects not allowed in function signatures +DECL.RESOURCEINFNSIG Resources not allowed in function signatures +DECL.SHADERMISSINGARG payload/params/attributes parameter is required for certain shader types +DECL.SHADERRETURNVOID Shader functions must return void +DECL.USEDEXTERNALFUNCTION External function must be used +DECL.USEDINTERNAL Internal declaration must be used +FLOW.DEADLOOP Loop must have break. +FLOW.FUNCTIONCALL Function with parameter is not permitted +FLOW.NORECURSION Recursion is not permitted. +FLOW.REDUCIBLE Execution flow must be reducible. +INSTR.ALLOWED Instructions must be of an allowed type. +INSTR.ATOMICCONST Constant destination to atomic. +INSTR.ATOMICINTRINNONUAV Non-UAV destination to atomic intrinsic. +INSTR.ATOMICOPNONGROUPSHAREDORRECORD Non-groupshared or node record destination to atomic operation. +INSTR.ATTRIBUTEATVERTEXNOINTERPOLATION Attribute %0 must have nointerpolation mode in order to use GetAttributeAtVertex function. +INSTR.BARRIERFLAGINVALID Invalid %0 flags on DXIL operation '%1' +INSTR.BARRIERMODEFORNONCS sync in a non-Compute/Amplification/Mesh/Node Shader must only sync UAV (sync_uglobal). +INSTR.BARRIERMODENOMEMORY sync must include some form of memory barrier - _u (UAV) and/or _g (Thread Group Shared Memory). Only _t (thread group sync) is optional. +INSTR.BARRIERMODEUSELESSUGROUP sync can't specify both _ugroup and _uglobal. If both are needed, just specify _uglobal. +INSTR.BARRIERNONCONSTANTFLAGARGUMENT Memory type, access, or sync flag is not constant +INSTR.BARRIERREQUIRESNODE sync in a non-Node Shader must not sync node record memory. +INSTR.BUFFERUPDATECOUNTERONRESHASCOUNTER BufferUpdateCounter valid only when HasCounter is true. +INSTR.BUFFERUPDATECOUNTERONUAV BufferUpdateCounter valid only on UAV. +INSTR.CALLOLOAD Call to DXIL intrinsic must match overload signature +INSTR.CANNOTPULLPOSITION pull-model evaluation of position disallowed +INSTR.CBUFFERCLASSFORCBUFFERHANDLE Expect Cbuffer for CBufferLoad handle. +INSTR.CBUFFEROUTOFBOUND Cbuffer access out of bound. +INSTR.CHECKACCESSFULLYMAPPED CheckAccessFullyMapped should only be used on resource status. +INSTR.CONSTALIGNFORRAWBUF Raw Buffer alignment value must be a constant. +INSTR.COORDINATECOUNTFORRAWTYPEDBUF raw/typed buffer offset must be undef. +INSTR.COORDINATECOUNTFORSTRUCTBUF structured buffer requires defined index and offset coordinates. +INSTR.CREATEHANDLEIMMRANGEID Local resource must map to global resource. +INSTR.DXILSTRUCTUSER Dxil struct types should only be used by ExtractValue. +INSTR.DXILSTRUCTUSEROUTOFBOUND Index out of bound when extract value from dxil struct types. +INSTR.EVALINTERPOLATIONMODE Interpolation mode on %0 used with eval_* instruction must be linear, linear_centroid, linear_noperspective, linear_noperspective_centroid, linear_sample or linear_noperspective_sample. +INSTR.EXTRACTVALUE ExtractValue should only be used on dxil struct types and cmpxchg. +INSTR.FAILTORESLOVETGSMPOINTER TGSM pointers must originate from an unambiguous TGSM global variable. +INSTR.HANDLENOTFROMCREATEHANDLE Resource handle should returned by createHandle. +INSTR.ILLEGALDXILOPCODE DXILOpCode must be [0..%0]. %1 specified. +INSTR.ILLEGALDXILOPFUNCTION '%0' is not a DXILOpFuncition for DXILOpcode '%1'. +INSTR.IMMBIASFORSAMPLEB bias amount for sample_b must be in the range [%0,%1], but %2 was specified as an immediate. +INSTR.INBOUNDSACCESS Access to out-of-bounds memory is disallowed. +INSTR.MAYREORDERTHREADUNDEFCOHERENCEHINTPARAM Use of undef coherence hint or num coherence hint bits in MaybeReorderThread. +INSTR.MINPRECISIONNOTPRECISE Instructions marked precise may not refer to minprecision values. +INSTR.MINPRECISONBITCAST Bitcast on minprecison types is not allowed. +INSTR.MIPLEVELFORGETDIMENSION Use mip level on buffer when GetDimensions. +INSTR.MIPONUAVLOAD uav load don't support mipLevel/sampleIndex. +INSTR.MISSINGSETMESHOUTPUTCOUNTS Missing SetMeshOutputCounts call. +INSTR.MULTIPLEGETMESHPAYLOAD GetMeshPayload cannot be called multiple times. +INSTR.MULTIPLESETMESHOUTPUTCOUNTS SetMeshOUtputCounts cannot be called multiple times. +INSTR.NODERECORDHANDLEUSEAFTERCOMPLETE Invalid use of completed record handle. +INSTR.NOGENERICPTRADDRSPACECAST Address space cast between pointer types must have one part to be generic address space. +INSTR.NOIDIVBYZERO No signed integer division by zero. +INSTR.NOINDEFINITEACOS No indefinite arccosine. +INSTR.NOINDEFINITEASIN No indefinite arcsine. +INSTR.NOINDEFINITEDSXY No indefinite derivative calculation. +INSTR.NOINDEFINITELOG No indefinite logarithm. +INSTR.NONDOMINATINGDISPATCHMESH Non-Dominating DispatchMesh call. +INSTR.NONDOMINATINGSETMESHOUTPUTCOUNTS Non-Dominating SetMeshOutputCounts call. +INSTR.NOREADINGUNINITIALIZED Instructions should not read uninitialized value. +INSTR.NOTONCEDISPATCHMESH DispatchMesh must be called exactly once in an Amplification shader. +INSTR.NOUDIVBYZERO No unsigned integer division by zero. +INSTR.OFFSETONUAVLOAD uav load don't support offset. +INSTR.OLOAD DXIL intrinsic overload must be valid. +INSTR.ONLYONEALLOCCONSUME RWStructuredBuffers may increment or decrement their counters, but not both. +INSTR.OPCODERESERVED Instructions must not reference reserved opcodes. +INSTR.OPCONST DXIL intrinsic requires an immediate constant operand +INSTR.OPCONSTRANGE Constant values must be in-range for operation. +INSTR.OPERANDRANGE DXIL intrinsic operand must be within defined range +INSTR.PTRBITCAST Pointer type bitcast must be have same size. +INSTR.RESOURCECLASSFORLOAD load can only run on UAV/SRV resource. +INSTR.RESOURCECLASSFORSAMPLERGATHER sample, lod and gather should be on srv resource. +INSTR.RESOURCECLASSFORUAVSTORE store should be on uav resource. +INSTR.RESOURCECOORDINATEMISS coord uninitialized. +INSTR.RESOURCECOORDINATETOOMANY out of bound coord must be undef. +INSTR.RESOURCEKINDFORBUFFERLOADSTORE buffer load/store only works on Raw/Typed/StructuredBuffer. +INSTR.RESOURCEKINDFORCALCLOD lod requires resource declared as texture1D/2D/3D/Cube/CubeArray/1DArray/2DArray. +INSTR.RESOURCEKINDFORGATHER gather requires resource declared as texture/2D/Cube/2DArray/CubeArray. +INSTR.RESOURCEKINDFORGETDIM Invalid resource kind on GetDimensions. +INSTR.RESOURCEKINDFORSAMPLE sample/_l/_d requires resource declared as texture1D/2D/3D/Cube/1DArray/2DArray/CubeArray. +INSTR.RESOURCEKINDFORSAMPLEC samplec requires resource declared as texture1D/2D/Cube/1DArray/2DArray/CubeArray. +INSTR.RESOURCEKINDFORTEXTURELOAD texture load only works on Texture1D/1DArray/2D/2DArray/3D/MS2D/MS2DArray. +INSTR.RESOURCEKINDFORTEXTURESTORE texture store only works on Texture1D/1DArray/2D/2DArray/3D. +INSTR.RESOURCEKINDFORTRACERAY TraceRay should only use RTAccelerationStructure. +INSTR.RESOURCEMAPTOSINGLEENTRY Fail to map resource to resource table. +INSTR.RESOURCEOFFSETMISS offset uninitialized. +INSTR.RESOURCEOFFSETTOOMANY out of bound offset must be undef. +INSTR.RESOURCEUSER Resource should only be used by Load/GEP/Call. +INSTR.SAMPLECOMPTYPE sample_* instructions require resource to be declared to return UNORM, SNORM or FLOAT. +INSTR.SAMPLEINDEXFORLOAD2DMS load on Texture2DMS/2DMSArray require sampleIndex. +INSTR.SAMPLERMODEFORLOD lod instruction requires sampler declared in default mode. +INSTR.SAMPLERMODEFORSAMPLE sample/_l/_d/_cl_s/gather instruction requires sampler declared in default mode. +INSTR.SAMPLERMODEFORSAMPLEC sample_c_*/gather_c instructions require sampler declared in comparison mode. +INSTR.SIGNATUREOPERATIONNOTINENTRY Dxil operation for input output signature must be in entryPoints. +INSTR.STATUS Resource status should only be used by CheckAccessFullyMapped. +INSTR.STRUCTBITCAST Bitcast on struct types is not allowed. +INSTR.SVCONFLICTINGLAUNCHMODE Input system values are compatible with node shader launch mode. +INSTR.TEXTUREOFFSET offset texture instructions must take offset which can resolve to integer literal in the range -8 to 7. +INSTR.TGSMRACECOND Race condition writing to shared memory detected, consider making this write conditional. +INSTR.UNDEFHITOBJECT HitObject is undef. +INSTR.UNDEFINEDVALUEFORUAVSTORE Assignment of undefined values to UAV. +INSTR.UNDEFRESULTFORGETDIMENSION GetDimensions used undef dimension %0 on %1. +INSTR.WRITEMASKFORTYPEDUAVSTORE store on typed uav must write to all four components of the UAV. +INSTR.WRITEMASKGAPFORUAV UAV write mask must be contiguous, starting at x: .x, .xy, .xyz, or .xyzw. +INSTR.WRITEMASKMATCHVALUEFORUAVSTORE uav store write mask must match store value mask, write mask is %0 and store value mask is %1. +META.BARYCENTRICSFLOAT3 only 'float3' type is allowed for SV_Barycentrics. +META.BARYCENTRICSINTERPOLATION SV_Barycentrics cannot be used with 'nointerpolation' type. +META.BARYCENTRICSTWOPERSPECTIVES There can only be up to two input attributes of SV_Barycentrics with different perspective interpolation mode. +META.BRANCHFLATTEN Can't use branch and flatten attributes together. +META.CLIPCULLMAXCOMPONENTS Combined elements of SV_ClipDistance and SV_CullDistance must fit in 8 components +META.CLIPCULLMAXROWS Combined elements of SV_ClipDistance and SV_CullDistance must fit in two rows. +META.COMPUTEWITHNODE Compute entry must not have node metadata +META.CONTROLFLOWHINTNOTONCONTROLFLOW Control flow hint only works on control flow inst. +META.DENSERESIDS Resource identifiers must be zero-based and dense. +META.DUPLICATESYSVALUE System value may only appear once in signature +META.ENTRYFUNCTION entrypoint not found. +META.FLAGSUSAGE Flags must match usage. +META.FORCECASEONSWITCH Attribute forcecase only works for switch. +META.GLCNOTONAPPENDCONSUME globallycoherent cannot be used with append/consume buffers: '%0'. +META.INTEGERINTERPMODE Interpolation mode on integer must be Constant +META.INTERPMODEINONEROW Interpolation mode must be identical for all elements packed into the same row. +META.INTERPMODEVALID Interpolation mode must be valid +META.INVALIDCONTROLFLOWHINT Invalid control flow hint. +META.KNOWN Named metadata should be known +META.MAXTESSFACTOR Hull Shader MaxTessFactor must be [%0..%1]. %2 specified. +META.NOENTRYPROPSFORENTRY Entry point %0 must have entry properties. +META.NOSEMANTICOVERLAP Semantics must not overlap +META.REQUIRED Required metadata missing. +META.SEMAKINDMATCHESNAME Semantic name must match system value, when defined. +META.SEMAKINDVALID Semantic kind must be valid +META.SEMANTICCOMPTYPE %0 must be %1. +META.SEMANTICINDEXMAX System value semantics have a maximum valid semantic index +META.SEMANTICLEN Semantic length must be at least 1 and at most 64. +META.SEMANTICSHOULDBEALLOCATED Semantic should have a valid packing location +META.SEMANTICSHOULDNOTBEALLOCATED Semantic should have a packing location of -1 +META.SIGNATURECOMPTYPE signature %0 specifies unrecognized or invalid component type. +META.SIGNATUREDATAWIDTH Data width must be identical for all elements packed into the same row. +META.SIGNATUREILLEGALCOMPONENTORDER Component ordering for packed elements must be: arbitrary < system value < system generated value +META.SIGNATUREINDEXCONFLICT Only elements with compatible indexing rules may be packed together +META.SIGNATUREOUTOFRANGE Signature elements must fit within maximum signature size +META.SIGNATUREOVERLAP Signature elements may not overlap in packing location. +META.STRUCTBUFALIGNMENT StructuredBuffer stride not aligned +META.STRUCTBUFALIGNMENTOUTOFBOUND StructuredBuffer stride out of bounds +META.SYSTEMVALUEROWS System value may only have 1 row +META.TARGET Target triple must be 'dxil-ms-dx' +META.TESSELLATOROUTPUTPRIMITIVE Invalid Tessellator Output Primitive specified. Must be point, line, triangleCW or triangleCCW. +META.TESSELLATORPARTITION Invalid Tessellator Partitioning specified. Must be integer, pow2, fractional_odd or fractional_even. +META.TEXTURETYPE elements of typed buffers and textures must fit in four 32-bit quantities. +META.USED All metadata must be used by dxil. +META.VALIDSAMPLERMODE Invalid sampler mode on sampler . +META.VALUERANGE Metadata value must be within range. +META.VERSIONSUPPORTED Version in metadata must be supported. +META.WELLFORMED Metadata must be well-formed in operand count and types. +SM.64BITRAWBUFFERLOADSTORE i64/f64 rawBufferLoad/Store overloads are allowed after SM 6.3. +SM.AMPLIFICATIONSHADERPAYLOADSIZE For amplification shader with entry '%0', payload size %1 is greater than maximum size of %2 bytes. +SM.AMPLIFICATIONSHADERPAYLOADSIZEDECLARED For amplification shader with entry '%0', payload size %1 is greater than declared size of %2 bytes. +SM.APPENDANDCONSUMEONSAMEUAV BufferUpdateCounter inc and dec on a given UAV (%d) cannot both be in the same shader for shader model less than 5.1. +SM.CBUFFERARRAYOFFSETALIGNMENT CBuffer array offset must be aligned to 16-bytes +SM.CBUFFERELEMENTOVERFLOW CBuffer elements must not overflow +SM.CBUFFEROFFSETOVERLAP CBuffer offsets must not overlap +SM.CBUFFERSIZE CBuffer size must not exceed 65536 bytes +SM.CBUFFERTEMPLATETYPEMUSTBESTRUCT D3D12 constant/texture buffer template element can only be a struct. +SM.COMPLETEPOSITION Not all elements of SV_Position were written. +SM.CONSTANTINTERPMODE Interpolation mode must be constant for MS primitive output. +SM.COUNTERONLYONSTRUCTBUF BufferUpdateCounter valid only on structured buffers. +SM.CSNOSIGNATURES Compute shaders must not have shader signatures. +SM.DOMAINLOCATIONIDXOOB DomainLocation component index out of bounds for the domain. +SM.DSINPUTCONTROLPOINTCOUNTRANGE DS input control point count must be [0..%0]. %1 specified. +SM.DXILVERSION Target shader model requires specific Dxil Version +SM.GSINSTANCECOUNTRANGE GS instance count must be [1..%0]. %1 specified. +SM.GSOUTPUTVERTEXCOUNTRANGE GS output vertex count must be [0..%0]. %1 specified. +SM.GSTOTALOUTPUTVERTEXDATARANGE Declared output vertex count (%0) multiplied by the total number of declared scalar components of output data (%1) equals %2. This value cannot be greater than %3. +SM.GSVALIDINPUTPRIMITIVE GS input primitive unrecognized. +SM.GSVALIDOUTPUTPRIMITIVETOPOLOGY GS output primitive topology unrecognized. +SM.HSINPUTCONTROLPOINTCOUNTRANGE HS input control point count must be [0..%0]. %1 specified. +SM.HULLPASSTHRUCONTROLPOINTCOUNTMATCH For pass thru hull shader, input control point count must match output control point count +SM.INCOMPATIBLECALLINENTRY Features used in internal function calls must be compatible with entry +SM.INCOMPATIBLEDERIVINCOMPUTESHADERMODEL Derivatives in compute-model shaders require shader model 6.6 and above +SM.INCOMPATIBLEDERIVLAUNCH Node shaders only support derivatives in broadcasting launch mode +SM.INCOMPATIBLEOPERATION Operations used in entry function must be compatible with shader stage and other properties +SM.INCOMPATIBLEREQUIRESGROUP Functions requiring groupshared memory must be called from shaders with a visible group +SM.INCOMPATIBLESHADERMODEL Functions may only use features available in the current shader model +SM.INCOMPATIBLESTAGE Functions may only use features available in the entry function's stage +SM.INCOMPATIBLETHREADGROUPDIM When derivatives are used in compute-model shaders, the thread group dimensions must be compatible +SM.INSIDETESSFACTORSIZEMATCHDOMAIN InsideTessFactor rows, columns (%0, %1) invalid for domain %2. Expected %3 rows and 1 column. +SM.INVALIDRESOURCECOMPTYPE Invalid resource return type. +SM.INVALIDRESOURCEKIND Invalid resources kind. +SM.INVALIDSAMPLERFEEDBACKTYPE Invalid sampler feedback type. +SM.INVALIDTEXTUREKINDONUAV TextureCube[Array] resources are not supported with UAVs. +SM.ISOLINEOUTPUTPRIMITIVEMISMATCH Hull Shader declared with IsoLine Domain must specify output primitive point or line. Triangle_cw or triangle_ccw output are not compatible with the IsoLine Domain. +SM.MAXMSSMSIZE Total Thread Group Shared Memory storage is %0, exceeded %1. +SM.MAXTGSMSIZE Total Thread Group Shared Memory storage is %0, exceeded %1. +SM.MAXTHEADGROUP Declared Thread Group Count %0 (X*Y*Z) is beyond the valid maximum of %1. +SM.MESHPSIGROWCOUNT For shader '%0', primitive output signatures are taking up more than %1 rows. +SM.MESHSHADERINOUTSIZE For shader '%0', payload plus output size is greater than %1. +SM.MESHSHADERMAXPRIMITIVECOUNT MS max primitive output count must be [0..%0]. %1 specified. +SM.MESHSHADERMAXVERTEXCOUNT MS max vertex output count must be [0..%0]. %1 specified. +SM.MESHSHADEROUTPUTSIZE For shader '%0', vertex plus primitive output size is greater than %1. +SM.MESHSHADERPAYLOADSIZE For mesh shader with entry '%0', payload size %1 is greater than maximum size of %2 bytes. +SM.MESHSHADERPAYLOADSIZEDECLARED For mesh shader with entry '%0', payload size %1 is greater than declared size of %2 bytes. +SM.MESHTOTALSIGROWCOUNT For shader '%0', vertex and primitive output signatures are taking up more than %1 rows. +SM.MESHVSIGROWCOUNT For shader '%0', vertex output signatures are taking up more than %1 rows. +SM.MULTISTREAMMUSTBEPOINT When multiple GS output streams are used they must be pointlists +SM.NAME Target shader model name must be known +SM.NOINTERPMODE Interpolation mode must be undefined for VS input/PS output/patch constant. +SM.NOPSOUTPUTIDX Pixel shader output registers are not indexable. +SM.OPCODE Opcode must be defined in target shader model +SM.OPCODEININVALIDFUNCTION Invalid DXIL opcode usage like StorePatchConstant in patch constant function +SM.OPERAND Operand must be defined in target shader model. +SM.OUTPUTCONTROLPOINTCOUNTRANGE output control point count must be [%0..%1]. %2 specified. +SM.OUTPUTCONTROLPOINTSTOTALSCALARS Total number of scalars across all HS output control points must not exceed . +SM.PATCHCONSTANTONLYFORHSDS patch constant signature only valid in HS and DS. +SM.PROGRAMVERSION Program Version in Dxil Container does not match Dxil Module shader model version +SM.PSCONSISTENTINTERP Interpolation mode for PS input position must be linear_noperspective_centroid or linear_noperspective_sample when outputting oDepthGE or oDepthLE and not running at sample frequency (which is forced by inputting SV_SampleIndex or declaring an input linear_sample or linear_noperspective_sample). +SM.PSCOVERAGEANDINNERCOVERAGE InnerCoverage and Coverage are mutually exclusive. +SM.PSMULTIPLEDEPTHSEMANTIC Pixel Shader only allows one type of depth semantic to be declared. +SM.PSOUTPUTSEMANTIC Pixel Shader allows output semantics to be SV_Target, SV_Depth, SV_DepthGreaterEqual, SV_DepthLessEqual, SV_Coverage or SV_StencilRef, %0 found. +SM.PSTARGETCOL0 SV_Target packed location must start at column 0. +SM.PSTARGETINDEXMATCHESROW SV_Target semantic index must match packed row location. +SM.RAYSHADERPAYLOADSIZE For shader '%0', %1 size is smaller than argument's allocation size. +SM.RAYSHADERSIGNATURES Ray tracing shader '%0' should not have any shader signatures. +SM.RESOURCERANGEOVERLAP Resource ranges must not overlap +SM.ROVONLYINPS RasterizerOrdered objects are only allowed in 5.0+ pixel shaders. +SM.SAMPLECOUNTONLYON2DMS Only Texture2DMS/2DMSArray could has sample count. +SM.SEMANTIC Semantic must be defined in target shader model +SM.STREAMINDEXRANGE Stream index (%0) must between 0 and %1. +SM.TESSFACTORFORDOMAIN Required TessFactor for domain not found declared anywhere in Patch Constant data. +SM.TESSFACTORSIZEMATCHDOMAIN TessFactor rows, columns (%0, %1) invalid for domain %2. Expected %3 rows and 1 column. +SM.TGSMUNSUPPORTED Thread Group Shared Memory not supported %0. +SM.THREADGROUPCHANNELRANGE Declared Thread Group %0 size %1 outside valid range [%2..%3]. +SM.TRIOUTPUTPRIMITIVEMISMATCH Hull Shader declared with Tri Domain must specify output primitive point, triangle_cw or triangle_ccw. Line output is not compatible with the Tri domain. +SM.UNDEFINEDOUTPUT Not all elements of output %0 were written. +SM.VALIDDOMAIN Invalid Tessellator Domain specified. Must be isoline, tri or quad. +SM.VIEWIDNEEDSSLOT ViewID requires compatible space in pixel shader input signature +SM.WAVESIZEALLZEROWHENUNDEFINED WaveSize Max and Preferred must be 0 when Min is 0 +SM.WAVESIZEEXPECTSONEPARAM WaveSize tag expects exactly 1 parameter. +SM.WAVESIZEMAXANDPREFERREDZEROWHENNORANGE WaveSize Max and Preferred must be 0 to encode min==max +SM.WAVESIZEMAXGREATERTHANMIN WaveSize Max must greater than Min +SM.WAVESIZENEEDSCONSTANTOPERANDS WaveSize metadata operands must be constant values. +SM.WAVESIZENEEDSSM66OR67 WaveSize is valid only for Shader Model 6.6 and 6.7. +SM.WAVESIZEONCOMPUTEORNODE WaveSize only allowed on compute or node shaders +SM.WAVESIZEPREFERREDINRANGE WaveSize Preferred must be within Min..Max range +SM.WAVESIZERANGEEXPECTSTHREEPARAMS WaveSize Range tag expects exactly 3 parameters. +SM.WAVESIZERANGENEEDSSM68PLUS WaveSize Range is valid only for Shader Model 6.8 and higher. +SM.WAVESIZETAGDUPLICATE WaveSize or WaveSizeRange tag may only appear once per entry point. +SM.WAVESIZEVALUE WaveSize value must be a power of 2 in range [4..128] +SM.ZEROHSINPUTCONTROLPOINTWITHINPUT When HS input control point count is 0, no input signature should exist. +TYPES.DEFINED Type must be defined based on DXIL primitives +TYPES.I8 I8 can only be used as immediate value for intrinsic or as i8* via bitcast by lifetime intrinsics. +TYPES.INTWIDTH Int type must be of valid width +TYPES.NOMULTIDIM Only one dimension allowed for array type. +TYPES.NOPTRTOPTR Pointers to pointers, or pointers in structures are not allowed. +TYPES.NOVECTOR Vector types must not be present +===================================================== ======================================================================================================================================================================================================================================================================================================== .. VALRULES-RST:END