diff options
| author | 3gg <3gg@shellblade.net> | 2025-12-02 16:39:36 -0800 |
|---|---|---|
| committer | 3gg <3gg@shellblade.net> | 2025-12-02 16:39:36 -0800 |
| commit | 6c8ae19be66cee247980a48e736a4e05d14de179 (patch) | |
| tree | d860767907bf0cbe17ec66422e11bea700cf56d9 /contrib/DirectX-Headers-1.618.2/googletest | |
| parent | 8f594c8ebd11f0e5f8a0c6369c3fe7383d250cbe (diff) | |
Diffstat (limited to 'contrib/DirectX-Headers-1.618.2/googletest')
4 files changed, 2711 insertions, 0 deletions
diff --git a/contrib/DirectX-Headers-1.618.2/googletest/CMakeLists.txt b/contrib/DirectX-Headers-1.618.2/googletest/CMakeLists.txt new file mode 100644 index 0000000..ff979d9 --- /dev/null +++ b/contrib/DirectX-Headers-1.618.2/googletest/CMakeLists.txt | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | # Copyright (c) Microsoft Corporation. | ||
| 2 | # Licensed under the MIT License. | ||
| 3 | include(FetchContent) | ||
| 4 | |||
| 5 | set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) | ||
| 6 | FetchContent_Declare( | ||
| 7 | googletest | ||
| 8 | GIT_REPOSITORY https://github.com/google/googletest.git | ||
| 9 | GIT_TAG main # Live at head | ||
| 10 | ) | ||
| 11 | FetchContent_MakeAvailable(googletest) | ||
| 12 | |||
| 13 | list(APPEND dxlibs "") | ||
| 14 | if(EXISTS "/usr/lib/wsl/lib/") | ||
| 15 | find_library(libd3d12 d3d12 HINTS /usr/lib/wsl/lib) | ||
| 16 | list(APPEND dxlibs ${libd3d12}) | ||
| 17 | else() | ||
| 18 | # Fallback to default: let CMake look for libs | ||
| 19 | list(APPEND dxlibs d3d12) | ||
| 20 | endif() | ||
| 21 | |||
| 22 | project(DirectX-Headers-GoogleTest-Suite | ||
| 23 | DESCRIPTION "DirectX-Header tests using GooleTest" | ||
| 24 | HOMEPAGE_URL "https://github.com/microsoft/DirectX-Headers/" | ||
| 25 | LANGUAGES CXX) | ||
| 26 | |||
| 27 | set(CMAKE_CXX_STANDARD 17) | ||
| 28 | set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
| 29 | set(CMAKE_CXX_EXTENSIONS OFF) | ||
| 30 | |||
| 31 | add_executable(Feature-Support-Test feature_support_test.cpp) | ||
| 32 | target_link_libraries(Feature-Support-Test DirectX-Headers DirectX-Guids ${dxlibs} gtest_main) | ||
| 33 | add_test(Feature-Support-Test Feature-Support-Test) | ||
| 34 | |||
| 35 | if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) | ||
| 36 | target_compile_options(Feature-Support-Test PRIVATE -Wno-unused-variable) | ||
| 37 | endif() | ||
| 38 | |||
| 39 | if(WIN32) | ||
| 40 | target_compile_definitions(Feature-Support-Test PRIVATE _UNICODE UNICODE _WIN32_WINNT=0x0A00) | ||
| 41 | |||
| 42 | if(WINDOWS_STORE) | ||
| 43 | target_compile_definitions(Feature-Support-Test PRIVATE WINAPI_FAMILY=WINAPI_FAMILY_APP) | ||
| 44 | endif() | ||
| 45 | endif() | ||
diff --git a/contrib/DirectX-Headers-1.618.2/googletest/MockDevice.hpp b/contrib/DirectX-Headers-1.618.2/googletest/MockDevice.hpp new file mode 100644 index 0000000..748d5ba --- /dev/null +++ b/contrib/DirectX-Headers-1.618.2/googletest/MockDevice.hpp | |||
| @@ -0,0 +1,1299 @@ | |||
| 1 | // Copyright (c) Microsoft Corporation. | ||
| 2 | // Licensed under the MIT License. | ||
| 3 | #ifndef DIRECTX_HEADERS_MOCK_DEVICE_HPP | ||
| 4 | #define DIRECTX_HEADERS_MOCK_DEVICE_HPP | ||
| 5 | #include <unordered_map> | ||
| 6 | |||
| 7 | #ifndef __RPC_FAR | ||
| 8 | #define __RPC_FAR | ||
| 9 | #endif | ||
| 10 | |||
| 11 | #include <directx/d3d12.h> | ||
| 12 | #include <directx/dxcore.h> | ||
| 13 | #include <directx/d3dx12.h> | ||
| 14 | #include "dxguids/dxguids.h" | ||
| 15 | |||
| 16 | class MockDevice : public ID3D12Device | ||
| 17 | { | ||
| 18 | public: // Constructors and custom functions | ||
| 19 | MockDevice(UINT NodeCount = 1) | ||
| 20 | : m_NodeCount(NodeCount) | ||
| 21 | , m_TileBasedRenderer(m_NodeCount, false) | ||
| 22 | , m_UMA(m_NodeCount, false) | ||
| 23 | , m_CacheCoherentUMA(m_NodeCount, false) | ||
| 24 | , m_IsolatedMMU(m_NodeCount, false) | ||
| 25 | , m_ProtectedResourceSessionSupport(m_NodeCount, D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAG_NONE) | ||
| 26 | , m_HeapSerializationTier(m_NodeCount, D3D12_HEAP_SERIALIZATION_TIER_0) | ||
| 27 | , m_ProtectedResourceSessionTypeCount(m_NodeCount, 0) | ||
| 28 | , m_ProtectedResourceSessionTypes(m_NodeCount) | ||
| 29 | { | ||
| 30 | |||
| 31 | } | ||
| 32 | |||
| 33 | virtual ~MockDevice() = default; | ||
| 34 | |||
| 35 | void SetNodeCount(UINT NewCount) | ||
| 36 | { | ||
| 37 | m_NodeCount = NewCount; | ||
| 38 | m_TileBasedRenderer.resize(NewCount); | ||
| 39 | m_UMA.resize(NewCount); | ||
| 40 | m_CacheCoherentUMA.resize(NewCount); | ||
| 41 | m_IsolatedMMU.resize(NewCount); | ||
| 42 | m_ProtectedResourceSessionSupport.resize(NewCount); | ||
| 43 | m_HeapSerializationTier.resize(NewCount); | ||
| 44 | m_ProtectedResourceSessionTypeCount.resize(NewCount); | ||
| 45 | m_ProtectedResourceSessionTypes.resize(NewCount); | ||
| 46 | } | ||
| 47 | |||
| 48 | public: // ID3D12Device | ||
| 49 | UINT STDMETHODCALLTYPE GetNodeCount() override | ||
| 50 | { | ||
| 51 | return m_NodeCount; | ||
| 52 | } | ||
| 53 | |||
| 54 | HRESULT STDMETHODCALLTYPE CreateCommandQueue( | ||
| 55 | _In_ const D3D12_COMMAND_QUEUE_DESC *pDesc, | ||
| 56 | REFIID riid, | ||
| 57 | _COM_Outptr_ void **ppCommandQueue | ||
| 58 | ) override | ||
| 59 | { | ||
| 60 | return S_OK; | ||
| 61 | } | ||
| 62 | |||
| 63 | HRESULT STDMETHODCALLTYPE CreateCommandAllocator( | ||
| 64 | _In_ D3D12_COMMAND_LIST_TYPE type, | ||
| 65 | REFIID riid, | ||
| 66 | _COM_Outptr_ void **ppCommandAllocator | ||
| 67 | ) override | ||
| 68 | { | ||
| 69 | return S_OK; | ||
| 70 | } | ||
| 71 | |||
| 72 | HRESULT STDMETHODCALLTYPE CreateGraphicsPipelineState( | ||
| 73 | _In_ const D3D12_GRAPHICS_PIPELINE_STATE_DESC *pDesc, | ||
| 74 | REFIID riid, | ||
| 75 | _COM_Outptr_ void **ppPipelineState | ||
| 76 | ) override | ||
| 77 | { | ||
| 78 | return S_OK; | ||
| 79 | } | ||
| 80 | |||
| 81 | HRESULT STDMETHODCALLTYPE CreateComputePipelineState( | ||
| 82 | _In_ const D3D12_COMPUTE_PIPELINE_STATE_DESC *pDesc, | ||
| 83 | REFIID riid, | ||
| 84 | _COM_Outptr_ void **ppPipelineState | ||
| 85 | ) override | ||
| 86 | { | ||
| 87 | return S_OK; | ||
| 88 | } | ||
| 89 | |||
| 90 | HRESULT STDMETHODCALLTYPE CreateCommandList( | ||
| 91 | _In_ UINT nodeMask, | ||
| 92 | _In_ D3D12_COMMAND_LIST_TYPE type, | ||
| 93 | _In_ ID3D12CommandAllocator *pCommandAllocator, | ||
| 94 | _In_opt_ ID3D12PipelineState *pInitialState, | ||
| 95 | REFIID riid, | ||
| 96 | _COM_Outptr_ void **ppCommandList | ||
| 97 | ) override | ||
| 98 | { | ||
| 99 | return S_OK; | ||
| 100 | } | ||
| 101 | |||
| 102 | virtual HRESULT STDMETHODCALLTYPE CreateDescriptorHeap( | ||
| 103 | _In_ const D3D12_DESCRIPTOR_HEAP_DESC *pDescriptorHeapDesc, | ||
| 104 | REFIID riid, | ||
| 105 | _COM_Outptr_ void **ppvHeap | ||
| 106 | ) override | ||
| 107 | { | ||
| 108 | return S_OK; | ||
| 109 | } | ||
| 110 | |||
| 111 | virtual UINT STDMETHODCALLTYPE GetDescriptorHandleIncrementSize( | ||
| 112 | _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapType | ||
| 113 | ) override | ||
| 114 | { | ||
| 115 | return 0; | ||
| 116 | } | ||
| 117 | |||
| 118 | virtual HRESULT STDMETHODCALLTYPE CreateRootSignature( | ||
| 119 | _In_ UINT nodeMask, | ||
| 120 | _In_reads_(blobLengthInBytes) const void *pBlobWithRootSignature, | ||
| 121 | _In_ SIZE_T blobLengthInBytes, | ||
| 122 | REFIID riid, | ||
| 123 | _COM_Outptr_ void **ppvRootSignature | ||
| 124 | ) override | ||
| 125 | { | ||
| 126 | return S_OK; | ||
| 127 | } | ||
| 128 | |||
| 129 | virtual void STDMETHODCALLTYPE CreateConstantBufferView( | ||
| 130 | _In_opt_ const D3D12_CONSTANT_BUFFER_VIEW_DESC *pDesc, | ||
| 131 | _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor | ||
| 132 | ) override | ||
| 133 | { | ||
| 134 | return; | ||
| 135 | } | ||
| 136 | |||
| 137 | virtual void STDMETHODCALLTYPE CreateShaderResourceView( | ||
| 138 | _In_opt_ ID3D12Resource *pResource, | ||
| 139 | _In_opt_ const D3D12_SHADER_RESOURCE_VIEW_DESC *pDesc, | ||
| 140 | _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor | ||
| 141 | ) override | ||
| 142 | { | ||
| 143 | return; | ||
| 144 | } | ||
| 145 | |||
| 146 | virtual void STDMETHODCALLTYPE CreateUnorderedAccessView( | ||
| 147 | _In_opt_ ID3D12Resource *pResource, | ||
| 148 | _In_opt_ ID3D12Resource *pCounterResource, | ||
| 149 | _In_opt_ const D3D12_UNORDERED_ACCESS_VIEW_DESC *pDesc, | ||
| 150 | _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor | ||
| 151 | ) override | ||
| 152 | { | ||
| 153 | return; | ||
| 154 | } | ||
| 155 | |||
| 156 | virtual void STDMETHODCALLTYPE CreateRenderTargetView( | ||
| 157 | _In_opt_ ID3D12Resource *pResource, | ||
| 158 | _In_opt_ const D3D12_RENDER_TARGET_VIEW_DESC *pDesc, | ||
| 159 | _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor | ||
| 160 | ) override | ||
| 161 | { | ||
| 162 | return; | ||
| 163 | } | ||
| 164 | |||
| 165 | virtual void STDMETHODCALLTYPE CreateDepthStencilView( | ||
| 166 | _In_opt_ ID3D12Resource *pResource, | ||
| 167 | _In_opt_ const D3D12_DEPTH_STENCIL_VIEW_DESC *pDesc, | ||
| 168 | _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor) override | ||
| 169 | { | ||
| 170 | return; | ||
| 171 | } | ||
| 172 | |||
| 173 | virtual void STDMETHODCALLTYPE CreateSampler( | ||
| 174 | _In_ const D3D12_SAMPLER_DESC *pDesc, | ||
| 175 | _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor) override | ||
| 176 | { | ||
| 177 | return; | ||
| 178 | } | ||
| 179 | |||
| 180 | virtual void STDMETHODCALLTYPE CopyDescriptors( | ||
| 181 | _In_ UINT NumDestDescriptorRanges, | ||
| 182 | _In_reads_(NumDestDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pDestDescriptorRangeStarts, | ||
| 183 | _In_reads_opt_(NumDestDescriptorRanges) const UINT *pDestDescriptorRangeSizes, | ||
| 184 | _In_ UINT NumSrcDescriptorRanges, | ||
| 185 | _In_reads_(NumSrcDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pSrcDescriptorRangeStarts, | ||
| 186 | _In_reads_opt_(NumSrcDescriptorRanges) const UINT *pSrcDescriptorRangeSizes, | ||
| 187 | _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType) override | ||
| 188 | { | ||
| 189 | return; | ||
| 190 | } | ||
| 191 | |||
| 192 | virtual void STDMETHODCALLTYPE CopyDescriptorsSimple( | ||
| 193 | _In_ UINT NumDescriptors, | ||
| 194 | _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptorRangeStart, | ||
| 195 | _In_ D3D12_CPU_DESCRIPTOR_HANDLE SrcDescriptorRangeStart, | ||
| 196 | _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType) override | ||
| 197 | { | ||
| 198 | return; | ||
| 199 | } | ||
| 200 | |||
| 201 | #if defined(_MSC_VER) || !defined(_WIN32) | ||
| 202 | virtual D3D12_RESOURCE_ALLOCATION_INFO STDMETHODCALLTYPE GetResourceAllocationInfo( | ||
| 203 | _In_ UINT visibleMask, | ||
| 204 | _In_ UINT numResourceDescs, | ||
| 205 | _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs) override | ||
| 206 | { | ||
| 207 | D3D12_RESOURCE_ALLOCATION_INFO mockInfo = {}; | ||
| 208 | return mockInfo; | ||
| 209 | } | ||
| 210 | #else | ||
| 211 | virtual D3D12_RESOURCE_ALLOCATION_INFO *STDMETHODCALLTYPE GetResourceAllocationInfo( | ||
| 212 | D3D12_RESOURCE_ALLOCATION_INFO * RetVal, | ||
| 213 | _In_ UINT visibleMask, | ||
| 214 | _In_ UINT numResourceDescs, | ||
| 215 | _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs) override | ||
| 216 | { | ||
| 217 | if (RetVal) | ||
| 218 | { | ||
| 219 | *RetVal = {}; | ||
| 220 | } | ||
| 221 | return RetVal; | ||
| 222 | } | ||
| 223 | #endif | ||
| 224 | |||
| 225 | #if defined(_MSC_VER) || !defined(_WIN32) | ||
| 226 | virtual D3D12_HEAP_PROPERTIES STDMETHODCALLTYPE GetCustomHeapProperties( | ||
| 227 | _In_ UINT nodeMask, | ||
| 228 | D3D12_HEAP_TYPE heapType) override | ||
| 229 | { | ||
| 230 | D3D12_HEAP_PROPERTIES mockProps = {}; | ||
| 231 | return mockProps; | ||
| 232 | } | ||
| 233 | #else | ||
| 234 | virtual D3D12_HEAP_PROPERTIES *STDMETHODCALLTYPE GetCustomHeapProperties( | ||
| 235 | D3D12_HEAP_PROPERTIES * RetVal, | ||
| 236 | _In_ UINT nodeMask, | ||
| 237 | D3D12_HEAP_TYPE heapType) override | ||
| 238 | { | ||
| 239 | if (RetVal) | ||
| 240 | { | ||
| 241 | *RetVal = {}; | ||
| 242 | } | ||
| 243 | return RetVal; | ||
| 244 | } | ||
| 245 | #endif | ||
| 246 | |||
| 247 | virtual HRESULT STDMETHODCALLTYPE CreateCommittedResource( | ||
| 248 | _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, | ||
| 249 | D3D12_HEAP_FLAGS HeapFlags, | ||
| 250 | _In_ const D3D12_RESOURCE_DESC *pDesc, | ||
| 251 | D3D12_RESOURCE_STATES InitialResourceState, | ||
| 252 | _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, | ||
| 253 | REFIID riidResource, | ||
| 254 | _COM_Outptr_opt_ void **ppvResource) override | ||
| 255 | { | ||
| 256 | return S_OK; | ||
| 257 | } | ||
| 258 | |||
| 259 | virtual HRESULT STDMETHODCALLTYPE CreateHeap( | ||
| 260 | _In_ const D3D12_HEAP_DESC *pDesc, | ||
| 261 | REFIID riid, | ||
| 262 | _COM_Outptr_opt_ void **ppvHeap) override | ||
| 263 | { | ||
| 264 | return S_OK; | ||
| 265 | } | ||
| 266 | |||
| 267 | virtual HRESULT STDMETHODCALLTYPE CreatePlacedResource( | ||
| 268 | _In_ ID3D12Heap *pHeap, | ||
| 269 | UINT64 HeapOffset, | ||
| 270 | _In_ const D3D12_RESOURCE_DESC *pDesc, | ||
| 271 | D3D12_RESOURCE_STATES InitialState, | ||
| 272 | _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, | ||
| 273 | REFIID riid, | ||
| 274 | _COM_Outptr_opt_ void **ppvResource) override | ||
| 275 | { | ||
| 276 | return S_OK; | ||
| 277 | } | ||
| 278 | |||
| 279 | virtual HRESULT STDMETHODCALLTYPE CreateReservedResource( | ||
| 280 | _In_ const D3D12_RESOURCE_DESC *pDesc, | ||
| 281 | D3D12_RESOURCE_STATES InitialState, | ||
| 282 | _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, | ||
| 283 | REFIID riid, | ||
| 284 | _COM_Outptr_opt_ void **ppvResource) override | ||
| 285 | { | ||
| 286 | return S_OK; | ||
| 287 | } | ||
| 288 | |||
| 289 | virtual HRESULT STDMETHODCALLTYPE CreateSharedHandle( | ||
| 290 | _In_ ID3D12DeviceChild *pObject, | ||
| 291 | _In_opt_ const SECURITY_ATTRIBUTES *pAttributes, | ||
| 292 | DWORD Access, | ||
| 293 | _In_opt_ LPCWSTR Name, | ||
| 294 | _Out_ HANDLE *pHandle) override | ||
| 295 | { | ||
| 296 | return S_OK; | ||
| 297 | } | ||
| 298 | |||
| 299 | virtual HRESULT STDMETHODCALLTYPE OpenSharedHandle( | ||
| 300 | _In_ HANDLE NTHandle, | ||
| 301 | REFIID riid, | ||
| 302 | _COM_Outptr_opt_ void **ppvObj) override | ||
| 303 | { | ||
| 304 | return S_OK; | ||
| 305 | } | ||
| 306 | |||
| 307 | virtual HRESULT STDMETHODCALLTYPE OpenSharedHandleByName( | ||
| 308 | _In_ LPCWSTR Name, | ||
| 309 | DWORD Access, | ||
| 310 | /* [annotation][out] */ | ||
| 311 | _Out_ HANDLE *pNTHandle) override | ||
| 312 | { | ||
| 313 | return S_OK; | ||
| 314 | } | ||
| 315 | |||
| 316 | virtual HRESULT STDMETHODCALLTYPE MakeResident( | ||
| 317 | UINT NumObjects, | ||
| 318 | _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects) override | ||
| 319 | { | ||
| 320 | return S_OK; | ||
| 321 | } | ||
| 322 | |||
| 323 | virtual HRESULT STDMETHODCALLTYPE Evict( | ||
| 324 | UINT NumObjects, | ||
| 325 | _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects) override | ||
| 326 | { | ||
| 327 | return S_OK; | ||
| 328 | } | ||
| 329 | |||
| 330 | virtual HRESULT STDMETHODCALLTYPE CreateFence( | ||
| 331 | UINT64 InitialValue, | ||
| 332 | D3D12_FENCE_FLAGS Flags, | ||
| 333 | REFIID riid, | ||
| 334 | _COM_Outptr_ void **ppFence) override | ||
| 335 | { | ||
| 336 | return S_OK; | ||
| 337 | } | ||
| 338 | |||
| 339 | virtual HRESULT STDMETHODCALLTYPE GetDeviceRemovedReason( void) override | ||
| 340 | { | ||
| 341 | return S_OK; | ||
| 342 | } | ||
| 343 | |||
| 344 | virtual void STDMETHODCALLTYPE GetCopyableFootprints( | ||
| 345 | _In_ const D3D12_RESOURCE_DESC *pResourceDesc, | ||
| 346 | _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, | ||
| 347 | _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, | ||
| 348 | UINT64 BaseOffset, | ||
| 349 | _Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT *pLayouts, | ||
| 350 | _Out_writes_opt_(NumSubresources) UINT *pNumRows, | ||
| 351 | _Out_writes_opt_(NumSubresources) UINT64 *pRowSizeInBytes, | ||
| 352 | _Out_opt_ UINT64 *pTotalBytes) override | ||
| 353 | { | ||
| 354 | return; | ||
| 355 | } | ||
| 356 | |||
| 357 | virtual HRESULT STDMETHODCALLTYPE CreateQueryHeap( | ||
| 358 | _In_ const D3D12_QUERY_HEAP_DESC *pDesc, | ||
| 359 | REFIID riid, | ||
| 360 | _COM_Outptr_opt_ void **ppvHeap) override | ||
| 361 | { | ||
| 362 | return S_OK; | ||
| 363 | } | ||
| 364 | |||
| 365 | virtual HRESULT STDMETHODCALLTYPE SetStablePowerState( | ||
| 366 | BOOL Enable) override | ||
| 367 | { | ||
| 368 | return S_OK; | ||
| 369 | } | ||
| 370 | |||
| 371 | virtual HRESULT STDMETHODCALLTYPE CreateCommandSignature( | ||
| 372 | _In_ const D3D12_COMMAND_SIGNATURE_DESC *pDesc, | ||
| 373 | _In_opt_ ID3D12RootSignature *pRootSignature, | ||
| 374 | REFIID riid, | ||
| 375 | _COM_Outptr_opt_ void **ppvCommandSignature) override | ||
| 376 | { | ||
| 377 | return S_OK; | ||
| 378 | } | ||
| 379 | |||
| 380 | virtual void STDMETHODCALLTYPE GetResourceTiling( | ||
| 381 | _In_ ID3D12Resource *pTiledResource, | ||
| 382 | _Out_opt_ UINT *pNumTilesForEntireResource, | ||
| 383 | _Out_opt_ D3D12_PACKED_MIP_INFO *pPackedMipDesc, | ||
| 384 | _Out_opt_ D3D12_TILE_SHAPE *pStandardTileShapeForNonPackedMips, | ||
| 385 | _Inout_opt_ UINT *pNumSubresourceTilings, | ||
| 386 | _In_ UINT FirstSubresourceTilingToGet, | ||
| 387 | _Out_writes_(*pNumSubresourceTilings) D3D12_SUBRESOURCE_TILING *pSubresourceTilingsForNonPackedMips) override | ||
| 388 | { | ||
| 389 | return; | ||
| 390 | } | ||
| 391 | |||
| 392 | #if defined(_MSC_VER) || !defined(_WIN32) | ||
| 393 | virtual LUID STDMETHODCALLTYPE GetAdapterLuid( void) override | ||
| 394 | { | ||
| 395 | LUID mockLuid = {}; | ||
| 396 | return mockLuid; | ||
| 397 | } | ||
| 398 | #else | ||
| 399 | virtual LUID *STDMETHODCALLTYPE GetAdapterLuid( | ||
| 400 | LUID * RetVal) override | ||
| 401 | { | ||
| 402 | if (RetVal) | ||
| 403 | { | ||
| 404 | *RetVal = {}; | ||
| 405 | } | ||
| 406 | return RetVal; | ||
| 407 | } | ||
| 408 | #endif | ||
| 409 | |||
| 410 | public: // ID3D12Object | ||
| 411 | virtual HRESULT STDMETHODCALLTYPE GetPrivateData( | ||
| 412 | _In_ REFGUID guid, | ||
| 413 | _Inout_ UINT *pDataSize, | ||
| 414 | _Out_writes_bytes_opt_( *pDataSize ) void *pData) override | ||
| 415 | { | ||
| 416 | return S_OK; | ||
| 417 | } | ||
| 418 | |||
| 419 | virtual HRESULT STDMETHODCALLTYPE SetPrivateData( | ||
| 420 | _In_ REFGUID guid, | ||
| 421 | _In_ UINT DataSize, | ||
| 422 | _In_reads_bytes_opt_( DataSize ) const void *pData) override | ||
| 423 | { | ||
| 424 | return S_OK; | ||
| 425 | } | ||
| 426 | |||
| 427 | virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface( | ||
| 428 | _In_ REFGUID guid, | ||
| 429 | _In_opt_ const IUnknown *pData) override | ||
| 430 | { | ||
| 431 | return S_OK; | ||
| 432 | } | ||
| 433 | |||
| 434 | virtual HRESULT STDMETHODCALLTYPE SetName( | ||
| 435 | _In_z_ LPCWSTR Name) override | ||
| 436 | { | ||
| 437 | return S_OK; | ||
| 438 | } | ||
| 439 | |||
| 440 | public: // IUnknown | ||
| 441 | virtual HRESULT STDMETHODCALLTYPE QueryInterface( | ||
| 442 | /* [in] */ REFIID riid, | ||
| 443 | /* [iid_is][out] */ _COM_Outptr_ void __RPC_FAR *__RPC_FAR *ppvObject) override | ||
| 444 | { | ||
| 445 | *ppvObject = this; | ||
| 446 | return S_OK; | ||
| 447 | } | ||
| 448 | |||
| 449 | virtual ULONG STDMETHODCALLTYPE AddRef() override | ||
| 450 | { | ||
| 451 | // Casual implementation. No actual actions | ||
| 452 | return 0; | ||
| 453 | } | ||
| 454 | |||
| 455 | virtual ULONG STDMETHODCALLTYPE Release() override | ||
| 456 | { | ||
| 457 | return 0; | ||
| 458 | } | ||
| 459 | |||
| 460 | |||
| 461 | // Major function we need to work with | ||
| 462 | virtual HRESULT STDMETHODCALLTYPE CheckFeatureSupport( | ||
| 463 | D3D12_FEATURE Feature, | ||
| 464 | _Inout_updates_bytes_(FeatureSupportDataSize) void *pFeatureSupportData, | ||
| 465 | UINT FeatureSupportDataSize | ||
| 466 | ) override | ||
| 467 | { | ||
| 468 | switch( Feature ) | ||
| 469 | { | ||
| 470 | case D3D12_FEATURE_D3D12_OPTIONS: | ||
| 471 | { | ||
| 472 | D3D12_FEATURE_DATA_D3D12_OPTIONS* pD3D12Options = static_cast<D3D12_FEATURE_DATA_D3D12_OPTIONS*>(pFeatureSupportData); | ||
| 473 | if (FeatureSupportDataSize != sizeof(D3D12_FEATURE_DATA_D3D12_OPTIONS)) | ||
| 474 | { | ||
| 475 | return E_INVALIDARG; | ||
| 476 | } | ||
| 477 | pD3D12Options->DoublePrecisionFloatShaderOps = m_DoublePrecisionFloatShaderOps; | ||
| 478 | pD3D12Options->OutputMergerLogicOp = m_OutputMergerLogicOp; | ||
| 479 | pD3D12Options->MinPrecisionSupport = m_ShaderMinPrecisionSupport10Bit | m_ShaderMinPrecisionSupport16Bit; | ||
| 480 | pD3D12Options->TiledResourcesTier = m_TiledResourcesTier; | ||
| 481 | pD3D12Options->ResourceBindingTier = m_ResourceBindingTier; | ||
| 482 | pD3D12Options->PSSpecifiedStencilRefSupported = (m_FeatureLevel >= D3D_FEATURE_LEVEL_11_1) && m_PSSpecifiedStencilRefSupported; | ||
| 483 | pD3D12Options->TypedUAVLoadAdditionalFormats = (m_FeatureLevel >= D3D_FEATURE_LEVEL_11_0) && m_TypedUAVLoadAdditionalFormats; | ||
| 484 | pD3D12Options->ROVsSupported = (m_FeatureLevel >= D3D_FEATURE_LEVEL_11_0) && m_ROVsSupported; | ||
| 485 | pD3D12Options->ConservativeRasterizationTier = (m_FeatureLevel >= D3D_FEATURE_LEVEL_11_1) ? m_ConservativeRasterizationTier : D3D12_CONSERVATIVE_RASTERIZATION_TIER_NOT_SUPPORTED; | ||
| 486 | pD3D12Options->MaxGPUVirtualAddressBitsPerResource = m_MaxGPUVirtualAddressBitsPerResource; | ||
| 487 | pD3D12Options->StandardSwizzle64KBSupported = m_StandardSwizzle64KBSupported; | ||
| 488 | #ifdef DX_ASTC_PROTOTYPE_ENABLED | ||
| 489 | pD3D12Options->ASTCProfile = ASTCProfile(); | ||
| 490 | #endif | ||
| 491 | pD3D12Options->CrossNodeSharingTier = m_CrossNodeSharingTier; | ||
| 492 | pD3D12Options->CrossAdapterRowMajorTextureSupported = m_CrossAdapterRowMajorTextureSupported; | ||
| 493 | pD3D12Options->VPAndRTArrayIndexFromAnyShaderFeedingRasterizerSupportedWithoutGSEmulation = m_VPAndRTArrayIndexFromAnyShaderFeedingRasterizerSupportedWithoutGSEmulation; | ||
| 494 | pD3D12Options->ResourceHeapTier = m_ResourceHeapTier; | ||
| 495 | } return S_OK; | ||
| 496 | |||
| 497 | case D3D12_FEATURE_D3D12_OPTIONS1: | ||
| 498 | { | ||
| 499 | if (!m_Options1Available) | ||
| 500 | { | ||
| 501 | return E_INVALIDARG; | ||
| 502 | } | ||
| 503 | D3D12_FEATURE_DATA_D3D12_OPTIONS1* pD3D12Options1 = static_cast<D3D12_FEATURE_DATA_D3D12_OPTIONS1*>(pFeatureSupportData); | ||
| 504 | if (FeatureSupportDataSize != sizeof(D3D12_FEATURE_DATA_D3D12_OPTIONS1)) | ||
| 505 | { | ||
| 506 | return E_INVALIDARG; | ||
| 507 | } | ||
| 508 | pD3D12Options1->WaveOps = m_WaveOpsSupported; | ||
| 509 | pD3D12Options1->WaveLaneCountMin = m_WaveLaneCountMin; | ||
| 510 | pD3D12Options1->WaveLaneCountMax = m_WaveLaneCountMax; | ||
| 511 | pD3D12Options1->TotalLaneCount = m_TotalLaneCount; | ||
| 512 | pD3D12Options1->ExpandedComputeResourceStates = m_ExpandedComputeResourceStates; | ||
| 513 | pD3D12Options1->Int64ShaderOps = m_Int64ShaderOpsSupported; | ||
| 514 | } return S_OK; | ||
| 515 | |||
| 516 | |||
| 517 | case D3D12_FEATURE_D3D12_OPTIONS2: | ||
| 518 | { | ||
| 519 | if (!m_Options2Available) | ||
| 520 | { | ||
| 521 | return E_INVALIDARG; | ||
| 522 | } | ||
| 523 | |||
| 524 | D3D12_FEATURE_DATA_D3D12_OPTIONS2* pD3D12Options2 = static_cast<D3D12_FEATURE_DATA_D3D12_OPTIONS2*>(pFeatureSupportData); | ||
| 525 | if (FeatureSupportDataSize != sizeof(D3D12_FEATURE_DATA_D3D12_OPTIONS2)) | ||
| 526 | { | ||
| 527 | return E_INVALIDARG; | ||
| 528 | } | ||
| 529 | pD3D12Options2->DepthBoundsTestSupported = m_DepthBoundsTestSupport; | ||
| 530 | pD3D12Options2->ProgrammableSamplePositionsTier = m_ProgrammableSamplePositionsTier; | ||
| 531 | } return S_OK; | ||
| 532 | |||
| 533 | case D3D12_FEATURE_ROOT_SIGNATURE: | ||
| 534 | { | ||
| 535 | if (!m_RootSignatureAvailable) | ||
| 536 | { | ||
| 537 | return E_INVALIDARG; | ||
| 538 | } | ||
| 539 | D3D12_FEATURE_DATA_ROOT_SIGNATURE* pRootSig = static_cast<D3D12_FEATURE_DATA_ROOT_SIGNATURE*>(pFeatureSupportData); | ||
| 540 | if (FeatureSupportDataSize != sizeof(D3D12_FEATURE_DATA_ROOT_SIGNATURE)) | ||
| 541 | { | ||
| 542 | return E_INVALIDARG; | ||
| 543 | } | ||
| 544 | switch (pRootSig->HighestVersion) | ||
| 545 | { | ||
| 546 | case D3D_ROOT_SIGNATURE_VERSION_1_0: | ||
| 547 | case D3D_ROOT_SIGNATURE_VERSION_1_1: | ||
| 548 | break; | ||
| 549 | default: | ||
| 550 | return E_INVALIDARG; | ||
| 551 | } | ||
| 552 | pRootSig->HighestVersion = static_cast<D3D_ROOT_SIGNATURE_VERSION>(std::min<int>(pRootSig->HighestVersion, m_RootSignatureHighestVersion)); | ||
| 553 | } return S_OK; | ||
| 554 | |||
| 555 | |||
| 556 | case D3D12_FEATURE_ARCHITECTURE: | ||
| 557 | { | ||
| 558 | D3D12_FEATURE_DATA_ARCHITECTURE* pFData = | ||
| 559 | static_cast< D3D12_FEATURE_DATA_ARCHITECTURE* >( pFeatureSupportData ); | ||
| 560 | if (FeatureSupportDataSize != sizeof( *pFData )) | ||
| 561 | { | ||
| 562 | return E_INVALIDARG; | ||
| 563 | } | ||
| 564 | |||
| 565 | // Testing only | ||
| 566 | // If Architecture1 is available, use data from architecture1 | ||
| 567 | if (m_Architecture1Available) | ||
| 568 | { | ||
| 569 | D3D12_FEATURE_DATA_ARCHITECTURE1 CurFData; | ||
| 570 | CurFData.NodeIndex = pFData->NodeIndex; | ||
| 571 | |||
| 572 | HRESULT hr; | ||
| 573 | if (FAILED( hr = CheckFeatureSupport( D3D12_FEATURE_ARCHITECTURE1, &CurFData, sizeof( CurFData ) ) )) | ||
| 574 | { | ||
| 575 | return hr; | ||
| 576 | } | ||
| 577 | |||
| 578 | pFData->TileBasedRenderer = CurFData.TileBasedRenderer; | ||
| 579 | pFData->UMA = CurFData.UMA; | ||
| 580 | pFData->CacheCoherentUMA = CurFData.CacheCoherentUMA; | ||
| 581 | } | ||
| 582 | else // Otherwise, load the data directly | ||
| 583 | { | ||
| 584 | // The original procedure will generate and return an E_INVALIDARG error if the NodeIndex is out of scope | ||
| 585 | // Mocking the behavior here by returning the rror | ||
| 586 | if (!(pFData->NodeIndex < m_NodeCount)) | ||
| 587 | { | ||
| 588 | return E_INVALIDARG; | ||
| 589 | } | ||
| 590 | pFData->TileBasedRenderer = m_TileBasedRenderer[pFData->NodeIndex]; | ||
| 591 | pFData->UMA = m_UMA[pFData->NodeIndex]; | ||
| 592 | pFData->CacheCoherentUMA = m_CacheCoherentUMA[pFData->NodeIndex]; | ||
| 593 | // Note that Architecture doesn't have the IsolatedMMU field. | ||
| 594 | } | ||
| 595 | } return S_OK; | ||
| 596 | case D3D12_FEATURE_ARCHITECTURE1: | ||
| 597 | { | ||
| 598 | // Mocking the case where ARCHITECTURE1 is not supported | ||
| 599 | if (!m_Architecture1Available || !m_ArchitectureSucceed) { | ||
| 600 | return E_INVALIDARG; | ||
| 601 | } | ||
| 602 | |||
| 603 | D3D12_FEATURE_DATA_ARCHITECTURE1* pFData = | ||
| 604 | static_cast< D3D12_FEATURE_DATA_ARCHITECTURE1* >( pFeatureSupportData ); | ||
| 605 | if (FeatureSupportDataSize != sizeof( *pFData )) | ||
| 606 | { | ||
| 607 | return E_INVALIDARG; | ||
| 608 | } | ||
| 609 | |||
| 610 | // The original procedure will generate and return an E_INVALIDARG error if the NodeIndex is out of scope | ||
| 611 | // Mocking the behavior here by returning the rror | ||
| 612 | if (!(pFData->NodeIndex < m_NodeCount)) | ||
| 613 | { | ||
| 614 | return E_INVALIDARG; | ||
| 615 | } | ||
| 616 | |||
| 617 | UINT localIndex = pFData->NodeIndex; | ||
| 618 | pFData->TileBasedRenderer = m_TileBasedRenderer[localIndex]; | ||
| 619 | pFData->UMA = m_UMA[localIndex]; | ||
| 620 | pFData->CacheCoherentUMA = m_CacheCoherentUMA[localIndex]; | ||
| 621 | pFData->IsolatedMMU = m_IsolatedMMU[localIndex]; | ||
| 622 | |||
| 623 | } return S_OK; | ||
| 624 | |||
| 625 | case D3D12_FEATURE_FEATURE_LEVELS: | ||
| 626 | { | ||
| 627 | D3D12_FEATURE_DATA_FEATURE_LEVELS* pFData = | ||
| 628 | static_cast< D3D12_FEATURE_DATA_FEATURE_LEVELS* >( pFeatureSupportData ); | ||
| 629 | if (FeatureSupportDataSize != sizeof( *pFData )) | ||
| 630 | { | ||
| 631 | return E_INVALIDARG; | ||
| 632 | } | ||
| 633 | |||
| 634 | if (pFData->NumFeatureLevels == 0 || pFData->pFeatureLevelsRequested == nullptr) | ||
| 635 | { | ||
| 636 | return E_INVALIDARG; | ||
| 637 | } | ||
| 638 | |||
| 639 | pFData->MaxSupportedFeatureLevel = D3D_FEATURE_LEVEL(0); | ||
| 640 | for (UINT i = 0; i < pFData->NumFeatureLevels; ++i) | ||
| 641 | { | ||
| 642 | if (pFData->pFeatureLevelsRequested[i] <= m_FeatureLevel && | ||
| 643 | pFData->pFeatureLevelsRequested[i] > pFData->MaxSupportedFeatureLevel) | ||
| 644 | { | ||
| 645 | pFData->MaxSupportedFeatureLevel = pFData->pFeatureLevelsRequested[i]; | ||
| 646 | } | ||
| 647 | } | ||
| 648 | return pFData->MaxSupportedFeatureLevel == D3D_FEATURE_LEVEL(0) ? | ||
| 649 | DXGI_ERROR_UNSUPPORTED : S_OK; | ||
| 650 | } | ||
| 651 | |||
| 652 | case D3D12_FEATURE_FORMAT_SUPPORT: | ||
| 653 | { | ||
| 654 | D3D12_FEATURE_DATA_FORMAT_SUPPORT* pFData = | ||
| 655 | static_cast< D3D12_FEATURE_DATA_FORMAT_SUPPORT* >( pFeatureSupportData ); | ||
| 656 | if (FeatureSupportDataSize != sizeof( *pFData )) | ||
| 657 | { | ||
| 658 | return E_INVALIDARG; | ||
| 659 | } | ||
| 660 | m_FormatReceived = pFData->Format; | ||
| 661 | pFData->Support1 = m_FormatSupport1; | ||
| 662 | pFData->Support2 = m_FormatSupport2; | ||
| 663 | // Based on the original implementation, if there's no support for the format, return an E_FAIL | ||
| 664 | if (m_FormatSupport1 == D3D12_FORMAT_SUPPORT1_NONE && m_FormatSupport2 == D3D12_FORMAT_SUPPORT2_NONE) | ||
| 665 | { | ||
| 666 | return E_FAIL; | ||
| 667 | } | ||
| 668 | } return S_OK; | ||
| 669 | |||
| 670 | case D3D12_FEATURE_MULTISAMPLE_QUALITY_LEVELS: | ||
| 671 | { | ||
| 672 | D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS* pFData = | ||
| 673 | static_cast< D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS* >( pFeatureSupportData ); | ||
| 674 | if (FeatureSupportDataSize != sizeof( *pFData )) | ||
| 675 | { | ||
| 676 | return E_INVALIDARG; | ||
| 677 | } | ||
| 678 | |||
| 679 | m_FormatReceived = pFData->Format; | ||
| 680 | m_SampleCountReceived = pFData->SampleCount; | ||
| 681 | m_MultisampleQualityLevelFlagsReceived = pFData->Flags; | ||
| 682 | |||
| 683 | // The original check implementation may return E_FAIL | ||
| 684 | // Valid results are non-negative values including 0, smaller than D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT | ||
| 685 | if (!m_MultisampleQualityLevelsSucceed) | ||
| 686 | { | ||
| 687 | // NumQualityLevels will be set to 0 should the check fails | ||
| 688 | pFData->NumQualityLevels = 0; | ||
| 689 | return E_FAIL; | ||
| 690 | } | ||
| 691 | |||
| 692 | pFData->NumQualityLevels = m_NumQualityLevels; | ||
| 693 | } return S_OK; | ||
| 694 | case D3D12_FEATURE_FORMAT_INFO: | ||
| 695 | { | ||
| 696 | D3D12_FEATURE_DATA_FORMAT_INFO* pFData = | ||
| 697 | static_cast< D3D12_FEATURE_DATA_FORMAT_INFO* > ( pFeatureSupportData ); | ||
| 698 | if (FeatureSupportDataSize != sizeof( *pFData )) | ||
| 699 | { | ||
| 700 | return E_INVALIDARG; | ||
| 701 | } | ||
| 702 | |||
| 703 | m_FormatReceived = pFData->Format; | ||
| 704 | |||
| 705 | // If the format is not supported, an E_INVALIDARG will be returned | ||
| 706 | if (!m_DXGIFormatSupported) | ||
| 707 | { | ||
| 708 | return E_INVALIDARG; | ||
| 709 | } | ||
| 710 | |||
| 711 | pFData->PlaneCount = m_PlaneCount; | ||
| 712 | |||
| 713 | } return S_OK; | ||
| 714 | case D3D12_FEATURE_GPU_VIRTUAL_ADDRESS_SUPPORT: | ||
| 715 | { | ||
| 716 | D3D12_FEATURE_DATA_GPU_VIRTUAL_ADDRESS_SUPPORT* pFData = | ||
| 717 | static_cast< D3D12_FEATURE_DATA_GPU_VIRTUAL_ADDRESS_SUPPORT* >( pFeatureSupportData ); | ||
| 718 | if (FeatureSupportDataSize != sizeof( *pFData )) | ||
| 719 | { | ||
| 720 | return E_INVALIDARG; | ||
| 721 | } | ||
| 722 | pFData->MaxGPUVirtualAddressBitsPerProcess = m_MaxGPUVirtualAddressBitsPerProcess; | ||
| 723 | pFData->MaxGPUVirtualAddressBitsPerResource = m_MaxGPUVirtualAddressBitsPerResource; | ||
| 724 | |||
| 725 | } return S_OK; | ||
| 726 | case D3D12_FEATURE_SHADER_MODEL: | ||
| 727 | { | ||
| 728 | D3D12_FEATURE_DATA_SHADER_MODEL* pSM = | ||
| 729 | static_cast<D3D12_FEATURE_DATA_SHADER_MODEL*>(pFeatureSupportData); | ||
| 730 | if (FeatureSupportDataSize != sizeof(*pSM)) | ||
| 731 | { | ||
| 732 | return E_INVALIDARG; | ||
| 733 | } | ||
| 734 | switch (pSM->HighestShaderModel) | ||
| 735 | { | ||
| 736 | case D3D_SHADER_MODEL_5_1: | ||
| 737 | case D3D_SHADER_MODEL_6_0: | ||
| 738 | case D3D_SHADER_MODEL_6_1: | ||
| 739 | case D3D_SHADER_MODEL_6_2: | ||
| 740 | case D3D_SHADER_MODEL_6_3: | ||
| 741 | case D3D_SHADER_MODEL_6_4: | ||
| 742 | case D3D_SHADER_MODEL_6_5: | ||
| 743 | case D3D_SHADER_MODEL_6_6: | ||
| 744 | case D3D_SHADER_MODEL_6_7: | ||
| 745 | break; | ||
| 746 | default: | ||
| 747 | return E_INVALIDARG; | ||
| 748 | } | ||
| 749 | pSM->HighestShaderModel = static_cast<D3D_SHADER_MODEL>(std::min<int>(pSM->HighestShaderModel,m_HighestSupportedShaderModel)); | ||
| 750 | } return S_OK; | ||
| 751 | case D3D12_FEATURE_SHADER_CACHE: | ||
| 752 | { | ||
| 753 | if (!m_ShaderCacheAvailable) | ||
| 754 | { | ||
| 755 | return E_INVALIDARG; | ||
| 756 | } | ||
| 757 | D3D12_FEATURE_DATA_SHADER_CACHE* pFlags = | ||
| 758 | static_cast<D3D12_FEATURE_DATA_SHADER_CACHE*>(pFeatureSupportData); | ||
| 759 | if (FeatureSupportDataSize != sizeof(*pFlags)) | ||
| 760 | { | ||
| 761 | return E_INVALIDARG; | ||
| 762 | } | ||
| 763 | pFlags->SupportFlags = m_ShaderCacheSupportFlags; | ||
| 764 | } return S_OK; | ||
| 765 | case D3D12_FEATURE_COMMAND_QUEUE_PRIORITY: | ||
| 766 | { | ||
| 767 | if (!m_CommandQueuePriorityAvailable) | ||
| 768 | { | ||
| 769 | return E_INVALIDARG; | ||
| 770 | } | ||
| 771 | D3D12_FEATURE_DATA_COMMAND_QUEUE_PRIORITY* pFlags = | ||
| 772 | static_cast<D3D12_FEATURE_DATA_COMMAND_QUEUE_PRIORITY*>(pFeatureSupportData); | ||
| 773 | if (FeatureSupportDataSize != sizeof(*pFlags)) | ||
| 774 | { | ||
| 775 | return E_INVALIDARG; | ||
| 776 | } | ||
| 777 | |||
| 778 | if (pFlags->CommandListType >= D3D12_COMMAND_LIST_TYPE_VIDEO_ENCODE+1) | ||
| 779 | { | ||
| 780 | return E_INVALIDARG; | ||
| 781 | } | ||
| 782 | |||
| 783 | if (pFlags->Priority == D3D12_COMMAND_QUEUE_PRIORITY_NORMAL || pFlags->Priority == D3D12_COMMAND_QUEUE_PRIORITY_HIGH) | ||
| 784 | { | ||
| 785 | pFlags->PriorityForTypeIsSupported = TRUE; | ||
| 786 | } | ||
| 787 | else if (pFlags->Priority == D3D12_COMMAND_QUEUE_PRIORITY_GLOBAL_REALTIME) | ||
| 788 | { | ||
| 789 | pFlags->PriorityForTypeIsSupported = m_GlobalRealtimeCommandQueueSupport; // Simplified | ||
| 790 | } | ||
| 791 | else | ||
| 792 | { | ||
| 793 | return E_INVALIDARG; | ||
| 794 | } | ||
| 795 | |||
| 796 | } return S_OK; | ||
| 797 | |||
| 798 | case D3D12_FEATURE_PROTECTED_RESOURCE_SESSION_SUPPORT: | ||
| 799 | { | ||
| 800 | if (!m_ProtectedResourceSessionAvailable) | ||
| 801 | { | ||
| 802 | return E_INVALIDARG; | ||
| 803 | } | ||
| 804 | D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_SUPPORT* pProtectedResourceSessionSupport = | ||
| 805 | static_cast<D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_SUPPORT*>(pFeatureSupportData); | ||
| 806 | if ( FeatureSupportDataSize != sizeof(*pProtectedResourceSessionSupport) | ||
| 807 | || pProtectedResourceSessionSupport->NodeIndex >= GetNodeCount()) | ||
| 808 | { | ||
| 809 | return E_INVALIDARG; | ||
| 810 | } | ||
| 811 | |||
| 812 | pProtectedResourceSessionSupport->Support = m_ContentProtectionSupported ? | ||
| 813 | m_ProtectedResourceSessionSupport[pProtectedResourceSessionSupport->NodeIndex] | ||
| 814 | : D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAG_NONE; | ||
| 815 | |||
| 816 | } return S_OK; | ||
| 817 | |||
| 818 | case D3D12_FEATURE_D3D12_OPTIONS3: | ||
| 819 | { | ||
| 820 | if (!m_Options3Available) | ||
| 821 | { | ||
| 822 | return E_INVALIDARG; | ||
| 823 | } | ||
| 824 | D3D12_FEATURE_DATA_D3D12_OPTIONS3* pD3D12Options3 = static_cast<D3D12_FEATURE_DATA_D3D12_OPTIONS3*>(pFeatureSupportData); | ||
| 825 | if (FeatureSupportDataSize != sizeof(D3D12_FEATURE_DATA_D3D12_OPTIONS3)) | ||
| 826 | { | ||
| 827 | return E_INVALIDARG; | ||
| 828 | } | ||
| 829 | pD3D12Options3->CopyQueueTimestampQueriesSupported = m_CopyQueueTimestampQueriesSupported; | ||
| 830 | pD3D12Options3->CastingFullyTypedFormatSupported = m_CastingFullyTypedFormatsSupported; | ||
| 831 | pD3D12Options3->WriteBufferImmediateSupportFlags = m_GetCachedWriteBufferImmediateSupportFlags; | ||
| 832 | pD3D12Options3->ViewInstancingTier = m_ViewInstancingTier; | ||
| 833 | pD3D12Options3->BarycentricsSupported = m_BarycentricsSupported; | ||
| 834 | |||
| 835 | } return S_OK; | ||
| 836 | case D3D12_FEATURE_EXISTING_HEAPS: | ||
| 837 | { | ||
| 838 | if (!m_ExistingHeapsAvailable) | ||
| 839 | { | ||
| 840 | return E_INVALIDARG; | ||
| 841 | } | ||
| 842 | auto* pSupport = static_cast<D3D12_FEATURE_DATA_EXISTING_HEAPS*>(pFeatureSupportData); | ||
| 843 | if (FeatureSupportDataSize != sizeof(*pSupport)) | ||
| 844 | { | ||
| 845 | return E_INVALIDARG; | ||
| 846 | } | ||
| 847 | pSupport->Supported = m_ExistingHeapCaps; | ||
| 848 | } return S_OK; | ||
| 849 | case D3D12_FEATURE_D3D12_OPTIONS4: | ||
| 850 | { | ||
| 851 | if (!m_Options4Available) | ||
| 852 | { | ||
| 853 | return E_INVALIDARG; | ||
| 854 | } | ||
| 855 | auto* pD3D12Options4 = static_cast<D3D12_FEATURE_DATA_D3D12_OPTIONS4*>(pFeatureSupportData); | ||
| 856 | if (FeatureSupportDataSize != sizeof(*pD3D12Options4)) | ||
| 857 | { | ||
| 858 | return E_INVALIDARG; | ||
| 859 | } | ||
| 860 | |||
| 861 | // Reserved Buffer Placement was cut, except for 64KB Aligned MSAA Textures | ||
| 862 | pD3D12Options4->MSAA64KBAlignedTextureSupported = m_MSAA64KBAlignedTextureSupported; | ||
| 863 | pD3D12Options4->SharedResourceCompatibilityTier = m_SharedResourceCompatibilityTier; // Simplified | ||
| 864 | pD3D12Options4->Native16BitShaderOpsSupported = m_Native16BitShaderOpsSupported; | ||
| 865 | } return S_OK; | ||
| 866 | case D3D12_FEATURE_SERIALIZATION: | ||
| 867 | { | ||
| 868 | if (!m_SerializationAvailable) | ||
| 869 | { | ||
| 870 | return E_INVALIDARG; | ||
| 871 | } | ||
| 872 | auto* pSerialization = static_cast<D3D12_FEATURE_DATA_SERIALIZATION*>(pFeatureSupportData); | ||
| 873 | if (FeatureSupportDataSize != sizeof(*pSerialization)) | ||
| 874 | { | ||
| 875 | return E_INVALIDARG; | ||
| 876 | } | ||
| 877 | |||
| 878 | const UINT NodeIndex = pSerialization->NodeIndex; | ||
| 879 | if (NodeIndex >= m_NodeCount) | ||
| 880 | { | ||
| 881 | return E_INVALIDARG; | ||
| 882 | } | ||
| 883 | pSerialization->HeapSerializationTier = m_HeapSerializationTier[NodeIndex]; | ||
| 884 | } return S_OK; | ||
| 885 | case D3D12_FEATURE_CROSS_NODE: | ||
| 886 | { | ||
| 887 | if (!m_CrossNodeAvailable) | ||
| 888 | { | ||
| 889 | return E_INVALIDARG; | ||
| 890 | } | ||
| 891 | auto* pCrossNode = static_cast<D3D12_FEATURE_DATA_CROSS_NODE*>(pFeatureSupportData); | ||
| 892 | if (FeatureSupportDataSize != sizeof(*pCrossNode)) | ||
| 893 | { | ||
| 894 | return E_INVALIDARG; | ||
| 895 | } | ||
| 896 | |||
| 897 | pCrossNode->SharingTier = m_CrossNodeSharingTier; | ||
| 898 | pCrossNode->AtomicShaderInstructions = m_AtomicShaderInstructions; | ||
| 899 | } return S_OK; | ||
| 900 | case D3D12_FEATURE_D3D12_OPTIONS5: | ||
| 901 | { | ||
| 902 | if (!m_Options5Available) | ||
| 903 | { | ||
| 904 | return E_INVALIDARG; | ||
| 905 | } | ||
| 906 | auto* pD3D12Options5 = static_cast<D3D12_FEATURE_DATA_D3D12_OPTIONS5*>(pFeatureSupportData); | ||
| 907 | if (FeatureSupportDataSize != sizeof(*pD3D12Options5)) | ||
| 908 | { | ||
| 909 | return E_INVALIDARG; | ||
| 910 | } | ||
| 911 | |||
| 912 | pD3D12Options5->RaytracingTier = m_RaytracingTier; | ||
| 913 | pD3D12Options5->RenderPassesTier = m_RenderPassesTier; | ||
| 914 | pD3D12Options5->SRVOnlyTiledResourceTier3 = m_SRVOnlyTiledResourceTier3; | ||
| 915 | } return S_OK; | ||
| 916 | case D3D12_FEATURE_DISPLAYABLE: | ||
| 917 | { | ||
| 918 | if (!m_DisplayableAvailable) | ||
| 919 | { | ||
| 920 | return E_INVALIDARG; | ||
| 921 | } | ||
| 922 | auto* pD3D12Displayable = static_cast<D3D12_FEATURE_DATA_DISPLAYABLE*>(pFeatureSupportData); | ||
| 923 | if (FeatureSupportDataSize != sizeof(*pD3D12Displayable)) // Feature_D3D1XDisplayable | ||
| 924 | { | ||
| 925 | return E_INVALIDARG; | ||
| 926 | } | ||
| 927 | |||
| 928 | pD3D12Displayable->DisplayableTexture = m_DisplayableTexture; | ||
| 929 | pD3D12Displayable->SharedResourceCompatibilityTier = m_SharedResourceCompatibilityTier; | ||
| 930 | } return S_OK; | ||
| 931 | |||
| 932 | case D3D12_FEATURE_D3D12_OPTIONS6: | ||
| 933 | { | ||
| 934 | if (!m_Options6Available) | ||
| 935 | { | ||
| 936 | return E_INVALIDARG; | ||
| 937 | } | ||
| 938 | |||
| 939 | auto* pD3D12Options6 = static_cast<D3D12_FEATURE_DATA_D3D12_OPTIONS6*>(pFeatureSupportData); | ||
| 940 | if (FeatureSupportDataSize != sizeof(*pD3D12Options6)) | ||
| 941 | { | ||
| 942 | return E_INVALIDARG; | ||
| 943 | } | ||
| 944 | pD3D12Options6->AdditionalShadingRatesSupported = m_AdditionalShadingRatesSupported; | ||
| 945 | pD3D12Options6->BackgroundProcessingSupported = m_BackgroundProcessingSupported; | ||
| 946 | pD3D12Options6->PerPrimitiveShadingRateSupportedWithViewportIndexing = m_PerPrimitiveShadingRateSupportedWithViewportIndexing; | ||
| 947 | pD3D12Options6->ShadingRateImageTileSize = m_ShadingRateImageTileSize; | ||
| 948 | pD3D12Options6->VariableShadingRateTier = m_VariableShadingRateTier; | ||
| 949 | } return S_OK; | ||
| 950 | case D3D12_FEATURE_QUERY_META_COMMAND: | ||
| 951 | { | ||
| 952 | if (m_QueryMetaCommandAvailable) | ||
| 953 | { | ||
| 954 | if (FeatureSupportDataSize != sizeof(D3D12_FEATURE_DATA_QUERY_META_COMMAND)) | ||
| 955 | { | ||
| 956 | return E_INVALIDARG; | ||
| 957 | } | ||
| 958 | |||
| 959 | // Only checks inputs and outputs | ||
| 960 | auto* pQueryData = static_cast<D3D12_FEATURE_DATA_QUERY_META_COMMAND*>(pFeatureSupportData); | ||
| 961 | m_CommandID = pQueryData->CommandId; | ||
| 962 | m_pQueryInputData = pQueryData->pQueryInputData; | ||
| 963 | m_NodeMask = pQueryData->NodeMask; | ||
| 964 | m_QueryInputDataSizeInBytes = pQueryData->QueryInputDataSizeInBytes; | ||
| 965 | |||
| 966 | pQueryData->QueryOutputDataSizeInBytes = m_QueryOutputDataSizeInBytes; | ||
| 967 | pQueryData->pQueryOutputData = m_pQueryOutputData; | ||
| 968 | } | ||
| 969 | else | ||
| 970 | { | ||
| 971 | return E_INVALIDARG; | ||
| 972 | } | ||
| 973 | } return S_OK; | ||
| 974 | case D3D12_FEATURE_D3D12_OPTIONS7: | ||
| 975 | { | ||
| 976 | if (!m_Options7Available) | ||
| 977 | { | ||
| 978 | return E_INVALIDARG; | ||
| 979 | } | ||
| 980 | auto* pD3D12Options7 = static_cast<D3D12_FEATURE_DATA_D3D12_OPTIONS7*>(pFeatureSupportData); | ||
| 981 | if (FeatureSupportDataSize != sizeof(*pD3D12Options7)) | ||
| 982 | { | ||
| 983 | return E_INVALIDARG; | ||
| 984 | } | ||
| 985 | |||
| 986 | pD3D12Options7->MeshShaderTier = m_MeshShaderTier; | ||
| 987 | pD3D12Options7->SamplerFeedbackTier = m_SamplerFeedbackTier; | ||
| 988 | } return S_OK; | ||
| 989 | case D3D12_FEATURE_PROTECTED_RESOURCE_SESSION_TYPE_COUNT: | ||
| 990 | { | ||
| 991 | if (!m_ProtectedResourceSessionTypeCountAvailable) | ||
| 992 | { | ||
| 993 | return E_INVALIDARG; | ||
| 994 | } | ||
| 995 | auto* pProtectedResourceSessionTypesCount = | ||
| 996 | static_cast<D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_TYPE_COUNT*>(pFeatureSupportData); | ||
| 997 | if ( FeatureSupportDataSize != sizeof(*pProtectedResourceSessionTypesCount) | ||
| 998 | || pProtectedResourceSessionTypesCount->NodeIndex >= GetNodeCount()) | ||
| 999 | { | ||
| 1000 | return E_INVALIDARG; | ||
| 1001 | } | ||
| 1002 | |||
| 1003 | pProtectedResourceSessionTypesCount->Count = m_ProtectedResourceSessionTypeCount[pProtectedResourceSessionTypesCount->NodeIndex]; | ||
| 1004 | } return S_OK; | ||
| 1005 | case D3D12_FEATURE_PROTECTED_RESOURCE_SESSION_TYPES: | ||
| 1006 | { | ||
| 1007 | if (!m_ProtectedResourceSessionTypesAvailable) | ||
| 1008 | { | ||
| 1009 | return E_INVALIDARG; | ||
| 1010 | } | ||
| 1011 | auto* pProtectedResourceSessionTypes = | ||
| 1012 | static_cast<D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_TYPES*>(pFeatureSupportData); | ||
| 1013 | if ( FeatureSupportDataSize != sizeof(*pProtectedResourceSessionTypes) | ||
| 1014 | || pProtectedResourceSessionTypes->NodeIndex >= GetNodeCount()) | ||
| 1015 | { | ||
| 1016 | return E_INVALIDARG; | ||
| 1017 | } | ||
| 1018 | UINT ExpectedCount = m_ProtectedResourceSessionTypeCount[pProtectedResourceSessionTypes->NodeIndex]; | ||
| 1019 | if (pProtectedResourceSessionTypes->Count != ExpectedCount) | ||
| 1020 | { | ||
| 1021 | return E_INVALIDARG; | ||
| 1022 | } | ||
| 1023 | |||
| 1024 | if (ExpectedCount > 0) | ||
| 1025 | { | ||
| 1026 | memcpy(pProtectedResourceSessionTypes->pTypes, m_ProtectedResourceSessionTypes[pProtectedResourceSessionTypes->NodeIndex].data(), ExpectedCount * sizeof(*pProtectedResourceSessionTypes->pTypes)); | ||
| 1027 | } | ||
| 1028 | |||
| 1029 | } return S_OK; | ||
| 1030 | |||
| 1031 | case D3D12_FEATURE_D3D12_OPTIONS8: | ||
| 1032 | { | ||
| 1033 | if (!m_Options8Available) | ||
| 1034 | { | ||
| 1035 | return E_INVALIDARG; | ||
| 1036 | } | ||
| 1037 | D3D12_FEATURE_DATA_D3D12_OPTIONS8 *pD3D12Options8 = static_cast<D3D12_FEATURE_DATA_D3D12_OPTIONS8*>(pFeatureSupportData); | ||
| 1038 | if (FeatureSupportDataSize != sizeof(*pD3D12Options8)) | ||
| 1039 | { | ||
| 1040 | return E_INVALIDARG; | ||
| 1041 | } | ||
| 1042 | |||
| 1043 | pD3D12Options8->UnalignedBlockTexturesSupported = m_UnalignedBlockTexturesSupported; | ||
| 1044 | } return S_OK; | ||
| 1045 | case D3D12_FEATURE_D3D12_OPTIONS9: | ||
| 1046 | { | ||
| 1047 | if (!m_Options9Available) | ||
| 1048 | { | ||
| 1049 | return E_INVALIDARG; | ||
| 1050 | } | ||
| 1051 | D3D12_FEATURE_DATA_D3D12_OPTIONS9 *pD3D12Options9 = static_cast<D3D12_FEATURE_DATA_D3D12_OPTIONS9*>(pFeatureSupportData); | ||
| 1052 | if (FeatureSupportDataSize != sizeof(*pD3D12Options9)) | ||
| 1053 | { | ||
| 1054 | return E_INVALIDARG; | ||
| 1055 | } | ||
| 1056 | |||
| 1057 | pD3D12Options9->AtomicInt64OnGroupSharedSupported = m_AtomicInt64OnGroupSharedSupported; | ||
| 1058 | pD3D12Options9->AtomicInt64OnTypedResourceSupported = m_AtomicInt64OnTypedResourceSupported; | ||
| 1059 | pD3D12Options9->DerivativesInMeshAndAmplificationShadersSupported = m_DerivativesInMeshAndAmplificationShadersSupported; | ||
| 1060 | pD3D12Options9->MeshShaderPipelineStatsSupported = m_MeshShaderPipelineStatsSupported; | ||
| 1061 | pD3D12Options9->MeshShaderSupportsFullRangeRenderTargetArrayIndex = m_MeshShaderSupportsFullRangeRenderTargetArrayIndex; | ||
| 1062 | pD3D12Options9->WaveMMATier = m_WaveMMATier; | ||
| 1063 | } return S_OK; | ||
| 1064 | case D3D12_FEATURE_D3D12_OPTIONS10: | ||
| 1065 | { | ||
| 1066 | if (!m_Options10Available) | ||
| 1067 | { | ||
| 1068 | return E_INVALIDARG; | ||
| 1069 | } | ||
| 1070 | D3D12_FEATURE_DATA_D3D12_OPTIONS10* pD3D12Options10 = static_cast<D3D12_FEATURE_DATA_D3D12_OPTIONS10*>(pFeatureSupportData); | ||
| 1071 | if (FeatureSupportDataSize != sizeof(*pD3D12Options10)) | ||
| 1072 | { | ||
| 1073 | return E_INVALIDARG; | ||
| 1074 | } | ||
| 1075 | |||
| 1076 | pD3D12Options10->MeshShaderPerPrimitiveShadingRateSupported = m_MeshShaderPerPrimitiveShadingRateSupported; | ||
| 1077 | pD3D12Options10->VariableRateShadingSumCombinerSupported = m_VariableRateShadingSumCombinerSupported; | ||
| 1078 | } return S_OK; | ||
| 1079 | case D3D12_FEATURE_D3D12_OPTIONS11: | ||
| 1080 | { | ||
| 1081 | if (!m_Options11Available) | ||
| 1082 | { | ||
| 1083 | return E_INVALIDARG; | ||
| 1084 | } | ||
| 1085 | D3D12_FEATURE_DATA_D3D12_OPTIONS11* pD3D12Options11 = static_cast<D3D12_FEATURE_DATA_D3D12_OPTIONS11*>(pFeatureSupportData); | ||
| 1086 | if (FeatureSupportDataSize != sizeof(*pD3D12Options11)) | ||
| 1087 | { | ||
| 1088 | return E_INVALIDARG; | ||
| 1089 | } | ||
| 1090 | |||
| 1091 | pD3D12Options11->AtomicInt64OnDescriptorHeapResourceSupported = m_AtomicInt64OnDescriptorHeapResourceSupported; | ||
| 1092 | } return S_OK; | ||
| 1093 | case D3D12_FEATURE_D3D12_OPTIONS12: | ||
| 1094 | { | ||
| 1095 | if (!m_Options12Available) | ||
| 1096 | { | ||
| 1097 | return E_INVALIDARG; | ||
| 1098 | } | ||
| 1099 | D3D12_FEATURE_DATA_D3D12_OPTIONS12* pD3D12Options12 = static_cast<D3D12_FEATURE_DATA_D3D12_OPTIONS12*>(pFeatureSupportData); | ||
| 1100 | if (FeatureSupportDataSize != sizeof(*pD3D12Options12)) | ||
| 1101 | { | ||
| 1102 | return E_INVALIDARG; | ||
| 1103 | } | ||
| 1104 | |||
| 1105 | pD3D12Options12->MSPrimitivesPipelineStatisticIncludesCulledPrimitives = m_MSPrimitivesPipelineStatisticIncludesCulledPrimitives; | ||
| 1106 | pD3D12Options12->EnhancedBarriersSupported = m_EnhancedBarriersSupported; | ||
| 1107 | } return S_OK; | ||
| 1108 | |||
| 1109 | default: | ||
| 1110 | return E_INVALIDARG; | ||
| 1111 | } | ||
| 1112 | } | ||
| 1113 | |||
| 1114 | public: // For simplicity, allow tests to set the internal state values for this mock class | ||
| 1115 | // General | ||
| 1116 | UINT m_NodeCount; // Simulated number of computing nodes | ||
| 1117 | |||
| 1118 | // 0: Options | ||
| 1119 | bool m_D3D12OptionsAvailable = true; | ||
| 1120 | BOOL m_DoublePrecisionFloatShaderOps = false; | ||
| 1121 | BOOL m_OutputMergerLogicOp = false; | ||
| 1122 | D3D12_SHADER_MIN_PRECISION_SUPPORT m_ShaderMinPrecisionSupport10Bit = D3D12_SHADER_MIN_PRECISION_SUPPORT_NONE; | ||
| 1123 | D3D12_SHADER_MIN_PRECISION_SUPPORT m_ShaderMinPrecisionSupport16Bit = D3D12_SHADER_MIN_PRECISION_SUPPORT_NONE; | ||
| 1124 | D3D12_TILED_RESOURCES_TIER m_TiledResourcesTier = D3D12_TILED_RESOURCES_TIER_NOT_SUPPORTED; | ||
| 1125 | D3D12_RESOURCE_BINDING_TIER m_ResourceBindingTier = (D3D12_RESOURCE_BINDING_TIER)0; | ||
| 1126 | BOOL m_PSSpecifiedStencilRefSupported = false; | ||
| 1127 | BOOL m_TypedUAVLoadAdditionalFormats = false; | ||
| 1128 | BOOL m_ROVsSupported = false; | ||
| 1129 | D3D12_CONSERVATIVE_RASTERIZATION_TIER m_ConservativeRasterizationTier = D3D12_CONSERVATIVE_RASTERIZATION_TIER_NOT_SUPPORTED; | ||
| 1130 | UINT m_MaxGPUVirtualAddressBitsPerResource = 0; | ||
| 1131 | BOOL m_StandardSwizzle64KBSupported = false; | ||
| 1132 | D3D12_CROSS_NODE_SHARING_TIER m_CrossNodeSharingTier = D3D12_CROSS_NODE_SHARING_TIER_NOT_SUPPORTED; | ||
| 1133 | BOOL m_CrossAdapterRowMajorTextureSupported = false; | ||
| 1134 | BOOL m_VPAndRTArrayIndexFromAnyShaderFeedingRasterizerSupportedWithoutGSEmulation = false; | ||
| 1135 | D3D12_RESOURCE_HEAP_TIER m_ResourceHeapTier = (D3D12_RESOURCE_HEAP_TIER)0; | ||
| 1136 | |||
| 1137 | // 1: Architecture & 16: Architecture1 | ||
| 1138 | bool m_ArchitectureSucceed = true; | ||
| 1139 | bool m_Architecture1Available = false; // Mock the case where Architecture1 is not supported | ||
| 1140 | std::vector<BOOL> m_TileBasedRenderer; | ||
| 1141 | std::vector<BOOL> m_UMA; | ||
| 1142 | std::vector<BOOL> m_CacheCoherentUMA; | ||
| 1143 | std::vector<BOOL> m_IsolatedMMU; | ||
| 1144 | |||
| 1145 | // 2: Feature Levels | ||
| 1146 | bool m_FeatureLevelsAvailable = true; | ||
| 1147 | D3D_FEATURE_LEVEL m_FeatureLevel = D3D_FEATURE_LEVEL_12_0; // Set higher to allow other tests to pass correctly | ||
| 1148 | |||
| 1149 | // 3: Feature Format Support | ||
| 1150 | // Forwarding call only. Make sure that the input parameters are correctly forwarded | ||
| 1151 | bool m_FormatSupportAvailable = true; | ||
| 1152 | DXGI_FORMAT m_FormatReceived; | ||
| 1153 | D3D12_FORMAT_SUPPORT1 m_FormatSupport1 = D3D12_FORMAT_SUPPORT1_NONE; | ||
| 1154 | D3D12_FORMAT_SUPPORT2 m_FormatSupport2 = D3D12_FORMAT_SUPPORT2_NONE; | ||
| 1155 | |||
| 1156 | // 4: Multisample Quality Levels | ||
| 1157 | bool m_MultisampleQualityLevelsSucceed = true; | ||
| 1158 | UINT m_SampleCountReceived; | ||
| 1159 | D3D12_MULTISAMPLE_QUALITY_LEVEL_FLAGS m_MultisampleQualityLevelFlagsReceived; | ||
| 1160 | UINT m_NumQualityLevels = 0; | ||
| 1161 | |||
| 1162 | // 5: Format Info | ||
| 1163 | bool m_DXGIFormatSupported = true; | ||
| 1164 | UINT m_PlaneCount = 0; | ||
| 1165 | |||
| 1166 | // 6: GPU Virtual Address Support | ||
| 1167 | bool m_GPUVASupportAvailable = true; | ||
| 1168 | UINT m_MaxGPUVirtualAddressBitsPerProcess = 0; | ||
| 1169 | |||
| 1170 | // 7: Shader Model | ||
| 1171 | D3D_SHADER_MODEL m_HighestSupportedShaderModel = D3D_SHADER_MODEL_5_1; | ||
| 1172 | |||
| 1173 | // 8: Options1 | ||
| 1174 | bool m_Options1Available = true; | ||
| 1175 | bool m_WaveOpsSupported = false; | ||
| 1176 | UINT m_WaveLaneCountMin = 0; | ||
| 1177 | UINT m_WaveLaneCountMax = 0; | ||
| 1178 | UINT m_TotalLaneCount = 0; | ||
| 1179 | bool m_ExpandedComputeResourceStates = false; | ||
| 1180 | bool m_Int64ShaderOpsSupported = false; | ||
| 1181 | |||
| 1182 | // 10: Protected Resource Session Support | ||
| 1183 | bool m_ProtectedResourceSessionAvailable = true; | ||
| 1184 | bool m_ContentProtectionSupported = true; | ||
| 1185 | std::vector<D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAGS> m_ProtectedResourceSessionSupport; | ||
| 1186 | |||
| 1187 | // 12: Root Signature | ||
| 1188 | bool m_RootSignatureAvailable = true; | ||
| 1189 | D3D_ROOT_SIGNATURE_VERSION m_RootSignatureHighestVersion = (D3D_ROOT_SIGNATURE_VERSION)0; | ||
| 1190 | |||
| 1191 | // 18: D3D12 Options2 | ||
| 1192 | bool m_Options2Available = true; | ||
| 1193 | bool m_DepthBoundsTestSupport = false; | ||
| 1194 | D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER m_ProgrammableSamplePositionsTier = D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER_NOT_SUPPORTED; | ||
| 1195 | |||
| 1196 | // 19: Shader Cache | ||
| 1197 | bool m_ShaderCacheAvailable = true; | ||
| 1198 | D3D12_SHADER_CACHE_SUPPORT_FLAGS m_ShaderCacheSupportFlags = D3D12_SHADER_CACHE_SUPPORT_NONE; // Lazy implementation | ||
| 1199 | |||
| 1200 | // 20: Command Queue Priority | ||
| 1201 | bool m_CommandQueuePriorityAvailable = true; | ||
| 1202 | bool m_GlobalRealtimeCommandQueueSupport = false; | ||
| 1203 | |||
| 1204 | // 21: Options3 | ||
| 1205 | bool m_Options3Available = true; | ||
| 1206 | bool m_CopyQueueTimestampQueriesSupported = false; | ||
| 1207 | bool m_CastingFullyTypedFormatsSupported = false; | ||
| 1208 | D3D12_COMMAND_LIST_SUPPORT_FLAGS m_GetCachedWriteBufferImmediateSupportFlags = D3D12_COMMAND_LIST_SUPPORT_FLAG_NONE; | ||
| 1209 | D3D12_VIEW_INSTANCING_TIER m_ViewInstancingTier = D3D12_VIEW_INSTANCING_TIER_NOT_SUPPORTED; | ||
| 1210 | bool m_BarycentricsSupported = false; | ||
| 1211 | |||
| 1212 | // 22: Existing Heaps | ||
| 1213 | bool m_ExistingHeapsAvailable = true; | ||
| 1214 | bool m_ExistingHeapCaps = false; | ||
| 1215 | |||
| 1216 | // 23: Options4 | ||
| 1217 | bool m_Options4Available = true; | ||
| 1218 | bool m_MSAA64KBAlignedTextureSupported = false; | ||
| 1219 | D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER m_SharedResourceCompatibilityTier = D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_0; | ||
| 1220 | bool m_Native16BitShaderOpsSupported = false; | ||
| 1221 | |||
| 1222 | // 24: Serialization | ||
| 1223 | bool m_SerializationAvailable = true; | ||
| 1224 | std::vector<D3D12_HEAP_SERIALIZATION_TIER> m_HeapSerializationTier; | ||
| 1225 | |||
| 1226 | // 25: Cross Node | ||
| 1227 | bool m_CrossNodeAvailable = true; | ||
| 1228 | bool m_AtomicShaderInstructions = false; | ||
| 1229 | |||
| 1230 | // 27: Options5 | ||
| 1231 | bool m_Options5Available = true; | ||
| 1232 | bool m_SRVOnlyTiledResourceTier3 = false; | ||
| 1233 | D3D12_RENDER_PASS_TIER m_RenderPassesTier = D3D12_RENDER_PASS_TIER_0; | ||
| 1234 | D3D12_RAYTRACING_TIER m_RaytracingTier = D3D12_RAYTRACING_TIER_NOT_SUPPORTED; | ||
| 1235 | |||
| 1236 | // 28: Displayable | ||
| 1237 | bool m_DisplayableAvailable = true; | ||
| 1238 | bool m_DisplayableTexture = false; | ||
| 1239 | // SharedResourceCompatibilityTier is located in Options4 | ||
| 1240 | |||
| 1241 | // 30: Options6 | ||
| 1242 | bool m_Options6Available = true; | ||
| 1243 | bool m_AdditionalShadingRatesSupported = false; | ||
| 1244 | bool m_PerPrimitiveShadingRateSupportedWithViewportIndexing = false; | ||
| 1245 | D3D12_VARIABLE_SHADING_RATE_TIER m_VariableShadingRateTier = D3D12_VARIABLE_SHADING_RATE_TIER_NOT_SUPPORTED; | ||
| 1246 | UINT m_ShadingRateImageTileSize = 0; | ||
| 1247 | bool m_BackgroundProcessingSupported = false; | ||
| 1248 | |||
| 1249 | // 31: Query Meta Command | ||
| 1250 | bool m_QueryMetaCommandAvailable = true; | ||
| 1251 | GUID m_CommandID = {}; | ||
| 1252 | UINT m_NodeMask = 0; | ||
| 1253 | const void* m_pQueryInputData = nullptr; | ||
| 1254 | SIZE_T m_QueryInputDataSizeInBytes = 0; | ||
| 1255 | void* m_pQueryOutputData = nullptr; | ||
| 1256 | SIZE_T m_QueryOutputDataSizeInBytes = 0; | ||
| 1257 | |||
| 1258 | // 32: Options7 | ||
| 1259 | bool m_Options7Available = true; | ||
| 1260 | D3D12_MESH_SHADER_TIER m_MeshShaderTier = D3D12_MESH_SHADER_TIER_NOT_SUPPORTED; | ||
| 1261 | D3D12_SAMPLER_FEEDBACK_TIER m_SamplerFeedbackTier = D3D12_SAMPLER_FEEDBACK_TIER_NOT_SUPPORTED; | ||
| 1262 | |||
| 1263 | // 33: Protected Resource Session Type Count | ||
| 1264 | bool m_ProtectedResourceSessionTypeCountAvailable = true; | ||
| 1265 | std::vector<UINT> m_ProtectedResourceSessionTypeCount; | ||
| 1266 | |||
| 1267 | // 34: Protected Resource Session Types | ||
| 1268 | bool m_ProtectedResourceSessionTypesAvailable = true; | ||
| 1269 | std::vector<std::vector<GUID>> m_ProtectedResourceSessionTypes; | ||
| 1270 | |||
| 1271 | // 36: Options8 | ||
| 1272 | bool m_Options8Available = true; | ||
| 1273 | bool m_UnalignedBlockTexturesSupported = false; | ||
| 1274 | |||
| 1275 | // 37: Options9 | ||
| 1276 | bool m_Options9Available = true; | ||
| 1277 | bool m_MeshShaderPipelineStatsSupported = false; | ||
| 1278 | bool m_MeshShaderSupportsFullRangeRenderTargetArrayIndex = false; | ||
| 1279 | bool m_AtomicInt64OnTypedResourceSupported = false; | ||
| 1280 | bool m_AtomicInt64OnGroupSharedSupported = false; | ||
| 1281 | bool m_DerivativesInMeshAndAmplificationShadersSupported = false; | ||
| 1282 | D3D12_WAVE_MMA_TIER m_WaveMMATier = D3D12_WAVE_MMA_TIER_NOT_SUPPORTED; | ||
| 1283 | |||
| 1284 | // 39: Options10 | ||
| 1285 | bool m_Options10Available = true; | ||
| 1286 | bool m_VariableRateShadingSumCombinerSupported = false; | ||
| 1287 | bool m_MeshShaderPerPrimitiveShadingRateSupported = false; | ||
| 1288 | |||
| 1289 | // 40: Options11 | ||
| 1290 | bool m_Options11Available = true; | ||
| 1291 | bool m_AtomicInt64OnDescriptorHeapResourceSupported = false; | ||
| 1292 | |||
| 1293 | // 41: Options12 | ||
| 1294 | bool m_Options12Available = true; | ||
| 1295 | D3D12_TRI_STATE m_MSPrimitivesPipelineStatisticIncludesCulledPrimitives = D3D12_TRI_STATE_UNKNOWN; | ||
| 1296 | bool m_EnhancedBarriersSupported = false; | ||
| 1297 | }; | ||
| 1298 | |||
| 1299 | #endif \ No newline at end of file | ||
diff --git a/contrib/DirectX-Headers-1.618.2/googletest/feature_support_test.cpp b/contrib/DirectX-Headers-1.618.2/googletest/feature_support_test.cpp new file mode 100644 index 0000000..0394384 --- /dev/null +++ b/contrib/DirectX-Headers-1.618.2/googletest/feature_support_test.cpp | |||
| @@ -0,0 +1,1354 @@ | |||
| 1 | // Copyright (c) Microsoft Corporation. | ||
| 2 | // Licensed under the MIT License. | ||
| 3 | #include "gtest/gtest.h" | ||
| 4 | |||
| 5 | #include <wsl/winadapter.h> | ||
| 6 | |||
| 7 | #include <directx/d3d12.h> | ||
| 8 | #include <directx/dxcore.h> | ||
| 9 | #include <directx/d3dx12.h> | ||
| 10 | #include "dxguids/dxguids.h" | ||
| 11 | |||
| 12 | #include "MockDevice.hpp" | ||
| 13 | |||
| 14 | // Initiliaze the CD3DX12FeatureSupport instance | ||
| 15 | // Can be modified to use new initialization methods if any comes up in the future | ||
| 16 | #define INIT_FEATURES() \ | ||
| 17 | CD3DX12FeatureSupport features; \ | ||
| 18 | HRESULT InitResult = features.Init(device); \ | ||
| 19 | EXPECT_EQ(features.GetStatus(), S_OK); | ||
| 20 | |||
| 21 | // Testing class setup | ||
| 22 | class FeatureSupportTest : public ::testing::Test { | ||
| 23 | protected: | ||
| 24 | void SetUp() override { | ||
| 25 | device = new MockDevice(1); | ||
| 26 | } | ||
| 27 | |||
| 28 | void TearDown() override { | ||
| 29 | delete device; | ||
| 30 | } | ||
| 31 | |||
| 32 | MockDevice* device = nullptr; | ||
| 33 | }; | ||
| 34 | |||
| 35 | // Test if the class can be initialized correctly | ||
| 36 | TEST_F(FeatureSupportTest, Initialization) { | ||
| 37 | CD3DX12FeatureSupport features; | ||
| 38 | EXPECT_EQ(features.Init(device), S_OK); | ||
| 39 | EXPECT_EQ(features.GetStatus(), S_OK); | ||
| 40 | } | ||
| 41 | |||
| 42 | // 0: D3D12_OPTIONS | ||
| 43 | // Arbitarily set support status for caps and see if the returned results are correct | ||
| 44 | TEST_F(FeatureSupportTest, D3D12Options) { | ||
| 45 | device->m_DoublePrecisionFloatShaderOps = true; | ||
| 46 | device->m_OutputMergerLogicOp = true; | ||
| 47 | device->m_ShaderMinPrecisionSupport10Bit = D3D12_SHADER_MIN_PRECISION_SUPPORT_10_BIT; | ||
| 48 | device->m_ShaderMinPrecisionSupport16Bit = D3D12_SHADER_MIN_PRECISION_SUPPORT_16_BIT; | ||
| 49 | device->m_TiledResourcesTier = D3D12_TILED_RESOURCES_TIER_3; | ||
| 50 | device->m_ResourceBindingTier = D3D12_RESOURCE_BINDING_TIER_3; | ||
| 51 | device->m_PSSpecifiedStencilRefSupported = true; | ||
| 52 | device->m_ConservativeRasterizationTier = D3D12_CONSERVATIVE_RASTERIZATION_TIER_2; | ||
| 53 | device->m_MaxGPUVirtualAddressBitsPerResource = 10; | ||
| 54 | device->m_ResourceHeapTier = D3D12_RESOURCE_HEAP_TIER_2; | ||
| 55 | |||
| 56 | INIT_FEATURES(); | ||
| 57 | EXPECT_TRUE(features.DoublePrecisionFloatShaderOps()); | ||
| 58 | EXPECT_TRUE(features.OutputMergerLogicOp()); | ||
| 59 | EXPECT_EQ(features.MinPrecisionSupport(), D3D12_SHADER_MIN_PRECISION_SUPPORT_10_BIT | D3D12_SHADER_MIN_PRECISION_SUPPORT_16_BIT); | ||
| 60 | EXPECT_EQ(features.TiledResourcesTier(), D3D12_TILED_RESOURCES_TIER_3); | ||
| 61 | EXPECT_EQ(features.ResourceBindingTier(), D3D12_RESOURCE_BINDING_TIER_3); | ||
| 62 | EXPECT_TRUE(features.PSSpecifiedStencilRefSupported()); | ||
| 63 | EXPECT_FALSE(features.TypedUAVLoadAdditionalFormats()); | ||
| 64 | EXPECT_FALSE(features.ROVsSupported()); | ||
| 65 | EXPECT_EQ(features.ConservativeRasterizationTier(), D3D12_CONSERVATIVE_RASTERIZATION_TIER_2); | ||
| 66 | EXPECT_EQ(features.MaxGPUVirtualAddressBitsPerResource(), 10); | ||
| 67 | EXPECT_FALSE(features.StandardSwizzle64KBSupported()); | ||
| 68 | EXPECT_EQ(features.CrossNodeSharingTier(), D3D12_CROSS_NODE_SHARING_TIER_NOT_SUPPORTED); | ||
| 69 | EXPECT_FALSE(features.CrossAdapterRowMajorTextureSupported()); | ||
| 70 | EXPECT_FALSE(features.VPAndRTArrayIndexFromAnyShaderFeedingRasterizerSupportedWithoutGSEmulation()); | ||
| 71 | EXPECT_EQ(features.ResourceHeapTier(), D3D12_RESOURCE_HEAP_TIER_2); | ||
| 72 | } | ||
| 73 | |||
| 74 | // 1: Architecture & 16: Architecture1 | ||
| 75 | // Test where architecture1 is available | ||
| 76 | TEST_F(FeatureSupportTest, Architecture1Available) | ||
| 77 | { | ||
| 78 | device->m_Architecture1Available = true; | ||
| 79 | device->m_TileBasedRenderer[0] = false; | ||
| 80 | device->m_UMA[0] = true; | ||
| 81 | device->m_CacheCoherentUMA[0] = true; | ||
| 82 | device->m_IsolatedMMU[0] = true; | ||
| 83 | |||
| 84 | INIT_FEATURES(); | ||
| 85 | EXPECT_FALSE(features.TileBasedRenderer(0)); | ||
| 86 | EXPECT_TRUE(features.UMA(0)); | ||
| 87 | EXPECT_TRUE(features.CacheCoherentUMA(0)); | ||
| 88 | EXPECT_TRUE(features.IsolatedMMU(0)); | ||
| 89 | } | ||
| 90 | |||
| 91 | // Test where architecture1 is not available | ||
| 92 | TEST_F(FeatureSupportTest, Architecture1Unavailable) | ||
| 93 | { | ||
| 94 | device->m_Architecture1Available = false; // Architecture1 not available | ||
| 95 | device->m_TileBasedRenderer[0] = false; | ||
| 96 | device->m_UMA[0] = true; | ||
| 97 | device->m_CacheCoherentUMA[0] = false; | ||
| 98 | device->m_IsolatedMMU[0] = true; // Notice that if architecture1 is not available, IslatedMMU cap should not be present | ||
| 99 | |||
| 100 | INIT_FEATURES(); | ||
| 101 | EXPECT_FALSE(features.TileBasedRenderer(0)); | ||
| 102 | EXPECT_TRUE(features.UMA(0)); | ||
| 103 | EXPECT_FALSE(features.CacheCoherentUMA(0)); | ||
| 104 | EXPECT_FALSE(features.IsolatedMMU(0)); // If Architecture1 is not available, IsolatedMMU should not be available | ||
| 105 | } | ||
| 106 | |||
| 107 | // Test on devices with more than one graphics node | ||
| 108 | TEST_F(FeatureSupportTest, ArchitectureMultinode) | ||
| 109 | { | ||
| 110 | device->SetNodeCount(3); | ||
| 111 | device->m_Architecture1Available = true; | ||
| 112 | device->m_TileBasedRenderer = {false, true, true}; | ||
| 113 | device->m_UMA = {true, false, false}; | ||
| 114 | device->m_CacheCoherentUMA = {false, false, true}; | ||
| 115 | device->m_IsolatedMMU = {false, true, false}; | ||
| 116 | |||
| 117 | INIT_FEATURES(); | ||
| 118 | |||
| 119 | EXPECT_FALSE(features.TileBasedRenderer(0)); | ||
| 120 | EXPECT_TRUE(features.TileBasedRenderer(1)); | ||
| 121 | EXPECT_TRUE(features.TileBasedRenderer(2)); | ||
| 122 | |||
| 123 | EXPECT_TRUE(features.UMA(0)); | ||
| 124 | EXPECT_FALSE(features.UMA(1)); | ||
| 125 | EXPECT_FALSE(features.UMA(2)); | ||
| 126 | |||
| 127 | EXPECT_FALSE(features.CacheCoherentUMA(0)); | ||
| 128 | EXPECT_FALSE(features.CacheCoherentUMA(1)); | ||
| 129 | EXPECT_TRUE(features.CacheCoherentUMA(2)); | ||
| 130 | |||
| 131 | EXPECT_FALSE(features.IsolatedMMU(0)); | ||
| 132 | EXPECT_TRUE(features.IsolatedMMU(1)); | ||
| 133 | EXPECT_FALSE(features.IsolatedMMU(2)); | ||
| 134 | } | ||
| 135 | |||
| 136 | // 2: Feature Levels | ||
| 137 | // Basic test with a high feature level | ||
| 138 | TEST_F(FeatureSupportTest, FeatureLevelBasic) | ||
| 139 | { | ||
| 140 | device->m_FeatureLevel = D3D_FEATURE_LEVEL_12_2; | ||
| 141 | |||
| 142 | INIT_FEATURES(); | ||
| 143 | EXPECT_EQ(features.MaxSupportedFeatureLevel(), D3D_FEATURE_LEVEL_12_2); | ||
| 144 | } | ||
| 145 | |||
| 146 | // Test through all supported feature levels | ||
| 147 | TEST_F(FeatureSupportTest, FeatureLevelAll) | ||
| 148 | { | ||
| 149 | std::vector<D3D_FEATURE_LEVEL> allLevels = | ||
| 150 | { | ||
| 151 | D3D_FEATURE_LEVEL_1_0_CORE, | ||
| 152 | D3D_FEATURE_LEVEL_9_1, | ||
| 153 | D3D_FEATURE_LEVEL_9_2, | ||
| 154 | D3D_FEATURE_LEVEL_9_3, | ||
| 155 | D3D_FEATURE_LEVEL_10_0, | ||
| 156 | D3D_FEATURE_LEVEL_10_1, | ||
| 157 | D3D_FEATURE_LEVEL_11_0, | ||
| 158 | D3D_FEATURE_LEVEL_11_1, | ||
| 159 | D3D_FEATURE_LEVEL_12_0, | ||
| 160 | D3D_FEATURE_LEVEL_12_1, | ||
| 161 | D3D_FEATURE_LEVEL_12_2 | ||
| 162 | }; | ||
| 163 | |||
| 164 | for (unsigned int i = 0; i < allLevels.size(); i++) | ||
| 165 | { | ||
| 166 | device->m_FeatureLevel = allLevels[i]; | ||
| 167 | INIT_FEATURES(); | ||
| 168 | EXPECT_EQ(features.MaxSupportedFeatureLevel(), allLevels[i]); | ||
| 169 | } | ||
| 170 | } | ||
| 171 | |||
| 172 | // Test with a feature level higher than the current highest level | ||
| 173 | TEST_F(FeatureSupportTest, FeatureLevelHigher) | ||
| 174 | { | ||
| 175 | device->m_FeatureLevel = (D3D_FEATURE_LEVEL)(D3D_FEATURE_LEVEL_12_2 + 1); | ||
| 176 | INIT_FEATURES(); | ||
| 177 | EXPECT_EQ(features.MaxSupportedFeatureLevel(), D3D_FEATURE_LEVEL_12_2); | ||
| 178 | } | ||
| 179 | |||
| 180 | // 3: Format Support | ||
| 181 | // Forward call to the old API. Basic correctness check | ||
| 182 | // Note: The input and return value of this test is arbitrary and does not reflect the results of running on real devices | ||
| 183 | // The test only checks if the input and output are correctly passed to the inner API and the user. | ||
| 184 | // Same applies to Multisample Quality Levels (4) and Format Info (5) | ||
| 185 | TEST_F(FeatureSupportTest, FormatSupportPositive) | ||
| 186 | { | ||
| 187 | device->m_FormatSupport1 = D3D12_FORMAT_SUPPORT1_BUFFER | D3D12_FORMAT_SUPPORT1_TEXTURE3D | D3D12_FORMAT_SUPPORT1_SHADER_SAMPLE_COMPARISON | D3D12_FORMAT_SUPPORT1_DECODER_OUTPUT; | ||
| 188 | device->m_FormatSupport2 = D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_ADD | D3D12_FORMAT_SUPPORT2_TILED; | ||
| 189 | |||
| 190 | INIT_FEATURES(); | ||
| 191 | |||
| 192 | D3D12_FORMAT_SUPPORT1 support1; | ||
| 193 | D3D12_FORMAT_SUPPORT2 support2; | ||
| 194 | |||
| 195 | HRESULT result = features.FormatSupport(DXGI_FORMAT_R32G32_UINT, support1, support2); // Some random input | ||
| 196 | EXPECT_EQ(support1, D3D12_FORMAT_SUPPORT1_BUFFER | D3D12_FORMAT_SUPPORT1_TEXTURE3D | D3D12_FORMAT_SUPPORT1_SHADER_SAMPLE_COMPARISON | D3D12_FORMAT_SUPPORT1_DECODER_OUTPUT); | ||
| 197 | EXPECT_EQ(support2, D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_ADD | D3D12_FORMAT_SUPPORT2_TILED); | ||
| 198 | EXPECT_EQ(result, S_OK); | ||
| 199 | } | ||
| 200 | |||
| 201 | // Negative test | ||
| 202 | TEST_F(FeatureSupportTest, FormatSupportNegative) | ||
| 203 | { | ||
| 204 | device->m_FormatSupport1 = D3D12_FORMAT_SUPPORT1_NONE; | ||
| 205 | device->m_FormatSupport2 = D3D12_FORMAT_SUPPORT2_NONE; | ||
| 206 | INIT_FEATURES(); | ||
| 207 | |||
| 208 | D3D12_FORMAT_SUPPORT1 support1; | ||
| 209 | D3D12_FORMAT_SUPPORT2 support2; | ||
| 210 | |||
| 211 | HRESULT result = features.FormatSupport(DXGI_FORMAT_UNKNOWN, support1, support2); | ||
| 212 | EXPECT_EQ(support1, D3D12_FORMAT_SUPPORT1_NONE); | ||
| 213 | EXPECT_EQ(support2, D3D12_FORMAT_SUPPORT2_NONE); | ||
| 214 | EXPECT_EQ(result, E_FAIL); | ||
| 215 | } | ||
| 216 | |||
| 217 | // 4: Multisample Quality Levels | ||
| 218 | // Forwarding call. Check if the API received the correct information. | ||
| 219 | TEST_F(FeatureSupportTest, MultisampleQualityLevelsPositive) | ||
| 220 | { | ||
| 221 | device->m_NumQualityLevels = 42; // Arbitrary return value | ||
| 222 | |||
| 223 | INIT_FEATURES(); | ||
| 224 | |||
| 225 | DXGI_FORMAT inFormat = DXGI_FORMAT_R16G16B16A16_FLOAT; | ||
| 226 | UINT inSampleCount = 10; | ||
| 227 | D3D12_MULTISAMPLE_QUALITY_LEVEL_FLAGS inFlags = D3D12_MULTISAMPLE_QUALITY_LEVELS_FLAG_NONE; | ||
| 228 | UINT NumQualityLevels; | ||
| 229 | |||
| 230 | HRESULT result = features.MultisampleQualityLevels(inFormat, inSampleCount, inFlags, NumQualityLevels); | ||
| 231 | |||
| 232 | EXPECT_EQ(device->m_FormatReceived, inFormat); | ||
| 233 | EXPECT_EQ(device->m_SampleCountReceived, inSampleCount); | ||
| 234 | EXPECT_EQ(device->m_MultisampleQualityLevelFlagsReceived, inFlags); | ||
| 235 | EXPECT_EQ(result, S_OK); | ||
| 236 | EXPECT_EQ(NumQualityLevels, 42); | ||
| 237 | } | ||
| 238 | |||
| 239 | // Test where the feature check fails | ||
| 240 | TEST_F(FeatureSupportTest, MultisampleQualityLevelsNegative) | ||
| 241 | { | ||
| 242 | device->m_NumQualityLevels = 42; | ||
| 243 | device->m_MultisampleQualityLevelsSucceed = false; // Simulate failure | ||
| 244 | |||
| 245 | INIT_FEATURES(); | ||
| 246 | |||
| 247 | DXGI_FORMAT inFormat = DXGI_FORMAT_R16G16B16A16_FLOAT; | ||
| 248 | UINT inSampleCount = 6; | ||
| 249 | D3D12_MULTISAMPLE_QUALITY_LEVEL_FLAGS inFlags = D3D12_MULTISAMPLE_QUALITY_LEVELS_FLAG_NONE; | ||
| 250 | UINT NumQualityLevels; | ||
| 251 | |||
| 252 | HRESULT result = features.MultisampleQualityLevels(inFormat, inSampleCount, inFlags, NumQualityLevels); | ||
| 253 | |||
| 254 | EXPECT_EQ(device->m_FormatReceived, inFormat); | ||
| 255 | EXPECT_EQ(device->m_SampleCountReceived, inSampleCount); | ||
| 256 | EXPECT_EQ(device->m_MultisampleQualityLevelFlagsReceived, inFlags); | ||
| 257 | EXPECT_EQ(result, E_FAIL); | ||
| 258 | EXPECT_EQ(NumQualityLevels, 0); | ||
| 259 | } | ||
| 260 | |||
| 261 | // 5: Format Info | ||
| 262 | // Forward call to old API. Basic check | ||
| 263 | TEST_F(FeatureSupportTest, FormatInfoPositive) | ||
| 264 | { | ||
| 265 | device->m_PlaneCount = 4; | ||
| 266 | |||
| 267 | INIT_FEATURES(); | ||
| 268 | |||
| 269 | DXGI_FORMAT inFormat = DXGI_FORMAT_D32_FLOAT; | ||
| 270 | UINT8 PlaneCount; | ||
| 271 | HRESULT result = features.FormatInfo(inFormat, PlaneCount); | ||
| 272 | |||
| 273 | EXPECT_EQ(PlaneCount, 4); | ||
| 274 | EXPECT_EQ(result, S_OK); | ||
| 275 | EXPECT_EQ(device->m_FormatReceived, inFormat); | ||
| 276 | } | ||
| 277 | |||
| 278 | // Test when feature check fails | ||
| 279 | TEST_F(FeatureSupportTest, FormatInfoNegative) | ||
| 280 | { | ||
| 281 | device->m_PlaneCount = 6; | ||
| 282 | device->m_DXGIFormatSupported = false; | ||
| 283 | |||
| 284 | INIT_FEATURES(); | ||
| 285 | |||
| 286 | DXGI_FORMAT inFormat = DXGI_FORMAT_BC1_UNORM; | ||
| 287 | UINT8 PlaneCount; | ||
| 288 | HRESULT result = features.FormatInfo(inFormat, PlaneCount); | ||
| 289 | |||
| 290 | EXPECT_EQ(result, E_INVALIDARG); | ||
| 291 | EXPECT_EQ(PlaneCount, 0); | ||
| 292 | EXPECT_EQ(device->m_FormatReceived, inFormat); | ||
| 293 | } | ||
| 294 | |||
| 295 | // 6: GPUVA Support | ||
| 296 | TEST_F(FeatureSupportTest, GPUVASupport) | ||
| 297 | { | ||
| 298 | device->m_MaxGPUVirtualAddressBitsPerProcess = 16; | ||
| 299 | device->m_MaxGPUVirtualAddressBitsPerResource = 12; | ||
| 300 | |||
| 301 | INIT_FEATURES(); | ||
| 302 | |||
| 303 | EXPECT_EQ(features.MaxGPUVirtualAddressBitsPerProcess(), 16); | ||
| 304 | EXPECT_EQ(features.MaxGPUVirtualAddressBitsPerResource(), 12); | ||
| 305 | } | ||
| 306 | |||
| 307 | /* | ||
| 308 | Starting from Options1, all features should have an "unavailable test" | ||
| 309 | to ensure the new API returns the desired default values | ||
| 310 | when a device does not support that feature | ||
| 311 | */ | ||
| 312 | |||
| 313 | // 8: Options1 | ||
| 314 | // Basic tests | ||
| 315 | TEST_F(FeatureSupportTest, Options1Basic) | ||
| 316 | { | ||
| 317 | device->m_WaveOpsSupported = true; | ||
| 318 | device->m_WaveLaneCountMin = 2; | ||
| 319 | device->m_WaveLaneCountMax = 4; | ||
| 320 | device->m_TotalLaneCount = 8; | ||
| 321 | device->m_ExpandedComputeResourceStates = true; | ||
| 322 | device->m_Int64ShaderOpsSupported = true; | ||
| 323 | |||
| 324 | INIT_FEATURES(); | ||
| 325 | |||
| 326 | EXPECT_TRUE(features.WaveOps()); | ||
| 327 | EXPECT_EQ(features.WaveLaneCountMin(), 2); | ||
| 328 | EXPECT_EQ(features.WaveLaneCountMax(), 4); | ||
| 329 | EXPECT_EQ(features.TotalLaneCount(), 8); | ||
| 330 | EXPECT_TRUE(features.ExpandedComputeResourceStates()); | ||
| 331 | EXPECT_TRUE(features.Int64ShaderOps()); | ||
| 332 | } | ||
| 333 | |||
| 334 | // Unavailable test | ||
| 335 | // Test where device does not support Options1 | ||
| 336 | TEST_F(FeatureSupportTest, Options1Unavailable) | ||
| 337 | { | ||
| 338 | device->m_Options1Available = false; | ||
| 339 | device->m_WaveOpsSupported = true; | ||
| 340 | device->m_WaveLaneCountMin = 2; | ||
| 341 | device->m_WaveLaneCountMax = 4; | ||
| 342 | device->m_TotalLaneCount = 8; | ||
| 343 | device->m_ExpandedComputeResourceStates = true; | ||
| 344 | device->m_Int64ShaderOpsSupported = true; | ||
| 345 | |||
| 346 | INIT_FEATURES(); | ||
| 347 | |||
| 348 | EXPECT_FALSE(features.WaveOps()); | ||
| 349 | EXPECT_EQ(features.WaveLaneCountMin(), 0); | ||
| 350 | EXPECT_EQ(features.WaveLaneCountMax(), 0); | ||
| 351 | EXPECT_EQ(features.TotalLaneCount(), 0); | ||
| 352 | EXPECT_FALSE(features.ExpandedComputeResourceStates()); | ||
| 353 | EXPECT_FALSE(features.Int64ShaderOps()); | ||
| 354 | } | ||
| 355 | |||
| 356 | // 10: Protected Resource Session Support | ||
| 357 | // Basic test | ||
| 358 | TEST_F(FeatureSupportTest, ProtectedResourceSessionSupportBasic) | ||
| 359 | { | ||
| 360 | device->m_ProtectedResourceSessionSupport[0] = D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAG_SUPPORTED; | ||
| 361 | |||
| 362 | INIT_FEATURES(); | ||
| 363 | |||
| 364 | EXPECT_EQ(features.ProtectedResourceSessionSupport(0), D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAG_SUPPORTED); | ||
| 365 | } | ||
| 366 | |||
| 367 | // Negative test | ||
| 368 | TEST_F(FeatureSupportTest, ProtectedResourceSessionSupportNegative) | ||
| 369 | { | ||
| 370 | device->m_ProtectedResourceSessionSupport[0] = D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAG_SUPPORTED; | ||
| 371 | device->m_ContentProtectionSupported = false; | ||
| 372 | |||
| 373 | INIT_FEATURES(); | ||
| 374 | |||
| 375 | EXPECT_EQ(features.ProtectedResourceSessionSupport(), D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAG_NONE); | ||
| 376 | } | ||
| 377 | |||
| 378 | // Multinode test | ||
| 379 | TEST_F(FeatureSupportTest, ProtectedResourceSessionSupportMultinode) | ||
| 380 | { | ||
| 381 | device->SetNodeCount(4); | ||
| 382 | device->m_ProtectedResourceSessionSupport = | ||
| 383 | { | ||
| 384 | D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAG_NONE, | ||
| 385 | D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAG_SUPPORTED, | ||
| 386 | D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAG_SUPPORTED, | ||
| 387 | D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAG_NONE | ||
| 388 | }; | ||
| 389 | |||
| 390 | INIT_FEATURES(); | ||
| 391 | |||
| 392 | EXPECT_EQ(features.ProtectedResourceSessionSupport(0), D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAG_NONE); | ||
| 393 | EXPECT_EQ(features.ProtectedResourceSessionSupport(1), D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAG_SUPPORTED); | ||
| 394 | EXPECT_EQ(features.ProtectedResourceSessionSupport(2), D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAG_SUPPORTED); | ||
| 395 | EXPECT_EQ(features.ProtectedResourceSessionSupport(3), D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAG_NONE); | ||
| 396 | } | ||
| 397 | |||
| 398 | // Unavailable test | ||
| 399 | TEST_F(FeatureSupportTest, ProtectedResourceSessionSupportNotAvailable) | ||
| 400 | { | ||
| 401 | device->m_ProtectedResourceSessionAvailable = false; | ||
| 402 | device->m_ProtectedResourceSessionSupport[0] = D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAG_SUPPORTED; | ||
| 403 | |||
| 404 | INIT_FEATURES(); | ||
| 405 | |||
| 406 | EXPECT_EQ(features.ProtectedResourceSessionSupport(0), D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAG_NONE); | ||
| 407 | } | ||
| 408 | |||
| 409 | |||
| 410 | // Multinode Unavailable test | ||
| 411 | TEST_F(FeatureSupportTest, ProtectedResourceSessionSupportNotAvailableMultinode) | ||
| 412 | { | ||
| 413 | device->m_ProtectedResourceSessionAvailable = false; | ||
| 414 | device->SetNodeCount(4); | ||
| 415 | device->m_ProtectedResourceSessionSupport = | ||
| 416 | { | ||
| 417 | D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAG_NONE, | ||
| 418 | D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAG_SUPPORTED, | ||
| 419 | D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAG_SUPPORTED, | ||
| 420 | D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAG_NONE | ||
| 421 | }; | ||
| 422 | |||
| 423 | INIT_FEATURES(); | ||
| 424 | |||
| 425 | EXPECT_EQ(features.ProtectedResourceSessionSupport(0), D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAG_NONE); | ||
| 426 | EXPECT_EQ(features.ProtectedResourceSessionSupport(1), D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAG_NONE); | ||
| 427 | EXPECT_EQ(features.ProtectedResourceSessionSupport(2), D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAG_NONE); | ||
| 428 | EXPECT_EQ(features.ProtectedResourceSessionSupport(3), D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAG_NONE); | ||
| 429 | } | ||
| 430 | |||
| 431 | // 12: Root Signature | ||
| 432 | // Basic test (highest supported version in header) | ||
| 433 | TEST_F(FeatureSupportTest, RootSignatureBasic) | ||
| 434 | { | ||
| 435 | device->m_RootSignatureHighestVersion = D3D_ROOT_SIGNATURE_VERSION_1_1; | ||
| 436 | INIT_FEATURES(); | ||
| 437 | EXPECT_EQ(features.HighestRootSignatureVersion(), D3D_ROOT_SIGNATURE_VERSION_1_1); | ||
| 438 | } | ||
| 439 | |||
| 440 | // Lower version test | ||
| 441 | TEST_F(FeatureSupportTest, RootSignatureLower) | ||
| 442 | { | ||
| 443 | device->m_RootSignatureHighestVersion = D3D_ROOT_SIGNATURE_VERSION_1; | ||
| 444 | INIT_FEATURES(); | ||
| 445 | EXPECT_EQ(features.HighestRootSignatureVersion(), D3D_ROOT_SIGNATURE_VERSION_1); | ||
| 446 | } | ||
| 447 | |||
| 448 | // Higher version test | ||
| 449 | TEST_F(FeatureSupportTest, RootSignatureHigher) | ||
| 450 | { | ||
| 451 | device->m_RootSignatureHighestVersion = (D3D_ROOT_SIGNATURE_VERSION)(D3D_ROOT_SIGNATURE_VERSION_1_1 + 1); | ||
| 452 | INIT_FEATURES(); | ||
| 453 | EXPECT_EQ(features.HighestRootSignatureVersion(), D3D_ROOT_SIGNATURE_VERSION_1_1); | ||
| 454 | } | ||
| 455 | |||
| 456 | // Unavailable test | ||
| 457 | TEST_F(FeatureSupportTest, RootSignatureUnavailable) | ||
| 458 | { | ||
| 459 | device->m_RootSignatureAvailable = false; | ||
| 460 | device->m_RootSignatureHighestVersion = D3D_ROOT_SIGNATURE_VERSION_1_1; | ||
| 461 | INIT_FEATURES(); | ||
| 462 | EXPECT_EQ(features.HighestRootSignatureVersion(), 0); | ||
| 463 | } | ||
| 464 | |||
| 465 | // 18: Options2 | ||
| 466 | // Basic test | ||
| 467 | TEST_F(FeatureSupportTest, D3D12Options2Basic) | ||
| 468 | { | ||
| 469 | device->m_DepthBoundsTestSupport = true; | ||
| 470 | device->m_ProgrammableSamplePositionsTier = D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER_2; | ||
| 471 | INIT_FEATURES(); | ||
| 472 | EXPECT_TRUE(features.DepthBoundsTestSupported()); | ||
| 473 | EXPECT_EQ(features.ProgrammableSamplePositionsTier(), D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER_2); | ||
| 474 | } | ||
| 475 | |||
| 476 | // Unavailable test | ||
| 477 | TEST_F(FeatureSupportTest, D3D12Options2Unavailable) | ||
| 478 | { | ||
| 479 | device->m_Options2Available = false; | ||
| 480 | device->m_DepthBoundsTestSupport = true; | ||
| 481 | device->m_ProgrammableSamplePositionsTier = D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER_2; | ||
| 482 | INIT_FEATURES(); | ||
| 483 | EXPECT_FALSE(features.DepthBoundsTestSupported()); | ||
| 484 | EXPECT_EQ(features.ProgrammableSamplePositionsTier(), D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER_NOT_SUPPORTED); | ||
| 485 | } | ||
| 486 | |||
| 487 | // 19: Shader Cache | ||
| 488 | // Basic test | ||
| 489 | TEST_F(FeatureSupportTest, ShaderCacheBasic) | ||
| 490 | { | ||
| 491 | D3D12_SHADER_CACHE_SUPPORT_FLAGS outFlags = D3D12_SHADER_CACHE_SUPPORT_SINGLE_PSO | ||
| 492 | | D3D12_SHADER_CACHE_SUPPORT_LIBRARY | ||
| 493 | | D3D12_SHADER_CACHE_SUPPORT_AUTOMATIC_INPROC_CACHE | ||
| 494 | | D3D12_SHADER_CACHE_SUPPORT_DRIVER_MANAGED_CACHE | ||
| 495 | | D3D12_SHADER_CACHE_SUPPORT_SHADER_CONTROL_CLEAR | ||
| 496 | | D3D12_SHADER_CACHE_SUPPORT_SHADER_SESSION_DELETE; | ||
| 497 | device->m_ShaderCacheSupportFlags = outFlags; | ||
| 498 | |||
| 499 | INIT_FEATURES(); | ||
| 500 | EXPECT_EQ(features.ShaderCacheSupportFlags(), outFlags); | ||
| 501 | } | ||
| 502 | |||
| 503 | // Unavailable test | ||
| 504 | TEST_F(FeatureSupportTest, ShaderCacheUnavailable) | ||
| 505 | { | ||
| 506 | device->m_ShaderCacheAvailable = false; | ||
| 507 | D3D12_SHADER_CACHE_SUPPORT_FLAGS outFlags = D3D12_SHADER_CACHE_SUPPORT_SINGLE_PSO | ||
| 508 | | D3D12_SHADER_CACHE_SUPPORT_LIBRARY | ||
| 509 | | D3D12_SHADER_CACHE_SUPPORT_AUTOMATIC_INPROC_CACHE | ||
| 510 | | D3D12_SHADER_CACHE_SUPPORT_DRIVER_MANAGED_CACHE | ||
| 511 | | D3D12_SHADER_CACHE_SUPPORT_SHADER_CONTROL_CLEAR | ||
| 512 | | D3D12_SHADER_CACHE_SUPPORT_SHADER_SESSION_DELETE; | ||
| 513 | device->m_ShaderCacheSupportFlags = outFlags; | ||
| 514 | |||
| 515 | INIT_FEATURES(); | ||
| 516 | EXPECT_EQ(features.ShaderCacheSupportFlags(), D3D12_SHADER_CACHE_SUPPORT_NONE); | ||
| 517 | } | ||
| 518 | |||
| 519 | // 20: Command Queue Priority | ||
| 520 | // Basic positive test | ||
| 521 | TEST_F(FeatureSupportTest, CommandQueuePriorityBasic) | ||
| 522 | { | ||
| 523 | device->m_GlobalRealtimeCommandQueueSupport = true; | ||
| 524 | INIT_FEATURES(); | ||
| 525 | EXPECT_TRUE(features.CommandQueuePrioritySupported(D3D12_COMMAND_LIST_TYPE_DIRECT, D3D12_COMMAND_QUEUE_PRIORITY_NORMAL)); | ||
| 526 | EXPECT_TRUE(features.CommandQueuePrioritySupported(D3D12_COMMAND_LIST_TYPE_DIRECT, D3D12_COMMAND_QUEUE_PRIORITY_HIGH)); | ||
| 527 | EXPECT_TRUE(features.CommandQueuePrioritySupported(D3D12_COMMAND_LIST_TYPE_DIRECT, D3D12_COMMAND_QUEUE_PRIORITY_GLOBAL_REALTIME)); | ||
| 528 | } | ||
| 529 | |||
| 530 | // Negative tests | ||
| 531 | TEST_F(FeatureSupportTest, CommandQueuePriorityNegative) | ||
| 532 | { | ||
| 533 | device->m_GlobalRealtimeCommandQueueSupport = false; | ||
| 534 | INIT_FEATURES(); | ||
| 535 | EXPECT_FALSE(features.CommandQueuePrioritySupported(D3D12_COMMAND_LIST_TYPE_VIDEO_ENCODE, D3D12_COMMAND_QUEUE_PRIORITY_GLOBAL_REALTIME)); // Global realtime not on | ||
| 536 | EXPECT_FALSE(features.CommandQueuePrioritySupported((D3D12_COMMAND_LIST_TYPE)(D3D12_COMMAND_LIST_TYPE_VIDEO_ENCODE+1), D3D12_COMMAND_QUEUE_PRIORITY_NORMAL)); // Unknown command list type | ||
| 537 | EXPECT_FALSE(features.CommandQueuePrioritySupported(D3D12_COMMAND_LIST_TYPE_COMPUTE, (D3D12_COMMAND_QUEUE_PRIORITY)10)); // Unknown Priority level | ||
| 538 | } | ||
| 539 | |||
| 540 | // Unavailable test | ||
| 541 | TEST_F(FeatureSupportTest, CommandQueuePriorityUnavailable) | ||
| 542 | { | ||
| 543 | device->m_CommandQueuePriorityAvailable = false; | ||
| 544 | |||
| 545 | device->m_GlobalRealtimeCommandQueueSupport = true; | ||
| 546 | INIT_FEATURES(); | ||
| 547 | EXPECT_FALSE(features.CommandQueuePrioritySupported(D3D12_COMMAND_LIST_TYPE_DIRECT, D3D12_COMMAND_QUEUE_PRIORITY_NORMAL)); | ||
| 548 | EXPECT_FALSE(features.CommandQueuePrioritySupported(D3D12_COMMAND_LIST_TYPE_DIRECT, D3D12_COMMAND_QUEUE_PRIORITY_HIGH)); | ||
| 549 | EXPECT_FALSE(features.CommandQueuePrioritySupported(D3D12_COMMAND_LIST_TYPE_DIRECT, D3D12_COMMAND_QUEUE_PRIORITY_GLOBAL_REALTIME)); | ||
| 550 | } | ||
| 551 | |||
| 552 | // 21: Options3 | ||
| 553 | // Basic Test | ||
| 554 | TEST_F(FeatureSupportTest, Options3Basic) | ||
| 555 | { | ||
| 556 | device->m_CopyQueueTimestampQueriesSupported = true; | ||
| 557 | device->m_CastingFullyTypedFormatsSupported = true; | ||
| 558 | device->m_GetCachedWriteBufferImmediateSupportFlags = D3D12_COMMAND_LIST_SUPPORT_FLAG_DIRECT | D3D12_COMMAND_LIST_SUPPORT_FLAG_COMPUTE; | ||
| 559 | device->m_ViewInstancingTier = D3D12_VIEW_INSTANCING_TIER_3; | ||
| 560 | device->m_BarycentricsSupported = true; | ||
| 561 | |||
| 562 | INIT_FEATURES(); | ||
| 563 | |||
| 564 | EXPECT_TRUE(features.CopyQueueTimestampQueriesSupported()); | ||
| 565 | EXPECT_TRUE(features.CastingFullyTypedFormatSupported()); | ||
| 566 | EXPECT_EQ(features.WriteBufferImmediateSupportFlags(), D3D12_COMMAND_LIST_SUPPORT_FLAG_DIRECT | D3D12_COMMAND_LIST_SUPPORT_FLAG_COMPUTE); | ||
| 567 | EXPECT_EQ(features.ViewInstancingTier(), D3D12_VIEW_INSTANCING_TIER_3); | ||
| 568 | EXPECT_TRUE(features.BarycentricsSupported()); | ||
| 569 | } | ||
| 570 | |||
| 571 | // Unavailable Test | ||
| 572 | TEST_F(FeatureSupportTest, Options3Unavailable) | ||
| 573 | { | ||
| 574 | device->m_Options3Available = false; | ||
| 575 | device->m_CopyQueueTimestampQueriesSupported = true; | ||
| 576 | device->m_CastingFullyTypedFormatsSupported = true; | ||
| 577 | device->m_GetCachedWriteBufferImmediateSupportFlags = D3D12_COMMAND_LIST_SUPPORT_FLAG_DIRECT | D3D12_COMMAND_LIST_SUPPORT_FLAG_COMPUTE; | ||
| 578 | device->m_ViewInstancingTier = D3D12_VIEW_INSTANCING_TIER_3; | ||
| 579 | device->m_BarycentricsSupported = true; | ||
| 580 | |||
| 581 | INIT_FEATURES(); | ||
| 582 | |||
| 583 | EXPECT_FALSE(features.CopyQueueTimestampQueriesSupported()); | ||
| 584 | EXPECT_FALSE(features.CastingFullyTypedFormatSupported()); | ||
| 585 | EXPECT_EQ(features.WriteBufferImmediateSupportFlags(), D3D12_COMMAND_LIST_SUPPORT_FLAG_NONE); | ||
| 586 | EXPECT_EQ(features.ViewInstancingTier(), D3D12_VIEW_INSTANCING_TIER_NOT_SUPPORTED); | ||
| 587 | EXPECT_FALSE(features.BarycentricsSupported()); | ||
| 588 | } | ||
| 589 | |||
| 590 | // 22: Existing Heaps | ||
| 591 | // Basic Test | ||
| 592 | TEST_F(FeatureSupportTest, ExistingHeapsBasic) | ||
| 593 | { | ||
| 594 | device->m_ExistingHeapCaps = true; | ||
| 595 | INIT_FEATURES(); | ||
| 596 | EXPECT_TRUE(features.ExistingHeapsSupported()); | ||
| 597 | } | ||
| 598 | |||
| 599 | // Unavailable Test | ||
| 600 | TEST_F(FeatureSupportTest, ExistingHeapsUnavailable) | ||
| 601 | { | ||
| 602 | device->m_ExistingHeapsAvailable = false; | ||
| 603 | device->m_ExistingHeapCaps = true; | ||
| 604 | INIT_FEATURES(); | ||
| 605 | EXPECT_FALSE(features.ExistingHeapsSupported()); | ||
| 606 | } | ||
| 607 | |||
| 608 | // 23: Options4 | ||
| 609 | // Basic Test | ||
| 610 | TEST_F(FeatureSupportTest, Options4Basic) | ||
| 611 | { | ||
| 612 | device->m_MSAA64KBAlignedTextureSupported = true; | ||
| 613 | device->m_SharedResourceCompatibilityTier = D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_2; // Duplicate member | ||
| 614 | device->m_Native16BitShaderOpsSupported = true; | ||
| 615 | |||
| 616 | INIT_FEATURES(); | ||
| 617 | EXPECT_TRUE(features.MSAA64KBAlignedTextureSupported()); | ||
| 618 | EXPECT_EQ(features.SharedResourceCompatibilityTier(), D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_2); | ||
| 619 | EXPECT_TRUE(features.Native16BitShaderOpsSupported()); | ||
| 620 | } | ||
| 621 | |||
| 622 | // Unavailable Test | ||
| 623 | TEST_F(FeatureSupportTest, Options4Unavailable) | ||
| 624 | { | ||
| 625 | device->m_Options4Available = false; | ||
| 626 | device->m_MSAA64KBAlignedTextureSupported = true; | ||
| 627 | device->m_SharedResourceCompatibilityTier = D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_2; // Duplicate member | ||
| 628 | device->m_Native16BitShaderOpsSupported = true; | ||
| 629 | |||
| 630 | INIT_FEATURES(); | ||
| 631 | EXPECT_FALSE(features.MSAA64KBAlignedTextureSupported()); | ||
| 632 | EXPECT_EQ(features.SharedResourceCompatibilityTier(), D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_0); | ||
| 633 | EXPECT_FALSE(features.Native16BitShaderOpsSupported()); | ||
| 634 | } | ||
| 635 | |||
| 636 | // 24: Serialization | ||
| 637 | // Basic Test | ||
| 638 | TEST_F(FeatureSupportTest, SerializationBasic) | ||
| 639 | { | ||
| 640 | device->m_HeapSerializationTier[0] = D3D12_HEAP_SERIALIZATION_TIER_10; | ||
| 641 | |||
| 642 | INIT_FEATURES(); | ||
| 643 | |||
| 644 | EXPECT_EQ(features.HeapSerializationTier(), D3D12_HEAP_SERIALIZATION_TIER_10); | ||
| 645 | } | ||
| 646 | |||
| 647 | // Multinode Test | ||
| 648 | TEST_F(FeatureSupportTest, SerializationMultinode) | ||
| 649 | { | ||
| 650 | device->SetNodeCount(3); | ||
| 651 | device->m_HeapSerializationTier = | ||
| 652 | { | ||
| 653 | D3D12_HEAP_SERIALIZATION_TIER_10, | ||
| 654 | D3D12_HEAP_SERIALIZATION_TIER_0, | ||
| 655 | D3D12_HEAP_SERIALIZATION_TIER_10 | ||
| 656 | }; | ||
| 657 | |||
| 658 | INIT_FEATURES(); | ||
| 659 | |||
| 660 | EXPECT_EQ(features.HeapSerializationTier(), D3D12_HEAP_SERIALIZATION_TIER_10); | ||
| 661 | EXPECT_EQ(features.HeapSerializationTier(1), D3D12_HEAP_SERIALIZATION_TIER_0); | ||
| 662 | EXPECT_EQ(features.HeapSerializationTier(2), D3D12_HEAP_SERIALIZATION_TIER_10); | ||
| 663 | } | ||
| 664 | |||
| 665 | // Unavailable Test | ||
| 666 | TEST_F(FeatureSupportTest, SerializationUnavailable) | ||
| 667 | { | ||
| 668 | device->m_SerializationAvailable = false; | ||
| 669 | device->SetNodeCount(3); | ||
| 670 | device->m_HeapSerializationTier = | ||
| 671 | { | ||
| 672 | D3D12_HEAP_SERIALIZATION_TIER_10, | ||
| 673 | D3D12_HEAP_SERIALIZATION_TIER_0, | ||
| 674 | D3D12_HEAP_SERIALIZATION_TIER_10 | ||
| 675 | }; | ||
| 676 | |||
| 677 | INIT_FEATURES(); | ||
| 678 | |||
| 679 | EXPECT_EQ(features.HeapSerializationTier(), D3D12_HEAP_SERIALIZATION_TIER_0); | ||
| 680 | EXPECT_EQ(features.HeapSerializationTier(1), D3D12_HEAP_SERIALIZATION_TIER_0); | ||
| 681 | EXPECT_EQ(features.HeapSerializationTier(2), D3D12_HEAP_SERIALIZATION_TIER_0); | ||
| 682 | } | ||
| 683 | |||
| 684 | // 25: Cross Node | ||
| 685 | // Basic Test | ||
| 686 | TEST_F(FeatureSupportTest, CrossNodeBasic) | ||
| 687 | { | ||
| 688 | device->m_CrossNodeSharingTier = D3D12_CROSS_NODE_SHARING_TIER_3; // Duplicated Cap | ||
| 689 | device->m_AtomicShaderInstructions = true; | ||
| 690 | |||
| 691 | INIT_FEATURES(); | ||
| 692 | |||
| 693 | EXPECT_EQ(features.CrossNodeSharingTier(), D3D12_CROSS_NODE_SHARING_TIER_3); | ||
| 694 | EXPECT_TRUE(features.CrossNodeAtomicShaderInstructions()); | ||
| 695 | } | ||
| 696 | |||
| 697 | // Unavailable Test | ||
| 698 | TEST_F(FeatureSupportTest, CrossNodeUnavailable) | ||
| 699 | { | ||
| 700 | device->m_CrossNodeAvailable = false; | ||
| 701 | device->m_CrossNodeSharingTier = D3D12_CROSS_NODE_SHARING_TIER_3; // Duplicated Cap | ||
| 702 | device->m_AtomicShaderInstructions = true; | ||
| 703 | |||
| 704 | INIT_FEATURES(); | ||
| 705 | |||
| 706 | EXPECT_EQ(features.CrossNodeSharingTier(), D3D12_CROSS_NODE_SHARING_TIER_3); // It is still correctly initialized by Options1 | ||
| 707 | EXPECT_FALSE(features.CrossNodeAtomicShaderInstructions()); | ||
| 708 | } | ||
| 709 | |||
| 710 | // 27: Options5 | ||
| 711 | // Basic Test | ||
| 712 | TEST_F(FeatureSupportTest, Options5Basic) | ||
| 713 | { | ||
| 714 | device->m_RaytracingTier = D3D12_RAYTRACING_TIER_1_1; | ||
| 715 | device->m_RenderPassesTier = D3D12_RENDER_PASS_TIER_2; | ||
| 716 | device->m_SRVOnlyTiledResourceTier3 = true; | ||
| 717 | |||
| 718 | INIT_FEATURES(); | ||
| 719 | |||
| 720 | EXPECT_EQ(features.RaytracingTier(), D3D12_RAYTRACING_TIER_1_1); | ||
| 721 | EXPECT_EQ(features.RenderPassesTier(), D3D12_RENDER_PASS_TIER_2); | ||
| 722 | EXPECT_TRUE(features.SRVOnlyTiledResourceTier3()); | ||
| 723 | } | ||
| 724 | |||
| 725 | // Unavailable Test | ||
| 726 | TEST_F(FeatureSupportTest, Options5Unavailable) | ||
| 727 | { | ||
| 728 | device->m_Options5Available = false; | ||
| 729 | device->m_RaytracingTier = D3D12_RAYTRACING_TIER_1_1; | ||
| 730 | device->m_RenderPassesTier = D3D12_RENDER_PASS_TIER_2; | ||
| 731 | device->m_SRVOnlyTiledResourceTier3 = true; | ||
| 732 | |||
| 733 | INIT_FEATURES(); | ||
| 734 | |||
| 735 | EXPECT_EQ(features.RaytracingTier(), D3D12_RAYTRACING_TIER_NOT_SUPPORTED); | ||
| 736 | EXPECT_EQ(features.RenderPassesTier(), D3D12_RENDER_PASS_TIER_0); | ||
| 737 | EXPECT_FALSE(features.SRVOnlyTiledResourceTier3()); | ||
| 738 | } | ||
| 739 | |||
| 740 | // 28: Displayable | ||
| 741 | // Basic Test | ||
| 742 | TEST_F(FeatureSupportTest, DisplayableBasic) | ||
| 743 | { | ||
| 744 | device->m_DisplayableTexture = true; | ||
| 745 | device->m_SharedResourceCompatibilityTier = D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_2; | ||
| 746 | |||
| 747 | INIT_FEATURES(); | ||
| 748 | |||
| 749 | EXPECT_TRUE(features.DisplayableTexture()); | ||
| 750 | EXPECT_EQ(features.SharedResourceCompatibilityTier(), D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_2); | ||
| 751 | } | ||
| 752 | |||
| 753 | // Unavailable Test | ||
| 754 | TEST_F(FeatureSupportTest, DisplayableUnavailable) | ||
| 755 | { | ||
| 756 | device->m_DisplayableAvailable = false; | ||
| 757 | device->m_DisplayableTexture = true; | ||
| 758 | device->m_SharedResourceCompatibilityTier = D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_2; | ||
| 759 | |||
| 760 | INIT_FEATURES(); | ||
| 761 | |||
| 762 | EXPECT_FALSE(features.DisplayableTexture()); | ||
| 763 | EXPECT_EQ(features.SharedResourceCompatibilityTier(), D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_2); // Still initialized by Options4 | ||
| 764 | } | ||
| 765 | |||
| 766 | // 30: D3D12 Options6 | ||
| 767 | // Basic Test | ||
| 768 | TEST_F(FeatureSupportTest, Options6Basic) | ||
| 769 | { | ||
| 770 | device->m_AdditionalShadingRatesSupported = true; | ||
| 771 | device->m_BackgroundProcessingSupported = true; | ||
| 772 | device->m_PerPrimitiveShadingRateSupportedWithViewportIndexing = true; | ||
| 773 | device->m_ShadingRateImageTileSize = 10; | ||
| 774 | device->m_VariableShadingRateTier = D3D12_VARIABLE_SHADING_RATE_TIER_2; | ||
| 775 | |||
| 776 | INIT_FEATURES(); | ||
| 777 | |||
| 778 | EXPECT_TRUE(features.AdditionalShadingRatesSupported()); | ||
| 779 | EXPECT_TRUE(features.BackgroundProcessingSupported()); | ||
| 780 | EXPECT_TRUE(features.PerPrimitiveShadingRateSupportedWithViewportIndexing()); | ||
| 781 | EXPECT_EQ(features.ShadingRateImageTileSize(), 10); | ||
| 782 | EXPECT_EQ(features.VariableShadingRateTier(), D3D12_VARIABLE_SHADING_RATE_TIER_2); | ||
| 783 | } | ||
| 784 | |||
| 785 | // Unavailable Test | ||
| 786 | TEST_F(FeatureSupportTest, Options6Unavailable) | ||
| 787 | { | ||
| 788 | device->m_Options6Available = false; | ||
| 789 | device->m_AdditionalShadingRatesSupported = true; | ||
| 790 | device->m_BackgroundProcessingSupported = true; | ||
| 791 | device->m_PerPrimitiveShadingRateSupportedWithViewportIndexing = true; | ||
| 792 | device->m_ShadingRateImageTileSize = 10; | ||
| 793 | device->m_VariableShadingRateTier = D3D12_VARIABLE_SHADING_RATE_TIER_2; | ||
| 794 | |||
| 795 | INIT_FEATURES(); | ||
| 796 | |||
| 797 | EXPECT_FALSE(features.AdditionalShadingRatesSupported()); | ||
| 798 | EXPECT_FALSE(features.BackgroundProcessingSupported()); | ||
| 799 | EXPECT_FALSE(features.PerPrimitiveShadingRateSupportedWithViewportIndexing()); | ||
| 800 | EXPECT_EQ(features.ShadingRateImageTileSize(), 0); | ||
| 801 | EXPECT_EQ(features.VariableShadingRateTier(), D3D12_VARIABLE_SHADING_RATE_TIER_NOT_SUPPORTED); | ||
| 802 | } | ||
| 803 | |||
| 804 | // 31: Query Meta Command | ||
| 805 | // Only performs input and output consistency checks; not reflecting results from real device | ||
| 806 | // Basic Test | ||
| 807 | TEST_F(FeatureSupportTest, QueryMetaCommandBasic) | ||
| 808 | { | ||
| 809 | UINT MockOutput[2] = {2, 8}; | ||
| 810 | UINT MockOutputSize = sizeof(MockOutput); | ||
| 811 | device->m_pQueryOutputData = MockOutput; | ||
| 812 | device->m_QueryOutputDataSizeInBytes = MockOutputSize; | ||
| 813 | |||
| 814 | UINT MockInput[3] = {3, 6, 42}; | ||
| 815 | UINT MockInputSize = sizeof(MockInput); | ||
| 816 | GUID MockCommandID = {1, 5, 9, {12, 17, 23, 38}}; // Not a real CommandID | ||
| 817 | UINT MockNodeMask = 0x12; | ||
| 818 | |||
| 819 | D3D12_FEATURE_DATA_QUERY_META_COMMAND QueryData; | ||
| 820 | QueryData.CommandId = MockCommandID; | ||
| 821 | QueryData.NodeMask = MockNodeMask; | ||
| 822 | QueryData.QueryInputDataSizeInBytes = MockInputSize; | ||
| 823 | QueryData.pQueryInputData = MockInput; | ||
| 824 | QueryData.QueryOutputDataSizeInBytes = MockOutputSize; | ||
| 825 | QueryData.pQueryOutputData = MockOutput; | ||
| 826 | |||
| 827 | INIT_FEATURES(); | ||
| 828 | |||
| 829 | HRESULT result = features.QueryMetaCommand(QueryData); | ||
| 830 | EXPECT_EQ(result, S_OK); | ||
| 831 | EXPECT_EQ(device->m_CommandID, MockCommandID); | ||
| 832 | EXPECT_EQ(device->m_NodeMask, MockNodeMask); | ||
| 833 | EXPECT_EQ(device->m_QueryInputDataSizeInBytes, MockInputSize); | ||
| 834 | EXPECT_EQ(device->m_pQueryInputData, MockInput); | ||
| 835 | EXPECT_EQ(QueryData.QueryOutputDataSizeInBytes, MockOutputSize); | ||
| 836 | EXPECT_EQ(QueryData.pQueryOutputData, MockOutput); | ||
| 837 | } | ||
| 838 | |||
| 839 | // 32: Options7 | ||
| 840 | // Basic Test | ||
| 841 | TEST_F(FeatureSupportTest, Options7Basic) | ||
| 842 | { | ||
| 843 | device->m_MeshShaderTier = D3D12_MESH_SHADER_TIER_1; | ||
| 844 | device->m_SamplerFeedbackTier = D3D12_SAMPLER_FEEDBACK_TIER_1_0; | ||
| 845 | |||
| 846 | INIT_FEATURES(); | ||
| 847 | |||
| 848 | EXPECT_EQ(features.MeshShaderTier(), D3D12_MESH_SHADER_TIER_1); | ||
| 849 | EXPECT_EQ(features.SamplerFeedbackTier(), D3D12_SAMPLER_FEEDBACK_TIER_1_0); | ||
| 850 | } | ||
| 851 | |||
| 852 | // Unavailable Test | ||
| 853 | TEST_F(FeatureSupportTest, Options7Unavailable) | ||
| 854 | { | ||
| 855 | device->m_Options7Available = false; | ||
| 856 | device->m_MeshShaderTier = D3D12_MESH_SHADER_TIER_1; | ||
| 857 | device->m_SamplerFeedbackTier = D3D12_SAMPLER_FEEDBACK_TIER_1_0; | ||
| 858 | |||
| 859 | INIT_FEATURES(); | ||
| 860 | |||
| 861 | EXPECT_EQ(features.MeshShaderTier(), D3D12_MESH_SHADER_TIER_NOT_SUPPORTED); | ||
| 862 | EXPECT_EQ(features.SamplerFeedbackTier(), D3D12_SAMPLER_FEEDBACK_TIER_NOT_SUPPORTED); | ||
| 863 | } | ||
| 864 | |||
| 865 | // 33: Protected Resource Session Type Count | ||
| 866 | // Basic Test | ||
| 867 | TEST_F(FeatureSupportTest, ProtectedResourceSessionTypeCountBasic) | ||
| 868 | { | ||
| 869 | device->m_ProtectedResourceSessionTypeCount[0] = 5; | ||
| 870 | device->m_ProtectedResourceSessionTypes[0].resize(5); // Must set the session types to a correct number | ||
| 871 | |||
| 872 | INIT_FEATURES(); | ||
| 873 | |||
| 874 | EXPECT_EQ(features.ProtectedResourceSessionTypeCount(0), 5); | ||
| 875 | } | ||
| 876 | |||
| 877 | // Multinode Test | ||
| 878 | TEST_F(FeatureSupportTest, ProtectedResourceSessionTypeCountMultinode) | ||
| 879 | { | ||
| 880 | device->SetNodeCount(3); | ||
| 881 | device->m_ProtectedResourceSessionTypeCount = {3, 14, 21}; | ||
| 882 | device->m_ProtectedResourceSessionTypes[0].resize(3); | ||
| 883 | device->m_ProtectedResourceSessionTypes[1].resize(14); | ||
| 884 | device->m_ProtectedResourceSessionTypes[2].resize(21); | ||
| 885 | |||
| 886 | INIT_FEATURES(); | ||
| 887 | |||
| 888 | EXPECT_EQ(features.ProtectedResourceSessionTypeCount(0), 3); | ||
| 889 | EXPECT_EQ(features.ProtectedResourceSessionTypeCount(1), 14); | ||
| 890 | EXPECT_EQ(features.ProtectedResourceSessionTypeCount(2), 21); | ||
| 891 | } | ||
| 892 | |||
| 893 | // Unavailable Test | ||
| 894 | TEST_F(FeatureSupportTest, ProtectedResourceSessionTypeCountUnavailable) | ||
| 895 | { | ||
| 896 | device->m_ProtectedResourceSessionTypeCountAvailable = false; | ||
| 897 | device->SetNodeCount(3); | ||
| 898 | device->m_ProtectedResourceSessionTypeCount = {3, 14, 21}; | ||
| 899 | device->m_ProtectedResourceSessionTypes[0].resize(3); | ||
| 900 | device->m_ProtectedResourceSessionTypes[1].resize(14); | ||
| 901 | device->m_ProtectedResourceSessionTypes[2].resize(21); | ||
| 902 | |||
| 903 | INIT_FEATURES(); | ||
| 904 | |||
| 905 | EXPECT_EQ(features.ProtectedResourceSessionTypeCount(0), 0); | ||
| 906 | EXPECT_EQ(features.ProtectedResourceSessionTypeCount(1), 0); | ||
| 907 | EXPECT_EQ(features.ProtectedResourceSessionTypeCount(2), 0); | ||
| 908 | } | ||
| 909 | |||
| 910 | // 34: Protected Resource Session Types | ||
| 911 | // Note: Protected Resource Seesion Type Count must be correctly set for this feature | ||
| 912 | // Basic Test | ||
| 913 | TEST_F(FeatureSupportTest, ProtectedResourceSessionTypesBasic) | ||
| 914 | { | ||
| 915 | device->m_ProtectedResourceSessionTypeCount[0] = 2; | ||
| 916 | device->m_ProtectedResourceSessionTypes[0] = {{1, 1, 2, {3, 5, 8, 13}}, {1, 4, 9, {16, 25, 36, 49}}}; // Some random GUID test data | ||
| 917 | |||
| 918 | INIT_FEATURES(); | ||
| 919 | |||
| 920 | EXPECT_EQ(features.ProtectedResourceSessionTypes(), device->m_ProtectedResourceSessionTypes[0]); | ||
| 921 | } | ||
| 922 | |||
| 923 | // Multinode Test | ||
| 924 | TEST_F(FeatureSupportTest, ProtectedResourceSessionTypesMultinode) | ||
| 925 | { | ||
| 926 | device->SetNodeCount(2); | ||
| 927 | device->m_ProtectedResourceSessionTypeCount = {2, 1}; | ||
| 928 | device->m_ProtectedResourceSessionTypes[0] = {{1, 1, 2, {3, 5, 8, 13}}, {1, 4, 9, {16, 25, 36, 49}}}; // Some random GUID test data | ||
| 929 | device->m_ProtectedResourceSessionTypes[1] = {{5, 7, 9, {11, 13, 15, 17}}}; | ||
| 930 | |||
| 931 | INIT_FEATURES(); | ||
| 932 | |||
| 933 | EXPECT_EQ(features.ProtectedResourceSessionTypes(0), device->m_ProtectedResourceSessionTypes[0]); | ||
| 934 | EXPECT_EQ(features.ProtectedResourceSessionTypes(1), device->m_ProtectedResourceSessionTypes[1]); | ||
| 935 | } | ||
| 936 | |||
| 937 | // Unavailable Test | ||
| 938 | TEST_F(FeatureSupportTest, ProtectedResourceSessionTypesUnavailable) | ||
| 939 | { | ||
| 940 | device->m_ProtectedResourceSessionTypesAvailable = false; | ||
| 941 | device->m_ProtectedResourceSessionTypeCount[0] = 2; | ||
| 942 | device->m_ProtectedResourceSessionTypes[0] = {{1, 1, 2, {3, 5, 8, 13}}, {1, 4, 9, {16, 25, 36, 49}}}; // Some random GUID test data | ||
| 943 | |||
| 944 | INIT_FEATURES(); | ||
| 945 | |||
| 946 | // If the check fails, the types vector should remain empty | ||
| 947 | EXPECT_EQ(features.ProtectedResourceSessionTypes(0).size(), 0); | ||
| 948 | } | ||
| 949 | |||
| 950 | // Test where ProtectedResourceSessiontTypeCount is unavailable | ||
| 951 | TEST_F(FeatureSupportTest, ProtectedResourceSessionTypesCascadeUnavailable) | ||
| 952 | { | ||
| 953 | device->m_ProtectedResourceSessionTypeCountAvailable = false; | ||
| 954 | device->m_ProtectedResourceSessionTypeCount[0] = 2; | ||
| 955 | device->m_ProtectedResourceSessionTypes[0] = {{1, 1, 2, {3, 5, 8, 13}}, {1, 4, 9, {16, 25, 36, 49}}}; // Some random GUID test data | ||
| 956 | |||
| 957 | INIT_FEATURES(); | ||
| 958 | |||
| 959 | EXPECT_EQ(features.ProtectedResourceSessionTypeCount(0), 0); | ||
| 960 | EXPECT_EQ(features.ProtectedResourceSessionTypes(0).size(), 0); | ||
| 961 | } | ||
| 962 | |||
| 963 | // 36: Options8 | ||
| 964 | // Basic Test | ||
| 965 | TEST_F(FeatureSupportTest, Options8Basic) | ||
| 966 | { | ||
| 967 | device->m_UnalignedBlockTexturesSupported = true; | ||
| 968 | INIT_FEATURES(); | ||
| 969 | EXPECT_TRUE(features.UnalignedBlockTexturesSupported()); | ||
| 970 | } | ||
| 971 | |||
| 972 | // Unavailable Test | ||
| 973 | TEST_F(FeatureSupportTest, Options8Unavailable) | ||
| 974 | { | ||
| 975 | device->m_Options8Available = false; | ||
| 976 | device->m_UnalignedBlockTexturesSupported = true; | ||
| 977 | INIT_FEATURES(); | ||
| 978 | EXPECT_FALSE(features.UnalignedBlockTexturesSupported()); | ||
| 979 | } | ||
| 980 | |||
| 981 | // 37: Options9 | ||
| 982 | // Basic Test | ||
| 983 | TEST_F(FeatureSupportTest, Options9Basic) | ||
| 984 | { | ||
| 985 | device->m_MeshShaderPipelineStatsSupported = true; | ||
| 986 | device->m_MeshShaderSupportsFullRangeRenderTargetArrayIndex = true; | ||
| 987 | device->m_AtomicInt64OnTypedResourceSupported = true; | ||
| 988 | device->m_AtomicInt64OnGroupSharedSupported = true; | ||
| 989 | device->m_DerivativesInMeshAndAmplificationShadersSupported = true; | ||
| 990 | device->m_WaveMMATier = D3D12_WAVE_MMA_TIER_1_0; | ||
| 991 | |||
| 992 | INIT_FEATURES(); | ||
| 993 | |||
| 994 | EXPECT_TRUE(features.MeshShaderPipelineStatsSupported()); | ||
| 995 | EXPECT_TRUE(features.MeshShaderSupportsFullRangeRenderTargetArrayIndex()); | ||
| 996 | EXPECT_TRUE(features.AtomicInt64OnTypedResourceSupported()); | ||
| 997 | EXPECT_TRUE(features.AtomicInt64OnGroupSharedSupported()); | ||
| 998 | EXPECT_TRUE(features.DerivativesInMeshAndAmplificationShadersSupported()); | ||
| 999 | EXPECT_EQ(features.WaveMMATier(), D3D12_WAVE_MMA_TIER_1_0); | ||
| 1000 | } | ||
| 1001 | |||
| 1002 | // Unavailable Test | ||
| 1003 | TEST_F(FeatureSupportTest, Options9Unavailable) | ||
| 1004 | { | ||
| 1005 | device->m_Options9Available = false; | ||
| 1006 | device->m_MeshShaderPipelineStatsSupported = true; | ||
| 1007 | device->m_MeshShaderSupportsFullRangeRenderTargetArrayIndex = true; | ||
| 1008 | device->m_AtomicInt64OnTypedResourceSupported = true; | ||
| 1009 | device->m_AtomicInt64OnGroupSharedSupported = true; | ||
| 1010 | device->m_DerivativesInMeshAndAmplificationShadersSupported = true; | ||
| 1011 | device->m_WaveMMATier = D3D12_WAVE_MMA_TIER_1_0; | ||
| 1012 | |||
| 1013 | INIT_FEATURES(); | ||
| 1014 | |||
| 1015 | EXPECT_FALSE(features.MeshShaderPipelineStatsSupported()); | ||
| 1016 | EXPECT_FALSE(features.MeshShaderSupportsFullRangeRenderTargetArrayIndex()); | ||
| 1017 | EXPECT_FALSE(features.AtomicInt64OnTypedResourceSupported()); | ||
| 1018 | EXPECT_FALSE(features.AtomicInt64OnGroupSharedSupported()); | ||
| 1019 | EXPECT_FALSE(features.DerivativesInMeshAndAmplificationShadersSupported()); | ||
| 1020 | EXPECT_EQ(features.WaveMMATier(), D3D12_WAVE_MMA_TIER_NOT_SUPPORTED); | ||
| 1021 | } | ||
| 1022 | |||
| 1023 | // 39: Options10 | ||
| 1024 | // Basic Test | ||
| 1025 | TEST_F(FeatureSupportTest, Options10Basic) | ||
| 1026 | { | ||
| 1027 | device->m_VariableRateShadingSumCombinerSupported = true; | ||
| 1028 | device->m_MeshShaderPerPrimitiveShadingRateSupported = true; | ||
| 1029 | |||
| 1030 | INIT_FEATURES(); | ||
| 1031 | |||
| 1032 | EXPECT_TRUE(features.VariableRateShadingSumCombinerSupported()); | ||
| 1033 | EXPECT_TRUE(features.MeshShaderPerPrimitiveShadingRateSupported()); | ||
| 1034 | } | ||
| 1035 | |||
| 1036 | // Unavailable Test | ||
| 1037 | TEST_F(FeatureSupportTest, Options10Unavailable) | ||
| 1038 | { | ||
| 1039 | device->m_Options10Available = false; | ||
| 1040 | device->m_VariableRateShadingSumCombinerSupported = true; | ||
| 1041 | device->m_MeshShaderPerPrimitiveShadingRateSupported = true; | ||
| 1042 | |||
| 1043 | INIT_FEATURES(); | ||
| 1044 | |||
| 1045 | EXPECT_FALSE(features.VariableRateShadingSumCombinerSupported()); | ||
| 1046 | EXPECT_FALSE(features.MeshShaderPerPrimitiveShadingRateSupported()); | ||
| 1047 | } | ||
| 1048 | |||
| 1049 | // 40: Options11 | ||
| 1050 | // Basic Test | ||
| 1051 | TEST_F(FeatureSupportTest, Options11Basic) | ||
| 1052 | { | ||
| 1053 | device->m_AtomicInt64OnDescriptorHeapResourceSupported = true; | ||
| 1054 | INIT_FEATURES(); | ||
| 1055 | EXPECT_TRUE(features.AtomicInt64OnDescriptorHeapResourceSupported()); | ||
| 1056 | } | ||
| 1057 | |||
| 1058 | // Unavailable Test | ||
| 1059 | TEST_F(FeatureSupportTest, Options11Unavailable) | ||
| 1060 | { | ||
| 1061 | device->m_Options11Available = false; | ||
| 1062 | device->m_AtomicInt64OnDescriptorHeapResourceSupported = true; | ||
| 1063 | INIT_FEATURES(); | ||
| 1064 | EXPECT_FALSE(features.AtomicInt64OnDescriptorHeapResourceSupported()); | ||
| 1065 | } | ||
| 1066 | |||
| 1067 | // 41: Options12 | ||
| 1068 | // Basic Test | ||
| 1069 | TEST_F(FeatureSupportTest, Options12Basic) | ||
| 1070 | { | ||
| 1071 | device->m_MSPrimitivesPipelineStatisticIncludesCulledPrimitives = D3D12_TRI_STATE_TRUE; | ||
| 1072 | device->m_EnhancedBarriersSupported = true; | ||
| 1073 | INIT_FEATURES(); | ||
| 1074 | EXPECT_EQ(features.MSPrimitivesPipelineStatisticIncludesCulledPrimitives(), D3D12_TRI_STATE_TRUE); | ||
| 1075 | EXPECT_TRUE(features.EnhancedBarriersSupported()); | ||
| 1076 | } | ||
| 1077 | |||
| 1078 | // Unavailable Test | ||
| 1079 | TEST_F(FeatureSupportTest, Options12Unavailable) | ||
| 1080 | { | ||
| 1081 | device->m_Options12Available = false; | ||
| 1082 | device->m_MSPrimitivesPipelineStatisticIncludesCulledPrimitives = D3D12_TRI_STATE_TRUE; | ||
| 1083 | device->m_EnhancedBarriersSupported = true; | ||
| 1084 | INIT_FEATURES(); | ||
| 1085 | EXPECT_EQ(features.MSPrimitivesPipelineStatisticIncludesCulledPrimitives(), D3D12_TRI_STATE_UNKNOWN); | ||
| 1086 | EXPECT_FALSE(features.EnhancedBarriersSupported()); | ||
| 1087 | } | ||
| 1088 | |||
| 1089 | // Duplicate Caps Tests | ||
| 1090 | // This test ensures that caps that are present in more than one features reports correctly | ||
| 1091 | // when either of them are unavailable on the runtime | ||
| 1092 | |||
| 1093 | // Cross Node Sharing Tier: D3D12Options, CrossNode | ||
| 1094 | TEST_F(FeatureSupportTest, DuplicateCrossNodeSharingTier) | ||
| 1095 | { | ||
| 1096 | device->m_CrossNodeSharingTier = D3D12_CROSS_NODE_SHARING_TIER_3; | ||
| 1097 | device->m_CrossNodeAvailable = false; | ||
| 1098 | |||
| 1099 | INIT_FEATURES(); | ||
| 1100 | |||
| 1101 | EXPECT_EQ(features.CrossNodeSharingTier(), D3D12_CROSS_NODE_SHARING_TIER_3); | ||
| 1102 | } | ||
| 1103 | |||
| 1104 | // Shared Resource Compatibility Tier: D3D12Options4, Displayable | ||
| 1105 | TEST_F(FeatureSupportTest, DuplicateSharedResourceCompatibilityTier) | ||
| 1106 | { | ||
| 1107 | device->m_SharedResourceCompatibilityTier = D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_2; | ||
| 1108 | device->m_DisplayableAvailable = false; | ||
| 1109 | |||
| 1110 | INIT_FEATURES(); | ||
| 1111 | EXPECT_EQ(features.SharedResourceCompatibilityTier(), D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_2); | ||
| 1112 | } | ||
| 1113 | |||
| 1114 | // Test where both features are unavailable | ||
| 1115 | TEST_F(FeatureSupportTest, DuplicateSharedResourceCompatibilityTierNegatvie) | ||
| 1116 | { | ||
| 1117 | device->m_SharedResourceCompatibilityTier = D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_2; | ||
| 1118 | device->m_DisplayableAvailable = false; | ||
| 1119 | device->m_Options4Available = false; | ||
| 1120 | |||
| 1121 | INIT_FEATURES(); | ||
| 1122 | EXPECT_EQ(features.SharedResourceCompatibilityTier(), D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_0); // Fallback to default value | ||
| 1123 | } | ||
| 1124 | |||
| 1125 | // MaxGPUVirtualAddressBitsPerResource also has duplicates, | ||
| 1126 | // but since the two features are always supported, no explicit tests are needed. | ||
| 1127 | |||
| 1128 | // System Test | ||
| 1129 | // Test if the system works when all features are initialized and queries | ||
| 1130 | // Skips functions that only does forwarding | ||
| 1131 | TEST_F(FeatureSupportTest, SystemTest) | ||
| 1132 | { | ||
| 1133 | device->SetNodeCount(2); | ||
| 1134 | device->m_DoublePrecisionFloatShaderOps = true; | ||
| 1135 | device->m_OutputMergerLogicOp = true; | ||
| 1136 | device->m_ShaderMinPrecisionSupport10Bit = D3D12_SHADER_MIN_PRECISION_SUPPORT_10_BIT; | ||
| 1137 | device->m_ShaderMinPrecisionSupport16Bit = D3D12_SHADER_MIN_PRECISION_SUPPORT_16_BIT; | ||
| 1138 | device->m_TiledResourcesTier = D3D12_TILED_RESOURCES_TIER_3; | ||
| 1139 | device->m_ResourceBindingTier = D3D12_RESOURCE_BINDING_TIER_3; | ||
| 1140 | device->m_PSSpecifiedStencilRefSupported = true; | ||
| 1141 | device->m_ConservativeRasterizationTier = D3D12_CONSERVATIVE_RASTERIZATION_TIER_2; | ||
| 1142 | device->m_MaxGPUVirtualAddressBitsPerResource = 10; | ||
| 1143 | device->m_ResourceHeapTier = D3D12_RESOURCE_HEAP_TIER_2; | ||
| 1144 | device->m_TypedUAVLoadAdditionalFormats = true; | ||
| 1145 | device->m_ROVsSupported = true; | ||
| 1146 | device->m_StandardSwizzle64KBSupported = true; | ||
| 1147 | device->m_CrossNodeSharingTier = D3D12_CROSS_NODE_SHARING_TIER_3; | ||
| 1148 | device->m_CrossAdapterRowMajorTextureSupported = true; | ||
| 1149 | device->m_VPAndRTArrayIndexFromAnyShaderFeedingRasterizerSupportedWithoutGSEmulation = true; | ||
| 1150 | |||
| 1151 | device->m_Architecture1Available = true; | ||
| 1152 | device->m_TileBasedRenderer = {false, true}; | ||
| 1153 | device->m_UMA = {true, false}; | ||
| 1154 | device->m_CacheCoherentUMA = {false, true}; | ||
| 1155 | device->m_IsolatedMMU = {true, true}; | ||
| 1156 | |||
| 1157 | device->m_FeatureLevel = D3D_FEATURE_LEVEL_12_2; | ||
| 1158 | |||
| 1159 | device->m_MaxGPUVirtualAddressBitsPerProcess = 16; | ||
| 1160 | |||
| 1161 | device->m_WaveOpsSupported = true; | ||
| 1162 | device->m_WaveLaneCountMin = 2; | ||
| 1163 | device->m_WaveLaneCountMax = 4; | ||
| 1164 | device->m_TotalLaneCount = 8; | ||
| 1165 | device->m_ExpandedComputeResourceStates = true; | ||
| 1166 | device->m_Int64ShaderOpsSupported = true; | ||
| 1167 | |||
| 1168 | device->m_ProtectedResourceSessionSupport = | ||
| 1169 | { | ||
| 1170 | D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAG_NONE, | ||
| 1171 | D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAG_SUPPORTED, | ||
| 1172 | }; | ||
| 1173 | |||
| 1174 | device->m_RootSignatureHighestVersion = D3D_ROOT_SIGNATURE_VERSION_1_1; | ||
| 1175 | |||
| 1176 | device->m_DepthBoundsTestSupport = true; | ||
| 1177 | device->m_ProgrammableSamplePositionsTier = D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER_2; | ||
| 1178 | |||
| 1179 | D3D12_SHADER_CACHE_SUPPORT_FLAGS outFlags = D3D12_SHADER_CACHE_SUPPORT_SINGLE_PSO | ||
| 1180 | | D3D12_SHADER_CACHE_SUPPORT_LIBRARY | ||
| 1181 | | D3D12_SHADER_CACHE_SUPPORT_AUTOMATIC_INPROC_CACHE | ||
| 1182 | | D3D12_SHADER_CACHE_SUPPORT_DRIVER_MANAGED_CACHE | ||
| 1183 | | D3D12_SHADER_CACHE_SUPPORT_SHADER_CONTROL_CLEAR | ||
| 1184 | | D3D12_SHADER_CACHE_SUPPORT_SHADER_SESSION_DELETE; | ||
| 1185 | device->m_ShaderCacheSupportFlags = outFlags; | ||
| 1186 | |||
| 1187 | device->m_GlobalRealtimeCommandQueueSupport = true; | ||
| 1188 | |||
| 1189 | device->m_CopyQueueTimestampQueriesSupported = true; | ||
| 1190 | device->m_CastingFullyTypedFormatsSupported = true; | ||
| 1191 | device->m_GetCachedWriteBufferImmediateSupportFlags = D3D12_COMMAND_LIST_SUPPORT_FLAG_DIRECT | D3D12_COMMAND_LIST_SUPPORT_FLAG_COMPUTE; | ||
| 1192 | device->m_ViewInstancingTier = D3D12_VIEW_INSTANCING_TIER_3; | ||
| 1193 | device->m_BarycentricsSupported = true; | ||
| 1194 | |||
| 1195 | device->m_ExistingHeapCaps = true; | ||
| 1196 | |||
| 1197 | device->m_MSAA64KBAlignedTextureSupported = true; | ||
| 1198 | device->m_SharedResourceCompatibilityTier = D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_2; | ||
| 1199 | device->m_Native16BitShaderOpsSupported = true; | ||
| 1200 | |||
| 1201 | device->m_HeapSerializationTier = | ||
| 1202 | { | ||
| 1203 | D3D12_HEAP_SERIALIZATION_TIER_10, | ||
| 1204 | D3D12_HEAP_SERIALIZATION_TIER_10, | ||
| 1205 | }; | ||
| 1206 | |||
| 1207 | device->m_AtomicShaderInstructions = true; | ||
| 1208 | |||
| 1209 | device->m_RaytracingTier = D3D12_RAYTRACING_TIER_1_1; | ||
| 1210 | device->m_RenderPassesTier = D3D12_RENDER_PASS_TIER_2; | ||
| 1211 | device->m_SRVOnlyTiledResourceTier3 = true; | ||
| 1212 | |||
| 1213 | device->m_DisplayableTexture = true; | ||
| 1214 | |||
| 1215 | device->m_AdditionalShadingRatesSupported = true; | ||
| 1216 | device->m_BackgroundProcessingSupported = true; | ||
| 1217 | device->m_PerPrimitiveShadingRateSupportedWithViewportIndexing = true; | ||
| 1218 | device->m_ShadingRateImageTileSize = 10; | ||
| 1219 | device->m_VariableShadingRateTier = D3D12_VARIABLE_SHADING_RATE_TIER_2; | ||
| 1220 | |||
| 1221 | device->m_MeshShaderTier = D3D12_MESH_SHADER_TIER_1; | ||
| 1222 | device->m_SamplerFeedbackTier = D3D12_SAMPLER_FEEDBACK_TIER_1_0; | ||
| 1223 | |||
| 1224 | device->m_ProtectedResourceSessionTypeCount = {2, 1}; | ||
| 1225 | device->m_ProtectedResourceSessionTypes[0].resize(3); | ||
| 1226 | device->m_ProtectedResourceSessionTypes[1].resize(14); | ||
| 1227 | |||
| 1228 | device->m_ProtectedResourceSessionTypes[0] = {{1, 1, 2, {3, 5, 8, 13}}, {1, 4, 9, {16, 25, 36, 49}}}; // Some random GUID test data | ||
| 1229 | device->m_ProtectedResourceSessionTypes[1] = {{5, 7, 9, {11, 13, 15, 17}}}; | ||
| 1230 | |||
| 1231 | device->m_UnalignedBlockTexturesSupported = true; | ||
| 1232 | |||
| 1233 | device->m_MeshShaderPipelineStatsSupported = true; | ||
| 1234 | device->m_MeshShaderSupportsFullRangeRenderTargetArrayIndex = true; | ||
| 1235 | device->m_AtomicInt64OnTypedResourceSupported = true; | ||
| 1236 | device->m_AtomicInt64OnGroupSharedSupported = true; | ||
| 1237 | device->m_DerivativesInMeshAndAmplificationShadersSupported = true; | ||
| 1238 | device->m_WaveMMATier = D3D12_WAVE_MMA_TIER_1_0; | ||
| 1239 | |||
| 1240 | device->m_VariableRateShadingSumCombinerSupported = true; | ||
| 1241 | device->m_MeshShaderPerPrimitiveShadingRateSupported = true; | ||
| 1242 | |||
| 1243 | device->m_AtomicInt64OnDescriptorHeapResourceSupported = true; | ||
| 1244 | |||
| 1245 | device->m_MSPrimitivesPipelineStatisticIncludesCulledPrimitives = D3D12_TRI_STATE_TRUE; | ||
| 1246 | device->m_EnhancedBarriersSupported = true; | ||
| 1247 | |||
| 1248 | INIT_FEATURES(); | ||
| 1249 | |||
| 1250 | EXPECT_TRUE(features.DoublePrecisionFloatShaderOps()); | ||
| 1251 | EXPECT_TRUE(features.OutputMergerLogicOp()); | ||
| 1252 | EXPECT_EQ(features.MinPrecisionSupport(), D3D12_SHADER_MIN_PRECISION_SUPPORT_10_BIT | D3D12_SHADER_MIN_PRECISION_SUPPORT_16_BIT); | ||
| 1253 | EXPECT_EQ(features.TiledResourcesTier(), D3D12_TILED_RESOURCES_TIER_3); | ||
| 1254 | EXPECT_EQ(features.ResourceBindingTier(), D3D12_RESOURCE_BINDING_TIER_3); | ||
| 1255 | EXPECT_TRUE(features.PSSpecifiedStencilRefSupported()); | ||
| 1256 | EXPECT_TRUE(features.TypedUAVLoadAdditionalFormats()); | ||
| 1257 | EXPECT_TRUE(features.ROVsSupported()); | ||
| 1258 | EXPECT_EQ(features.ConservativeRasterizationTier(), D3D12_CONSERVATIVE_RASTERIZATION_TIER_2); | ||
| 1259 | EXPECT_EQ(features.MaxGPUVirtualAddressBitsPerResource(), 10); | ||
| 1260 | EXPECT_TRUE(features.StandardSwizzle64KBSupported()); | ||
| 1261 | EXPECT_EQ(features.CrossNodeSharingTier(), D3D12_CROSS_NODE_SHARING_TIER_3); | ||
| 1262 | EXPECT_TRUE(features.CrossAdapterRowMajorTextureSupported()); | ||
| 1263 | EXPECT_TRUE(features.VPAndRTArrayIndexFromAnyShaderFeedingRasterizerSupportedWithoutGSEmulation()); | ||
| 1264 | EXPECT_EQ(features.ResourceHeapTier(), D3D12_RESOURCE_HEAP_TIER_2); | ||
| 1265 | |||
| 1266 | EXPECT_FALSE(features.TileBasedRenderer(0)); | ||
| 1267 | EXPECT_TRUE(features.TileBasedRenderer(1)); | ||
| 1268 | EXPECT_TRUE(features.UMA(0)); | ||
| 1269 | EXPECT_FALSE(features.UMA(1)); | ||
| 1270 | EXPECT_FALSE(features.CacheCoherentUMA(0)); | ||
| 1271 | EXPECT_TRUE(features.CacheCoherentUMA(1)); | ||
| 1272 | EXPECT_TRUE(features.IsolatedMMU(0)); | ||
| 1273 | EXPECT_TRUE(features.IsolatedMMU(1)); | ||
| 1274 | |||
| 1275 | EXPECT_EQ(features.MaxSupportedFeatureLevel(), D3D_FEATURE_LEVEL_12_2); | ||
| 1276 | |||
| 1277 | EXPECT_EQ(features.MaxGPUVirtualAddressBitsPerProcess(), 16); | ||
| 1278 | |||
| 1279 | EXPECT_TRUE(features.WaveOps()); | ||
| 1280 | EXPECT_EQ(features.WaveLaneCountMin(), 2); | ||
| 1281 | EXPECT_EQ(features.WaveLaneCountMax(), 4); | ||
| 1282 | EXPECT_EQ(features.TotalLaneCount(), 8); | ||
| 1283 | EXPECT_TRUE(features.ExpandedComputeResourceStates()); | ||
| 1284 | EXPECT_TRUE(features.Int64ShaderOps()); | ||
| 1285 | |||
| 1286 | EXPECT_EQ(features.ProtectedResourceSessionSupport(0), D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAG_NONE); | ||
| 1287 | EXPECT_EQ(features.ProtectedResourceSessionSupport(1), D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAG_SUPPORTED); | ||
| 1288 | |||
| 1289 | EXPECT_EQ(features.HighestRootSignatureVersion(), D3D_ROOT_SIGNATURE_VERSION_1_1); | ||
| 1290 | |||
| 1291 | EXPECT_TRUE(features.DepthBoundsTestSupported()); | ||
| 1292 | EXPECT_EQ(features.ProgrammableSamplePositionsTier(), D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER_2); | ||
| 1293 | |||
| 1294 | EXPECT_EQ(features.ShaderCacheSupportFlags(), outFlags); | ||
| 1295 | |||
| 1296 | EXPECT_TRUE(features.CommandQueuePrioritySupported(D3D12_COMMAND_LIST_TYPE_DIRECT, D3D12_COMMAND_QUEUE_PRIORITY_NORMAL)); | ||
| 1297 | EXPECT_TRUE(features.CommandQueuePrioritySupported(D3D12_COMMAND_LIST_TYPE_DIRECT, D3D12_COMMAND_QUEUE_PRIORITY_HIGH)); | ||
| 1298 | EXPECT_TRUE(features.CommandQueuePrioritySupported(D3D12_COMMAND_LIST_TYPE_DIRECT, D3D12_COMMAND_QUEUE_PRIORITY_GLOBAL_REALTIME)); | ||
| 1299 | |||
| 1300 | EXPECT_TRUE(features.CopyQueueTimestampQueriesSupported()); | ||
| 1301 | EXPECT_TRUE(features.CastingFullyTypedFormatSupported()); | ||
| 1302 | EXPECT_EQ(features.WriteBufferImmediateSupportFlags(), D3D12_COMMAND_LIST_SUPPORT_FLAG_DIRECT | D3D12_COMMAND_LIST_SUPPORT_FLAG_COMPUTE); | ||
| 1303 | EXPECT_EQ(features.ViewInstancingTier(), D3D12_VIEW_INSTANCING_TIER_3); | ||
| 1304 | EXPECT_TRUE(features.BarycentricsSupported()); | ||
| 1305 | |||
| 1306 | EXPECT_TRUE(features.ExistingHeapsSupported()); | ||
| 1307 | |||
| 1308 | EXPECT_TRUE(features.MSAA64KBAlignedTextureSupported()); | ||
| 1309 | EXPECT_EQ(features.SharedResourceCompatibilityTier(), D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_2); | ||
| 1310 | EXPECT_TRUE(features.Native16BitShaderOpsSupported()); | ||
| 1311 | |||
| 1312 | EXPECT_EQ(features.HeapSerializationTier(), D3D12_HEAP_SERIALIZATION_TIER_10); | ||
| 1313 | EXPECT_EQ(features.HeapSerializationTier(1), D3D12_HEAP_SERIALIZATION_TIER_10); | ||
| 1314 | |||
| 1315 | EXPECT_EQ(features.CrossNodeSharingTier(), D3D12_CROSS_NODE_SHARING_TIER_3); | ||
| 1316 | EXPECT_TRUE(features.CrossNodeAtomicShaderInstructions()); | ||
| 1317 | |||
| 1318 | EXPECT_EQ(features.RaytracingTier(), D3D12_RAYTRACING_TIER_1_1); | ||
| 1319 | EXPECT_EQ(features.RenderPassesTier(), D3D12_RENDER_PASS_TIER_2); | ||
| 1320 | EXPECT_TRUE(features.SRVOnlyTiledResourceTier3()); | ||
| 1321 | |||
| 1322 | EXPECT_TRUE(features.DisplayableTexture()); | ||
| 1323 | |||
| 1324 | EXPECT_TRUE(features.AdditionalShadingRatesSupported()); | ||
| 1325 | EXPECT_TRUE(features.BackgroundProcessingSupported()); | ||
| 1326 | EXPECT_TRUE(features.PerPrimitiveShadingRateSupportedWithViewportIndexing()); | ||
| 1327 | EXPECT_EQ(features.ShadingRateImageTileSize(), 10); | ||
| 1328 | EXPECT_EQ(features.VariableShadingRateTier(), D3D12_VARIABLE_SHADING_RATE_TIER_2); | ||
| 1329 | |||
| 1330 | EXPECT_EQ(features.MeshShaderTier(), D3D12_MESH_SHADER_TIER_1); | ||
| 1331 | EXPECT_EQ(features.SamplerFeedbackTier(), D3D12_SAMPLER_FEEDBACK_TIER_1_0); | ||
| 1332 | |||
| 1333 | EXPECT_EQ(features.ProtectedResourceSessionTypeCount(0), 2); | ||
| 1334 | EXPECT_EQ(features.ProtectedResourceSessionTypeCount(1), 1); | ||
| 1335 | EXPECT_EQ(features.ProtectedResourceSessionTypes(0), device->m_ProtectedResourceSessionTypes[0]); | ||
| 1336 | EXPECT_EQ(features.ProtectedResourceSessionTypes(1), device->m_ProtectedResourceSessionTypes[1]); | ||
| 1337 | |||
| 1338 | EXPECT_TRUE(features.UnalignedBlockTexturesSupported()); | ||
| 1339 | |||
| 1340 | EXPECT_TRUE(features.MeshShaderPipelineStatsSupported()); | ||
| 1341 | EXPECT_TRUE(features.MeshShaderSupportsFullRangeRenderTargetArrayIndex()); | ||
| 1342 | EXPECT_TRUE(features.AtomicInt64OnTypedResourceSupported()); | ||
| 1343 | EXPECT_TRUE(features.AtomicInt64OnGroupSharedSupported()); | ||
| 1344 | EXPECT_TRUE(features.DerivativesInMeshAndAmplificationShadersSupported()); | ||
| 1345 | EXPECT_EQ(features.WaveMMATier(), D3D12_WAVE_MMA_TIER_1_0); | ||
| 1346 | |||
| 1347 | EXPECT_TRUE(features.VariableRateShadingSumCombinerSupported()); | ||
| 1348 | EXPECT_TRUE(features.MeshShaderPerPrimitiveShadingRateSupported()); | ||
| 1349 | |||
| 1350 | EXPECT_TRUE(features.AtomicInt64OnDescriptorHeapResourceSupported()); | ||
| 1351 | |||
| 1352 | EXPECT_EQ(features.MSPrimitivesPipelineStatisticIncludesCulledPrimitives(), D3D12_TRI_STATE_TRUE); | ||
| 1353 | EXPECT_TRUE(features.EnhancedBarriersSupported()); | ||
| 1354 | } \ No newline at end of file | ||
diff --git a/contrib/DirectX-Headers-1.618.2/googletest/meson.build b/contrib/DirectX-Headers-1.618.2/googletest/meson.build new file mode 100644 index 0000000..a839782 --- /dev/null +++ b/contrib/DirectX-Headers-1.618.2/googletest/meson.build | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | # Copyright (c) Microsoft Corporation. | ||
| 2 | # Licensed under the MIT License. | ||
| 3 | |||
| 4 | gtest = cpp.find_library('gtest', required: false) | ||
| 5 | gtest_main = cpp.find_library('gtest_main', required: false) | ||
| 6 | |||
| 7 | if gtest.found() and gtest_main.found() | ||
| 8 | feature_support_test = executable('Feature-Support-Test', 'feature_support_test.cpp', | ||
| 9 | dependencies : [gtest, gtest_main, dep_dxheaders, d3d12_lib, dxcore_lib], | ||
| 10 | cpp_args : test_compile_opts, | ||
| 11 | c_args : test_compile_opts) | ||
| 12 | test('Feature-Support-Test', feature_support_test) | ||
| 13 | endif | ||
