New upstream version 1.606.4

This commit is contained in:
denghao 2023-03-29 14:22:21 +08:00
parent fd3de63396
commit 77a12447b1
57 changed files with 18106 additions and 5829 deletions

23
.gitignore vendored Normal file
View File

@ -0,0 +1,23 @@
*.psess
*.vsp
*.log
*.err
*.wrn
*.suo
*.sdf
*.user
*.i
*.vspscc
*.opensdf
*.opendb
*.ipch
*.cache
*.tlog
*.lastbuildstate
*.ilk
*.VC.db
*.nupkg
.vs
/out
/CMakeUserPresets.json
/build*

View File

@ -1 +0,0 @@
debian/patches

View File

@ -1 +0,0 @@
series

View File

@ -1 +0,0 @@
2

View File

View File

@ -3,7 +3,7 @@
cmake_minimum_required(VERSION 3.10.2)
project(DirectX-Headers
LANGUAGES CXX
VERSION 1.4.9
VERSION 1.608.2
)
set(CMAKE_CXX_STANDARD 14)
@ -32,15 +32,16 @@ include(GNUInstallDirs)
# Enables consumers to add this library as a link target to automatically add
# these include directories, regardless of whether this is referenced via subdirectory
# or from an installed location
add_library(DirectX-Headers INTERFACE)
target_include_directories(DirectX-Headers SYSTEM INTERFACE
add_library(DirectX-Headers STATIC src/d3dx12_property_format_table.cpp)
target_include_directories(DirectX-Headers SYSTEM PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)
target_include_directories(DirectX-Headers PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include/directx)
# For non-Windows targets, also add the WSL stubs to the include path
if (NOT WIN32)
target_include_directories(DirectX-Headers SYSTEM INTERFACE
target_include_directories(DirectX-Headers SYSTEM PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/wsl/stubs>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/wsl/stubs>"
)

187
CMakePresets.json Normal file
View File

@ -0,0 +1,187 @@
{
"version": 2,
"configurePresets": [
{
"name": "base",
"displayName": "Basic Config",
"description": "Basic build using Ninja generator",
"generator": "Ninja",
"hidden": true,
"binaryDir": "${sourceDir}/out/build/${presetName}",
"cacheVariables": { "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}" }
},
{
"name": "x64",
"architecture": {
"value": "x64",
"strategy": "external"
},
"hidden": true
},
{
"name": "x86",
"architecture": {
"value": "x86",
"strategy": "external"
},
"hidden": true
},
{
"name": "ARM",
"architecture": {
"value": "arm",
"strategy": "external"
},
"hidden": true
},
{
"name": "ARM64",
"architecture": {
"value": "arm64",
"strategy": "external"
},
"hidden": true
},
{
"name": "Debug",
"cacheVariables": { "CMAKE_BUILD_TYPE": "Debug" },
"hidden": true
},
{
"name": "Release",
"cacheVariables": { "CMAKE_BUILD_TYPE": "RelWithDebInfo" },
"hidden": true
},
{
"name": "MSVC",
"hidden": true,
"cacheVariables": {
"CMAKE_CXX_COMPILER": "cl.exe",
"CMAKE_C_COMPILER": "cl.exe"
},
"toolset": {
"value": "host=x64",
"strategy": "external"
}
},
{
"name": "Clang",
"hidden": true,
"cacheVariables": {
"CMAKE_CXX_COMPILER": "clang-cl.exe",
"CMAKE_C_COMPILER": "clang-cl.exe"
},
"toolset": {
"value": "host=x64",
"strategy": "external"
}
},
{
"name": "GNUC",
"hidden": true,
"cacheVariables": {
"CMAKE_CXX_COMPILER": "g++.exe",
"CMAKE_C_COMPILER": "gcc.exe",
"DXHEADERS_BUILD_TEST": false
},
"toolset": {
"value": "host=x64",
"strategy": "external"
}
},
{
"name": "Intel",
"hidden": true,
"cacheVariables": {
"CMAKE_CXX_COMPILER": "icl.exe",
"DXHEADERS_BUILD_GOOGLE_TEST": false,
"DXHEADERS_BUILD_TEST": false
},
"toolset": {
"value": "host=x64",
"strategy": "external"
}
},
{
"name": "IntelLLVM",
"hidden": true,
"cacheVariables": {
"CMAKE_CXX_COMPILER": "icx.exe",
"DXHEADERS_BUILD_GOOGLE_TEST": false
},
"toolset": {
"value": "host=x64",
"strategy": "external"
}
},
{
"name": "UWP",
"cacheVariables": {
"CMAKE_SYSTEM_NAME": "WindowsStore",
"CMAKE_SYSTEM_VERSION": "10.0"
},
"hidden": true
},
{
"name": "NoTests",
"hidden": true,
"cacheVariables": {
"DXHEADERS_BUILD_TEST": false,
"DXHEADERS_BUILD_GOOGLE_TEST": false
}
},
{ "name": "x64-Debug" , "description": "MSVC for x64 (Debug)", "inherits": [ "base", "x64", "Debug", "MSVC" ] },
{ "name": "x64-Release" , "description": "MSVC for x64 (Release)", "inherits": [ "base", "x64", "Release", "MSVC" ] },
{ "name": "x86-Debug" , "description": "MSVC for x86 (Debug)", "inherits": [ "base", "x86", "Debug", "MSVC" ] },
{ "name": "x86-Release" , "description": "MSVC for x86 (Release)", "inherits": [ "base", "x86", "Release", "MSVC" ] },
{ "name": "arm64-Debug" , "description": "MSVC for ARM64 (Debug)", "inherits": [ "base", "ARM64", "Debug", "MSVC" ] },
{ "name": "arm64-Release", "description": "MSVC for ARM64 (Release)", "inherits": [ "base", "ARM64", "Release", "MSVC" ] },
{ "name": "x64-Debug-UWP" , "description": "MSVC for x64 (Debug) for UWP", "inherits": [ "base", "x64", "Debug", "MSVC", "UWP" ] },
{ "name": "x64-Release-UWP" , "description": "MSVC for x64 (Release) for UWP", "inherits": [ "base", "x64", "Release", "MSVC", "UWP" ] },
{ "name": "x86-Debug-UWP" , "description": "MSVC for x86 (Debug) for UWP", "inherits": [ "base", "x86", "Debug", "MSVC", "UWP" ] },
{ "name": "x86-Release-UWP" , "description": "MSVC for x86 (Release) for UWP", "inherits": [ "base", "x86", "Release", "MSVC", "UWP" ] },
{ "name": "arm-Debug-UWP" , "description": "MSVC for ARM (Debug) for UWP", "inherits": [ "base", "ARM", "Debug", "MSVC", "UWP" ] },
{ "name": "arm-Release-UWP" , "description": "MSVC for ARM (Release) for UWP", "inherits": [ "base", "ARM", "Release", "MSVC", "UWP" ] },
{ "name": "arm64-Debug-UWP" , "description": "MSVC for ARM64 (Debug) for UWP", "inherits": [ "base", "ARM64", "Debug", "MSVC", "UWP" ] },
{ "name": "arm64-Release-UWP", "description": "MSVC for ARM64 (Release) for UWP", "inherits": [ "base", "ARM64", "Release", "MSVC", "UWP" ] },
{ "name": "x64-Debug-Clang" , "description": "Clang/LLVM for x64 (Debug)", "inherits": [ "base", "x64", "Debug", "Clang" ] },
{ "name": "x64-Release-Clang" , "description": "Clang/LLVM for x64 (Release)", "inherits": [ "base", "x64", "Release", "Clang" ] },
{ "name": "x86-Debug-Clang" , "description": "Clang/LLVM for x86 (Debug)", "inherits": [ "base", "x86", "Debug", "Clang" ], "environment": { "CXXFLAGS": "-m32" } },
{ "name": "x86-Release-Clang" , "description": "Clang/LLVM for x86 (Release)", "inherits": [ "base", "x86", "Release", "Clang" ], "environment": { "CXXFLAGS": "-m32" } },
{ "name": "arm64-Debug-Clang" , "description": "Clang/LLVM for AArch64 (Debug)", "inherits": [ "base", "ARM64", "Debug", "Clang" ], "environment": { "CXXFLAGS": "--target=arm64-pc-windows-msvc" } },
{ "name": "arm64-Release-Clang", "description": "Clang/LLVM for AArch64 (Release)", "inherits": [ "base", "ARM64", "Release", "Clang" ], "environment": { "CXXFLAGS": "--target=arm64-pc-windows-msvc" } },
{ "name": "x64-Debug-ICC" , "description": "Intel Classic Compiler (Debug)", "inherits": [ "base", "x64", "Debug", "Intel" ] },
{ "name": "x64-Release-ICC" , "description": "Intel Classic Compiler (Release)", "inherits": [ "base", "x64", "Release", "Intel" ] },
{ "name": "x86-Debug-ICC" , "description": "Intel Classic Compiler (Debug)", "inherits": [ "base", "x86", "Debug", "Intel" ] },
{ "name": "x86-Release-ICC" , "description": "Intel Classic Compiler (Release)", "inherits": [ "base", "x86", "Release", "Intel" ] },
{ "name": "x64-Debug-ICX" , "description": "Intel oneAPI Compiler (Debug)", "inherits": [ "base", "x64", "Debug", "IntelLLVM" ] },
{ "name": "x64-Release-ICX" , "description": "Intel oneAPI Compiler (Release)", "inherits": [ "base", "x64", "Release", "IntelLLVM" ] },
{ "name": "x86-Debug-ICX" , "description": "Intel oneAPI Compiler (Debug)", "inherits": [ "base", "x86", "Debug", "IntelLLVM" ] },
{ "name": "x86-Release-ICX" , "description": "Intel oneAPI Compiler (Release)", "inherits": [ "base", "x86", "Release", "IntelLLVM" ] },
{ "name": "x64-Debug-MinGW" , "description": "MinG-W64 (Debug)", "inherits": [ "base", "x64", "Debug", "GNUC" ], "environment": { "PATH": "$penv{PATH};c:/mingw64/bin" } },
{ "name": "x64-Release-MinGW", "description": "MinG-W64 (Release)", "inherits": [ "base", "x64", "Release", "GNUC" ], "environment": { "PATH": "$penv{PATH};c:/mingw64/bin" } },
{ "name": "x86-Debug-MinGW" , "description": "MinG-W32 (Debug)", "inherits": [ "base", "x86", "Debug", "GNUC" ], "environment": { "PATH": "$penv{PATH};c:/mingw32/bin" } },
{ "name": "x86-Release-MinGW", "description": "MinG-W32 (Release)", "inherits": [ "base", "x86", "Release", "GNUC" ], "environment": { "PATH": "$penv{PATH};c:/mingw32/bin" } },
{ "name": "x64-Debug-WSL" , "description": "WSL x64 (Debug) for Windows 11", "inherits": [ "base", "x64", "Debug" ] },
{ "name": "x64-Release-WSL" , "description": "WSL x64 (Release) for Windows 11", "inherits": [ "base", "x64", "Release" ] },
{ "name": "arm64-Debug-WSL" , "description": "WSL AArch64 (Debug) for Windows 11", "inherits": [ "base", "ARM64", "Debug" ] },
{ "name": "arm64-Release-WSL", "description": "WSL AArch64 (Release) for Windows 11", "inherits": [ "base", "ARM64", "Release" ] },
{ "name": "x64-Debug-Linux" , "description": "Linux x64 (Debug)", "inherits": [ "base", "x64", "Debug", "NoTests" ] },
{ "name": "x64-Release-Linux" , "description": "Linux x64 (Release)", "inherits": [ "base", "x64", "Release", "NoTests" ] },
{ "name": "arm64-Debug-Linux" , "description": "Linux AArch64 (Debug)", "inherits": [ "base", "ARM64", "Debug", "NoTests" ] },
{ "name": "arm64-Release-Linux", "description": "Linux AArch64 (Release)", "inherits": [ "base", "ARM64", "Release", "NoTests" ] }
]
}

View File

@ -1,24 +0,0 @@
directx-headers (1.600.10-1) unstable; urgency=medium
* New upstream release.
-- Timo Aaltonen <tjaalton@debian.org> Wed, 02 Feb 2022 15:59:21 +0200
directx-headers (1.4.9-1) unstable; urgency=medium
* New upstream release.
* copyright: The license is essentially Expat, make it so.
-- Timo Aaltonen <tjaalton@debian.org> Mon, 24 May 2021 16:07:01 +0300
directx-headers (1.0.2-1) unstable; urgency=medium
* control: Add an uploader, bump policy to 4.5.1.
-- Timo Aaltonen <tjaalton@debian.org> Sat, 27 Feb 2021 21:58:53 +0200
directx-headers (1.0.1-1) unstable; urgency=medium
* Initial release (Closes: #980789)
-- Timo Aaltonen <tjaalton@debian.org> Fri, 22 Jan 2021 10:15:40 +0200

View File

@ -1,18 +0,0 @@
Source: directx-headers
Section: graphics
Priority: optional
Maintainer: Debian X Strike Force <debian-x@lists.debian.org>
Uploaders: Timo Aaltonen <tjaalton@debian.org>
Build-Depends: debhelper-compat (= 13),
meson,
Standards-Version: 4.5.1
Homepage: https://github.com/microsoft/DirectX-Headers
Vcs-Browser: https://salsa.debian.org/xorg-team/lib/directx-headers
Vcs-Git: https://salsa.debian.org/xorg-team/lib/directx-headers.git
Rules-Requires-Root: no
Package: directx-headers-dev
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Direct3D 12 headers
This package provides the development headers for Direct3D 12.

View File

@ -1,31 +0,0 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: directx-headers
Upstream-Contact: https://github.com/microsoft/DirectX-Headers/issues
Source: https://github.com/microsoft/DirectX-Headers
Files: *
Copyright: 2021 Microsoft Corporation
License: Expat
Files: debian/*
Copyright: 2021 Timo Aaltonen <tjaalton@debian.org>
License: Expat
License: Expat
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,8 +0,0 @@
#!/usr/bin/make -f
%:
dh $@ --buildsystem=meson
override_dh_auto_configure:
dh_auto_configure -- \
-Dbuild-test=false

View File

@ -1 +0,0 @@
3.0 (quilt)

View File

@ -1,5 +0,0 @@
version=4
opts="filenamemangle=s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%directx-headers-$1.tar.gz%" \
https://github.com/microsoft/DirectX-Headers/tags \
(?:.*?/)?v?(\d[\d.]*)\.tar\.gz

View File

@ -6,10 +6,39 @@ set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG master # Live at head
GIT_TAG main # Live at head
)
FetchContent_MakeAvailable(googletest)
project(DirectX-Headers-GoogleTest-Suite CXX)
list(APPEND dxlibs "")
if(EXISTS "/usr/lib/wsl/lib/")
find_library(libd3d12 d3d12 HINTS /usr/lib/wsl/lib)
list(APPEND dxlibs ${libd3d12})
else()
# Fallback to default: let CMake look for libs
list(APPEND dxlibs d3d12)
endif()
project(DirectX-Headers-GoogleTest-Suite
DESCRIPTION "DirectX-Header tests using GooleTest"
HOMEPAGE_URL "https://github.com/microsoft/DirectX-Headers/"
LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
add_executable(Feature-Support-Test feature_support_test.cpp)
target_link_libraries(Feature-Support-Test DirectX-Headers DirectX-Guids d3d12 dxcore gtest_main)
target_link_libraries(Feature-Support-Test DirectX-Headers DirectX-Guids ${dxlibs} gtest_main)
if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
target_compile_options(Feature-Support-Test PRIVATE -Wno-unused-variable)
endif()
if(WIN32)
target_compile_definitions(Feature-Support-Test PRIVATE _UNICODE UNICODE _WIN32_WINNT=0x0A00)
if(WINDOWS_STORE)
target_compile_definitions(Feature-Support-Test PRIVATE WINAPI_FAMILY=WINAPI_FAMILY_APP)
endif()
endif()

View File

@ -4,6 +4,10 @@
#define DIRECTX_HEADERS_MOCK_DEVICE_HPP
#include <unordered_map>
#ifndef __RPC_FAR
#define __RPC_FAR
#endif
#include <directx/d3d12.h>
#include <directx/dxcore.h>
#include <directx/d3dx12.h>
@ -26,6 +30,8 @@ public: // Constructors and custom functions
}
virtual ~MockDevice() = default;
void SetNodeCount(UINT NewCount)
{
m_NodeCount = NewCount;
@ -502,7 +508,7 @@ public: // IUnknown
default:
return E_INVALIDARG;
}
pRootSig->HighestVersion = min(pRootSig->HighestVersion, m_RootSignatureHighestVersion);
pRootSig->HighestVersion = static_cast<D3D_ROOT_SIGNATURE_VERSION>(std::min<int>(pRootSig->HighestVersion, m_RootSignatureHighestVersion));
} return S_OK;
@ -699,7 +705,7 @@ public: // IUnknown
default:
return E_INVALIDARG;
}
pSM->HighestShaderModel = min(pSM->HighestShaderModel,m_HighestSupportedShaderModel);
pSM->HighestShaderModel = static_cast<D3D_SHADER_MODEL>(std::min<int>(pSM->HighestShaderModel,m_HighestSupportedShaderModel));
} return S_OK;
case D3D12_FEATURE_SHADER_CACHE:
{
@ -1043,7 +1049,21 @@ public: // IUnknown
pD3D12Options11->AtomicInt64OnDescriptorHeapResourceSupported = m_AtomicInt64OnDescriptorHeapResourceSupported;
} return S_OK;
case D3D12_FEATURE_D3D12_OPTIONS12:
{
if (!m_Options12Available)
{
return E_INVALIDARG;
}
D3D12_FEATURE_DATA_D3D12_OPTIONS12* pD3D12Options12 = static_cast<D3D12_FEATURE_DATA_D3D12_OPTIONS12*>(pFeatureSupportData);
if (FeatureSupportDataSize != sizeof(*pD3D12Options12))
{
return E_INVALIDARG;
}
pD3D12Options12->MSPrimitivesPipelineStatisticIncludesCulledPrimitives = m_MSPrimitivesPipelineStatisticIncludesCulledPrimitives;
pD3D12Options12->EnhancedBarriersSupported = m_EnhancedBarriersSupported;
} return S_OK;
default:
return E_INVALIDARG;
@ -1228,6 +1248,11 @@ public: // For simplicity, allow tests to set the internal state values for this
// 40: Options11
bool m_Options11Available = true;
bool m_AtomicInt64OnDescriptorHeapResourceSupported = false;
// 41: Options12
bool m_Options12Available = true;
D3D12_TRI_STATE m_MSPrimitivesPipelineStatisticIncludesCulledPrimitives = D3D12_TRI_STATE_UNKNOWN;
bool m_EnhancedBarriersSupported = false;
};
#endif

View File

@ -2,6 +2,8 @@
// Licensed under the MIT License.
#include "gtest/gtest.h"
#include <wsl/winadapter.h>
#include <directx/d3d12.h>
#include <directx/dxcore.h>
#include <directx/d3dx12.h>
@ -608,12 +610,12 @@ TEST_F(FeatureSupportTest, ExistingHeapsUnavailable)
TEST_F(FeatureSupportTest, Options4Basic)
{
device->m_MSAA64KBAlignedTextureSupported = true;
device->m_SharedResourceCompatibilityTier = D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_3; // Duplicate member
device->m_SharedResourceCompatibilityTier = D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_2; // Duplicate member
device->m_Native16BitShaderOpsSupported = true;
INIT_FEATURES();
EXPECT_TRUE(features.MSAA64KBAlignedTextureSupported());
EXPECT_EQ(features.SharedResourceCompatibilityTier(), D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_3);
EXPECT_EQ(features.SharedResourceCompatibilityTier(), D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_2);
EXPECT_TRUE(features.Native16BitShaderOpsSupported());
}
@ -622,7 +624,7 @@ TEST_F(FeatureSupportTest, Options4Unavailable)
{
device->m_Options4Available = false;
device->m_MSAA64KBAlignedTextureSupported = true;
device->m_SharedResourceCompatibilityTier = D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_3; // Duplicate member
device->m_SharedResourceCompatibilityTier = D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_2; // Duplicate member
device->m_Native16BitShaderOpsSupported = true;
INIT_FEATURES();
@ -740,12 +742,12 @@ TEST_F(FeatureSupportTest, Options5Unavailable)
TEST_F(FeatureSupportTest, DisplayableBasic)
{
device->m_DisplayableTexture = true;
device->m_SharedResourceCompatibilityTier = D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_3;
device->m_SharedResourceCompatibilityTier = D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_2;
INIT_FEATURES();
EXPECT_TRUE(features.DisplayableTexture());
EXPECT_EQ(features.SharedResourceCompatibilityTier(), D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_3);
EXPECT_EQ(features.SharedResourceCompatibilityTier(), D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_2);
}
// Unavailable Test
@ -753,12 +755,12 @@ TEST_F(FeatureSupportTest, DisplayableUnavailable)
{
device->m_DisplayableAvailable = false;
device->m_DisplayableTexture = true;
device->m_SharedResourceCompatibilityTier = D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_3;
device->m_SharedResourceCompatibilityTier = D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_2;
INIT_FEATURES();
EXPECT_FALSE(features.DisplayableTexture());
EXPECT_EQ(features.SharedResourceCompatibilityTier(), D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_3); // Still initialized by Options4
EXPECT_EQ(features.SharedResourceCompatibilityTier(), D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_2); // Still initialized by Options4
}
// 30: D3D12 Options6
@ -1062,6 +1064,28 @@ TEST_F(FeatureSupportTest, Options11Unavailable)
EXPECT_FALSE(features.AtomicInt64OnDescriptorHeapResourceSupported());
}
// 41: Options12
// Basic Test
TEST_F(FeatureSupportTest, Options12Basic)
{
device->m_MSPrimitivesPipelineStatisticIncludesCulledPrimitives = D3D12_TRI_STATE_TRUE;
device->m_EnhancedBarriersSupported = true;
INIT_FEATURES();
EXPECT_EQ(features.MSPrimitivesPipelineStatisticIncludesCulledPrimitives(), D3D12_TRI_STATE_TRUE);
EXPECT_TRUE(features.EnhancedBarriersSupported());
}
// Unavailable Test
TEST_F(FeatureSupportTest, Options12Unavailable)
{
device->m_Options12Available = false;
device->m_MSPrimitivesPipelineStatisticIncludesCulledPrimitives = D3D12_TRI_STATE_TRUE;
device->m_EnhancedBarriersSupported = true;
INIT_FEATURES();
EXPECT_EQ(features.MSPrimitivesPipelineStatisticIncludesCulledPrimitives(), D3D12_TRI_STATE_UNKNOWN);
EXPECT_FALSE(features.EnhancedBarriersSupported());
}
// Duplicate Caps Tests
// This test ensures that caps that are present in more than one features reports correctly
// when either of them are unavailable on the runtime
@ -1080,17 +1104,17 @@ TEST_F(FeatureSupportTest, DuplicateCrossNodeSharingTier)
// Shared Resource Compatibility Tier: D3D12Options4, Displayable
TEST_F(FeatureSupportTest, DuplicateSharedResourceCompatibilityTier)
{
device->m_SharedResourceCompatibilityTier = D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_3;
device->m_SharedResourceCompatibilityTier = D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_2;
device->m_DisplayableAvailable = false;
INIT_FEATURES();
EXPECT_EQ(features.SharedResourceCompatibilityTier(), D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_3);
EXPECT_EQ(features.SharedResourceCompatibilityTier(), D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_2);
}
// Test where both features are unavailable
TEST_F(FeatureSupportTest, DuplicateSharedResourceCompatibilityTierNegatvie)
{
device->m_SharedResourceCompatibilityTier = D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_3;
device->m_SharedResourceCompatibilityTier = D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_2;
device->m_DisplayableAvailable = false;
device->m_Options4Available = false;
@ -1171,7 +1195,7 @@ TEST_F(FeatureSupportTest, SystemTest)
device->m_ExistingHeapCaps = true;
device->m_MSAA64KBAlignedTextureSupported = true;
device->m_SharedResourceCompatibilityTier = D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_3;
device->m_SharedResourceCompatibilityTier = D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_2;
device->m_Native16BitShaderOpsSupported = true;
device->m_HeapSerializationTier =
@ -1218,6 +1242,9 @@ TEST_F(FeatureSupportTest, SystemTest)
device->m_AtomicInt64OnDescriptorHeapResourceSupported = true;
device->m_MSPrimitivesPipelineStatisticIncludesCulledPrimitives = D3D12_TRI_STATE_TRUE;
device->m_EnhancedBarriersSupported = true;
INIT_FEATURES();
EXPECT_TRUE(features.DoublePrecisionFloatShaderOps());
@ -1279,7 +1306,7 @@ TEST_F(FeatureSupportTest, SystemTest)
EXPECT_TRUE(features.ExistingHeapsSupported());
EXPECT_TRUE(features.MSAA64KBAlignedTextureSupported());
EXPECT_EQ(features.SharedResourceCompatibilityTier(), D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_3);
EXPECT_EQ(features.SharedResourceCompatibilityTier(), D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_2);
EXPECT_TRUE(features.Native16BitShaderOpsSupported());
EXPECT_EQ(features.HeapSerializationTier(), D3D12_HEAP_SERIALIZATION_TIER_10);
@ -1321,4 +1348,7 @@ TEST_F(FeatureSupportTest, SystemTest)
EXPECT_TRUE(features.MeshShaderPerPrimitiveShadingRateSupported());
EXPECT_TRUE(features.AtomicInt64OnDescriptorHeapResourceSupported());
EXPECT_EQ(features.MSPrimitivesPipelineStatisticIncludesCulledPrimitives(), D3D12_TRI_STATE_TRUE);
EXPECT_TRUE(features.EnhancedBarriersSupported());
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -4,8 +4,8 @@
* Licensed under the MIT license
*
*-------------------------------------------------------------------------------------*/
import "OAIdl.idl";
import "OCIdl.idl";
import "oaidl.idl";
import "ocidl.idl";
import "dxgicommon.idl";
import "dxgiformat.idl";
@ -293,7 +293,7 @@ const UINT D3D12_OS_RESERVED_REGISTER_SPACE_VALUES_END = 0xffffffff;
const UINT D3D12_OS_RESERVED_REGISTER_SPACE_VALUES_START = 0xfffffff8;
const UINT D3D12_PACKED_TILE = 0xffffffff;
const UINT D3D12_PIXEL_ADDRESS_RANGE_BIT_COUNT = 15;
const UINT D3D12_PREVIEW_SDK_VERSION = 700;
const UINT D3D12_PREVIEW_SDK_VERSION = 707;
const UINT D3D12_PRE_SCISSOR_PIXEL_ADDRESS_RANGE_BIT_COUNT = 16;
const UINT D3D12_PS_CS_UAV_REGISTER_COMPONENTS = 1;
const UINT D3D12_PS_CS_UAV_REGISTER_COUNT = 8;
@ -361,7 +361,7 @@ const UINT D3D12_REQ_TEXTURECUBE_DIMENSION = 16384;
const UINT D3D12_RESINFO_INSTRUCTION_MISSING_COMPONENT_RETVAL = 0;
const UINT D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES = 0xffffffff;
const UINT D3D12_RS_SET_SHADING_RATE_COMBINER_COUNT = 2;
const UINT D3D12_SDK_VERSION = 600;
const UINT D3D12_SDK_VERSION = 608;
const UINT D3D12_SHADER_IDENTIFIER_SIZE_IN_BYTES = 32;
const UINT D3D12_SHADER_MAJOR_VERSION = 5;
const UINT D3D12_SHADER_MAX_INSTANCES = 65535;
@ -460,6 +460,8 @@ typedef enum D3D12_COMMAND_LIST_TYPE
D3D12_COMMAND_LIST_TYPE_VIDEO_PROCESS = 5,
D3D12_COMMAND_LIST_TYPE_VIDEO_ENCODE = 6,
D3D12_COMMAND_LIST_TYPE_NONE = -1,
} D3D12_COMMAND_LIST_TYPE;
typedef enum D3D12_COMMAND_QUEUE_FLAGS
@ -574,6 +576,7 @@ typedef struct D3D12_BOX
// Keep COMPARISON_FUNC values in sync with earlier DX versions (HW consumes values directly).
typedef enum D3D12_COMPARISON_FUNC
{
D3D12_COMPARISON_FUNC_NONE = 0,
D3D12_COMPARISON_FUNC_NEVER = 1,
D3D12_COMPARISON_FUNC_LESS = 2,
D3D12_COMPARISON_FUNC_EQUAL = 3,
@ -636,6 +639,28 @@ typedef struct D3D12_DEPTH_STENCIL_DESC1
BOOL DepthBoundsTestEnable;
} D3D12_DEPTH_STENCIL_DESC1;
// Front/back face independent stencil masks
typedef struct D3D12_DEPTH_STENCILOP_DESC1
{
D3D12_STENCIL_OP StencilFailOp;
D3D12_STENCIL_OP StencilDepthFailOp;
D3D12_STENCIL_OP StencilPassOp;
D3D12_COMPARISON_FUNC StencilFunc;
UINT8 StencilReadMask;
UINT8 StencilWriteMask;
} D3D12_DEPTH_STENCILOP_DESC1;
typedef struct D3D12_DEPTH_STENCIL_DESC2
{
BOOL DepthEnable;
D3D12_DEPTH_WRITE_MASK DepthWriteMask;
D3D12_COMPARISON_FUNC DepthFunc;
BOOL StencilEnable;
D3D12_DEPTH_STENCILOP_DESC1 FrontFace;
D3D12_DEPTH_STENCILOP_DESC1 BackFace;
BOOL DepthBoundsTestEnable;
} D3D12_DEPTH_STENCIL_DESC2;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
@ -665,6 +690,8 @@ typedef enum D3D12_BLEND
D3D12_BLEND_INV_SRC1_COLOR = 17, // 1.0f - PS output o1.rgb
D3D12_BLEND_SRC1_ALPHA = 18, // PS output o1.a
D3D12_BLEND_INV_SRC1_ALPHA = 19, // 1.0f - PS output o1.a
D3D12_BLEND_ALPHA_FACTOR = 20,
D3D12_BLEND_INV_ALPHA_FACTOR = 21
} D3D12_BLEND;
// Keep BLENDOP values in sync with earlier DX versions (HW consumes values directly).
@ -761,6 +788,21 @@ typedef struct D3D12_RASTERIZER_DESC
D3D12_CONSERVATIVE_RASTERIZATION_MODE ConservativeRaster;
} D3D12_RASTERIZER_DESC;
typedef struct D3D12_RASTERIZER_DESC1
{
D3D12_FILL_MODE FillMode;
D3D12_CULL_MODE CullMode;
BOOL FrontCounterClockwise;
FLOAT DepthBias;
FLOAT DepthBiasClamp;
FLOAT SlopeScaledDepthBias;
BOOL DepthClipEnable;
BOOL MultisampleEnable;
BOOL AntialiasedLineEnable;
UINT ForcedSampleCount;
D3D12_CONSERVATIVE_RASTERIZATION_MODE ConservativeRaster;
} D3D12_RASTERIZER_DESC1;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Pipeline State v1
@ -811,6 +853,8 @@ typedef enum D3D12_PIPELINE_STATE_FLAGS
{
D3D12_PIPELINE_STATE_FLAG_NONE = 0x0,
D3D12_PIPELINE_STATE_FLAG_TOOL_DEBUG = 0x1,
D3D12_PIPELINE_STATE_FLAG_DYNAMIC_DEPTH_BIAS = 0x4,
D3D12_PIPELINE_STATE_FLAG_DYNAMIC_INDEX_BUFFER_STRIP_CUT = 0x8,
} D3D12_PIPELINE_STATE_FLAGS;
cpp_quote( "DEFINE_ENUM_FLAG_OPERATORS( D3D12_PIPELINE_STATE_FLAGS );" )
@ -894,6 +938,8 @@ typedef enum D3D12_PIPELINE_STATE_SUBOBJECT_TYPE
D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_VIEW_INSTANCING, // D3D12_VIEW_INSTANCING_DESC
D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_AS = 24, // D3D12_SHADER_BYTECODE
D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_MS = 25, // D3D12_SHADER_BYTECODE
D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL2 = 26, // D3D12_DEPTH_STENCIL_DESC2
D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_RASTERIZER1 = 27, // D3D12_RASTERIZER_DESC1
D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_MAX_VALID,
} D3D12_PIPELINE_STATE_SUBOBJECT_TYPE;
@ -937,6 +983,10 @@ typedef enum D3D12_FEATURE
D3D12_FEATURE_D3D12_OPTIONS10 = 39,
D3D12_FEATURE_D3D12_OPTIONS11 = 40,
D3D12_FEATURE_D3D12_OPTIONS12 = 41,
D3D12_FEATURE_D3D12_OPTIONS13 = 42,
D3D12_FEATURE_D3D12_OPTIONS14 = 43,
D3D12_FEATURE_D3D12_OPTIONS15 = 44,
D3D12_FEATURE_D3D12_OPTIONS16 = 45
} D3D12_FEATURE;
typedef enum D3D12_SHADER_MIN_PRECISION_SUPPORT
@ -1151,7 +1201,8 @@ typedef enum D3D_SHADER_MODEL
D3D_SHADER_MODEL_6_5 = 0x65,
D3D_SHADER_MODEL_6_6 = 0x66,
D3D_SHADER_MODEL_6_7 = 0x67,
D3D_HIGHEST_SHADER_MODEL = D3D_SHADER_MODEL_6_7
D3D_SHADER_MODEL_6_8 = 0x68,
D3D_HIGHEST_SHADER_MODEL = D3D_SHADER_MODEL_6_8
} D3D_SHADER_MODEL;
typedef struct D3D12_FEATURE_DATA_SHADER_MODEL
@ -1408,8 +1459,42 @@ typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS12
{
[annotation("_Out_")] D3D12_TRI_STATE MSPrimitivesPipelineStatisticIncludesCulledPrimitives;
[annotation("_Out_")] BOOL EnhancedBarriersSupported;
[annotation("_Out_")] BOOL RelaxedFormatCastingSupported;
} D3D12_FEATURE_DATA_D3D12_OPTIONS12;
// D3D12_FEATURE_D3D12_OPTIONS13
typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS13
{
[annotation("_Out_")] BOOL UnrestrictedBufferTextureCopyPitchSupported;
[annotation("_Out_")] BOOL UnrestrictedVertexElementAlignmentSupported;
[annotation("_Out_")] BOOL InvertedViewportHeightFlipsYSupported;
[annotation("_Out_")] BOOL InvertedViewportDepthFlipsZSupported;
[annotation("_Out_")] BOOL TextureCopyBetweenDimensionsSupported;
[annotation("_Out_")] BOOL AlphaBlendFactorSupported;
} D3D12_FEATURE_DATA_D3D12_OPTIONS13;
// D3D12_FEATURE_D3D12_OPTIONS14
typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS14
{
[annotation("_Out_")] BOOL AdvancedTextureOpsSupported;
[annotation("_Out_")] BOOL WriteableMSAATexturesSupported;
[annotation("_Out_")] BOOL IndependentFrontAndBackStencilRefMaskSupported;
} D3D12_FEATURE_DATA_D3D12_OPTIONS14;
// D3D12_FEATURE_D3D12_OPTIONS15
typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS15
{
[annotation("_Out_")] BOOL TriangleFanSupported;
[annotation("_Out_")] BOOL DynamicIndexBufferStripCutSupported;
} D3D12_FEATURE_DATA_D3D12_OPTIONS15;
// D3D12_FEATURE_D3D12_OPTIONS16
typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS16
{
[annotation("_Out_")] BOOL DynamicDepthBiasSupported;
[annotation("_Out_")] BOOL Reserved; //
} D3D12_FEATURE_DATA_D3D12_OPTIONS16;
typedef struct D3D12_RESOURCE_ALLOCATION_INFO
{
@ -2114,6 +2199,8 @@ typedef enum D3D12_TEXTURE_ADDRESS_MODE
D3D12_TEXTURE_ADDRESS_MODE_MIRROR_ONCE = 5
} D3D12_TEXTURE_ADDRESS_MODE;
typedef struct D3D12_SAMPLER_DESC
{
D3D12_FILTER Filter;
@ -2128,6 +2215,35 @@ typedef struct D3D12_SAMPLER_DESC
FLOAT MaxLOD;
} D3D12_SAMPLER_DESC;
typedef enum D3D12_SAMPLER_FLAGS
{
D3D12_SAMPLER_FLAG_NONE = 0x0,
D3D12_SAMPLER_FLAG_UINT_BORDER_COLOR = 0x01
} D3D12_SAMPLER_FLAGS;
cpp_quote("DEFINE_ENUM_FLAG_OPERATORS( D3D12_SAMPLER_FLAGS );")
typedef struct D3D12_SAMPLER_DESC2
{
D3D12_FILTER Filter;
D3D12_TEXTURE_ADDRESS_MODE AddressU;
D3D12_TEXTURE_ADDRESS_MODE AddressV;
D3D12_TEXTURE_ADDRESS_MODE AddressW;
FLOAT MipLODBias;
UINT MaxAnisotropy;
D3D12_COMPARISON_FUNC ComparisonFunc;
union
{
FLOAT FloatBorderColor[4]; // RGBA
UINT UintBorderColor[4];
};
FLOAT MinLOD;
FLOAT MaxLOD;
D3D12_SAMPLER_FLAGS Flags;
} D3D12_SAMPLER_DESC2;
typedef enum D3D12_BUFFER_UAV_FLAGS
{
D3D12_BUFFER_UAV_FLAG_NONE = 0,
@ -2170,6 +2286,18 @@ typedef struct D3D12_TEX2D_ARRAY_UAV
UINT PlaneSlice;
} D3D12_TEX2D_ARRAY_UAV;
typedef struct D3D12_TEX2DMS_UAV
{
// don't need to define anything specific for this view dimension
UINT UnusedField_NothingToDefine;
} D3D12_TEX2DMS_UAV;
typedef struct D3D12_TEX2DMS_ARRAY_UAV
{
UINT FirstArraySlice;
UINT ArraySize;
} D3D12_TEX2DMS_ARRAY_UAV;
typedef struct D3D12_TEX3D_UAV
{
UINT MipSlice;
@ -2185,6 +2313,8 @@ typedef enum D3D12_UAV_DIMENSION
D3D12_UAV_DIMENSION_TEXTURE1DARRAY = 3,
D3D12_UAV_DIMENSION_TEXTURE2D = 4,
D3D12_UAV_DIMENSION_TEXTURE2DARRAY = 5,
D3D12_UAV_DIMENSION_TEXTURE2DMS = 6,
D3D12_UAV_DIMENSION_TEXTURE2DMSARRAY = 7,
D3D12_UAV_DIMENSION_TEXTURE3D = 8,
} D3D12_UAV_DIMENSION;
@ -2200,6 +2330,8 @@ typedef struct D3D12_UNORDERED_ACCESS_VIEW_DESC
D3D12_TEX1D_ARRAY_UAV Texture1DArray;
D3D12_TEX2D_UAV Texture2D;
D3D12_TEX2D_ARRAY_UAV Texture2DArray;
D3D12_TEX2DMS_UAV Texture2DMS;
D3D12_TEX2DMS_ARRAY_UAV Texture2DMSArray;
D3D12_TEX3D_UAV Texture3D;
};
} D3D12_UNORDERED_ACCESS_VIEW_DESC;
@ -2486,11 +2618,14 @@ typedef enum D3D12_ROOT_SIGNATURE_FLAGS
} D3D12_ROOT_SIGNATURE_FLAGS;
cpp_quote( "DEFINE_ENUM_FLAG_OPERATORS( D3D12_ROOT_SIGNATURE_FLAGS );" )
typedef enum D3D12_STATIC_BORDER_COLOR
{
D3D12_STATIC_BORDER_COLOR_TRANSPARENT_BLACK, // 0.0f,0.0f,0.0f,0.0f
D3D12_STATIC_BORDER_COLOR_OPAQUE_BLACK, // 0.0f,0.0f,0.0f,1.0f
D3D12_STATIC_BORDER_COLOR_OPAQUE_WHITE, // 1.0f,1.0f,1.0f,1.0f
D3D12_STATIC_BORDER_COLOR_OPAQUE_BLACK_UINT, // 0,0,0,1
D3D12_STATIC_BORDER_COLOR_OPAQUE_WHITE_UINT // 1,1,1,1
} D3D12_STATIC_BORDER_COLOR;
typedef struct D3D12_STATIC_SAMPLER_DESC
@ -4735,6 +4870,13 @@ interface ID3D12DeviceRemovedExtendedDataSettings1
void SetBreadcrumbContextEnablement(D3D12_DRED_ENABLEMENT Enablement);
};
[uuid(61552388-01ab-4008-a436-83db189566ea), object, local, pointer_default(unique)]
interface ID3D12DeviceRemovedExtendedDataSettings2
: ID3D12DeviceRemovedExtendedDataSettings1
{
void UseMarkersOnlyAutoBreadcrumbs(BOOL MarkersOnly);
};
[uuid(98931D33-5AE8-4791-AA3C-1A73A2934E71), object, local, pointer_default(unique)]
interface ID3D12DeviceRemovedExtendedData
@ -5144,6 +5286,7 @@ typedef enum D3D12_BARRIER_LAYOUT
D3D12_BARRIER_LAYOUT_COMPUTE_QUEUE_COPY_SOURCE,
D3D12_BARRIER_LAYOUT_COMPUTE_QUEUE_COPY_DEST,
D3D12_BARRIER_LAYOUT_VIDEO_QUEUE_COMMON,
} D3D12_BARRIER_LAYOUT;
typedef enum D3D12_BARRIER_SYNC
@ -5151,7 +5294,7 @@ typedef enum D3D12_BARRIER_SYNC
D3D12_BARRIER_SYNC_NONE = 0x0,
D3D12_BARRIER_SYNC_ALL = 0x1,
D3D12_BARRIER_SYNC_DRAW = 0x2,
D3D12_BARRIER_SYNC_INPUT_ASSEMBLER = 0x4,
D3D12_BARRIER_SYNC_INDEX_INPUT = 0x4,
D3D12_BARRIER_SYNC_VERTEX_SHADING = 0x8,
D3D12_BARRIER_SYNC_PIXEL_SHADING = 0x10,
D3D12_BARRIER_SYNC_DEPTH_STENCIL = 0x20,
@ -5165,6 +5308,7 @@ typedef enum D3D12_BARRIER_SYNC
D3D12_BARRIER_SYNC_ALL_SHADING = 0x1000,
D3D12_BARRIER_SYNC_NON_PIXEL_SHADING = 0x2000,
D3D12_BARRIER_SYNC_EMIT_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO = 0x4000,
D3D12_BARRIER_SYNC_CLEAR_UNORDERED_ACCESS_VIEW = 0x8000,
D3D12_BARRIER_SYNC_VIDEO_DECODE = 0x100000,
D3D12_BARRIER_SYNC_VIDEO_PROCESS = 0x200000,
D3D12_BARRIER_SYNC_VIDEO_ENCODE = 0x400000,
@ -5261,16 +5405,6 @@ typedef struct D3D12_BUFFER_BARRIER
UINT64 Size;
} D3D12_BUFFER_BARRIER;
typedef struct D3D12_RESOURCE_STATE_BARRIER
{
D3D12_RESOURCE_STATES State;
[annotation("_In_")] ID3D12Resource *pResource;
UINT Subresource;
D3D12_BARRIER_SYNC Sync;
D3D12_BARRIER_ACCESS Access;
D3D12_BARRIER_LAYOUT Layout;
} D3D12_RESOURCE_STATE_BARRIER;
typedef struct D3D12_BARRIER_GROUP
{
D3D12_BARRIER_TYPE Type;
@ -5280,7 +5414,6 @@ typedef struct D3D12_BARRIER_GROUP
[annotation("_In_reads_(NumBarriers)")] const D3D12_GLOBAL_BARRIER *pGlobalBarriers;
[annotation("_In_reads_(NumBarriers)")] const D3D12_TEXTURE_BARRIER *pTextureBarriers;
[annotation("_In_reads_(NumBarriers)")] const D3D12_BUFFER_BARRIER *pBufferBarriers;
[annotation("_In_reads_(NumBarriers)")] const D3D12_RESOURCE_STATE_BARRIER *pStateBarriers;
};
} D3D12_BARRIER_GROUP;
@ -5341,6 +5474,15 @@ interface ID3D12Device9
);
};
[uuid(5405c344-d457-444e-b4dd-2366e45aee39), object, local, pointer_default(unique)]
interface ID3D12Device11
: ID3D12Device10
{
void CreateSampler2(
[annotation("_In_")] const D3D12_SAMPLER_DESC2* pDesc,
[annotation("_In_")] D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor);
};
[uuid(517f8718-aa66-49f9-b02b-a7ab89c06031), object, local, pointer_default(unique)]
interface ID3D12Device10
: ID3D12Device9
@ -5526,20 +5668,6 @@ cpp_quote(" 0xa81a,")
cpp_quote(" 0x4f56,")
cpp_quote(" { 0x8c, 0x5b, 0xc5, 0x10, 0x39, 0xd6, 0x94, 0xfb }")
cpp_quote("};")
cpp_quote("// --------------------------------------------------------------------------------------------------------------------------------")
cpp_quote("// Experimental Feature: D3D12MetaCommand")
cpp_quote("//")
cpp_quote("// Use with D3D12EnableExperimentalFeatures to enable the D3D12 Meta Command.")
cpp_quote("//")
cpp_quote("// Enabling D3D12MetaCommand needs no configuration struct, pass NULL in the pConfigurationStructs array.")
cpp_quote("//")
cpp_quote("// --------------------------------------------------------------------------------------------------------------------------------")
cpp_quote("static const UUID D3D12MetaCommand = { /* C734C97E-8077-48C8-9FDC-D9D1DD31DD77 */")
cpp_quote(" 0xc734c97e,")
cpp_quote(" 0x8077,")
cpp_quote(" 0x48c8,")
cpp_quote(" { 0x9f, 0xdc, 0xd9, 0xd1, 0xdd, 0x31, 0xdd, 0x77 }")
cpp_quote("};")
cpp_quote("// --------------------------------------------------------------------------------------------------------------------------------")
cpp_quote("// D3D12GetInterface")
@ -5551,6 +5679,7 @@ cpp_quote("DEFINE_GUID(CLSID_D3D12Debug, 0xf2352aeb, 0xdd
cpp_quote("DEFINE_GUID(CLSID_D3D12Tools, 0xe38216b1, 0x3c8c, 0x4833, 0xaa, 0x09, 0x0a, 0x06, 0xb6, 0x5d, 0x96, 0xc8);")
cpp_quote("DEFINE_GUID(CLSID_D3D12DeviceRemovedExtendedData, 0x4a75bbc4, 0x9ff4, 0x4ad8, 0x9f, 0x18, 0xab, 0xae, 0x84, 0xdc, 0x5f, 0xf2);")
cpp_quote("DEFINE_GUID(CLSID_D3D12SDKConfiguration, 0x7cda6aca, 0xa03e, 0x49c8, 0x94, 0x58, 0x03, 0x34, 0xd2, 0x0e, 0x07, 0xce);")
cpp_quote("DEFINE_GUID(CLSID_D3D12DeviceFactory, 0x114863bf, 0xc386, 0x4aee, 0xb3, 0x9d, 0x8f, 0x0b, 0xbb, 0x06, 0x29, 0x55);")
cpp_quote("")
cpp_quote("typedef HRESULT (WINAPI* PFN_D3D12_GET_INTERFACE)( _In_ REFCLSID, _In_ REFIID, _COM_Outptr_opt_ void** );")
cpp_quote("")
@ -5573,6 +5702,100 @@ interface ID3D12SDKConfiguration
);
}
[uuid(8aaf9303-ad25-48b9-9a57-d9c37e009d9f), object, local, pointer_default(unique)]
interface ID3D12SDKConfiguration1
: ID3D12SDKConfiguration
{
HRESULT CreateDeviceFactory(
UINT SDKVersion,
[annotation("_In_")] LPCSTR SDKPath,
REFIID riid, // Expected: ID3D12DeviceFactory
[annotation("_COM_Outptr_")] void **ppvFactory
);
void FreeUnusedSDKs();
}
typedef enum D3D12_DEVICE_FACTORY_FLAGS
{
D3D12_DEVICE_FACTORY_FLAG_NONE = 0,
D3D12_DEVICE_FACTORY_FLAG_ALLOW_RETURNING_EXISTING_DEVICE = 0x1,
D3D12_DEVICE_FACTORY_FLAG_ALLOW_RETURNING_INCOMPATIBLE_EXISTING_DEVICE = 0x2,
D3D12_DEVICE_FACTORY_FLAG_DISALLOW_STORING_NEW_DEVICE_AS_SINGLETON = 0x4,
} D3D12_DEVICE_FACTORY_FLAGS;
cpp_quote("DEFINE_ENUM_FLAG_OPERATORS( D3D12_DEVICE_FACTORY_FLAGS );")
[uuid(61f307d3-d34e-4e7c-8374-3ba4de23cccb), object, local, pointer_default(unique)]
interface ID3D12DeviceFactory
: IUnknown
{
HRESULT InitializeFromGlobalState();
HRESULT ApplyToGlobalState();
HRESULT SetFlags(D3D12_DEVICE_FACTORY_FLAGS flags);
D3D12_DEVICE_FACTORY_FLAGS GetFlags();
HRESULT GetConfigurationInterface(
REFCLSID clsid,
REFIID iid,
[annotation("_COM_Outptr_")] void **ppv);
HRESULT EnableExperimentalFeatures(
UINT NumFeatures,
[annotation("_In_reads_(NumFeatures)")] const IID *pIIDs,
[annotation("_In_reads_opt_(NumFeatures)")] void *pConfigurationStructs,
[annotation("_In_reads_opt_(NumFeatures)")] UINT *pConfigurationStructSizes);
HRESULT CreateDevice(
[annotation("_In_opt_")] IUnknown *adapter,
D3D_FEATURE_LEVEL FeatureLevel,
REFIID riid,
[annotation("_COM_Outptr_opt_")] void **ppvDevice);
};
typedef enum D3D12_DEVICE_FLAGS
{
D3D12_DEVICE_FLAG_NONE = 0,
D3D12_DEVICE_FLAG_DEBUG_LAYER_ENABLED = 0x1,
D3D12_DEVICE_FLAG_GPU_BASED_VALIDATION_ENABLED = 0x2,
D3D12_DEVICE_FLAG_SYNCHRONIZED_COMMAND_QUEUE_VALIDATION_DISABLED = 0x4,
D3D12_DEVICE_FLAG_DRED_AUTO_BREADCRUMBS_ENABLED = 0x8,
D3D12_DEVICE_FLAG_DRED_PAGE_FAULT_REPORTING_ENABLED = 0x10,
D3D12_DEVICE_FLAG_DRED_WATSON_REPORTING_ENABLED = 0x20,
D3D12_DEVICE_FLAG_DRED_BREADCRUMB_CONTEXT_ENABLED = 0x40,
D3D12_DEVICE_FLAG_DRED_USE_MARKERS_ONLY_BREADCRUMBS = 0x80,
D3D12_DEVICE_FLAG_SHADER_INSTRUMENTATION_ENABLED = 0x100,
D3D12_DEVICE_FLAG_AUTO_DEBUG_NAME_ENABLED = 0x200,
D3D12_DEVICE_FLAG_FORCE_LEGACY_STATE_VALIDATION = 0x400,
} D3D12_DEVICE_FLAGS;
cpp_quote("DEFINE_ENUM_FLAG_OPERATORS( D3D12_DEVICE_FLAGS );")
typedef struct D3D12_DEVICE_CONFIGURATION_DESC
{
D3D12_DEVICE_FLAGS Flags;
UINT GpuBasedValidationFlags; // D3D12_GPU_BASED_VALIDATION_FLAGS from d3d12sdklayers.h
UINT SDKVersion;
UINT NumEnabledExperimentalFeatures;
} D3D12_DEVICE_CONFIGURATION_DESC;
[uuid(78dbf87b-f766-422b-a61c-c8c446bdb9ad), object, local, pointer_default(unique)]
interface ID3D12DeviceConfiguration
: IUnknown
{
D3D12_DEVICE_CONFIGURATION_DESC GetDesc();
HRESULT GetEnabledExperimentalFeatures([annotation("_Out_writes_(NumGuids)")] GUID *pGuids, UINT NumGuids);
HRESULT SerializeVersionedRootSignature(
[annotation("_In_")] const D3D12_VERSIONED_ROOT_SIGNATURE_DESC *pDesc,
[annotation("_COM_Outptr_")] ID3DBlob **ppResult,
[annotation("_Always_(_Outptr_opt_result_maybenull_)")] ID3DBlob **ppError);
HRESULT CreateVersionedRootSignatureDeserializer(
[annotation("_In_reads_bytes_(Size)")] const void *pBlob,
SIZE_T Size,
REFIID riid,
[annotation("_COM_Outptr_")] void **ppvDeserializer);
};
typedef enum D3D12_AXIS_SHADING_RATE
{
@ -5647,6 +5870,29 @@ interface ID3D12GraphicsCommandList7 : ID3D12GraphicsCommandList6
);
};
[uuid(ee936ef9-599d-4d28-938e-23c4ad05ce51), object, local, pointer_default(unique)]
interface ID3D12GraphicsCommandList8 : ID3D12GraphicsCommandList7
{
void OMSetFrontAndBackStencilRef(
[annotation("_In_")] UINT FrontStencilRef,
[annotation("_In_")] UINT BackStencilRef
);
};
[uuid(34ed2808-ffe6-4c2b-b11a-cabd2b0c59e1), object, local, pointer_default(unique)]
interface ID3D12GraphicsCommandList9 : ID3D12GraphicsCommandList8
{
void RSSetDepthBias(
[annotation("_In_")] FLOAT DepthBias,
[annotation("_In_")] FLOAT DepthBiasClamp,
[annotation("_In_")] FLOAT SlopeScaledDepthBias
);
void IASetIndexBufferStripCutValue(
[annotation("_In_")] D3D12_INDEX_BUFFER_STRIP_CUT_VALUE IBStripCutValue
);
};
//----------------------------------------------------------------------------------------------------------
// Old types which are still supported by the runtime for app-compat
@ -5691,6 +5937,7 @@ cpp_quote( "DEFINE_GUID(IID_ID3D12StateObjectProperties,0xde5fa827,0x9bf9,0x4f26
cpp_quote( "DEFINE_GUID(IID_ID3D12Device5,0x8b4f173b,0x2fea,0x4b80,0x8f,0x58,0x43,0x07,0x19,0x1a,0xb9,0x5d);" )
cpp_quote( "DEFINE_GUID(IID_ID3D12DeviceRemovedExtendedDataSettings,0x82BC481C,0x6B9B,0x4030,0xAE,0xDB,0x7E,0xE3,0xD1,0xDF,0x1E,0x63);" )
cpp_quote( "DEFINE_GUID(IID_ID3D12DeviceRemovedExtendedDataSettings1,0xDBD5AE51,0x3317,0x4F0A,0xAD,0xF9,0x1D,0x7C,0xED,0xCA,0xAE,0x0B);" )
cpp_quote( "DEFINE_GUID(IID_ID3D12DeviceRemovedExtendedDataSettings2,0x61552388,0x01ab,0x4008,0xa4,0x36,0x83,0xdb,0x18,0x95,0x66,0xea);" )
cpp_quote( "DEFINE_GUID(IID_ID3D12DeviceRemovedExtendedData,0x98931D33,0x5AE8,0x4791,0xAA,0x3C,0x1A,0x73,0xA2,0x93,0x4E,0x71);" )
cpp_quote( "DEFINE_GUID(IID_ID3D12DeviceRemovedExtendedData1,0x9727A022,0xCF1D,0x4DDA,0x9E,0xBA,0xEF,0xFA,0x65,0x3F,0xC5,0x06);" )
cpp_quote( "DEFINE_GUID(IID_ID3D12DeviceRemovedExtendedData2,0x67FC5816,0xE4CA,0x4915,0xBF,0x18,0x42,0x54,0x12,0x72,0xDA,0x54);" )
@ -5707,9 +5954,15 @@ cpp_quote( "DEFINE_GUID(IID_ID3D12GraphicsCommandList4,0x8754318e,0xd3a9,0x4541,
cpp_quote( "DEFINE_GUID(IID_ID3D12ShaderCacheSession,0x28e2495d,0x0f64,0x4ae4,0xa6,0xec,0x12,0x92,0x55,0xdc,0x49,0xa8);" )
cpp_quote( "DEFINE_GUID(IID_ID3D12Device9,0x4c80e962,0xf032,0x4f60,0xbc,0x9e,0xeb,0xc2,0xcf,0xa1,0xd8,0x3c);" )
cpp_quote( "DEFINE_GUID(IID_ID3D12Device10,0x517f8718,0xaa66,0x49f9,0xb0,0x2b,0xa7,0xab,0x89,0xc0,0x60,0x31);" )
cpp_quote( "DEFINE_GUID(IID_ID3D12Device11,0x5405c344,0xd457,0x444e,0xb4,0xdd,0x23,0x66,0xe4,0x5a,0xee,0x39);" )
cpp_quote( "DEFINE_GUID(IID_ID3D12VirtualizationGuestDevice,0xbc66d368,0x7373,0x4943,0x87,0x57,0xfc,0x87,0xdc,0x79,0xe4,0x76);" )
cpp_quote( "DEFINE_GUID(IID_ID3D12Tools,0x7071e1f0,0xe84b,0x4b33,0x97,0x4f,0x12,0xfa,0x49,0xde,0x65,0xc5);" )
cpp_quote( "DEFINE_GUID(IID_ID3D12SDKConfiguration,0xe9eb5314,0x33aa,0x42b2,0xa7,0x18,0xd7,0x7f,0x58,0xb1,0xf1,0xc7);" )
cpp_quote( "DEFINE_GUID(IID_ID3D12SDKConfiguration1,0x8aaf9303,0xad25,0x48b9,0x9a,0x57,0xd9,0xc3,0x7e,0x00,0x9d,0x9f);" )
cpp_quote( "DEFINE_GUID(IID_ID3D12DeviceFactory,0x61f307d3,0xd34e,0x4e7c,0x83,0x74,0x3b,0xa4,0xde,0x23,0xcc,0xcb);" )
cpp_quote( "DEFINE_GUID(IID_ID3D12DeviceConfiguration,0x78dbf87b,0xf766,0x422b,0xa6,0x1c,0xc8,0xc4,0x46,0xbd,0xb9,0xad);" )
cpp_quote( "DEFINE_GUID(IID_ID3D12GraphicsCommandList5,0x55050859,0x4024,0x474c,0x87,0xf5,0x64,0x72,0xea,0xee,0x44,0xea);" )
cpp_quote( "DEFINE_GUID(IID_ID3D12GraphicsCommandList6,0xc3827890,0xe548,0x4cfa,0x96,0xcf,0x56,0x89,0xa9,0x37,0x0f,0x80);" )
cpp_quote( "DEFINE_GUID(IID_ID3D12GraphicsCommandList7,0xdd171223,0x8b61,0x4769,0x90,0xe3,0x16,0x0c,0xcd,0xe4,0xe2,0xc1);" )
cpp_quote( "DEFINE_GUID(IID_ID3D12GraphicsCommandList8,0xee936ef9,0x599d,0x4d28,0x93,0x8e,0x23,0xc4,0xad,0x05,0xce,0x51);" )
cpp_quote( "DEFINE_GUID(IID_ID3D12GraphicsCommandList9,0x34ed2808,0xffe6,0x4c2b,0xb1,0x1a,0xca,0xbd,0x2b,0x0c,0x59,0xe1);" )

View File

@ -9,7 +9,7 @@
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 8.01.0627 */
/* File created by MIDL compiler version 8.01.0628 */
@ -94,9 +94,16 @@ typedef interface DirectMLTensorFlowCreatorID DirectMLTensorFlowCreatorID;
#endif /* __DirectMLTensorFlowCreatorID_FWD_DEFINED__ */
#ifndef __DirectMLPyTorchCreatorID_FWD_DEFINED__
#define __DirectMLPyTorchCreatorID_FWD_DEFINED__
typedef interface DirectMLPyTorchCreatorID DirectMLPyTorchCreatorID;
#endif /* __DirectMLPyTorchCreatorID_FWD_DEFINED__ */
/* header files for imported files */
#include "OAIdl.h"
#include "OCIdl.h"
#include "oaidl.h"
#include "ocidl.h"
#include "d3d11on12.h"
#ifdef __cplusplus
@ -630,7 +637,79 @@ EXTERN_C const IID IID_DirectMLTensorFlowCreatorID;
#endif /* __DirectMLTensorFlowCreatorID_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_d3d12compatibility_0000_0006 */
#ifndef __DirectMLPyTorchCreatorID_INTERFACE_DEFINED__
#define __DirectMLPyTorchCreatorID_INTERFACE_DEFINED__
/* interface DirectMLPyTorchCreatorID */
/* [unique][local][object][uuid] */
EXTERN_C const IID IID_DirectMLPyTorchCreatorID;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("af029192-fba1-4b05-9116-235e06560354")
DirectMLPyTorchCreatorID : public IUnknown
{
public:
};
#else /* C style interface */
typedef struct DirectMLPyTorchCreatorIDVtbl
{
BEGIN_INTERFACE
DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
DirectMLPyTorchCreatorID * This,
REFIID riid,
_COM_Outptr_ void **ppvObject);
DECLSPEC_XFGVIRT(IUnknown, AddRef)
ULONG ( STDMETHODCALLTYPE *AddRef )(
DirectMLPyTorchCreatorID * This);
DECLSPEC_XFGVIRT(IUnknown, Release)
ULONG ( STDMETHODCALLTYPE *Release )(
DirectMLPyTorchCreatorID * This);
END_INTERFACE
} DirectMLPyTorchCreatorIDVtbl;
interface DirectMLPyTorchCreatorID
{
CONST_VTBL struct DirectMLPyTorchCreatorIDVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define DirectMLPyTorchCreatorID_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define DirectMLPyTorchCreatorID_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define DirectMLPyTorchCreatorID_Release(This) \
( (This)->lpVtbl -> Release(This) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __DirectMLPyTorchCreatorID_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_d3d12compatibility_0000_0007 */
/* [local] */
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_GAMES) */
@ -641,10 +720,11 @@ DEFINE_GUID(IID_D3D9On12CreatorID,0xfffcbb7f,0x15d3,0x42a2,0x84,0x1e,0x9d,0x8d,0
DEFINE_GUID(IID_OpenGLOn12CreatorID,0x6bb3cd34,0x0d19,0x45ab,0x97,0xed,0xd7,0x20,0xba,0x3d,0xfc,0x80);
DEFINE_GUID(IID_OpenCLOn12CreatorID,0x3f76bb74,0x91b5,0x4a88,0xb1,0x26,0x20,0xca,0x03,0x31,0xcd,0x60);
DEFINE_GUID(IID_DirectMLTensorFlowCreatorID,0xcb7490ac,0x8a0f,0x44ec,0x9b,0x7b,0x6f,0x4c,0xaf,0xe8,0xe9,0xab);
DEFINE_GUID(IID_DirectMLPyTorchCreatorID,0xaf029192,0xfba1,0x4b05,0x91,0x16,0x23,0x5e,0x06,0x56,0x03,0x54);
extern RPC_IF_HANDLE __MIDL_itf_d3d12compatibility_0000_0006_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3d12compatibility_0000_0006_v0_0_s_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3d12compatibility_0000_0007_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3d12compatibility_0000_0007_v0_0_s_ifspec;
/* Additional Prototypes for ALL interfaces */

View File

@ -4,8 +4,8 @@
* Licensed under the MIT license
*
*-------------------------------------------------------------------------------------*/
import "OAIdl.idl";
import "OCIdl.idl";
import "oaidl.idl";
import "ocidl.idl";
import "d3d11on12.idl";
@ -76,6 +76,9 @@ interface OpenCLOn12CreatorID : IUnknown { };
[uuid(cb7490ac-8a0f-44ec-9b7b-6f4cafe8e9ab), object, local, pointer_default(unique)]
interface DirectMLTensorFlowCreatorID : IUnknown { };
[uuid(af029192-fba1-4b05-9116-235e06560354), object, local, pointer_default(unique)]
interface DirectMLPyTorchCreatorID : IUnknown { };
cpp_quote("#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_GAMES) */")
#pragma endregion
@ -86,3 +89,4 @@ cpp_quote( "DEFINE_GUID(IID_D3D9On12CreatorID,0xfffcbb7f,0x15d3,0x42a2,0x84,0x1e
cpp_quote( "DEFINE_GUID(IID_OpenGLOn12CreatorID,0x6bb3cd34,0x0d19,0x45ab,0x97,0xed,0xd7,0x20,0xba,0x3d,0xfc,0x80);" )
cpp_quote( "DEFINE_GUID(IID_OpenCLOn12CreatorID,0x3f76bb74,0x91b5,0x4a88,0xb1,0x26,0x20,0xca,0x03,0x31,0xcd,0x60);" )
cpp_quote( "DEFINE_GUID(IID_DirectMLTensorFlowCreatorID,0xcb7490ac,0x8a0f,0x44ec,0x9b,0x7b,0x6f,0x4c,0xaf,0xe8,0xe9,0xab);" )
cpp_quote( "DEFINE_GUID(IID_DirectMLPyTorchCreatorID,0xaf029192,0xfba1,0x4b05,0x91,0x16,0x23,0x5e,0x06,0x56,0x03,0x54);" )

View File

@ -9,7 +9,7 @@
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 8.01.0627 */
/* File created by MIDL compiler version 8.01.0628 */
@ -129,6 +129,13 @@ typedef interface ID3D12DebugCommandQueue ID3D12DebugCommandQueue;
#endif /* __ID3D12DebugCommandQueue_FWD_DEFINED__ */
#ifndef __ID3D12DebugCommandQueue1_FWD_DEFINED__
#define __ID3D12DebugCommandQueue1_FWD_DEFINED__
typedef interface ID3D12DebugCommandQueue1 ID3D12DebugCommandQueue1;
#endif /* __ID3D12DebugCommandQueue1_FWD_DEFINED__ */
#ifndef __ID3D12DebugCommandList1_FWD_DEFINED__
#define __ID3D12DebugCommandList1_FWD_DEFINED__
typedef interface ID3D12DebugCommandList1 ID3D12DebugCommandList1;
@ -150,6 +157,13 @@ typedef interface ID3D12DebugCommandList2 ID3D12DebugCommandList2;
#endif /* __ID3D12DebugCommandList2_FWD_DEFINED__ */
#ifndef __ID3D12DebugCommandList3_FWD_DEFINED__
#define __ID3D12DebugCommandList3_FWD_DEFINED__
typedef interface ID3D12DebugCommandList3 ID3D12DebugCommandList3;
#endif /* __ID3D12DebugCommandList3_FWD_DEFINED__ */
#ifndef __ID3D12SharingContract_FWD_DEFINED__
#define __ID3D12SharingContract_FWD_DEFINED__
typedef interface ID3D12SharingContract ID3D12SharingContract;
@ -172,8 +186,8 @@ typedef interface ID3D12InfoQueue1 ID3D12InfoQueue1;
/* header files for imported files */
#include "OAIdl.h"
#include "OCIdl.h"
#include "oaidl.h"
#include "ocidl.h"
#include "d3d12.h"
#ifdef __cplusplus
@ -1468,7 +1482,120 @@ EXTERN_C const IID IID_ID3D12DebugCommandQueue;
#endif /* __ID3D12DebugCommandQueue_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_d3d12sdklayers_0000_0011 */
#ifndef __ID3D12DebugCommandQueue1_INTERFACE_DEFINED__
#define __ID3D12DebugCommandQueue1_INTERFACE_DEFINED__
/* interface ID3D12DebugCommandQueue1 */
/* [unique][local][object][uuid] */
EXTERN_C const IID IID_ID3D12DebugCommandQueue1;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("16be35a2-bfd6-49f2-bcae-eaae4aff862d")
ID3D12DebugCommandQueue1 : public ID3D12DebugCommandQueue
{
public:
virtual void STDMETHODCALLTYPE AssertResourceAccess(
_In_ ID3D12Resource *pResource,
UINT Subresource,
D3D12_BARRIER_ACCESS Access) = 0;
virtual void STDMETHODCALLTYPE AssertTextureLayout(
_In_ ID3D12Resource *pResource,
UINT Subresource,
D3D12_BARRIER_LAYOUT Layout) = 0;
};
#else /* C style interface */
typedef struct ID3D12DebugCommandQueue1Vtbl
{
BEGIN_INTERFACE
DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
ID3D12DebugCommandQueue1 * This,
REFIID riid,
_COM_Outptr_ void **ppvObject);
DECLSPEC_XFGVIRT(IUnknown, AddRef)
ULONG ( STDMETHODCALLTYPE *AddRef )(
ID3D12DebugCommandQueue1 * This);
DECLSPEC_XFGVIRT(IUnknown, Release)
ULONG ( STDMETHODCALLTYPE *Release )(
ID3D12DebugCommandQueue1 * This);
DECLSPEC_XFGVIRT(ID3D12DebugCommandQueue, AssertResourceState)
BOOL ( STDMETHODCALLTYPE *AssertResourceState )(
ID3D12DebugCommandQueue1 * This,
_In_ ID3D12Resource *pResource,
UINT Subresource,
UINT State);
DECLSPEC_XFGVIRT(ID3D12DebugCommandQueue1, AssertResourceAccess)
void ( STDMETHODCALLTYPE *AssertResourceAccess )(
ID3D12DebugCommandQueue1 * This,
_In_ ID3D12Resource *pResource,
UINT Subresource,
D3D12_BARRIER_ACCESS Access);
DECLSPEC_XFGVIRT(ID3D12DebugCommandQueue1, AssertTextureLayout)
void ( STDMETHODCALLTYPE *AssertTextureLayout )(
ID3D12DebugCommandQueue1 * This,
_In_ ID3D12Resource *pResource,
UINT Subresource,
D3D12_BARRIER_LAYOUT Layout);
END_INTERFACE
} ID3D12DebugCommandQueue1Vtbl;
interface ID3D12DebugCommandQueue1
{
CONST_VTBL struct ID3D12DebugCommandQueue1Vtbl *lpVtbl;
};
#ifdef COBJMACROS
#define ID3D12DebugCommandQueue1_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define ID3D12DebugCommandQueue1_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define ID3D12DebugCommandQueue1_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define ID3D12DebugCommandQueue1_AssertResourceState(This,pResource,Subresource,State) \
( (This)->lpVtbl -> AssertResourceState(This,pResource,Subresource,State) )
#define ID3D12DebugCommandQueue1_AssertResourceAccess(This,pResource,Subresource,Access) \
( (This)->lpVtbl -> AssertResourceAccess(This,pResource,Subresource,Access) )
#define ID3D12DebugCommandQueue1_AssertTextureLayout(This,pResource,Subresource,Layout) \
( (This)->lpVtbl -> AssertTextureLayout(This,pResource,Subresource,Layout) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __ID3D12DebugCommandQueue1_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_d3d12sdklayers_0000_0012 */
/* [local] */
typedef
@ -1484,8 +1611,8 @@ typedef struct D3D12_DEBUG_COMMAND_LIST_GPU_BASED_VALIDATION_SETTINGS
extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0011_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0011_v0_0_s_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0012_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0012_v0_0_s_ifspec;
#ifndef __ID3D12DebugCommandList1_INTERFACE_DEFINED__
#define __ID3D12DebugCommandList1_INTERFACE_DEFINED__
@ -1839,6 +1966,155 @@ EXTERN_C const IID IID_ID3D12DebugCommandList2;
#endif /* __ID3D12DebugCommandList2_INTERFACE_DEFINED__ */
#ifndef __ID3D12DebugCommandList3_INTERFACE_DEFINED__
#define __ID3D12DebugCommandList3_INTERFACE_DEFINED__
/* interface ID3D12DebugCommandList3 */
/* [unique][local][object][uuid] */
EXTERN_C const IID IID_ID3D12DebugCommandList3;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("197d5e15-4d37-4d34-af78-724cd70fdb1f")
ID3D12DebugCommandList3 : public ID3D12DebugCommandList2
{
public:
virtual void STDMETHODCALLTYPE AssertResourceAccess(
_In_ ID3D12Resource *pResource,
UINT Subresource,
D3D12_BARRIER_ACCESS Access) = 0;
virtual void STDMETHODCALLTYPE AssertTextureLayout(
_In_ ID3D12Resource *pResource,
UINT Subresource,
D3D12_BARRIER_LAYOUT Layout) = 0;
};
#else /* C style interface */
typedef struct ID3D12DebugCommandList3Vtbl
{
BEGIN_INTERFACE
DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
ID3D12DebugCommandList3 * This,
REFIID riid,
_COM_Outptr_ void **ppvObject);
DECLSPEC_XFGVIRT(IUnknown, AddRef)
ULONG ( STDMETHODCALLTYPE *AddRef )(
ID3D12DebugCommandList3 * This);
DECLSPEC_XFGVIRT(IUnknown, Release)
ULONG ( STDMETHODCALLTYPE *Release )(
ID3D12DebugCommandList3 * This);
DECLSPEC_XFGVIRT(ID3D12DebugCommandList, AssertResourceState)
BOOL ( STDMETHODCALLTYPE *AssertResourceState )(
ID3D12DebugCommandList3 * This,
_In_ ID3D12Resource *pResource,
UINT Subresource,
UINT State);
DECLSPEC_XFGVIRT(ID3D12DebugCommandList, SetFeatureMask)
HRESULT ( STDMETHODCALLTYPE *SetFeatureMask )(
ID3D12DebugCommandList3 * This,
D3D12_DEBUG_FEATURE Mask);
DECLSPEC_XFGVIRT(ID3D12DebugCommandList, GetFeatureMask)
D3D12_DEBUG_FEATURE ( STDMETHODCALLTYPE *GetFeatureMask )(
ID3D12DebugCommandList3 * This);
DECLSPEC_XFGVIRT(ID3D12DebugCommandList2, SetDebugParameter)
HRESULT ( STDMETHODCALLTYPE *SetDebugParameter )(
ID3D12DebugCommandList3 * This,
D3D12_DEBUG_COMMAND_LIST_PARAMETER_TYPE Type,
_In_reads_bytes_(DataSize) const void *pData,
UINT DataSize);
DECLSPEC_XFGVIRT(ID3D12DebugCommandList2, GetDebugParameter)
HRESULT ( STDMETHODCALLTYPE *GetDebugParameter )(
ID3D12DebugCommandList3 * This,
D3D12_DEBUG_COMMAND_LIST_PARAMETER_TYPE Type,
_Out_writes_bytes_(DataSize) void *pData,
UINT DataSize);
DECLSPEC_XFGVIRT(ID3D12DebugCommandList3, AssertResourceAccess)
void ( STDMETHODCALLTYPE *AssertResourceAccess )(
ID3D12DebugCommandList3 * This,
_In_ ID3D12Resource *pResource,
UINT Subresource,
D3D12_BARRIER_ACCESS Access);
DECLSPEC_XFGVIRT(ID3D12DebugCommandList3, AssertTextureLayout)
void ( STDMETHODCALLTYPE *AssertTextureLayout )(
ID3D12DebugCommandList3 * This,
_In_ ID3D12Resource *pResource,
UINT Subresource,
D3D12_BARRIER_LAYOUT Layout);
END_INTERFACE
} ID3D12DebugCommandList3Vtbl;
interface ID3D12DebugCommandList3
{
CONST_VTBL struct ID3D12DebugCommandList3Vtbl *lpVtbl;
};
#ifdef COBJMACROS
#define ID3D12DebugCommandList3_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define ID3D12DebugCommandList3_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define ID3D12DebugCommandList3_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define ID3D12DebugCommandList3_AssertResourceState(This,pResource,Subresource,State) \
( (This)->lpVtbl -> AssertResourceState(This,pResource,Subresource,State) )
#define ID3D12DebugCommandList3_SetFeatureMask(This,Mask) \
( (This)->lpVtbl -> SetFeatureMask(This,Mask) )
#define ID3D12DebugCommandList3_GetFeatureMask(This) \
( (This)->lpVtbl -> GetFeatureMask(This) )
#define ID3D12DebugCommandList3_SetDebugParameter(This,Type,pData,DataSize) \
( (This)->lpVtbl -> SetDebugParameter(This,Type,pData,DataSize) )
#define ID3D12DebugCommandList3_GetDebugParameter(This,Type,pData,DataSize) \
( (This)->lpVtbl -> GetDebugParameter(This,Type,pData,DataSize) )
#define ID3D12DebugCommandList3_AssertResourceAccess(This,pResource,Subresource,Access) \
( (This)->lpVtbl -> AssertResourceAccess(This,pResource,Subresource,Access) )
#define ID3D12DebugCommandList3_AssertTextureLayout(This,pResource,Subresource,Layout) \
( (This)->lpVtbl -> AssertTextureLayout(This,pResource,Subresource,Layout) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __ID3D12DebugCommandList3_INTERFACE_DEFINED__ */
#ifndef __ID3D12SharingContract_INTERFACE_DEFINED__
#define __ID3D12SharingContract_INTERFACE_DEFINED__
@ -1961,7 +2237,7 @@ EXTERN_C const IID IID_ID3D12SharingContract;
#endif /* __ID3D12SharingContract_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_d3d12sdklayers_0000_0015 */
/* interface __MIDL_itf_d3d12sdklayers_0000_0017 */
/* [local] */
typedef
@ -2900,7 +3176,32 @@ enum D3D12_MESSAGE_ID
D3D12_MESSAGE_ID_UNSUPPORTED_BARRIER_LAYOUT = 1341,
D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_INVALID_PARAMETERS = 1342,
D3D12_MESSAGE_ID_ENHANCED_BARRIERS_NOT_SUPPORTED = 1343,
D3D12_MESSAGE_ID_D3D12_MESSAGES_END = ( D3D12_MESSAGE_ID_ENHANCED_BARRIERS_NOT_SUPPORTED + 1 )
D3D12_MESSAGE_ID_LEGACY_BARRIER_VALIDATION_FORCED_ON = 1346,
D3D12_MESSAGE_ID_EMPTY_ROOT_DESCRIPTOR_TABLE = 1347,
D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_ELEMENT_OFFSET_UNALIGNED = 1348,
D3D12_MESSAGE_ID_ALPHA_BLEND_FACTOR_NOT_SUPPORTED = 1349,
D3D12_MESSAGE_ID_BARRIER_INTEROP_INVALID_LAYOUT = 1350,
D3D12_MESSAGE_ID_BARRIER_INTEROP_INVALID_STATE = 1351,
D3D12_MESSAGE_ID_GRAPHICS_PIPELINE_STATE_DESC_ZERO_SAMPLE_MASK = 1352,
D3D12_MESSAGE_ID_INDEPENDENT_STENCIL_REF_NOT_SUPPORTED = 1353,
D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INDEPENDENT_MASKS_UNSUPPORTED = 1354,
D3D12_MESSAGE_ID_TEXTURE_BARRIER_SUBRESOURCES_OUT_OF_BOUNDS = 1355,
D3D12_MESSAGE_ID_NON_OPTIMAL_BARRIER_ONLY_EXECUTE_COMMAND_LISTS = 1356,
D3D12_MESSAGE_ID_EXECUTE_INDIRECT_ZERO_COMMAND_COUNT = 1357,
D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_INCOMPATIBLE_TEXTURE_LAYOUT = 1358,
D3D12_MESSAGE_ID_DYNAMIC_INDEX_BUFFER_STRIP_CUT_NOT_SUPPORTED = 1359,
D3D12_MESSAGE_ID_PRIMITIVE_TOPOLOGY_TRIANGLE_FANS_NOT_SUPPORTED = 1360,
D3D12_MESSAGE_ID_CREATE_SAMPLER_COMPARISON_FUNC_IGNORED = 1361,
D3D12_MESSAGE_ID_CREATEHEAP_INVALIDHEAPTYPE = 1362,
D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_INVALIDHEAPTYPE = 1363,
D3D12_MESSAGE_ID_DYNAMIC_DEPTH_BIAS_NOT_SUPPORTED = 1364,
D3D12_MESSAGE_ID_CREATERASTERIZERSTATE_NON_WHOLE_DYNAMIC_DEPTH_BIAS = 1365,
D3D12_MESSAGE_ID_DYNAMIC_DEPTH_BIAS_FLAG_MISSING = 1366,
D3D12_MESSAGE_ID_DYNAMIC_DEPTH_BIAS_NO_PIPELINE = 1367,
D3D12_MESSAGE_ID_DYNAMIC_INDEX_BUFFER_STRIP_CUT_FLAG_MISSING = 1368,
D3D12_MESSAGE_ID_DYNAMIC_INDEX_BUFFER_STRIP_CUT_NO_PIPELINE = 1369,
D3D12_MESSAGE_ID_INVALID_CAST_TARGET = 1371,
D3D12_MESSAGE_ID_D3D12_MESSAGES_END = ( D3D12_MESSAGE_ID_INVALID_CAST_TARGET + 1 )
} D3D12_MESSAGE_ID;
typedef struct D3D12_MESSAGE
@ -2931,8 +3232,8 @@ typedef struct D3D12_INFO_QUEUE_FILTER
#define D3D12_INFO_QUEUE_DEFAULT_MESSAGE_COUNT_LIMIT 1024
extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0015_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0015_v0_0_s_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0017_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0017_v0_0_s_ifspec;
#ifndef __ID3D12InfoQueue_INTERFACE_DEFINED__
#define __ID3D12InfoQueue_INTERFACE_DEFINED__
@ -3377,7 +3678,7 @@ EXTERN_C const IID IID_ID3D12InfoQueue;
#endif /* __ID3D12InfoQueue_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_d3d12sdklayers_0000_0016 */
/* interface __MIDL_itf_d3d12sdklayers_0000_0018 */
/* [local] */
typedef
@ -3397,8 +3698,8 @@ typedef void ( __stdcall *D3D12MessageFunc )(
extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0016_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0016_v0_0_s_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0018_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0018_v0_0_s_ifspec;
#ifndef __ID3D12InfoQueue1_INTERFACE_DEFINED__
#define __ID3D12InfoQueue1_INTERFACE_DEFINED__
@ -3774,7 +4075,7 @@ EXTERN_C const IID IID_ID3D12InfoQueue1;
#endif /* __ID3D12InfoQueue1_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_d3d12sdklayers_0000_0017 */
/* interface __MIDL_itf_d3d12sdklayers_0000_0019 */
/* [local] */
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_GAMES) */
@ -3790,16 +4091,18 @@ DEFINE_GUID(IID_ID3D12DebugDevice1,0xa9b71770,0xd099,0x4a65,0xa6,0x98,0x3d,0xee,
DEFINE_GUID(IID_ID3D12DebugDevice,0x3febd6dd,0x4973,0x4787,0x81,0x94,0xe4,0x5f,0x9e,0x28,0x92,0x3e);
DEFINE_GUID(IID_ID3D12DebugDevice2,0x60eccbc1,0x378d,0x4df1,0x89,0x4c,0xf8,0xac,0x5c,0xe4,0xd7,0xdd);
DEFINE_GUID(IID_ID3D12DebugCommandQueue,0x09e0bf36,0x54ac,0x484f,0x88,0x47,0x4b,0xae,0xea,0xb6,0x05,0x3a);
DEFINE_GUID(IID_ID3D12DebugCommandQueue1,0x16be35a2,0xbfd6,0x49f2,0xbc,0xae,0xea,0xae,0x4a,0xff,0x86,0x2d);
DEFINE_GUID(IID_ID3D12DebugCommandList1,0x102ca951,0x311b,0x4b01,0xb1,0x1f,0xec,0xb8,0x3e,0x06,0x1b,0x37);
DEFINE_GUID(IID_ID3D12DebugCommandList,0x09e0bf36,0x54ac,0x484f,0x88,0x47,0x4b,0xae,0xea,0xb6,0x05,0x3f);
DEFINE_GUID(IID_ID3D12DebugCommandList2,0xaeb575cf,0x4e06,0x48be,0xba,0x3b,0xc4,0x50,0xfc,0x96,0x65,0x2e);
DEFINE_GUID(IID_ID3D12DebugCommandList3,0x197d5e15,0x4d37,0x4d34,0xaf,0x78,0x72,0x4c,0xd7,0x0f,0xdb,0x1f);
DEFINE_GUID(IID_ID3D12SharingContract,0x0adf7d52,0x929c,0x4e61,0xad,0xdb,0xff,0xed,0x30,0xde,0x66,0xef);
DEFINE_GUID(IID_ID3D12InfoQueue,0x0742a90b,0xc387,0x483f,0xb9,0x46,0x30,0xa7,0xe4,0xe6,0x14,0x58);
DEFINE_GUID(IID_ID3D12InfoQueue1,0x2852dd88,0xb484,0x4c0c,0xb6,0xb1,0x67,0x16,0x85,0x00,0xe6,0x00);
extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0017_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0017_v0_0_s_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0019_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0019_v0_0_s_ifspec;
/* Additional Prototypes for ALL interfaces */

View File

@ -4,8 +4,8 @@
* Licensed under the MIT license
*
*-------------------------------------------------------------------------------------*/
import "OAIdl.idl";
import "OCIdl.idl";
import "oaidl.idl";
import "ocidl.idl";
import "d3d12.idl";
@ -182,6 +182,14 @@ interface ID3D12DebugCommandQueue
// TODO: Stale BOOL AssertResourceStateThroughView( [annotation("_In_")] ID3D12View* pView, UINT State );
};
[ uuid( 16be35a2-bfd6-49f2-bcae-eaae4aff862d ), object, local, pointer_default( unique ) ]
interface ID3D12DebugCommandQueue1
: ID3D12DebugCommandQueue
{
void AssertResourceAccess([annotation("_In_")] ID3D12Resource* pResource, UINT Subresource, D3D12_BARRIER_ACCESS Access);
void AssertTextureLayout([annotation("_In_")] ID3D12Resource* pResource, UINT Subresource, D3D12_BARRIER_LAYOUT Layout);
};
typedef enum D3D12_DEBUG_COMMAND_LIST_PARAMETER_TYPE
{
D3D12_DEBUG_COMMAND_LIST_PARAMETER_GPU_BASED_VALIDATION_SETTINGS,
@ -218,6 +226,14 @@ interface ID3D12DebugCommandList2
HRESULT GetDebugParameter(D3D12_DEBUG_COMMAND_LIST_PARAMETER_TYPE Type, [annotation("_Out_writes_bytes_(DataSize)")] void *pData, UINT DataSize);
};
[ uuid(197d5e15-4d37-4d34-af78-724cd70fdb1f), object, local, pointer_default( unique ) ]
interface ID3D12DebugCommandList3
: ID3D12DebugCommandList2
{
void AssertResourceAccess([annotation("_In_")] ID3D12Resource* pResource, UINT Subresource, D3D12_BARRIER_ACCESS Access);
void AssertTextureLayout([annotation("_In_")] ID3D12Resource* pResource, UINT Subresource, D3D12_BARRIER_LAYOUT Layout);
};
[uuid(0adf7d52-929c-4e61-addb-ffed30de66ef), object, local, pointer_default(unique)]
interface ID3D12SharingContract
: IUnknown
@ -1366,6 +1382,45 @@ typedef enum D3D12_MESSAGE_ID {
D3D12_MESSAGE_ID_ENHANCED_BARRIERS_NOT_SUPPORTED = 1343,
D3D12_MESSAGE_ID_LEGACY_BARRIER_VALIDATION_FORCED_ON = 1346,
D3D12_MESSAGE_ID_EMPTY_ROOT_DESCRIPTOR_TABLE = 1347,
D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_ELEMENT_OFFSET_UNALIGNED = 1348,
D3D12_MESSAGE_ID_ALPHA_BLEND_FACTOR_NOT_SUPPORTED = 1349,
D3D12_MESSAGE_ID_BARRIER_INTEROP_INVALID_LAYOUT = 1350,
D3D12_MESSAGE_ID_BARRIER_INTEROP_INVALID_STATE = 1351,
D3D12_MESSAGE_ID_GRAPHICS_PIPELINE_STATE_DESC_ZERO_SAMPLE_MASK = 1352,
D3D12_MESSAGE_ID_INDEPENDENT_STENCIL_REF_NOT_SUPPORTED = 1353,
D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INDEPENDENT_MASKS_UNSUPPORTED = 1354,
D3D12_MESSAGE_ID_TEXTURE_BARRIER_SUBRESOURCES_OUT_OF_BOUNDS = 1355,
D3D12_MESSAGE_ID_NON_OPTIMAL_BARRIER_ONLY_EXECUTE_COMMAND_LISTS = 1356,
D3D12_MESSAGE_ID_EXECUTE_INDIRECT_ZERO_COMMAND_COUNT = 1357,
D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_INCOMPATIBLE_TEXTURE_LAYOUT = 1358,
D3D12_MESSAGE_ID_DYNAMIC_INDEX_BUFFER_STRIP_CUT_NOT_SUPPORTED = 1359,
D3D12_MESSAGE_ID_PRIMITIVE_TOPOLOGY_TRIANGLE_FANS_NOT_SUPPORTED = 1360,
D3D12_MESSAGE_ID_CREATE_SAMPLER_COMPARISON_FUNC_IGNORED = 1361,
D3D12_MESSAGE_ID_CREATEHEAP_INVALIDHEAPTYPE = 1362,
D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_INVALIDHEAPTYPE = 1363,
D3D12_MESSAGE_ID_DYNAMIC_DEPTH_BIAS_NOT_SUPPORTED = 1364,
D3D12_MESSAGE_ID_CREATERASTERIZERSTATE_NON_WHOLE_DYNAMIC_DEPTH_BIAS = 1365,
D3D12_MESSAGE_ID_DYNAMIC_DEPTH_BIAS_FLAG_MISSING = 1366,
D3D12_MESSAGE_ID_DYNAMIC_DEPTH_BIAS_NO_PIPELINE = 1367,
D3D12_MESSAGE_ID_DYNAMIC_INDEX_BUFFER_STRIP_CUT_FLAG_MISSING = 1368,
D3D12_MESSAGE_ID_DYNAMIC_INDEX_BUFFER_STRIP_CUT_NO_PIPELINE = 1369,
D3D12_MESSAGE_ID_INVALID_CAST_TARGET = 1371,
D3D12_MESSAGE_ID_D3D12_MESSAGES_END
} D3D12_MESSAGE_ID;
@ -1703,9 +1758,11 @@ cpp_quote( "DEFINE_GUID(IID_ID3D12DebugDevice1,0xa9b71770,0xd099,0x4a65,0xa6,0x9
cpp_quote( "DEFINE_GUID(IID_ID3D12DebugDevice,0x3febd6dd,0x4973,0x4787,0x81,0x94,0xe4,0x5f,0x9e,0x28,0x92,0x3e);" )
cpp_quote( "DEFINE_GUID(IID_ID3D12DebugDevice2,0x60eccbc1,0x378d,0x4df1,0x89,0x4c,0xf8,0xac,0x5c,0xe4,0xd7,0xdd);" )
cpp_quote( "DEFINE_GUID(IID_ID3D12DebugCommandQueue,0x09e0bf36,0x54ac,0x484f,0x88,0x47,0x4b,0xae,0xea,0xb6,0x05,0x3a);" )
cpp_quote( "DEFINE_GUID(IID_ID3D12DebugCommandQueue1,0x16be35a2,0xbfd6,0x49f2,0xbc,0xae,0xea,0xae,0x4a,0xff,0x86,0x2d);" )
cpp_quote( "DEFINE_GUID(IID_ID3D12DebugCommandList1,0x102ca951,0x311b,0x4b01,0xb1,0x1f,0xec,0xb8,0x3e,0x06,0x1b,0x37);" )
cpp_quote( "DEFINE_GUID(IID_ID3D12DebugCommandList,0x09e0bf36,0x54ac,0x484f,0x88,0x47,0x4b,0xae,0xea,0xb6,0x05,0x3f);" )
cpp_quote( "DEFINE_GUID(IID_ID3D12DebugCommandList2,0xaeb575cf,0x4e06,0x48be,0xba,0x3b,0xc4,0x50,0xfc,0x96,0x65,0x2e);" )
cpp_quote( "DEFINE_GUID(IID_ID3D12DebugCommandList3,0x197d5e15,0x4d37,0x4d34,0xaf,0x78,0x72,0x4c,0xd7,0x0f,0xdb,0x1f);" )
cpp_quote( "DEFINE_GUID(IID_ID3D12SharingContract,0x0adf7d52,0x929c,0x4e61,0xad,0xdb,0xff,0xed,0x30,0xde,0x66,0xef);" )
cpp_quote( "DEFINE_GUID(IID_ID3D12InfoQueue,0x0742a90b,0xc387,0x483f,0xb9,0x46,0x30,0xa7,0xe4,0xe6,0x14,0x58);" )
cpp_quote( "DEFINE_GUID(IID_ID3D12InfoQueue1,0x2852dd88,0xb484,0x4c0c,0xb6,0xb1,0x67,0x16,0x85,0x00,0xe6,0x00);" )

View File

@ -201,6 +201,9 @@ typedef struct _D3D12_SHADER_INPUT_BIND_DESC
#define D3D_SHADER_REQUIRES_SAMPLER_DESCRIPTOR_HEAP_INDEXING 0x04000000
#define D3D_SHADER_REQUIRES_WAVE_MMA 0x08000000
#define D3D_SHADER_REQUIRES_ATOMIC_INT64_ON_DESCRIPTOR_HEAP_RESOURCE 0x10000000
#define D3D_SHADER_FEATURE_ADVANCED_TEXTURE_OPS 0x20000000
#define D3D_SHADER_FEATURE_WRITEABLE_MSAA_TEXTURES 0x40000000
typedef struct _D3D12_LIBRARY_DESC
{

View File

@ -9,7 +9,7 @@
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 8.01.0627 */
/* File created by MIDL compiler version 8.01.0628 */
@ -242,8 +242,8 @@ typedef interface ID3D12VideoEncodeCommandList3 ID3D12VideoEncodeCommandList3;
/* header files for imported files */
#include "OAIdl.h"
#include "OCIdl.h"
#include "oaidl.h"
#include "ocidl.h"
#include "dxgicommon.h"
#include "d3d12.h"
@ -491,7 +491,12 @@ EXTERN_C const IID IID_ID3D12VideoDecoderHeap;
ID3D12VideoDecoderHeap : public ID3D12Pageable
{
public:
#if defined(_MSC_VER) || !defined(_WIN32)
virtual D3D12_VIDEO_DECODER_HEAP_DESC STDMETHODCALLTYPE GetDesc( void) = 0;
#else
virtual D3D12_VIDEO_DECODER_HEAP_DESC *STDMETHODCALLTYPE GetDesc(
D3D12_VIDEO_DECODER_HEAP_DESC * RetVal) = 0;
#endif
};
@ -548,10 +553,17 @@ EXTERN_C const IID IID_ID3D12VideoDecoderHeap;
_COM_Outptr_opt_ void **ppvDevice);
DECLSPEC_XFGVIRT(ID3D12VideoDecoderHeap, GetDesc)
#if !defined(_WIN32)
D3D12_VIDEO_DECODER_HEAP_DESC ( STDMETHODCALLTYPE *GetDesc )(
ID3D12VideoDecoderHeap * This);
#else
D3D12_VIDEO_DECODER_HEAP_DESC *( STDMETHODCALLTYPE *GetDesc )(
ID3D12VideoDecoderHeap * This,
D3D12_VIDEO_DECODER_HEAP_DESC * RetVal);
#endif
END_INTERFACE
} ID3D12VideoDecoderHeapVtbl;
@ -592,9 +604,14 @@ EXTERN_C const IID IID_ID3D12VideoDecoderHeap;
( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) )
#if !defined(_WIN32)
#define ID3D12VideoDecoderHeap_GetDesc(This) \
( (This)->lpVtbl -> GetDesc(This) )
#else
#define ID3D12VideoDecoderHeap_GetDesc(This,RetVal) \
( (This)->lpVtbl -> GetDesc(This,RetVal) )
#endif
#endif /* COBJMACROS */
@ -760,7 +777,12 @@ EXTERN_C const IID IID_ID3D12VideoDecoder;
ID3D12VideoDecoder : public ID3D12Pageable
{
public:
#if defined(_MSC_VER) || !defined(_WIN32)
virtual D3D12_VIDEO_DECODER_DESC STDMETHODCALLTYPE GetDesc( void) = 0;
#else
virtual D3D12_VIDEO_DECODER_DESC *STDMETHODCALLTYPE GetDesc(
D3D12_VIDEO_DECODER_DESC * RetVal) = 0;
#endif
};
@ -817,10 +839,17 @@ EXTERN_C const IID IID_ID3D12VideoDecoder;
_COM_Outptr_opt_ void **ppvDevice);
DECLSPEC_XFGVIRT(ID3D12VideoDecoder, GetDesc)
#if !defined(_WIN32)
D3D12_VIDEO_DECODER_DESC ( STDMETHODCALLTYPE *GetDesc )(
ID3D12VideoDecoder * This);
#else
D3D12_VIDEO_DECODER_DESC *( STDMETHODCALLTYPE *GetDesc )(
ID3D12VideoDecoder * This,
D3D12_VIDEO_DECODER_DESC * RetVal);
#endif
END_INTERFACE
} ID3D12VideoDecoderVtbl;
@ -861,9 +890,14 @@ EXTERN_C const IID IID_ID3D12VideoDecoder;
( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) )
#if !defined(_WIN32)
#define ID3D12VideoDecoder_GetDesc(This) \
( (This)->lpVtbl -> GetDesc(This) )
#else
#define ID3D12VideoDecoder_GetDesc(This,RetVal) \
( (This)->lpVtbl -> GetDesc(This,RetVal) )
#endif
#endif /* COBJMACROS */
@ -1146,7 +1180,12 @@ EXTERN_C const IID IID_ID3D12VideoProcessor;
UINT NumInputStreamDescs,
_Out_writes_(NumInputStreamDescs) D3D12_VIDEO_PROCESS_INPUT_STREAM_DESC *pInputStreamDescs) = 0;
#if defined(_MSC_VER) || !defined(_WIN32)
virtual D3D12_VIDEO_PROCESS_OUTPUT_STREAM_DESC STDMETHODCALLTYPE GetOutputStreamDesc( void) = 0;
#else
virtual D3D12_VIDEO_PROCESS_OUTPUT_STREAM_DESC *STDMETHODCALLTYPE GetOutputStreamDesc(
D3D12_VIDEO_PROCESS_OUTPUT_STREAM_DESC * RetVal) = 0;
#endif
};
@ -1217,10 +1256,17 @@ EXTERN_C const IID IID_ID3D12VideoProcessor;
_Out_writes_(NumInputStreamDescs) D3D12_VIDEO_PROCESS_INPUT_STREAM_DESC *pInputStreamDescs);
DECLSPEC_XFGVIRT(ID3D12VideoProcessor, GetOutputStreamDesc)
#if !defined(_WIN32)
D3D12_VIDEO_PROCESS_OUTPUT_STREAM_DESC ( STDMETHODCALLTYPE *GetOutputStreamDesc )(
ID3D12VideoProcessor * This);
#else
D3D12_VIDEO_PROCESS_OUTPUT_STREAM_DESC *( STDMETHODCALLTYPE *GetOutputStreamDesc )(
ID3D12VideoProcessor * This,
D3D12_VIDEO_PROCESS_OUTPUT_STREAM_DESC * RetVal);
#endif
END_INTERFACE
} ID3D12VideoProcessorVtbl;
@ -1270,9 +1316,14 @@ EXTERN_C const IID IID_ID3D12VideoProcessor;
#define ID3D12VideoProcessor_GetInputStreamDescs(This,NumInputStreamDescs,pInputStreamDescs) \
( (This)->lpVtbl -> GetInputStreamDescs(This,NumInputStreamDescs,pInputStreamDescs) )
#if !defined(_WIN32)
#define ID3D12VideoProcessor_GetOutputStreamDesc(This) \
( (This)->lpVtbl -> GetOutputStreamDesc(This) )
#else
#define ID3D12VideoProcessor_GetOutputStreamDesc(This,RetVal) \
( (This)->lpVtbl -> GetOutputStreamDesc(This,RetVal) )
#endif
#endif /* COBJMACROS */
@ -2785,7 +2836,12 @@ EXTERN_C const IID IID_ID3D12VideoMotionEstimator;
ID3D12VideoMotionEstimator : public ID3D12Pageable
{
public:
#if defined(_MSC_VER) || !defined(_WIN32)
virtual D3D12_VIDEO_MOTION_ESTIMATOR_DESC STDMETHODCALLTYPE GetDesc( void) = 0;
#else
virtual D3D12_VIDEO_MOTION_ESTIMATOR_DESC *STDMETHODCALLTYPE GetDesc(
D3D12_VIDEO_MOTION_ESTIMATOR_DESC * RetVal) = 0;
#endif
virtual HRESULT STDMETHODCALLTYPE GetProtectedResourceSession(
REFIID riid,
@ -2846,10 +2902,17 @@ EXTERN_C const IID IID_ID3D12VideoMotionEstimator;
_COM_Outptr_opt_ void **ppvDevice);
DECLSPEC_XFGVIRT(ID3D12VideoMotionEstimator, GetDesc)
#if !defined(_WIN32)
D3D12_VIDEO_MOTION_ESTIMATOR_DESC ( STDMETHODCALLTYPE *GetDesc )(
ID3D12VideoMotionEstimator * This);
#else
D3D12_VIDEO_MOTION_ESTIMATOR_DESC *( STDMETHODCALLTYPE *GetDesc )(
ID3D12VideoMotionEstimator * This,
D3D12_VIDEO_MOTION_ESTIMATOR_DESC * RetVal);
#endif
DECLSPEC_XFGVIRT(ID3D12VideoMotionEstimator, GetProtectedResourceSession)
HRESULT ( STDMETHODCALLTYPE *GetProtectedResourceSession )(
ID3D12VideoMotionEstimator * This,
@ -2896,9 +2959,14 @@ EXTERN_C const IID IID_ID3D12VideoMotionEstimator;
( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) )
#if !defined(_WIN32)
#define ID3D12VideoMotionEstimator_GetDesc(This) \
( (This)->lpVtbl -> GetDesc(This) )
#else
#define ID3D12VideoMotionEstimator_GetDesc(This,RetVal) \
( (This)->lpVtbl -> GetDesc(This,RetVal) )
#endif
#define ID3D12VideoMotionEstimator_GetProtectedResourceSession(This,riid,ppProtectedSession) \
( (This)->lpVtbl -> GetProtectedResourceSession(This,riid,ppProtectedSession) )
@ -2946,7 +3014,12 @@ EXTERN_C const IID IID_ID3D12VideoMotionVectorHeap;
ID3D12VideoMotionVectorHeap : public ID3D12Pageable
{
public:
#if defined(_MSC_VER) || !defined(_WIN32)
virtual D3D12_VIDEO_MOTION_VECTOR_HEAP_DESC STDMETHODCALLTYPE GetDesc( void) = 0;
#else
virtual D3D12_VIDEO_MOTION_VECTOR_HEAP_DESC *STDMETHODCALLTYPE GetDesc(
D3D12_VIDEO_MOTION_VECTOR_HEAP_DESC * RetVal) = 0;
#endif
virtual HRESULT STDMETHODCALLTYPE GetProtectedResourceSession(
REFIID riid,
@ -3007,10 +3080,17 @@ EXTERN_C const IID IID_ID3D12VideoMotionVectorHeap;
_COM_Outptr_opt_ void **ppvDevice);
DECLSPEC_XFGVIRT(ID3D12VideoMotionVectorHeap, GetDesc)
#if !defined(_WIN32)
D3D12_VIDEO_MOTION_VECTOR_HEAP_DESC ( STDMETHODCALLTYPE *GetDesc )(
ID3D12VideoMotionVectorHeap * This);
#else
D3D12_VIDEO_MOTION_VECTOR_HEAP_DESC *( STDMETHODCALLTYPE *GetDesc )(
ID3D12VideoMotionVectorHeap * This,
D3D12_VIDEO_MOTION_VECTOR_HEAP_DESC * RetVal);
#endif
DECLSPEC_XFGVIRT(ID3D12VideoMotionVectorHeap, GetProtectedResourceSession)
HRESULT ( STDMETHODCALLTYPE *GetProtectedResourceSession )(
ID3D12VideoMotionVectorHeap * This,
@ -3057,9 +3137,14 @@ EXTERN_C const IID IID_ID3D12VideoMotionVectorHeap;
( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) )
#if !defined(_WIN32)
#define ID3D12VideoMotionVectorHeap_GetDesc(This) \
( (This)->lpVtbl -> GetDesc(This) )
#else
#define ID3D12VideoMotionVectorHeap_GetDesc(This,RetVal) \
( (This)->lpVtbl -> GetDesc(This,RetVal) )
#endif
#define ID3D12VideoMotionVectorHeap_GetProtectedResourceSession(This,riid,ppProtectedSession) \
( (This)->lpVtbl -> GetProtectedResourceSession(This,riid,ppProtectedSession) )
@ -3844,10 +3929,17 @@ EXTERN_C const IID IID_ID3D12VideoDecoder1;
_COM_Outptr_opt_ void **ppvDevice);
DECLSPEC_XFGVIRT(ID3D12VideoDecoder, GetDesc)
#if !defined(_WIN32)
D3D12_VIDEO_DECODER_DESC ( STDMETHODCALLTYPE *GetDesc )(
ID3D12VideoDecoder1 * This);
#else
D3D12_VIDEO_DECODER_DESC *( STDMETHODCALLTYPE *GetDesc )(
ID3D12VideoDecoder1 * This,
D3D12_VIDEO_DECODER_DESC * RetVal);
#endif
DECLSPEC_XFGVIRT(ID3D12VideoDecoder1, GetProtectedResourceSession)
HRESULT ( STDMETHODCALLTYPE *GetProtectedResourceSession )(
ID3D12VideoDecoder1 * This,
@ -3894,9 +3986,14 @@ EXTERN_C const IID IID_ID3D12VideoDecoder1;
( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) )
#if !defined(_WIN32)
#define ID3D12VideoDecoder1_GetDesc(This) \
( (This)->lpVtbl -> GetDesc(This) )
#else
#define ID3D12VideoDecoder1_GetDesc(This,RetVal) \
( (This)->lpVtbl -> GetDesc(This,RetVal) )
#endif
#define ID3D12VideoDecoder1_GetProtectedResourceSession(This,riid,ppProtectedSession) \
@ -3987,10 +4084,17 @@ EXTERN_C const IID IID_ID3D12VideoDecoderHeap1;
_COM_Outptr_opt_ void **ppvDevice);
DECLSPEC_XFGVIRT(ID3D12VideoDecoderHeap, GetDesc)
#if !defined(_WIN32)
D3D12_VIDEO_DECODER_HEAP_DESC ( STDMETHODCALLTYPE *GetDesc )(
ID3D12VideoDecoderHeap1 * This);
#else
D3D12_VIDEO_DECODER_HEAP_DESC *( STDMETHODCALLTYPE *GetDesc )(
ID3D12VideoDecoderHeap1 * This,
D3D12_VIDEO_DECODER_HEAP_DESC * RetVal);
#endif
DECLSPEC_XFGVIRT(ID3D12VideoDecoderHeap1, GetProtectedResourceSession)
HRESULT ( STDMETHODCALLTYPE *GetProtectedResourceSession )(
ID3D12VideoDecoderHeap1 * This,
@ -4037,9 +4141,14 @@ EXTERN_C const IID IID_ID3D12VideoDecoderHeap1;
( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) )
#if !defined(_WIN32)
#define ID3D12VideoDecoderHeap1_GetDesc(This) \
( (This)->lpVtbl -> GetDesc(This) )
#else
#define ID3D12VideoDecoderHeap1_GetDesc(This,RetVal) \
( (This)->lpVtbl -> GetDesc(This,RetVal) )
#endif
#define ID3D12VideoDecoderHeap1_GetProtectedResourceSession(This,riid,ppProtectedSession) \
@ -4144,10 +4253,17 @@ EXTERN_C const IID IID_ID3D12VideoProcessor1;
_Out_writes_(NumInputStreamDescs) D3D12_VIDEO_PROCESS_INPUT_STREAM_DESC *pInputStreamDescs);
DECLSPEC_XFGVIRT(ID3D12VideoProcessor, GetOutputStreamDesc)
#if !defined(_WIN32)
D3D12_VIDEO_PROCESS_OUTPUT_STREAM_DESC ( STDMETHODCALLTYPE *GetOutputStreamDesc )(
ID3D12VideoProcessor1 * This);
#else
D3D12_VIDEO_PROCESS_OUTPUT_STREAM_DESC *( STDMETHODCALLTYPE *GetOutputStreamDesc )(
ID3D12VideoProcessor1 * This,
D3D12_VIDEO_PROCESS_OUTPUT_STREAM_DESC * RetVal);
#endif
DECLSPEC_XFGVIRT(ID3D12VideoProcessor1, GetProtectedResourceSession)
HRESULT ( STDMETHODCALLTYPE *GetProtectedResourceSession )(
ID3D12VideoProcessor1 * This,
@ -4203,9 +4319,14 @@ EXTERN_C const IID IID_ID3D12VideoProcessor1;
#define ID3D12VideoProcessor1_GetInputStreamDescs(This,NumInputStreamDescs,pInputStreamDescs) \
( (This)->lpVtbl -> GetInputStreamDescs(This,NumInputStreamDescs,pInputStreamDescs) )
#if !defined(_WIN32)
#define ID3D12VideoProcessor1_GetOutputStreamDesc(This) \
( (This)->lpVtbl -> GetOutputStreamDesc(This) )
#else
#define ID3D12VideoProcessor1_GetOutputStreamDesc(This,RetVal) \
( (This)->lpVtbl -> GetOutputStreamDesc(This,RetVal) )
#endif
#define ID3D12VideoProcessor1_GetProtectedResourceSession(This,riid,ppProtectedSession) \
@ -4237,7 +4358,12 @@ EXTERN_C const IID IID_ID3D12VideoExtensionCommand;
ID3D12VideoExtensionCommand : public ID3D12Pageable
{
public:
#if defined(_MSC_VER) || !defined(_WIN32)
virtual D3D12_VIDEO_EXTENSION_COMMAND_DESC STDMETHODCALLTYPE GetDesc( void) = 0;
#else
virtual D3D12_VIDEO_EXTENSION_COMMAND_DESC *STDMETHODCALLTYPE GetDesc(
D3D12_VIDEO_EXTENSION_COMMAND_DESC * RetVal) = 0;
#endif
virtual HRESULT STDMETHODCALLTYPE GetProtectedResourceSession(
REFIID riid,
@ -4298,10 +4424,17 @@ EXTERN_C const IID IID_ID3D12VideoExtensionCommand;
_COM_Outptr_opt_ void **ppvDevice);
DECLSPEC_XFGVIRT(ID3D12VideoExtensionCommand, GetDesc)
#if !defined(_WIN32)
D3D12_VIDEO_EXTENSION_COMMAND_DESC ( STDMETHODCALLTYPE *GetDesc )(
ID3D12VideoExtensionCommand * This);
#else
D3D12_VIDEO_EXTENSION_COMMAND_DESC *( STDMETHODCALLTYPE *GetDesc )(
ID3D12VideoExtensionCommand * This,
D3D12_VIDEO_EXTENSION_COMMAND_DESC * RetVal);
#endif
DECLSPEC_XFGVIRT(ID3D12VideoExtensionCommand, GetProtectedResourceSession)
HRESULT ( STDMETHODCALLTYPE *GetProtectedResourceSession )(
ID3D12VideoExtensionCommand * This,
@ -4348,9 +4481,14 @@ EXTERN_C const IID IID_ID3D12VideoExtensionCommand;
( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) )
#if !defined(_WIN32)
#define ID3D12VideoExtensionCommand_GetDesc(This) \
( (This)->lpVtbl -> GetDesc(This) )
#else
#define ID3D12VideoExtensionCommand_GetDesc(This,RetVal) \
( (This)->lpVtbl -> GetDesc(This,RetVal) )
#endif
#define ID3D12VideoExtensionCommand_GetProtectedResourceSession(This,riid,ppProtectedSession) \
( (This)->lpVtbl -> GetProtectedResourceSession(This,riid,ppProtectedSession) )

View File

@ -4,8 +4,8 @@
* Licensed under the MIT license
*
*-------------------------------------------------------------------------------------*/
import "OAIdl.idl";
import "OCIdl.idl";
import "oaidl.idl";
import "ocidl.idl";
import "dxgicommon.idl";
import "d3d12.idl";

View File

@ -9,7 +9,7 @@
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 8.01.0627 */
/* File created by MIDL compiler version 8.01.0628 */
/* @@MIDL_FILE_HEADING( ) */
@ -68,8 +68,8 @@ typedef interface ID3DDestructionNotifier ID3DDestructionNotifier;
/* header files for imported files */
#include "OAIdl.h"
#include "OCIdl.h"
#include "oaidl.h"
#include "ocidl.h"
#ifdef __cplusplus
extern "C"{
@ -130,6 +130,7 @@ enum D3D_PRIMITIVE_TOPOLOGY
D3D_PRIMITIVE_TOPOLOGY_LINESTRIP = 3,
D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST = 4,
D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = 5,
D3D_PRIMITIVE_TOPOLOGY_TRIANGLEFAN = 6,
D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = 10,
D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = 11,
D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = 12,
@ -386,6 +387,8 @@ enum D3D_SRV_DIMENSION
#define D3D_SHADER_FEATURE_SAMPLER_DESCRIPTOR_HEAP_INDEXING 0x4000000
#define D3D_SHADER_FEATURE_WAVE_MMA 0x8000000
#define D3D_SHADER_FEATURE_ATOMIC_INT64_ON_DESCRIPTOR_HEAP_RESOURCE 0x10000000
#define D3D_SHADER_FEATURE_ADVANCED_TEXTURE_OPS 0x20000000
#define D3D_SHADER_FEATURE_WRITEABLE_MSAA_TEXTURES 0x40000000
typedef struct _D3D_SHADER_MACRO
{
LPCSTR Name;
@ -1041,6 +1044,46 @@ enum _D3D_PARAMETER_FLAGS
D3D_PF_FORCE_DWORD = 0x7fffffff
} D3D_PARAMETER_FLAGS;
typedef
enum D3D_FORMAT_LAYOUT
{
D3DFL_STANDARD = 0,
D3DFL_CUSTOM = -1
} D3D_FORMAT_LAYOUT;
typedef
enum D3D_FORMAT_TYPE_LEVEL
{
D3DFTL_NO_TYPE = 0,
D3DFTL_PARTIAL_TYPE = -2,
D3DFTL_FULL_TYPE = -1
} D3D_FORMAT_TYPE_LEVEL;
typedef
enum D3D_FORMAT_COMPONENT_NAME
{
D3DFCN_R = -4,
D3DFCN_G = -3,
D3DFCN_B = -2,
D3DFCN_A = -1,
D3DFCN_D = 0,
D3DFCN_S = 1,
D3DFCN_X = 2
} D3D_FORMAT_COMPONENT_NAME;
typedef
enum D3D_FORMAT_COMPONENT_INTERPRETATION
{
D3DFCI_TYPELESS = 0,
D3DFCI_FLOAT = -4,
D3DFCI_SNORM = -3,
D3DFCI_UNORM = -2,
D3DFCI_SINT = -1,
D3DFCI_UINT = 1,
D3DFCI_UNORM_SRGB = 2,
D3DFCI_BIASED_FIXED_2_8 = 3
} D3D_FORMAT_COMPONENT_INTERPRETATION;
DEFINE_GUID(WKPDID_D3DDebugObjectName,0x429b8c22,0x9188,0x4b0c,0x87,0x42,0xac,0xb0,0xbf,0x85,0xc2,0x00);
DEFINE_GUID(WKPDID_D3DDebugObjectNameW,0x4cca5fd8,0x921f,0x42c8,0x85,0x66,0x70,0xca,0xf2,0xa9,0xb7,0x41);
DEFINE_GUID(WKPDID_CommentStringW,0xd0149dc0,0x90e8,0x4ec8,0x81, 0x44, 0xe9, 0x00, 0xad, 0x26, 0x6b, 0xb2);

View File

@ -4,8 +4,8 @@
* Licensed under the MIT license
*
*-------------------------------------------------------------------------------------*/
import "OAIdl.idl";
import "OCIdl.idl";
import "oaidl.idl";
import "ocidl.idl";
//----------------------------------------------------------------------------
//
@ -62,7 +62,7 @@ typedef enum D3D_PRIMITIVE_TOPOLOGY
D3D_PRIMITIVE_TOPOLOGY_LINESTRIP = 3,
D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST = 4,
D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = 5,
// 6 is reserved for legacy triangle fans
D3D_PRIMITIVE_TOPOLOGY_TRIANGLEFAN = 6,
// Adjacency values should be equal to (0x8 & non-adjacency):
D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = 10,
D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = 11,
@ -153,7 +153,7 @@ typedef enum D3D_PRIMITIVE_TOPOLOGY
D3D11_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST
} D3D_PRIMITIVE_TOPOLOGY;
typedef enum D3D_PRIMITIVE
@ -327,6 +327,8 @@ cpp_quote("#define D3D_SHADER_FEATURE_RESOURCE_DESCRIPTOR_HEAP_INDEXING
cpp_quote("#define D3D_SHADER_FEATURE_SAMPLER_DESCRIPTOR_HEAP_INDEXING 0x4000000")
cpp_quote("#define D3D_SHADER_FEATURE_WAVE_MMA 0x8000000")
cpp_quote("#define D3D_SHADER_FEATURE_ATOMIC_INT64_ON_DESCRIPTOR_HEAP_RESOURCE 0x10000000")
cpp_quote("#define D3D_SHADER_FEATURE_ADVANCED_TEXTURE_OPS 0x20000000")
cpp_quote("#define D3D_SHADER_FEATURE_WRITEABLE_MSAA_TEXTURES 0x40000000")
// Additional internal shader feature flags are listed in dxbcutils.h (not relevant/useful for public to see)
// When adding entries here, make sure they don't conflict with what's there.
@ -891,6 +893,51 @@ typedef enum _D3D_PARAMETER_FLAGS
D3D_PF_FORCE_DWORD = 0x7fffffff
} D3D_PARAMETER_FLAGS;
// Format Layout Properties
typedef enum D3D_FORMAT_LAYOUT
{
D3DFL_STANDARD = 0, // standard layout
D3DFL_CUSTOM = -1 // custom layout
// Note, 1 bit allocated for this in FORMAT_DETAIL below. If you add fields here, add bits...
// NOTE SIGNED VALUES ARE USED SINCE COMPILER MAKES ENUMS SIGNED, AND BITFIELDS ARE SIGN EXTENDED ON READ
} D3D_FORMAT_LAYOUT;
typedef enum D3D_FORMAT_TYPE_LEVEL
{
D3DFTL_NO_TYPE = 0,
D3DFTL_PARTIAL_TYPE = -2,
D3DFTL_FULL_TYPE = -1,
// Note, 2 bits allocated for this in FORMAT_DETAIL below. If you add fields here, add bits...
// NOTE SIGNED VALUES ARE USED SINCE COMPILER MAKES ENUMS SIGNED, AND BITFIELDS ARE SIGN EXTENDED ON READ
} D3D_FORMAT_TYPE_LEVEL;
typedef enum D3D_FORMAT_COMPONENT_NAME
{
D3DFCN_R = -4,
D3DFCN_G = -3,
D3DFCN_B = -2,
D3DFCN_A = -1,
D3DFCN_D = 0,
D3DFCN_S = 1,
D3DFCN_X = 2,
// Note, 3 bits allocated for this in FORMAT_DETAIL below. If you add fields here, add bits...
// NOTE SIGNED VALUES ARE USED SINCE COMPILER MAKES ENUMS SIGNED, AND BITFIELDS ARE SIGN EXTENDED ON READ
} D3D_FORMAT_COMPONENT_NAME;
typedef enum D3D_FORMAT_COMPONENT_INTERPRETATION
{
D3DFCI_TYPELESS = 0,
D3DFCI_FLOAT = -4,
D3DFCI_SNORM = -3,
D3DFCI_UNORM = -2,
D3DFCI_SINT = -1,
D3DFCI_UINT = 1,
D3DFCI_UNORM_SRGB = 2,
D3DFCI_BIASED_FIXED_2_8 = 3,
// Note, 3 bits allocated for this in FORMAT_DETAIL below. If you add fields here, add bits...
// NOTE SIGNED VALUES ARE USED SINCE COMPILER MAKES ENUMS SIGNED, AND BITFIELDS ARE SIGN EXTENDED ON READ
} D3D_FORMAT_COMPONENT_INTERPRETATION;
// Well-Known Private Data IDs (WKPDID_*):
// WKPDID_D3DDebugObjectName provides a unique name to objects in order to assist the developer during debugging.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,192 @@
//*********************************************************
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License (MIT).
//
//*********************************************************
#ifndef __D3DX12_BARRIERS_H__
#define __D3DX12_BARRIERS_H__
#if defined( __cplusplus )
#include "d3d12.h"
//------------------------------------------------------------------------------------------------
struct CD3DX12_RESOURCE_BARRIER : public D3D12_RESOURCE_BARRIER
{
CD3DX12_RESOURCE_BARRIER() = default;
explicit CD3DX12_RESOURCE_BARRIER(const D3D12_RESOURCE_BARRIER &o) noexcept :
D3D12_RESOURCE_BARRIER(o)
{}
static inline CD3DX12_RESOURCE_BARRIER Transition(
_In_ ID3D12Resource* pResource,
D3D12_RESOURCE_STATES stateBefore,
D3D12_RESOURCE_STATES stateAfter,
UINT subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES,
D3D12_RESOURCE_BARRIER_FLAGS flags = D3D12_RESOURCE_BARRIER_FLAG_NONE) noexcept
{
CD3DX12_RESOURCE_BARRIER result = {};
D3D12_RESOURCE_BARRIER &barrier = result;
result.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;
result.Flags = flags;
barrier.Transition.pResource = pResource;
barrier.Transition.StateBefore = stateBefore;
barrier.Transition.StateAfter = stateAfter;
barrier.Transition.Subresource = subresource;
return result;
}
static inline CD3DX12_RESOURCE_BARRIER Aliasing(
_In_ ID3D12Resource* pResourceBefore,
_In_ ID3D12Resource* pResourceAfter) noexcept
{
CD3DX12_RESOURCE_BARRIER result = {};
D3D12_RESOURCE_BARRIER &barrier = result;
result.Type = D3D12_RESOURCE_BARRIER_TYPE_ALIASING;
barrier.Aliasing.pResourceBefore = pResourceBefore;
barrier.Aliasing.pResourceAfter = pResourceAfter;
return result;
}
static inline CD3DX12_RESOURCE_BARRIER UAV(
_In_opt_ ID3D12Resource* pResource) noexcept
{
CD3DX12_RESOURCE_BARRIER result = {};
D3D12_RESOURCE_BARRIER &barrier = result;
result.Type = D3D12_RESOURCE_BARRIER_TYPE_UAV;
barrier.UAV.pResource = pResource;
return result;
}
};
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 608)
//================================================================================================
// D3DX12 Enhanced Barrier Helpers
//================================================================================================
class CD3DX12_BARRIER_SUBRESOURCE_RANGE : public D3D12_BARRIER_SUBRESOURCE_RANGE
{
public:
CD3DX12_BARRIER_SUBRESOURCE_RANGE() = default;
CD3DX12_BARRIER_SUBRESOURCE_RANGE(const D3D12_BARRIER_SUBRESOURCE_RANGE &o) noexcept :
D3D12_BARRIER_SUBRESOURCE_RANGE(o)
{}
explicit CD3DX12_BARRIER_SUBRESOURCE_RANGE(UINT Subresource) noexcept :
D3D12_BARRIER_SUBRESOURCE_RANGE{ Subresource, 0, 0, 0, 0, 0 }
{}
CD3DX12_BARRIER_SUBRESOURCE_RANGE(
UINT firstMipLevel,
UINT numMips,
UINT firstArraySlice,
UINT numArraySlices,
UINT firstPlane = 0,
UINT numPlanes = 1) noexcept :
D3D12_BARRIER_SUBRESOURCE_RANGE
{
firstMipLevel,
numMips,
firstArraySlice,
numArraySlices,
firstPlane,
numPlanes
}
{}
};
class CD3DX12_GLOBAL_BARRIER : public D3D12_GLOBAL_BARRIER
{
public:
CD3DX12_GLOBAL_BARRIER() = default;
CD3DX12_GLOBAL_BARRIER(const D3D12_GLOBAL_BARRIER &o) noexcept : D3D12_GLOBAL_BARRIER(o){}
CD3DX12_GLOBAL_BARRIER(
D3D12_BARRIER_SYNC syncBefore,
D3D12_BARRIER_SYNC syncAfter,
D3D12_BARRIER_ACCESS accessBefore,
D3D12_BARRIER_ACCESS accessAfter) noexcept : D3D12_GLOBAL_BARRIER {
syncBefore,
syncAfter,
accessBefore,
accessAfter
}
{}
};
class CD3DX12_BUFFER_BARRIER : public D3D12_BUFFER_BARRIER
{
public:
CD3DX12_BUFFER_BARRIER() = default;
CD3DX12_BUFFER_BARRIER(const D3D12_BUFFER_BARRIER &o) noexcept : D3D12_BUFFER_BARRIER(o){}
CD3DX12_BUFFER_BARRIER(
D3D12_BARRIER_SYNC syncBefore,
D3D12_BARRIER_SYNC syncAfter,
D3D12_BARRIER_ACCESS accessBefore,
D3D12_BARRIER_ACCESS accessAfter,
ID3D12Resource *pRes) noexcept : D3D12_BUFFER_BARRIER {
syncBefore,
syncAfter,
accessBefore,
accessAfter,
pRes,
0, ULLONG_MAX
}
{}
};
class CD3DX12_TEXTURE_BARRIER : public D3D12_TEXTURE_BARRIER
{
public:
CD3DX12_TEXTURE_BARRIER() = default;
CD3DX12_TEXTURE_BARRIER(const D3D12_TEXTURE_BARRIER &o) noexcept : D3D12_TEXTURE_BARRIER(o){}
CD3DX12_TEXTURE_BARRIER(
D3D12_BARRIER_SYNC syncBefore,
D3D12_BARRIER_SYNC syncAfter,
D3D12_BARRIER_ACCESS accessBefore,
D3D12_BARRIER_ACCESS accessAfter,
D3D12_BARRIER_LAYOUT layoutBefore,
D3D12_BARRIER_LAYOUT layoutAfter,
ID3D12Resource *pRes,
const D3D12_BARRIER_SUBRESOURCE_RANGE &subresources,
D3D12_TEXTURE_BARRIER_FLAGS flag = D3D12_TEXTURE_BARRIER_FLAG_NONE) noexcept : D3D12_TEXTURE_BARRIER {
syncBefore,
syncAfter,
accessBefore,
accessAfter,
layoutBefore,
layoutAfter,
pRes,
subresources,
flag
}
{}
};
class CD3DX12_BARRIER_GROUP : public D3D12_BARRIER_GROUP
{
public:
CD3DX12_BARRIER_GROUP() = default;
CD3DX12_BARRIER_GROUP(const D3D12_BARRIER_GROUP &o) noexcept : D3D12_BARRIER_GROUP(o){}
CD3DX12_BARRIER_GROUP(UINT32 numBarriers, const D3D12_BUFFER_BARRIER *pBarriers) noexcept
{
Type = D3D12_BARRIER_TYPE_BUFFER;
NumBarriers = numBarriers;
pBufferBarriers = pBarriers;
}
CD3DX12_BARRIER_GROUP(UINT32 numBarriers, const D3D12_TEXTURE_BARRIER *pBarriers) noexcept
{
Type = D3D12_BARRIER_TYPE_TEXTURE;
NumBarriers = numBarriers;
pTextureBarriers = pBarriers;
}
CD3DX12_BARRIER_GROUP(UINT32 numBarriers, const D3D12_GLOBAL_BARRIER *pBarriers) noexcept
{
Type = D3D12_BARRIER_TYPE_GLOBAL;
NumBarriers = numBarriers;
pGlobalBarriers = pBarriers;
}
};
#endif // D3D12_SDK_VERSION >= 608
#endif // defined( __cplusplus )
#endif // __D3DX12_BARRIERS_H__

View File

@ -0,0 +1,996 @@
//*********************************************************
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License (MIT).
//
//*********************************************************
#pragma once
#ifndef __cplusplus
#error D3DX12 requires C++
#endif
#include "d3d12.h"
//================================================================================================
// D3DX12 Check Feature Support
//================================================================================================
#include <vector>
class CD3DX12FeatureSupport
{
public: // Function declaration
// Default constructor that creates an empty object
CD3DX12FeatureSupport() noexcept;
// Initialize data from the given device
HRESULT Init(ID3D12Device* pDevice);
// Retreives the status of the object. If an error occurred in the initialization process, the function returns the error code.
HRESULT GetStatus() const noexcept { return m_hStatus; }
// Getter functions for each feature class
// D3D12_OPTIONS
BOOL DoublePrecisionFloatShaderOps() const noexcept;
BOOL OutputMergerLogicOp() const noexcept;
D3D12_SHADER_MIN_PRECISION_SUPPORT MinPrecisionSupport() const noexcept;
D3D12_TILED_RESOURCES_TIER TiledResourcesTier() const noexcept;
D3D12_RESOURCE_BINDING_TIER ResourceBindingTier() const noexcept;
BOOL PSSpecifiedStencilRefSupported() const noexcept;
BOOL TypedUAVLoadAdditionalFormats() const noexcept;
BOOL ROVsSupported() const noexcept;
D3D12_CONSERVATIVE_RASTERIZATION_TIER ConservativeRasterizationTier() const noexcept;
BOOL StandardSwizzle64KBSupported() const noexcept;
BOOL CrossAdapterRowMajorTextureSupported() const noexcept;
BOOL VPAndRTArrayIndexFromAnyShaderFeedingRasterizerSupportedWithoutGSEmulation() const noexcept;
D3D12_RESOURCE_HEAP_TIER ResourceHeapTier() const noexcept;
D3D12_CROSS_NODE_SHARING_TIER CrossNodeSharingTier() const noexcept;
UINT MaxGPUVirtualAddressBitsPerResource() const noexcept;
// FEATURE_LEVELS
D3D_FEATURE_LEVEL MaxSupportedFeatureLevel() const noexcept;
// FORMAT_SUPPORT
HRESULT FormatSupport(DXGI_FORMAT Format, D3D12_FORMAT_SUPPORT1& Support1, D3D12_FORMAT_SUPPORT2& Support2) const;
// MUTLTISAMPLE_QUALITY_LEVELS
HRESULT MultisampleQualityLevels(DXGI_FORMAT Format, UINT SampleCount, D3D12_MULTISAMPLE_QUALITY_LEVEL_FLAGS Flags, UINT& NumQualityLevels) const;
// FORMAT_INFO
HRESULT FormatInfo(DXGI_FORMAT Format, UINT8& PlaneCount) const;
// GPU_VIRTUAL_ADDRESS_SUPPORT
UINT MaxGPUVirtualAddressBitsPerProcess() const noexcept;
// SHADER_MODEL
D3D_SHADER_MODEL HighestShaderModel() const noexcept;
// D3D12_OPTIONS1
BOOL WaveOps() const noexcept;
UINT WaveLaneCountMin() const noexcept;
UINT WaveLaneCountMax() const noexcept;
UINT TotalLaneCount() const noexcept;
BOOL ExpandedComputeResourceStates() const noexcept;
BOOL Int64ShaderOps() const noexcept;
// PROTECTED_RESOURCE_SESSION_SUPPORT
D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAGS ProtectedResourceSessionSupport(UINT NodeIndex = 0) const;
// ROOT_SIGNATURE
D3D_ROOT_SIGNATURE_VERSION HighestRootSignatureVersion() const noexcept;
// ARCHITECTURE1
BOOL TileBasedRenderer(UINT NodeIndex = 0) const;
BOOL UMA(UINT NodeIndex = 0) const;
BOOL CacheCoherentUMA(UINT NodeIndex = 0) const;
BOOL IsolatedMMU(UINT NodeIndex = 0) const;
// D3D12_OPTIONS2
BOOL DepthBoundsTestSupported() const noexcept;
D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER ProgrammableSamplePositionsTier() const noexcept;
// SHADER_CACHE
D3D12_SHADER_CACHE_SUPPORT_FLAGS ShaderCacheSupportFlags() const noexcept;
// COMMAND_QUEUE_PRIORITY
BOOL CommandQueuePrioritySupported(D3D12_COMMAND_LIST_TYPE CommandListType, UINT Priority);
// D3D12_OPTIONS3
BOOL CopyQueueTimestampQueriesSupported() const noexcept;
BOOL CastingFullyTypedFormatSupported() const noexcept;
D3D12_COMMAND_LIST_SUPPORT_FLAGS WriteBufferImmediateSupportFlags() const noexcept;
D3D12_VIEW_INSTANCING_TIER ViewInstancingTier() const noexcept;
BOOL BarycentricsSupported() const noexcept;
// EXISTING_HEAPS
BOOL ExistingHeapsSupported() const noexcept;
// D3D12_OPTIONS4
BOOL MSAA64KBAlignedTextureSupported() const noexcept;
D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER SharedResourceCompatibilityTier() const noexcept;
BOOL Native16BitShaderOpsSupported() const noexcept;
// SERIALIZATION
D3D12_HEAP_SERIALIZATION_TIER HeapSerializationTier(UINT NodeIndex = 0) const;
// CROSS_NODE
// CrossNodeSharingTier handled in D3D12Options
BOOL CrossNodeAtomicShaderInstructions() const noexcept;
// D3D12_OPTIONS5
BOOL SRVOnlyTiledResourceTier3() const noexcept;
D3D12_RENDER_PASS_TIER RenderPassesTier() const noexcept;
D3D12_RAYTRACING_TIER RaytracingTier() const noexcept;
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 4)
// DISPLAYABLE
BOOL DisplayableTexture() const noexcept;
// SharedResourceCompatibilityTier handled in D3D12Options4
#endif
// D3D12_OPTIONS6
BOOL AdditionalShadingRatesSupported() const noexcept;
BOOL PerPrimitiveShadingRateSupportedWithViewportIndexing() const noexcept;
D3D12_VARIABLE_SHADING_RATE_TIER VariableShadingRateTier() const noexcept;
UINT ShadingRateImageTileSize() const noexcept;
BOOL BackgroundProcessingSupported() const noexcept;
// QUERY_META_COMMAND
HRESULT QueryMetaCommand(D3D12_FEATURE_DATA_QUERY_META_COMMAND& dQueryMetaCommand) const;
// D3D12_OPTIONS7
D3D12_MESH_SHADER_TIER MeshShaderTier() const noexcept;
D3D12_SAMPLER_FEEDBACK_TIER SamplerFeedbackTier() const noexcept;
// PROTECTED_RESOURCE_SESSION_TYPE_COUNT
UINT ProtectedResourceSessionTypeCount(UINT NodeIndex = 0) const;
// PROTECTED_RESOURCE_SESSION_TYPES
std::vector<GUID> ProtectedResourceSessionTypes(UINT NodeIndex = 0) const;
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 3)
// D3D12_OPTIONS8
BOOL UnalignedBlockTexturesSupported() const noexcept;
// D3D12_OPTIONS9
BOOL MeshShaderPipelineStatsSupported() const noexcept;
BOOL MeshShaderSupportsFullRangeRenderTargetArrayIndex() const noexcept;
BOOL AtomicInt64OnTypedResourceSupported() const noexcept;
BOOL AtomicInt64OnGroupSharedSupported() const noexcept;
BOOL DerivativesInMeshAndAmplificationShadersSupported() const noexcept;
D3D12_WAVE_MMA_TIER WaveMMATier() const noexcept;
#endif
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 4)
// D3D12_OPTIONS10
BOOL VariableRateShadingSumCombinerSupported() const noexcept;
BOOL MeshShaderPerPrimitiveShadingRateSupported() const noexcept;
// D3D12_OPTIONS11
BOOL AtomicInt64OnDescriptorHeapResourceSupported() const noexcept;
#endif
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 600)
// D3D12_OPTIONS12
D3D12_TRI_STATE MSPrimitivesPipelineStatisticIncludesCulledPrimitives() const noexcept;
BOOL EnhancedBarriersSupported() const noexcept;
BOOL RelaxedFormatCastingSupported() const noexcept;
#endif
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 602)
// D3D12_OPTIONS13
BOOL UnrestrictedBufferTextureCopyPitchSupported() const noexcept;
BOOL UnrestrictedVertexElementAlignmentSupported() const noexcept;
BOOL InvertedViewportHeightFlipsYSupported() const noexcept;
BOOL InvertedViewportDepthFlipsZSupported() const noexcept;
BOOL TextureCopyBetweenDimensionsSupported() const noexcept;
BOOL AlphaBlendFactorSupported() const noexcept;
#endif
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 606)
// D3D12_OPTIONS14
BOOL AdvancedTextureOpsSupported() const noexcept;
BOOL WriteableMSAATexturesSupported() const noexcept;
BOOL IndependentFrontAndBackStencilRefMaskSupported() const noexcept;
// D3D12_OPTIONS15
BOOL TriangleFanSupported() const noexcept;
BOOL DynamicIndexBufferStripCutSupported() const noexcept;
#endif
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 608)
// D3D12_OPTIONS16
BOOL DynamicDepthBiasSupported() const noexcept;
#endif
private: // Private structs and helpers declaration
struct ProtectedResourceSessionTypesLocal : D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_TYPES
{
std::vector<GUID> TypeVec;
};
// Helper function to decide the highest shader model supported by the system
// Stores the result in m_dShaderModel
// Must be updated whenever a new shader model is added to the d3d12.h header
HRESULT QueryHighestShaderModel();
// Helper function to decide the highest root signature supported
// Must be updated whenever a new root signature version is added to the d3d12.h header
HRESULT QueryHighestRootSignatureVersion();
// Helper funcion to decide the highest feature level
HRESULT QueryHighestFeatureLevel();
// Helper function to initialize local protected resource session types structs
HRESULT QueryProtectedResourceSessionTypes(UINT NodeIndex, UINT Count);
private: // Member data
// Pointer to the underlying device
ID3D12Device* m_pDevice;
// Stores the error code from initialization
HRESULT m_hStatus;
// Feature support data structs
D3D12_FEATURE_DATA_D3D12_OPTIONS m_dOptions;
D3D_FEATURE_LEVEL m_eMaxFeatureLevel;
D3D12_FEATURE_DATA_GPU_VIRTUAL_ADDRESS_SUPPORT m_dGPUVASupport;
D3D12_FEATURE_DATA_SHADER_MODEL m_dShaderModel;
D3D12_FEATURE_DATA_D3D12_OPTIONS1 m_dOptions1;
std::vector<D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_SUPPORT> m_dProtectedResourceSessionSupport;
D3D12_FEATURE_DATA_ROOT_SIGNATURE m_dRootSignature;
std::vector<D3D12_FEATURE_DATA_ARCHITECTURE1> m_dArchitecture1;
D3D12_FEATURE_DATA_D3D12_OPTIONS2 m_dOptions2;
D3D12_FEATURE_DATA_SHADER_CACHE m_dShaderCache;
D3D12_FEATURE_DATA_COMMAND_QUEUE_PRIORITY m_dCommandQueuePriority;
D3D12_FEATURE_DATA_D3D12_OPTIONS3 m_dOptions3;
D3D12_FEATURE_DATA_EXISTING_HEAPS m_dExistingHeaps;
D3D12_FEATURE_DATA_D3D12_OPTIONS4 m_dOptions4;
std::vector<D3D12_FEATURE_DATA_SERIALIZATION> m_dSerialization; // Cat2 NodeIndex
D3D12_FEATURE_DATA_CROSS_NODE m_dCrossNode;
D3D12_FEATURE_DATA_D3D12_OPTIONS5 m_dOptions5;
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 4)
D3D12_FEATURE_DATA_DISPLAYABLE m_dDisplayable;
#endif
D3D12_FEATURE_DATA_D3D12_OPTIONS6 m_dOptions6;
D3D12_FEATURE_DATA_D3D12_OPTIONS7 m_dOptions7;
std::vector<D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_TYPE_COUNT> m_dProtectedResourceSessionTypeCount; // Cat2 NodeIndex
std::vector<ProtectedResourceSessionTypesLocal> m_dProtectedResourceSessionTypes; // Cat3
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 3)
D3D12_FEATURE_DATA_D3D12_OPTIONS8 m_dOptions8;
D3D12_FEATURE_DATA_D3D12_OPTIONS9 m_dOptions9;
#endif
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 4)
D3D12_FEATURE_DATA_D3D12_OPTIONS10 m_dOptions10;
D3D12_FEATURE_DATA_D3D12_OPTIONS11 m_dOptions11;
#endif
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 600)
D3D12_FEATURE_DATA_D3D12_OPTIONS12 m_dOptions12;
#endif
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 602)
D3D12_FEATURE_DATA_D3D12_OPTIONS13 m_dOptions13;
#endif
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 606)
D3D12_FEATURE_DATA_D3D12_OPTIONS14 m_dOptions14;
D3D12_FEATURE_DATA_D3D12_OPTIONS15 m_dOptions15;
#endif
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 608)
D3D12_FEATURE_DATA_D3D12_OPTIONS16 m_dOptions16;
#endif
};
// Implementations for CD3DX12FeatureSupport functions
// Macro to set up a getter function for each entry in feature support data
// The getter function will have the same name as the feature option name
#define FEATURE_SUPPORT_GET(RETTYPE,FEATURE,OPTION) \
inline RETTYPE CD3DX12FeatureSupport::OPTION() const noexcept \
{ \
return FEATURE.OPTION; \
}
// Macro to set up a getter function for each entry in feature support data
// Also specifies the name for the function which can be different from the feature name
#define FEATURE_SUPPORT_GET_NAME(RETTYPE,FEATURE,OPTION,NAME) \
inline RETTYPE CD3DX12FeatureSupport::NAME() const noexcept \
{\
return FEATURE.OPTION; \
}
// Macro to set up a getter function for feature data indexed by the graphics node ID
// The default parameter is 0, or the first availabe graphics device node
#define FEATURE_SUPPORT_GET_NODE_INDEXED(RETTYPE,FEATURE,OPTION) \
inline RETTYPE CD3DX12FeatureSupport::OPTION(UINT NodeIndex) const \
{\
return FEATURE[NodeIndex].OPTION; \
}
// Macro to set up a getter function for feature data indexed by NodeIndex
// Allows a custom name for the getter function
#define FEATURE_SUPPORT_GET_NODE_INDEXED_NAME(RETTYPE,FEATURE,OPTION,NAME) \
inline RETTYPE CD3DX12FeatureSupport::NAME(UINT NodeIndex) const \
{\
return FEATURE[NodeIndex].OPTION; \
}
inline CD3DX12FeatureSupport::CD3DX12FeatureSupport() noexcept
: m_pDevice(nullptr)
, m_hStatus(E_INVALIDARG)
, m_dOptions{}
, m_eMaxFeatureLevel{}
, m_dGPUVASupport{}
, m_dShaderModel{}
, m_dOptions1{}
, m_dRootSignature{}
, m_dOptions2{}
, m_dShaderCache{}
, m_dCommandQueuePriority{}
, m_dOptions3{}
, m_dExistingHeaps{}
, m_dOptions4{}
, m_dCrossNode{}
, m_dOptions5{}
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 4)
, m_dDisplayable{}
#endif
, m_dOptions6{}
, m_dOptions7{}
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 3)
, m_dOptions8{}
, m_dOptions9{}
#endif
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 4)
, m_dOptions10{}
, m_dOptions11{}
#endif
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 600)
, m_dOptions12{}
#endif
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 602)
, m_dOptions13{}
#endif
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 606)
, m_dOptions14{}
, m_dOptions15{}
#endif
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 608)
, m_dOptions16{}
#endif
{}
inline HRESULT CD3DX12FeatureSupport::Init(ID3D12Device* pDevice)
{
if (!pDevice)
{
m_hStatus = E_INVALIDARG;
return m_hStatus;
}
m_pDevice = pDevice;
// Initialize static feature support data structures
if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS, &m_dOptions, sizeof(m_dOptions))))
{
m_dOptions = {};
}
if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_GPU_VIRTUAL_ADDRESS_SUPPORT, &m_dGPUVASupport, sizeof(m_dGPUVASupport))))
{
m_dGPUVASupport = {};
}
if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS1, &m_dOptions1, sizeof(m_dOptions1))))
{
m_dOptions1 = {};
}
if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS2, &m_dOptions2, sizeof(m_dOptions2))))
{
m_dOptions2 = {};
}
if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_SHADER_CACHE, &m_dShaderCache, sizeof(m_dShaderCache))))
{
m_dShaderCache = {};
}
if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS3, &m_dOptions3, sizeof(m_dOptions3))))
{
m_dOptions3 = {};
}
if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_EXISTING_HEAPS, &m_dExistingHeaps, sizeof(m_dExistingHeaps))))
{
m_dExistingHeaps = {};
}
if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS4, &m_dOptions4, sizeof(m_dOptions4))))
{
m_dOptions4 = {};
}
if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_CROSS_NODE, &m_dCrossNode, sizeof(m_dCrossNode))))
{
m_dCrossNode = {};
}
if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS5, &m_dOptions5, sizeof(m_dOptions5))))
{
m_dOptions5 = {};
}
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 4)
if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_DISPLAYABLE, &m_dDisplayable, sizeof(m_dDisplayable))))
{
m_dDisplayable = {};
}
#endif
if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS6, &m_dOptions6, sizeof(m_dOptions6))))
{
m_dOptions6 = {};
}
if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS7, &m_dOptions7, sizeof(m_dOptions7))))
{
m_dOptions7 = {};
}
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 3)
if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS8, &m_dOptions8, sizeof(m_dOptions8))))
{
m_dOptions8 = {};
}
if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS9, &m_dOptions9, sizeof(m_dOptions9))))
{
m_dOptions9 = {};
}
#endif
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 4)
if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS10, &m_dOptions10, sizeof(m_dOptions10))))
{
m_dOptions10 = {};
}
if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS11, &m_dOptions11, sizeof(m_dOptions11))))
{
m_dOptions11 = {};
}
#endif
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 600)
if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS12, &m_dOptions12, sizeof(m_dOptions12))))
{
m_dOptions12 = {};
m_dOptions12.MSPrimitivesPipelineStatisticIncludesCulledPrimitives = D3D12_TRI_STATE::D3D12_TRI_STATE_UNKNOWN;
}
#endif
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 602)
if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS13, &m_dOptions13, sizeof(m_dOptions13))))
{
m_dOptions13 = {};
}
#endif
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 606)
if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS14, &m_dOptions14, sizeof(m_dOptions14))))
{
m_dOptions14 = {};
}
if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS15, &m_dOptions15, sizeof(m_dOptions15))))
{
m_dOptions15 = {};
}
#endif
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 608)
if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS16, &m_dOptions16, sizeof(m_dOptions16))))
{
m_dOptions16 = {};
}
#endif
// Initialize per-node feature support data structures
const UINT uNodeCount = m_pDevice->GetNodeCount();
m_dProtectedResourceSessionSupport.resize(uNodeCount);
m_dArchitecture1.resize(uNodeCount);
m_dSerialization.resize(uNodeCount);
m_dProtectedResourceSessionTypeCount.resize(uNodeCount);
m_dProtectedResourceSessionTypes.resize(uNodeCount);
for (UINT NodeIndex = 0; NodeIndex < uNodeCount; NodeIndex++)
{
m_dProtectedResourceSessionSupport[NodeIndex].NodeIndex = NodeIndex;
if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_PROTECTED_RESOURCE_SESSION_SUPPORT, &m_dProtectedResourceSessionSupport[NodeIndex], sizeof(m_dProtectedResourceSessionSupport[NodeIndex]))))
{
m_dProtectedResourceSessionSupport[NodeIndex].Support = D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAG_NONE;
}
m_dArchitecture1[NodeIndex].NodeIndex = NodeIndex;
if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_ARCHITECTURE1, &m_dArchitecture1[NodeIndex], sizeof(m_dArchitecture1[NodeIndex]))))
{
D3D12_FEATURE_DATA_ARCHITECTURE dArchLocal = {};
dArchLocal.NodeIndex = NodeIndex;
if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_ARCHITECTURE, &dArchLocal, sizeof(dArchLocal))))
{
dArchLocal.TileBasedRenderer = false;
dArchLocal.UMA = false;
dArchLocal.CacheCoherentUMA = false;
}
m_dArchitecture1[NodeIndex].TileBasedRenderer = dArchLocal.TileBasedRenderer;
m_dArchitecture1[NodeIndex].UMA = dArchLocal.UMA;
m_dArchitecture1[NodeIndex].CacheCoherentUMA = dArchLocal.CacheCoherentUMA;
m_dArchitecture1[NodeIndex].IsolatedMMU = false;
}
m_dSerialization[NodeIndex].NodeIndex = NodeIndex;
if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_SERIALIZATION, &m_dSerialization[NodeIndex], sizeof(m_dSerialization[NodeIndex]))))
{
m_dSerialization[NodeIndex].HeapSerializationTier = D3D12_HEAP_SERIALIZATION_TIER_0;
}
m_dProtectedResourceSessionTypeCount[NodeIndex].NodeIndex = NodeIndex;
if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_PROTECTED_RESOURCE_SESSION_TYPE_COUNT, &m_dProtectedResourceSessionTypeCount[NodeIndex], sizeof(m_dProtectedResourceSessionTypeCount[NodeIndex]))))
{
m_dProtectedResourceSessionTypeCount[NodeIndex].Count = 0;
}
// Special procedure to initialize local protected resource session types structs
// Must wait until session type count initialized
QueryProtectedResourceSessionTypes(NodeIndex, m_dProtectedResourceSessionTypeCount[NodeIndex].Count);
}
// Initialize features that requires highest version check
if (FAILED(m_hStatus = QueryHighestShaderModel()))
{
return m_hStatus;
}
if (FAILED(m_hStatus = QueryHighestRootSignatureVersion()))
{
return m_hStatus;
}
// Initialize Feature Levels data
if (FAILED(m_hStatus = QueryHighestFeatureLevel()))
{
return m_hStatus;
}
return m_hStatus;
}
// 0: D3D12_OPTIONS
FEATURE_SUPPORT_GET(BOOL, m_dOptions, DoublePrecisionFloatShaderOps);
FEATURE_SUPPORT_GET(BOOL, m_dOptions, OutputMergerLogicOp);
FEATURE_SUPPORT_GET(D3D12_SHADER_MIN_PRECISION_SUPPORT, m_dOptions, MinPrecisionSupport);
FEATURE_SUPPORT_GET(D3D12_TILED_RESOURCES_TIER, m_dOptions, TiledResourcesTier);
FEATURE_SUPPORT_GET(D3D12_RESOURCE_BINDING_TIER, m_dOptions, ResourceBindingTier);
FEATURE_SUPPORT_GET(BOOL, m_dOptions, PSSpecifiedStencilRefSupported);
FEATURE_SUPPORT_GET(BOOL, m_dOptions, TypedUAVLoadAdditionalFormats);
FEATURE_SUPPORT_GET(BOOL, m_dOptions, ROVsSupported);
FEATURE_SUPPORT_GET(D3D12_CONSERVATIVE_RASTERIZATION_TIER, m_dOptions, ConservativeRasterizationTier);
FEATURE_SUPPORT_GET(BOOL, m_dOptions, StandardSwizzle64KBSupported);
FEATURE_SUPPORT_GET(BOOL, m_dOptions, CrossAdapterRowMajorTextureSupported);
FEATURE_SUPPORT_GET(BOOL, m_dOptions, VPAndRTArrayIndexFromAnyShaderFeedingRasterizerSupportedWithoutGSEmulation);
FEATURE_SUPPORT_GET(D3D12_RESOURCE_HEAP_TIER, m_dOptions, ResourceHeapTier);
// Special procedure for handling caps that is also part of other features
inline D3D12_CROSS_NODE_SHARING_TIER CD3DX12FeatureSupport::CrossNodeSharingTier() const noexcept
{
if (m_dCrossNode.SharingTier > D3D12_CROSS_NODE_SHARING_TIER_NOT_SUPPORTED)
{
return m_dCrossNode.SharingTier;
}
else
{
return m_dOptions.CrossNodeSharingTier;
}
}
inline UINT CD3DX12FeatureSupport::MaxGPUVirtualAddressBitsPerResource() const noexcept
{
if (m_dOptions.MaxGPUVirtualAddressBitsPerResource > 0)
{
return m_dOptions.MaxGPUVirtualAddressBitsPerResource;
}
else
{
return m_dGPUVASupport.MaxGPUVirtualAddressBitsPerResource;
}
}
// 1: Architecture
// Combined with Architecture1
// 2: Feature Levels
// Simply returns the highest supported feature level
inline D3D_FEATURE_LEVEL CD3DX12FeatureSupport::MaxSupportedFeatureLevel() const noexcept
{
return m_eMaxFeatureLevel;
}
// 3: Feature Format Support
inline HRESULT CD3DX12FeatureSupport::FormatSupport(DXGI_FORMAT Format, D3D12_FORMAT_SUPPORT1& Support1, D3D12_FORMAT_SUPPORT2& Support2) const
{
D3D12_FEATURE_DATA_FORMAT_SUPPORT dFormatSupport;
dFormatSupport.Format = Format;
// It is possible that the function call returns an error
HRESULT result = m_pDevice->CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT, &dFormatSupport, sizeof(D3D12_FEATURE_DATA_FORMAT_SUPPORT));
Support1 = dFormatSupport.Support1;
Support2 = dFormatSupport.Support2; // Two outputs. Probably better just to take in the struct as an argument?
return result;
}
// 4: Multisample Quality Levels
inline HRESULT CD3DX12FeatureSupport::MultisampleQualityLevels(DXGI_FORMAT Format, UINT SampleCount, D3D12_MULTISAMPLE_QUALITY_LEVEL_FLAGS Flags, UINT& NumQualityLevels) const
{
D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS dMultisampleQualityLevels;
dMultisampleQualityLevels.Format = Format;
dMultisampleQualityLevels.SampleCount = SampleCount;
dMultisampleQualityLevels.Flags = Flags;
HRESULT result = m_pDevice->CheckFeatureSupport(D3D12_FEATURE_MULTISAMPLE_QUALITY_LEVELS, &dMultisampleQualityLevels, sizeof(D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS));
if (SUCCEEDED(result))
{
NumQualityLevels = dMultisampleQualityLevels.NumQualityLevels;
}
else
{
NumQualityLevels = 0;
}
return result;
}
// 5: Format Info
inline HRESULT CD3DX12FeatureSupport::FormatInfo(DXGI_FORMAT Format, UINT8& PlaneCount) const
{
D3D12_FEATURE_DATA_FORMAT_INFO dFormatInfo;
dFormatInfo.Format = Format;
HRESULT result = m_pDevice->CheckFeatureSupport(D3D12_FEATURE_FORMAT_INFO, &dFormatInfo, sizeof(D3D12_FEATURE_DATA_FORMAT_INFO));
if (FAILED(result))
{
PlaneCount = 0;
}
else
{
PlaneCount = dFormatInfo.PlaneCount;
}
return result;
}
// 6: GPU Virtual Address Support
// MaxGPUVirtualAddressBitsPerResource handled in D3D12Options
FEATURE_SUPPORT_GET(UINT, m_dGPUVASupport, MaxGPUVirtualAddressBitsPerProcess);
// 7: Shader Model
inline D3D_SHADER_MODEL CD3DX12FeatureSupport::HighestShaderModel() const noexcept
{
return m_dShaderModel.HighestShaderModel;
}
// 8: D3D12 Options1
FEATURE_SUPPORT_GET(BOOL, m_dOptions1, WaveOps);
FEATURE_SUPPORT_GET(UINT, m_dOptions1, WaveLaneCountMin);
FEATURE_SUPPORT_GET(UINT, m_dOptions1, WaveLaneCountMax);
FEATURE_SUPPORT_GET(UINT, m_dOptions1, TotalLaneCount);
FEATURE_SUPPORT_GET(BOOL, m_dOptions1, ExpandedComputeResourceStates);
FEATURE_SUPPORT_GET(BOOL, m_dOptions1, Int64ShaderOps);
// 10: Protected Resource Session Support
inline D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAGS CD3DX12FeatureSupport::ProtectedResourceSessionSupport(UINT NodeIndex) const
{
return m_dProtectedResourceSessionSupport[NodeIndex].Support;
}
// 12: Root Signature
inline D3D_ROOT_SIGNATURE_VERSION CD3DX12FeatureSupport::HighestRootSignatureVersion() const noexcept
{
return m_dRootSignature.HighestVersion;
}
// 16: Architecture1
// Same data fields can be queried from m_dArchitecture
FEATURE_SUPPORT_GET_NODE_INDEXED(BOOL, m_dArchitecture1, TileBasedRenderer);
FEATURE_SUPPORT_GET_NODE_INDEXED(BOOL, m_dArchitecture1, UMA);
FEATURE_SUPPORT_GET_NODE_INDEXED(BOOL, m_dArchitecture1, CacheCoherentUMA);
FEATURE_SUPPORT_GET_NODE_INDEXED(BOOL, m_dArchitecture1, IsolatedMMU);
// 18: D3D12 Options2
FEATURE_SUPPORT_GET(BOOL, m_dOptions2, DepthBoundsTestSupported);
FEATURE_SUPPORT_GET(D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER, m_dOptions2, ProgrammableSamplePositionsTier);
// 19: Shader Cache
FEATURE_SUPPORT_GET_NAME(D3D12_SHADER_CACHE_SUPPORT_FLAGS, m_dShaderCache, SupportFlags, ShaderCacheSupportFlags);
// 20: Command Queue Priority
inline BOOL CD3DX12FeatureSupport::CommandQueuePrioritySupported(D3D12_COMMAND_LIST_TYPE CommandListType, UINT Priority)
{
m_dCommandQueuePriority.CommandListType = CommandListType;
m_dCommandQueuePriority.Priority = Priority;
if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_COMMAND_QUEUE_PRIORITY, &m_dCommandQueuePriority, sizeof(D3D12_FEATURE_DATA_COMMAND_QUEUE_PRIORITY))))
{
return false;
}
return m_dCommandQueuePriority.PriorityForTypeIsSupported;
}
// 21: D3D12 Options3
FEATURE_SUPPORT_GET(BOOL, m_dOptions3, CopyQueueTimestampQueriesSupported);
FEATURE_SUPPORT_GET(BOOL, m_dOptions3, CastingFullyTypedFormatSupported);
FEATURE_SUPPORT_GET(D3D12_COMMAND_LIST_SUPPORT_FLAGS, m_dOptions3, WriteBufferImmediateSupportFlags);
FEATURE_SUPPORT_GET(D3D12_VIEW_INSTANCING_TIER, m_dOptions3, ViewInstancingTier);
FEATURE_SUPPORT_GET(BOOL, m_dOptions3, BarycentricsSupported);
// 22: Existing Heaps
FEATURE_SUPPORT_GET_NAME(BOOL, m_dExistingHeaps, Supported, ExistingHeapsSupported);
// 23: D3D12 Options4
FEATURE_SUPPORT_GET(BOOL, m_dOptions4, MSAA64KBAlignedTextureSupported);
FEATURE_SUPPORT_GET(D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER, m_dOptions4, SharedResourceCompatibilityTier);
FEATURE_SUPPORT_GET(BOOL, m_dOptions4, Native16BitShaderOpsSupported);
// 24: Serialization
FEATURE_SUPPORT_GET_NODE_INDEXED(D3D12_HEAP_SERIALIZATION_TIER, m_dSerialization, HeapSerializationTier);
// 25: Cross Node
// CrossNodeSharingTier handled in D3D12Options
FEATURE_SUPPORT_GET_NAME(BOOL, m_dCrossNode, AtomicShaderInstructions, CrossNodeAtomicShaderInstructions);
// 27: D3D12 Options5
FEATURE_SUPPORT_GET(BOOL, m_dOptions5, SRVOnlyTiledResourceTier3);
FEATURE_SUPPORT_GET(D3D12_RENDER_PASS_TIER, m_dOptions5, RenderPassesTier);
FEATURE_SUPPORT_GET(D3D12_RAYTRACING_TIER, m_dOptions5, RaytracingTier);
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 4)
// 28: Displayable
FEATURE_SUPPORT_GET(BOOL, m_dDisplayable, DisplayableTexture);
// SharedResourceCompatibilityTier handled in D3D12Options4
#endif
// 30: D3D12 Options6
FEATURE_SUPPORT_GET(BOOL, m_dOptions6, AdditionalShadingRatesSupported);
FEATURE_SUPPORT_GET(BOOL, m_dOptions6, PerPrimitiveShadingRateSupportedWithViewportIndexing);
FEATURE_SUPPORT_GET(D3D12_VARIABLE_SHADING_RATE_TIER, m_dOptions6, VariableShadingRateTier);
FEATURE_SUPPORT_GET(UINT, m_dOptions6, ShadingRateImageTileSize);
FEATURE_SUPPORT_GET(BOOL, m_dOptions6, BackgroundProcessingSupported);
// 31: Query Meta Command
// Keep the original call routine
inline HRESULT CD3DX12FeatureSupport::QueryMetaCommand(D3D12_FEATURE_DATA_QUERY_META_COMMAND& dQueryMetaCommand) const
{
return m_pDevice->CheckFeatureSupport(D3D12_FEATURE_QUERY_META_COMMAND, &dQueryMetaCommand, sizeof(D3D12_FEATURE_DATA_QUERY_META_COMMAND));
}
// 32: D3D12 Options7
FEATURE_SUPPORT_GET(D3D12_MESH_SHADER_TIER, m_dOptions7, MeshShaderTier);
FEATURE_SUPPORT_GET(D3D12_SAMPLER_FEEDBACK_TIER, m_dOptions7, SamplerFeedbackTier);
// 33: Protected Resource Session Type Count
FEATURE_SUPPORT_GET_NODE_INDEXED_NAME(UINT, m_dProtectedResourceSessionTypeCount, Count, ProtectedResourceSessionTypeCount);
// 34: Protected Resource Session Types
FEATURE_SUPPORT_GET_NODE_INDEXED_NAME(std::vector<GUID>, m_dProtectedResourceSessionTypes, TypeVec, ProtectedResourceSessionTypes);
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 3)
// 36: Options8
FEATURE_SUPPORT_GET(BOOL, m_dOptions8, UnalignedBlockTexturesSupported);
// 37: Options9
FEATURE_SUPPORT_GET(BOOL, m_dOptions9, MeshShaderPipelineStatsSupported);
FEATURE_SUPPORT_GET(BOOL, m_dOptions9, MeshShaderSupportsFullRangeRenderTargetArrayIndex);
FEATURE_SUPPORT_GET(BOOL, m_dOptions9, AtomicInt64OnTypedResourceSupported);
FEATURE_SUPPORT_GET(BOOL, m_dOptions9, AtomicInt64OnGroupSharedSupported);
FEATURE_SUPPORT_GET(BOOL, m_dOptions9, DerivativesInMeshAndAmplificationShadersSupported);
FEATURE_SUPPORT_GET(D3D12_WAVE_MMA_TIER, m_dOptions9, WaveMMATier);
#endif
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 4)
// 39: Options10
FEATURE_SUPPORT_GET(BOOL, m_dOptions10, VariableRateShadingSumCombinerSupported);
FEATURE_SUPPORT_GET(BOOL, m_dOptions10, MeshShaderPerPrimitiveShadingRateSupported);
// 40: Options11
FEATURE_SUPPORT_GET(BOOL, m_dOptions11, AtomicInt64OnDescriptorHeapResourceSupported);
#endif
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 600)
// 41: Options12
FEATURE_SUPPORT_GET(D3D12_TRI_STATE, m_dOptions12, MSPrimitivesPipelineStatisticIncludesCulledPrimitives);
FEATURE_SUPPORT_GET(BOOL, m_dOptions12, EnhancedBarriersSupported);
FEATURE_SUPPORT_GET(BOOL, m_dOptions12, RelaxedFormatCastingSupported);
#endif
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 602)
// 42: Options13
FEATURE_SUPPORT_GET(BOOL, m_dOptions13, UnrestrictedBufferTextureCopyPitchSupported);
FEATURE_SUPPORT_GET(BOOL, m_dOptions13, UnrestrictedVertexElementAlignmentSupported);
FEATURE_SUPPORT_GET(BOOL, m_dOptions13, InvertedViewportHeightFlipsYSupported);
FEATURE_SUPPORT_GET(BOOL, m_dOptions13, InvertedViewportDepthFlipsZSupported);
FEATURE_SUPPORT_GET(BOOL, m_dOptions13, TextureCopyBetweenDimensionsSupported);
FEATURE_SUPPORT_GET(BOOL, m_dOptions13, AlphaBlendFactorSupported);
#endif
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 606)
// 43: Options14
FEATURE_SUPPORT_GET(BOOL, m_dOptions14, AdvancedTextureOpsSupported);
FEATURE_SUPPORT_GET(BOOL, m_dOptions14, WriteableMSAATexturesSupported);
FEATURE_SUPPORT_GET(BOOL, m_dOptions14, IndependentFrontAndBackStencilRefMaskSupported);
// 44: Options15
FEATURE_SUPPORT_GET(BOOL, m_dOptions15, TriangleFanSupported);
FEATURE_SUPPORT_GET(BOOL, m_dOptions15, DynamicIndexBufferStripCutSupported);
#endif
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 608)
// 45: Options16
FEATURE_SUPPORT_GET(BOOL, m_dOptions16, DynamicDepthBiasSupported);
#endif
// Helper function to decide the highest shader model supported by the system
// Stores the result in m_dShaderModel
// Must be updated whenever a new shader model is added to the d3d12.h header
inline HRESULT CD3DX12FeatureSupport::QueryHighestShaderModel()
{
// Check support in descending order
HRESULT result;
const D3D_SHADER_MODEL allModelVersions[] =
{
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 606)
D3D_SHADER_MODEL_6_8,
#endif
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 3)
D3D_SHADER_MODEL_6_7,
#endif
D3D_SHADER_MODEL_6_6,
D3D_SHADER_MODEL_6_5,
D3D_SHADER_MODEL_6_4,
D3D_SHADER_MODEL_6_3,
D3D_SHADER_MODEL_6_2,
D3D_SHADER_MODEL_6_1,
D3D_SHADER_MODEL_6_0,
D3D_SHADER_MODEL_5_1
};
constexpr size_t numModelVersions = sizeof(allModelVersions) / sizeof(D3D_SHADER_MODEL);
for (size_t i = 0; i < numModelVersions; i++)
{
m_dShaderModel.HighestShaderModel = allModelVersions[i];
result = m_pDevice->CheckFeatureSupport(D3D12_FEATURE_SHADER_MODEL, &m_dShaderModel, sizeof(D3D12_FEATURE_DATA_SHADER_MODEL));
if (result != E_INVALIDARG)
{
// Indicates that the version is recognizable by the runtime and stored in the struct
// Also terminate on unexpected error code
if (FAILED(result))
{
m_dShaderModel.HighestShaderModel = static_cast<D3D_SHADER_MODEL>(0);
}
return result;
}
}
// Shader model may not be supported. Continue the rest initializations
m_dShaderModel.HighestShaderModel = static_cast<D3D_SHADER_MODEL>(0);
return S_OK;
}
// Helper function to decide the highest root signature supported
// Must be updated whenever a new root signature version is added to the d3d12.h header
inline HRESULT CD3DX12FeatureSupport::QueryHighestRootSignatureVersion()
{
HRESULT result;
const D3D_ROOT_SIGNATURE_VERSION allRootSignatureVersions[] =
{
D3D_ROOT_SIGNATURE_VERSION_1_1,
D3D_ROOT_SIGNATURE_VERSION_1_0,
D3D_ROOT_SIGNATURE_VERSION_1,
};
constexpr size_t numRootSignatureVersions = sizeof(allRootSignatureVersions) / sizeof(D3D_ROOT_SIGNATURE_VERSION);
for (size_t i = 0; i < numRootSignatureVersions; i++)
{
m_dRootSignature.HighestVersion = allRootSignatureVersions[i];
result = m_pDevice->CheckFeatureSupport(D3D12_FEATURE_ROOT_SIGNATURE, &m_dRootSignature, sizeof(D3D12_FEATURE_DATA_ROOT_SIGNATURE));
if (result != E_INVALIDARG)
{
if (FAILED(result))
{
m_dRootSignature.HighestVersion = static_cast<D3D_ROOT_SIGNATURE_VERSION>(0);
}
// If succeeded, the highest version is already written into the member struct
return result;
}
}
// No version left. Set to invalid value and continue.
m_dRootSignature.HighestVersion = static_cast<D3D_ROOT_SIGNATURE_VERSION>(0);
return S_OK;
}
// Helper funcion to decide the highest feature level
inline HRESULT CD3DX12FeatureSupport::QueryHighestFeatureLevel()
{
HRESULT result;
// Check against a list of all feature levels present in d3dcommon.h
// Needs to be updated for future feature levels
const D3D_FEATURE_LEVEL allLevels[] =
{
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 3)
D3D_FEATURE_LEVEL_12_2,
#endif
D3D_FEATURE_LEVEL_12_1,
D3D_FEATURE_LEVEL_12_0,
D3D_FEATURE_LEVEL_11_1,
D3D_FEATURE_LEVEL_11_0,
D3D_FEATURE_LEVEL_10_1,
D3D_FEATURE_LEVEL_10_0,
D3D_FEATURE_LEVEL_9_3,
D3D_FEATURE_LEVEL_9_2,
D3D_FEATURE_LEVEL_9_1,
D3D_FEATURE_LEVEL_1_0_CORE
};
D3D12_FEATURE_DATA_FEATURE_LEVELS dFeatureLevel;
dFeatureLevel.NumFeatureLevels = static_cast<UINT>(sizeof(allLevels) / sizeof(D3D_FEATURE_LEVEL));
dFeatureLevel.pFeatureLevelsRequested = allLevels;
result = m_pDevice->CheckFeatureSupport(D3D12_FEATURE_FEATURE_LEVELS, &dFeatureLevel, sizeof(D3D12_FEATURE_DATA_FEATURE_LEVELS));
if (SUCCEEDED(result))
{
m_eMaxFeatureLevel = dFeatureLevel.MaxSupportedFeatureLevel;
}
else
{
m_eMaxFeatureLevel = static_cast<D3D_FEATURE_LEVEL>(0);
if (result == DXGI_ERROR_UNSUPPORTED)
{
// Indicates that none supported. Continue initialization
result = S_OK;
}
}
return result;
}
// Helper function to initialize local protected resource session types structs
inline HRESULT CD3DX12FeatureSupport::QueryProtectedResourceSessionTypes(UINT NodeIndex, UINT Count)
{
auto& CurrentPRSTypes = m_dProtectedResourceSessionTypes[NodeIndex];
CurrentPRSTypes.NodeIndex = NodeIndex;
CurrentPRSTypes.Count = Count;
CurrentPRSTypes.TypeVec.resize(CurrentPRSTypes.Count);
CurrentPRSTypes.pTypes = CurrentPRSTypes.TypeVec.data();
HRESULT result = m_pDevice->CheckFeatureSupport(D3D12_FEATURE_PROTECTED_RESOURCE_SESSION_TYPES, &m_dProtectedResourceSessionTypes[NodeIndex], sizeof(D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_TYPES));
if (FAILED(result))
{
// Resize TypeVec to empty
CurrentPRSTypes.TypeVec.clear();
}
return result;
}
#undef FEATURE_SUPPORT_GET
#undef FEATURE_SUPPORT_GET_NAME
#undef FEATURE_SUPPORT_GET_NODE_INDEXED
#undef FEATURE_SUPPORT_GET_NODE_INDEXED_NAME
// end CD3DX12FeatureSupport

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,12 @@
//*********************************************************
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License (MIT).
//
//*********************************************************
#pragma once
struct CD3DX12_DEFAULT {};
extern const DECLSPEC_SELECTANY CD3DX12_DEFAULT D3D12_DEFAULT;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,123 @@
//*********************************************************
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License (MIT).
//
//*********************************************************
#ifndef __D3D12_PROPERTY_LAYOUT_FORMAT_TABLE_H__
#define __D3D12_PROPERTY_LAYOUT_FORMAT_TABLE_H__
#include "d3d12.h"
#define MAP_ALIGN_REQUIREMENT 16 // Map is required to return 16-byte aligned addresses
struct D3D12_PROPERTY_LAYOUT_FORMAT_TABLE
{
public:
// ----------------------------------------------------------------------------
// Information describing everything about a D3D Resource Format
// ----------------------------------------------------------------------------
typedef struct FORMAT_DETAIL
{
DXGI_FORMAT DXGIFormat;
DXGI_FORMAT ParentFormat;
const DXGI_FORMAT* pDefaultFormatCastSet; // This is dependent on FL/driver version, but is here to save a lot of space
UINT8 BitsPerComponent[4]; // only used for D3DFTL_PARTIAL_TYPE or FULL_TYPE
UINT8 BitsPerUnit;
BYTE SRGBFormat : 1;
UINT WidthAlignment : 4; // number of texels to align to in a mip level.
UINT HeightAlignment : 4; // Top level dimensions must be a multiple of these
UINT DepthAlignment : 1; // values.
D3D_FORMAT_LAYOUT Layout : 1;
D3D_FORMAT_TYPE_LEVEL TypeLevel : 2;
D3D_FORMAT_COMPONENT_NAME ComponentName0 : 3; // RED ... only used for D3DFTL_PARTIAL_TYPE or FULL_TYPE
D3D_FORMAT_COMPONENT_NAME ComponentName1 : 3; // GREEN ... only used for D3DFTL_PARTIAL_TYPE or FULL_TYPE
D3D_FORMAT_COMPONENT_NAME ComponentName2 : 3; // BLUE ... only used for D3DFTL_PARTIAL_TYPE or FULL_TYPE
D3D_FORMAT_COMPONENT_NAME ComponentName3 : 3; // ALPHA ... only used for D3DFTL_PARTIAL_TYPE or FULL_TYPE
D3D_FORMAT_COMPONENT_INTERPRETATION ComponentInterpretation0 : 3; // only used for D3DFTL_FULL_TYPE
D3D_FORMAT_COMPONENT_INTERPRETATION ComponentInterpretation1 : 3; // only used for D3DFTL_FULL_TYPE
D3D_FORMAT_COMPONENT_INTERPRETATION ComponentInterpretation2 : 3; // only used for D3DFTL_FULL_TYPE
D3D_FORMAT_COMPONENT_INTERPRETATION ComponentInterpretation3 : 3; // only used for D3DFTL_FULL_TYPE
bool bDX9VertexOrIndexFormat : 1;
bool bDX9TextureFormat : 1;
bool bFloatNormFormat : 1;
bool bPlanar : 1;
bool bYUV : 1;
bool bDependantFormatCastSet : 1; // This indicates that the format cast set is dependent on FL/driver version
bool bInternal : 1;
} FORMAT_DETAIL;
private:
static const FORMAT_DETAIL s_FormatDetail[];
static const UINT s_NumFormats;
static const LPCSTR s_FormatNames[]; // separate from above structure so it can be compiled out of runtime.
public:
static UINT GetNumFormats();
static const FORMAT_DETAIL* GetFormatTable();
static D3D_FEATURE_LEVEL GetHighestDefinedFeatureLevel();
static DXGI_FORMAT GetFormat (SIZE_T Index);
static bool FormatExists (DXGI_FORMAT Format);
static bool FormatExistsInHeader (DXGI_FORMAT Format, bool bExternalHeader = true);
static UINT GetByteAlignment (DXGI_FORMAT Format);
static bool IsBlockCompressFormat (DXGI_FORMAT Format);
static LPCSTR GetName (DXGI_FORMAT Format, bool bHideInternalFormats = true);
static bool IsSRGBFormat (DXGI_FORMAT Format);
static UINT GetBitsPerStencil (DXGI_FORMAT Format);
static void GetFormatReturnTypes (DXGI_FORMAT Format, D3D_FORMAT_COMPONENT_INTERPRETATION* pInterpretations); // return array of 4 components
static UINT GetNumComponentsInFormat(DXGI_FORMAT Format);
// Converts the sequential component index (range from 0 to GetNumComponentsInFormat()) to
// the absolute component index (range 0 to 3).
static UINT Sequential2AbsoluteComponentIndex (DXGI_FORMAT Format, UINT SequentialComponentIndex);
static bool CanBeCastEvenFullyTyped (DXGI_FORMAT Format, D3D_FEATURE_LEVEL fl);
static UINT8 GetAddressingBitsPerAlignedSize (DXGI_FORMAT Format);
static DXGI_FORMAT GetParentFormat (DXGI_FORMAT Format);
static const DXGI_FORMAT* GetFormatCastSet (DXGI_FORMAT Format);
static D3D_FORMAT_LAYOUT GetLayout (DXGI_FORMAT Format);
static D3D_FORMAT_TYPE_LEVEL GetTypeLevel (DXGI_FORMAT Format);
static UINT GetBitsPerUnit (DXGI_FORMAT Format);
static UINT GetBitsPerUnitThrow (DXGI_FORMAT Format);
static UINT GetBitsPerElement (DXGI_FORMAT Format); // Legacy function used to support D3D10on9 only. Do not use.
static UINT GetWidthAlignment (DXGI_FORMAT Format);
static UINT GetHeightAlignment (DXGI_FORMAT Format);
static UINT GetDepthAlignment (DXGI_FORMAT Format);
static BOOL Planar (DXGI_FORMAT Format);
static BOOL NonOpaquePlanar (DXGI_FORMAT Format);
static BOOL YUV (DXGI_FORMAT Format);
static BOOL Opaque (DXGI_FORMAT Format);
static bool FamilySupportsStencil (DXGI_FORMAT Format);
static UINT NonOpaquePlaneCount (DXGI_FORMAT Format);
static BOOL DX9VertexOrIndexFormat (DXGI_FORMAT Format);
static BOOL DX9TextureFormat (DXGI_FORMAT Format);
static BOOL FloatNormTextureFormat (DXGI_FORMAT Format);
static bool DepthOnlyFormat (DXGI_FORMAT format);
static UINT8 GetPlaneCount (DXGI_FORMAT Format);
static bool MotionEstimatorAllowedInputFormat (DXGI_FORMAT Format);
static bool SupportsSamplerFeedback (DXGI_FORMAT Format);
static bool DecodeHistogramAllowedForOutputFormatSupport(DXGI_FORMAT Format);
static UINT8 GetPlaneSliceFromViewFormat (DXGI_FORMAT ResourceFormat, DXGI_FORMAT ViewFormat);
static bool FloatAndNotFloatFormats (DXGI_FORMAT FormatA, DXGI_FORMAT FormatB);
static bool SNORMAndUNORMFormats (DXGI_FORMAT FormatA, DXGI_FORMAT FormatB);
static bool ValidCastToR32UAV (DXGI_FORMAT from, DXGI_FORMAT to);
static bool IsSupportedTextureDisplayableFormat (DXGI_FORMAT, bool bMediaFormatOnly);
static D3D_FORMAT_COMPONENT_INTERPRETATION GetFormatComponentInterpretation (DXGI_FORMAT Format, UINT AbsoluteComponentIndex);
static UINT GetBitsPerComponent (DXGI_FORMAT Format, UINT AbsoluteComponentIndex);
static D3D_FORMAT_COMPONENT_NAME GetComponentName (DXGI_FORMAT Format, UINT AbsoluteComponentIndex);
static HRESULT CalculateExtraPlanarRows (DXGI_FORMAT format, UINT plane0Height, _Out_ UINT& totalHeight);
static HRESULT CalculateMinimumRowMajorRowPitch (DXGI_FORMAT Format, UINT Width, _Out_ UINT& RowPitch);
static HRESULT CalculateMinimumRowMajorSlicePitch (DXGI_FORMAT Format, UINT ContextBasedRowPitch, UINT Height, _Out_ UINT& SlicePitch);
static void GetYCbCrChromaSubsampling (DXGI_FORMAT Format, _Out_ UINT& HorizontalSubsampling, _Out_ UINT& VerticalSubsampling);
static HRESULT CalculateResourceSize (UINT width, UINT height, UINT depth, DXGI_FORMAT format, UINT mipLevels, UINT subresources, _Out_ SIZE_T& totalByteSize, _Out_writes_opt_(subresources) D3D12_MEMCPY_DEST* pDst = nullptr);
static void GetTileShape (D3D12_TILE_SHAPE* pTileShape, DXGI_FORMAT Format, D3D12_RESOURCE_DIMENSION Dimension, UINT SampleCount);
static void Get4KTileShape (D3D12_TILE_SHAPE* pTileShape, DXGI_FORMAT Format, D3D12_RESOURCE_DIMENSION Dimension, UINT SampleCount);
static void GetMipDimensions (UINT8 mipSlice, _Inout_ UINT64* pWidth, _Inout_opt_ UINT64* pHeight = nullptr, _Inout_opt_ UINT64* pDepth = nullptr);
static void GetPlaneSubsampledSizeAndFormatForCopyableLayout(UINT PlaneSlice, DXGI_FORMAT Format, UINT Width, UINT Height, _Out_ DXGI_FORMAT& PlaneFormat, _Out_ UINT& MinPlanePitchWidth, _Out_ UINT& PlaneWidth, _Out_ UINT& PlaneHeight);
static UINT GetDetailTableIndex (DXGI_FORMAT Format);
static UINT GetDetailTableIndexNoThrow (DXGI_FORMAT Format);
static UINT GetDetailTableIndexThrow (DXGI_FORMAT Format);
private:
static const FORMAT_DETAIL* GetFormatDetail (DXGI_FORMAT Format);
};
#endif

View File

@ -0,0 +1,57 @@
//*********************************************************
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License (MIT).
//
//*********************************************************
#pragma once
#ifndef __cplusplus
#error D3DX12 requires C++
#endif
#include "d3d12.h"
inline bool operator==( const D3D12_RENDER_PASS_BEGINNING_ACCESS_CLEAR_PARAMETERS &a, const D3D12_RENDER_PASS_BEGINNING_ACCESS_CLEAR_PARAMETERS &b) noexcept
{
return a.ClearValue == b.ClearValue;
}
inline bool operator==( const D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_PARAMETERS &a, const D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_PARAMETERS &b) noexcept
{
if (a.pSrcResource != b.pSrcResource) return false;
if (a.pDstResource != b.pDstResource) return false;
if (a.SubresourceCount != b.SubresourceCount) return false;
if (a.Format != b.Format) return false;
if (a.ResolveMode != b.ResolveMode) return false;
if (a.PreserveResolveSource != b.PreserveResolveSource) return false;
return true;
}
inline bool operator==( const D3D12_RENDER_PASS_BEGINNING_ACCESS &a, const D3D12_RENDER_PASS_BEGINNING_ACCESS &b) noexcept
{
if (a.Type != b.Type) return false;
if (a.Type == D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_CLEAR && !(a.Clear == b.Clear)) return false;
return true;
}
inline bool operator==( const D3D12_RENDER_PASS_ENDING_ACCESS &a, const D3D12_RENDER_PASS_ENDING_ACCESS &b) noexcept
{
if (a.Type != b.Type) return false;
if (a.Type == D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_RESOLVE && !(a.Resolve == b.Resolve)) return false;
return true;
}
inline bool operator==( const D3D12_RENDER_PASS_RENDER_TARGET_DESC &a, const D3D12_RENDER_PASS_RENDER_TARGET_DESC &b) noexcept
{
if (a.cpuDescriptor.ptr != b.cpuDescriptor.ptr) return false;
if (!(a.BeginningAccess == b.BeginningAccess)) return false;
if (!(a.EndingAccess == b.EndingAccess)) return false;
return true;
}
inline bool operator==( const D3D12_RENDER_PASS_DEPTH_STENCIL_DESC &a, const D3D12_RENDER_PASS_DEPTH_STENCIL_DESC &b) noexcept
{
if (a.cpuDescriptor.ptr != b.cpuDescriptor.ptr) return false;
if (!(a.DepthBeginningAccess == b.DepthBeginningAccess)) return false;
if (!(a.StencilBeginningAccess == b.StencilBeginningAccess)) return false;
if (!(a.DepthEndingAccess == b.DepthEndingAccess)) return false;
if (!(a.StencilEndingAccess == b.StencilEndingAccess)) return false;
return true;
}

View File

@ -0,0 +1,599 @@
//*********************************************************
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License (MIT).
//
//*********************************************************
#pragma once
#ifndef __cplusplus
#error D3DX12 requires C++
#endif
#include "d3d12.h"
#include "d3dx12_core.h"
#include "d3dx12_property_format_table.h"
//------------------------------------------------------------------------------------------------
template <typename T, typename U, typename V>
inline void D3D12DecomposeSubresource( UINT Subresource, UINT MipLevels, UINT ArraySize, _Out_ T& MipSlice, _Out_ U& ArraySlice, _Out_ V& PlaneSlice ) noexcept
{
MipSlice = static_cast<T>(Subresource % MipLevels);
ArraySlice = static_cast<U>((Subresource / MipLevels) % ArraySize);
PlaneSlice = static_cast<V>(Subresource / (MipLevels * ArraySize));
}
//------------------------------------------------------------------------------------------------
// Row-by-row memcpy
inline void MemcpySubresource(
_In_ const D3D12_MEMCPY_DEST* pDest,
_In_ const D3D12_SUBRESOURCE_DATA* pSrc,
SIZE_T RowSizeInBytes,
UINT NumRows,
UINT NumSlices) noexcept
{
for (UINT z = 0; z < NumSlices; ++z)
{
auto pDestSlice = static_cast<BYTE*>(pDest->pData) + pDest->SlicePitch * z;
auto pSrcSlice = static_cast<const BYTE*>(pSrc->pData) + pSrc->SlicePitch * LONG_PTR(z);
for (UINT y = 0; y < NumRows; ++y)
{
memcpy(pDestSlice + pDest->RowPitch * y,
pSrcSlice + pSrc->RowPitch * LONG_PTR(y),
RowSizeInBytes);
}
}
}
//------------------------------------------------------------------------------------------------
// Row-by-row memcpy
inline void MemcpySubresource(
_In_ const D3D12_MEMCPY_DEST* pDest,
_In_ const void* pResourceData,
_In_ const D3D12_SUBRESOURCE_INFO* pSrc,
SIZE_T RowSizeInBytes,
UINT NumRows,
UINT NumSlices) noexcept
{
for (UINT z = 0; z < NumSlices; ++z)
{
auto pDestSlice = static_cast<BYTE*>(pDest->pData) + pDest->SlicePitch * z;
auto pSrcSlice = (static_cast<const BYTE*>(pResourceData) + pSrc->Offset) + pSrc->DepthPitch * ULONG_PTR(z);
for (UINT y = 0; y < NumRows; ++y)
{
memcpy(pDestSlice + pDest->RowPitch * y,
pSrcSlice + pSrc->RowPitch * ULONG_PTR(y),
RowSizeInBytes);
}
}
}
//------------------------------------------------------------------------------------------------
// Returns required size of a buffer to be used for data upload
inline UINT64 GetRequiredIntermediateSize(
_In_ ID3D12Resource* pDestinationResource,
_In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource,
_In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources) noexcept
{
#if defined(_MSC_VER) || !defined(_WIN32)
const auto Desc = pDestinationResource->GetDesc();
#else
D3D12_RESOURCE_DESC tmpDesc;
const auto& Desc = *pDestinationResource->GetDesc(&tmpDesc);
#endif
UINT64 RequiredSize = 0;
ID3D12Device* pDevice = nullptr;
pDestinationResource->GetDevice(IID_ID3D12Device, reinterpret_cast<void**>(&pDevice));
pDevice->GetCopyableFootprints(&Desc, FirstSubresource, NumSubresources, 0, nullptr, nullptr, nullptr, &RequiredSize);
pDevice->Release();
return RequiredSize;
}
//------------------------------------------------------------------------------------------------
// All arrays must be populated (e.g. by calling GetCopyableFootprints)
inline UINT64 UpdateSubresources(
_In_ ID3D12GraphicsCommandList* pCmdList,
_In_ ID3D12Resource* pDestinationResource,
_In_ ID3D12Resource* pIntermediate,
_In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource,
_In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources,
UINT64 RequiredSize,
_In_reads_(NumSubresources) const D3D12_PLACED_SUBRESOURCE_FOOTPRINT* pLayouts,
_In_reads_(NumSubresources) const UINT* pNumRows,
_In_reads_(NumSubresources) const UINT64* pRowSizesInBytes,
_In_reads_(NumSubresources) const D3D12_SUBRESOURCE_DATA* pSrcData) noexcept
{
// Minor validation
#if defined(_MSC_VER) || !defined(_WIN32)
const auto IntermediateDesc = pIntermediate->GetDesc();
const auto DestinationDesc = pDestinationResource->GetDesc();
#else
D3D12_RESOURCE_DESC tmpDesc1, tmpDesc2;
const auto& IntermediateDesc = *pIntermediate->GetDesc(&tmpDesc1);
const auto& DestinationDesc = *pDestinationResource->GetDesc(&tmpDesc2);
#endif
if (IntermediateDesc.Dimension != D3D12_RESOURCE_DIMENSION_BUFFER ||
IntermediateDesc.Width < RequiredSize + pLayouts[0].Offset ||
RequiredSize > SIZE_T(-1) ||
(DestinationDesc.Dimension == D3D12_RESOURCE_DIMENSION_BUFFER &&
(FirstSubresource != 0 || NumSubresources != 1)))
{
return 0;
}
BYTE* pData;
HRESULT hr = pIntermediate->Map(0, nullptr, reinterpret_cast<void**>(&pData));
if (FAILED(hr))
{
return 0;
}
for (UINT i = 0; i < NumSubresources; ++i)
{
if (pRowSizesInBytes[i] > SIZE_T(-1)) return 0;
D3D12_MEMCPY_DEST DestData = { pData + pLayouts[i].Offset, pLayouts[i].Footprint.RowPitch, SIZE_T(pLayouts[i].Footprint.RowPitch) * SIZE_T(pNumRows[i]) };
MemcpySubresource(&DestData, &pSrcData[i], static_cast<SIZE_T>(pRowSizesInBytes[i]), pNumRows[i], pLayouts[i].Footprint.Depth);
}
pIntermediate->Unmap(0, nullptr);
if (DestinationDesc.Dimension == D3D12_RESOURCE_DIMENSION_BUFFER)
{
pCmdList->CopyBufferRegion(
pDestinationResource, 0, pIntermediate, pLayouts[0].Offset, pLayouts[0].Footprint.Width);
}
else
{
for (UINT i = 0; i < NumSubresources; ++i)
{
const CD3DX12_TEXTURE_COPY_LOCATION Dst(pDestinationResource, i + FirstSubresource);
const CD3DX12_TEXTURE_COPY_LOCATION Src(pIntermediate, pLayouts[i]);
pCmdList->CopyTextureRegion(&Dst, 0, 0, 0, &Src, nullptr);
}
}
return RequiredSize;
}
//------------------------------------------------------------------------------------------------
// All arrays must be populated (e.g. by calling GetCopyableFootprints)
inline UINT64 UpdateSubresources(
_In_ ID3D12GraphicsCommandList* pCmdList,
_In_ ID3D12Resource* pDestinationResource,
_In_ ID3D12Resource* pIntermediate,
_In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource,
_In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources,
UINT64 RequiredSize,
_In_reads_(NumSubresources) const D3D12_PLACED_SUBRESOURCE_FOOTPRINT* pLayouts,
_In_reads_(NumSubresources) const UINT* pNumRows,
_In_reads_(NumSubresources) const UINT64* pRowSizesInBytes,
_In_ const void* pResourceData,
_In_reads_(NumSubresources) const D3D12_SUBRESOURCE_INFO* pSrcData) noexcept
{
// Minor validation
#if defined(_MSC_VER) || !defined(_WIN32)
const auto IntermediateDesc = pIntermediate->GetDesc();
const auto DestinationDesc = pDestinationResource->GetDesc();
#else
D3D12_RESOURCE_DESC tmpDesc1, tmpDesc2;
const auto& IntermediateDesc = *pIntermediate->GetDesc(&tmpDesc1);
const auto& DestinationDesc = *pDestinationResource->GetDesc(&tmpDesc2);
#endif
if (IntermediateDesc.Dimension != D3D12_RESOURCE_DIMENSION_BUFFER ||
IntermediateDesc.Width < RequiredSize + pLayouts[0].Offset ||
RequiredSize > SIZE_T(-1) ||
(DestinationDesc.Dimension == D3D12_RESOURCE_DIMENSION_BUFFER &&
(FirstSubresource != 0 || NumSubresources != 1)))
{
return 0;
}
BYTE* pData;
HRESULT hr = pIntermediate->Map(0, nullptr, reinterpret_cast<void**>(&pData));
if (FAILED(hr))
{
return 0;
}
for (UINT i = 0; i < NumSubresources; ++i)
{
if (pRowSizesInBytes[i] > SIZE_T(-1)) return 0;
D3D12_MEMCPY_DEST DestData = { pData + pLayouts[i].Offset, pLayouts[i].Footprint.RowPitch, SIZE_T(pLayouts[i].Footprint.RowPitch) * SIZE_T(pNumRows[i]) };
MemcpySubresource(&DestData, pResourceData, &pSrcData[i], static_cast<SIZE_T>(pRowSizesInBytes[i]), pNumRows[i], pLayouts[i].Footprint.Depth);
}
pIntermediate->Unmap(0, nullptr);
if (DestinationDesc.Dimension == D3D12_RESOURCE_DIMENSION_BUFFER)
{
pCmdList->CopyBufferRegion(
pDestinationResource, 0, pIntermediate, pLayouts[0].Offset, pLayouts[0].Footprint.Width);
}
else
{
for (UINT i = 0; i < NumSubresources; ++i)
{
const CD3DX12_TEXTURE_COPY_LOCATION Dst(pDestinationResource, i + FirstSubresource);
const CD3DX12_TEXTURE_COPY_LOCATION Src(pIntermediate, pLayouts[i]);
pCmdList->CopyTextureRegion(&Dst, 0, 0, 0, &Src, nullptr);
}
}
return RequiredSize;
}
//------------------------------------------------------------------------------------------------
// Heap-allocating UpdateSubresources implementation
inline UINT64 UpdateSubresources(
_In_ ID3D12GraphicsCommandList* pCmdList,
_In_ ID3D12Resource* pDestinationResource,
_In_ ID3D12Resource* pIntermediate,
UINT64 IntermediateOffset,
_In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource,
_In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources,
_In_reads_(NumSubresources) const D3D12_SUBRESOURCE_DATA* pSrcData) noexcept
{
UINT64 RequiredSize = 0;
const auto MemToAlloc = static_cast<UINT64>(sizeof(D3D12_PLACED_SUBRESOURCE_FOOTPRINT) + sizeof(UINT) + sizeof(UINT64)) * NumSubresources;
if (MemToAlloc > SIZE_MAX)
{
return 0;
}
void* pMem = HeapAlloc(GetProcessHeap(), 0, static_cast<SIZE_T>(MemToAlloc));
if (pMem == nullptr)
{
return 0;
}
auto pLayouts = static_cast<D3D12_PLACED_SUBRESOURCE_FOOTPRINT*>(pMem);
auto pRowSizesInBytes = reinterpret_cast<UINT64*>(pLayouts + NumSubresources);
auto pNumRows = reinterpret_cast<UINT*>(pRowSizesInBytes + NumSubresources);
#if defined(_MSC_VER) || !defined(_WIN32)
const auto Desc = pDestinationResource->GetDesc();
#else
D3D12_RESOURCE_DESC tmpDesc;
const auto& Desc = *pDestinationResource->GetDesc(&tmpDesc);
#endif
ID3D12Device* pDevice = nullptr;
pDestinationResource->GetDevice(IID_ID3D12Device, reinterpret_cast<void**>(&pDevice));
pDevice->GetCopyableFootprints(&Desc, FirstSubresource, NumSubresources, IntermediateOffset, pLayouts, pNumRows, pRowSizesInBytes, &RequiredSize);
pDevice->Release();
const UINT64 Result = UpdateSubresources(pCmdList, pDestinationResource, pIntermediate, FirstSubresource, NumSubresources, RequiredSize, pLayouts, pNumRows, pRowSizesInBytes, pSrcData);
HeapFree(GetProcessHeap(), 0, pMem);
return Result;
}
//------------------------------------------------------------------------------------------------
// Heap-allocating UpdateSubresources implementation
inline UINT64 UpdateSubresources(
_In_ ID3D12GraphicsCommandList* pCmdList,
_In_ ID3D12Resource* pDestinationResource,
_In_ ID3D12Resource* pIntermediate,
UINT64 IntermediateOffset,
_In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource,
_In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources,
_In_ const void* pResourceData,
_In_reads_(NumSubresources) const D3D12_SUBRESOURCE_INFO* pSrcData) noexcept
{
UINT64 RequiredSize = 0;
const auto MemToAlloc = static_cast<UINT64>(sizeof(D3D12_PLACED_SUBRESOURCE_FOOTPRINT) + sizeof(UINT) + sizeof(UINT64)) * NumSubresources;
if (MemToAlloc > SIZE_MAX)
{
return 0;
}
void* pMem = HeapAlloc(GetProcessHeap(), 0, static_cast<SIZE_T>(MemToAlloc));
if (pMem == nullptr)
{
return 0;
}
auto pLayouts = static_cast<D3D12_PLACED_SUBRESOURCE_FOOTPRINT*>(pMem);
auto pRowSizesInBytes = reinterpret_cast<UINT64*>(pLayouts + NumSubresources);
auto pNumRows = reinterpret_cast<UINT*>(pRowSizesInBytes + NumSubresources);
#if defined(_MSC_VER) || !defined(_WIN32)
const auto Desc = pDestinationResource->GetDesc();
#else
D3D12_RESOURCE_DESC tmpDesc;
const auto& Desc = *pDestinationResource->GetDesc(&tmpDesc);
#endif
ID3D12Device* pDevice = nullptr;
pDestinationResource->GetDevice(IID_ID3D12Device, reinterpret_cast<void**>(&pDevice));
pDevice->GetCopyableFootprints(&Desc, FirstSubresource, NumSubresources, IntermediateOffset, pLayouts, pNumRows, pRowSizesInBytes, &RequiredSize);
pDevice->Release();
const UINT64 Result = UpdateSubresources(pCmdList, pDestinationResource, pIntermediate, FirstSubresource, NumSubresources, RequiredSize, pLayouts, pNumRows, pRowSizesInBytes, pResourceData, pSrcData);
HeapFree(GetProcessHeap(), 0, pMem);
return Result;
}
//------------------------------------------------------------------------------------------------
// Stack-allocating UpdateSubresources implementation
template <UINT MaxSubresources>
inline UINT64 UpdateSubresources(
_In_ ID3D12GraphicsCommandList* pCmdList,
_In_ ID3D12Resource* pDestinationResource,
_In_ ID3D12Resource* pIntermediate,
UINT64 IntermediateOffset,
_In_range_(0,MaxSubresources) UINT FirstSubresource,
_In_range_(1,MaxSubresources-FirstSubresource) UINT NumSubresources,
_In_reads_(NumSubresources) const D3D12_SUBRESOURCE_DATA* pSrcData) noexcept
{
UINT64 RequiredSize = 0;
D3D12_PLACED_SUBRESOURCE_FOOTPRINT Layouts[MaxSubresources];
UINT NumRows[MaxSubresources];
UINT64 RowSizesInBytes[MaxSubresources];
#if defined(_MSC_VER) || !defined(_WIN32)
const auto Desc = pDestinationResource->GetDesc();
#else
D3D12_RESOURCE_DESC tmpDesc;
const auto& Desc = *pDestinationResource->GetDesc(&tmpDesc);
#endif
ID3D12Device* pDevice = nullptr;
pDestinationResource->GetDevice(IID_ID3D12Device, reinterpret_cast<void**>(&pDevice));
pDevice->GetCopyableFootprints(&Desc, FirstSubresource, NumSubresources, IntermediateOffset, Layouts, NumRows, RowSizesInBytes, &RequiredSize);
pDevice->Release();
return UpdateSubresources(pCmdList, pDestinationResource, pIntermediate, FirstSubresource, NumSubresources, RequiredSize, Layouts, NumRows, RowSizesInBytes, pSrcData);
}
//------------------------------------------------------------------------------------------------
// Stack-allocating UpdateSubresources implementation
template <UINT MaxSubresources>
inline UINT64 UpdateSubresources(
_In_ ID3D12GraphicsCommandList* pCmdList,
_In_ ID3D12Resource* pDestinationResource,
_In_ ID3D12Resource* pIntermediate,
UINT64 IntermediateOffset,
_In_range_(0,MaxSubresources) UINT FirstSubresource,
_In_range_(1,MaxSubresources-FirstSubresource) UINT NumSubresources,
_In_ const void* pResourceData,
_In_reads_(NumSubresources) const D3D12_SUBRESOURCE_INFO* pSrcData) noexcept
{
UINT64 RequiredSize = 0;
D3D12_PLACED_SUBRESOURCE_FOOTPRINT Layouts[MaxSubresources];
UINT NumRows[MaxSubresources];
UINT64 RowSizesInBytes[MaxSubresources];
#if defined(_MSC_VER) || !defined(_WIN32)
const auto Desc = pDestinationResource->GetDesc();
#else
D3D12_RESOURCE_DESC tmpDesc;
const auto& Desc = *pDestinationResource->GetDesc(&tmpDesc);
#endif
ID3D12Device* pDevice = nullptr;
pDestinationResource->GetDevice(IID_ID3D12Device, reinterpret_cast<void**>(&pDevice));
pDevice->GetCopyableFootprints(&Desc, FirstSubresource, NumSubresources, IntermediateOffset, Layouts, NumRows, RowSizesInBytes, &RequiredSize);
pDevice->Release();
return UpdateSubresources(pCmdList, pDestinationResource, pIntermediate, FirstSubresource, NumSubresources, RequiredSize, Layouts, NumRows, RowSizesInBytes, pResourceData, pSrcData);
}
//------------------------------------------------------------------------------------------------
constexpr bool D3D12IsLayoutOpaque( D3D12_TEXTURE_LAYOUT Layout ) noexcept
{ return Layout == D3D12_TEXTURE_LAYOUT_UNKNOWN || Layout == D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE; }
//------------------------------------------------------------------------------------------------
template< typename T >
inline T D3DX12Align(T uValue, T uAlign)
{
// Assert power of 2 alignment
D3DX12_ASSERT(0 == (uAlign & (uAlign - 1)));
T uMask = uAlign - 1;
T uResult = (uValue + uMask) & ~uMask;
D3DX12_ASSERT(uResult >= uValue);
D3DX12_ASSERT(0 == (uResult % uAlign));
return uResult;
}
//------------------------------------------------------------------------------------------------
template< typename T >
inline T D3DX12AlignAtLeast(T uValue, T uAlign)
{
T aligned = D3DX12Align(uValue, uAlign);
return aligned > uAlign ? aligned : uAlign;
}
inline const CD3DX12_RESOURCE_DESC1* D3DX12ConditionallyExpandAPIDesc(
D3D12_RESOURCE_DESC1& LclDesc,
const D3D12_RESOURCE_DESC1* pDesc)
{
return D3DX12ConditionallyExpandAPIDesc(static_cast<CD3DX12_RESOURCE_DESC1&>(LclDesc), static_cast<const CD3DX12_RESOURCE_DESC1*>(pDesc));
}
//------------------------------------------------------------------------------------------------
// The difference between D3DX12GetCopyableFootprints and ID3D12Device::GetCopyableFootprints
// is that this one loses a lot of error checking by assuming the arguments are correct
inline bool D3DX12GetCopyableFootprints(
_In_ const D3D12_RESOURCE_DESC1& ResourceDesc,
_In_range_(0, D3D12_REQ_SUBRESOURCES) UINT FirstSubresource,
_In_range_(0, D3D12_REQ_SUBRESOURCES - FirstSubresource) UINT NumSubresources,
UINT64 BaseOffset,
_Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT* pLayouts,
_Out_writes_opt_(NumSubresources) UINT* pNumRows,
_Out_writes_opt_(NumSubresources) UINT64* pRowSizeInBytes,
_Out_opt_ UINT64* pTotalBytes)
{
constexpr UINT64 uint64_max = ~0ull;
UINT64 TotalBytes = uint64_max;
UINT uSubRes = 0;
bool bResourceOverflow = false;
TotalBytes = 0;
const DXGI_FORMAT Format = ResourceDesc.Format;
CD3DX12_RESOURCE_DESC1 LresourceDesc;
const CD3DX12_RESOURCE_DESC1& resourceDesc = *D3DX12ConditionallyExpandAPIDesc(LresourceDesc, &ResourceDesc);
// Check if its a valid format
D3DX12_ASSERT(D3D12_PROPERTY_LAYOUT_FORMAT_TABLE::FormatExists(Format));
const UINT WidthAlignment = D3D12_PROPERTY_LAYOUT_FORMAT_TABLE::GetWidthAlignment( Format );
const UINT HeightAlignment = D3D12_PROPERTY_LAYOUT_FORMAT_TABLE::GetHeightAlignment( Format );
const UINT16 DepthAlignment = UINT16( D3D12_PROPERTY_LAYOUT_FORMAT_TABLE::GetDepthAlignment( Format ) );
for (; uSubRes < NumSubresources; ++uSubRes)
{
bool bOverflow = false;
UINT Subresource = FirstSubresource + uSubRes;
D3DX12_ASSERT(resourceDesc.MipLevels != 0);
UINT subresourceCount = resourceDesc.MipLevels * resourceDesc.ArraySize() * D3D12_PROPERTY_LAYOUT_FORMAT_TABLE::GetPlaneCount(resourceDesc.Format);
if (Subresource > subresourceCount)
{
break;
}
TotalBytes = D3DX12Align< UINT64 >( TotalBytes, D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT );
UINT MipLevel, ArraySlice, PlaneSlice;
D3D12DecomposeSubresource(Subresource, resourceDesc.MipLevels, resourceDesc.ArraySize(), /*_Out_*/MipLevel, /*_Out_*/ArraySlice, /*_Out_*/PlaneSlice);
const UINT64 Width = D3DX12AlignAtLeast<UINT64>(resourceDesc.Width >> MipLevel, WidthAlignment);
const UINT Height = D3DX12AlignAtLeast(resourceDesc.Height >> MipLevel, HeightAlignment);
const UINT16 Depth = D3DX12AlignAtLeast<UINT16>(resourceDesc.Depth() >> MipLevel, DepthAlignment);
// Adjust for the current PlaneSlice. Most formats have only one plane.
DXGI_FORMAT PlaneFormat;
UINT32 MinPlanePitchWidth, PlaneWidth, PlaneHeight;
D3D12_PROPERTY_LAYOUT_FORMAT_TABLE::GetPlaneSubsampledSizeAndFormatForCopyableLayout(PlaneSlice, Format, (UINT)Width, Height, /*_Out_*/ PlaneFormat, /*_Out_*/ MinPlanePitchWidth, /* _Out_ */ PlaneWidth, /*_Out_*/ PlaneHeight);
D3D12_SUBRESOURCE_FOOTPRINT LocalPlacement;
auto& Placement = pLayouts ? pLayouts[uSubRes].Footprint : LocalPlacement;
Placement.Format = PlaneFormat;
Placement.Width = PlaneWidth;
Placement.Height = PlaneHeight;
Placement.Depth = Depth;
// Calculate row pitch
UINT MinPlaneRowPitch = 0;
D3D12_PROPERTY_LAYOUT_FORMAT_TABLE::CalculateMinimumRowMajorRowPitch(PlaneFormat, MinPlanePitchWidth, MinPlaneRowPitch);
// Formats with more than one plane choose a larger pitch alignment to ensure that each plane begins on the row
// immediately following the previous plane while still adhering to subresource alignment restrictions.
static_assert( D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT >= D3D12_TEXTURE_DATA_PITCH_ALIGNMENT
&& ((D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT % D3D12_TEXTURE_DATA_PITCH_ALIGNMENT) == 0),
"D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT must be >= and evenly divisible by D3D12_TEXTURE_DATA_PITCH_ALIGNMENT." );
Placement.RowPitch = D3D12_PROPERTY_LAYOUT_FORMAT_TABLE::Planar(Format)
? D3DX12Align< UINT >( MinPlaneRowPitch, D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT )
: D3DX12Align< UINT >( MinPlaneRowPitch, D3D12_TEXTURE_DATA_PITCH_ALIGNMENT );
if (pRowSizeInBytes)
{
UINT PlaneRowSize = 0;
D3D12_PROPERTY_LAYOUT_FORMAT_TABLE::CalculateMinimumRowMajorRowPitch(PlaneFormat, PlaneWidth, PlaneRowSize);
pRowSizeInBytes[uSubRes] = PlaneRowSize;
}
// Number of rows (accounting for block compression and additional planes)
UINT NumRows = 0;
if (D3D12_PROPERTY_LAYOUT_FORMAT_TABLE::Planar(Format))
{
NumRows = PlaneHeight;
}
else
{
D3DX12_ASSERT(Height % HeightAlignment == 0);
NumRows = Height / HeightAlignment;
}
if (pNumRows)
{
pNumRows[uSubRes] = NumRows;
}
// Offsetting
if (pLayouts)
{
pLayouts[uSubRes].Offset = (bOverflow ? uint64_max : TotalBytes + BaseOffset);
}
const UINT16 NumSlices = Depth;
const UINT64 SubresourceSize = (NumRows * NumSlices - 1) * Placement.RowPitch + MinPlaneRowPitch;
// uint64 addition with overflow checking
TotalBytes = TotalBytes + SubresourceSize;
if(TotalBytes < SubresourceSize)
{
TotalBytes = uint64_max;
}
bResourceOverflow = bResourceOverflow || bOverflow;
}
// Overflow error
if (bResourceOverflow)
{
TotalBytes = uint64_max;
}
if (pLayouts)
{
memset( pLayouts + uSubRes, -1, sizeof( *pLayouts ) * (NumSubresources - uSubRes) );
}
if (pNumRows)
{
memset(pNumRows + uSubRes, -1, sizeof(*pNumRows) * (NumSubresources - uSubRes));
}
if (pRowSizeInBytes)
{
memset(pRowSizeInBytes + uSubRes, -1, sizeof(*pRowSizeInBytes) * (NumSubresources - uSubRes));
}
if (pTotalBytes)
{
*pTotalBytes = TotalBytes;
}
if(TotalBytes == uint64_max)
{
return false;
}
return true;
}
//------------------------------------------------------------------------------------------------
inline D3D12_RESOURCE_DESC1 D3DX12ResourceDesc0ToDesc1(D3D12_RESOURCE_DESC const& desc0)
{
D3D12_RESOURCE_DESC1 desc1;
desc1.Dimension = desc0.Dimension;
desc1.Alignment = desc0.Alignment;
desc1.Width = desc0.Width;
desc1.Height = desc0.Height;
desc1.DepthOrArraySize = desc0.DepthOrArraySize;
desc1.MipLevels = desc0.MipLevels;
desc1.Format = desc0.Format;
desc1.SampleDesc.Count = desc0.SampleDesc.Count;
desc1.SampleDesc.Quality = desc0.SampleDesc.Quality;
desc1.Layout = desc0.Layout;
desc1.Flags = desc0.Flags;
desc1.SamplerFeedbackMipRegion.Width = 0;
desc1.SamplerFeedbackMipRegion.Height = 0;
desc1.SamplerFeedbackMipRegion.Depth = 0;
return desc1;
}
//------------------------------------------------------------------------------------------------
inline bool D3DX12GetCopyableFootprints(
_In_ const D3D12_RESOURCE_DESC& pResourceDesc,
_In_range_(0, D3D12_REQ_SUBRESOURCES) UINT FirstSubresource,
_In_range_(0, D3D12_REQ_SUBRESOURCES - FirstSubresource) UINT NumSubresources,
UINT64 BaseOffset,
_Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT* pLayouts,
_Out_writes_opt_(NumSubresources) UINT* pNumRows,
_Out_writes_opt_(NumSubresources) UINT64* pRowSizeInBytes,
_Out_opt_ UINT64* pTotalBytes)
{
// From D3D12_RESOURCE_DESC to D3D12_RESOURCE_DESC1
D3D12_RESOURCE_DESC1 desc = D3DX12ResourceDesc0ToDesc1(pResourceDesc);
return D3DX12GetCopyableFootprints(
*static_cast<CD3DX12_RESOURCE_DESC1*>(&desc),// From D3D12_RESOURCE_DESC1 to CD3DX12_RESOURCE_DESC1
FirstSubresource,
NumSubresources,
BaseOffset,
pLayouts,
pNumRows,
pRowSizeInBytes,
pTotalBytes);
}

View File

@ -0,0 +1,973 @@
//*********************************************************
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License (MIT).
//
//*********************************************************
#pragma once
#ifndef __cplusplus
#error D3DX12 requires C++
#endif
#include "d3d12.h"
#include "d3dx12_default.h"
//------------------------------------------------------------------------------------------------
struct CD3DX12_DESCRIPTOR_RANGE : public D3D12_DESCRIPTOR_RANGE
{
CD3DX12_DESCRIPTOR_RANGE() = default;
explicit CD3DX12_DESCRIPTOR_RANGE(const D3D12_DESCRIPTOR_RANGE &o) noexcept :
D3D12_DESCRIPTOR_RANGE(o)
{}
CD3DX12_DESCRIPTOR_RANGE(
D3D12_DESCRIPTOR_RANGE_TYPE rangeType,
UINT numDescriptors,
UINT baseShaderRegister,
UINT registerSpace = 0,
UINT offsetInDescriptorsFromTableStart =
D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND) noexcept
{
Init(rangeType, numDescriptors, baseShaderRegister, registerSpace, offsetInDescriptorsFromTableStart);
}
inline void Init(
D3D12_DESCRIPTOR_RANGE_TYPE rangeType,
UINT numDescriptors,
UINT baseShaderRegister,
UINT registerSpace = 0,
UINT offsetInDescriptorsFromTableStart =
D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND) noexcept
{
Init(*this, rangeType, numDescriptors, baseShaderRegister, registerSpace, offsetInDescriptorsFromTableStart);
}
static inline void Init(
_Out_ D3D12_DESCRIPTOR_RANGE &range,
D3D12_DESCRIPTOR_RANGE_TYPE rangeType,
UINT numDescriptors,
UINT baseShaderRegister,
UINT registerSpace = 0,
UINT offsetInDescriptorsFromTableStart =
D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND) noexcept
{
range.RangeType = rangeType;
range.NumDescriptors = numDescriptors;
range.BaseShaderRegister = baseShaderRegister;
range.RegisterSpace = registerSpace;
range.OffsetInDescriptorsFromTableStart = offsetInDescriptorsFromTableStart;
}
};
//------------------------------------------------------------------------------------------------
struct CD3DX12_ROOT_DESCRIPTOR_TABLE : public D3D12_ROOT_DESCRIPTOR_TABLE
{
CD3DX12_ROOT_DESCRIPTOR_TABLE() = default;
explicit CD3DX12_ROOT_DESCRIPTOR_TABLE(const D3D12_ROOT_DESCRIPTOR_TABLE &o) noexcept :
D3D12_ROOT_DESCRIPTOR_TABLE(o)
{}
CD3DX12_ROOT_DESCRIPTOR_TABLE(
UINT numDescriptorRanges,
_In_reads_opt_(numDescriptorRanges) const D3D12_DESCRIPTOR_RANGE* _pDescriptorRanges) noexcept
{
Init(numDescriptorRanges, _pDescriptorRanges);
}
inline void Init(
UINT numDescriptorRanges,
_In_reads_opt_(numDescriptorRanges) const D3D12_DESCRIPTOR_RANGE* _pDescriptorRanges) noexcept
{
Init(*this, numDescriptorRanges, _pDescriptorRanges);
}
static inline void Init(
_Out_ D3D12_ROOT_DESCRIPTOR_TABLE &rootDescriptorTable,
UINT numDescriptorRanges,
_In_reads_opt_(numDescriptorRanges) const D3D12_DESCRIPTOR_RANGE* _pDescriptorRanges) noexcept
{
rootDescriptorTable.NumDescriptorRanges = numDescriptorRanges;
rootDescriptorTable.pDescriptorRanges = _pDescriptorRanges;
}
};
//------------------------------------------------------------------------------------------------
struct CD3DX12_ROOT_CONSTANTS : public D3D12_ROOT_CONSTANTS
{
CD3DX12_ROOT_CONSTANTS() = default;
explicit CD3DX12_ROOT_CONSTANTS(const D3D12_ROOT_CONSTANTS &o) noexcept :
D3D12_ROOT_CONSTANTS(o)
{}
CD3DX12_ROOT_CONSTANTS(
UINT num32BitValues,
UINT shaderRegister,
UINT registerSpace = 0) noexcept
{
Init(num32BitValues, shaderRegister, registerSpace);
}
inline void Init(
UINT num32BitValues,
UINT shaderRegister,
UINT registerSpace = 0) noexcept
{
Init(*this, num32BitValues, shaderRegister, registerSpace);
}
static inline void Init(
_Out_ D3D12_ROOT_CONSTANTS &rootConstants,
UINT num32BitValues,
UINT shaderRegister,
UINT registerSpace = 0) noexcept
{
rootConstants.Num32BitValues = num32BitValues;
rootConstants.ShaderRegister = shaderRegister;
rootConstants.RegisterSpace = registerSpace;
}
};
//------------------------------------------------------------------------------------------------
struct CD3DX12_ROOT_DESCRIPTOR : public D3D12_ROOT_DESCRIPTOR
{
CD3DX12_ROOT_DESCRIPTOR() = default;
explicit CD3DX12_ROOT_DESCRIPTOR(const D3D12_ROOT_DESCRIPTOR &o) noexcept :
D3D12_ROOT_DESCRIPTOR(o)
{}
CD3DX12_ROOT_DESCRIPTOR(
UINT shaderRegister,
UINT registerSpace = 0) noexcept
{
Init(shaderRegister, registerSpace);
}
inline void Init(
UINT shaderRegister,
UINT registerSpace = 0) noexcept
{
Init(*this, shaderRegister, registerSpace);
}
static inline void Init(_Out_ D3D12_ROOT_DESCRIPTOR &table, UINT shaderRegister, UINT registerSpace = 0) noexcept
{
table.ShaderRegister = shaderRegister;
table.RegisterSpace = registerSpace;
}
};
//------------------------------------------------------------------------------------------------
struct CD3DX12_ROOT_PARAMETER : public D3D12_ROOT_PARAMETER
{
CD3DX12_ROOT_PARAMETER() = default;
explicit CD3DX12_ROOT_PARAMETER(const D3D12_ROOT_PARAMETER &o) noexcept :
D3D12_ROOT_PARAMETER(o)
{}
static inline void InitAsDescriptorTable(
_Out_ D3D12_ROOT_PARAMETER &rootParam,
UINT numDescriptorRanges,
_In_reads_(numDescriptorRanges) const D3D12_DESCRIPTOR_RANGE* pDescriptorRanges,
D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) noexcept
{
rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
rootParam.ShaderVisibility = visibility;
CD3DX12_ROOT_DESCRIPTOR_TABLE::Init(rootParam.DescriptorTable, numDescriptorRanges, pDescriptorRanges);
}
static inline void InitAsConstants(
_Out_ D3D12_ROOT_PARAMETER &rootParam,
UINT num32BitValues,
UINT shaderRegister,
UINT registerSpace = 0,
D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) noexcept
{
rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS;
rootParam.ShaderVisibility = visibility;
CD3DX12_ROOT_CONSTANTS::Init(rootParam.Constants, num32BitValues, shaderRegister, registerSpace);
}
static inline void InitAsConstantBufferView(
_Out_ D3D12_ROOT_PARAMETER &rootParam,
UINT shaderRegister,
UINT registerSpace = 0,
D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) noexcept
{
rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV;
rootParam.ShaderVisibility = visibility;
CD3DX12_ROOT_DESCRIPTOR::Init(rootParam.Descriptor, shaderRegister, registerSpace);
}
static inline void InitAsShaderResourceView(
_Out_ D3D12_ROOT_PARAMETER &rootParam,
UINT shaderRegister,
UINT registerSpace = 0,
D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) noexcept
{
rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_SRV;
rootParam.ShaderVisibility = visibility;
CD3DX12_ROOT_DESCRIPTOR::Init(rootParam.Descriptor, shaderRegister, registerSpace);
}
static inline void InitAsUnorderedAccessView(
_Out_ D3D12_ROOT_PARAMETER &rootParam,
UINT shaderRegister,
UINT registerSpace = 0,
D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) noexcept
{
rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_UAV;
rootParam.ShaderVisibility = visibility;
CD3DX12_ROOT_DESCRIPTOR::Init(rootParam.Descriptor, shaderRegister, registerSpace);
}
inline void InitAsDescriptorTable(
UINT numDescriptorRanges,
_In_reads_(numDescriptorRanges) const D3D12_DESCRIPTOR_RANGE* pDescriptorRanges,
D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) noexcept
{
InitAsDescriptorTable(*this, numDescriptorRanges, pDescriptorRanges, visibility);
}
inline void InitAsConstants(
UINT num32BitValues,
UINT shaderRegister,
UINT registerSpace = 0,
D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) noexcept
{
InitAsConstants(*this, num32BitValues, shaderRegister, registerSpace, visibility);
}
inline void InitAsConstantBufferView(
UINT shaderRegister,
UINT registerSpace = 0,
D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) noexcept
{
InitAsConstantBufferView(*this, shaderRegister, registerSpace, visibility);
}
inline void InitAsShaderResourceView(
UINT shaderRegister,
UINT registerSpace = 0,
D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) noexcept
{
InitAsShaderResourceView(*this, shaderRegister, registerSpace, visibility);
}
inline void InitAsUnorderedAccessView(
UINT shaderRegister,
UINT registerSpace = 0,
D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) noexcept
{
InitAsUnorderedAccessView(*this, shaderRegister, registerSpace, visibility);
}
};
//------------------------------------------------------------------------------------------------
struct CD3DX12_STATIC_SAMPLER_DESC : public D3D12_STATIC_SAMPLER_DESC
{
CD3DX12_STATIC_SAMPLER_DESC() = default;
explicit CD3DX12_STATIC_SAMPLER_DESC(const D3D12_STATIC_SAMPLER_DESC &o) noexcept :
D3D12_STATIC_SAMPLER_DESC(o)
{}
CD3DX12_STATIC_SAMPLER_DESC(
UINT shaderRegister,
D3D12_FILTER filter = D3D12_FILTER_ANISOTROPIC,
D3D12_TEXTURE_ADDRESS_MODE addressU = D3D12_TEXTURE_ADDRESS_MODE_WRAP,
D3D12_TEXTURE_ADDRESS_MODE addressV = D3D12_TEXTURE_ADDRESS_MODE_WRAP,
D3D12_TEXTURE_ADDRESS_MODE addressW = D3D12_TEXTURE_ADDRESS_MODE_WRAP,
FLOAT mipLODBias = 0,
UINT maxAnisotropy = 16,
D3D12_COMPARISON_FUNC comparisonFunc = D3D12_COMPARISON_FUNC_LESS_EQUAL,
D3D12_STATIC_BORDER_COLOR borderColor = D3D12_STATIC_BORDER_COLOR_OPAQUE_WHITE,
FLOAT minLOD = 0.f,
FLOAT maxLOD = D3D12_FLOAT32_MAX,
D3D12_SHADER_VISIBILITY shaderVisibility = D3D12_SHADER_VISIBILITY_ALL,
UINT registerSpace = 0) noexcept
{
Init(
shaderRegister,
filter,
addressU,
addressV,
addressW,
mipLODBias,
maxAnisotropy,
comparisonFunc,
borderColor,
minLOD,
maxLOD,
shaderVisibility,
registerSpace);
}
static inline void Init(
_Out_ D3D12_STATIC_SAMPLER_DESC &samplerDesc,
UINT shaderRegister,
D3D12_FILTER filter = D3D12_FILTER_ANISOTROPIC,
D3D12_TEXTURE_ADDRESS_MODE addressU = D3D12_TEXTURE_ADDRESS_MODE_WRAP,
D3D12_TEXTURE_ADDRESS_MODE addressV = D3D12_TEXTURE_ADDRESS_MODE_WRAP,
D3D12_TEXTURE_ADDRESS_MODE addressW = D3D12_TEXTURE_ADDRESS_MODE_WRAP,
FLOAT mipLODBias = 0,
UINT maxAnisotropy = 16,
D3D12_COMPARISON_FUNC comparisonFunc = D3D12_COMPARISON_FUNC_LESS_EQUAL,
D3D12_STATIC_BORDER_COLOR borderColor = D3D12_STATIC_BORDER_COLOR_OPAQUE_WHITE,
FLOAT minLOD = 0.f,
FLOAT maxLOD = D3D12_FLOAT32_MAX,
D3D12_SHADER_VISIBILITY shaderVisibility = D3D12_SHADER_VISIBILITY_ALL,
UINT registerSpace = 0) noexcept
{
samplerDesc.ShaderRegister = shaderRegister;
samplerDesc.Filter = filter;
samplerDesc.AddressU = addressU;
samplerDesc.AddressV = addressV;
samplerDesc.AddressW = addressW;
samplerDesc.MipLODBias = mipLODBias;
samplerDesc.MaxAnisotropy = maxAnisotropy;
samplerDesc.ComparisonFunc = comparisonFunc;
samplerDesc.BorderColor = borderColor;
samplerDesc.MinLOD = minLOD;
samplerDesc.MaxLOD = maxLOD;
samplerDesc.ShaderVisibility = shaderVisibility;
samplerDesc.RegisterSpace = registerSpace;
}
inline void Init(
UINT shaderRegister,
D3D12_FILTER filter = D3D12_FILTER_ANISOTROPIC,
D3D12_TEXTURE_ADDRESS_MODE addressU = D3D12_TEXTURE_ADDRESS_MODE_WRAP,
D3D12_TEXTURE_ADDRESS_MODE addressV = D3D12_TEXTURE_ADDRESS_MODE_WRAP,
D3D12_TEXTURE_ADDRESS_MODE addressW = D3D12_TEXTURE_ADDRESS_MODE_WRAP,
FLOAT mipLODBias = 0,
UINT maxAnisotropy = 16,
D3D12_COMPARISON_FUNC comparisonFunc = D3D12_COMPARISON_FUNC_LESS_EQUAL,
D3D12_STATIC_BORDER_COLOR borderColor = D3D12_STATIC_BORDER_COLOR_OPAQUE_WHITE,
FLOAT minLOD = 0.f,
FLOAT maxLOD = D3D12_FLOAT32_MAX,
D3D12_SHADER_VISIBILITY shaderVisibility = D3D12_SHADER_VISIBILITY_ALL,
UINT registerSpace = 0) noexcept
{
Init(
*this,
shaderRegister,
filter,
addressU,
addressV,
addressW,
mipLODBias,
maxAnisotropy,
comparisonFunc,
borderColor,
minLOD,
maxLOD,
shaderVisibility,
registerSpace);
}
};
//------------------------------------------------------------------------------------------------
struct CD3DX12_ROOT_SIGNATURE_DESC : public D3D12_ROOT_SIGNATURE_DESC
{
CD3DX12_ROOT_SIGNATURE_DESC() = default;
explicit CD3DX12_ROOT_SIGNATURE_DESC(const D3D12_ROOT_SIGNATURE_DESC &o) noexcept :
D3D12_ROOT_SIGNATURE_DESC(o)
{}
CD3DX12_ROOT_SIGNATURE_DESC(
UINT numParameters,
_In_reads_opt_(numParameters) const D3D12_ROOT_PARAMETER* _pParameters,
UINT numStaticSamplers = 0,
_In_reads_opt_(numStaticSamplers) const D3D12_STATIC_SAMPLER_DESC* _pStaticSamplers = nullptr,
D3D12_ROOT_SIGNATURE_FLAGS flags = D3D12_ROOT_SIGNATURE_FLAG_NONE) noexcept
{
Init(numParameters, _pParameters, numStaticSamplers, _pStaticSamplers, flags);
}
CD3DX12_ROOT_SIGNATURE_DESC(CD3DX12_DEFAULT) noexcept
{
Init(0, nullptr, 0, nullptr, D3D12_ROOT_SIGNATURE_FLAG_NONE);
}
inline void Init(
UINT numParameters,
_In_reads_opt_(numParameters) const D3D12_ROOT_PARAMETER* _pParameters,
UINT numStaticSamplers = 0,
_In_reads_opt_(numStaticSamplers) const D3D12_STATIC_SAMPLER_DESC* _pStaticSamplers = nullptr,
D3D12_ROOT_SIGNATURE_FLAGS flags = D3D12_ROOT_SIGNATURE_FLAG_NONE) noexcept
{
Init(*this, numParameters, _pParameters, numStaticSamplers, _pStaticSamplers, flags);
}
static inline void Init(
_Out_ D3D12_ROOT_SIGNATURE_DESC &desc,
UINT numParameters,
_In_reads_opt_(numParameters) const D3D12_ROOT_PARAMETER* _pParameters,
UINT numStaticSamplers = 0,
_In_reads_opt_(numStaticSamplers) const D3D12_STATIC_SAMPLER_DESC* _pStaticSamplers = nullptr,
D3D12_ROOT_SIGNATURE_FLAGS flags = D3D12_ROOT_SIGNATURE_FLAG_NONE) noexcept
{
desc.NumParameters = numParameters;
desc.pParameters = _pParameters;
desc.NumStaticSamplers = numStaticSamplers;
desc.pStaticSamplers = _pStaticSamplers;
desc.Flags = flags;
}
};
//------------------------------------------------------------------------------------------------
struct CD3DX12_DESCRIPTOR_RANGE1 : public D3D12_DESCRIPTOR_RANGE1
{
CD3DX12_DESCRIPTOR_RANGE1() = default;
explicit CD3DX12_DESCRIPTOR_RANGE1(const D3D12_DESCRIPTOR_RANGE1 &o) noexcept :
D3D12_DESCRIPTOR_RANGE1(o)
{}
CD3DX12_DESCRIPTOR_RANGE1(
D3D12_DESCRIPTOR_RANGE_TYPE rangeType,
UINT numDescriptors,
UINT baseShaderRegister,
UINT registerSpace = 0,
D3D12_DESCRIPTOR_RANGE_FLAGS flags = D3D12_DESCRIPTOR_RANGE_FLAG_NONE,
UINT offsetInDescriptorsFromTableStart =
D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND) noexcept
{
Init(rangeType, numDescriptors, baseShaderRegister, registerSpace, flags, offsetInDescriptorsFromTableStart);
}
inline void Init(
D3D12_DESCRIPTOR_RANGE_TYPE rangeType,
UINT numDescriptors,
UINT baseShaderRegister,
UINT registerSpace = 0,
D3D12_DESCRIPTOR_RANGE_FLAGS flags = D3D12_DESCRIPTOR_RANGE_FLAG_NONE,
UINT offsetInDescriptorsFromTableStart =
D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND) noexcept
{
Init(*this, rangeType, numDescriptors, baseShaderRegister, registerSpace, flags, offsetInDescriptorsFromTableStart);
}
static inline void Init(
_Out_ D3D12_DESCRIPTOR_RANGE1 &range,
D3D12_DESCRIPTOR_RANGE_TYPE rangeType,
UINT numDescriptors,
UINT baseShaderRegister,
UINT registerSpace = 0,
D3D12_DESCRIPTOR_RANGE_FLAGS flags = D3D12_DESCRIPTOR_RANGE_FLAG_NONE,
UINT offsetInDescriptorsFromTableStart =
D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND) noexcept
{
range.RangeType = rangeType;
range.NumDescriptors = numDescriptors;
range.BaseShaderRegister = baseShaderRegister;
range.RegisterSpace = registerSpace;
range.Flags = flags;
range.OffsetInDescriptorsFromTableStart = offsetInDescriptorsFromTableStart;
}
};
//------------------------------------------------------------------------------------------------
struct CD3DX12_ROOT_DESCRIPTOR_TABLE1 : public D3D12_ROOT_DESCRIPTOR_TABLE1
{
CD3DX12_ROOT_DESCRIPTOR_TABLE1() = default;
explicit CD3DX12_ROOT_DESCRIPTOR_TABLE1(const D3D12_ROOT_DESCRIPTOR_TABLE1 &o) noexcept :
D3D12_ROOT_DESCRIPTOR_TABLE1(o)
{}
CD3DX12_ROOT_DESCRIPTOR_TABLE1(
UINT numDescriptorRanges,
_In_reads_opt_(numDescriptorRanges) const D3D12_DESCRIPTOR_RANGE1* _pDescriptorRanges) noexcept
{
Init(numDescriptorRanges, _pDescriptorRanges);
}
inline void Init(
UINT numDescriptorRanges,
_In_reads_opt_(numDescriptorRanges) const D3D12_DESCRIPTOR_RANGE1* _pDescriptorRanges) noexcept
{
Init(*this, numDescriptorRanges, _pDescriptorRanges);
}
static inline void Init(
_Out_ D3D12_ROOT_DESCRIPTOR_TABLE1 &rootDescriptorTable,
UINT numDescriptorRanges,
_In_reads_opt_(numDescriptorRanges) const D3D12_DESCRIPTOR_RANGE1* _pDescriptorRanges) noexcept
{
rootDescriptorTable.NumDescriptorRanges = numDescriptorRanges;
rootDescriptorTable.pDescriptorRanges = _pDescriptorRanges;
}
};
//------------------------------------------------------------------------------------------------
struct CD3DX12_ROOT_DESCRIPTOR1 : public D3D12_ROOT_DESCRIPTOR1
{
CD3DX12_ROOT_DESCRIPTOR1() = default;
explicit CD3DX12_ROOT_DESCRIPTOR1(const D3D12_ROOT_DESCRIPTOR1 &o) noexcept :
D3D12_ROOT_DESCRIPTOR1(o)
{}
CD3DX12_ROOT_DESCRIPTOR1(
UINT shaderRegister,
UINT registerSpace = 0,
D3D12_ROOT_DESCRIPTOR_FLAGS flags = D3D12_ROOT_DESCRIPTOR_FLAG_NONE) noexcept
{
Init(shaderRegister, registerSpace, flags);
}
inline void Init(
UINT shaderRegister,
UINT registerSpace = 0,
D3D12_ROOT_DESCRIPTOR_FLAGS flags = D3D12_ROOT_DESCRIPTOR_FLAG_NONE) noexcept
{
Init(*this, shaderRegister, registerSpace, flags);
}
static inline void Init(
_Out_ D3D12_ROOT_DESCRIPTOR1 &table,
UINT shaderRegister,
UINT registerSpace = 0,
D3D12_ROOT_DESCRIPTOR_FLAGS flags = D3D12_ROOT_DESCRIPTOR_FLAG_NONE) noexcept
{
table.ShaderRegister = shaderRegister;
table.RegisterSpace = registerSpace;
table.Flags = flags;
}
};
//------------------------------------------------------------------------------------------------
struct CD3DX12_ROOT_PARAMETER1 : public D3D12_ROOT_PARAMETER1
{
CD3DX12_ROOT_PARAMETER1() = default;
explicit CD3DX12_ROOT_PARAMETER1(const D3D12_ROOT_PARAMETER1 &o) noexcept :
D3D12_ROOT_PARAMETER1(o)
{}
static inline void InitAsDescriptorTable(
_Out_ D3D12_ROOT_PARAMETER1 &rootParam,
UINT numDescriptorRanges,
_In_reads_(numDescriptorRanges) const D3D12_DESCRIPTOR_RANGE1* pDescriptorRanges,
D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) noexcept
{
rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
rootParam.ShaderVisibility = visibility;
CD3DX12_ROOT_DESCRIPTOR_TABLE1::Init(rootParam.DescriptorTable, numDescriptorRanges, pDescriptorRanges);
}
static inline void InitAsConstants(
_Out_ D3D12_ROOT_PARAMETER1 &rootParam,
UINT num32BitValues,
UINT shaderRegister,
UINT registerSpace = 0,
D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) noexcept
{
rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS;
rootParam.ShaderVisibility = visibility;
CD3DX12_ROOT_CONSTANTS::Init(rootParam.Constants, num32BitValues, shaderRegister, registerSpace);
}
static inline void InitAsConstantBufferView(
_Out_ D3D12_ROOT_PARAMETER1 &rootParam,
UINT shaderRegister,
UINT registerSpace = 0,
D3D12_ROOT_DESCRIPTOR_FLAGS flags = D3D12_ROOT_DESCRIPTOR_FLAG_NONE,
D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) noexcept
{
rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV;
rootParam.ShaderVisibility = visibility;
CD3DX12_ROOT_DESCRIPTOR1::Init(rootParam.Descriptor, shaderRegister, registerSpace, flags);
}
static inline void InitAsShaderResourceView(
_Out_ D3D12_ROOT_PARAMETER1 &rootParam,
UINT shaderRegister,
UINT registerSpace = 0,
D3D12_ROOT_DESCRIPTOR_FLAGS flags = D3D12_ROOT_DESCRIPTOR_FLAG_NONE,
D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) noexcept
{
rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_SRV;
rootParam.ShaderVisibility = visibility;
CD3DX12_ROOT_DESCRIPTOR1::Init(rootParam.Descriptor, shaderRegister, registerSpace, flags);
}
static inline void InitAsUnorderedAccessView(
_Out_ D3D12_ROOT_PARAMETER1 &rootParam,
UINT shaderRegister,
UINT registerSpace = 0,
D3D12_ROOT_DESCRIPTOR_FLAGS flags = D3D12_ROOT_DESCRIPTOR_FLAG_NONE,
D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) noexcept
{
rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_UAV;
rootParam.ShaderVisibility = visibility;
CD3DX12_ROOT_DESCRIPTOR1::Init(rootParam.Descriptor, shaderRegister, registerSpace, flags);
}
inline void InitAsDescriptorTable(
UINT numDescriptorRanges,
_In_reads_(numDescriptorRanges) const D3D12_DESCRIPTOR_RANGE1* pDescriptorRanges,
D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) noexcept
{
InitAsDescriptorTable(*this, numDescriptorRanges, pDescriptorRanges, visibility);
}
inline void InitAsConstants(
UINT num32BitValues,
UINT shaderRegister,
UINT registerSpace = 0,
D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) noexcept
{
InitAsConstants(*this, num32BitValues, shaderRegister, registerSpace, visibility);
}
inline void InitAsConstantBufferView(
UINT shaderRegister,
UINT registerSpace = 0,
D3D12_ROOT_DESCRIPTOR_FLAGS flags = D3D12_ROOT_DESCRIPTOR_FLAG_NONE,
D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) noexcept
{
InitAsConstantBufferView(*this, shaderRegister, registerSpace, flags, visibility);
}
inline void InitAsShaderResourceView(
UINT shaderRegister,
UINT registerSpace = 0,
D3D12_ROOT_DESCRIPTOR_FLAGS flags = D3D12_ROOT_DESCRIPTOR_FLAG_NONE,
D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) noexcept
{
InitAsShaderResourceView(*this, shaderRegister, registerSpace, flags, visibility);
}
inline void InitAsUnorderedAccessView(
UINT shaderRegister,
UINT registerSpace = 0,
D3D12_ROOT_DESCRIPTOR_FLAGS flags = D3D12_ROOT_DESCRIPTOR_FLAG_NONE,
D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) noexcept
{
InitAsUnorderedAccessView(*this, shaderRegister, registerSpace, flags, visibility);
}
};
//------------------------------------------------------------------------------------------------
struct CD3DX12_VERSIONED_ROOT_SIGNATURE_DESC : public D3D12_VERSIONED_ROOT_SIGNATURE_DESC
{
CD3DX12_VERSIONED_ROOT_SIGNATURE_DESC() = default;
explicit CD3DX12_VERSIONED_ROOT_SIGNATURE_DESC(const D3D12_VERSIONED_ROOT_SIGNATURE_DESC &o) noexcept :
D3D12_VERSIONED_ROOT_SIGNATURE_DESC(o)
{}
explicit CD3DX12_VERSIONED_ROOT_SIGNATURE_DESC(const D3D12_ROOT_SIGNATURE_DESC &o) noexcept
{
Version = D3D_ROOT_SIGNATURE_VERSION_1_0;
Desc_1_0 = o;
}
explicit CD3DX12_VERSIONED_ROOT_SIGNATURE_DESC(const D3D12_ROOT_SIGNATURE_DESC1 &o) noexcept
{
Version = D3D_ROOT_SIGNATURE_VERSION_1_1;
Desc_1_1 = o;
}
CD3DX12_VERSIONED_ROOT_SIGNATURE_DESC(
UINT numParameters,
_In_reads_opt_(numParameters) const D3D12_ROOT_PARAMETER* _pParameters,
UINT numStaticSamplers = 0,
_In_reads_opt_(numStaticSamplers) const D3D12_STATIC_SAMPLER_DESC* _pStaticSamplers = nullptr,
D3D12_ROOT_SIGNATURE_FLAGS flags = D3D12_ROOT_SIGNATURE_FLAG_NONE) noexcept
{
Init_1_0(numParameters, _pParameters, numStaticSamplers, _pStaticSamplers, flags);
}
CD3DX12_VERSIONED_ROOT_SIGNATURE_DESC(
UINT numParameters,
_In_reads_opt_(numParameters) const D3D12_ROOT_PARAMETER1* _pParameters,
UINT numStaticSamplers = 0,
_In_reads_opt_(numStaticSamplers) const D3D12_STATIC_SAMPLER_DESC* _pStaticSamplers = nullptr,
D3D12_ROOT_SIGNATURE_FLAGS flags = D3D12_ROOT_SIGNATURE_FLAG_NONE) noexcept
{
Init_1_1(numParameters, _pParameters, numStaticSamplers, _pStaticSamplers, flags);
}
CD3DX12_VERSIONED_ROOT_SIGNATURE_DESC(CD3DX12_DEFAULT) noexcept
{
Init_1_1(0, nullptr, 0, nullptr, D3D12_ROOT_SIGNATURE_FLAG_NONE);
}
inline void Init_1_0(
UINT numParameters,
_In_reads_opt_(numParameters) const D3D12_ROOT_PARAMETER* _pParameters,
UINT numStaticSamplers = 0,
_In_reads_opt_(numStaticSamplers) const D3D12_STATIC_SAMPLER_DESC* _pStaticSamplers = nullptr,
D3D12_ROOT_SIGNATURE_FLAGS flags = D3D12_ROOT_SIGNATURE_FLAG_NONE) noexcept
{
Init_1_0(*this, numParameters, _pParameters, numStaticSamplers, _pStaticSamplers, flags);
}
static inline void Init_1_0(
_Out_ D3D12_VERSIONED_ROOT_SIGNATURE_DESC &desc,
UINT numParameters,
_In_reads_opt_(numParameters) const D3D12_ROOT_PARAMETER* _pParameters,
UINT numStaticSamplers = 0,
_In_reads_opt_(numStaticSamplers) const D3D12_STATIC_SAMPLER_DESC* _pStaticSamplers = nullptr,
D3D12_ROOT_SIGNATURE_FLAGS flags = D3D12_ROOT_SIGNATURE_FLAG_NONE) noexcept
{
desc.Version = D3D_ROOT_SIGNATURE_VERSION_1_0;
desc.Desc_1_0.NumParameters = numParameters;
desc.Desc_1_0.pParameters = _pParameters;
desc.Desc_1_0.NumStaticSamplers = numStaticSamplers;
desc.Desc_1_0.pStaticSamplers = _pStaticSamplers;
desc.Desc_1_0.Flags = flags;
}
inline void Init_1_1(
UINT numParameters,
_In_reads_opt_(numParameters) const D3D12_ROOT_PARAMETER1* _pParameters,
UINT numStaticSamplers = 0,
_In_reads_opt_(numStaticSamplers) const D3D12_STATIC_SAMPLER_DESC* _pStaticSamplers = nullptr,
D3D12_ROOT_SIGNATURE_FLAGS flags = D3D12_ROOT_SIGNATURE_FLAG_NONE) noexcept
{
Init_1_1(*this, numParameters, _pParameters, numStaticSamplers, _pStaticSamplers, flags);
}
static inline void Init_1_1(
_Out_ D3D12_VERSIONED_ROOT_SIGNATURE_DESC &desc,
UINT numParameters,
_In_reads_opt_(numParameters) const D3D12_ROOT_PARAMETER1* _pParameters,
UINT numStaticSamplers = 0,
_In_reads_opt_(numStaticSamplers) const D3D12_STATIC_SAMPLER_DESC* _pStaticSamplers = nullptr,
D3D12_ROOT_SIGNATURE_FLAGS flags = D3D12_ROOT_SIGNATURE_FLAG_NONE) noexcept
{
desc.Version = D3D_ROOT_SIGNATURE_VERSION_1_1;
desc.Desc_1_1.NumParameters = numParameters;
desc.Desc_1_1.pParameters = _pParameters;
desc.Desc_1_1.NumStaticSamplers = numStaticSamplers;
desc.Desc_1_1.pStaticSamplers = _pStaticSamplers;
desc.Desc_1_1.Flags = flags;
}
};
//------------------------------------------------------------------------------------------------
struct CD3DX12_CPU_DESCRIPTOR_HANDLE : public D3D12_CPU_DESCRIPTOR_HANDLE
{
CD3DX12_CPU_DESCRIPTOR_HANDLE() = default;
explicit CD3DX12_CPU_DESCRIPTOR_HANDLE(const D3D12_CPU_DESCRIPTOR_HANDLE &o) noexcept :
D3D12_CPU_DESCRIPTOR_HANDLE(o)
{}
CD3DX12_CPU_DESCRIPTOR_HANDLE(CD3DX12_DEFAULT) noexcept { ptr = 0; }
CD3DX12_CPU_DESCRIPTOR_HANDLE(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE &other, INT offsetScaledByIncrementSize) noexcept
{
InitOffsetted(other, offsetScaledByIncrementSize);
}
CD3DX12_CPU_DESCRIPTOR_HANDLE(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE &other, INT offsetInDescriptors, UINT descriptorIncrementSize) noexcept
{
InitOffsetted(other, offsetInDescriptors, descriptorIncrementSize);
}
CD3DX12_CPU_DESCRIPTOR_HANDLE& Offset(INT offsetInDescriptors, UINT descriptorIncrementSize) noexcept
{
ptr = SIZE_T(INT64(ptr) + INT64(offsetInDescriptors) * INT64(descriptorIncrementSize));
return *this;
}
CD3DX12_CPU_DESCRIPTOR_HANDLE& Offset(INT offsetScaledByIncrementSize) noexcept
{
ptr = SIZE_T(INT64(ptr) + INT64(offsetScaledByIncrementSize));
return *this;
}
bool operator==(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE& other) const noexcept
{
return (ptr == other.ptr);
}
bool operator!=(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE& other) const noexcept
{
return (ptr != other.ptr);
}
CD3DX12_CPU_DESCRIPTOR_HANDLE &operator=(const D3D12_CPU_DESCRIPTOR_HANDLE &other) noexcept
{
ptr = other.ptr;
return *this;
}
inline void InitOffsetted(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE &base, INT offsetScaledByIncrementSize) noexcept
{
InitOffsetted(*this, base, offsetScaledByIncrementSize);
}
inline void InitOffsetted(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE &base, INT offsetInDescriptors, UINT descriptorIncrementSize) noexcept
{
InitOffsetted(*this, base, offsetInDescriptors, descriptorIncrementSize);
}
static inline void InitOffsetted(_Out_ D3D12_CPU_DESCRIPTOR_HANDLE &handle, _In_ const D3D12_CPU_DESCRIPTOR_HANDLE &base, INT offsetScaledByIncrementSize) noexcept
{
handle.ptr = SIZE_T(INT64(base.ptr) + INT64(offsetScaledByIncrementSize));
}
static inline void InitOffsetted(_Out_ D3D12_CPU_DESCRIPTOR_HANDLE &handle, _In_ const D3D12_CPU_DESCRIPTOR_HANDLE &base, INT offsetInDescriptors, UINT descriptorIncrementSize) noexcept
{
handle.ptr = SIZE_T(INT64(base.ptr) + INT64(offsetInDescriptors) * INT64(descriptorIncrementSize));
}
};
//------------------------------------------------------------------------------------------------
struct CD3DX12_GPU_DESCRIPTOR_HANDLE : public D3D12_GPU_DESCRIPTOR_HANDLE
{
CD3DX12_GPU_DESCRIPTOR_HANDLE() = default;
explicit CD3DX12_GPU_DESCRIPTOR_HANDLE(const D3D12_GPU_DESCRIPTOR_HANDLE &o) noexcept :
D3D12_GPU_DESCRIPTOR_HANDLE(o)
{}
CD3DX12_GPU_DESCRIPTOR_HANDLE(CD3DX12_DEFAULT) noexcept { ptr = 0; }
CD3DX12_GPU_DESCRIPTOR_HANDLE(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE &other, INT offsetScaledByIncrementSize) noexcept
{
InitOffsetted(other, offsetScaledByIncrementSize);
}
CD3DX12_GPU_DESCRIPTOR_HANDLE(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE &other, INT offsetInDescriptors, UINT descriptorIncrementSize) noexcept
{
InitOffsetted(other, offsetInDescriptors, descriptorIncrementSize);
}
CD3DX12_GPU_DESCRIPTOR_HANDLE& Offset(INT offsetInDescriptors, UINT descriptorIncrementSize) noexcept
{
ptr = UINT64(INT64(ptr) + INT64(offsetInDescriptors) * INT64(descriptorIncrementSize));
return *this;
}
CD3DX12_GPU_DESCRIPTOR_HANDLE& Offset(INT offsetScaledByIncrementSize) noexcept
{
ptr = UINT64(INT64(ptr) + INT64(offsetScaledByIncrementSize));
return *this;
}
inline bool operator==(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE& other) const noexcept
{
return (ptr == other.ptr);
}
inline bool operator!=(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE& other) const noexcept
{
return (ptr != other.ptr);
}
CD3DX12_GPU_DESCRIPTOR_HANDLE &operator=(const D3D12_GPU_DESCRIPTOR_HANDLE &other) noexcept
{
ptr = other.ptr;
return *this;
}
inline void InitOffsetted(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE &base, INT offsetScaledByIncrementSize) noexcept
{
InitOffsetted(*this, base, offsetScaledByIncrementSize);
}
inline void InitOffsetted(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE &base, INT offsetInDescriptors, UINT descriptorIncrementSize) noexcept
{
InitOffsetted(*this, base, offsetInDescriptors, descriptorIncrementSize);
}
static inline void InitOffsetted(_Out_ D3D12_GPU_DESCRIPTOR_HANDLE &handle, _In_ const D3D12_GPU_DESCRIPTOR_HANDLE &base, INT offsetScaledByIncrementSize) noexcept
{
handle.ptr = UINT64(INT64(base.ptr) + INT64(offsetScaledByIncrementSize));
}
static inline void InitOffsetted(_Out_ D3D12_GPU_DESCRIPTOR_HANDLE &handle, _In_ const D3D12_GPU_DESCRIPTOR_HANDLE &base, INT offsetInDescriptors, UINT descriptorIncrementSize) noexcept
{
handle.ptr = UINT64(INT64(base.ptr) + INT64(offsetInDescriptors) * INT64(descriptorIncrementSize));
}
};
//------------------------------------------------------------------------------------------------
// D3D12 exports a new method for serializing root signatures in the Windows 10 Anniversary Update.
// To help enable root signature 1.1 features when they are available and not require maintaining
// two code paths for building root signatures, this helper method reconstructs a 1.0 signature when
// 1.1 is not supported.
inline HRESULT D3DX12SerializeVersionedRootSignature(
_In_ const D3D12_VERSIONED_ROOT_SIGNATURE_DESC* pRootSignatureDesc,
D3D_ROOT_SIGNATURE_VERSION MaxVersion,
_Outptr_ ID3DBlob** ppBlob,
_Always_(_Outptr_opt_result_maybenull_) ID3DBlob** ppErrorBlob) noexcept
{
if (ppErrorBlob != nullptr)
{
*ppErrorBlob = nullptr;
}
switch (MaxVersion)
{
case D3D_ROOT_SIGNATURE_VERSION_1_0:
switch (pRootSignatureDesc->Version)
{
case D3D_ROOT_SIGNATURE_VERSION_1_0:
return D3D12SerializeRootSignature(&pRootSignatureDesc->Desc_1_0, D3D_ROOT_SIGNATURE_VERSION_1, ppBlob, ppErrorBlob);
case D3D_ROOT_SIGNATURE_VERSION_1_1:
{
HRESULT hr = S_OK;
const D3D12_ROOT_SIGNATURE_DESC1& desc_1_1 = pRootSignatureDesc->Desc_1_1;
const SIZE_T ParametersSize = sizeof(D3D12_ROOT_PARAMETER) * desc_1_1.NumParameters;
void* pParameters = (ParametersSize > 0) ? HeapAlloc(GetProcessHeap(), 0, ParametersSize) : nullptr;
if (ParametersSize > 0 && pParameters == nullptr)
{
hr = E_OUTOFMEMORY;
}
auto pParameters_1_0 = static_cast<D3D12_ROOT_PARAMETER*>(pParameters);
if (SUCCEEDED(hr))
{
for (UINT n = 0; n < desc_1_1.NumParameters; n++)
{
__analysis_assume(ParametersSize == sizeof(D3D12_ROOT_PARAMETER) * desc_1_1.NumParameters);
pParameters_1_0[n].ParameterType = desc_1_1.pParameters[n].ParameterType;
pParameters_1_0[n].ShaderVisibility = desc_1_1.pParameters[n].ShaderVisibility;
switch (desc_1_1.pParameters[n].ParameterType)
{
case D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS:
pParameters_1_0[n].Constants.Num32BitValues = desc_1_1.pParameters[n].Constants.Num32BitValues;
pParameters_1_0[n].Constants.RegisterSpace = desc_1_1.pParameters[n].Constants.RegisterSpace;
pParameters_1_0[n].Constants.ShaderRegister = desc_1_1.pParameters[n].Constants.ShaderRegister;
break;
case D3D12_ROOT_PARAMETER_TYPE_CBV:
case D3D12_ROOT_PARAMETER_TYPE_SRV:
case D3D12_ROOT_PARAMETER_TYPE_UAV:
pParameters_1_0[n].Descriptor.RegisterSpace = desc_1_1.pParameters[n].Descriptor.RegisterSpace;
pParameters_1_0[n].Descriptor.ShaderRegister = desc_1_1.pParameters[n].Descriptor.ShaderRegister;
break;
case D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE:
const D3D12_ROOT_DESCRIPTOR_TABLE1& table_1_1 = desc_1_1.pParameters[n].DescriptorTable;
const SIZE_T DescriptorRangesSize = sizeof(D3D12_DESCRIPTOR_RANGE) * table_1_1.NumDescriptorRanges;
void* pDescriptorRanges = (DescriptorRangesSize > 0 && SUCCEEDED(hr)) ? HeapAlloc(GetProcessHeap(), 0, DescriptorRangesSize) : nullptr;
if (DescriptorRangesSize > 0 && pDescriptorRanges == nullptr)
{
hr = E_OUTOFMEMORY;
}
auto pDescriptorRanges_1_0 = static_cast<D3D12_DESCRIPTOR_RANGE*>(pDescriptorRanges);
if (SUCCEEDED(hr))
{
for (UINT x = 0; x < table_1_1.NumDescriptorRanges; x++)
{
__analysis_assume(DescriptorRangesSize == sizeof(D3D12_DESCRIPTOR_RANGE) * table_1_1.NumDescriptorRanges);
pDescriptorRanges_1_0[x].BaseShaderRegister = table_1_1.pDescriptorRanges[x].BaseShaderRegister;
pDescriptorRanges_1_0[x].NumDescriptors = table_1_1.pDescriptorRanges[x].NumDescriptors;
pDescriptorRanges_1_0[x].OffsetInDescriptorsFromTableStart = table_1_1.pDescriptorRanges[x].OffsetInDescriptorsFromTableStart;
pDescriptorRanges_1_0[x].RangeType = table_1_1.pDescriptorRanges[x].RangeType;
pDescriptorRanges_1_0[x].RegisterSpace = table_1_1.pDescriptorRanges[x].RegisterSpace;
}
}
D3D12_ROOT_DESCRIPTOR_TABLE& table_1_0 = pParameters_1_0[n].DescriptorTable;
table_1_0.NumDescriptorRanges = table_1_1.NumDescriptorRanges;
table_1_0.pDescriptorRanges = pDescriptorRanges_1_0;
}
}
}
if (SUCCEEDED(hr))
{
const CD3DX12_ROOT_SIGNATURE_DESC desc_1_0(desc_1_1.NumParameters, pParameters_1_0, desc_1_1.NumStaticSamplers, desc_1_1.pStaticSamplers, desc_1_1.Flags);
hr = D3D12SerializeRootSignature(&desc_1_0, D3D_ROOT_SIGNATURE_VERSION_1, ppBlob, ppErrorBlob);
}
if (pParameters)
{
for (UINT n = 0; n < desc_1_1.NumParameters; n++)
{
if (desc_1_1.pParameters[n].ParameterType == D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE)
{
auto pDescriptorRanges_1_0 = pParameters_1_0[n].DescriptorTable.pDescriptorRanges;
HeapFree(GetProcessHeap(), 0, reinterpret_cast<void*>(const_cast<D3D12_DESCRIPTOR_RANGE*>(pDescriptorRanges_1_0)));
}
}
HeapFree(GetProcessHeap(), 0, pParameters);
}
return hr;
}
}
break;
case D3D_ROOT_SIGNATURE_VERSION_1_1:
return D3D12SerializeVersionedRootSignature(pRootSignatureDesc, ppBlob, ppErrorBlob);
}
return E_INVALIDARG;
}

View File

@ -0,0 +1,790 @@
//*********************************************************
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License (MIT).
//
//*********************************************************
#pragma once
#ifndef __cplusplus
#error D3DX12 requires C++
#endif
#include "d3d12.h"
//================================================================================================
// D3DX12 State Object Creation Helpers
//
// Helper classes for creating new style state objects out of an arbitrary set of subobjects.
// Uses STL
//
// Start by instantiating CD3DX12_STATE_OBJECT_DESC (see its public methods).
// One of its methods is CreateSubobject(), which has a comment showing a couple of options for
// defining subobjects using the helper classes for each subobject (CD3DX12_DXIL_LIBRARY_SUBOBJECT
// etc.). The subobject helpers each have methods specific to the subobject for configuring its
// contents.
//
//================================================================================================
#include <list>
#include <memory>
#include <string>
#include <vector>
#ifndef D3DX12_USE_ATL
#include <wrl/client.h>
#define D3DX12_COM_PTR Microsoft::WRL::ComPtr
#define D3DX12_COM_PTR_GET(x) x.Get()
#define D3DX12_COM_PTR_ADDRESSOF(x) x.GetAddressOf()
#else
#include <atlbase.h>
#define D3DX12_COM_PTR ATL::CComPtr
#define D3DX12_COM_PTR_GET(x) x.p
#define D3DX12_COM_PTR_ADDRESSOF(x) &x.p
#endif
//------------------------------------------------------------------------------------------------
class CD3DX12_STATE_OBJECT_DESC
{
public:
CD3DX12_STATE_OBJECT_DESC() noexcept
{
Init(D3D12_STATE_OBJECT_TYPE_COLLECTION);
}
CD3DX12_STATE_OBJECT_DESC(D3D12_STATE_OBJECT_TYPE Type) noexcept
{
Init(Type);
}
void SetStateObjectType(D3D12_STATE_OBJECT_TYPE Type) noexcept { m_Desc.Type = Type; }
operator const D3D12_STATE_OBJECT_DESC&()
{
// Do final preparation work
m_RepointedAssociations.clear();
m_SubobjectArray.clear();
m_SubobjectArray.reserve(m_Desc.NumSubobjects);
// Flatten subobjects into an array (each flattened subobject still has a
// member that's a pointer to its desc that's not flattened)
for (auto Iter = m_SubobjectList.begin();
Iter != m_SubobjectList.end(); Iter++)
{
m_SubobjectArray.push_back(*Iter);
// Store new location in array so we can redirect pointers contained in subobjects
Iter->pSubobjectArrayLocation = &m_SubobjectArray.back();
}
// For subobjects with pointer fields, create a new copy of those subobject definitions
// with fixed pointers
for (UINT i = 0; i < m_Desc.NumSubobjects; i++)
{
if (m_SubobjectArray[i].Type == D3D12_STATE_SUBOBJECT_TYPE_SUBOBJECT_TO_EXPORTS_ASSOCIATION)
{
auto pOriginalSubobjectAssociation =
static_cast<const D3D12_SUBOBJECT_TO_EXPORTS_ASSOCIATION*>(m_SubobjectArray[i].pDesc);
D3D12_SUBOBJECT_TO_EXPORTS_ASSOCIATION Repointed = *pOriginalSubobjectAssociation;
auto pWrapper =
static_cast<const SUBOBJECT_WRAPPER*>(pOriginalSubobjectAssociation->pSubobjectToAssociate);
Repointed.pSubobjectToAssociate = pWrapper->pSubobjectArrayLocation;
m_RepointedAssociations.push_back(Repointed);
m_SubobjectArray[i].pDesc = &m_RepointedAssociations.back();
}
}
// Below: using ugly way to get pointer in case .data() is not defined
m_Desc.pSubobjects = m_Desc.NumSubobjects ? &m_SubobjectArray[0] : nullptr;
return m_Desc;
}
operator const D3D12_STATE_OBJECT_DESC*()
{
// Cast calls the above final preparation work
return &static_cast<const D3D12_STATE_OBJECT_DESC&>(*this);
}
// CreateSubobject creates a sububject helper (e.g. CD3DX12_HIT_GROUP_SUBOBJECT)
// whose lifetime is owned by this class.
// e.g.
//
// CD3DX12_STATE_OBJECT_DESC Collection1(D3D12_STATE_OBJECT_TYPE_COLLECTION);
// auto Lib0 = Collection1.CreateSubobject<CD3DX12_DXIL_LIBRARY_SUBOBJECT>();
// Lib0->SetDXILLibrary(&pMyAppDxilLibs[0]);
// Lib0->DefineExport(L"rayGenShader0"); // in practice these export listings might be
// // data/engine driven
// etc.
//
// Alternatively, users can instantiate sububject helpers explicitly, such as via local
// variables instead, passing the state object desc that should point to it into the helper
// constructor (or call mySubobjectHelper.AddToStateObject(Collection1)).
// In this alternative scenario, the user must keep the subobject alive as long as the state
// object it is associated with is alive, else its pointer references will be stale.
// e.g.
//
// CD3DX12_STATE_OBJECT_DESC RaytracingState2(D3D12_STATE_OBJECT_TYPE_RAYTRACING_PIPELINE);
// CD3DX12_DXIL_LIBRARY_SUBOBJECT LibA(RaytracingState2);
// LibA.SetDXILLibrary(&pMyAppDxilLibs[4]); // not manually specifying exports
// // - meaning all exports in the libraries
// // are exported
// etc.
template<typename T>
T* CreateSubobject()
{
T* pSubobject = new T(*this);
m_OwnedSubobjectHelpers.emplace_back(pSubobject);
return pSubobject;
}
private:
D3D12_STATE_SUBOBJECT* TrackSubobject(D3D12_STATE_SUBOBJECT_TYPE Type, void* pDesc)
{
SUBOBJECT_WRAPPER Subobject;
Subobject.pSubobjectArrayLocation = nullptr;
Subobject.Type = Type;
Subobject.pDesc = pDesc;
m_SubobjectList.push_back(Subobject);
m_Desc.NumSubobjects++;
return &m_SubobjectList.back();
}
void Init(D3D12_STATE_OBJECT_TYPE Type) noexcept
{
SetStateObjectType(Type);
m_Desc.pSubobjects = nullptr;
m_Desc.NumSubobjects = 0;
m_SubobjectList.clear();
m_SubobjectArray.clear();
m_RepointedAssociations.clear();
}
typedef struct SUBOBJECT_WRAPPER : public D3D12_STATE_SUBOBJECT
{
D3D12_STATE_SUBOBJECT* pSubobjectArrayLocation; // new location when flattened into array
// for repointing pointers in subobjects
} SUBOBJECT_WRAPPER;
D3D12_STATE_OBJECT_DESC m_Desc;
std::list<SUBOBJECT_WRAPPER> m_SubobjectList; // Pointers to list nodes handed out so
// these can be edited live
std::vector<D3D12_STATE_SUBOBJECT> m_SubobjectArray; // Built at the end, copying list contents
std::list<D3D12_SUBOBJECT_TO_EXPORTS_ASSOCIATION>
m_RepointedAssociations; // subobject type that contains pointers to other subobjects,
// repointed to flattened array
class StringContainer
{
public:
LPCWSTR LocalCopy(LPCWSTR string, bool bSingleString = false)
{
if (string)
{
if (bSingleString)
{
m_Strings.clear();
m_Strings.push_back(string);
}
else
{
m_Strings.push_back(string);
}
return m_Strings.back().c_str();
}
else
{
return nullptr;
}
}
void clear() noexcept { m_Strings.clear(); }
private:
std::list<std::wstring> m_Strings;
};
class SUBOBJECT_HELPER_BASE
{
public:
SUBOBJECT_HELPER_BASE() noexcept { Init(); }
virtual ~SUBOBJECT_HELPER_BASE() = default;
virtual D3D12_STATE_SUBOBJECT_TYPE Type() const noexcept = 0;
void AddToStateObject(CD3DX12_STATE_OBJECT_DESC& ContainingStateObject)
{
m_pSubobject = ContainingStateObject.TrackSubobject(Type(), Data());
}
protected:
virtual void* Data() noexcept = 0;
void Init() noexcept { m_pSubobject = nullptr; }
D3D12_STATE_SUBOBJECT* m_pSubobject;
};
#if(__cplusplus >= 201103L)
std::list<std::unique_ptr<const SUBOBJECT_HELPER_BASE>> m_OwnedSubobjectHelpers;
#else
class OWNED_HELPER
{
public:
OWNED_HELPER(const SUBOBJECT_HELPER_BASE* pHelper) noexcept { m_pHelper = pHelper; }
~OWNED_HELPER() { delete m_pHelper; }
const SUBOBJECT_HELPER_BASE* m_pHelper;
};
std::list<OWNED_HELPER> m_OwnedSubobjectHelpers;
#endif
friend class CD3DX12_DXIL_LIBRARY_SUBOBJECT;
friend class CD3DX12_EXISTING_COLLECTION_SUBOBJECT;
friend class CD3DX12_SUBOBJECT_TO_EXPORTS_ASSOCIATION_SUBOBJECT;
friend class CD3DX12_DXIL_SUBOBJECT_TO_EXPORTS_ASSOCIATION;
friend class CD3DX12_HIT_GROUP_SUBOBJECT;
friend class CD3DX12_RAYTRACING_SHADER_CONFIG_SUBOBJECT;
friend class CD3DX12_RAYTRACING_PIPELINE_CONFIG_SUBOBJECT;
friend class CD3DX12_RAYTRACING_PIPELINE_CONFIG1_SUBOBJECT;
friend class CD3DX12_GLOBAL_ROOT_SIGNATURE_SUBOBJECT;
friend class CD3DX12_LOCAL_ROOT_SIGNATURE_SUBOBJECT;
friend class CD3DX12_STATE_OBJECT_CONFIG_SUBOBJECT;
friend class CD3DX12_NODE_MASK_SUBOBJECT;
};
//------------------------------------------------------------------------------------------------
class CD3DX12_DXIL_LIBRARY_SUBOBJECT
: public CD3DX12_STATE_OBJECT_DESC::SUBOBJECT_HELPER_BASE
{
public:
CD3DX12_DXIL_LIBRARY_SUBOBJECT() noexcept
{
Init();
}
CD3DX12_DXIL_LIBRARY_SUBOBJECT(CD3DX12_STATE_OBJECT_DESC& ContainingStateObject)
{
Init();
AddToStateObject(ContainingStateObject);
}
void SetDXILLibrary(const D3D12_SHADER_BYTECODE* pCode) noexcept
{
static const D3D12_SHADER_BYTECODE Default = {};
m_Desc.DXILLibrary = pCode ? *pCode : Default;
}
void DefineExport(
LPCWSTR Name,
LPCWSTR ExportToRename = nullptr,
D3D12_EXPORT_FLAGS Flags = D3D12_EXPORT_FLAG_NONE)
{
D3D12_EXPORT_DESC Export;
Export.Name = m_Strings.LocalCopy(Name);
Export.ExportToRename = m_Strings.LocalCopy(ExportToRename);
Export.Flags = Flags;
m_Exports.push_back(Export);
m_Desc.pExports = &m_Exports[0]; // using ugly way to get pointer in case .data() is not defined
m_Desc.NumExports = static_cast<UINT>(m_Exports.size());
}
template<size_t N>
void DefineExports(LPCWSTR(&Exports)[N])
{
for (UINT i = 0; i < N; i++)
{
DefineExport(Exports[i]);
}
}
void DefineExports(const LPCWSTR* Exports, UINT N)
{
for (UINT i = 0; i < N; i++)
{
DefineExport(Exports[i]);
}
}
D3D12_STATE_SUBOBJECT_TYPE Type() const noexcept override
{
return D3D12_STATE_SUBOBJECT_TYPE_DXIL_LIBRARY;
}
operator const D3D12_STATE_SUBOBJECT&() const noexcept { return *m_pSubobject; }
operator const D3D12_DXIL_LIBRARY_DESC&() const noexcept { return m_Desc; }
private:
void Init() noexcept
{
SUBOBJECT_HELPER_BASE::Init();
m_Desc = {};
m_Strings.clear();
m_Exports.clear();
}
void* Data() noexcept override { return &m_Desc; }
D3D12_DXIL_LIBRARY_DESC m_Desc;
CD3DX12_STATE_OBJECT_DESC::StringContainer m_Strings;
std::vector<D3D12_EXPORT_DESC> m_Exports;
};
//------------------------------------------------------------------------------------------------
class CD3DX12_EXISTING_COLLECTION_SUBOBJECT
: public CD3DX12_STATE_OBJECT_DESC::SUBOBJECT_HELPER_BASE
{
public:
CD3DX12_EXISTING_COLLECTION_SUBOBJECT() noexcept
{
Init();
}
CD3DX12_EXISTING_COLLECTION_SUBOBJECT(CD3DX12_STATE_OBJECT_DESC& ContainingStateObject)
{
Init();
AddToStateObject(ContainingStateObject);
}
void SetExistingCollection(ID3D12StateObject*pExistingCollection) noexcept
{
m_Desc.pExistingCollection = pExistingCollection;
m_CollectionRef = pExistingCollection;
}
void DefineExport(
LPCWSTR Name,
LPCWSTR ExportToRename = nullptr,
D3D12_EXPORT_FLAGS Flags = D3D12_EXPORT_FLAG_NONE)
{
D3D12_EXPORT_DESC Export;
Export.Name = m_Strings.LocalCopy(Name);
Export.ExportToRename = m_Strings.LocalCopy(ExportToRename);
Export.Flags = Flags;
m_Exports.push_back(Export);
m_Desc.pExports = &m_Exports[0]; // using ugly way to get pointer in case .data() is not defined
m_Desc.NumExports = static_cast<UINT>(m_Exports.size());
}
template<size_t N>
void DefineExports(LPCWSTR(&Exports)[N])
{
for (UINT i = 0; i < N; i++)
{
DefineExport(Exports[i]);
}
}
void DefineExports(const LPCWSTR* Exports, UINT N)
{
for (UINT i = 0; i < N; i++)
{
DefineExport(Exports[i]);
}
}
D3D12_STATE_SUBOBJECT_TYPE Type() const noexcept override
{
return D3D12_STATE_SUBOBJECT_TYPE_EXISTING_COLLECTION;
}
operator const D3D12_STATE_SUBOBJECT&() const noexcept { return *m_pSubobject; }
operator const D3D12_EXISTING_COLLECTION_DESC&() const noexcept { return m_Desc; }
private:
void Init() noexcept
{
SUBOBJECT_HELPER_BASE::Init();
m_Desc = {};
m_CollectionRef = nullptr;
m_Strings.clear();
m_Exports.clear();
}
void* Data() noexcept override { return &m_Desc; }
D3D12_EXISTING_COLLECTION_DESC m_Desc;
D3DX12_COM_PTR<ID3D12StateObject> m_CollectionRef;
CD3DX12_STATE_OBJECT_DESC::StringContainer m_Strings;
std::vector<D3D12_EXPORT_DESC> m_Exports;
};
//------------------------------------------------------------------------------------------------
class CD3DX12_SUBOBJECT_TO_EXPORTS_ASSOCIATION_SUBOBJECT
: public CD3DX12_STATE_OBJECT_DESC::SUBOBJECT_HELPER_BASE
{
public:
CD3DX12_SUBOBJECT_TO_EXPORTS_ASSOCIATION_SUBOBJECT() noexcept
{
Init();
}
CD3DX12_SUBOBJECT_TO_EXPORTS_ASSOCIATION_SUBOBJECT(CD3DX12_STATE_OBJECT_DESC& ContainingStateObject)
{
Init();
AddToStateObject(ContainingStateObject);
}
void SetSubobjectToAssociate(const D3D12_STATE_SUBOBJECT& SubobjectToAssociate) noexcept
{
m_Desc.pSubobjectToAssociate = &SubobjectToAssociate;
}
void AddExport(LPCWSTR Export)
{
m_Desc.NumExports++;
m_Exports.push_back(m_Strings.LocalCopy(Export));
m_Desc.pExports = &m_Exports[0]; // using ugly way to get pointer in case .data() is not defined
}
template<size_t N>
void AddExports(LPCWSTR (&Exports)[N])
{
for (UINT i = 0; i < N; i++)
{
AddExport(Exports[i]);
}
}
void AddExports(const LPCWSTR* Exports, UINT N)
{
for (UINT i = 0; i < N; i++)
{
AddExport(Exports[i]);
}
}
D3D12_STATE_SUBOBJECT_TYPE Type() const noexcept override
{
return D3D12_STATE_SUBOBJECT_TYPE_SUBOBJECT_TO_EXPORTS_ASSOCIATION;
}
operator const D3D12_STATE_SUBOBJECT&() const noexcept { return *m_pSubobject; }
operator const D3D12_SUBOBJECT_TO_EXPORTS_ASSOCIATION&() const noexcept { return m_Desc; }
private:
void Init() noexcept
{
SUBOBJECT_HELPER_BASE::Init();
m_Desc = {};
m_Strings.clear();
m_Exports.clear();
}
void* Data() noexcept override { return &m_Desc; }
D3D12_SUBOBJECT_TO_EXPORTS_ASSOCIATION m_Desc;
CD3DX12_STATE_OBJECT_DESC::StringContainer m_Strings;
std::vector<LPCWSTR> m_Exports;
};
//------------------------------------------------------------------------------------------------
class CD3DX12_DXIL_SUBOBJECT_TO_EXPORTS_ASSOCIATION
: public CD3DX12_STATE_OBJECT_DESC::SUBOBJECT_HELPER_BASE
{
public:
CD3DX12_DXIL_SUBOBJECT_TO_EXPORTS_ASSOCIATION() noexcept
{
Init();
}
CD3DX12_DXIL_SUBOBJECT_TO_EXPORTS_ASSOCIATION(CD3DX12_STATE_OBJECT_DESC& ContainingStateObject)
{
Init();
AddToStateObject(ContainingStateObject);
}
void SetSubobjectNameToAssociate(LPCWSTR SubobjectToAssociate)
{
m_Desc.SubobjectToAssociate = m_SubobjectName.LocalCopy(SubobjectToAssociate, true);
}
void AddExport(LPCWSTR Export)
{
m_Desc.NumExports++;
m_Exports.push_back(m_Strings.LocalCopy(Export));
m_Desc.pExports = &m_Exports[0]; // using ugly way to get pointer in case .data() is not defined
}
template<size_t N>
void AddExports(LPCWSTR (&Exports)[N])
{
for (UINT i = 0; i < N; i++)
{
AddExport(Exports[i]);
}
}
void AddExports(const LPCWSTR* Exports, UINT N)
{
for (UINT i = 0; i < N; i++)
{
AddExport(Exports[i]);
}
}
D3D12_STATE_SUBOBJECT_TYPE Type() const noexcept override
{
return D3D12_STATE_SUBOBJECT_TYPE_DXIL_SUBOBJECT_TO_EXPORTS_ASSOCIATION;
}
operator const D3D12_STATE_SUBOBJECT&() const noexcept { return *m_pSubobject; }
operator const D3D12_DXIL_SUBOBJECT_TO_EXPORTS_ASSOCIATION&() const noexcept { return m_Desc; }
private:
void Init() noexcept
{
SUBOBJECT_HELPER_BASE::Init();
m_Desc = {};
m_Strings.clear();
m_SubobjectName.clear();
m_Exports.clear();
}
void* Data() noexcept override { return &m_Desc; }
D3D12_DXIL_SUBOBJECT_TO_EXPORTS_ASSOCIATION m_Desc;
CD3DX12_STATE_OBJECT_DESC::StringContainer m_Strings;
CD3DX12_STATE_OBJECT_DESC::StringContainer m_SubobjectName;
std::vector<LPCWSTR> m_Exports;
};
//------------------------------------------------------------------------------------------------
class CD3DX12_HIT_GROUP_SUBOBJECT
: public CD3DX12_STATE_OBJECT_DESC::SUBOBJECT_HELPER_BASE
{
public:
CD3DX12_HIT_GROUP_SUBOBJECT() noexcept
{
Init();
}
CD3DX12_HIT_GROUP_SUBOBJECT(CD3DX12_STATE_OBJECT_DESC& ContainingStateObject)
{
Init();
AddToStateObject(ContainingStateObject);
}
void SetHitGroupExport(LPCWSTR exportName)
{
m_Desc.HitGroupExport = m_Strings[0].LocalCopy(exportName, true);
}
void SetHitGroupType(D3D12_HIT_GROUP_TYPE Type) noexcept { m_Desc.Type = Type; }
void SetAnyHitShaderImport(LPCWSTR importName)
{
m_Desc.AnyHitShaderImport = m_Strings[1].LocalCopy(importName, true);
}
void SetClosestHitShaderImport(LPCWSTR importName)
{
m_Desc.ClosestHitShaderImport = m_Strings[2].LocalCopy(importName, true);
}
void SetIntersectionShaderImport(LPCWSTR importName)
{
m_Desc.IntersectionShaderImport = m_Strings[3].LocalCopy(importName, true);
}
D3D12_STATE_SUBOBJECT_TYPE Type() const noexcept override
{
return D3D12_STATE_SUBOBJECT_TYPE_HIT_GROUP;
}
operator const D3D12_STATE_SUBOBJECT&() const noexcept { return *m_pSubobject; }
operator const D3D12_HIT_GROUP_DESC&() const noexcept { return m_Desc; }
private:
void Init() noexcept
{
SUBOBJECT_HELPER_BASE::Init();
m_Desc = {};
for (UINT i = 0; i < m_NumStrings; i++)
{
m_Strings[i].clear();
}
}
void* Data() noexcept override { return &m_Desc; }
D3D12_HIT_GROUP_DESC m_Desc;
static constexpr UINT m_NumStrings = 4;
CD3DX12_STATE_OBJECT_DESC::StringContainer
m_Strings[m_NumStrings]; // one string for every entrypoint name
};
//------------------------------------------------------------------------------------------------
class CD3DX12_RAYTRACING_SHADER_CONFIG_SUBOBJECT
: public CD3DX12_STATE_OBJECT_DESC::SUBOBJECT_HELPER_BASE
{
public:
CD3DX12_RAYTRACING_SHADER_CONFIG_SUBOBJECT() noexcept
{
Init();
}
CD3DX12_RAYTRACING_SHADER_CONFIG_SUBOBJECT(CD3DX12_STATE_OBJECT_DESC& ContainingStateObject)
{
Init();
AddToStateObject(ContainingStateObject);
}
void Config(UINT MaxPayloadSizeInBytes, UINT MaxAttributeSizeInBytes) noexcept
{
m_Desc.MaxPayloadSizeInBytes = MaxPayloadSizeInBytes;
m_Desc.MaxAttributeSizeInBytes = MaxAttributeSizeInBytes;
}
D3D12_STATE_SUBOBJECT_TYPE Type() const noexcept override
{
return D3D12_STATE_SUBOBJECT_TYPE_RAYTRACING_SHADER_CONFIG;
}
operator const D3D12_STATE_SUBOBJECT&() const noexcept { return *m_pSubobject; }
operator const D3D12_RAYTRACING_SHADER_CONFIG&() const noexcept { return m_Desc; }
private:
void Init() noexcept
{
SUBOBJECT_HELPER_BASE::Init();
m_Desc = {};
}
void* Data() noexcept override { return &m_Desc; }
D3D12_RAYTRACING_SHADER_CONFIG m_Desc;
};
//------------------------------------------------------------------------------------------------
class CD3DX12_RAYTRACING_PIPELINE_CONFIG_SUBOBJECT
: public CD3DX12_STATE_OBJECT_DESC::SUBOBJECT_HELPER_BASE
{
public:
CD3DX12_RAYTRACING_PIPELINE_CONFIG_SUBOBJECT() noexcept
{
Init();
}
CD3DX12_RAYTRACING_PIPELINE_CONFIG_SUBOBJECT(CD3DX12_STATE_OBJECT_DESC& ContainingStateObject)
{
Init();
AddToStateObject(ContainingStateObject);
}
void Config(UINT MaxTraceRecursionDepth) noexcept
{
m_Desc.MaxTraceRecursionDepth = MaxTraceRecursionDepth;
}
D3D12_STATE_SUBOBJECT_TYPE Type() const noexcept override
{
return D3D12_STATE_SUBOBJECT_TYPE_RAYTRACING_PIPELINE_CONFIG;
}
operator const D3D12_STATE_SUBOBJECT&() const noexcept { return *m_pSubobject; }
operator const D3D12_RAYTRACING_PIPELINE_CONFIG&() const noexcept { return m_Desc; }
private:
void Init() noexcept
{
SUBOBJECT_HELPER_BASE::Init();
m_Desc = {};
}
void* Data() noexcept override { return &m_Desc; }
D3D12_RAYTRACING_PIPELINE_CONFIG m_Desc;
};
//------------------------------------------------------------------------------------------------
class CD3DX12_RAYTRACING_PIPELINE_CONFIG1_SUBOBJECT
: public CD3DX12_STATE_OBJECT_DESC::SUBOBJECT_HELPER_BASE
{
public:
CD3DX12_RAYTRACING_PIPELINE_CONFIG1_SUBOBJECT() noexcept
{
Init();
}
CD3DX12_RAYTRACING_PIPELINE_CONFIG1_SUBOBJECT(CD3DX12_STATE_OBJECT_DESC& ContainingStateObject)
{
Init();
AddToStateObject(ContainingStateObject);
}
void Config(UINT MaxTraceRecursionDepth, D3D12_RAYTRACING_PIPELINE_FLAGS Flags) noexcept
{
m_Desc.MaxTraceRecursionDepth = MaxTraceRecursionDepth;
m_Desc.Flags = Flags;
}
D3D12_STATE_SUBOBJECT_TYPE Type() const noexcept override
{
return D3D12_STATE_SUBOBJECT_TYPE_RAYTRACING_PIPELINE_CONFIG1;
}
operator const D3D12_STATE_SUBOBJECT&() const noexcept { return *m_pSubobject; }
operator const D3D12_RAYTRACING_PIPELINE_CONFIG1&() const noexcept { return m_Desc; }
private:
void Init() noexcept
{
SUBOBJECT_HELPER_BASE::Init();
m_Desc = {};
}
void* Data() noexcept override { return &m_Desc; }
D3D12_RAYTRACING_PIPELINE_CONFIG1 m_Desc;
};
//------------------------------------------------------------------------------------------------
class CD3DX12_GLOBAL_ROOT_SIGNATURE_SUBOBJECT
: public CD3DX12_STATE_OBJECT_DESC::SUBOBJECT_HELPER_BASE
{
public:
CD3DX12_GLOBAL_ROOT_SIGNATURE_SUBOBJECT() noexcept
{
Init();
}
CD3DX12_GLOBAL_ROOT_SIGNATURE_SUBOBJECT(CD3DX12_STATE_OBJECT_DESC& ContainingStateObject)
{
Init();
AddToStateObject(ContainingStateObject);
}
void SetRootSignature(ID3D12RootSignature* pRootSig) noexcept
{
m_pRootSig = pRootSig;
}
D3D12_STATE_SUBOBJECT_TYPE Type() const noexcept override
{
return D3D12_STATE_SUBOBJECT_TYPE_GLOBAL_ROOT_SIGNATURE;
}
operator const D3D12_STATE_SUBOBJECT&() const noexcept { return *m_pSubobject; }
operator ID3D12RootSignature*() const noexcept { return D3DX12_COM_PTR_GET(m_pRootSig); }
private:
void Init() noexcept
{
SUBOBJECT_HELPER_BASE::Init();
m_pRootSig = nullptr;
}
void* Data() noexcept override { return D3DX12_COM_PTR_ADDRESSOF(m_pRootSig); }
D3DX12_COM_PTR<ID3D12RootSignature> m_pRootSig;
};
//------------------------------------------------------------------------------------------------
class CD3DX12_LOCAL_ROOT_SIGNATURE_SUBOBJECT
: public CD3DX12_STATE_OBJECT_DESC::SUBOBJECT_HELPER_BASE
{
public:
CD3DX12_LOCAL_ROOT_SIGNATURE_SUBOBJECT() noexcept
{
Init();
}
CD3DX12_LOCAL_ROOT_SIGNATURE_SUBOBJECT(CD3DX12_STATE_OBJECT_DESC& ContainingStateObject)
{
Init();
AddToStateObject(ContainingStateObject);
}
void SetRootSignature(ID3D12RootSignature* pRootSig) noexcept
{
m_pRootSig = pRootSig;
}
D3D12_STATE_SUBOBJECT_TYPE Type() const noexcept override
{
return D3D12_STATE_SUBOBJECT_TYPE_LOCAL_ROOT_SIGNATURE;
}
operator const D3D12_STATE_SUBOBJECT&() const noexcept { return *m_pSubobject; }
operator ID3D12RootSignature*() const noexcept { return D3DX12_COM_PTR_GET(m_pRootSig); }
private:
void Init() noexcept
{
SUBOBJECT_HELPER_BASE::Init();
m_pRootSig = nullptr;
}
void* Data() noexcept override { return D3DX12_COM_PTR_ADDRESSOF(m_pRootSig); }
D3DX12_COM_PTR<ID3D12RootSignature> m_pRootSig;
};
//------------------------------------------------------------------------------------------------
class CD3DX12_STATE_OBJECT_CONFIG_SUBOBJECT
: public CD3DX12_STATE_OBJECT_DESC::SUBOBJECT_HELPER_BASE
{
public:
CD3DX12_STATE_OBJECT_CONFIG_SUBOBJECT() noexcept
{
Init();
}
CD3DX12_STATE_OBJECT_CONFIG_SUBOBJECT(CD3DX12_STATE_OBJECT_DESC& ContainingStateObject)
{
Init();
AddToStateObject(ContainingStateObject);
}
void SetFlags(D3D12_STATE_OBJECT_FLAGS Flags) noexcept
{
m_Desc.Flags = Flags;
}
D3D12_STATE_SUBOBJECT_TYPE Type() const noexcept override
{
return D3D12_STATE_SUBOBJECT_TYPE_STATE_OBJECT_CONFIG;
}
operator const D3D12_STATE_SUBOBJECT&() const noexcept { return *m_pSubobject; }
operator const D3D12_STATE_OBJECT_CONFIG&() const noexcept { return m_Desc; }
private:
void Init() noexcept
{
SUBOBJECT_HELPER_BASE::Init();
m_Desc = {};
}
void* Data() noexcept override { return &m_Desc; }
D3D12_STATE_OBJECT_CONFIG m_Desc;
};
//------------------------------------------------------------------------------------------------
class CD3DX12_NODE_MASK_SUBOBJECT
: public CD3DX12_STATE_OBJECT_DESC::SUBOBJECT_HELPER_BASE
{
public:
CD3DX12_NODE_MASK_SUBOBJECT() noexcept
{
Init();
}
CD3DX12_NODE_MASK_SUBOBJECT(CD3DX12_STATE_OBJECT_DESC& ContainingStateObject)
{
Init();
AddToStateObject(ContainingStateObject);
}
void SetNodeMask(UINT NodeMask) noexcept
{
m_Desc.NodeMask = NodeMask;
}
D3D12_STATE_SUBOBJECT_TYPE Type() const noexcept override
{
return D3D12_STATE_SUBOBJECT_TYPE_NODE_MASK;
}
operator const D3D12_STATE_SUBOBJECT&() const noexcept { return *m_pSubobject; }
operator const D3D12_NODE_MASK&() const noexcept { return m_Desc; }
private:
void Init() noexcept
{
SUBOBJECT_HELPER_BASE::Init();
m_Desc = {};
}
void* Data() noexcept override { return &m_Desc; }
D3D12_NODE_MASK m_Desc;
};
#undef D3DX12_COM_PTR
#undef D3DX12_COM_PTR_GET
#undef D3DX12_COM_PTR_ADDRESSOF

View File

@ -3,6 +3,7 @@
// Licensed under the MIT license
//
import "ocidl.idl";
typedef struct DXGI_RATIONAL
{

View File

@ -22,29 +22,51 @@ constexpr inline bool ConstexprIsEqualGUID(REFGUID a, REFGUID b)
a.Data4[7] == b.Data4[7];
}
template <typename T> GUID uuidof() = delete;
template <typename T> GUID uuidof(T*) { return uuidof<T>(); }
template <typename T> GUID uuidof(T**) { return uuidof<T>(); }
template <typename T> GUID uuidof(T&) { return uuidof<T>(); }
// Each COM interface (e.g. ID3D12Device) has a unique interface ID (IID) associated with it. With MSVC, the IID is defined
// along with the interface declaration using compiler intrinsics (__declspec(uuid(...)); the IID can then be retrieved
// using __uuidof. These intrinsics are not supported with all toolchains, so these helpers redefine IID values that can be
// used with the various adapter COM helpers (ComPtr, IID_PPV_ARGS, etc.) for Linux. IIDs are stable and cannot change, but as
// a precaution we statically assert the values are as expected when compiling for Windows.
#ifdef _WIN32
// winadapter.h isn't included when building for Windows, so the base function template needs to be declared.
template <typename T> GUID uuidof() = delete;
#if defined(_MSC_VER)
#define _DXGUIDS_SUPPORT_STATIC_ASSERT_IID
#elif defined(__CRT_UUID_DECL)
/* match _mingw.h */
#if __cpp_constexpr >= 200704l && __cpp_inline_variables >= 201606L
#define _DXGUIDS_SUPPORT_STATIC_ASSERT_IID
#endif /* __cpp_constexpr >= 200704l && __cpp_inline_variables >= 201606L */
#endif /* _MSC_VER */
#ifdef _DXGUIDS_SUPPORT_STATIC_ASSERT_IID
#define _WINADAPTER_ASSERT_IID(InterfaceName) \
static_assert(ConstexprIsEqualGUID(uuidof<InterfaceName>(), __uuidof(InterfaceName)), "GUID definition mismatch: "#InterfaceName);
#else
#define _WINADAPTER_ASSERT_IID(InterfaceName)
#endif
#ifdef __CRT_UUID_DECL
#define WINADAPTER_IID(InterfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
template <> constexpr GUID uuidof<InterfaceName>() \
{ \
return { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }; \
} \
static_assert(ConstexprIsEqualGUID(uuidof<InterfaceName>(), __uuidof(InterfaceName)), "GUID definition mismatch: "#InterfaceName);
__CRT_UUID_DECL(InterfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
_WINADAPTER_ASSERT_IID(InterfaceName)
#else
#define WINADAPTER_IID(InterfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
template <> constexpr GUID uuidof<InterfaceName>() \
{ \
return { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }; \
}
#endif
} \
_WINADAPTER_ASSERT_IID(InterfaceName)
#endif /* defined(_WIN32) && defined(__MINGW32__) */
// Direct3D
#ifdef __d3d12_h__
WINADAPTER_IID(ID3D12Object, 0xc4fec28f, 0x7966, 0x4e95, 0x9f, 0x94, 0xf4, 0x31, 0xcb, 0x56, 0xc3, 0xb8);
WINADAPTER_IID(ID3D12DeviceChild, 0x905db94b, 0xa00c, 0x4140, 0x9d, 0xf5, 0x2b, 0x64, 0xca, 0x9e, 0xa3, 0x57);
WINADAPTER_IID(ID3D12RootSignature, 0xc54a6b66, 0x72df, 0x4ee8, 0x8b, 0xe5, 0xa9, 0x46, 0xa1, 0x42, 0x92, 0x14);
@ -82,8 +104,10 @@ WINADAPTER_IID(ID3D12StateObjectProperties, 0xde5fa827, 0x9bf9, 0x4f26, 0x89, 0x
WINADAPTER_IID(ID3D12Device5, 0x8b4f173b, 0x2fea, 0x4b80, 0x8f, 0x58, 0x43, 0x07, 0x19, 0x1a, 0xb9, 0x5d);
WINADAPTER_IID(ID3D12DeviceRemovedExtendedDataSettings, 0x82BC481C, 0x6B9B, 0x4030, 0xAE, 0xDB, 0x7E, 0xE3, 0xD1, 0xDF, 0x1E, 0x63);
WINADAPTER_IID(ID3D12DeviceRemovedExtendedDataSettings1, 0xDBD5AE51, 0x3317, 0x4F0A, 0xAD, 0xF9, 0x1D, 0x7C, 0xED, 0xCA, 0xAE, 0x0B);
WINADAPTER_IID(ID3D12DeviceRemovedExtendedDataSettings2, 0x61552388, 0x01ab, 0x4008, 0xa4, 0x36, 0x83, 0xdb, 0x18, 0x95, 0x66, 0xea);
WINADAPTER_IID(ID3D12DeviceRemovedExtendedData, 0x98931D33, 0x5AE8, 0x4791, 0xAA, 0x3C, 0x1A, 0x73, 0xA2, 0x93, 0x4E, 0x71);
WINADAPTER_IID(ID3D12DeviceRemovedExtendedData1, 0x9727A022, 0xCF1D, 0x4DDA, 0x9E, 0xBA, 0xEF, 0xFA, 0x65, 0x3F, 0xC5, 0x06);
WINADAPTER_IID(ID3D12DeviceRemovedExtendedData2, 0x67FC5816, 0xE4CA, 0x4915, 0xBF, 0x18, 0x42, 0x54, 0x12, 0x72, 0xDA, 0x54);
WINADAPTER_IID(ID3D12Device6, 0xc70b221b, 0x40e4, 0x4a17, 0x89, 0xaf, 0x02, 0x5a, 0x07, 0x27, 0xa6, 0xdc);
WINADAPTER_IID(ID3D12ProtectedResourceSession1, 0xD6F12DD6, 0x76FB, 0x406E, 0x89, 0x61, 0x42, 0x96, 0xEE, 0xFC, 0x04, 0x09);
WINADAPTER_IID(ID3D12Device7, 0x5c014b53, 0x68a1, 0x4b9b, 0x8b, 0xd1, 0xdd, 0x60, 0x46, 0xb9, 0x35, 0x8b);
@ -96,10 +120,50 @@ WINADAPTER_IID(ID3D12MetaCommand, 0xDBB84C27, 0x36CE, 0x4FC9, 0xB8, 0x01, 0xF0,
WINADAPTER_IID(ID3D12GraphicsCommandList4, 0x8754318e, 0xd3a9, 0x4541, 0x98, 0xcf, 0x64, 0x5b, 0x50, 0xdc, 0x48, 0x74);
WINADAPTER_IID(ID3D12ShaderCacheSession, 0x28e2495d, 0x0f64, 0x4ae4, 0xa6, 0xec, 0x12, 0x92, 0x55, 0xdc, 0x49, 0xa8);
WINADAPTER_IID(ID3D12Device9, 0x4c80e962, 0xf032, 0x4f60, 0xbc, 0x9e, 0xeb, 0xc2, 0xcf, 0xa1, 0xd8, 0x3c);
WINADAPTER_IID(ID3D12Device10, 0x517f8718, 0xaa66, 0x49f9, 0xb0, 0x2b, 0xa7, 0xab, 0x89, 0xc0, 0x60, 0x31);
WINADAPTER_IID(ID3D12Device11, 0x5405c344, 0xd457, 0x444e, 0xb4, 0xdd, 0x23, 0x66, 0xe4, 0x5a, 0xee, 0x39);
WINADAPTER_IID(ID3D12VirtualizationGuestDevice, 0xbc66d368, 0x7373, 0x4943, 0x87, 0x57, 0xfc, 0x87, 0xdc, 0x79, 0xe4, 0x76);
WINADAPTER_IID(ID3D12Tools, 0x7071e1f0, 0xe84b, 0x4b33, 0x97, 0x4f, 0x12, 0xfa, 0x49, 0xde, 0x65, 0xc5);
WINADAPTER_IID(ID3D12SDKConfiguration, 0xe9eb5314, 0x33aa, 0x42b2, 0xa7, 0x18, 0xd7, 0x7f, 0x58, 0xb1, 0xf1, 0xc7);
WINADAPTER_IID(ID3D12SDKConfiguration1, 0x8aaf9303, 0xad25, 0x48b9, 0x9a, 0x57, 0xd9, 0xc3, 0x7e, 0x00, 0x9d, 0x9f);
WINADAPTER_IID(ID3D12DeviceFactory, 0x61f307d3, 0xd34e, 0x4e7c, 0x83, 0x74, 0x3b, 0xa4, 0xde, 0x23, 0xcc, 0xcb);
WINADAPTER_IID(ID3D12DeviceConfiguration, 0x78dbf87b, 0xf766, 0x422b, 0xa6, 0x1c, 0xc8, 0xc4, 0x46, 0xbd, 0xb9, 0xad);
WINADAPTER_IID(ID3D12GraphicsCommandList5, 0x55050859, 0x4024, 0x474c, 0x87, 0xf5, 0x64, 0x72, 0xea, 0xee, 0x44, 0xea);
WINADAPTER_IID(ID3D12GraphicsCommandList6, 0xc3827890, 0xe548, 0x4cfa, 0x96, 0xcf, 0x56, 0x89, 0xa9, 0x37, 0x0f, 0x80);
WINADAPTER_IID(ID3D12GraphicsCommandList7, 0xdd171223, 0x8b61, 0x4769, 0x90, 0xe3, 0x16, 0x0c, 0xcd, 0xe4, 0xe2, 0xc1);
WINADAPTER_IID(ID3D12GraphicsCommandList8, 0xee936ef9, 0x599d, 0x4d28, 0x93, 0x8e, 0x23, 0xc4, 0xad, 0x05, 0xce, 0x51);
#endif
// Direct3D Video
#ifdef __d3d12video_h__
WINADAPTER_IID(ID3D12VideoDecoderHeap,0x0946B7C9,0xEBF6,0x4047,0xBB,0x73,0x86,0x83,0xE2,0x7D,0xBB,0x1F);
WINADAPTER_IID(ID3D12VideoDevice,0x1F052807,0x0B46,0x4ACC,0x8A,0x89,0x36,0x4F,0x79,0x37,0x18,0xA4);
WINADAPTER_IID(ID3D12VideoDecoder,0xC59B6BDC,0x7720,0x4074,0xA1,0x36,0x17,0xA1,0x56,0x03,0x74,0x70);
WINADAPTER_IID(ID3D12VideoProcessor,0x304FDB32,0xBEDE,0x410A,0x85,0x45,0x94,0x3A,0xC6,0xA4,0x61,0x38);
WINADAPTER_IID(ID3D12VideoDecodeCommandList,0x3B60536E,0xAD29,0x4E64,0xA2,0x69,0xF8,0x53,0x83,0x7E,0x5E,0x53);
WINADAPTER_IID(ID3D12VideoProcessCommandList,0xAEB2543A,0x167F,0x4682,0xAC,0xC8,0xD1,0x59,0xED,0x4A,0x62,0x09);
WINADAPTER_IID(ID3D12VideoDecodeCommandList1,0xD52F011B,0xB56E,0x453C,0xA0,0x5A,0xA7,0xF3,0x11,0xC8,0xF4,0x72);
WINADAPTER_IID(ID3D12VideoProcessCommandList1,0x542C5C4D,0x7596,0x434F,0x8C,0x93,0x4E,0xFA,0x67,0x66,0xF2,0x67);
WINADAPTER_IID(ID3D12VideoMotionEstimator,0x33FDAE0E,0x098B,0x428F,0x87,0xBB,0x34,0xB6,0x95,0xDE,0x08,0xF8);
WINADAPTER_IID(ID3D12VideoMotionVectorHeap,0x5BE17987,0x743A,0x4061,0x83,0x4B,0x23,0xD2,0x2D,0xAE,0xA5,0x05);
WINADAPTER_IID(ID3D12VideoDevice1,0x981611AD,0xA144,0x4C83,0x98,0x90,0xF3,0x0E,0x26,0xD6,0x58,0xAB);
WINADAPTER_IID(ID3D12VideoEncodeCommandList,0x8455293A,0x0CBD,0x4831,0x9B,0x39,0xFB,0xDB,0xAB,0x72,0x47,0x23);
WINADAPTER_IID(ID3D12VideoDecoder1,0x79A2E5FB,0xCCD2,0x469A,0x9F,0xDE,0x19,0x5D,0x10,0x95,0x1F,0x7E);
WINADAPTER_IID(ID3D12VideoDecoderHeap1,0xDA1D98C5,0x539F,0x41B2,0xBF,0x6B,0x11,0x98,0xA0,0x3B,0x6D,0x26);
WINADAPTER_IID(ID3D12VideoProcessor1,0xF3CFE615,0x553F,0x425C,0x86,0xD8,0xEE,0x8C,0x1B,0x1F,0xB0,0x1C);
WINADAPTER_IID(ID3D12VideoExtensionCommand,0x554E41E8,0xAE8E,0x4A8C,0xB7,0xD2,0x5B,0x4F,0x27,0x4A,0x30,0xE4);
WINADAPTER_IID(ID3D12VideoDevice2,0xF019AC49,0xF838,0x4A95,0x9B,0x17,0x57,0x94,0x37,0xC8,0xF5,0x13);
WINADAPTER_IID(ID3D12VideoDecodeCommandList2,0x6e120880,0xc114,0x4153,0x80,0x36,0xd2,0x47,0x05,0x1e,0x17,0x29);
WINADAPTER_IID(ID3D12VideoDecodeCommandList3,0x2aee8c37,0x9562,0x42da,0x8a,0xbf,0x61,0xef,0xeb,0x2e,0x45,0x13);
WINADAPTER_IID(ID3D12VideoProcessCommandList2,0xdb525ae4,0x6ad6,0x473c,0xba,0xa7,0x59,0xb2,0xe3,0x70,0x82,0xe4);
WINADAPTER_IID(ID3D12VideoProcessCommandList3,0x1a0a4ca4,0x9f08,0x40ce,0x95,0x58,0xb4,0x11,0xfd,0x26,0x66,0xff);
WINADAPTER_IID(ID3D12VideoEncodeCommandList1,0x94971eca,0x2bdb,0x4769,0x88,0xcf,0x36,0x75,0xea,0x75,0x7e,0xbc);
WINADAPTER_IID(ID3D12VideoEncoder,0x2E0D212D,0x8DF9,0x44A6,0xA7,0x70,0xBB,0x28,0x9B,0x18,0x27,0x37);
WINADAPTER_IID(ID3D12VideoEncoderHeap,0x22B35D96,0x876A,0x44C0,0xB2,0x5E,0xFB,0x8C,0x9C,0x7F,0x1C,0x4A);
WINADAPTER_IID(ID3D12VideoDevice3,0x4243ADB4,0x3A32,0x4666,0x97,0x3C,0x0C,0xCC,0x56,0x25,0xDC,0x44);
WINADAPTER_IID(ID3D12VideoEncodeCommandList2,0x895491e2,0xe701,0x46a9,0x9a,0x1f,0x8d,0x34,0x80,0xed,0x86,0x7a);
WINADAPTER_IID(ID3D12VideoEncodeCommandList3,0x7f027b22,0x1515,0x4e85,0xaa,0x0d,0x02,0x64,0x86,0x58,0x05,0x76);
#endif
#ifdef __d3d12sdklayers_h__
WINADAPTER_IID(ID3D12Debug, 0x344488b7, 0x6846, 0x474b, 0xb9, 0x89, 0xf0, 0x27, 0x44, 0x82, 0x45, 0xe0);
@ -107,15 +171,20 @@ WINADAPTER_IID(ID3D12Debug1, 0xaffaa4ca, 0x63fe, 0x4d8e, 0xb8, 0xad, 0x15, 0x90,
WINADAPTER_IID(ID3D12Debug2, 0x93a665c4, 0xa3b2, 0x4e5d, 0xb6, 0x92, 0xa2, 0x6a, 0xe1, 0x4e, 0x33, 0x74);
WINADAPTER_IID(ID3D12Debug3, 0x5cf4e58f, 0xf671, 0x4ff1, 0xa5, 0x42, 0x36, 0x86, 0xe3, 0xd1, 0x53, 0xd1);
WINADAPTER_IID(ID3D12Debug4, 0x014b816e, 0x9ec5, 0x4a2f, 0xa8, 0x45, 0xff, 0xbe, 0x44, 0x1c, 0xe1, 0x3a);
WINADAPTER_IID(ID3D12Debug5, 0x548d6b12, 0x09fa, 0x40e0, 0x90, 0x69, 0x5d, 0xcd, 0x58, 0x9a, 0x52, 0xc9);
WINADAPTER_IID(ID3D12Debug6, 0x82a816d6, 0x5d01, 0x4157, 0x97, 0xd0, 0x49, 0x75, 0x46, 0x3f, 0xd1, 0xed);
WINADAPTER_IID(ID3D12DebugDevice1, 0xa9b71770, 0xd099, 0x4a65, 0xa6, 0x98, 0x3d, 0xee, 0x10, 0x02, 0x0f, 0x88);
WINADAPTER_IID(ID3D12DebugDevice, 0x3febd6dd, 0x4973, 0x4787, 0x81, 0x94, 0xe4, 0x5f, 0x9e, 0x28, 0x92, 0x3e);
WINADAPTER_IID(ID3D12DebugDevice2, 0x60eccbc1, 0x378d, 0x4df1, 0x89, 0x4c, 0xf8, 0xac, 0x5c, 0xe4, 0xd7, 0xdd);
WINADAPTER_IID(ID3D12DebugCommandQueue, 0x09e0bf36, 0x54ac, 0x484f, 0x88, 0x47, 0x4b, 0xae, 0xea, 0xb6, 0x05, 0x3a);
WINADAPTER_IID(ID3D12DebugCommandQueue1, 0x16be35a2, 0xbfd6, 0x49f2, 0xbc, 0xae, 0xea, 0xae, 0x4a, 0xff, 0x86, 0x2d);
WINADAPTER_IID(ID3D12DebugCommandList1, 0x102ca951, 0x311b, 0x4b01, 0xb1, 0x1f, 0xec, 0xb8, 0x3e, 0x06, 0x1b, 0x37);
WINADAPTER_IID(ID3D12DebugCommandList, 0x09e0bf36, 0x54ac, 0x484f, 0x88, 0x47, 0x4b, 0xae, 0xea, 0xb6, 0x05, 0x3f);
WINADAPTER_IID(ID3D12DebugCommandList2, 0xaeb575cf, 0x4e06, 0x48be, 0xba, 0x3b, 0xc4, 0x50, 0xfc, 0x96, 0x65, 0x2e);
WINADAPTER_IID(ID3D12DebugCommandList3, 0x197d5e15, 0x4d37, 0x4d34, 0xaf, 0x78, 0x72, 0x4c, 0xd7, 0x0f, 0xdb, 0x1f);
WINADAPTER_IID(ID3D12SharingContract, 0x0adf7d52, 0x929c, 0x4e61, 0xad, 0xdb, 0xff, 0xed, 0x30, 0xde, 0x66, 0xef);
WINADAPTER_IID(ID3D12InfoQueue, 0x0742a90b, 0xc387, 0x483f, 0xb9, 0x46, 0x30, 0xa7, 0xe4, 0xe6, 0x14, 0x58);
WINADAPTER_IID(ID3D12InfoQueue1, 0x2852dd88, 0xb484, 0x4c0c, 0xb6, 0xb1, 0x67, 0x16, 0x85, 0x00, 0xe6, 0x00);
#endif
// DXCore

406
include/wsl/stubs/basetsd.h Normal file
View File

@ -0,0 +1,406 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#pragma once
// These #defines prevent the idl-generated headers from trying to include
// Windows.h from the SDK rather than this one.
#define RPC_NO_WINDOWS_H
#define COM_NO_WINDOWS_H
// Allcaps type definitions
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <limits.h>
// Note: using fixed-width here to match Windows widths
// Specifically this is different for 'long' vs 'LONG'
typedef uint8_t UINT8;
typedef int8_t INT8;
typedef uint16_t UINT16;
typedef int16_t INT16;
typedef uint32_t UINT32, UINT, ULONG, DWORD, BOOL, WINBOOL;
typedef int32_t INT32, INT, LONG;
typedef uint64_t UINT64, ULONG_PTR;
typedef int64_t INT64, LONG_PTR;
typedef void VOID, *HANDLE, *RPC_IF_HANDLE, *LPVOID;
typedef const void *LPCVOID;
typedef size_t SIZE_T;
typedef float FLOAT;
typedef double DOUBLE;
typedef unsigned char BYTE;
typedef int HWND;
typedef int PALETTEENTRY;
typedef int HDC;
typedef uint16_t WORD;
typedef void* PVOID;
typedef char BOOLEAN;
typedef uint64_t ULONGLONG;
typedef uint16_t USHORT, *PUSHORT;
typedef int64_t LONGLONG, *PLONGLONG;
typedef int64_t LONG_PTR, *PLONG_PTR;
typedef int64_t LONG64, *PLONG64;
typedef uint64_t ULONG64, *PULONG64;
typedef wchar_t WCHAR, *PWSTR;
typedef uint8_t UCHAR, *PUCHAR;
typedef uint64_t ULONG_PTR, *PULONG_PTR;
typedef uint64_t UINT_PTR, *PUINT_PTR;
typedef int64_t INT_PTR, *PINT_PTR;
// Note: WCHAR is not the same between Windows and Linux, to enable
// string manipulation APIs to work with resulting strings.
// APIs to D3D/DXCore will work on Linux wchars, but beware with
// interactions directly with the Windows kernel.
typedef char CHAR, *PSTR, *LPSTR, TCHAR, *PTSTR;
typedef const char *LPCSTR, *PCSTR, *LPCTSTR, *PCTSTR;
typedef wchar_t WCHAR, *PWSTR, *LPWSTR, *PWCHAR;
typedef const wchar_t *LPCWSTR, *PCWSTR;
#undef LONG_MAX
#define LONG_MAX INT_MAX
#undef ULONG_MAX
#define ULONG_MAX UINT_MAX
// Misc defines
#define MIDL_INTERFACE(x) interface
#define __analysis_assume(x)
#define TRUE 1u
#define FALSE 0u
#define DECLSPEC_UUID(x)
#define DECLSPEC_NOVTABLE
#define DECLSPEC_SELECTANY
#ifdef __cplusplus
#define EXTERN_C extern "C"
#else
#define EXTERN_C extern
#endif
#define APIENTRY
#define OUT
#define IN
#define CONST const
#define MAX_PATH 260
#define GENERIC_ALL 0x10000000L
#define C_ASSERT(expr) static_assert((expr))
#define _countof(a) (sizeof(a) / sizeof(*(a)))
typedef struct tagRECTL
{
LONG left;
LONG top;
LONG right;
LONG bottom;
} RECTL;
typedef struct tagPOINT
{
int x;
int y;
} POINT;
typedef struct _GUID {
uint32_t Data1;
uint16_t Data2;
uint16_t Data3;
uint8_t Data4[ 8 ];
} GUID;
#ifdef INITGUID
#ifdef __cplusplus
#define DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) EXTERN_C const GUID DECLSPEC_SELECTANY name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
#else
#define DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) const GUID DECLSPEC_SELECTANY name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
#endif
#else
#define DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) EXTERN_C const GUID name
#endif
typedef GUID IID;
typedef GUID UUID;
typedef GUID CLSID;
#ifdef __cplusplus
#define REFGUID const GUID &
#define REFIID const IID &
#define REFCLSID const IID &
__inline int InlineIsEqualGUID(REFGUID rguid1, REFGUID rguid2)
{
return (
((uint32_t *)&rguid1)[0] == ((uint32_t *)&rguid2)[0] &&
((uint32_t *)&rguid1)[1] == ((uint32_t *)&rguid2)[1] &&
((uint32_t *)&rguid1)[2] == ((uint32_t *)&rguid2)[2] &&
((uint32_t *)&rguid1)[3] == ((uint32_t *)&rguid2)[3]);
}
inline bool operator==(REFGUID guidOne, REFGUID guidOther)
{
return !!InlineIsEqualGUID(guidOne, guidOther);
}
inline bool operator!=(REFGUID guidOne, REFGUID guidOther)
{
return !(guidOne == guidOther);
}
#else
#define REFGUID const GUID *
#define REFIID const IID *
#define REFCLSID const IID *
#endif
// SAL annotations
#define _In_
#define _In_z_
#define _In_opt_
#define _In_opt_z_
#define _In_reads_(x)
#define _In_reads_opt_(x)
#define _In_reads_bytes_(x)
#define _In_reads_bytes_opt_(x)
#define _In_range_(x, y)
#define _In_bytecount_(x)
#define _Out_
#define _Out_opt_
#define _Outptr_
#define _Outptr_opt_result_z_
#define _Outptr_opt_result_bytebuffer_(x)
#define _COM_Outptr_
#define _COM_Outptr_result_maybenull_
#define _COM_Outptr_opt_
#define _COM_Outptr_opt_result_maybenull_
#define _Out_writes_(x)
#define _Out_writes_z_(x)
#define _Out_writes_opt_(x)
#define _Out_writes_all_(x)
#define _Out_writes_all_opt_(x)
#define _Out_writes_to_opt_(x, y)
#define _Out_writes_bytes_(x)
#define _Out_writes_bytes_all_(x)
#define _Out_writes_bytes_all_opt_(x)
#define _Out_writes_bytes_opt_(x)
#define _Inout_
#define _Inout_opt_
#define _Inout_updates_(x)
#define _Inout_updates_bytes_(x)
#define _Field_size_(x)
#define _Field_size_opt_(x)
#define _Field_size_bytes_(x)
#define _Field_size_full_(x)
#define _Field_size_full_opt_(x)
#define _Field_size_bytes_full_(x)
#define _Field_size_bytes_full_opt_(x)
#define _Field_size_bytes_part_(x, y)
#define _Field_range_(x, y)
#define _Field_z_
#define _Check_return_
#define _IRQL_requires_(x)
#define _IRQL_requires_min_(x)
#define _IRQL_requires_max_(x)
#define _At_(x, y)
#define _Always_(x)
#define _Return_type_success_(x)
#define _Translates_Win32_to_HRESULT_(x)
#define _Maybenull_
#define _Outptr_result_maybenull_
#define _Outptr_result_nullonfailure_
#define _Analysis_assume_(x)
#define _Success_(x)
#define _In_count_(x)
#define _In_opt_count_(x)
#define _Use_decl_annotations_
#define _Null_terminated_
// Calling conventions
#define __cdecl
#define __stdcall
#define STDMETHODCALLTYPE
#define STDAPICALLTYPE
#define STDAPI EXTERN_C HRESULT STDAPICALLTYPE
#define WINAPI
#define interface struct
#if defined (__cplusplus) && !defined (CINTERFACE)
#define STDMETHOD(method) virtual HRESULT STDMETHODCALLTYPE method
#define STDMETHOD_(type, method) virtual type STDMETHODCALLTYPE method
#define PURE = 0
#define THIS_
#define THIS void
#define DECLARE_INTERFACE(iface) interface DECLSPEC_NOVTABLE iface
#define DECLARE_INTERFACE_(iface, baseiface) interface DECLSPEC_NOVTABLE iface : public baseiface
interface IUnknown;
extern "C++"
{
template<typename T> void** IID_PPV_ARGS_Helper(T** pp)
{
(void)static_cast<IUnknown*>(*pp);
return reinterpret_cast<void**>(pp);
}
}
#define IID_PPV_ARGS(ppType) __uuidof (**(ppType)), IID_PPV_ARGS_Helper (ppType)
#else
#define STDMETHOD(method) HRESULT (STDMETHODCALLTYPE *method)
#define STDMETHOD_(type, method) type (STDMETHODCALLTYPE *method)
#define PURE
#define THIS_ INTERFACE *This,
#define THIS INTERFACE *This
#ifdef CONST_VTABLE
#define DECLARE_INTERFACE(iface) typedef interface iface { const struct iface##Vtbl *lpVtbl; } iface; typedef const struct iface##Vtbl iface##Vtbl; const struct iface##Vtbl
#else
#define DECLARE_INTERFACE(iface) typedef interface iface { struct iface##Vtbl *lpVtbl; } iface; typedef struct iface##Vtbl iface##Vtbl; struct iface##Vtbl
#endif
#define DECLARE_INTERFACE_(iface, baseiface) DECLARE_INTERFACE (iface)
#endif
#define IFACEMETHOD(method) /*override*/ STDMETHOD (method)
#define IFACEMETHOD_(type, method) /*override*/ STDMETHOD_(type, method)
#ifndef BEGIN_INTERFACE
#define BEGIN_INTERFACE
#define END_INTERFACE
#endif
// Error codes
typedef LONG HRESULT;
#define SUCCEEDED(hr) (((HRESULT)(hr)) >= 0)
#define FAILED(hr) (((HRESULT)(hr)) < 0)
#define S_OK ((HRESULT)0L)
#define S_FALSE ((HRESULT)1L)
#define E_NOTIMPL ((HRESULT)0x80004001L)
#define E_OUTOFMEMORY ((HRESULT)0x8007000EL)
#define E_INVALIDARG ((HRESULT)0x80070057L)
#define E_NOINTERFACE ((HRESULT)0x80004002L)
#define E_POINTER ((HRESULT)0x80004003L)
#define E_HANDLE ((HRESULT)0x80070006L)
#define E_ABORT ((HRESULT)0x80004004L)
#define E_FAIL ((HRESULT)0x80004005L)
#define E_ACCESSDENIED ((HRESULT)0x80070005L)
#define E_UNEXPECTED ((HRESULT)0x8000FFFFL)
#define DXGI_ERROR_INVALID_CALL ((HRESULT)0x887A0001L)
#define DXGI_ERROR_NOT_FOUND ((HRESULT)0x887A0002L)
#define DXGI_ERROR_MORE_DATA ((HRESULT)0x887A0003L)
#define DXGI_ERROR_UNSUPPORTED ((HRESULT)0x887A0004L)
#define DXGI_ERROR_DEVICE_REMOVED ((HRESULT)0x887A0005L)
#define DXGI_ERROR_DEVICE_HUNG ((HRESULT)0x887A0006L)
#define DXGI_ERROR_DEVICE_RESET ((HRESULT)0x887A0007L)
#define DXGI_ERROR_DRIVER_INTERNAL_ERROR ((HRESULT)0x887A0020L)
#define DXGI_ERROR_SDK_COMPONENT_MISSING ((HRESULT)0x887A002DL)
typedef struct _LUID
{
ULONG LowPart;
LONG HighPart;
} LUID;
typedef struct _RECT
{
int left;
int top;
int right;
int bottom;
} RECT;
typedef union _LARGE_INTEGER {
struct {
uint32_t LowPart;
uint32_t HighPart;
} u;
int64_t QuadPart;
} LARGE_INTEGER;
typedef LARGE_INTEGER *PLARGE_INTEGER;
typedef union _ULARGE_INTEGER {
struct {
uint32_t LowPart;
uint32_t HighPart;
} u;
uint64_t QuadPart;
} ULARGE_INTEGER;
typedef ULARGE_INTEGER *PULARGE_INTEGER;
#define DECLARE_HANDLE(name) \
struct name##__ { \
int unused; \
}; \
typedef struct name##__ *name
typedef struct _SECURITY_ATTRIBUTES {
DWORD nLength;
LPVOID lpSecurityDescriptor;
WINBOOL bInheritHandle;
} SECURITY_ATTRIBUTES;
struct STATSTG;
#ifdef __cplusplus
// ENUM_FLAG_OPERATORS
// Define operator overloads to enable bit operations on enum values that are
// used to define flags. Use DEFINE_ENUM_FLAG_OPERATORS(YOUR_TYPE) to enable these
// operators on YOUR_TYPE.
extern "C++" {
template <size_t S>
struct _ENUM_FLAG_INTEGER_FOR_SIZE;
template <>
struct _ENUM_FLAG_INTEGER_FOR_SIZE<1>
{
typedef int8_t type;
};
template <>
struct _ENUM_FLAG_INTEGER_FOR_SIZE<2>
{
typedef int16_t type;
};
template <>
struct _ENUM_FLAG_INTEGER_FOR_SIZE<4>
{
typedef int32_t type;
};
template <>
struct _ENUM_FLAG_INTEGER_FOR_SIZE<8>
{
typedef int64_t type;
};
// used as an approximation of std::underlying_type<T>
template <class T>
struct _ENUM_FLAG_SIZED_INTEGER
{
typedef typename _ENUM_FLAG_INTEGER_FOR_SIZE<sizeof(T)>::type type;
};
}
#define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) \
extern "C++" { \
inline constexpr ENUMTYPE operator | (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)a) | ((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)b)); } \
inline ENUMTYPE &operator |= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type &)a) |= ((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)b)); } \
inline constexpr ENUMTYPE operator & (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)a) & ((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)b)); } \
inline ENUMTYPE &operator &= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type &)a) &= ((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)b)); } \
inline constexpr ENUMTYPE operator ~ (ENUMTYPE a) { return ENUMTYPE(~((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)a)); } \
inline constexpr ENUMTYPE operator ^ (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)a) ^ ((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)b)); } \
inline ENUMTYPE &operator ^= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type &)a) ^= ((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)b)); } \
}
#else
#define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) /* */
#endif
// D3DX12 uses these
#include <stdlib.h>
#define HeapAlloc(heap, flags, size) malloc(size)
#define HeapFree(heap, flags, ptr) free(ptr)
#if defined(lint)
// Note: lint -e530 says don't complain about uninitialized variables for
// this variable. Error 527 has to do with unreachable code.
// -restore restores checking to the -save state
#define UNREFERENCED_PARAMETER(P) \
/*lint -save -e527 -e530 */ \
{ \
(P) = (P); \
} \
/*lint -restore */
#else
#define UNREFERENCED_PARAMETER(P) (P)
#endif

View File

@ -3,4 +3,76 @@
// Stub header to satisfy d3d12.h include
#pragma once
#include "basetsd.h"
#define __RPCNDR_H_VERSION__
#ifdef CONST_VTABLE
#define CONST_VTBL const
#else
#define CONST_VTBL
#endif
/* Macros for __uuidof template-based emulation */
#if defined(__cplusplus)
#if __cpp_constexpr >= 200704l && __cpp_inline_variables >= 201606L
#define __wsl_stub_uuidof_use_constexpr 1
#else
#define __wsl_stub_uuidof_use_constexpr 0
#endif
#ifndef __GNUC__
#error "Only support for compilers that support for `GNU C++ extension`"
#endif
extern "C++" {
#if __wsl_stub_uuidof_use_constexpr
__extension__ template<typename T> struct __wsl_stub_uuidof_s;
__extension__ template<typename T> constexpr const GUID &__wsl_stub_uuidof();
#else
__extension__ template<typename T> const GUID &__wsl_stub_uuidof();
#endif
}
#if __wsl_stub_uuidof_use_constexpr
#define __CRT_UUID_DECL(type, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
extern "C++" \
{ \
template <> \
struct __wsl_stub_uuidof_s<type> \
{ \
static constexpr IID __uuid_inst = { \
l, w1, w2, {b1, b2, b3, b4, b5, b6, b7, b8}}; \
}; \
template <> \
constexpr const GUID &__wsl_stub_uuidof<type>() \
{ \
return __wsl_stub_uuidof_s<type>::__uuid_inst; \
} \
template <> \
constexpr const GUID &__wsl_stub_uuidof<type *>() \
{ \
return __wsl_stub_uuidof_s<type>::__uuid_inst; \
} \
}
#else
#define __CRT_UUID_DECL(type, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
extern "C++" \
{ \
template <> \
inline const GUID &__wsl_stub_uuidof<type>() \
{ \
static const IID __uuid_inst = { \
l, w1, w2, {b1, b2, b3, b4, b5, b6, b7, b8}}; \
return __uuid_inst; \
} \
template <> \
inline const GUID &__wsl_stub_uuidof<type *>() \
{ \
return __wsl_stub_uuidof<type>(); \
} \
}
#endif
#define __uuidof(type) __wsl_stub_uuidof<__typeof(type)>()
#else
#define __CRT_UUID_DECL(type, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)
#endif

View File

@ -0,0 +1,3 @@
#pragma once
#include "unknwnbase.h"

View File

@ -0,0 +1,124 @@
/*-------------------------------------------------------------------------------------
*
* Copyright (c) Microsoft Corporation
* Licensed under the MIT license
*
*-------------------------------------------------------------------------------------*/
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 8.01.0627 */
/* verify that the <rpcndr.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCNDR_H_VERSION__
#define __REQUIRED_RPCNDR_H_VERSION__ 500
#endif
/* verify that the <rpcsal.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCSAL_H_VERSION__
#define __REQUIRED_RPCSAL_H_VERSION__ 100
#endif
#include "rpc.h"
#include "rpcndr.h"
#ifndef __RPCNDR_H_VERSION__
#error this stub requires an updated version of <rpcndr.h>
#endif /* __RPCNDR_H_VERSION__ */
#ifndef COM_NO_WINDOWS_H
#include "windows.h"
#include "ole2.h"
#endif /*COM_NO_WINDOWS_H*/
#ifndef __unknwnbase_h__
#define __unknwnbase_h__
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif
/* Forward Declarations */
#ifndef __IUnknown_FWD_DEFINED__
#define __IUnknown_FWD_DEFINED__
typedef interface IUnknown IUnknown;
#endif /* __IUnknown_FWD_DEFINED__ */
#ifndef __IUnknown_INTERFACE_DEFINED__
#define __IUnknown_INTERFACE_DEFINED__
/* interface IUnknown */
/* [unique][uuid][object][local] */
typedef /* [unique] */ IUnknown *LPUNKNOWN;
EXTERN_C const IID IID_IUnknown;
#if defined(__cplusplus) && !defined(CINTERFACE)
extern "C++"
{
MIDL_INTERFACE("00000000-0000-0000-c000-000000000046")
IUnknown
{
BEGIN_INTERFACE
virtual HRESULT STDMETHODCALLTYPE QueryInterface(
REFIID riid,
void **ppvObject) = 0;
virtual ULONG STDMETHODCALLTYPE AddRef() = 0;
virtual ULONG STDMETHODCALLTYPE Release() = 0;
template <class Q>
HRESULT
STDMETHODCALLTYPE
QueryInterface(_COM_Outptr_ Q * *pp)
{
return QueryInterface(__uuidof(Q), (void **)pp);
}
END_INTERFACE
};
}
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IUnknown, 0x00000000, 0x0000, 0x0000, 0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46)
#endif
#else
typedef struct IUnknownVtbl {
BEGIN_INTERFACE
/*** IUnknown methods ***/
HRESULT (STDMETHODCALLTYPE *QueryInterface)(
IUnknown *This,
REFIID riid,
void **ppvObject);
ULONG (STDMETHODCALLTYPE *AddRef)(
IUnknown *This);
ULONG (STDMETHODCALLTYPE *Release)(
IUnknown *This);
END_INTERFACE
} IUnknownVtbl;
interface IUnknown {
CONST_VTBL IUnknownVtbl* lpVtbl;
};
#ifdef COBJMACROS
/*** IUnknown methods ***/
#define IUnknown_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IUnknown_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IUnknown_Release(This) (This)->lpVtbl->Release(This)
#endif
#endif
#endif /* __IUnknown_INTERFACE_DEFINED__ */
DEFINE_GUID(IID_IUnknown, 0x00000000, 0x0000, 0x0000, 0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46);
#endif /* __unknwnbase_h__ */

View File

@ -3,4 +3,4 @@
// Stub to satisfy d3dx12.h include
#pragma once
#include "../wrladapter.h"
#include <wsl/wrladapter.h>

View File

@ -3,4 +3,4 @@
// Stub to satisfy DML TF runtime includes
#pragma once
#include "wrladapter.h"
#include <wsl/wrladapter.h>

View File

@ -3,402 +3,4 @@
#pragma once
// These #defines prevent the idl-generated headers from trying to include
// Windows.h from the SDK rather than this one.
#define RPC_NO_WINDOWS_H
#define COM_NO_WINDOWS_H
// Allcaps type definitions
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <limits.h>
// Note: using fixed-width here to match Windows widths
// Specifically this is different for 'long' vs 'LONG'
typedef uint8_t UINT8;
typedef int8_t INT8;
typedef uint16_t UINT16;
typedef int16_t INT16;
typedef uint32_t UINT32, UINT, ULONG, DWORD, BOOL;
typedef int32_t INT32, INT, LONG;
typedef uint64_t UINT64, ULONG_PTR;
typedef int64_t INT64, LONG_PTR;
typedef void VOID, *HANDLE, *RPC_IF_HANDLE, *LPVOID;
typedef const void *LPCVOID;
typedef size_t SIZE_T;
typedef float FLOAT;
typedef double DOUBLE;
typedef unsigned char BYTE;
typedef int HWND;
typedef int PALETTEENTRY;
typedef int HDC;
typedef uint16_t WORD;
typedef void* PVOID;
typedef char BOOLEAN;
typedef uint64_t ULONGLONG;
typedef uint16_t USHORT, *PUSHORT;
typedef int64_t LONGLONG, *PLONGLONG;
typedef int64_t LONG_PTR, *PLONG_PTR;
typedef int64_t LONG64, *PLONG64;
typedef uint64_t ULONG64, *PULONG64;
typedef wchar_t WCHAR, *PWSTR;
typedef uint8_t UCHAR, *PUCHAR;
typedef uint64_t ULONG_PTR, *PULONG_PTR;
typedef uint64_t UINT_PTR, *PUINT_PTR;
typedef int64_t INT_PTR, *PINT_PTR;
// Note: WCHAR is not the same between Windows and Linux, to enable
// string manipulation APIs to work with resulting strings.
// APIs to D3D/DXCore will work on Linux wchars, but beware with
// interactions directly with the Windows kernel.
typedef char CHAR, *PSTR, *LPSTR, TCHAR, *PTSTR;
typedef const char *LPCSTR, *PCSTR, *LPCTSTR, *PCTSTR;
typedef wchar_t WCHAR, *PWSTR, *LPWSTR, *PWCHAR;
typedef const wchar_t *LPCWSTR, *PCWSTR;
#undef LONG_MAX
#define LONG_MAX INT_MAX
#undef ULONG_MAX
#define ULONG_MAX UINT_MAX
// Misc defines
#define interface struct
#define MIDL_INTERFACE(x) interface
#define __analysis_assume(x)
#define TRUE 1u
#define FALSE 0u
#define DECLARE_INTERFACE(iface) interface iface
#define PURE = 0
#define THIS_
#define DECLSPEC_UUID(x)
#define DECLSPEC_NOVTABLE
#define DECLSPEC_SELECTANY
#ifdef __cplusplus
#define EXTERN_C extern "C"
#else
#define EXTERN_C
#endif
#define APIENTRY
#define OUT
#define IN
#define CONST const
#define MAX_PATH 260
#define GENERIC_ALL 0x10000000L
#define C_ASSERT(expr) static_assert((expr))
#define _countof(a) (sizeof(a) / sizeof(*(a)))
typedef struct tagRECTL
{
LONG left;
LONG top;
LONG right;
LONG bottom;
} RECTL;
typedef struct tagPOINT
{
int x;
int y;
} POINT;
typedef struct _GUID {
uint32_t Data1;
uint16_t Data2;
uint16_t Data3;
uint8_t Data4[ 8 ];
} GUID;
#ifdef __cplusplus
#ifdef INITGUID
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) extern "C" const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
#else
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) extern "C" const GUID name
#endif
template <typename T> GUID uuidof() = delete;
template <typename T> GUID uuidof(T*) { return uuidof<T>(); }
template <typename T> GUID uuidof(T**) { return uuidof<T>(); }
template <typename T> GUID uuidof(T&) { return uuidof<T>(); }
#define __uuidof(x) uuidof(x)
#else
#ifdef INITGUID
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
#else
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) extern const GUID name
#endif
#endif
typedef GUID IID;
typedef GUID UUID;
typedef GUID CLSID;
#ifdef __cplusplus
#define REFGUID const GUID &
#define REFIID const IID &
#define REFCLSID const IID &
__inline int InlineIsEqualGUID(REFGUID rguid1, REFGUID rguid2)
{
return (
((uint32_t *)&rguid1)[0] == ((uint32_t *)&rguid2)[0] &&
((uint32_t *)&rguid1)[1] == ((uint32_t *)&rguid2)[1] &&
((uint32_t *)&rguid1)[2] == ((uint32_t *)&rguid2)[2] &&
((uint32_t *)&rguid1)[3] == ((uint32_t *)&rguid2)[3]);
}
inline bool operator==(REFGUID guidOne, REFGUID guidOther)
{
return !!InlineIsEqualGUID(guidOne, guidOther);
}
inline bool operator!=(REFGUID guidOne, REFGUID guidOther)
{
return !(guidOne == guidOther);
}
#else
#define REFGUID const GUID *
#define REFIID const IID *
#define REFCLSID const IID *
#endif
// SAL annotations
#define _In_
#define _In_z_
#define _In_opt_
#define _In_opt_z_
#define _In_reads_(x)
#define _In_reads_opt_(x)
#define _In_reads_bytes_(x)
#define _In_reads_bytes_opt_(x)
#define _In_range_(x, y)
#define _In_bytecount_(x)
#define _Out_
#define _Out_opt_
#define _Outptr_
#define _Outptr_opt_result_z_
#define _Outptr_opt_result_bytebuffer_(x)
#define _COM_Outptr_
#define _COM_Outptr_result_maybenull_
#define _COM_Outptr_opt_
#define _COM_Outptr_opt_result_maybenull_
#define _Out_writes_(x)
#define _Out_writes_z_(x)
#define _Out_writes_opt_(x)
#define _Out_writes_all_(x)
#define _Out_writes_all_opt_(x)
#define _Out_writes_to_opt_(x, y)
#define _Out_writes_bytes_(x)
#define _Out_writes_bytes_all_(x)
#define _Out_writes_bytes_all_opt_(x)
#define _Out_writes_bytes_opt_(x)
#define _Inout_
#define _Inout_opt_
#define _Inout_updates_(x)
#define _Inout_updates_bytes_(x)
#define _Field_size_(x)
#define _Field_size_opt_(x)
#define _Field_size_bytes_(x)
#define _Field_size_full_(x)
#define _Field_size_bytes_full_(x)
#define _Field_size_bytes_full_opt_(x)
#define _Field_size_bytes_part_(x, y)
#define _Field_range_(x, y)
#define _Field_z_
#define _Check_return_
#define _IRQL_requires_(x)
#define _IRQL_requires_min_(x)
#define _IRQL_requires_max_(x)
#define _At_(x, y)
#define _Always_(x)
#define _Return_type_success_(x)
#define _Translates_Win32_to_HRESULT_(x)
#define _Maybenull_
#define _Outptr_result_maybenull_
#define _Outptr_result_nullonfailure_
#define _Analysis_assume_(x)
#define _Success_(x)
#define _In_count_(x)
#define _In_opt_count_(x)
#define _Use_decl_annotations_
// Calling conventions
#define __cdecl
#define __stdcall
#define STDMETHODCALLTYPE
#define STDAPICALLTYPE
#define STDAPI extern "C" HRESULT STDAPICALLTYPE
#define WINAPI
#define STDMETHOD(name) virtual HRESULT name
#define STDMETHOD_(type,name) virtual type name
#define IFACEMETHOD(method) /*__override*/ STDMETHOD(method)
#define IFACEMETHOD_(type, method) /*__override*/ STDMETHOD_(type, method)
// Error codes
typedef LONG HRESULT;
#define SUCCEEDED(hr) (((HRESULT)(hr)) >= 0)
#define FAILED(hr) (((HRESULT)(hr)) < 0)
#define S_OK ((HRESULT)0L)
#define S_FALSE ((HRESULT)1L)
#define E_NOTIMPL ((HRESULT)0x80004001L)
#define E_OUTOFMEMORY ((HRESULT)0x8007000EL)
#define E_INVALIDARG ((HRESULT)0x80070057L)
#define E_NOINTERFACE ((HRESULT)0x80004002L)
#define E_POINTER ((HRESULT)0x80004003L)
#define E_HANDLE ((HRESULT)0x80070006L)
#define E_ABORT ((HRESULT)0x80004004L)
#define E_FAIL ((HRESULT)0x80004005L)
#define E_ACCESSDENIED ((HRESULT)0x80070005L)
#define E_UNEXPECTED ((HRESULT)0x8000FFFFL)
#define DXGI_ERROR_INVALID_CALL ((HRESULT)0x887A0001L)
#define DXGI_ERROR_NOT_FOUND ((HRESULT)0x887A0002L)
#define DXGI_ERROR_MORE_DATA ((HRESULT)0x887A0003L)
#define DXGI_ERROR_UNSUPPORTED ((HRESULT)0x887A0004L)
#define DXGI_ERROR_DEVICE_REMOVED ((HRESULT)0x887A0005L)
#define DXGI_ERROR_DEVICE_HUNG ((HRESULT)0x887A0006L)
#define DXGI_ERROR_DEVICE_RESET ((HRESULT)0x887A0007L)
#define DXGI_ERROR_DRIVER_INTERNAL_ERROR ((HRESULT)0x887A0020L)
typedef struct _LUID
{
ULONG LowPart;
LONG HighPart;
} LUID;
typedef struct _RECT
{
int left;
int top;
int right;
int bottom;
} RECT;
typedef union _LARGE_INTEGER {
struct {
uint32_t LowPart;
uint32_t HighPart;
} u;
int64_t QuadPart;
} LARGE_INTEGER;
typedef LARGE_INTEGER *PLARGE_INTEGER;
typedef union _ULARGE_INTEGER {
struct {
uint32_t LowPart;
uint32_t HighPart;
} u;
uint64_t QuadPart;
} ULARGE_INTEGER;
typedef ULARGE_INTEGER *PULARGE_INTEGER;
#define DECLARE_HANDLE(name) \
struct name##__ { \
int unused; \
}; \
typedef struct name##__ *name
struct SECURITY_ATTRIBUTES;
struct STATSTG;
#ifdef __cplusplus
// ENUM_FLAG_OPERATORS
// Define operator overloads to enable bit operations on enum values that are
// used to define flags. Use DEFINE_ENUM_FLAG_OPERATORS(YOUR_TYPE) to enable these
// operators on YOUR_TYPE.
extern "C++" {
template <size_t S>
struct _ENUM_FLAG_INTEGER_FOR_SIZE;
template <>
struct _ENUM_FLAG_INTEGER_FOR_SIZE<1>
{
typedef int8_t type;
};
template <>
struct _ENUM_FLAG_INTEGER_FOR_SIZE<2>
{
typedef int16_t type;
};
template <>
struct _ENUM_FLAG_INTEGER_FOR_SIZE<4>
{
typedef int32_t type;
};
template <>
struct _ENUM_FLAG_INTEGER_FOR_SIZE<8>
{
typedef int64_t type;
};
// used as an approximation of std::underlying_type<T>
template <class T>
struct _ENUM_FLAG_SIZED_INTEGER
{
typedef typename _ENUM_FLAG_INTEGER_FOR_SIZE<sizeof(T)>::type type;
};
}
#define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) \
extern "C++" { \
inline constexpr ENUMTYPE operator | (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)a) | ((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)b)); } \
inline ENUMTYPE &operator |= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type &)a) |= ((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)b)); } \
inline constexpr ENUMTYPE operator & (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)a) & ((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)b)); } \
inline ENUMTYPE &operator &= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type &)a) &= ((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)b)); } \
inline constexpr ENUMTYPE operator ~ (ENUMTYPE a) { return ENUMTYPE(~((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)a)); } \
inline constexpr ENUMTYPE operator ^ (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)a) ^ ((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)b)); } \
inline ENUMTYPE &operator ^= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type &)a) ^= ((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)b)); } \
}
#endif
// D3DX12 uses these
#include <stdlib.h>
#define HeapAlloc(heap, flags, size) malloc(size)
#define HeapFree(heap, flags, ptr) free(ptr)
#ifdef __cplusplus
// IUnknown
interface DECLSPEC_UUID("00000000-0000-0000-C000-000000000046") DECLSPEC_NOVTABLE IUnknown
{
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject) = 0;
virtual ULONG STDMETHODCALLTYPE AddRef() = 0;
virtual ULONG STDMETHODCALLTYPE Release() = 0;
template <class Q> HRESULT STDMETHODCALLTYPE QueryInterface(Q** pp) {
return QueryInterface(uuidof<Q>(), (void **)pp);
}
};
template <> constexpr GUID uuidof<IUnknown>()
{
return { 0x00000000, 0x0000, 0x0000, { 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 } };
}
extern "C++"
{
template<typename T> void** IID_PPV_ARGS_Helper(T** pp)
{
static_cast<IUnknown*>(*pp);
return reinterpret_cast<void**>(pp);
}
}
#define IID_PPV_ARGS(ppType) __uuidof(**(ppType)), IID_PPV_ARGS_Helper(ppType)
#endif
#if defined(lint)
// Note: lint -e530 says don't complain about uninitialized variables for
// this variable. Error 527 has to do with unreachable code.
// -restore restores checking to the -save state
#define UNREFERENCED_PARAMETER(P) \
/*lint -save -e527 -e530 */ \
{ \
(P) = (P); \
} \
/*lint -restore */
#else
#define UNREFERENCED_PARAMETER(P) (P)
#endif
#include <unknwn.h>

View File

@ -320,7 +320,7 @@ namespace WRL
(std::is_same<T, IUnknown>::value)
&& !std::is_same<U*, T*>::value, void *>::type * = 0) const throw()
{
return ptr_->QueryInterface(uuidof<U>(), ptr);
return ptr_->QueryInterface(__uuidof(U), ptr);
}
HRESULT CopyTo(_Outptr_result_maybenull_ InterfaceType** ptr) const throw()
@ -338,21 +338,21 @@ namespace WRL
template<typename U>
HRESULT CopyTo(_Outptr_result_nullonfailure_ U** ptr) const throw()
{
return ptr_->QueryInterface(uuidof<U>(), reinterpret_cast<void**>(ptr));
return ptr_->QueryInterface(__uuidof(U), reinterpret_cast<void**>(ptr));
}
// query for U interface
template<typename U>
HRESULT As(_Inout_ Details::ComPtrRef<ComPtr<U>> p) const throw()
{
return ptr_->QueryInterface(uuidof<U>(), p);
return ptr_->QueryInterface(__uuidof(U), p);
}
// query for U interface
template<typename U>
HRESULT As(_Out_ ComPtr<U>* p) const throw()
{
return ptr_->QueryInterface(uuidof<U>(), reinterpret_cast<void**>(p->ReleaseAndGetAddressOf()));
return ptr_->QueryInterface(__uuidof(U), reinterpret_cast<void**>(p->ReleaseAndGetAddressOf()));
}
// query for riid interface and return as IUnknown
@ -385,7 +385,7 @@ namespace WRL
*ppvObject = nullptr;
bool isRefDelegated = false;
// Prefer InlineIsEqualGUID over other forms since it's better perf on 4-byte aligned data, which is almost always the case.
if (InlineIsEqualGUID(riid, uuidof<IUnknown>()))
if (InlineIsEqualGUID(riid, __uuidof(IUnknown)))
{
*ppvObject = implements->CastToUnknown();
static_cast<IUnknown*>(*ppvObject)->AddRef();
@ -439,7 +439,7 @@ namespace WRL
static bool CanCastTo(_In_ T* ptr, REFIID riid, _Outptr_ void **ppv) noexcept
{
// Prefer InlineIsEqualGUID over other forms since it's better perf on 4-byte aligned data, which is almost always the case.
if (InlineIsEqualGUID(riid, uuidof<Base>()))
if (InlineIsEqualGUID(riid, __uuidof(Base)))
{
*ppv = static_cast<Base*>(ptr);
return true;
@ -553,7 +553,7 @@ namespace WRL
HRESULT CanCastTo(REFIID riid, _Outptr_ void **ppv, bool *pRefDelegated = nullptr) noexcept
{
// Prefer InlineIsEqualGUID over other forms since it's better perf on 4-byte aligned data, which is almost always the case.
if (InlineIsEqualGUID(riid, uuidof<I0>()))
if (InlineIsEqualGUID(riid, __uuidof(I0)))
{
*ppv = reinterpret_cast<I0*>(reinterpret_cast<void*>(this));
return S_OK;

View File

@ -1,7 +1,7 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
project('DirectX-Headers', 'cpp', version : '1.4.9',
project('DirectX-Headers', 'cpp', version : '1.608.2',
default_options : ['cpp_std=c++14'])
inc_dirs = [include_directories('include', is_system : true)]
@ -12,10 +12,15 @@ if host_machine.system() != 'windows'
install_inc_subdirs += ['', 'wsl/stubs', 'directx']
endif
format_properties_lib = static_library(
'd3dx12-format-properties',
'src/d3dx12_property_format_table.cpp',
include_directories : [inc_dirs, 'include/directx'],
install : true)
guids_lib = static_library('DirectX-Guids', 'src/dxguids.cpp', include_directories : inc_dirs, install : true)
dep_dxheaders = declare_dependency(
link_with : guids_lib,
link_with : [format_properties_lib, guids_lib],
include_directories : inc_dirs)
if meson.version().version_compare('>=0.54.0')
@ -29,7 +34,7 @@ endif
pkg = import('pkgconfig')
pkg.generate(name : 'DirectX-Headers',
description : 'Headers for using D3D12',
libraries : [guids_lib],
libraries : [format_properties_lib, guids_lib],
version : meson.project_version(),
subdirs : install_inc_subdirs)
install_subdir('include', install_dir : '')

File diff suppressed because it is too large Load Diff

View File

@ -4,9 +4,8 @@
// This file's sole purpose is to initialize the GUIDs declared using the DEFINE_GUID macro.
#define INITGUID
#ifndef _WIN32
#include <wsl/winadapter.h>
#endif
#include <directx/dxcore.h>
#include <directx/d3d12.h>
#include <directx/d3d12video.h>

View File

@ -1,9 +1,52 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
project(DirectX-Headers-Test CXX)
list(APPEND dxlibs "")
# Check if in WSL and if has DirectX driver and runtime
if(EXISTS "/usr/lib/wsl/lib/")
find_library(libd3d12 d3d12 HINTS /usr/lib/wsl/lib)
find_library(libdxcore dxcore HINTS /usr/lib/wsl/lib)
list(APPEND dxlibs ${libd3d12} ${libdxcore})
else()
# Fallback to default: let CMake look for libs
list(APPEND dxlibs d3d12)
if (MSVC)
# MINGW doesn't have dxcore yet
list(APPEND dxlibs dxcore)
endif()
endif()
project(DirectX-Headers-Test
DESCRIPTION "DirectX-Header test"
HOMEPAGE_URL "https://github.com/microsoft/DirectX-Headers/"
LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(TEST_EXES DirectX-Headers-Test DirectX-Headers-Check-Feature-Support-Test)
add_executable(DirectX-Headers-Test test.cpp)
target_link_libraries(DirectX-Headers-Test DirectX-Headers DirectX-Guids d3d12 dxcore)
add_executable(DirectX-Headers-Check-Feature-Support-Test feature_check_test.cpp)
target_link_libraries(DirectX-Headers-Check-Feature-Support-Test DirectX-Headers DirectX-Guids d3d12 dxcore)
foreach(t IN LISTS TEST_EXES)
target_link_libraries(${t} DirectX-Headers DirectX-Guids ${dxlibs})
endforeach()
if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang|IntelLLVM" )
target_compile_options(DirectX-Headers-Check-Feature-Support-Test PRIVATE -Wno-unused-variable)
endif()
if(WIN32)
foreach(t IN LISTS TEST_EXES)
target_compile_definitions(${t} PRIVATE _UNICODE UNICODE _WIN32_WINNT=0x0A00)
endforeach()
if(WINDOWS_STORE)
foreach(t IN LISTS TEST_EXES)
target_compile_definitions(${t} PRIVATE WINAPI_FAMILY=WINAPI_FAMILY_APP)
endforeach()
endif()
endif()

View File

@ -1,9 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#ifndef _WIN32
#include <wsl/winadapter.h>
#endif
#include <iostream>
#include <directx/d3d12.h>
@ -94,14 +92,44 @@ std::cout << "Verification failed: " << #FeatureName << std::endl \
<< "New API: " << NewFeature << std::endl;
using namespace Microsoft::WRL;
// To get property value from adapter
std::vector<char> get_adapter_property(ComPtr<IDXCoreAdapter> adapter, DXCoreAdapterProperty property)
{
if (adapter->IsPropertySupported(property))
{
size_t len;
if(FAILED(adapter->GetPropertySize(property, &len)))
{
return {};
}
std::vector<char> buf(len);
if(FAILED(adapter->GetProperty(property, len, buf.data())))
{
return {};
}
return buf;
}
return {};
}
// To get driver description for display before test
std::string get_driver_description(ComPtr<IDXCoreAdapter> adapter)
{
auto rs = get_adapter_property(adapter, DXCoreAdapterProperty::DriverDescription);
std::string name(rs.data());
return name;
}
// -----------------------------------------------------------------------------------------------------------------
// Main function
// Run tests on a specific device which is created from the input adapter
// -----------------------------------------------------------------------------------------------------------------
int main()
int run_per_adapter(IUnknown* adapter)
{
ID3D12Device *device = nullptr;
if (FAILED(D3D12CreateDevice(nullptr, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&device))))
if (FAILED(D3D12CreateDevice(adapter, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&device))))
{
return -1;
}
@ -369,7 +397,7 @@ int main()
D3D12_FEATURE_DATA_SHADER_CACHE Data;
INITIALIZE_FEATURE_SUPPORT_DATA(SHADER_CACHE);
VERIFY_RENAMED_FEATURE_CHECK(ShaderCacheSupportFlags, SupportFlags, D3D12_SHADER_CACHE_FLAG_NONE);
VERIFY_RENAMED_FEATURE_CHECK(ShaderCacheSupportFlags, SupportFlags, D3D12_SHADER_CACHE_SUPPORT_NONE);
}
// 20: Command Queue Prioirity
@ -619,6 +647,81 @@ int main()
VERIFY_FEATURE_CHECK(AtomicInt64OnDescriptorHeapResourceSupported, false);
}
// 41: Options12
{
D3D12_TRI_STATE MSPrimitivesPipelineStatisticIncludesCulledPrimitives = features.MSPrimitivesPipelineStatisticIncludesCulledPrimitives();
BOOL EnhancedBarriersSupported = features.EnhancedBarriersSupported();
D3D12_FEATURE_DATA_D3D12_OPTIONS12 Data;
INITIALIZE_FEATURE_SUPPORT_DATA(D3D12_OPTIONS12);
VERIFY_FEATURE_CHECK(MSPrimitivesPipelineStatisticIncludesCulledPrimitives, D3D12_TRI_STATE_UNKNOWN);
VERIFY_FEATURE_CHECK(EnhancedBarriersSupported, false);
VERIFY_FEATURE_CHECK(RelaxedFormatCastingSupported, false);
}
// 41: Options13
{
D3D12_FEATURE_DATA_D3D12_OPTIONS13 Data;
INITIALIZE_FEATURE_SUPPORT_DATA(D3D12_OPTIONS13);
VERIFY_FEATURE_CHECK(UnrestrictedBufferTextureCopyPitchSupported, false);
VERIFY_FEATURE_CHECK(UnrestrictedVertexElementAlignmentSupported, false);
VERIFY_FEATURE_CHECK(InvertedViewportHeightFlipsYSupported, false);
VERIFY_FEATURE_CHECK(InvertedViewportDepthFlipsZSupported, false);
VERIFY_FEATURE_CHECK(TextureCopyBetweenDimensionsSupported, false);
VERIFY_FEATURE_CHECK(AlphaBlendFactorSupported, false);
}
std::cout << "Test completed with no errors." << std::endl;
return 0;
}
#ifdef __MINGW32__
STDAPI
DXCoreCreateAdapterFactory(
REFIID riid,
_COM_Outptr_ void** ppvFactory
) {
return 0;
}
#endif
int main()
{
ComPtr<IDXCoreAdapterFactory> adapter_factory;
ComPtr<IDXCoreAdapterList> adapter_list;
GUID dx_must_attr[1]{ DXCORE_ADAPTER_ATTRIBUTE_D3D12_CORE_COMPUTE };
if(FAILED(DXCoreCreateAdapterFactory(IID_PPV_ARGS(&adapter_factory))))
{
return -1;
}
if(FAILED(adapter_factory->CreateAdapterList(_countof(dx_must_attr), dx_must_attr, IID_PPV_ARGS(&adapter_list))))
{
return -1;
}
// Test all adapters
for (uint32_t i = 0; i < adapter_list->GetAdapterCount(); i++)
{
ComPtr<IDXCoreAdapter> adapter;
if(FAILED(adapter_list->GetAdapter(i, IID_PPV_ARGS(&adapter))))
{
std::cout << "Cannot get number " << i << " adapter." << std::endl;
continue;
}
std::string driver_desc_str = get_driver_description(adapter);
if(driver_desc_str.empty())
{
std::cout << "Cannot get number " << i << " adapter's driver description." << std::endl;
}
std::cout << "Test on device driver: " << driver_desc_str << std::endl;
if(FAILED(run_per_adapter(adapter.Get())))
{
std::cout << "Some tests failed with error on number " << i << " adapter." << std::endl;
}
}
return 0;
}

View File

@ -1,9 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#ifndef _WIN32
#include <wsl/winadapter.h>
#endif
#include <directx/d3d12.h>
#include <directx/d3d12video.h>
@ -11,11 +9,26 @@
#include <directx/d3dx12.h>
#include "dxguids/dxguids.h"
#ifdef __MINGW32__
STDAPI
DXCoreCreateAdapterFactory(
REFIID riid,
_COM_Outptr_ void** ppvFactory
) {
return 0;
}
#endif
int check_uuid_linkage() {
auto uuid_i_unknown = IID_IUnknown;
return sizeof(uuid_i_unknown);
}
int main()
{
IDXCoreAdapter *adapter = nullptr;
ID3D12Device *device = nullptr;
check_uuid_linkage();
{
IDXCoreAdapterFactory *factory = nullptr;
if (FAILED(DXCoreCreateAdapterFactory(&factory)))