aboutsummaryrefslogtreecommitdiff
path: root/contrib/DirectX-Headers-1.618.2/include/directx/d3dx12_check_feature_support.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/DirectX-Headers-1.618.2/include/directx/d3dx12_check_feature_support.h')
-rw-r--r--contrib/DirectX-Headers-1.618.2/include/directx/d3dx12_check_feature_support.h1162
1 files changed, 1162 insertions, 0 deletions
diff --git a/contrib/DirectX-Headers-1.618.2/include/directx/d3dx12_check_feature_support.h b/contrib/DirectX-Headers-1.618.2/include/directx/d3dx12_check_feature_support.h
new file mode 100644
index 0000000..725fb7f
--- /dev/null
+++ b/contrib/DirectX-Headers-1.618.2/include/directx/d3dx12_check_feature_support.h
@@ -0,0 +1,1162 @@
1//*********************************************************
2//
3// Copyright (c) Microsoft Corporation.
4// Licensed under the MIT License (MIT).
5//
6//*********************************************************
7
8#pragma once
9
10#ifndef __cplusplus
11#error D3DX12 requires C++
12#endif
13
14#include "d3d12.h"
15
16//================================================================================================
17// D3DX12 Check Feature Support
18//================================================================================================
19
20#include <vector>
21
22class CD3DX12FeatureSupport
23{
24public: // Function declaration
25 // Default constructor that creates an empty object
26 CD3DX12FeatureSupport() noexcept;
27
28 // Initialize data from the given device
29 HRESULT Init(ID3D12Device* pDevice);
30
31 // Retreives the status of the object. If an error occurred in the initialization process, the function returns the error code.
32 HRESULT GetStatus() const noexcept { return m_hStatus; }
33
34 // Getter functions for each feature class
35 // D3D12_OPTIONS
36 BOOL DoublePrecisionFloatShaderOps() const noexcept;
37 BOOL OutputMergerLogicOp() const noexcept;
38 D3D12_SHADER_MIN_PRECISION_SUPPORT MinPrecisionSupport() const noexcept;
39 D3D12_TILED_RESOURCES_TIER TiledResourcesTier() const noexcept;
40 D3D12_RESOURCE_BINDING_TIER ResourceBindingTier() const noexcept;
41 BOOL PSSpecifiedStencilRefSupported() const noexcept;
42 BOOL TypedUAVLoadAdditionalFormats() const noexcept;
43 BOOL ROVsSupported() const noexcept;
44 D3D12_CONSERVATIVE_RASTERIZATION_TIER ConservativeRasterizationTier() const noexcept;
45 BOOL StandardSwizzle64KBSupported() const noexcept;
46 BOOL CrossAdapterRowMajorTextureSupported() const noexcept;
47 BOOL VPAndRTArrayIndexFromAnyShaderFeedingRasterizerSupportedWithoutGSEmulation() const noexcept;
48 D3D12_RESOURCE_HEAP_TIER ResourceHeapTier() const noexcept;
49 D3D12_CROSS_NODE_SHARING_TIER CrossNodeSharingTier() const noexcept;
50 UINT MaxGPUVirtualAddressBitsPerResource() const noexcept;
51
52 // FEATURE_LEVELS
53 D3D_FEATURE_LEVEL MaxSupportedFeatureLevel() const noexcept;
54
55 // FORMAT_SUPPORT
56 HRESULT FormatSupport(DXGI_FORMAT Format, D3D12_FORMAT_SUPPORT1& Support1, D3D12_FORMAT_SUPPORT2& Support2) const;
57
58 // MUTLTISAMPLE_QUALITY_LEVELS
59 HRESULT MultisampleQualityLevels(DXGI_FORMAT Format, UINT SampleCount, D3D12_MULTISAMPLE_QUALITY_LEVEL_FLAGS Flags, UINT& NumQualityLevels) const;
60
61 // FORMAT_INFO
62 HRESULT FormatInfo(DXGI_FORMAT Format, UINT8& PlaneCount) const;
63
64 // GPU_VIRTUAL_ADDRESS_SUPPORT
65 UINT MaxGPUVirtualAddressBitsPerProcess() const noexcept;
66
67 // SHADER_MODEL
68 D3D_SHADER_MODEL HighestShaderModel() const noexcept;
69
70 // D3D12_OPTIONS1
71 BOOL WaveOps() const noexcept;
72 UINT WaveLaneCountMin() const noexcept;
73 UINT WaveLaneCountMax() const noexcept;
74 UINT TotalLaneCount() const noexcept;
75 BOOL ExpandedComputeResourceStates() const noexcept;
76 BOOL Int64ShaderOps() const noexcept;
77
78 // PROTECTED_RESOURCE_SESSION_SUPPORT
79 D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAGS ProtectedResourceSessionSupport(UINT NodeIndex = 0) const;
80
81 // ROOT_SIGNATURE
82 D3D_ROOT_SIGNATURE_VERSION HighestRootSignatureVersion() const noexcept;
83
84 // ARCHITECTURE1
85 BOOL TileBasedRenderer(UINT NodeIndex = 0) const;
86 BOOL UMA(UINT NodeIndex = 0) const;
87 BOOL CacheCoherentUMA(UINT NodeIndex = 0) const;
88 BOOL IsolatedMMU(UINT NodeIndex = 0) const;
89
90 // D3D12_OPTIONS2
91 BOOL DepthBoundsTestSupported() const noexcept;
92 D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER ProgrammableSamplePositionsTier() const noexcept;
93
94 // SHADER_CACHE
95 D3D12_SHADER_CACHE_SUPPORT_FLAGS ShaderCacheSupportFlags() const noexcept;
96
97 // COMMAND_QUEUE_PRIORITY
98 BOOL CommandQueuePrioritySupported(D3D12_COMMAND_LIST_TYPE CommandListType, UINT Priority);
99
100 // D3D12_OPTIONS3
101 BOOL CopyQueueTimestampQueriesSupported() const noexcept;
102 BOOL CastingFullyTypedFormatSupported() const noexcept;
103 D3D12_COMMAND_LIST_SUPPORT_FLAGS WriteBufferImmediateSupportFlags() const noexcept;
104 D3D12_VIEW_INSTANCING_TIER ViewInstancingTier() const noexcept;
105 BOOL BarycentricsSupported() const noexcept;
106
107 // EXISTING_HEAPS
108 BOOL ExistingHeapsSupported() const noexcept;
109
110 // D3D12_OPTIONS4
111 BOOL MSAA64KBAlignedTextureSupported() const noexcept;
112 D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER SharedResourceCompatibilityTier() const noexcept;
113 BOOL Native16BitShaderOpsSupported() const noexcept;
114
115 // SERIALIZATION
116 D3D12_HEAP_SERIALIZATION_TIER HeapSerializationTier(UINT NodeIndex = 0) const;
117
118 // CROSS_NODE
119 // CrossNodeSharingTier handled in D3D12Options
120 BOOL CrossNodeAtomicShaderInstructions() const noexcept;
121
122 // D3D12_OPTIONS5
123 BOOL SRVOnlyTiledResourceTier3() const noexcept;
124 D3D12_RENDER_PASS_TIER RenderPassesTier() const noexcept;
125 D3D12_RAYTRACING_TIER RaytracingTier() const noexcept;
126
127#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 4)
128 // DISPLAYABLE
129 BOOL DisplayableTexture() const noexcept;
130 // SharedResourceCompatibilityTier handled in D3D12Options4
131#endif
132
133 // D3D12_OPTIONS6
134 BOOL AdditionalShadingRatesSupported() const noexcept;
135 BOOL PerPrimitiveShadingRateSupportedWithViewportIndexing() const noexcept;
136 D3D12_VARIABLE_SHADING_RATE_TIER VariableShadingRateTier() const noexcept;
137 UINT ShadingRateImageTileSize() const noexcept;
138 BOOL BackgroundProcessingSupported() const noexcept;
139
140 // QUERY_META_COMMAND
141 HRESULT QueryMetaCommand(D3D12_FEATURE_DATA_QUERY_META_COMMAND& dQueryMetaCommand) const;
142
143 // D3D12_OPTIONS7
144 D3D12_MESH_SHADER_TIER MeshShaderTier() const noexcept;
145 D3D12_SAMPLER_FEEDBACK_TIER SamplerFeedbackTier() const noexcept;
146
147 // PROTECTED_RESOURCE_SESSION_TYPE_COUNT
148 UINT ProtectedResourceSessionTypeCount(UINT NodeIndex = 0) const;
149
150 // PROTECTED_RESOURCE_SESSION_TYPES
151 std::vector<GUID> ProtectedResourceSessionTypes(UINT NodeIndex = 0) const;
152
153#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 3)
154 // D3D12_OPTIONS8
155 BOOL UnalignedBlockTexturesSupported() const noexcept;
156
157 // D3D12_OPTIONS9
158 BOOL MeshShaderPipelineStatsSupported() const noexcept;
159 BOOL MeshShaderSupportsFullRangeRenderTargetArrayIndex() const noexcept;
160 BOOL AtomicInt64OnTypedResourceSupported() const noexcept;
161 BOOL AtomicInt64OnGroupSharedSupported() const noexcept;
162 BOOL DerivativesInMeshAndAmplificationShadersSupported() const noexcept;
163 D3D12_WAVE_MMA_TIER WaveMMATier() const noexcept;
164#endif
165
166#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 4)
167 // D3D12_OPTIONS10
168 BOOL VariableRateShadingSumCombinerSupported() const noexcept;
169 BOOL MeshShaderPerPrimitiveShadingRateSupported() const noexcept;
170
171 // D3D12_OPTIONS11
172 BOOL AtomicInt64OnDescriptorHeapResourceSupported() const noexcept;
173#endif
174
175#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 600)
176 // D3D12_OPTIONS12
177 D3D12_TRI_STATE MSPrimitivesPipelineStatisticIncludesCulledPrimitives() const noexcept;
178 BOOL EnhancedBarriersSupported() const noexcept;
179 BOOL RelaxedFormatCastingSupported() const noexcept;
180#endif
181
182#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 602)
183 // D3D12_OPTIONS13
184 BOOL UnrestrictedBufferTextureCopyPitchSupported() const noexcept;
185 BOOL UnrestrictedVertexElementAlignmentSupported() const noexcept;
186 BOOL InvertedViewportHeightFlipsYSupported() const noexcept;
187 BOOL InvertedViewportDepthFlipsZSupported() const noexcept;
188 BOOL TextureCopyBetweenDimensionsSupported() const noexcept;
189 BOOL AlphaBlendFactorSupported() const noexcept;
190#endif
191
192#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 606)
193 // D3D12_OPTIONS14
194 BOOL AdvancedTextureOpsSupported() const noexcept;
195 BOOL WriteableMSAATexturesSupported() const noexcept;
196 BOOL IndependentFrontAndBackStencilRefMaskSupported() const noexcept;
197
198 // D3D12_OPTIONS15
199 BOOL TriangleFanSupported() const noexcept;
200 BOOL DynamicIndexBufferStripCutSupported() const noexcept;
201#endif
202
203#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 608)
204 // D3D12_OPTIONS16
205 BOOL DynamicDepthBiasSupported() const noexcept;
206#endif
207#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 609)
208 BOOL GPUUploadHeapSupported() const noexcept;
209
210 // D3D12_OPTIONS17
211 BOOL NonNormalizedCoordinateSamplersSupported() const noexcept;
212 BOOL ManualWriteTrackingResourceSupported() const noexcept;
213
214 // D3D12_OPTIONS18
215 BOOL RenderPassesValid() const noexcept;
216#endif
217
218#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 610)
219 BOOL MismatchingOutputDimensionsSupported() const noexcept;
220 UINT SupportedSampleCountsWithNoOutputs() const noexcept;
221 BOOL PointSamplingAddressesNeverRoundUp() const noexcept;
222 BOOL RasterizerDesc2Supported() const noexcept;
223 BOOL NarrowQuadrilateralLinesSupported() const noexcept;
224 BOOL AnisoFilterWithPointMipSupported() const noexcept;
225 UINT MaxSamplerDescriptorHeapSize() const noexcept;
226 UINT MaxSamplerDescriptorHeapSizeWithStaticSamplers() const noexcept;
227 UINT MaxViewDescriptorHeapSize() const noexcept;
228#endif
229
230#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 611)
231 BOOL ComputeOnlyWriteWatchSupported() const noexcept;
232#endif
233
234#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 612)
235 D3D12_EXECUTE_INDIRECT_TIER ExecuteIndirectTier() const noexcept;
236 D3D12_WORK_GRAPHS_TIER WorkGraphsTier() const noexcept;
237#endif
238
239#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 617)
240 D3D12_TIGHT_ALIGNMENT_TIER TightAlignmentSupportTier() const noexcept;
241#endif
242
243private: // Private structs and helpers declaration
244 struct ProtectedResourceSessionTypesLocal : D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_TYPES
245 {
246 std::vector<GUID> TypeVec;
247 };
248
249 // Helper function to decide the highest shader model supported by the system
250 // Stores the result in m_dShaderModel
251 // Must be updated whenever a new shader model is added to the d3d12.h header
252 HRESULT QueryHighestShaderModel();
253
254 // Helper function to decide the highest root signature supported
255 // Must be updated whenever a new root signature version is added to the d3d12.h header
256 HRESULT QueryHighestRootSignatureVersion();
257
258 // Helper funcion to decide the highest feature level
259 HRESULT QueryHighestFeatureLevel();
260
261 // Helper function to initialize local protected resource session types structs
262 HRESULT QueryProtectedResourceSessionTypes(UINT NodeIndex, UINT Count);
263
264private: // Member data
265 // Pointer to the underlying device
266 ID3D12Device* m_pDevice;
267
268 // Stores the error code from initialization
269 HRESULT m_hStatus;
270
271 // Feature support data structs
272 D3D12_FEATURE_DATA_D3D12_OPTIONS m_dOptions;
273 D3D_FEATURE_LEVEL m_eMaxFeatureLevel;
274 D3D12_FEATURE_DATA_GPU_VIRTUAL_ADDRESS_SUPPORT m_dGPUVASupport;
275 D3D12_FEATURE_DATA_SHADER_MODEL m_dShaderModel;
276 D3D12_FEATURE_DATA_D3D12_OPTIONS1 m_dOptions1;
277 std::vector<D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_SUPPORT> m_dProtectedResourceSessionSupport;
278 D3D12_FEATURE_DATA_ROOT_SIGNATURE m_dRootSignature;
279 std::vector<D3D12_FEATURE_DATA_ARCHITECTURE1> m_dArchitecture1;
280 D3D12_FEATURE_DATA_D3D12_OPTIONS2 m_dOptions2;
281 D3D12_FEATURE_DATA_SHADER_CACHE m_dShaderCache;
282 D3D12_FEATURE_DATA_COMMAND_QUEUE_PRIORITY m_dCommandQueuePriority;
283 D3D12_FEATURE_DATA_D3D12_OPTIONS3 m_dOptions3;
284 D3D12_FEATURE_DATA_EXISTING_HEAPS m_dExistingHeaps;
285 D3D12_FEATURE_DATA_D3D12_OPTIONS4 m_dOptions4;
286 std::vector<D3D12_FEATURE_DATA_SERIALIZATION> m_dSerialization; // Cat2 NodeIndex
287 D3D12_FEATURE_DATA_CROSS_NODE m_dCrossNode;
288 D3D12_FEATURE_DATA_D3D12_OPTIONS5 m_dOptions5;
289#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 4)
290 D3D12_FEATURE_DATA_DISPLAYABLE m_dDisplayable;
291#endif
292 D3D12_FEATURE_DATA_D3D12_OPTIONS6 m_dOptions6;
293 D3D12_FEATURE_DATA_D3D12_OPTIONS7 m_dOptions7;
294 std::vector<D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_TYPE_COUNT> m_dProtectedResourceSessionTypeCount; // Cat2 NodeIndex
295 std::vector<ProtectedResourceSessionTypesLocal> m_dProtectedResourceSessionTypes; // Cat3
296#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 3)
297 D3D12_FEATURE_DATA_D3D12_OPTIONS8 m_dOptions8;
298 D3D12_FEATURE_DATA_D3D12_OPTIONS9 m_dOptions9;
299#endif
300#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 4)
301 D3D12_FEATURE_DATA_D3D12_OPTIONS10 m_dOptions10;
302 D3D12_FEATURE_DATA_D3D12_OPTIONS11 m_dOptions11;
303#endif
304#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 600)
305 D3D12_FEATURE_DATA_D3D12_OPTIONS12 m_dOptions12;
306#endif
307#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 602)
308 D3D12_FEATURE_DATA_D3D12_OPTIONS13 m_dOptions13;
309#endif
310#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 606)
311 D3D12_FEATURE_DATA_D3D12_OPTIONS14 m_dOptions14;
312 D3D12_FEATURE_DATA_D3D12_OPTIONS15 m_dOptions15;
313#endif
314#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 608)
315 D3D12_FEATURE_DATA_D3D12_OPTIONS16 m_dOptions16;
316#endif
317#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 609)
318 D3D12_FEATURE_DATA_D3D12_OPTIONS17 m_dOptions17;
319#endif
320#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 609)
321 D3D12_FEATURE_DATA_D3D12_OPTIONS18 m_dOptions18;
322#endif
323#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 610)
324 D3D12_FEATURE_DATA_D3D12_OPTIONS19 m_dOptions19;
325#endif
326#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 611)
327 D3D12_FEATURE_DATA_D3D12_OPTIONS20 m_dOptions20;
328#endif
329#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 612)
330 D3D12_FEATURE_DATA_D3D12_OPTIONS21 m_dOptions21;
331#endif
332#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 617)
333 D3D12_FEATURE_DATA_TIGHT_ALIGNMENT m_dTightAlignment;
334#endif
335};
336
337// Implementations for CD3DX12FeatureSupport functions
338
339// Macro to set up a getter function for each entry in feature support data
340// The getter function will have the same name as the feature option name
341#define FEATURE_SUPPORT_GET(RETTYPE,FEATURE,OPTION) \
342inline RETTYPE CD3DX12FeatureSupport::OPTION() const noexcept \
343{ \
344 return FEATURE.OPTION; \
345}
346
347// Macro to set up a getter function for each entry in feature support data
348// Also specifies the name for the function which can be different from the feature name
349#define FEATURE_SUPPORT_GET_NAME(RETTYPE,FEATURE,OPTION,NAME) \
350inline RETTYPE CD3DX12FeatureSupport::NAME() const noexcept \
351{\
352 return FEATURE.OPTION; \
353}
354
355// Macro to set up a getter function for feature data indexed by the graphics node ID
356// The default parameter is 0, or the first availabe graphics device node
357#define FEATURE_SUPPORT_GET_NODE_INDEXED(RETTYPE,FEATURE,OPTION) \
358inline RETTYPE CD3DX12FeatureSupport::OPTION(UINT NodeIndex) const \
359{\
360 return FEATURE[NodeIndex].OPTION; \
361}
362
363// Macro to set up a getter function for feature data indexed by NodeIndex
364// Allows a custom name for the getter function
365#define FEATURE_SUPPORT_GET_NODE_INDEXED_NAME(RETTYPE,FEATURE,OPTION,NAME) \
366inline RETTYPE CD3DX12FeatureSupport::NAME(UINT NodeIndex) const \
367{\
368 return FEATURE[NodeIndex].OPTION; \
369}
370
371inline CD3DX12FeatureSupport::CD3DX12FeatureSupport() noexcept
372: m_pDevice(nullptr)
373, m_hStatus(E_INVALIDARG)
374, m_dOptions{}
375, m_eMaxFeatureLevel{}
376, m_dGPUVASupport{}
377, m_dShaderModel{}
378, m_dOptions1{}
379, m_dRootSignature{}
380, m_dOptions2{}
381, m_dShaderCache{}
382, m_dCommandQueuePriority{}
383, m_dOptions3{}
384, m_dExistingHeaps{}
385, m_dOptions4{}
386, m_dCrossNode{}
387, m_dOptions5{}
388#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 4)
389, m_dDisplayable{}
390#endif
391, m_dOptions6{}
392, m_dOptions7{}
393#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 3)
394, m_dOptions8{}
395, m_dOptions9{}
396#endif
397#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 4)
398, m_dOptions10{}
399, m_dOptions11{}
400#endif
401#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 600)
402, m_dOptions12{}
403#endif
404#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 602)
405, m_dOptions13{}
406#endif
407#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 606)
408, m_dOptions14{}
409, m_dOptions15{}
410#endif
411#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 608)
412, m_dOptions16{}
413#endif
414#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 609)
415, m_dOptions17{}
416#endif
417#if defined (D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 609)
418, m_dOptions18{}
419#endif
420#if defined (D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 610)
421, m_dOptions19{}
422#endif
423#if defined (D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 611)
424, m_dOptions20{}
425#endif
426#if defined (D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 612)
427, m_dOptions21{}
428#endif
429#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 617)
430, m_dTightAlignment{}
431#endif
432{}
433
434inline HRESULT CD3DX12FeatureSupport::Init(ID3D12Device* pDevice)
435{
436 if (!pDevice)
437 {
438 m_hStatus = E_INVALIDARG;
439 return m_hStatus;
440 }
441
442 m_pDevice = pDevice;
443
444 // Initialize static feature support data structures
445 if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS, &m_dOptions, sizeof(m_dOptions))))
446 {
447 m_dOptions = {};
448 }
449
450 if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_GPU_VIRTUAL_ADDRESS_SUPPORT, &m_dGPUVASupport, sizeof(m_dGPUVASupport))))
451 {
452 m_dGPUVASupport = {};
453 }
454
455 if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS1, &m_dOptions1, sizeof(m_dOptions1))))
456 {
457 m_dOptions1 = {};
458 }
459
460 if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS2, &m_dOptions2, sizeof(m_dOptions2))))
461 {
462 m_dOptions2 = {};
463 }
464
465 if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_SHADER_CACHE, &m_dShaderCache, sizeof(m_dShaderCache))))
466 {
467 m_dShaderCache = {};
468 }
469
470 if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS3, &m_dOptions3, sizeof(m_dOptions3))))
471 {
472 m_dOptions3 = {};
473 }
474
475 if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_EXISTING_HEAPS, &m_dExistingHeaps, sizeof(m_dExistingHeaps))))
476 {
477 m_dExistingHeaps = {};
478 }
479
480 if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS4, &m_dOptions4, sizeof(m_dOptions4))))
481 {
482 m_dOptions4 = {};
483 }
484
485 if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_CROSS_NODE, &m_dCrossNode, sizeof(m_dCrossNode))))
486 {
487 m_dCrossNode = {};
488 }
489
490 if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS5, &m_dOptions5, sizeof(m_dOptions5))))
491 {
492 m_dOptions5 = {};
493 }
494
495#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 4)
496 if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_DISPLAYABLE, &m_dDisplayable, sizeof(m_dDisplayable))))
497 {
498 m_dDisplayable = {};
499 }
500#endif
501
502 if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS6, &m_dOptions6, sizeof(m_dOptions6))))
503 {
504 m_dOptions6 = {};
505 }
506
507 if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS7, &m_dOptions7, sizeof(m_dOptions7))))
508 {
509 m_dOptions7 = {};
510 }
511
512#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 3)
513 if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS8, &m_dOptions8, sizeof(m_dOptions8))))
514 {
515 m_dOptions8 = {};
516 }
517
518 if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS9, &m_dOptions9, sizeof(m_dOptions9))))
519 {
520 m_dOptions9 = {};
521 }
522#endif
523
524#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 4)
525 if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS10, &m_dOptions10, sizeof(m_dOptions10))))
526 {
527 m_dOptions10 = {};
528 }
529
530 if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS11, &m_dOptions11, sizeof(m_dOptions11))))
531 {
532 m_dOptions11 = {};
533 }
534#endif
535
536#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 600)
537 if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS12, &m_dOptions12, sizeof(m_dOptions12))))
538 {
539 m_dOptions12 = {};
540 m_dOptions12.MSPrimitivesPipelineStatisticIncludesCulledPrimitives = D3D12_TRI_STATE::D3D12_TRI_STATE_UNKNOWN;
541 }
542#endif
543
544#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 602)
545 if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS13, &m_dOptions13, sizeof(m_dOptions13))))
546 {
547 m_dOptions13 = {};
548 }
549#endif
550
551#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 606)
552 if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS14, &m_dOptions14, sizeof(m_dOptions14))))
553 {
554 m_dOptions14 = {};
555 }
556
557 if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS15, &m_dOptions15, sizeof(m_dOptions15))))
558 {
559 m_dOptions15 = {};
560 }
561#endif
562
563#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 608)
564 if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS16, &m_dOptions16, sizeof(m_dOptions16))))
565 {
566 m_dOptions16 = {};
567 }
568#endif
569
570#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 609)
571 if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS17, &m_dOptions17, sizeof(m_dOptions17))))
572 {
573 m_dOptions17 = {};
574 }
575
576 if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS18, &m_dOptions18, sizeof(m_dOptions18))))
577 {
578 m_dOptions18.RenderPassesValid = false;
579 }
580#endif
581
582#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 610)
583 if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS19, &m_dOptions19, sizeof(m_dOptions19))))
584 {
585 m_dOptions19 = {};
586 m_dOptions19.SupportedSampleCountsWithNoOutputs = 1;
587 m_dOptions19.MaxSamplerDescriptorHeapSize = D3D12_MAX_SHADER_VISIBLE_SAMPLER_HEAP_SIZE;
588 m_dOptions19.MaxSamplerDescriptorHeapSizeWithStaticSamplers = D3D12_MAX_SHADER_VISIBLE_SAMPLER_HEAP_SIZE;
589 m_dOptions19.MaxViewDescriptorHeapSize = D3D12_MAX_SHADER_VISIBLE_DESCRIPTOR_HEAP_SIZE_TIER_1;
590 }
591#endif
592
593#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 611)
594 if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS20, &m_dOptions20, sizeof(m_dOptions20))))
595 {
596 m_dOptions20 = {};
597 }
598#endif
599
600#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 612)
601 if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS21, &m_dOptions21, sizeof(m_dOptions21))))
602 {
603 m_dOptions21 = {};
604 }
605#endif
606
607#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 617)
608 if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_TIGHT_ALIGNMENT, &m_dTightAlignment, sizeof(m_dTightAlignment))))
609 {
610 m_dTightAlignment = {};
611 }
612#endif
613
614 // Initialize per-node feature support data structures
615 const UINT uNodeCount = m_pDevice->GetNodeCount();
616 m_dProtectedResourceSessionSupport.resize(uNodeCount);
617 m_dArchitecture1.resize(uNodeCount);
618 m_dSerialization.resize(uNodeCount);
619 m_dProtectedResourceSessionTypeCount.resize(uNodeCount);
620 m_dProtectedResourceSessionTypes.resize(uNodeCount);
621 for (UINT NodeIndex = 0; NodeIndex < uNodeCount; NodeIndex++)
622 {
623 m_dProtectedResourceSessionSupport[NodeIndex].NodeIndex = NodeIndex;
624 if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_PROTECTED_RESOURCE_SESSION_SUPPORT, &m_dProtectedResourceSessionSupport[NodeIndex], sizeof(m_dProtectedResourceSessionSupport[NodeIndex]))))
625 {
626 m_dProtectedResourceSessionSupport[NodeIndex].Support = D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAG_NONE;
627 }
628
629 m_dArchitecture1[NodeIndex].NodeIndex = NodeIndex;
630 if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_ARCHITECTURE1, &m_dArchitecture1[NodeIndex], sizeof(m_dArchitecture1[NodeIndex]))))
631 {
632 D3D12_FEATURE_DATA_ARCHITECTURE dArchLocal = {};
633 dArchLocal.NodeIndex = NodeIndex;
634 if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_ARCHITECTURE, &dArchLocal, sizeof(dArchLocal))))
635 {
636 dArchLocal.TileBasedRenderer = false;
637 dArchLocal.UMA = false;
638 dArchLocal.CacheCoherentUMA = false;
639 }
640
641 m_dArchitecture1[NodeIndex].TileBasedRenderer = dArchLocal.TileBasedRenderer;
642 m_dArchitecture1[NodeIndex].UMA = dArchLocal.UMA;
643 m_dArchitecture1[NodeIndex].CacheCoherentUMA = dArchLocal.CacheCoherentUMA;
644 m_dArchitecture1[NodeIndex].IsolatedMMU = false;
645 }
646
647 m_dSerialization[NodeIndex].NodeIndex = NodeIndex;
648 if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_SERIALIZATION, &m_dSerialization[NodeIndex], sizeof(m_dSerialization[NodeIndex]))))
649 {
650 m_dSerialization[NodeIndex].HeapSerializationTier = D3D12_HEAP_SERIALIZATION_TIER_0;
651 }
652
653 m_dProtectedResourceSessionTypeCount[NodeIndex].NodeIndex = NodeIndex;
654 if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_PROTECTED_RESOURCE_SESSION_TYPE_COUNT, &m_dProtectedResourceSessionTypeCount[NodeIndex], sizeof(m_dProtectedResourceSessionTypeCount[NodeIndex]))))
655 {
656 m_dProtectedResourceSessionTypeCount[NodeIndex].Count = 0;
657 }
658
659 // Special procedure to initialize local protected resource session types structs
660 // Must wait until session type count initialized
661 QueryProtectedResourceSessionTypes(NodeIndex, m_dProtectedResourceSessionTypeCount[NodeIndex].Count);
662 }
663
664 // Initialize features that requires highest version check
665 if (FAILED(m_hStatus = QueryHighestShaderModel()))
666 {
667 return m_hStatus;
668 }
669
670 if (FAILED(m_hStatus = QueryHighestRootSignatureVersion()))
671 {
672 return m_hStatus;
673 }
674
675 // Initialize Feature Levels data
676 if (FAILED(m_hStatus = QueryHighestFeatureLevel()))
677 {
678 return m_hStatus;
679 }
680
681 return m_hStatus;
682}
683
684// 0: D3D12_OPTIONS
685FEATURE_SUPPORT_GET(BOOL, m_dOptions, DoublePrecisionFloatShaderOps);
686FEATURE_SUPPORT_GET(BOOL, m_dOptions, OutputMergerLogicOp);
687FEATURE_SUPPORT_GET(D3D12_SHADER_MIN_PRECISION_SUPPORT, m_dOptions, MinPrecisionSupport);
688FEATURE_SUPPORT_GET(D3D12_TILED_RESOURCES_TIER, m_dOptions, TiledResourcesTier);
689FEATURE_SUPPORT_GET(D3D12_RESOURCE_BINDING_TIER, m_dOptions, ResourceBindingTier);
690FEATURE_SUPPORT_GET(BOOL, m_dOptions, PSSpecifiedStencilRefSupported);
691FEATURE_SUPPORT_GET(BOOL, m_dOptions, TypedUAVLoadAdditionalFormats);
692FEATURE_SUPPORT_GET(BOOL, m_dOptions, ROVsSupported);
693FEATURE_SUPPORT_GET(D3D12_CONSERVATIVE_RASTERIZATION_TIER, m_dOptions, ConservativeRasterizationTier);
694FEATURE_SUPPORT_GET(BOOL, m_dOptions, StandardSwizzle64KBSupported);
695FEATURE_SUPPORT_GET(BOOL, m_dOptions, CrossAdapterRowMajorTextureSupported);
696FEATURE_SUPPORT_GET(BOOL, m_dOptions, VPAndRTArrayIndexFromAnyShaderFeedingRasterizerSupportedWithoutGSEmulation);
697FEATURE_SUPPORT_GET(D3D12_RESOURCE_HEAP_TIER, m_dOptions, ResourceHeapTier);
698
699// Special procedure for handling caps that is also part of other features
700inline D3D12_CROSS_NODE_SHARING_TIER CD3DX12FeatureSupport::CrossNodeSharingTier() const noexcept
701{
702 if (m_dCrossNode.SharingTier > D3D12_CROSS_NODE_SHARING_TIER_NOT_SUPPORTED)
703 {
704 return m_dCrossNode.SharingTier;
705 }
706 else
707 {
708 return m_dOptions.CrossNodeSharingTier;
709 }
710}
711
712inline UINT CD3DX12FeatureSupport::MaxGPUVirtualAddressBitsPerResource() const noexcept
713{
714 if (m_dOptions.MaxGPUVirtualAddressBitsPerResource > 0)
715 {
716 return m_dOptions.MaxGPUVirtualAddressBitsPerResource;
717 }
718 else
719 {
720 return m_dGPUVASupport.MaxGPUVirtualAddressBitsPerResource;
721 }
722}
723
724// 1: Architecture
725// Combined with Architecture1
726
727// 2: Feature Levels
728// Simply returns the highest supported feature level
729inline D3D_FEATURE_LEVEL CD3DX12FeatureSupport::MaxSupportedFeatureLevel() const noexcept
730{
731 return m_eMaxFeatureLevel;
732}
733
734// 3: Feature Format Support
735inline HRESULT CD3DX12FeatureSupport::FormatSupport(DXGI_FORMAT Format, D3D12_FORMAT_SUPPORT1& Support1, D3D12_FORMAT_SUPPORT2& Support2) const
736{
737 D3D12_FEATURE_DATA_FORMAT_SUPPORT dFormatSupport;
738 dFormatSupport.Format = Format;
739
740 // It is possible that the function call returns an error
741 HRESULT result = m_pDevice->CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT, &dFormatSupport, sizeof(D3D12_FEATURE_DATA_FORMAT_SUPPORT));
742
743 Support1 = dFormatSupport.Support1;
744 Support2 = dFormatSupport.Support2; // Two outputs. Probably better just to take in the struct as an argument?
745
746 return result;
747}
748
749// 4: Multisample Quality Levels
750inline HRESULT CD3DX12FeatureSupport::MultisampleQualityLevels(DXGI_FORMAT Format, UINT SampleCount, D3D12_MULTISAMPLE_QUALITY_LEVEL_FLAGS Flags, UINT& NumQualityLevels) const
751{
752 D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS dMultisampleQualityLevels;
753 dMultisampleQualityLevels.Format = Format;
754 dMultisampleQualityLevels.SampleCount = SampleCount;
755 dMultisampleQualityLevels.Flags = Flags;
756
757 HRESULT result = m_pDevice->CheckFeatureSupport(D3D12_FEATURE_MULTISAMPLE_QUALITY_LEVELS, &dMultisampleQualityLevels, sizeof(D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS));
758
759 if (SUCCEEDED(result))
760 {
761 NumQualityLevels = dMultisampleQualityLevels.NumQualityLevels;
762 }
763 else
764 {
765 NumQualityLevels = 0;
766 }
767
768 return result;
769}
770
771// 5: Format Info
772inline HRESULT CD3DX12FeatureSupport::FormatInfo(DXGI_FORMAT Format, UINT8& PlaneCount) const
773{
774 D3D12_FEATURE_DATA_FORMAT_INFO dFormatInfo;
775 dFormatInfo.Format = Format;
776
777 HRESULT result = m_pDevice->CheckFeatureSupport(D3D12_FEATURE_FORMAT_INFO, &dFormatInfo, sizeof(D3D12_FEATURE_DATA_FORMAT_INFO));
778 if (FAILED(result))
779 {
780 PlaneCount = 0;
781 }
782 else
783 {
784 PlaneCount = dFormatInfo.PlaneCount;
785 }
786 return result;
787}
788
789// 6: GPU Virtual Address Support
790// MaxGPUVirtualAddressBitsPerResource handled in D3D12Options
791FEATURE_SUPPORT_GET(UINT, m_dGPUVASupport, MaxGPUVirtualAddressBitsPerProcess);
792
793// 7: Shader Model
794inline D3D_SHADER_MODEL CD3DX12FeatureSupport::HighestShaderModel() const noexcept
795{
796 return m_dShaderModel.HighestShaderModel;
797}
798
799// 8: D3D12 Options1
800FEATURE_SUPPORT_GET(BOOL, m_dOptions1, WaveOps);
801FEATURE_SUPPORT_GET(UINT, m_dOptions1, WaveLaneCountMin);
802FEATURE_SUPPORT_GET(UINT, m_dOptions1, WaveLaneCountMax);
803FEATURE_SUPPORT_GET(UINT, m_dOptions1, TotalLaneCount);
804FEATURE_SUPPORT_GET(BOOL, m_dOptions1, ExpandedComputeResourceStates);
805FEATURE_SUPPORT_GET(BOOL, m_dOptions1, Int64ShaderOps);
806
807// 10: Protected Resource Session Support
808inline D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAGS CD3DX12FeatureSupport::ProtectedResourceSessionSupport(UINT NodeIndex) const
809{
810 return m_dProtectedResourceSessionSupport[NodeIndex].Support;
811}
812
813// 12: Root Signature
814inline D3D_ROOT_SIGNATURE_VERSION CD3DX12FeatureSupport::HighestRootSignatureVersion() const noexcept
815{
816 return m_dRootSignature.HighestVersion;
817}
818
819// 16: Architecture1
820// Same data fields can be queried from m_dArchitecture
821FEATURE_SUPPORT_GET_NODE_INDEXED(BOOL, m_dArchitecture1, TileBasedRenderer);
822FEATURE_SUPPORT_GET_NODE_INDEXED(BOOL, m_dArchitecture1, UMA);
823FEATURE_SUPPORT_GET_NODE_INDEXED(BOOL, m_dArchitecture1, CacheCoherentUMA);
824FEATURE_SUPPORT_GET_NODE_INDEXED(BOOL, m_dArchitecture1, IsolatedMMU);
825
826// 18: D3D12 Options2
827FEATURE_SUPPORT_GET(BOOL, m_dOptions2, DepthBoundsTestSupported);
828FEATURE_SUPPORT_GET(D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER, m_dOptions2, ProgrammableSamplePositionsTier);
829
830// 19: Shader Cache
831FEATURE_SUPPORT_GET_NAME(D3D12_SHADER_CACHE_SUPPORT_FLAGS, m_dShaderCache, SupportFlags, ShaderCacheSupportFlags);
832
833// 20: Command Queue Priority
834inline BOOL CD3DX12FeatureSupport::CommandQueuePrioritySupported(D3D12_COMMAND_LIST_TYPE CommandListType, UINT Priority)
835{
836 m_dCommandQueuePriority.CommandListType = CommandListType;
837 m_dCommandQueuePriority.Priority = Priority;
838
839 if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_COMMAND_QUEUE_PRIORITY, &m_dCommandQueuePriority, sizeof(D3D12_FEATURE_DATA_COMMAND_QUEUE_PRIORITY))))
840 {
841 return false;
842 }
843
844 return m_dCommandQueuePriority.PriorityForTypeIsSupported;
845}
846
847// 21: D3D12 Options3
848FEATURE_SUPPORT_GET(BOOL, m_dOptions3, CopyQueueTimestampQueriesSupported);
849FEATURE_SUPPORT_GET(BOOL, m_dOptions3, CastingFullyTypedFormatSupported);
850FEATURE_SUPPORT_GET(D3D12_COMMAND_LIST_SUPPORT_FLAGS, m_dOptions3, WriteBufferImmediateSupportFlags);
851FEATURE_SUPPORT_GET(D3D12_VIEW_INSTANCING_TIER, m_dOptions3, ViewInstancingTier);
852FEATURE_SUPPORT_GET(BOOL, m_dOptions3, BarycentricsSupported);
853
854// 22: Existing Heaps
855FEATURE_SUPPORT_GET_NAME(BOOL, m_dExistingHeaps, Supported, ExistingHeapsSupported);
856
857// 23: D3D12 Options4
858FEATURE_SUPPORT_GET(BOOL, m_dOptions4, MSAA64KBAlignedTextureSupported);
859FEATURE_SUPPORT_GET(D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER, m_dOptions4, SharedResourceCompatibilityTier);
860FEATURE_SUPPORT_GET(BOOL, m_dOptions4, Native16BitShaderOpsSupported);
861
862// 24: Serialization
863FEATURE_SUPPORT_GET_NODE_INDEXED(D3D12_HEAP_SERIALIZATION_TIER, m_dSerialization, HeapSerializationTier);
864
865// 25: Cross Node
866// CrossNodeSharingTier handled in D3D12Options
867FEATURE_SUPPORT_GET_NAME(BOOL, m_dCrossNode, AtomicShaderInstructions, CrossNodeAtomicShaderInstructions);
868
869// 27: D3D12 Options5
870FEATURE_SUPPORT_GET(BOOL, m_dOptions5, SRVOnlyTiledResourceTier3);
871FEATURE_SUPPORT_GET(D3D12_RENDER_PASS_TIER, m_dOptions5, RenderPassesTier);
872FEATURE_SUPPORT_GET(D3D12_RAYTRACING_TIER, m_dOptions5, RaytracingTier);
873
874#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 4)
875// 28: Displayable
876FEATURE_SUPPORT_GET(BOOL, m_dDisplayable, DisplayableTexture);
877// SharedResourceCompatibilityTier handled in D3D12Options4
878#endif
879
880// 30: D3D12 Options6
881FEATURE_SUPPORT_GET(BOOL, m_dOptions6, AdditionalShadingRatesSupported);
882FEATURE_SUPPORT_GET(BOOL, m_dOptions6, PerPrimitiveShadingRateSupportedWithViewportIndexing);
883FEATURE_SUPPORT_GET(D3D12_VARIABLE_SHADING_RATE_TIER, m_dOptions6, VariableShadingRateTier);
884FEATURE_SUPPORT_GET(UINT, m_dOptions6, ShadingRateImageTileSize);
885FEATURE_SUPPORT_GET(BOOL, m_dOptions6, BackgroundProcessingSupported);
886
887// 31: Query Meta Command
888// Keep the original call routine
889inline HRESULT CD3DX12FeatureSupport::QueryMetaCommand(D3D12_FEATURE_DATA_QUERY_META_COMMAND& dQueryMetaCommand) const
890{
891 return m_pDevice->CheckFeatureSupport(D3D12_FEATURE_QUERY_META_COMMAND, &dQueryMetaCommand, sizeof(D3D12_FEATURE_DATA_QUERY_META_COMMAND));
892}
893
894// 32: D3D12 Options7
895FEATURE_SUPPORT_GET(D3D12_MESH_SHADER_TIER, m_dOptions7, MeshShaderTier);
896FEATURE_SUPPORT_GET(D3D12_SAMPLER_FEEDBACK_TIER, m_dOptions7, SamplerFeedbackTier);
897
898// 33: Protected Resource Session Type Count
899FEATURE_SUPPORT_GET_NODE_INDEXED_NAME(UINT, m_dProtectedResourceSessionTypeCount, Count, ProtectedResourceSessionTypeCount);
900
901// 34: Protected Resource Session Types
902FEATURE_SUPPORT_GET_NODE_INDEXED_NAME(std::vector<GUID>, m_dProtectedResourceSessionTypes, TypeVec, ProtectedResourceSessionTypes);
903
904#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 3)
905// 36: Options8
906FEATURE_SUPPORT_GET(BOOL, m_dOptions8, UnalignedBlockTexturesSupported);
907
908// 37: Options9
909FEATURE_SUPPORT_GET(BOOL, m_dOptions9, MeshShaderPipelineStatsSupported);
910FEATURE_SUPPORT_GET(BOOL, m_dOptions9, MeshShaderSupportsFullRangeRenderTargetArrayIndex);
911FEATURE_SUPPORT_GET(BOOL, m_dOptions9, AtomicInt64OnTypedResourceSupported);
912FEATURE_SUPPORT_GET(BOOL, m_dOptions9, AtomicInt64OnGroupSharedSupported);
913FEATURE_SUPPORT_GET(BOOL, m_dOptions9, DerivativesInMeshAndAmplificationShadersSupported);
914FEATURE_SUPPORT_GET(D3D12_WAVE_MMA_TIER, m_dOptions9, WaveMMATier);
915#endif
916
917#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 4)
918// 39: Options10
919FEATURE_SUPPORT_GET(BOOL, m_dOptions10, VariableRateShadingSumCombinerSupported);
920FEATURE_SUPPORT_GET(BOOL, m_dOptions10, MeshShaderPerPrimitiveShadingRateSupported);
921
922// 40: Options11
923FEATURE_SUPPORT_GET(BOOL, m_dOptions11, AtomicInt64OnDescriptorHeapResourceSupported);
924#endif
925
926#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 600)
927// 41: Options12
928FEATURE_SUPPORT_GET(D3D12_TRI_STATE, m_dOptions12, MSPrimitivesPipelineStatisticIncludesCulledPrimitives);
929FEATURE_SUPPORT_GET(BOOL, m_dOptions12, EnhancedBarriersSupported);
930FEATURE_SUPPORT_GET(BOOL, m_dOptions12, RelaxedFormatCastingSupported);
931#endif
932
933#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 602)
934// 42: Options13
935FEATURE_SUPPORT_GET(BOOL, m_dOptions13, UnrestrictedBufferTextureCopyPitchSupported);
936FEATURE_SUPPORT_GET(BOOL, m_dOptions13, UnrestrictedVertexElementAlignmentSupported);
937FEATURE_SUPPORT_GET(BOOL, m_dOptions13, InvertedViewportHeightFlipsYSupported);
938FEATURE_SUPPORT_GET(BOOL, m_dOptions13, InvertedViewportDepthFlipsZSupported);
939FEATURE_SUPPORT_GET(BOOL, m_dOptions13, TextureCopyBetweenDimensionsSupported);
940FEATURE_SUPPORT_GET(BOOL, m_dOptions13, AlphaBlendFactorSupported);
941#endif
942
943#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 606)
944// 43: Options14
945FEATURE_SUPPORT_GET(BOOL, m_dOptions14, AdvancedTextureOpsSupported);
946FEATURE_SUPPORT_GET(BOOL, m_dOptions14, WriteableMSAATexturesSupported);
947FEATURE_SUPPORT_GET(BOOL, m_dOptions14, IndependentFrontAndBackStencilRefMaskSupported);
948
949// 44: Options15
950FEATURE_SUPPORT_GET(BOOL, m_dOptions15, TriangleFanSupported);
951FEATURE_SUPPORT_GET(BOOL, m_dOptions15, DynamicIndexBufferStripCutSupported);
952#endif
953
954#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 608)
955// 45: Options16
956FEATURE_SUPPORT_GET(BOOL, m_dOptions16, DynamicDepthBiasSupported);
957#endif
958#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 609)
959FEATURE_SUPPORT_GET(BOOL, m_dOptions16, GPUUploadHeapSupported);
960
961// 46: Options17
962FEATURE_SUPPORT_GET(BOOL, m_dOptions17, NonNormalizedCoordinateSamplersSupported);
963FEATURE_SUPPORT_GET(BOOL, m_dOptions17, ManualWriteTrackingResourceSupported);
964
965// 47: Option18
966FEATURE_SUPPORT_GET(BOOL, m_dOptions18, RenderPassesValid);
967#endif
968
969#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 610)
970FEATURE_SUPPORT_GET(BOOL, m_dOptions19, MismatchingOutputDimensionsSupported);
971FEATURE_SUPPORT_GET(UINT, m_dOptions19, SupportedSampleCountsWithNoOutputs);
972FEATURE_SUPPORT_GET(BOOL, m_dOptions19, PointSamplingAddressesNeverRoundUp);
973FEATURE_SUPPORT_GET(BOOL, m_dOptions19, RasterizerDesc2Supported);
974FEATURE_SUPPORT_GET(BOOL, m_dOptions19, NarrowQuadrilateralLinesSupported);
975FEATURE_SUPPORT_GET(BOOL, m_dOptions19, AnisoFilterWithPointMipSupported);
976FEATURE_SUPPORT_GET(UINT, m_dOptions19, MaxSamplerDescriptorHeapSize);
977FEATURE_SUPPORT_GET(UINT, m_dOptions19, MaxSamplerDescriptorHeapSizeWithStaticSamplers);
978FEATURE_SUPPORT_GET(UINT, m_dOptions19, MaxViewDescriptorHeapSize);
979#endif
980
981#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 611)
982// 49: Options20
983FEATURE_SUPPORT_GET(BOOL, m_dOptions20, ComputeOnlyWriteWatchSupported);
984#endif
985
986#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 612)
987// 50: Options21
988FEATURE_SUPPORT_GET(D3D12_EXECUTE_INDIRECT_TIER, m_dOptions21, ExecuteIndirectTier);
989FEATURE_SUPPORT_GET(D3D12_WORK_GRAPHS_TIER, m_dOptions21, WorkGraphsTier);
990#endif
991
992#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 617)
993// 51: TightAlignment
994FEATURE_SUPPORT_GET_NAME(D3D12_TIGHT_ALIGNMENT_TIER, m_dTightAlignment, SupportTier, TightAlignmentSupportTier);
995#endif
996
997// Helper function to decide the highest shader model supported by the system
998// Stores the result in m_dShaderModel
999// Must be updated whenever a new shader model is added to the d3d12.h header
1000inline HRESULT CD3DX12FeatureSupport::QueryHighestShaderModel()
1001{
1002 // Check support in descending order
1003 HRESULT result;
1004
1005 const D3D_SHADER_MODEL allModelVersions[] =
1006 {
1007#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 612)
1008 D3D_SHADER_MODEL_6_9,
1009#endif
1010#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 606)
1011 D3D_SHADER_MODEL_6_8,
1012#endif
1013#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 3)
1014 D3D_SHADER_MODEL_6_7,
1015#endif
1016 D3D_SHADER_MODEL_6_6,
1017 D3D_SHADER_MODEL_6_5,
1018 D3D_SHADER_MODEL_6_4,
1019 D3D_SHADER_MODEL_6_3,
1020 D3D_SHADER_MODEL_6_2,
1021 D3D_SHADER_MODEL_6_1,
1022 D3D_SHADER_MODEL_6_0,
1023 D3D_SHADER_MODEL_5_1
1024 };
1025 constexpr size_t numModelVersions = sizeof(allModelVersions) / sizeof(D3D_SHADER_MODEL);
1026
1027 for (size_t i = 0; i < numModelVersions; i++)
1028 {
1029 m_dShaderModel.HighestShaderModel = allModelVersions[i];
1030 result = m_pDevice->CheckFeatureSupport(D3D12_FEATURE_SHADER_MODEL, &m_dShaderModel, sizeof(D3D12_FEATURE_DATA_SHADER_MODEL));
1031 if (result != E_INVALIDARG)
1032 {
1033 // Indicates that the version is recognizable by the runtime and stored in the struct
1034 // Also terminate on unexpected error code
1035 if (FAILED(result))
1036 {
1037 m_dShaderModel.HighestShaderModel = static_cast<D3D_SHADER_MODEL>(0);
1038 }
1039 return result;
1040 }
1041 }
1042
1043 // Shader model may not be supported. Continue the rest initializations
1044 m_dShaderModel.HighestShaderModel = static_cast<D3D_SHADER_MODEL>(0);
1045 return S_OK;
1046}
1047
1048// Helper function to decide the highest root signature supported
1049// Must be updated whenever a new root signature version is added to the d3d12.h header
1050inline HRESULT CD3DX12FeatureSupport::QueryHighestRootSignatureVersion()
1051{
1052 HRESULT result;
1053
1054 const D3D_ROOT_SIGNATURE_VERSION allRootSignatureVersions[] =
1055 {
1056#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 609)
1057 D3D_ROOT_SIGNATURE_VERSION_1_2,
1058#endif
1059 D3D_ROOT_SIGNATURE_VERSION_1_1,
1060 D3D_ROOT_SIGNATURE_VERSION_1_0,
1061 D3D_ROOT_SIGNATURE_VERSION_1,
1062 };
1063 constexpr size_t numRootSignatureVersions = sizeof(allRootSignatureVersions) / sizeof(D3D_ROOT_SIGNATURE_VERSION);
1064
1065 for (size_t i = 0; i < numRootSignatureVersions; i++)
1066 {
1067 m_dRootSignature.HighestVersion = allRootSignatureVersions[i];
1068 result = m_pDevice->CheckFeatureSupport(D3D12_FEATURE_ROOT_SIGNATURE, &m_dRootSignature, sizeof(D3D12_FEATURE_DATA_ROOT_SIGNATURE));
1069 if (result != E_INVALIDARG)
1070 {
1071 if (FAILED(result))
1072 {
1073 m_dRootSignature.HighestVersion = static_cast<D3D_ROOT_SIGNATURE_VERSION>(0);
1074 }
1075 // If succeeded, the highest version is already written into the member struct
1076 return result;
1077 }
1078 }
1079
1080 // No version left. Set to invalid value and continue.
1081 m_dRootSignature.HighestVersion = static_cast<D3D_ROOT_SIGNATURE_VERSION>(0);
1082 return S_OK;
1083}
1084
1085// Helper funcion to decide the highest feature level
1086inline HRESULT CD3DX12FeatureSupport::QueryHighestFeatureLevel()
1087{
1088 HRESULT result;
1089
1090 // Check against a list of all feature levels present in d3dcommon.h
1091 // Needs to be updated for future feature levels
1092 const D3D_FEATURE_LEVEL allLevels[] =
1093 {
1094#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 3)
1095 D3D_FEATURE_LEVEL_12_2,
1096#endif
1097 D3D_FEATURE_LEVEL_12_1,
1098 D3D_FEATURE_LEVEL_12_0,
1099 D3D_FEATURE_LEVEL_11_1,
1100 D3D_FEATURE_LEVEL_11_0,
1101 D3D_FEATURE_LEVEL_10_1,
1102 D3D_FEATURE_LEVEL_10_0,
1103 D3D_FEATURE_LEVEL_9_3,
1104 D3D_FEATURE_LEVEL_9_2,
1105 D3D_FEATURE_LEVEL_9_1,
1106#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 5)
1107 D3D_FEATURE_LEVEL_1_0_CORE,
1108#endif
1109#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 611)
1110 D3D_FEATURE_LEVEL_1_0_GENERIC
1111#endif
1112 };
1113
1114 D3D12_FEATURE_DATA_FEATURE_LEVELS dFeatureLevel;
1115 dFeatureLevel.NumFeatureLevels = static_cast<UINT>(sizeof(allLevels) / sizeof(D3D_FEATURE_LEVEL));
1116 dFeatureLevel.pFeatureLevelsRequested = allLevels;
1117
1118 result = m_pDevice->CheckFeatureSupport(D3D12_FEATURE_FEATURE_LEVELS, &dFeatureLevel, sizeof(D3D12_FEATURE_DATA_FEATURE_LEVELS));
1119 if (SUCCEEDED(result))
1120 {
1121 m_eMaxFeatureLevel = dFeatureLevel.MaxSupportedFeatureLevel;
1122 }
1123 else
1124 {
1125 m_eMaxFeatureLevel = static_cast<D3D_FEATURE_LEVEL>(0);
1126
1127 if (result == DXGI_ERROR_UNSUPPORTED)
1128 {
1129 // Indicates that none supported. Continue initialization
1130 result = S_OK;
1131 }
1132 }
1133 return result;
1134}
1135
1136// Helper function to initialize local protected resource session types structs
1137inline HRESULT CD3DX12FeatureSupport::QueryProtectedResourceSessionTypes(UINT NodeIndex, UINT Count)
1138{
1139 auto& CurrentPRSTypes = m_dProtectedResourceSessionTypes[NodeIndex];
1140 CurrentPRSTypes.NodeIndex = NodeIndex;
1141 CurrentPRSTypes.Count = Count;
1142 CurrentPRSTypes.TypeVec.resize(CurrentPRSTypes.Count);
1143 CurrentPRSTypes.pTypes = CurrentPRSTypes.TypeVec.data();
1144
1145 HRESULT result = m_pDevice->CheckFeatureSupport(D3D12_FEATURE_PROTECTED_RESOURCE_SESSION_TYPES, &m_dProtectedResourceSessionTypes[NodeIndex], sizeof(D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_TYPES));
1146 if (FAILED(result))
1147 {
1148 // Resize TypeVec to empty
1149 CurrentPRSTypes.TypeVec.clear();
1150 }
1151
1152 return result;
1153}
1154
1155#undef FEATURE_SUPPORT_GET
1156#undef FEATURE_SUPPORT_GET_NAME
1157#undef FEATURE_SUPPORT_GET_NODE_INDEXED
1158#undef FEATURE_SUPPORT_GET_NODE_INDEXED_NAME
1159
1160// end CD3DX12FeatureSupport
1161
1162