
#ifdef CONTAINER_PART
CONTAINER_PART(DXIL)
CONTAINER_PART(SFI0)
CONTAINER_PART(HASH)
CONTAINER_PART(PSV0)
CONTAINER_PART(RTS0)
CONTAINER_PART(ISG1)
CONTAINER_PART(OSG1)
CONTAINER_PART(PSG1)

#undef CONTAINER_PART
#endif // CONTAINER_PART

#ifdef SHADER_FEATURE_FLAG

// SHADER_FEATURE_FLAG(bit offset for the shader info flag, bit offset for DXIL module flag, name, description.

SHADER_FEATURE_FLAG(0,   2, Doubles, "Double-precision floating point")
SHADER_FEATURE_FLAG(1,  17, ComputeShadersPlusRawAndStructuredBuffers, "CS4 raw and structured buffers")
SHADER_FEATURE_FLAG(2,  16, UAVsAtEveryStage, "UAVs at every shader stage")
SHADER_FEATURE_FLAG(3,  15, Max64UAVs, "64 UAV slots")
SHADER_FEATURE_FLAG(4,  -1, MinimumPrecision, "Minimum-precision data types")
SHADER_FEATURE_FLAG(5,   6, DX11_1_DoubleExtensions, "Double-precision extensions for 11.1")
SHADER_FEATURE_FLAG(6,   7, DX11_1_ShaderExtensions, "Shader extensions for 11.1")
SHADER_FEATURE_FLAG(7,  14, LEVEL9ComparisonFiltering, "Comparison filtering for feature level 9")
SHADER_FEATURE_FLAG(8,  12, TiledResources, "Tiled resources")
SHADER_FEATURE_FLAG(9,  11, StencilRef, "PS Output Stencil Ref")
SHADER_FEATURE_FLAG(10, 10, InnerCoverage, "PS Inner Coverage")
SHADER_FEATURE_FLAG(11, 13, TypedUAVLoadAdditionalFormats, "Typed UAV Load Additional Formats")
SHADER_FEATURE_FLAG(12, 18, ROVs, "Raster Ordered UAVs")
SHADER_FEATURE_FLAG(13,  9, ViewportAndRTArrayIndexFromAnyShaderFeedingRasterizer, "SV_RenderTargetArrayIndex or SV_ViewportArrayIndex from any shader feeding rasterizer")
SHADER_FEATURE_FLAG(14, 19, WaveOps, "Wave level operations")
SHADER_FEATURE_FLAG(15, 20, Int64Ops, "64-Bit integer")
SHADER_FEATURE_FLAG(16, 21, ViewID, "View Instancing")
SHADER_FEATURE_FLAG(17, 22, Barycentrics, "Barycentrics")
SHADER_FEATURE_FLAG(18, -1, NativeLowPrecision, "Native low-precision data types")
SHADER_FEATURE_FLAG(19, 24, ShadingRate, "Shading Rate")
SHADER_FEATURE_FLAG(20, 25, Raytracing_Tier_1_1, "Raytracing tier 1.1 features")
SHADER_FEATURE_FLAG(21, 26, SamplerFeedback, "Sampler feedback")
SHADER_FEATURE_FLAG(22, 27, AtomicInt64OnTypedResource, "64-bit Atomics on Typed Resources")
SHADER_FEATURE_FLAG(23, 28, AtomicInt64OnGroupShared, "64-bit Atomics on Group Shared")
SHADER_FEATURE_FLAG(24, 29, DerivativesInMeshAndAmpShaders, "Derivatives in mesh and amplification shaders")
SHADER_FEATURE_FLAG(25, 30, ResourceDescriptorHeapIndexing, "Resource descriptor heap indexing")
SHADER_FEATURE_FLAG(26, 31, SamplerDescriptorHeapIndexing, "Sampler descriptor heap indexing")
SHADER_FEATURE_FLAG(27, 36, RESERVED, "<RESERVED>")
SHADER_FEATURE_FLAG(28, 32, AtomicInt64OnHeapResource, "64-bit Atomics on Heap Resources")
SHADER_FEATURE_FLAG(29, 34, AdvancedTextureOps, "Advanced Texture Ops")
SHADER_FEATURE_FLAG(30, 35, WriteableMSAATextures, "Writeable MSAA Textures")
SHADER_FEATURE_FLAG(31, 37, SampleCmpWithGradientOrBias, "SampleCmp with gradient or bias")
SHADER_FEATURE_FLAG(32, 38, ExtendedCommandInfo, "Extended command information")

SHADER_FEATURE_FLAG(33, 39, NextUnusedBit, "Next reserved shader flag bit (not a flag)")

#undef SHADER_FEATURE_FLAG
#endif // SHADER_FEATURE_FLAG

// Below is the definition of root signature enumerations and flags. The
// definitions of all values here correspond to their description in the
// d3d12.h header and are carried over from their values in DXC. For reference:
// https://learn.microsoft.com/en-us/windows/win32/api/d3d12/

// ROOT_SIGNATURE_FLAG(flag value, name).
#ifdef ROOT_SIGNATURE_FLAG

ROOT_SIGNATURE_FLAG(0, None)
ROOT_SIGNATURE_FLAG(0x1, AllowInputAssemblerInputLayout)
ROOT_SIGNATURE_FLAG(0x2, DenyVertexShaderRootAccess)
ROOT_SIGNATURE_FLAG(0x4, DenyHullShaderRootAccess)
ROOT_SIGNATURE_FLAG(0x8, DenyDomainShaderRootAccess)
ROOT_SIGNATURE_FLAG(0x10, DenyGeometryShaderRootAccess)
ROOT_SIGNATURE_FLAG(0x20, DenyPixelShaderRootAccess)
ROOT_SIGNATURE_FLAG(0x40, AllowStreamOutput)
ROOT_SIGNATURE_FLAG(0x80, LocalRootSignature)
ROOT_SIGNATURE_FLAG(0x100, DenyAmplificationShaderRootAccess)
ROOT_SIGNATURE_FLAG(0x200, DenyMeshShaderRootAccess)
ROOT_SIGNATURE_FLAG(0x400, CBVSRVUAVHeapDirectlyIndexed)
ROOT_SIGNATURE_FLAG(0x800, SamplerHeapDirectlyIndexed)

#undef ROOT_SIGNATURE_FLAG
#endif // ROOT_SIGNATURE_FLAG
 
// ROOT_DESCRIPTOR_FLAG(flag value, name, flag).
#ifdef ROOT_DESCRIPTOR_FLAG

ROOT_DESCRIPTOR_FLAG(0, None, NONE)
ROOT_DESCRIPTOR_FLAG(0x2, DataVolatile, DATA_VOLATILE)
ROOT_DESCRIPTOR_FLAG(0x4, DataStaticWhileSetAtExecute, DATA_STATIC_WHILE_SET_AT_EXECUTE)
ROOT_DESCRIPTOR_FLAG(0x8, DataStatic, DATA_STATIC)

#undef ROOT_DESCRIPTOR_FLAG
#endif // ROOT_DESCRIPTOR_FLAG

// DESCRIPTOR_RANGE_FLAG(flag value, name, flag).
#ifdef DESCRIPTOR_RANGE_FLAG

DESCRIPTOR_RANGE_FLAG(0, None, NONE)
DESCRIPTOR_RANGE_FLAG(0x1, DescriptorsVolatile, DESCRIPTORS_VOLATILE)
DESCRIPTOR_RANGE_FLAG(0x2, DataVolatile, DATA_VOLATILE)
DESCRIPTOR_RANGE_FLAG(0x4, DataStaticWhileSetAtExecute, DATA_STATIC_WHILE_SET_AT_EXECUTE)
DESCRIPTOR_RANGE_FLAG(0x8, DataStatic, DATA_STATIC)
DESCRIPTOR_RANGE_FLAG(0x10000, DescriptorsStaticKeepingBufferBoundsChecks, DESCRIPTORS_STATIC_KEEPING_BUFFER_BOUNDS_CHECKS)

#undef DESCRIPTOR_RANGE_FLAG
#endif // DESCRIPTOR_RANGE_FLAG

// STATIC_SAMPLER_FLAG(flag value, name, flag).
#ifdef STATIC_SAMPLER_FLAG

STATIC_SAMPLER_FLAG(0x0, None, SAMPLER_FLAG_NONE)
STATIC_SAMPLER_FLAG(0x1, UintBorderColor, SAMPLER_FLAG_UINT_BORDER_COLOR)
STATIC_SAMPLER_FLAG(0x2, NonNormalizedCoordinates, SAMPLER_FLAG_NON_NORMALIZED_COORDINATES)

#undef STATIC_SAMPLER_FLAG
#endif // STATIC_SAMPLER_FLAG

#ifdef ROOT_PARAMETER

ROOT_PARAMETER(0, DescriptorTable)
ROOT_PARAMETER(1, Constants32Bit)
ROOT_PARAMETER(2, CBV)
ROOT_PARAMETER(3, SRV)
ROOT_PARAMETER(4, UAV)
#undef ROOT_PARAMETER
#endif // ROOT_PARAMETER

// SHADER_VISIBILITY(value, enum).
#ifdef SHADER_VISIBILITY

SHADER_VISIBILITY(0, All)
SHADER_VISIBILITY(1, Vertex)
SHADER_VISIBILITY(2, Hull)
SHADER_VISIBILITY(3, Domain)
SHADER_VISIBILITY(4, Geometry)
SHADER_VISIBILITY(5, Pixel)
SHADER_VISIBILITY(6, Amplification)
SHADER_VISIBILITY(7, Mesh)

#undef SHADER_VISIBILITY
#endif // SHADER_VISIBILITY

// FILTER(value, enum).
#ifdef FILTER

FILTER(0, MinMagMipPoint)
FILTER(0x1, MinMagPointMipLinear)
FILTER(0x4, MinPointMagLinearMipPoint)
FILTER(0x5, MinPointMagMipLinear)
FILTER(0x10, MinLinearMagMipPoint)
FILTER(0x11, MinLinearMagPointMipLinear)
FILTER(0x14, MinMagLinearMipPoint)
FILTER(0x15, MinMagMipLinear)
FILTER(0x55, Anisotropic)
FILTER(0x80, ComparisonMinMagMipPoint)
FILTER(0x81, ComparisonMinMagPointMipLinear)
FILTER(0x84, ComparisonMinPointMagLinearMipPoint)
FILTER(0x85, ComparisonMinPointMagMipLinear)
FILTER(0x90, ComparisonMinLinearMagMipPoint)
FILTER(0x91, ComparisonMinLinearMagPointMipLinear)
FILTER(0x94, ComparisonMinMagLinearMipPoint)
FILTER(0x95, ComparisonMinMagMipLinear)
FILTER(0xd5, ComparisonAnisotropic)
FILTER(0x100, MinimumMinMagMipPoint)
FILTER(0x101, MinimumMinMagPointMipLinear)
FILTER(0x104, MinimumMinPointMagLinearMipPoint)
FILTER(0x105, MinimumMinPointMagMipLinear)
FILTER(0x110, MinimumMinLinearMagMipPoint)
FILTER(0x111, MinimumMinLinearMagPointMipLinear)
FILTER(0x114, MinimumMinMagLinearMipPoint)
FILTER(0x115, MinimumMinMagMipLinear)
FILTER(0x155, MinimumAnisotropic)
FILTER(0x180, MaximumMinMagMipPoint)
FILTER(0x181, MaximumMinMagPointMipLinear)
FILTER(0x184, MaximumMinPointMagLinearMipPoint)
FILTER(0x185, MaximumMinPointMagMipLinear)
FILTER(0x190, MaximumMinLinearMagMipPoint)
FILTER(0x191, MaximumMinLinearMagPointMipLinear)
FILTER(0x194, MaximumMinMagLinearMipPoint)
FILTER(0x195, MaximumMinMagMipLinear)
FILTER(0x1d5, MaximumAnisotropic)

#undef FILTER
#endif // FILTER

// TEXTURE_ADDRESS_MODE(value, enum).
#ifdef TEXTURE_ADDRESS_MODE

TEXTURE_ADDRESS_MODE(1,  Wrap)
TEXTURE_ADDRESS_MODE(2,  Mirror)
TEXTURE_ADDRESS_MODE(3,  Clamp)
TEXTURE_ADDRESS_MODE(4,  Border)
TEXTURE_ADDRESS_MODE(5,  MirrorOnce)

#undef TEXTURE_ADDRESS_MODE
#endif // TEXTURE_ADDRESS_MODE

// COMPARISON_FUNC(value, enum).
#ifdef COMPARISON_FUNC

COMPARISON_FUNC(1,  Never)
COMPARISON_FUNC(2,  Less)
COMPARISON_FUNC(3,  Equal)
COMPARISON_FUNC(4,  LessEqual)
COMPARISON_FUNC(5,  Greater)
COMPARISON_FUNC(6,  NotEqual)
COMPARISON_FUNC(7,  GreaterEqual)
COMPARISON_FUNC(8,  Always)

#undef COMPARISON_FUNC
#endif // COMPARISON_FUNC

// STATIC_BORDER_COLOR(value, enum).
#ifdef STATIC_BORDER_COLOR

STATIC_BORDER_COLOR(0,  TransparentBlack)
STATIC_BORDER_COLOR(1,  OpaqueBlack)
STATIC_BORDER_COLOR(2,  OpaqueWhite)
STATIC_BORDER_COLOR(3,  OpaqueBlackUint)
STATIC_BORDER_COLOR(4,  OpaqueWhiteUint)

#undef STATIC_BORDER_COLOR
#endif // STATIC_BORDER_COLOR

#ifdef DXIL_MODULE_FLAG

// Only save DXIL module flags which not map to feature flags here.
DXIL_MODULE_FLAG( 0,  DisableOptimizations,   "Disable shader optimizations")
DXIL_MODULE_FLAG( 1,  DisableMathRefactoring, "Disable math refactoring")
DXIL_MODULE_FLAG( 3,  ForceEarlyDepthStencil, "Force early depth-stencil test")
DXIL_MODULE_FLAG( 4,  EnableRawAndStructuredBuffers, "Raw and structured buffers")
DXIL_MODULE_FLAG( 5,  LowPrecisionPresent, "Low-precision data types present")
DXIL_MODULE_FLAG( 8,  AllResourcesBound, "All resources bound for the duration of shader execution")
DXIL_MODULE_FLAG(23,  NativeLowPrecisionMode, "Enable native low-precision data types")
DXIL_MODULE_FLAG(33,  ResMayNotAlias, "Any UAV may not alias any other UAV")

#undef DXIL_MODULE_FLAG
#endif // DXIL_MODULE_FLAG

#ifdef SEMANTIC_KIND

SEMANTIC_KIND(0, Arbitrary)
SEMANTIC_KIND(1, VertexID)
SEMANTIC_KIND(2, InstanceID)
SEMANTIC_KIND(3, Position)
SEMANTIC_KIND(4, RenderTargetArrayIndex)
SEMANTIC_KIND(5, ViewPortArrayIndex)
SEMANTIC_KIND(6, ClipDistance)
SEMANTIC_KIND(7, CullDistance)
SEMANTIC_KIND(8, OutputControlPointID)
SEMANTIC_KIND(9, DomainLocation)
SEMANTIC_KIND(10, PrimitiveID)
SEMANTIC_KIND(11, GSInstanceID)
SEMANTIC_KIND(12, SampleIndex)
SEMANTIC_KIND(13, IsFrontFace)
SEMANTIC_KIND(14, Coverage)
SEMANTIC_KIND(15, InnerCoverage)
SEMANTIC_KIND(16, Target)
SEMANTIC_KIND(17, Depth)
SEMANTIC_KIND(18, DepthLessEqual)
SEMANTIC_KIND(19, DepthGreaterEqual)
SEMANTIC_KIND(20, StencilRef)
SEMANTIC_KIND(21, DispatchThreadID)
SEMANTIC_KIND(22, GroupID)
SEMANTIC_KIND(23, GroupIndex)
SEMANTIC_KIND(24, GroupThreadID)
SEMANTIC_KIND(25, TessFactor)
SEMANTIC_KIND(26, InsideTessFactor)
SEMANTIC_KIND(27, ViewID)
SEMANTIC_KIND(28, Barycentrics)
SEMANTIC_KIND(29, ShadingRate)
SEMANTIC_KIND(30, CullPrimitive)
SEMANTIC_KIND(30, Invalid)

#undef SEMANTIC_KIND
#endif // SEMANTIC_KIND

#ifdef COMPONENT_TYPE

COMPONENT_TYPE(0, Unknown)
COMPONENT_TYPE(1, UInt32)
COMPONENT_TYPE(2, SInt32)
COMPONENT_TYPE(3, Float32)
COMPONENT_TYPE(4, UInt16)
COMPONENT_TYPE(5, SInt16)
COMPONENT_TYPE(6, Float16)
COMPONENT_TYPE(7, UInt64)
COMPONENT_TYPE(8, SInt64)
COMPONENT_TYPE(9, Float64)

#undef COMPONENT_TYPE
#endif // COMPONENT_TYPE

#ifdef COMPONENT_PRECISION

COMPONENT_PRECISION(0, Default)
COMPONENT_PRECISION(1, Float16)
COMPONENT_PRECISION(2, Float2_8)
COMPONENT_PRECISION(3, Reserved)
COMPONENT_PRECISION(4, SInt16)
COMPONENT_PRECISION(5, UInt16)
COMPONENT_PRECISION(0xf0, Any16)
COMPONENT_PRECISION(0xf1, Any10)

#undef COMPONENT_PRECISION
#endif // COMPONENT_PRECISION

#ifdef INTERPOLATION_MODE

INTERPOLATION_MODE(0, Undefined)
INTERPOLATION_MODE(1, Constant)
INTERPOLATION_MODE(2, Linear)
INTERPOLATION_MODE(3, LinearCentroid)
INTERPOLATION_MODE(4, LinearNoperspective)
INTERPOLATION_MODE(5, LinearNoperspectiveCentroid)
INTERPOLATION_MODE(6, LinearSample)
INTERPOLATION_MODE(7, LinearNoperspectiveSample)
INTERPOLATION_MODE(8, Invalid)

#undef INTERPOLATION_MODE
#endif // INTERPOLATION_MODE

#ifdef RESOURCE_TYPE
RESOURCE_TYPE(0, Invalid)
RESOURCE_TYPE(1, Sampler)
RESOURCE_TYPE(2, CBV)
RESOURCE_TYPE(3, SRVTyped)
RESOURCE_TYPE(4, SRVRaw)
RESOURCE_TYPE(5, SRVStructured)
RESOURCE_TYPE(6, UAVTyped)
RESOURCE_TYPE(7, UAVRaw)
RESOURCE_TYPE(8, UAVStructured)
RESOURCE_TYPE(9, UAVStructuredWithCounter)

#undef RESOURCE_TYPE
#endif // RESOURCE_TYPE

#ifdef RESOURCE_KIND
RESOURCE_KIND(0, Invalid)
RESOURCE_KIND(1, Texture1D)
RESOURCE_KIND(2, Texture2D)
RESOURCE_KIND(3, Texture2DMS)
RESOURCE_KIND(4, Texture3D)
RESOURCE_KIND(5, TextureCube)
RESOURCE_KIND(6, Texture1DArray)
RESOURCE_KIND(7, Texture2DArray)
RESOURCE_KIND(8, Texture2DMSArray)
RESOURCE_KIND(9, TextureCubeArray)
RESOURCE_KIND(10, TypedBuffer)
RESOURCE_KIND(11, RawBuffer)
RESOURCE_KIND(12, StructuredBuffer)
RESOURCE_KIND(13, CBuffer)
RESOURCE_KIND(14, Sampler)
RESOURCE_KIND(15, TBuffer)
RESOURCE_KIND(16, RTAccelerationStructure)
RESOURCE_KIND(17, FeedbackTexture2D)
RESOURCE_KIND(18, FeedbackTexture2DArray)

#undef RESOURCE_KIND
#endif // RESOURCE_KIND

#ifdef RESOURCE_FLAG
RESOURCE_FLAG(0, UsedByAtomic64)

#undef RESOURCE_FLAG
#endif // RESOURCE_FLAG

#ifdef D3D_SYSTEM_VALUE

D3D_SYSTEM_VALUE(0, Undefined)
D3D_SYSTEM_VALUE(1, Position)
D3D_SYSTEM_VALUE(2, ClipDistance)
D3D_SYSTEM_VALUE(3, CullDistance)
D3D_SYSTEM_VALUE(4, RenderTargetArrayIndex)
D3D_SYSTEM_VALUE(5, ViewPortArrayIndex)
D3D_SYSTEM_VALUE(6, VertexID)
D3D_SYSTEM_VALUE(7, PrimitiveID)
D3D_SYSTEM_VALUE(8, InstanceID)
D3D_SYSTEM_VALUE(9, IsFrontFace)
D3D_SYSTEM_VALUE(10, SampleIndex)
D3D_SYSTEM_VALUE(11, FinalQuadEdgeTessfactor)
D3D_SYSTEM_VALUE(12, FinalQuadInsideTessfactor)
D3D_SYSTEM_VALUE(13, FinalTriEdgeTessfactor)
D3D_SYSTEM_VALUE(14, FinalTriInsideTessfactor)
D3D_SYSTEM_VALUE(15, FinalLineDetailTessfactor)
D3D_SYSTEM_VALUE(16, FinalLineDensityTessfactor)
D3D_SYSTEM_VALUE(23, Barycentrics)
D3D_SYSTEM_VALUE(24, ShadingRate)
D3D_SYSTEM_VALUE(25, CullPrimitive)
D3D_SYSTEM_VALUE(64, Target)
D3D_SYSTEM_VALUE(65, Depth)
D3D_SYSTEM_VALUE(66, Coverage)
D3D_SYSTEM_VALUE(67, DepthGE)
D3D_SYSTEM_VALUE(68, DepthLE)
D3D_SYSTEM_VALUE(69, StencilRef)
D3D_SYSTEM_VALUE(70, InnerCoverage)

#undef D3D_SYSTEM_VALUE

#endif // D3D_SYSTEM_VALUE
