Przeglądaj źródła

Add RaytracingPipelineConfig1 subobject to DXR (#2342)

amarpMSFT 6 lat temu
rodzic
commit
c41606c737

+ 13 - 3
include/dxc/DXIL/DxilConstants.h

@@ -1249,8 +1249,8 @@ namespace DXIL {
     UseNativeLowPrecision
   };
 
-  // Corresponds to HIT_FLAG_* in HLSL
-  enum class RayFlag : uint8_t {
+  // Corresponds to RAY_FLAG_* in HLSL
+  enum class RayFlag : uint32_t {
     None = 0x00,
     ForceOpaque = 0x01,
     ForceNonOpaque = 0x02,
@@ -1260,6 +1260,8 @@ namespace DXIL {
     CullFrontFacingTriangles = 0x20,
     CullOpaque = 0x40,
     CullNonOpaque = 0x80,
+    SkipTriangles = 0x100,
+    SkipProceduralPrimitives = 0x200,
   };
 
   // Corresponds to HIT_KIND_* in HLSL
@@ -1316,6 +1318,7 @@ namespace DXIL {
     RaytracingShaderConfig            = 9,
     RaytracingPipelineConfig          = 10,
     HitGroup                          = 11,
+    RaytracingPipelineConfig1         = 12,
     NumKinds // aka D3D12_STATE_SUBOBJECT_TYPE_MAX_VALID
   };
 
@@ -1336,7 +1339,14 @@ namespace DXIL {
     ProceduralPrimitive = 0x1,
     LastEntry,
   };
-
+  
+  enum class RaytracingPipelineFlags : uint32_t {
+    None = 0x0,
+    SkipTriangles = 0x100,
+    SkipProceduralPrimitives = 0x200,
+    ValidMask = 0x300,
+  };
+  
   enum class CommittedStatus : uint32_t {
     CommittedNothing = 0,
     CommittedTriangleHit = 1,

+ 10 - 0
include/dxc/DXIL/DxilSubobject.h

@@ -50,6 +50,7 @@ public:
   bool GetRaytracingShaderConfig(uint32_t &MaxPayloadSizeInBytes,
                                  uint32_t &MaxAttributeSizeInBytes) const;
   bool GetRaytracingPipelineConfig(uint32_t &MaxTraceRecursionDepth) const;
+  bool GetRaytracingPipelineConfig1(uint32_t &MaxTraceRecursionDepth, uint32_t &Flags) const;
   bool GetHitGroup(DXIL::HitGroupType &hitGroupType,
                    llvm::StringRef &AnyHit,
                    llvm::StringRef &ClosestHit,
@@ -86,6 +87,10 @@ private:
   struct RaytracingPipelineConfig_t {
     uint32_t MaxTraceRecursionDepth;
   };
+  struct RaytracingPipelineConfig1_t {
+    uint32_t MaxTraceRecursionDepth;
+    uint32_t Flags; // DXIL::RaytracingPipelineFlags
+  };
   struct HitGroup_t {
     DXIL::HitGroupType Type;
     const char *AnyHit;
@@ -100,6 +105,7 @@ private:
     RaytracingShaderConfig_t RaytracingShaderConfig;
     RaytracingPipelineConfig_t RaytracingPipelineConfig;
     HitGroup_t HitGroup;
+    RaytracingPipelineConfig1_t RaytracingPipelineConfig1;
   };
 
   friend class DxilSubobjects;
@@ -148,6 +154,10 @@ public:
   DxilSubobject &CreateRaytracingPipelineConfig(
     llvm::StringRef Name,
     uint32_t MaxTraceRecursionDepth);
+  DxilSubobject &CreateRaytracingPipelineConfig1(
+    llvm::StringRef Name,
+    uint32_t MaxTraceRecursionDepth,
+    uint32_t Flags);
   DxilSubobject &CreateHitGroup(llvm::StringRef Name, 
                                 DXIL::HitGroupType hitGroupType,
                                 llvm::StringRef AnyHit,

+ 22 - 0
include/dxc/DxilContainer/DxilRuntimeReflection.h

@@ -219,6 +219,10 @@ struct RuntimeDataSubobjectInfo {
     uint32_t ClosestHit;
     uint32_t Intersection;
   };
+  struct RaytracingPipelineConfig1_t {
+    uint32_t MaxTraceRecursionDepth;
+    uint32_t Flags;
+  };
 
   union {
     StateObjectConfig_t StateObjectConfig;
@@ -227,6 +231,7 @@ struct RuntimeDataSubobjectInfo {
     RaytracingShaderConfig_t RaytracingShaderConfig;
     RaytracingPipelineConfig_t RaytracingPipelineConfig;
     HitGroup_t HitGroup;
+    RaytracingPipelineConfig1_t RaytracingPipelineConfig1;
   };
 };
 
@@ -532,6 +537,17 @@ public:
       m_SubobjectInfo->RaytracingPipelineConfig.MaxTraceRecursionDepth : 0;
   }
 
+  // RaytracingPipelineConfig1
+  uint32_t GetRaytracingPipelineConfig1_MaxTraceRecursionDepth() const {
+    return (GetKind() == DXIL::SubobjectKind::RaytracingPipelineConfig1) ?
+      m_SubobjectInfo->RaytracingPipelineConfig1.MaxTraceRecursionDepth : 0;
+  }
+
+  uint32_t GetRaytracingPipelineConfig1_Flags() const {
+    return (GetKind() == DXIL::SubobjectKind::RaytracingPipelineConfig1) ?
+      m_SubobjectInfo->RaytracingPipelineConfig1.Flags : (uint32_t)0;
+  }
+
   // HitGroup
   DXIL::HitGroupType GetHitGroup_Type() const {
     return (GetKind() == DXIL::SubobjectKind::HitGroup) ?
@@ -653,6 +669,11 @@ struct DxilSubobjectDesc {
     LPCWSTR Intersection;
   };
 
+  struct RaytracingPipelineConfig1_t {
+    uint32_t MaxTraceRecursionDepth;
+    uint32_t Flags; // DXIL::RaytracingPipelineFlags / D3D12_RAYTRACING_PIPELINE_FLAGS
+  };
+
   union {
     StateObjectConfig_t StateObjectConfig;
     RootSignature_t RootSignature;    // GlobalRootSignature or LocalRootSignature
@@ -660,6 +681,7 @@ struct DxilSubobjectDesc {
     RaytracingShaderConfig_t RaytracingShaderConfig;
     RaytracingPipelineConfig_t RaytracingPipelineConfig;
     HitGroup_t HitGroup;
+    RaytracingPipelineConfig1_t RaytracingPipelineConfig1;
   };
 };
 

+ 4 - 0
include/dxc/DxilContainer/DxilRuntimeReflection.inl

@@ -515,6 +515,10 @@ DxilSubobjectDesc *DxilRuntimeReflection_impl::AddSubobject(const SubobjectReade
     subobject.HitGroup.AnyHit = GetWideString(subobjectReader.GetHitGroup_AnyHit());
     subobject.HitGroup.ClosestHit = GetWideString(subobjectReader.GetHitGroup_ClosestHit());
     break;
+  case DXIL::SubobjectKind::RaytracingPipelineConfig1:
+    subobject.RaytracingPipelineConfig1.MaxTraceRecursionDepth = subobjectReader.GetRaytracingPipelineConfig1_MaxTraceRecursionDepth();
+    subobject.RaytracingPipelineConfig1.Flags = subobjectReader.GetRaytracingPipelineConfig1_Flags();
+    break;
   default:
     // Ignore contents of unrecognized subobject type (forward-compat)
     break;

+ 19 - 0
lib/DXIL/DxilMetadataHelper.cpp

@@ -1621,6 +1621,15 @@ Metadata *DxilMDHelper::EmitSubobject(const DxilSubobject &obj) {
     Args.emplace_back(MDString::get(m_Ctx, ClosestHit));
     break;
   }
+  case DXIL::SubobjectKind::RaytracingPipelineConfig1: {
+    uint32_t MaxTraceRecursionDepth;
+    uint32_t Flags;
+    IFTBOOL(obj.GetRaytracingPipelineConfig1(MaxTraceRecursionDepth, Flags),
+            DXC_E_INCORRECT_DXIL_METADATA);
+    Args.emplace_back(Uint32ToConstMD(MaxTraceRecursionDepth));
+    Args.emplace_back(Uint32ToConstMD(Flags));
+    break;
+  }
   default:
     DXASSERT(false, "otherwise, we didn't handle a valid subobject kind");
     break;
@@ -1690,6 +1699,16 @@ void DxilMDHelper::LoadSubobject(const llvm::MDNode &MD, DxilSubobjects &Subobje
     Subobjects.CreateHitGroup(name, (DXIL::HitGroupType)hgType, AnyHit, ClosestHit, Intersection);
     break;
   }
+  case DXIL::SubobjectKind::RaytracingPipelineConfig1: {
+    uint32_t MaxTraceRecursionDepth = ConstMDToUint32(MD.getOperand(i++));
+    uint32_t Flags = ConstMDToUint32(MD.getOperand(i++));
+    IFTBOOL(0 ==
+                ((~(uint32_t)DXIL::RaytracingPipelineFlags::ValidMask) & Flags),
+            DXC_E_INCORRECT_DXIL_METADATA);
+    Subobjects.CreateRaytracingPipelineConfig1(name, MaxTraceRecursionDepth,
+                                               Flags);
+    break;
+  }
   default:
     DXASSERT(false, "otherwise, we didn't handle a valid subobject kind");
     break;

+ 25 - 1
lib/DXIL/DxilSubobject.cpp

@@ -76,6 +76,10 @@ void DxilSubobject::CopyUnionedContents(const DxilSubobject &other) {
     HitGroup.ClosestHit = other.HitGroup.ClosestHit;
     HitGroup.Intersection = other.HitGroup.Intersection;
     break;
+  case Kind::RaytracingPipelineConfig1:
+    RaytracingPipelineConfig1.MaxTraceRecursionDepth = other.RaytracingPipelineConfig1.MaxTraceRecursionDepth;
+    RaytracingPipelineConfig1.Flags = other.RaytracingPipelineConfig1.Flags;
+    break;
   default:
     DXASSERT(0, "invalid kind");
     break;
@@ -178,7 +182,17 @@ bool DxilSubobject::GetHitGroup(DXIL::HitGroupType &hitGroupType,
   return false;
 }
 
-
+// RaytracingPipelineConfig1
+bool DxilSubobject::GetRaytracingPipelineConfig1(
+    uint32_t &MaxTraceRecursionDepth, uint32_t &Flags) const {
+  if (m_Kind == Kind::RaytracingPipelineConfig1) {
+    MaxTraceRecursionDepth = RaytracingPipelineConfig1.MaxTraceRecursionDepth;
+    Flags = RaytracingPipelineConfig1.Flags;
+    return true;
+  }
+  return false;
+}
+ 
 DxilSubobjects::DxilSubobjects()
   : m_BytesStorage()
   , m_Subobjects()
@@ -307,6 +321,16 @@ DxilSubobject &DxilSubobjects::CreateHitGroup(llvm::StringRef Name,
   return obj;
 }
 
+DxilSubobject &DxilSubobjects::CreateRaytracingPipelineConfig1(
+    llvm::StringRef Name, uint32_t MaxTraceRecursionDepth, uint32_t Flags) {
+  auto &obj = CreateSubobject(Kind::RaytracingPipelineConfig1, Name);
+  obj.RaytracingPipelineConfig1.MaxTraceRecursionDepth = MaxTraceRecursionDepth;
+  DXASSERT_NOMSG(
+      0 == ((~(uint32_t)DXIL::RaytracingPipelineFlags::ValidMask) & Flags));
+  obj.RaytracingPipelineConfig1.Flags = Flags;
+  return obj;
+}
+
 DxilSubobject &DxilSubobjects::CreateSubobject(Kind kind, llvm::StringRef Name) {
   Name = InternString(Name);
   IFTBOOLMSG(FindSubobject(Name) == nullptr, DXC_E_GENERAL_INTERNAL_ERROR, "Subobject name collision");

+ 7 - 0
lib/DxilContainer/DxilContainerAssembler.cpp

@@ -1288,6 +1288,7 @@ private:
           info.RaytracingPipelineConfig.MaxTraceRecursionDepth);
         break;
       case DXIL::SubobjectKind::HitGroup:
+      {
         HitGroupType hgType;
         StringRef AnyHit;
         StringRef ClosestHit;
@@ -1299,6 +1300,12 @@ private:
         info.HitGroup.Intersection = m_pStringBufferPart->Insert(Intersection);
         break;
       }
+      case DXIL::SubobjectKind::RaytracingPipelineConfig1:
+        obj.GetRaytracingPipelineConfig1(
+            info.RaytracingPipelineConfig1.MaxTraceRecursionDepth,
+            info.RaytracingPipelineConfig1.Flags);
+        break;
+      }
       m_pSubobjectTable->Insert(info);
     }
   }

+ 6 - 0
lib/DxilContainer/DxilContainerReader.cpp

@@ -72,6 +72,12 @@ bool LoadSubobjectsFromRDAT(DxilSubobjects &subobjects, RDAT::SubobjectTableRead
           reader.GetHitGroup_ClosestHit(),
           reader.GetHitGroup_Intersection());
           break;
+      case DXIL::SubobjectKind::RaytracingPipelineConfig1:
+        subobjects.CreateRaytracingPipelineConfig1(
+            reader.GetName(),
+            reader.GetRaytracingPipelineConfig1_MaxTraceRecursionDepth(),
+            reader.GetRaytracingPipelineConfig1_Flags());
+        break;
       }
     } catch (hlsl::Exception &) {
       result = false;

+ 1 - 1
tools/clang/include/clang/AST/HlslTypes.h

@@ -302,7 +302,7 @@ void AddHLSLVectorTemplate(
 clang::CXXRecordDecl* DeclareRecordTypeWithHandle(
   clang::ASTContext& context, llvm::StringRef name);
 
-void AddRayTracingConstants(clang::ASTContext& context);
+void AddRaytracingConstants(clang::ASTContext& context);
 
 /// <summary>Adds the implementation for std::is_equal.</summary>
 void AddStdIsEqualImplementation(clang::ASTContext& context, clang::Sema& sema);

+ 9 - 1
tools/clang/lib/AST/ASTContextHLSL.cpp

@@ -413,6 +413,7 @@ static void AddConstUInt(clang::ASTContext& context, StringRef name, unsigned va
 
 // Adds a top-level enum with the given enumerants.
 struct Enumerant { StringRef name; unsigned value; };
+
 static void AddTypedefPseudoEnum(ASTContext& context, StringRef name, ArrayRef<Enumerant> enumerants) {
   DeclContext* curDC = context.getTranslationUnitDecl();
   // typedef uint <name>;
@@ -428,7 +429,7 @@ static void AddTypedefPseudoEnum(ASTContext& context, StringRef name, ArrayRef<E
 }
 
 /// <summary> Adds all constants and enums for ray tracing </summary>
-void hlsl::AddRayTracingConstants(ASTContext& context) {
+void hlsl::AddRaytracingConstants(ASTContext& context) {
   AddTypedefPseudoEnum(context, "RAY_FLAG", {
     { "RAY_FLAG_NONE", (unsigned)DXIL::RayFlag::None },
     { "RAY_FLAG_FORCE_OPAQUE", (unsigned)DXIL::RayFlag::ForceOpaque },
@@ -459,6 +460,13 @@ void hlsl::AddRayTracingConstants(ASTContext& context) {
 
   AddConstUInt(context, StringRef("STATE_OBJECT_FLAGS_ALLOW_LOCAL_DEPENDENCIES_ON_EXTERNAL_DEFINITONS"), (unsigned)DXIL::StateObjectFlags::AllowLocalDependenciesOnExternalDefinitions);
   AddConstUInt(context, StringRef("STATE_OBJECT_FLAGS_ALLOW_EXTERNAL_DEPENDENCIES_ON_LOCAL_DEFINITIONS"), (unsigned)DXIL::StateObjectFlags::AllowExternalDependenciesOnLocalDefinitions);
+  // The above "_FLAGS_" was a typo, leaving in to avoid breaking anyone.  Supposed to be _FLAG_ below.  
+  AddConstUInt(context, StringRef("STATE_OBJECT_FLAG_ALLOW_LOCAL_DEPENDENCIES_ON_EXTERNAL_DEFINITONS"), (unsigned)DXIL::StateObjectFlags::AllowLocalDependenciesOnExternalDefinitions);
+  AddConstUInt(context, StringRef("STATE_OBJECT_FLAG_ALLOW_EXTERNAL_DEPENDENCIES_ON_LOCAL_DEFINITIONS"), (unsigned)DXIL::StateObjectFlags::AllowExternalDependenciesOnLocalDefinitions);
+
+  AddConstUInt(context, StringRef("RAYTRACING_PIPELINE_FLAG_NONE"), (unsigned)DXIL::RaytracingPipelineFlags::None);
+  AddConstUInt(context, StringRef("RAYTRACING_PIPELINE_FLAG_SKIP_TRIANGLES"), (unsigned)DXIL::RaytracingPipelineFlags::SkipTriangles);
+  AddConstUInt(context, StringRef("RAYTRACING_PIPELINE_FLAG_SKIP_PROCEDURAL_PRIMITIVES"), (unsigned)DXIL::RaytracingPipelineFlags::SkipProceduralPrimitives);
 }
 
 static

+ 2 - 0
tools/clang/lib/AST/HlslTypes.cpp

@@ -564,6 +564,8 @@ bool GetHLSLSubobjectKind(clang::QualType type, DXIL::SubobjectKind &subobjectKi
       return name == "RaytracingShaderConfig" ? (subobjectKind = DXIL::SubobjectKind::RaytracingShaderConfig, true) : false;
     case 24:
       return name == "RaytracingPipelineConfig" ? (subobjectKind = DXIL::SubobjectKind::RaytracingPipelineConfig, true) : false;
+    case 25:
+      return name == "RaytracingPipelineConfig1" ? (subobjectKind = DXIL::SubobjectKind::RaytracingPipelineConfig1, true) : false;
     case 16:
       if (name == "TriangleHitGroup") {
         subobjectKind = DXIL::SubobjectKind::HitGroup;

+ 13 - 0
tools/clang/lib/CodeGen/CGHLSLMS.cpp

@@ -2811,6 +2811,19 @@ void CGMSHLSLRuntime::CreateSubobject(DXIL::SubobjectKind kind, const StringRef
       }
       break;
     }
+    case DXIL::SubobjectKind::RaytracingPipelineConfig1: {
+      DXASSERT_NOMSG(argCount == 2);
+      uint32_t maxTraceRecursionDepth;
+      uint32_t raytracingPipelineFlags;
+      if (!GetAsConstantUInt32(args[0], &maxTraceRecursionDepth))
+        return;
+
+      if (!GetAsConstantUInt32(args[1], &raytracingPipelineFlags))
+        return;
+
+      subobjects->CreateRaytracingPipelineConfig1(name, maxTraceRecursionDepth, raytracingPipelineFlags);
+      break;
+    }
     default:
       llvm_unreachable("unknown SubobjectKind");
       break;

+ 28 - 2
tools/clang/lib/Sema/SemaHLSL.cpp

@@ -203,6 +203,7 @@ enum ArBasicKind {
   AR_OBJECT_RAYTRACING_PIPELINE_CONFIG,
   AR_OBJECT_TRIANGLE_HIT_GROUP,
   AR_OBJECT_PROCEDURAL_PRIMITIVE_HIT_GROUP,
+  AR_OBJECT_RAYTRACING_PIPELINE_CONFIG1,
 
   // RayQuery
   AR_OBJECT_RAY_QUERY,
@@ -489,6 +490,7 @@ const UINT g_uBasicKindProps[] =
   0,      //AR_OBJECT_RAYTRACING_PIPELINE_CONFIG,
   0,      //AR_OBJECT_TRIANGLE_HIT_GROUP,
   0,      //AR_OBJECT_PROCEDURAL_PRIMITIVE_HIT_GROUP,
+  0,      //AR_OBJECT_RAYTRACING_PIPELINE_CONFIG1,
 
   0,      //AR_OBJECT_RAY_QUERY,
 
@@ -1323,6 +1325,7 @@ const ArBasicKind g_ArBasicKindsAsTypes[] =
   AR_OBJECT_RAYTRACING_PIPELINE_CONFIG,
   AR_OBJECT_TRIANGLE_HIT_GROUP,
   AR_OBJECT_PROCEDURAL_PRIMITIVE_HIT_GROUP,
+  AR_OBJECT_RAYTRACING_PIPELINE_CONFIG1,
 
   AR_OBJECT_RAY_QUERY
 };
@@ -1409,6 +1412,7 @@ const uint8_t g_ArBasicKindsTemplateCount[] =
   0, // AR_OBJECT_RAYTRACING_PIPELINE_CONFIG,
   0, // AR_OBJECT_TRIANGLE_HIT_GROUP,
   0, // AR_OBJECT_PROCEDURAL_PRIMITIVE_HIT_GROUP,
+  0, // AR_OBJECT_RAYTRACING_PIPELINE_CONFIG1,
 
   1, // AR_OBJECT_RAY_QUERY,
 };
@@ -1505,6 +1509,7 @@ const SubscriptOperatorRecord g_ArBasicKindsSubscripts[] =
   { 0, MipsFalse, SampleFalse },  // AR_OBJECT_RAYTRACING_PIPELINE_CONFIG,
   { 0, MipsFalse, SampleFalse },  // AR_OBJECT_TRIANGLE_HIT_GROUP,
   { 0, MipsFalse, SampleFalse },  // AR_OBJECT_PROCEDURAL_PRIMITIVE_HIT_GROUP,
+  { 0, MipsFalse, SampleFalse },  // AR_OBJECT_RAYTRACING_PIPELINE_CONFIG1,
 
   { 0, MipsFalse, SampleFalse },  // AR_OBJECT_RAY_QUERY,
 };
@@ -1625,6 +1630,7 @@ const char* g_ArBasicTypeNames[] =
   "RaytracingPipelineConfig",
   "TriangleHitGroup",
   "ProceduralPrimitiveHitGroup",
+  "RaytracingPipelineConfig1",
 
   "RayQuery"
 };
@@ -2613,6 +2619,23 @@ static CXXRecordDecl *CreateSubobjectRaytracingPipelineConfig(ASTContext& contex
   return decl;
 }
 
+// struct RaytracingPipelineConfig1
+// {
+//   uint32_t MaxTraceRecursionDepth;
+//   uint32_t Flags;
+// };
+static CXXRecordDecl *
+CreateSubobjectRaytracingPipelineConfig1(ASTContext &context) {
+  CXXRecordDecl *decl =
+      StartSubobjectDecl(context, "RaytracingPipelineConfig1");
+  CreateSimpleField(context, decl, "MaxTraceRecursionDepth",
+                    context.UnsignedIntTy, AccessSpecifier::AS_private);
+  CreateSimpleField(context, decl, "Flags", context.UnsignedIntTy,
+                    AccessSpecifier::AS_private);
+  FinishSubobjectDecl(context, decl);
+  return decl;
+}
+
 // struct TriangleHitGroup
 // {
 //   string AnyHit;
@@ -3290,6 +3313,9 @@ private:
         case AR_OBJECT_PROCEDURAL_PRIMITIVE_HIT_GROUP:
           recordDecl = CreateSubobjectProceduralPrimitiveHitGroup(*m_context);
           break;
+        case AR_OBJECT_RAYTRACING_PIPELINE_CONFIG1:
+          recordDecl = CreateSubobjectRaytracingPipelineConfig1(*m_context);
+          break;
         }
       } else if (kind == AR_OBJECT_RAY_QUERY) {
         recordDecl = DeclareUIntTemplatedTypeWithHandle(*m_context, "RayQuery", "flags");
@@ -3479,7 +3505,7 @@ public:
   }
 
   static bool IsSubobjectBasicKind(ArBasicKind kind) {
-    return kind >= AR_OBJECT_STATE_OBJECT_CONFIG && kind <= AR_OBJECT_PROCEDURAL_PRIMITIVE_HIT_GROUP;
+    return kind >= AR_OBJECT_STATE_OBJECT_CONFIG && kind <= AR_OBJECT_RAYTRACING_PIPELINE_CONFIG1;
   }
 
   bool IsSubobjectType(QualType type) {
@@ -4226,7 +4252,7 @@ public:
     DXASSERT(m_matrixTemplateDecl != nullptr, "AddHLSLMatrixTypes failed to return the matrix template declaration");
 
     // Initializing built in integers for ray tracing
-    AddRayTracingConstants(*m_context);
+    AddRaytracingConstants(*m_context);
 
     return true;
   }

+ 2 - 0
tools/clang/test/CodeGenHLSL/batch/shader_stages/raytracing/subobjects.hlsl

@@ -10,6 +10,7 @@
 // CHECK: ; RaytracingPipelineConfig rpc = { MaxTraceRecursionDepth = 512 };
 // CHECK: ; HitGroup trHitGt = { HitGroupType = Triangle, Anyhit = "a", Closesthit = "b", Intersection = "" };
 // CHECK: ; HitGroup ppHitGt = { HitGroupType = ProceduralPrimitive, Anyhit = "a", Closesthit = "b", Intersection = "c" };
+// CHECK: ; StateObjectConfig soc2 = { STATE_OBJECT_FLAG_ALLOW_LOCAL_DEPENDENCIES_ON_EXTERNAL_DEFINITIONS };
 
 GlobalRootSignature grs = {"CBV(b0)"};
 StateObjectConfig soc = { STATE_OBJECT_FLAGS_ALLOW_LOCAL_DEPENDENCIES_ON_EXTERNAL_DEFINITONS };
@@ -22,6 +23,7 @@ RaytracingShaderConfig rsc = { 128, 64 };
 RaytracingPipelineConfig rpc = { 512 };
 TriangleHitGroup trHitGt = { "a", "b" };
 ProceduralPrimitiveHitGroup ppHitGt = { "a", "b", "c"};
+StateObjectConfig soc2 = {STATE_OBJECT_FLAG_ALLOW_LOCAL_DEPENDENCIES_ON_EXTERNAL_DEFINITONS};
 
 int main(int i : INDEX) : SV_Target {
   return 1;

+ 32 - 0
tools/clang/test/CodeGenHLSL/batch/shader_stages/raytracing/subobjects_raytracingPipelineConfig1.hlsl

@@ -0,0 +1,32 @@
+// RUN: %dxc -T lib_6_3 %s | FileCheck %s
+
+// CHECK: ; GlobalRootSignature grs = { <48 bytes> };
+// CHECK: ; StateObjectConfig soc = { STATE_OBJECT_FLAG_ALLOW_LOCAL_DEPENDENCIES_ON_EXTERNAL_DEFINITIONS };
+// CHECK: ; LocalRootSignature lrs = { <48 bytes> };
+// CHECK: ; SubobjectToExportsAssociation sea = { "grs", { "a", "b", "foo", "c" }  };
+// CHECK: ; SubobjectToExportsAssociation sea2 = { "grs", { }  };
+// CHECK: ; SubobjectToExportsAssociation sea3 = { "grs", { }  };
+// CHECK: ; RaytracingShaderConfig rsc = { MaxPayloadSizeInBytes = 128, MaxAttributeSizeInBytes = 64 };
+// CHECK: ; RaytracingPipelineConfig1 rpc = { MaxTraceRecursionDepth = 32, Flags = RAYTRACING_PIPELINE_FLAG_SKIP_TRIANGLES };
+// CHECK: ; SubobjectToExportsAssociation sea4 = { "rpc", { }  };
+// CHECK: ; RaytracingPipelineConfig1 rpc2 = { MaxTraceRecursionDepth = 32, Flags = 0 };
+// CHECK: ; HitGroup trHitGt = { HitGroupType = Triangle, Anyhit = "a", Closesthit = "b", Intersection = "" };
+// CHECK: ; HitGroup ppHitGt = { HitGroupType = ProceduralPrimitive, Anyhit = "a", Closesthit = "b", Intersection = "c" };
+
+GlobalRootSignature grs = {"CBV(b0)"};
+StateObjectConfig soc = { STATE_OBJECT_FLAGS_ALLOW_LOCAL_DEPENDENCIES_ON_EXTERNAL_DEFINITONS };
+LocalRootSignature lrs = {"UAV(u0, visibility = SHADER_VISIBILITY_GEOMETRY), RootFlags(LOCAL_ROOT_SIGNATURE)"};
+SubobjectToExportsAssociation sea = { "grs", "a;b;foo;c" };
+// Empty association is well-defined: it creates a default association
+SubobjectToExportsAssociation sea2 = { "grs", ";" };
+SubobjectToExportsAssociation sea3 = { "grs", "" };
+RaytracingShaderConfig rsc = { 128, 64 };
+RaytracingPipelineConfig1 rpc = { 32, RAYTRACING_PIPELINE_FLAG_SKIP_TRIANGLES };
+SubobjectToExportsAssociation sea4 = {"rpc", ";"};
+RaytracingPipelineConfig1 rpc2 = {32, RAYTRACING_PIPELINE_FLAG_NONE };
+TriangleHitGroup trHitGt = {"a", "b"};
+ProceduralPrimitiveHitGroup ppHitGt = { "a", "b", "c"};
+
+int main(int i : INDEX) : SV_Target {
+  return 1;
+}

+ 25 - 0
tools/clang/tools/dxcompiler/dxcdisassembler.cpp

@@ -598,6 +598,7 @@ static const char *SubobjectKindToString(DXIL::SubobjectKind kind) {
   case DXIL::SubobjectKind::RaytracingShaderConfig: return "RaytracingShaderConfig";
   case DXIL::SubobjectKind::RaytracingPipelineConfig: return "RaytracingPipelineConfig";
   case DXIL::SubobjectKind::HitGroup: return "HitGroup";
+  case DXIL::SubobjectKind::RaytracingPipelineConfig1: return "RaytracingPipelineConfig1";
   }
   return "<invalid kind>";
 }
@@ -612,6 +613,18 @@ static const char *FlagToString(DXIL::StateObjectFlags Flag) {
   return "<invalid StateObjectFlag>";
 }
 
+static const char *FlagToString(DXIL::RaytracingPipelineFlags Flag) {
+  switch (Flag) {
+  case DXIL::RaytracingPipelineFlags::None:
+    return "RAYTRACING_PIPELINE_FLAG_NONE";
+  case DXIL::RaytracingPipelineFlags::SkipTriangles:
+    return "RAYTRACING_PIPELINE_FLAG_SKIP_TRIANGLES";
+  case DXIL::RaytracingPipelineFlags::SkipProceduralPrimitives:
+    return "RAYTRACING_PIPELINE_FLAG_SKIP_PROCEDURAL_PRIMITIVES";
+  }
+  return "<invalid RaytracingPipelineFlags>";
+}
+
 static const char *HitGroupTypeToString(DXIL::HitGroupType type) {
   switch (type) {
   case DXIL::HitGroupType::Triangle:
@@ -737,6 +750,18 @@ void PrintSubobjects(const DxilSubobjects &subobjects,
          << "\", Intersection = \"" << Intersection << "\"";
       break;
     }
+    case DXIL::SubobjectKind::RaytracingPipelineConfig1: {
+      uint32_t MaxTraceRecursionDepth;
+      uint32_t Flags;
+      if (!obj.GetRaytracingPipelineConfig1(MaxTraceRecursionDepth, Flags)) {
+        OS << "<error getting subobject>";
+        break;
+      }
+      OS << "MaxTraceRecursionDepth = " << MaxTraceRecursionDepth;
+      OS << ", Flags = ";
+      PrintFlags<DXIL::RaytracingPipelineFlags>(OS, Flags);
+      break;
+    }
     }
     OS << " };\n";
   }

+ 1 - 0
tools/clang/unittests/HLSL/CompilerTest.cpp

@@ -2753,6 +2753,7 @@ TEST_F(CompilerTest, SubobjectCodeGenErrors) {
     { "SubobjectToExportsAssociation sea;", "1:1: error: subobject needs to be initialized" },
     { "RaytracingShaderConfig rsc;",        "1:1: error: subobject needs to be initialized" },
     { "RaytracingPipelineConfig rpc;",      "1:1: error: subobject needs to be initialized" },
+    { "RaytracingPipelineConfig1 rpc1;",    "1:1: error: subobject needs to be initialized" },
     { "TriangleHitGroup hitGt;",            "1:1: error: subobject needs to be initialized" },
     { "ProceduralPrimitiveHitGroup hitGt;", "1:1: error: subobject needs to be initialized" },
     { "GlobalRootSignature grs2 = {\"\"};", "1:29: error: empty string not expected here" },