Import Upstream version 1.600.10

This commit is contained in:
denghao 2023-03-27 17:30:09 +08:00
commit fd3de63396
54 changed files with 61429 additions and 0 deletions

1
.pc/.quilt_patches Normal file
View File

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

1
.pc/.quilt_series Normal file
View File

@ -0,0 +1 @@
series

1
.pc/.version Normal file
View File

@ -0,0 +1 @@
2

0
.pc/applied-patches Normal file
View File

14
Android.bp Normal file
View File

@ -0,0 +1,14 @@
cc_library_headers {
name: "DirectX-Headers",
export_include_dirs: ["include", "include/wsl/stubs"],
vendor_available: true,
}
cc_library_static {
name: "DirectX-Guids",
header_libs: ["DirectX-Headers"],
local_include_dirs: ["include/dxguids"],
srcs: ["src/dxguids.cpp"],
cppflags: ["-Wno-non-virtual-dtor", "-Wno-unused-value"],
vendor_available: true,
}

92
CMakeLists.txt Normal file
View File

@ -0,0 +1,92 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
cmake_minimum_required(VERSION 3.10.2)
project(DirectX-Headers
LANGUAGES CXX
VERSION 1.4.9
)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# It's useful to know if you are a top level project or not, if your project is
# being consumed via add_subdirectory
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
set(IS_TOPLEVEL_PROJECT TRUE)
else()
set(IS_TOPLEVEL_PROJECT FALSE)
endif()
# Use DXHEADERS_* prefix to avoid potential name conflicts in cmake-gui, and allow
# grouping by prefix if more options are added
#
# Testing should only be enabled by default if we are top level. Otherwise clients can set it
# either via cmake or cmake-gui
option(DXHEADERS_BUILD_TEST "Build the test" ${IS_TOPLEVEL_PROJECT})
option(DXHEADERS_INSTALL "Installation logic" ${IS_TOPLEVEL_PROJECT})
option(DXHEADERS_BUILD_GOOGLE_TEST "Build the google test suite" ${IS_TOPLEVEL_PROJECT})
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
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)
# For non-Windows targets, also add the WSL stubs to the include path
if (NOT WIN32)
target_include_directories(DirectX-Headers SYSTEM INTERFACE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/wsl/stubs>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/wsl/stubs>"
)
endif()
add_library(Microsoft::DirectX-Headers ALIAS DirectX-Headers)
add_library(DirectX-Guids STATIC src/dxguids.cpp)
target_link_libraries(DirectX-Guids PRIVATE DirectX-Headers)
add_library(Microsoft::DirectX-Guids ALIAS DirectX-Guids)
if (DXHEADERS_INSTALL)
# Install the targets
install(TARGETS DirectX-Headers DirectX-Guids
EXPORT DirectX-Headers-Targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
# Create the targets CMake file which contains the above definitions
install(EXPORT DirectX-Headers-Targets FILE directx-headers-targets.cmake
NAMESPACE Microsoft::
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/directx-headers/cmake)
# Install the actual includes
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
# Create the CMake config files
include(CMakePackageConfigHelpers)
write_basic_package_version_file("directx-headers-config-version.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion)
configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/directx-headers-config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/directx-headers-config.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/directx-headers/cmake)
# Install the CMake config files
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/directx-headers-config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/directx-headers-config-version.cmake"
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/directx-headers/cmake)
endif()
if (DXHEADERS_BUILD_TEST)
add_subdirectory(test)
endif()
if (DXHEADERS_BUILD_GOOGLE_TEST)
add_subdirectory(googletest)
endif()

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
Copyright (c) Microsoft Corporation.
MIT License
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.

63
README.md Normal file
View File

@ -0,0 +1,63 @@
# DirectX Headers
This repository hosts the official Direct3D 12 headers. These headers are made available under the MIT license rather than the traditional Windows SDK license.
Additionally, this repository hosts several helpers for using these headers.
Make sure that you visit the [DirectX Landing Page](https://devblogs.microsoft.com/directx/landing-page/) for more resources for DirectX developers.
## Directory Structure
* `/`: Build files are available here for quick integration. CMake is provided, and can be referenced either via `subdirectory()` or after installation to a system location. Meson is also available for inclusion as a subproject/wrap.
* `/include/directx`: These files are the core headers for using D3D12, plus d3dx12.h, which is a helper and does not cross the boundaries of the D3D12 API.
* `/include/wsl`: These files are provided as a shim to be able to include the D3D12 headers from a Linux build environment, without requiring the rest of the Windows SDK.
* `/include/dxguids`: This header allows an application to use `uuidof<T>()` consistently between Windows and WSL, instead of `__uuidof()`.
* `/src/dxguids.cpp`: This cpp file can be used as a replacement for linking against `dxguid.lib` on Windows, and as a convenient translation unit to define GUIDs without multiple definitions for WSL.
* `/test`: Simple CMake/Meson projects for validating the headers can be included in a given environment
## Use on Windows
Note that these headers may conflict with the headers from the Windows SDK, depending on include ordering. These headers should be added to the include directory list before the SDK, and should be included before other graphics headers (e.g. `d3d11.h`) from the Windows SDK. Otherwise, the corresponding header from the Windows SDK may be included first, and will define the include guards which prevents these headers from being used.
## Use on WSL
Note: WSL support is not intended for general purpose application development. At this time, the only recommended usage is for frameworks wishing to provide hardware acceleration for a Linux graphics/compute API in a WSL2 virtualization environment.
Note: WSL support is only available for 64-bit binaries.
The headers in the `/include/wsl` directory provide alternative definitions to macros and typedefs normally found in the Windows SDK. For the most part, they should be straightforward, but there are a couple to call attention to:
|Type|Reason|
|---|---|
|`LONG`/`ULONG`|On 64-bit Windows, a `long` is 4 bytes, but on Linux it is typically 8 bytes. The D3D12 ABI for WSL uses `long` and therefore these should be 8 bytes.|
|`WCHAR`/`WCSTR`|On Windows, a `wchar_t` is 2 bytes, but on Linux it is typically 4 bytes. The D3D12 ABI for WSL uses the native 4-byte `wchar_t`, to enable applications and the runtime to use the system C library to perform string manipulation.|
Additionally, APIs taking `HANDLE` (`void*`) for Win32 types should instead use `reinterpret_cast<HANDLE>(fd)` for an appropriate type of file descriptor. For `ID3D12Fence::SetEventOnCompletion` this should be an `eventfd`, and for shared resources will be an opaque fd.
## Ways to consume
There are various ways to consume the headers in this project:
* Manually: Just copy the headers somewhere and point your project at them.
* CMake subproject: Add this entire project as a subdirectory of your larger project, e.g. as a git submodule, and `add_subdirectory` into it. Use the resulting `DirectX-Headers` and/or `DirectX-Guids` targets as a link dependency
* Installed CMake: After building/installing this project, it can be found through CMake's `find_package` functionality and will expose the same `DirectX-Headers` and `DirectX-Guids` targets.
* FetchContent CMake (3.11+): Fetch this library using Git and easily add it to your project.
* Meson subproject/wrap: Add this entire project as a subproject of your larger project, and use `subproject` or `dependency` to consume it.
* Pkg-config: Use Meson to build this project, and the resulting installed package can be found via pkg-config.
* vcpkg: A vcpkg port has [been added](https://github.com/microsoft/vcpkg/tree/master/ports/directx-headers).
* NuGet: Download the [DirectX 12 Agility SDK](https://devblogs.microsoft.com/directx/announcing-dx12agility/) from [NuGet.org](https://www.nuget.org/packages/Microsoft.Direct3D.D3D12)
* For more info about the Agility SDK, see the [getting started guide](https://devblogs.microsoft.com/directx/gettingstarted-dx12agility/)
Contributions for new mechanisms are welcome.
## Contributing
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
## Trademarks
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow [Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

41
SECURITY.md Normal file
View File

@ -0,0 +1,41 @@
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.5 BLOCK -->
## Security
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)), please report it to us as described below.
## Reporting Security Issues
**Please do not report security vulnerabilities through public GitHub issues.**
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report).
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc).
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
* Full paths of source file(s) related to the manifestation of the issue
* The location of the affected source code (tag/branch/commit or direct URL)
* Any special configuration required to reproduce the issue
* Step-by-step instructions to reproduce the issue
* Proof-of-concept or exploit code (if possible)
* Impact of the issue, including how an attacker might exploit the issue
This information will help us triage your report more quickly.
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://microsoft.com/msrc/bounty) page for more details about our active programs.
## Preferred Languages
We prefer all communications to be in English.
## Policy
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd).
<!-- END MICROSOFT SECURITY.MD BLOCK -->

View File

@ -0,0 +1,4 @@
@PACKAGE_INIT@
include("${CMAKE_CURRENT_LIST_DIR}/directx-headers-targets.cmake")
check_required_components("@PROJECT_NAME@")

24
debian-orig/changelog Normal file
View File

@ -0,0 +1,24 @@
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

18
debian-orig/control Normal file
View File

@ -0,0 +1,18 @@
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.

31
debian-orig/copyright Normal file
View File

@ -0,0 +1,31 @@
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.

8
debian-orig/rules Executable file
View File

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

View File

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

5
debian-orig/watch Normal file
View File

@ -0,0 +1,5 @@
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

15
googletest/CMakeLists.txt Normal file
View File

@ -0,0 +1,15 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
include(FetchContent)
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
)
FetchContent_MakeAvailable(googletest)
project(DirectX-Headers-GoogleTest-Suite CXX)
add_executable(Feature-Support-Test feature_support_test.cpp)
target_link_libraries(Feature-Support-Test DirectX-Headers DirectX-Guids d3d12 dxcore gtest_main)

1233
googletest/MockDevice.hpp Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

25258
include/directx/d3d12.h Normal file

File diff suppressed because it is too large Load Diff

5715
include/directx/d3d12.idl Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,659 @@
/*-------------------------------------------------------------------------------------
*
* 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 __d3d12compatibility_h__
#define __d3d12compatibility_h__
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif
#ifndef DECLSPEC_XFGVIRT
#if defined(_CONTROL_FLOW_GUARD_XFG)
#define DECLSPEC_XFGVIRT(base, func) __declspec(xfg_virtual(base, func))
#else
#define DECLSPEC_XFGVIRT(base, func)
#endif
#endif
/* Forward Declarations */
#ifndef __ID3D12CompatibilityDevice_FWD_DEFINED__
#define __ID3D12CompatibilityDevice_FWD_DEFINED__
typedef interface ID3D12CompatibilityDevice ID3D12CompatibilityDevice;
#endif /* __ID3D12CompatibilityDevice_FWD_DEFINED__ */
#ifndef __D3D11On12CreatorID_FWD_DEFINED__
#define __D3D11On12CreatorID_FWD_DEFINED__
typedef interface D3D11On12CreatorID D3D11On12CreatorID;
#endif /* __D3D11On12CreatorID_FWD_DEFINED__ */
#ifndef __D3D9On12CreatorID_FWD_DEFINED__
#define __D3D9On12CreatorID_FWD_DEFINED__
typedef interface D3D9On12CreatorID D3D9On12CreatorID;
#endif /* __D3D9On12CreatorID_FWD_DEFINED__ */
#ifndef __OpenGLOn12CreatorID_FWD_DEFINED__
#define __OpenGLOn12CreatorID_FWD_DEFINED__
typedef interface OpenGLOn12CreatorID OpenGLOn12CreatorID;
#endif /* __OpenGLOn12CreatorID_FWD_DEFINED__ */
#ifndef __OpenCLOn12CreatorID_FWD_DEFINED__
#define __OpenCLOn12CreatorID_FWD_DEFINED__
typedef interface OpenCLOn12CreatorID OpenCLOn12CreatorID;
#endif /* __OpenCLOn12CreatorID_FWD_DEFINED__ */
#ifndef __DirectMLTensorFlowCreatorID_FWD_DEFINED__
#define __DirectMLTensorFlowCreatorID_FWD_DEFINED__
typedef interface DirectMLTensorFlowCreatorID DirectMLTensorFlowCreatorID;
#endif /* __DirectMLTensorFlowCreatorID_FWD_DEFINED__ */
/* header files for imported files */
#include "OAIdl.h"
#include "OCIdl.h"
#include "d3d11on12.h"
#ifdef __cplusplus
extern "C"{
#endif
/* interface __MIDL_itf_d3d12compatibility_0000_0000 */
/* [local] */
#include <winapifamily.h>
#pragma region Desktop Family
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_GAMES)
typedef
enum D3D12_COMPATIBILITY_SHARED_FLAGS
{
D3D12_COMPATIBILITY_SHARED_FLAG_NONE = 0,
D3D12_COMPATIBILITY_SHARED_FLAG_NON_NT_HANDLE = 0x1,
D3D12_COMPATIBILITY_SHARED_FLAG_KEYED_MUTEX = 0x2,
D3D12_COMPATIBILITY_SHARED_FLAG_9_ON_12 = 0x4
} D3D12_COMPATIBILITY_SHARED_FLAGS;
DEFINE_ENUM_FLAG_OPERATORS( D3D12_COMPATIBILITY_SHARED_FLAGS );
typedef
enum D3D12_REFLECT_SHARED_PROPERTY
{
D3D12_REFLECT_SHARED_PROPERTY_D3D11_RESOURCE_FLAGS = 0,
D3D12_REFELCT_SHARED_PROPERTY_COMPATIBILITY_SHARED_FLAGS = ( D3D12_REFLECT_SHARED_PROPERTY_D3D11_RESOURCE_FLAGS + 1 ) ,
D3D12_REFLECT_SHARED_PROPERTY_NON_NT_SHARED_HANDLE = ( D3D12_REFELCT_SHARED_PROPERTY_COMPATIBILITY_SHARED_FLAGS + 1 )
} D3D12_REFLECT_SHARED_PROPERTY;
extern RPC_IF_HANDLE __MIDL_itf_d3d12compatibility_0000_0000_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3d12compatibility_0000_0000_v0_0_s_ifspec;
#ifndef __ID3D12CompatibilityDevice_INTERFACE_DEFINED__
#define __ID3D12CompatibilityDevice_INTERFACE_DEFINED__
/* interface ID3D12CompatibilityDevice */
/* [unique][local][object][uuid] */
EXTERN_C const IID IID_ID3D12CompatibilityDevice;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("8f1c0e3c-fae3-4a82-b098-bfe1708207ff")
ID3D12CompatibilityDevice : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE CreateSharedResource(
_In_ const D3D12_HEAP_PROPERTIES *pHeapProperties,
D3D12_HEAP_FLAGS HeapFlags,
_In_ const D3D12_RESOURCE_DESC *pDesc,
D3D12_RESOURCE_STATES InitialResourceState,
_In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue,
_In_opt_ const D3D11_RESOURCE_FLAGS *pFlags11,
D3D12_COMPATIBILITY_SHARED_FLAGS CompatibilityFlags,
_In_opt_ ID3D12LifetimeTracker *pLifetimeTracker,
_In_opt_ ID3D12SwapChainAssistant *pOwningSwapchain,
REFIID riid,
_COM_Outptr_opt_ void **ppResource) = 0;
virtual HRESULT STDMETHODCALLTYPE CreateSharedHeap(
_In_ const D3D12_HEAP_DESC *pHeapDesc,
D3D12_COMPATIBILITY_SHARED_FLAGS CompatibilityFlags,
REFIID riid,
_COM_Outptr_opt_ void **ppHeap) = 0;
virtual HRESULT STDMETHODCALLTYPE ReflectSharedProperties(
_In_ ID3D12Object *pHeapOrResource,
D3D12_REFLECT_SHARED_PROPERTY ReflectType,
_Out_writes_bytes_(DataSize) void *pData,
UINT DataSize) = 0;
};
#else /* C style interface */
typedef struct ID3D12CompatibilityDeviceVtbl
{
BEGIN_INTERFACE
DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
ID3D12CompatibilityDevice * This,
REFIID riid,
_COM_Outptr_ void **ppvObject);
DECLSPEC_XFGVIRT(IUnknown, AddRef)
ULONG ( STDMETHODCALLTYPE *AddRef )(
ID3D12CompatibilityDevice * This);
DECLSPEC_XFGVIRT(IUnknown, Release)
ULONG ( STDMETHODCALLTYPE *Release )(
ID3D12CompatibilityDevice * This);
DECLSPEC_XFGVIRT(ID3D12CompatibilityDevice, CreateSharedResource)
HRESULT ( STDMETHODCALLTYPE *CreateSharedResource )(
ID3D12CompatibilityDevice * This,
_In_ const D3D12_HEAP_PROPERTIES *pHeapProperties,
D3D12_HEAP_FLAGS HeapFlags,
_In_ const D3D12_RESOURCE_DESC *pDesc,
D3D12_RESOURCE_STATES InitialResourceState,
_In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue,
_In_opt_ const D3D11_RESOURCE_FLAGS *pFlags11,
D3D12_COMPATIBILITY_SHARED_FLAGS CompatibilityFlags,
_In_opt_ ID3D12LifetimeTracker *pLifetimeTracker,
_In_opt_ ID3D12SwapChainAssistant *pOwningSwapchain,
REFIID riid,
_COM_Outptr_opt_ void **ppResource);
DECLSPEC_XFGVIRT(ID3D12CompatibilityDevice, CreateSharedHeap)
HRESULT ( STDMETHODCALLTYPE *CreateSharedHeap )(
ID3D12CompatibilityDevice * This,
_In_ const D3D12_HEAP_DESC *pHeapDesc,
D3D12_COMPATIBILITY_SHARED_FLAGS CompatibilityFlags,
REFIID riid,
_COM_Outptr_opt_ void **ppHeap);
DECLSPEC_XFGVIRT(ID3D12CompatibilityDevice, ReflectSharedProperties)
HRESULT ( STDMETHODCALLTYPE *ReflectSharedProperties )(
ID3D12CompatibilityDevice * This,
_In_ ID3D12Object *pHeapOrResource,
D3D12_REFLECT_SHARED_PROPERTY ReflectType,
_Out_writes_bytes_(DataSize) void *pData,
UINT DataSize);
END_INTERFACE
} ID3D12CompatibilityDeviceVtbl;
interface ID3D12CompatibilityDevice
{
CONST_VTBL struct ID3D12CompatibilityDeviceVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define ID3D12CompatibilityDevice_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define ID3D12CompatibilityDevice_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define ID3D12CompatibilityDevice_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define ID3D12CompatibilityDevice_CreateSharedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pFlags11,CompatibilityFlags,pLifetimeTracker,pOwningSwapchain,riid,ppResource) \
( (This)->lpVtbl -> CreateSharedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pFlags11,CompatibilityFlags,pLifetimeTracker,pOwningSwapchain,riid,ppResource) )
#define ID3D12CompatibilityDevice_CreateSharedHeap(This,pHeapDesc,CompatibilityFlags,riid,ppHeap) \
( (This)->lpVtbl -> CreateSharedHeap(This,pHeapDesc,CompatibilityFlags,riid,ppHeap) )
#define ID3D12CompatibilityDevice_ReflectSharedProperties(This,pHeapOrResource,ReflectType,pData,DataSize) \
( (This)->lpVtbl -> ReflectSharedProperties(This,pHeapOrResource,ReflectType,pData,DataSize) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __ID3D12CompatibilityDevice_INTERFACE_DEFINED__ */
#ifndef __D3D11On12CreatorID_INTERFACE_DEFINED__
#define __D3D11On12CreatorID_INTERFACE_DEFINED__
/* interface D3D11On12CreatorID */
/* [unique][local][object][uuid] */
EXTERN_C const IID IID_D3D11On12CreatorID;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("edbf5678-2960-4e81-8429-99d4b2630c4e")
D3D11On12CreatorID : public IUnknown
{
public:
};
#else /* C style interface */
typedef struct D3D11On12CreatorIDVtbl
{
BEGIN_INTERFACE
DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
D3D11On12CreatorID * This,
REFIID riid,
_COM_Outptr_ void **ppvObject);
DECLSPEC_XFGVIRT(IUnknown, AddRef)
ULONG ( STDMETHODCALLTYPE *AddRef )(
D3D11On12CreatorID * This);
DECLSPEC_XFGVIRT(IUnknown, Release)
ULONG ( STDMETHODCALLTYPE *Release )(
D3D11On12CreatorID * This);
END_INTERFACE
} D3D11On12CreatorIDVtbl;
interface D3D11On12CreatorID
{
CONST_VTBL struct D3D11On12CreatorIDVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define D3D11On12CreatorID_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define D3D11On12CreatorID_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define D3D11On12CreatorID_Release(This) \
( (This)->lpVtbl -> Release(This) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __D3D11On12CreatorID_INTERFACE_DEFINED__ */
#ifndef __D3D9On12CreatorID_INTERFACE_DEFINED__
#define __D3D9On12CreatorID_INTERFACE_DEFINED__
/* interface D3D9On12CreatorID */
/* [unique][local][object][uuid] */
EXTERN_C const IID IID_D3D9On12CreatorID;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("fffcbb7f-15d3-42a2-841e-9d8d32f37ddd")
D3D9On12CreatorID : public IUnknown
{
public:
};
#else /* C style interface */
typedef struct D3D9On12CreatorIDVtbl
{
BEGIN_INTERFACE
DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
D3D9On12CreatorID * This,
REFIID riid,
_COM_Outptr_ void **ppvObject);
DECLSPEC_XFGVIRT(IUnknown, AddRef)
ULONG ( STDMETHODCALLTYPE *AddRef )(
D3D9On12CreatorID * This);
DECLSPEC_XFGVIRT(IUnknown, Release)
ULONG ( STDMETHODCALLTYPE *Release )(
D3D9On12CreatorID * This);
END_INTERFACE
} D3D9On12CreatorIDVtbl;
interface D3D9On12CreatorID
{
CONST_VTBL struct D3D9On12CreatorIDVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define D3D9On12CreatorID_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define D3D9On12CreatorID_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define D3D9On12CreatorID_Release(This) \
( (This)->lpVtbl -> Release(This) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __D3D9On12CreatorID_INTERFACE_DEFINED__ */
#ifndef __OpenGLOn12CreatorID_INTERFACE_DEFINED__
#define __OpenGLOn12CreatorID_INTERFACE_DEFINED__
/* interface OpenGLOn12CreatorID */
/* [unique][local][object][uuid] */
EXTERN_C const IID IID_OpenGLOn12CreatorID;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("6bb3cd34-0d19-45ab-97ed-d720ba3dfc80")
OpenGLOn12CreatorID : public IUnknown
{
public:
};
#else /* C style interface */
typedef struct OpenGLOn12CreatorIDVtbl
{
BEGIN_INTERFACE
DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
OpenGLOn12CreatorID * This,
REFIID riid,
_COM_Outptr_ void **ppvObject);
DECLSPEC_XFGVIRT(IUnknown, AddRef)
ULONG ( STDMETHODCALLTYPE *AddRef )(
OpenGLOn12CreatorID * This);
DECLSPEC_XFGVIRT(IUnknown, Release)
ULONG ( STDMETHODCALLTYPE *Release )(
OpenGLOn12CreatorID * This);
END_INTERFACE
} OpenGLOn12CreatorIDVtbl;
interface OpenGLOn12CreatorID
{
CONST_VTBL struct OpenGLOn12CreatorIDVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define OpenGLOn12CreatorID_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define OpenGLOn12CreatorID_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define OpenGLOn12CreatorID_Release(This) \
( (This)->lpVtbl -> Release(This) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __OpenGLOn12CreatorID_INTERFACE_DEFINED__ */
#ifndef __OpenCLOn12CreatorID_INTERFACE_DEFINED__
#define __OpenCLOn12CreatorID_INTERFACE_DEFINED__
/* interface OpenCLOn12CreatorID */
/* [unique][local][object][uuid] */
EXTERN_C const IID IID_OpenCLOn12CreatorID;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("3f76bb74-91b5-4a88-b126-20ca0331cd60")
OpenCLOn12CreatorID : public IUnknown
{
public:
};
#else /* C style interface */
typedef struct OpenCLOn12CreatorIDVtbl
{
BEGIN_INTERFACE
DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
OpenCLOn12CreatorID * This,
REFIID riid,
_COM_Outptr_ void **ppvObject);
DECLSPEC_XFGVIRT(IUnknown, AddRef)
ULONG ( STDMETHODCALLTYPE *AddRef )(
OpenCLOn12CreatorID * This);
DECLSPEC_XFGVIRT(IUnknown, Release)
ULONG ( STDMETHODCALLTYPE *Release )(
OpenCLOn12CreatorID * This);
END_INTERFACE
} OpenCLOn12CreatorIDVtbl;
interface OpenCLOn12CreatorID
{
CONST_VTBL struct OpenCLOn12CreatorIDVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define OpenCLOn12CreatorID_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define OpenCLOn12CreatorID_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define OpenCLOn12CreatorID_Release(This) \
( (This)->lpVtbl -> Release(This) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __OpenCLOn12CreatorID_INTERFACE_DEFINED__ */
#ifndef __DirectMLTensorFlowCreatorID_INTERFACE_DEFINED__
#define __DirectMLTensorFlowCreatorID_INTERFACE_DEFINED__
/* interface DirectMLTensorFlowCreatorID */
/* [unique][local][object][uuid] */
EXTERN_C const IID IID_DirectMLTensorFlowCreatorID;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("cb7490ac-8a0f-44ec-9b7b-6f4cafe8e9ab")
DirectMLTensorFlowCreatorID : public IUnknown
{
public:
};
#else /* C style interface */
typedef struct DirectMLTensorFlowCreatorIDVtbl
{
BEGIN_INTERFACE
DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
DirectMLTensorFlowCreatorID * This,
REFIID riid,
_COM_Outptr_ void **ppvObject);
DECLSPEC_XFGVIRT(IUnknown, AddRef)
ULONG ( STDMETHODCALLTYPE *AddRef )(
DirectMLTensorFlowCreatorID * This);
DECLSPEC_XFGVIRT(IUnknown, Release)
ULONG ( STDMETHODCALLTYPE *Release )(
DirectMLTensorFlowCreatorID * This);
END_INTERFACE
} DirectMLTensorFlowCreatorIDVtbl;
interface DirectMLTensorFlowCreatorID
{
CONST_VTBL struct DirectMLTensorFlowCreatorIDVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define DirectMLTensorFlowCreatorID_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define DirectMLTensorFlowCreatorID_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define DirectMLTensorFlowCreatorID_Release(This) \
( (This)->lpVtbl -> Release(This) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __DirectMLTensorFlowCreatorID_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_d3d12compatibility_0000_0006 */
/* [local] */
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_GAMES) */
#pragma endregion
DEFINE_GUID(IID_ID3D12CompatibilityDevice,0x8f1c0e3c,0xfae3,0x4a82,0xb0,0x98,0xbf,0xe1,0x70,0x82,0x07,0xff);
DEFINE_GUID(IID_D3D11On12CreatorID,0xedbf5678,0x2960,0x4e81,0x84,0x29,0x99,0xd4,0xb2,0x63,0x0c,0x4e);
DEFINE_GUID(IID_D3D9On12CreatorID,0xfffcbb7f,0x15d3,0x42a2,0x84,0x1e,0x9d,0x8d,0x32,0xf3,0x7d,0xdd);
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);
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;
/* Additional Prototypes for ALL interfaces */
/* end of Additional Prototypes */
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,88 @@
/*-------------------------------------------------------------------------------------
*
* Copyright (c) Microsoft Corporation
* Licensed under the MIT license
*
*-------------------------------------------------------------------------------------*/
import "OAIdl.idl";
import "OCIdl.idl";
import "d3d11on12.idl";
cpp_quote("#include <winapifamily.h>")
#pragma region Desktop Family
cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_GAMES)")
typedef enum D3D12_COMPATIBILITY_SHARED_FLAGS
{
D3D12_COMPATIBILITY_SHARED_FLAG_NONE = 0,
D3D12_COMPATIBILITY_SHARED_FLAG_NON_NT_HANDLE = 0x1,
D3D12_COMPATIBILITY_SHARED_FLAG_KEYED_MUTEX = 0x2,
D3D12_COMPATIBILITY_SHARED_FLAG_9_ON_12 = 0x4,
} D3D12_COMPATIBILITY_SHARED_FLAGS;
cpp_quote( "DEFINE_ENUM_FLAG_OPERATORS( D3D12_COMPATIBILITY_SHARED_FLAGS );" )
typedef enum D3D12_REFLECT_SHARED_PROPERTY
{
D3D12_REFLECT_SHARED_PROPERTY_D3D11_RESOURCE_FLAGS, // D3D11_RESOURCE_FLAGS
D3D12_REFELCT_SHARED_PROPERTY_COMPATIBILITY_SHARED_FLAGS, // D3D12_COMPATIBILITY_SHARED_FLAGS
D3D12_REFLECT_SHARED_PROPERTY_NON_NT_SHARED_HANDLE, // HANDLE
} D3D12_REFLECT_SHARED_PROPERTY;
[ uuid( 8f1c0e3c-fae3-4a82-b098-bfe1708207ff ), object, local, pointer_default( unique ) ]
interface ID3D12CompatibilityDevice
: IUnknown
{
HRESULT CreateSharedResource(
[annotation("_In_")] const D3D12_HEAP_PROPERTIES* pHeapProperties,
D3D12_HEAP_FLAGS HeapFlags,
[annotation("_In_")] const D3D12_RESOURCE_DESC* pDesc,
D3D12_RESOURCE_STATES InitialResourceState,
[annotation("_In_opt_")] const D3D12_CLEAR_VALUE* pOptimizedClearValue,
[annotation("_In_opt_")] const D3D11_RESOURCE_FLAGS* pFlags11,
D3D12_COMPATIBILITY_SHARED_FLAGS CompatibilityFlags,
[annotation("_In_opt_")] ID3D12LifetimeTracker* pLifetimeTracker,
[annotation("_In_opt_")] ID3D12SwapChainAssistant* pOwningSwapchain,
REFIID riid,
[out, iid_is(riid), annotation("_COM_Outptr_opt_")] void** ppResource);
HRESULT CreateSharedHeap(
[annotation("_In_")] const D3D12_HEAP_DESC* pHeapDesc,
D3D12_COMPATIBILITY_SHARED_FLAGS CompatibilityFlags,
REFIID riid,
[out, iid_is(riid), annotation("_COM_Outptr_opt_")] void** ppHeap);
HRESULT ReflectSharedProperties(
[annotation("_In_")] ID3D12Object* pHeapOrResource,
D3D12_REFLECT_SHARED_PROPERTY ReflectType,
[annotation("_Out_writes_bytes_(DataSize)")] void* pData,
UINT DataSize);
}
[uuid(edbf5678-2960-4e81-8429-99d4b2630c4e), object, local, pointer_default(unique)]
interface D3D11On12CreatorID : IUnknown { };
[uuid(fffcbb7f-15d3-42a2-841e-9d8d32f37ddd), object, local, pointer_default(unique)]
interface D3D9On12CreatorID : IUnknown { };
[uuid(6bb3cd34-0d19-45ab-97ed-d720ba3dfc80), object, local, pointer_default(unique)]
interface OpenGLOn12CreatorID : IUnknown { };
[uuid(3f76bb74-91b5-4a88-b126-20ca0331cd60), object, local, pointer_default(unique)]
interface OpenCLOn12CreatorID : IUnknown { };
[uuid(cb7490ac-8a0f-44ec-9b7b-6f4cafe8e9ab), object, local, pointer_default(unique)]
interface DirectMLTensorFlowCreatorID : IUnknown { };
cpp_quote("#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_GAMES) */")
#pragma endregion
cpp_quote( "DEFINE_GUID(IID_ID3D12CompatibilityDevice,0x8f1c0e3c,0xfae3,0x4a82,0xb0,0x98,0xbf,0xe1,0x70,0x82,0x07,0xff);" )
cpp_quote( "DEFINE_GUID(IID_D3D11On12CreatorID,0xedbf5678,0x2960,0x4e81,0x84,0x29,0x99,0xd4,0xb2,0x63,0x0c,0x4e);" )
cpp_quote( "DEFINE_GUID(IID_D3D9On12CreatorID,0xfffcbb7f,0x15d3,0x42a2,0x84,0x1e,0x9d,0x8d,0x32,0xf3,0x7d,0xdd);" )
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);" )

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,487 @@
//////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
//
// File: D3D12Shader.h
// Content: D3D12 Shader Types and APIs
//
//////////////////////////////////////////////////////////////////////////////
#ifndef __D3D12SHADER_H__
#define __D3D12SHADER_H__
#include "d3dcommon.h"
typedef enum D3D12_SHADER_VERSION_TYPE
{
D3D12_SHVER_PIXEL_SHADER = 0,
D3D12_SHVER_VERTEX_SHADER = 1,
D3D12_SHVER_GEOMETRY_SHADER = 2,
// D3D11 Shaders
D3D12_SHVER_HULL_SHADER = 3,
D3D12_SHVER_DOMAIN_SHADER = 4,
D3D12_SHVER_COMPUTE_SHADER = 5,
// D3D12 Shaders
D3D12_SHVER_LIBRARY = 6,
D3D12_SHVER_RAY_GENERATION_SHADER = 7,
D3D12_SHVER_INTERSECTION_SHADER = 8,
D3D12_SHVER_ANY_HIT_SHADER = 9,
D3D12_SHVER_CLOSEST_HIT_SHADER = 10,
D3D12_SHVER_MISS_SHADER = 11,
D3D12_SHVER_CALLABLE_SHADER = 12,
D3D12_SHVER_MESH_SHADER = 13,
D3D12_SHVER_AMPLIFICATION_SHADER = 14,
D3D12_SHVER_RESERVED0 = 0xFFF0,
} D3D12_SHADER_VERSION_TYPE;
#define D3D12_SHVER_GET_TYPE(_Version) \
(((_Version) >> 16) & 0xffff)
#define D3D12_SHVER_GET_MAJOR(_Version) \
(((_Version) >> 4) & 0xf)
#define D3D12_SHVER_GET_MINOR(_Version) \
(((_Version) >> 0) & 0xf)
// Slot ID for library function return
#define D3D_RETURN_PARAMETER_INDEX (-1)
typedef D3D_RESOURCE_RETURN_TYPE D3D12_RESOURCE_RETURN_TYPE;
typedef D3D_CBUFFER_TYPE D3D12_CBUFFER_TYPE;
typedef struct _D3D12_SIGNATURE_PARAMETER_DESC
{
LPCSTR SemanticName; // Name of the semantic
UINT SemanticIndex; // Index of the semantic
UINT Register; // Number of member variables
D3D_NAME SystemValueType;// A predefined system value, or D3D_NAME_UNDEFINED if not applicable
D3D_REGISTER_COMPONENT_TYPE ComponentType; // Scalar type (e.g. uint, float, etc.)
BYTE Mask; // Mask to indicate which components of the register
// are used (combination of D3D10_COMPONENT_MASK values)
BYTE ReadWriteMask; // Mask to indicate whether a given component is
// never written (if this is an output signature) or
// always read (if this is an input signature).
// (combination of D3D_MASK_* values)
UINT Stream; // Stream index
D3D_MIN_PRECISION MinPrecision; // Minimum desired interpolation precision
} D3D12_SIGNATURE_PARAMETER_DESC;
typedef struct _D3D12_SHADER_BUFFER_DESC
{
LPCSTR Name; // Name of the constant buffer
D3D_CBUFFER_TYPE Type; // Indicates type of buffer content
UINT Variables; // Number of member variables
UINT Size; // Size of CB (in bytes)
UINT uFlags; // Buffer description flags
} D3D12_SHADER_BUFFER_DESC;
typedef struct _D3D12_SHADER_VARIABLE_DESC
{
LPCSTR Name; // Name of the variable
UINT StartOffset; // Offset in constant buffer's backing store
UINT Size; // Size of variable (in bytes)
UINT uFlags; // Variable flags
LPVOID DefaultValue; // Raw pointer to default value
UINT StartTexture; // First texture index (or -1 if no textures used)
UINT TextureSize; // Number of texture slots possibly used.
UINT StartSampler; // First sampler index (or -1 if no textures used)
UINT SamplerSize; // Number of sampler slots possibly used.
} D3D12_SHADER_VARIABLE_DESC;
typedef struct _D3D12_SHADER_TYPE_DESC
{
D3D_SHADER_VARIABLE_CLASS Class; // Variable class (e.g. object, matrix, etc.)
D3D_SHADER_VARIABLE_TYPE Type; // Variable type (e.g. float, sampler, etc.)
UINT Rows; // Number of rows (for matrices, 1 for other numeric, 0 if not applicable)
UINT Columns; // Number of columns (for vectors & matrices, 1 for other numeric, 0 if not applicable)
UINT Elements; // Number of elements (0 if not an array)
UINT Members; // Number of members (0 if not a structure)
UINT Offset; // Offset from the start of structure (0 if not a structure member)
LPCSTR Name; // Name of type, can be NULL
} D3D12_SHADER_TYPE_DESC;
typedef D3D_TESSELLATOR_DOMAIN D3D12_TESSELLATOR_DOMAIN;
typedef D3D_TESSELLATOR_PARTITIONING D3D12_TESSELLATOR_PARTITIONING;
typedef D3D_TESSELLATOR_OUTPUT_PRIMITIVE D3D12_TESSELLATOR_OUTPUT_PRIMITIVE;
typedef struct _D3D12_SHADER_DESC
{
UINT Version; // Shader version
LPCSTR Creator; // Creator string
UINT Flags; // Shader compilation/parse flags
UINT ConstantBuffers; // Number of constant buffers
UINT BoundResources; // Number of bound resources
UINT InputParameters; // Number of parameters in the input signature
UINT OutputParameters; // Number of parameters in the output signature
UINT InstructionCount; // Number of emitted instructions
UINT TempRegisterCount; // Number of temporary registers used
UINT TempArrayCount; // Number of temporary arrays used
UINT DefCount; // Number of constant defines
UINT DclCount; // Number of declarations (input + output)
UINT TextureNormalInstructions; // Number of non-categorized texture instructions
UINT TextureLoadInstructions; // Number of texture load instructions
UINT TextureCompInstructions; // Number of texture comparison instructions
UINT TextureBiasInstructions; // Number of texture bias instructions
UINT TextureGradientInstructions; // Number of texture gradient instructions
UINT FloatInstructionCount; // Number of floating point arithmetic instructions used
UINT IntInstructionCount; // Number of signed integer arithmetic instructions used
UINT UintInstructionCount; // Number of unsigned integer arithmetic instructions used
UINT StaticFlowControlCount; // Number of static flow control instructions used
UINT DynamicFlowControlCount; // Number of dynamic flow control instructions used
UINT MacroInstructionCount; // Number of macro instructions used
UINT ArrayInstructionCount; // Number of array instructions used
UINT CutInstructionCount; // Number of cut instructions used
UINT EmitInstructionCount; // Number of emit instructions used
D3D_PRIMITIVE_TOPOLOGY GSOutputTopology; // Geometry shader output topology
UINT GSMaxOutputVertexCount; // Geometry shader maximum output vertex count
D3D_PRIMITIVE InputPrimitive; // GS/HS input primitive
UINT PatchConstantParameters; // Number of parameters in the patch constant signature
UINT cGSInstanceCount; // Number of Geometry shader instances
UINT cControlPoints; // Number of control points in the HS->DS stage
D3D_TESSELLATOR_OUTPUT_PRIMITIVE HSOutputPrimitive; // Primitive output by the tessellator
D3D_TESSELLATOR_PARTITIONING HSPartitioning; // Partitioning mode of the tessellator
D3D_TESSELLATOR_DOMAIN TessellatorDomain; // Domain of the tessellator (quad, tri, isoline)
// instruction counts
UINT cBarrierInstructions; // Number of barrier instructions in a compute shader
UINT cInterlockedInstructions; // Number of interlocked instructions
UINT cTextureStoreInstructions; // Number of texture writes
} D3D12_SHADER_DESC;
typedef struct _D3D12_SHADER_INPUT_BIND_DESC
{
LPCSTR Name; // Name of the resource
D3D_SHADER_INPUT_TYPE Type; // Type of resource (e.g. texture, cbuffer, etc.)
UINT BindPoint; // Starting bind point
UINT BindCount; // Number of contiguous bind points (for arrays)
UINT uFlags; // Input binding flags
D3D_RESOURCE_RETURN_TYPE ReturnType; // Return type (if texture)
D3D_SRV_DIMENSION Dimension; // Dimension (if texture)
UINT NumSamples; // Number of samples (0 if not MS texture)
UINT Space; // Register space
UINT uID; // Range ID in the bytecode
} D3D12_SHADER_INPUT_BIND_DESC;
#define D3D_SHADER_REQUIRES_DOUBLES 0x00000001
#define D3D_SHADER_REQUIRES_EARLY_DEPTH_STENCIL 0x00000002
#define D3D_SHADER_REQUIRES_UAVS_AT_EVERY_STAGE 0x00000004
#define D3D_SHADER_REQUIRES_64_UAVS 0x00000008
#define D3D_SHADER_REQUIRES_MINIMUM_PRECISION 0x00000010
#define D3D_SHADER_REQUIRES_11_1_DOUBLE_EXTENSIONS 0x00000020
#define D3D_SHADER_REQUIRES_11_1_SHADER_EXTENSIONS 0x00000040
#define D3D_SHADER_REQUIRES_LEVEL_9_COMPARISON_FILTERING 0x00000080
#define D3D_SHADER_REQUIRES_TILED_RESOURCES 0x00000100
#define D3D_SHADER_REQUIRES_STENCIL_REF 0x00000200
#define D3D_SHADER_REQUIRES_INNER_COVERAGE 0x00000400
#define D3D_SHADER_REQUIRES_TYPED_UAV_LOAD_ADDITIONAL_FORMATS 0x00000800
#define D3D_SHADER_REQUIRES_ROVS 0x00001000
#define D3D_SHADER_REQUIRES_VIEWPORT_AND_RT_ARRAY_INDEX_FROM_ANY_SHADER_FEEDING_RASTERIZER 0x00002000
#define D3D_SHADER_REQUIRES_WAVE_OPS 0x00004000
#define D3D_SHADER_REQUIRES_INT64_OPS 0x00008000
#define D3D_SHADER_REQUIRES_VIEW_ID 0x00010000
#define D3D_SHADER_REQUIRES_BARYCENTRICS 0x00020000
#define D3D_SHADER_REQUIRES_NATIVE_16BIT_OPS 0x00040000
#define D3D_SHADER_REQUIRES_SHADING_RATE 0x00080000
#define D3D_SHADER_REQUIRES_RAYTRACING_TIER_1_1 0x00100000
#define D3D_SHADER_REQUIRES_SAMPLER_FEEDBACK 0x00200000
#define D3D_SHADER_REQUIRES_ATOMIC_INT64_ON_TYPED_RESOURCE 0x00400000
#define D3D_SHADER_REQUIRES_ATOMIC_INT64_ON_GROUP_SHARED 0x00800000
#define D3D_SHADER_REQUIRES_DERIVATIVES_IN_MESH_AND_AMPLIFICATION_SHADERS 0x01000000
#define D3D_SHADER_REQUIRES_RESOURCE_DESCRIPTOR_HEAP_INDEXING 0x02000000
#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
typedef struct _D3D12_LIBRARY_DESC
{
LPCSTR Creator; // The name of the originator of the library.
UINT Flags; // Compilation flags.
UINT FunctionCount; // Number of functions exported from the library.
} D3D12_LIBRARY_DESC;
typedef struct _D3D12_FUNCTION_DESC
{
UINT Version; // Shader version
LPCSTR Creator; // Creator string
UINT Flags; // Shader compilation/parse flags
UINT ConstantBuffers; // Number of constant buffers
UINT BoundResources; // Number of bound resources
UINT InstructionCount; // Number of emitted instructions
UINT TempRegisterCount; // Number of temporary registers used
UINT TempArrayCount; // Number of temporary arrays used
UINT DefCount; // Number of constant defines
UINT DclCount; // Number of declarations (input + output)
UINT TextureNormalInstructions; // Number of non-categorized texture instructions
UINT TextureLoadInstructions; // Number of texture load instructions
UINT TextureCompInstructions; // Number of texture comparison instructions
UINT TextureBiasInstructions; // Number of texture bias instructions
UINT TextureGradientInstructions; // Number of texture gradient instructions
UINT FloatInstructionCount; // Number of floating point arithmetic instructions used
UINT IntInstructionCount; // Number of signed integer arithmetic instructions used
UINT UintInstructionCount; // Number of unsigned integer arithmetic instructions used
UINT StaticFlowControlCount; // Number of static flow control instructions used
UINT DynamicFlowControlCount; // Number of dynamic flow control instructions used
UINT MacroInstructionCount; // Number of macro instructions used
UINT ArrayInstructionCount; // Number of array instructions used
UINT MovInstructionCount; // Number of mov instructions used
UINT MovcInstructionCount; // Number of movc instructions used
UINT ConversionInstructionCount; // Number of type conversion instructions used
UINT BitwiseInstructionCount; // Number of bitwise arithmetic instructions used
D3D_FEATURE_LEVEL MinFeatureLevel; // Min target of the function byte code
UINT64 RequiredFeatureFlags; // Required feature flags
LPCSTR Name; // Function name
INT FunctionParameterCount; // Number of logical parameters in the function signature (not including return)
BOOL HasReturn; // TRUE, if function returns a value, false - it is a subroutine
BOOL Has10Level9VertexShader; // TRUE, if there is a 10L9 VS blob
BOOL Has10Level9PixelShader; // TRUE, if there is a 10L9 PS blob
} D3D12_FUNCTION_DESC;
typedef struct _D3D12_PARAMETER_DESC
{
LPCSTR Name; // Parameter name.
LPCSTR SemanticName; // Parameter semantic name (+index).
D3D_SHADER_VARIABLE_TYPE Type; // Element type.
D3D_SHADER_VARIABLE_CLASS Class; // Scalar/Vector/Matrix.
UINT Rows; // Rows are for matrix parameters.
UINT Columns; // Components or Columns in matrix.
D3D_INTERPOLATION_MODE InterpolationMode; // Interpolation mode.
D3D_PARAMETER_FLAGS Flags; // Parameter modifiers.
UINT FirstInRegister; // The first input register for this parameter.
UINT FirstInComponent; // The first input register component for this parameter.
UINT FirstOutRegister; // The first output register for this parameter.
UINT FirstOutComponent; // The first output register component for this parameter.
} D3D12_PARAMETER_DESC;
//////////////////////////////////////////////////////////////////////////////
// Interfaces ////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
typedef interface ID3D12ShaderReflectionType ID3D12ShaderReflectionType;
typedef interface ID3D12ShaderReflectionType *LPD3D12SHADERREFLECTIONTYPE;
typedef interface ID3D12ShaderReflectionVariable ID3D12ShaderReflectionVariable;
typedef interface ID3D12ShaderReflectionVariable *LPD3D12SHADERREFLECTIONVARIABLE;
typedef interface ID3D12ShaderReflectionConstantBuffer ID3D12ShaderReflectionConstantBuffer;
typedef interface ID3D12ShaderReflectionConstantBuffer *LPD3D12SHADERREFLECTIONCONSTANTBUFFER;
typedef interface ID3D12ShaderReflection ID3D12ShaderReflection;
typedef interface ID3D12ShaderReflection *LPD3D12SHADERREFLECTION;
typedef interface ID3D12LibraryReflection ID3D12LibraryReflection;
typedef interface ID3D12LibraryReflection *LPD3D12LIBRARYREFLECTION;
typedef interface ID3D12FunctionReflection ID3D12FunctionReflection;
typedef interface ID3D12FunctionReflection *LPD3D12FUNCTIONREFLECTION;
typedef interface ID3D12FunctionParameterReflection ID3D12FunctionParameterReflection;
typedef interface ID3D12FunctionParameterReflection *LPD3D12FUNCTIONPARAMETERREFLECTION;
// {E913C351-783D-48CA-A1D1-4F306284AD56}
interface DECLSPEC_UUID("E913C351-783D-48CA-A1D1-4F306284AD56") ID3D12ShaderReflectionType;
DEFINE_GUID(IID_ID3D12ShaderReflectionType,
0xe913c351, 0x783d, 0x48ca, 0xa1, 0xd1, 0x4f, 0x30, 0x62, 0x84, 0xad, 0x56);
#undef INTERFACE
#define INTERFACE ID3D12ShaderReflectionType
DECLARE_INTERFACE(ID3D12ShaderReflectionType)
{
STDMETHOD(GetDesc)(THIS_ _Out_ D3D12_SHADER_TYPE_DESC *pDesc) PURE;
STDMETHOD_(ID3D12ShaderReflectionType*, GetMemberTypeByIndex)(THIS_ _In_ UINT Index) PURE;
STDMETHOD_(ID3D12ShaderReflectionType*, GetMemberTypeByName)(THIS_ _In_ LPCSTR Name) PURE;
STDMETHOD_(LPCSTR, GetMemberTypeName)(THIS_ _In_ UINT Index) PURE;
STDMETHOD(IsEqual)(THIS_ _In_ ID3D12ShaderReflectionType* pType) PURE;
STDMETHOD_(ID3D12ShaderReflectionType*, GetSubType)(THIS) PURE;
STDMETHOD_(ID3D12ShaderReflectionType*, GetBaseClass)(THIS) PURE;
STDMETHOD_(UINT, GetNumInterfaces)(THIS) PURE;
STDMETHOD_(ID3D12ShaderReflectionType*, GetInterfaceByIndex)(THIS_ _In_ UINT uIndex) PURE;
STDMETHOD(IsOfType)(THIS_ _In_ ID3D12ShaderReflectionType* pType) PURE;
STDMETHOD(ImplementsInterface)(THIS_ _In_ ID3D12ShaderReflectionType* pBase) PURE;
};
// {8337A8A6-A216-444A-B2F4-314733A73AEA}
interface DECLSPEC_UUID("8337A8A6-A216-444A-B2F4-314733A73AEA") ID3D12ShaderReflectionVariable;
DEFINE_GUID(IID_ID3D12ShaderReflectionVariable,
0x8337a8a6, 0xa216, 0x444a, 0xb2, 0xf4, 0x31, 0x47, 0x33, 0xa7, 0x3a, 0xea);
#undef INTERFACE
#define INTERFACE ID3D12ShaderReflectionVariable
DECLARE_INTERFACE(ID3D12ShaderReflectionVariable)
{
STDMETHOD(GetDesc)(THIS_ _Out_ D3D12_SHADER_VARIABLE_DESC *pDesc) PURE;
STDMETHOD_(ID3D12ShaderReflectionType*, GetType)(THIS) PURE;
STDMETHOD_(ID3D12ShaderReflectionConstantBuffer*, GetBuffer)(THIS) PURE;
STDMETHOD_(UINT, GetInterfaceSlot)(THIS_ _In_ UINT uArrayIndex) PURE;
};
// {C59598B4-48B3-4869-B9B1-B1618B14A8B7}
interface DECLSPEC_UUID("C59598B4-48B3-4869-B9B1-B1618B14A8B7") ID3D12ShaderReflectionConstantBuffer;
DEFINE_GUID(IID_ID3D12ShaderReflectionConstantBuffer,
0xc59598b4, 0x48b3, 0x4869, 0xb9, 0xb1, 0xb1, 0x61, 0x8b, 0x14, 0xa8, 0xb7);
#undef INTERFACE
#define INTERFACE ID3D12ShaderReflectionConstantBuffer
DECLARE_INTERFACE(ID3D12ShaderReflectionConstantBuffer)
{
STDMETHOD(GetDesc)(THIS_ D3D12_SHADER_BUFFER_DESC *pDesc) PURE;
STDMETHOD_(ID3D12ShaderReflectionVariable*, GetVariableByIndex)(THIS_ _In_ UINT Index) PURE;
STDMETHOD_(ID3D12ShaderReflectionVariable*, GetVariableByName)(THIS_ _In_ LPCSTR Name) PURE;
};
// The ID3D12ShaderReflection IID may change from SDK version to SDK version
// if the reflection API changes. This prevents new code with the new API
// from working with an old binary. Recompiling with the new header
// will pick up the new IID.
// {5A58797D-A72C-478D-8BA2-EFC6B0EFE88E}
interface DECLSPEC_UUID("5A58797D-A72C-478D-8BA2-EFC6B0EFE88E") ID3D12ShaderReflection;
DEFINE_GUID(IID_ID3D12ShaderReflection,
0x5a58797d, 0xa72c, 0x478d, 0x8b, 0xa2, 0xef, 0xc6, 0xb0, 0xef, 0xe8, 0x8e);
#undef INTERFACE
#define INTERFACE ID3D12ShaderReflection
DECLARE_INTERFACE_(ID3D12ShaderReflection, IUnknown)
{
STDMETHOD(QueryInterface)(THIS_ _In_ REFIID iid,
_Out_ LPVOID *ppv) PURE;
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
STDMETHOD_(ULONG, Release)(THIS) PURE;
STDMETHOD(GetDesc)(THIS_ _Out_ D3D12_SHADER_DESC *pDesc) PURE;
STDMETHOD_(ID3D12ShaderReflectionConstantBuffer*, GetConstantBufferByIndex)(THIS_ _In_ UINT Index) PURE;
STDMETHOD_(ID3D12ShaderReflectionConstantBuffer*, GetConstantBufferByName)(THIS_ _In_ LPCSTR Name) PURE;
STDMETHOD(GetResourceBindingDesc)(THIS_ _In_ UINT ResourceIndex,
_Out_ D3D12_SHADER_INPUT_BIND_DESC *pDesc) PURE;
STDMETHOD(GetInputParameterDesc)(THIS_ _In_ UINT ParameterIndex,
_Out_ D3D12_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
STDMETHOD(GetOutputParameterDesc)(THIS_ _In_ UINT ParameterIndex,
_Out_ D3D12_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
STDMETHOD(GetPatchConstantParameterDesc)(THIS_ _In_ UINT ParameterIndex,
_Out_ D3D12_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
STDMETHOD_(ID3D12ShaderReflectionVariable*, GetVariableByName)(THIS_ _In_ LPCSTR Name) PURE;
STDMETHOD(GetResourceBindingDescByName)(THIS_ _In_ LPCSTR Name,
_Out_ D3D12_SHADER_INPUT_BIND_DESC *pDesc) PURE;
STDMETHOD_(UINT, GetMovInstructionCount)(THIS) PURE;
STDMETHOD_(UINT, GetMovcInstructionCount)(THIS) PURE;
STDMETHOD_(UINT, GetConversionInstructionCount)(THIS) PURE;
STDMETHOD_(UINT, GetBitwiseInstructionCount)(THIS) PURE;
STDMETHOD_(D3D_PRIMITIVE, GetGSInputPrimitive)(THIS) PURE;
STDMETHOD_(BOOL, IsSampleFrequencyShader)(THIS) PURE;
STDMETHOD_(UINT, GetNumInterfaceSlots)(THIS) PURE;
STDMETHOD(GetMinFeatureLevel)(THIS_ _Out_ enum D3D_FEATURE_LEVEL* pLevel) PURE;
STDMETHOD_(UINT, GetThreadGroupSize)(THIS_
_Out_opt_ UINT* pSizeX,
_Out_opt_ UINT* pSizeY,
_Out_opt_ UINT* pSizeZ) PURE;
STDMETHOD_(UINT64, GetRequiresFlags)(THIS) PURE;
};
// {8E349D19-54DB-4A56-9DC9-119D87BDB804}
interface DECLSPEC_UUID("8E349D19-54DB-4A56-9DC9-119D87BDB804") ID3D12LibraryReflection;
DEFINE_GUID(IID_ID3D12LibraryReflection,
0x8e349d19, 0x54db, 0x4a56, 0x9d, 0xc9, 0x11, 0x9d, 0x87, 0xbd, 0xb8, 0x4);
#undef INTERFACE
#define INTERFACE ID3D12LibraryReflection
DECLARE_INTERFACE_(ID3D12LibraryReflection, IUnknown)
{
STDMETHOD(QueryInterface)(THIS_ _In_ REFIID iid, _Out_ LPVOID * ppv) PURE;
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
STDMETHOD_(ULONG, Release)(THIS) PURE;
STDMETHOD(GetDesc)(THIS_ _Out_ D3D12_LIBRARY_DESC * pDesc) PURE;
STDMETHOD_(ID3D12FunctionReflection *, GetFunctionByIndex)(THIS_ _In_ INT FunctionIndex) PURE;
};
// {1108795C-2772-4BA9-B2A8-D464DC7E2799}
interface DECLSPEC_UUID("1108795C-2772-4BA9-B2A8-D464DC7E2799") ID3D12FunctionReflection;
DEFINE_GUID(IID_ID3D12FunctionReflection,
0x1108795c, 0x2772, 0x4ba9, 0xb2, 0xa8, 0xd4, 0x64, 0xdc, 0x7e, 0x27, 0x99);
#undef INTERFACE
#define INTERFACE ID3D12FunctionReflection
DECLARE_INTERFACE(ID3D12FunctionReflection)
{
STDMETHOD(GetDesc)(THIS_ _Out_ D3D12_FUNCTION_DESC * pDesc) PURE;
STDMETHOD_(ID3D12ShaderReflectionConstantBuffer *, GetConstantBufferByIndex)(THIS_ _In_ UINT BufferIndex) PURE;
STDMETHOD_(ID3D12ShaderReflectionConstantBuffer *, GetConstantBufferByName)(THIS_ _In_ LPCSTR Name) PURE;
STDMETHOD(GetResourceBindingDesc)(THIS_ _In_ UINT ResourceIndex,
_Out_ D3D12_SHADER_INPUT_BIND_DESC * pDesc) PURE;
STDMETHOD_(ID3D12ShaderReflectionVariable *, GetVariableByName)(THIS_ _In_ LPCSTR Name) PURE;
STDMETHOD(GetResourceBindingDescByName)(THIS_ _In_ LPCSTR Name,
_Out_ D3D12_SHADER_INPUT_BIND_DESC * pDesc) PURE;
// Use D3D_RETURN_PARAMETER_INDEX to get description of the return value.
STDMETHOD_(ID3D12FunctionParameterReflection *, GetFunctionParameter)(THIS_ _In_ INT ParameterIndex) PURE;
};
// {EC25F42D-7006-4F2B-B33E-02CC3375733F}
interface DECLSPEC_UUID("EC25F42D-7006-4F2B-B33E-02CC3375733F") ID3D12FunctionParameterReflection;
DEFINE_GUID(IID_ID3D12FunctionParameterReflection,
0xec25f42d, 0x7006, 0x4f2b, 0xb3, 0x3e, 0x2, 0xcc, 0x33, 0x75, 0x73, 0x3f);
#undef INTERFACE
#define INTERFACE ID3D12FunctionParameterReflection
DECLARE_INTERFACE(ID3D12FunctionParameterReflection)
{
STDMETHOD(GetDesc)(THIS_ _Out_ D3D12_PARAMETER_DESC * pDesc) PURE;
};
//////////////////////////////////////////////////////////////////////////////
// APIs //////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
#ifdef __cplusplus
extern "C" {
#endif //__cplusplus
#ifdef __cplusplus
}
#endif //__cplusplus
#endif //__D3D12SHADER_H__

8446
include/directx/d3d12video.h Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1073
include/directx/d3dcommon.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,917 @@
/*-------------------------------------------------------------------------------------
*
* Copyright (c) Microsoft Corporation
* Licensed under the MIT license
*
*-------------------------------------------------------------------------------------*/
import "OAIdl.idl";
import "OCIdl.idl";
//----------------------------------------------------------------------------
//
// D3D-version-neutral runtime information.
//
//----------------------------------------------------------------------------
typedef enum D3D_DRIVER_TYPE
{
D3D_DRIVER_TYPE_UNKNOWN,
D3D_DRIVER_TYPE_HARDWARE,
D3D_DRIVER_TYPE_REFERENCE,
D3D_DRIVER_TYPE_NULL,
D3D_DRIVER_TYPE_SOFTWARE,
D3D_DRIVER_TYPE_WARP,
} D3D_DRIVER_TYPE;
typedef enum D3D_FEATURE_LEVEL
{
D3D_FEATURE_LEVEL_1_0_CORE = 0x1000,
D3D_FEATURE_LEVEL_9_1 = 0x9100,
D3D_FEATURE_LEVEL_9_2 = 0x9200,
D3D_FEATURE_LEVEL_9_3 = 0x9300,
D3D_FEATURE_LEVEL_10_0 = 0xa000,
D3D_FEATURE_LEVEL_10_1 = 0xa100,
D3D_FEATURE_LEVEL_11_0 = 0xb000,
D3D_FEATURE_LEVEL_11_1 = 0xb100,
D3D_FEATURE_LEVEL_12_0 = 0xc000,
D3D_FEATURE_LEVEL_12_1 = 0xc100,
D3D_FEATURE_LEVEL_12_2 = 0xc200
} D3D_FEATURE_LEVEL;
cpp_quote("#define D3D_FL9_1_REQ_TEXTURE1D_U_DIMENSION 2048")
cpp_quote("#define D3D_FL9_3_REQ_TEXTURE1D_U_DIMENSION 4096")
cpp_quote("#define D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION 2048")
cpp_quote("#define D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION 4096")
cpp_quote("#define D3D_FL9_1_REQ_TEXTURECUBE_DIMENSION 512")
cpp_quote("#define D3D_FL9_3_REQ_TEXTURECUBE_DIMENSION 4096")
cpp_quote("#define D3D_FL9_1_REQ_TEXTURE3D_U_V_OR_W_DIMENSION 256")
cpp_quote("#define D3D_FL9_1_DEFAULT_MAX_ANISOTROPY 2")
cpp_quote("#define D3D_FL9_1_IA_PRIMITIVE_MAX_COUNT 65535")
cpp_quote("#define D3D_FL9_2_IA_PRIMITIVE_MAX_COUNT 1048575")
cpp_quote("#define D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT 1")
cpp_quote("#define D3D_FL9_3_SIMULTANEOUS_RENDER_TARGET_COUNT 4")
cpp_quote("#define D3D_FL9_1_MAX_TEXTURE_REPEAT 128")
cpp_quote("#define D3D_FL9_2_MAX_TEXTURE_REPEAT 2048")
cpp_quote("#define D3D_FL9_3_MAX_TEXTURE_REPEAT 8192")
typedef enum D3D_PRIMITIVE_TOPOLOGY
{
D3D_PRIMITIVE_TOPOLOGY_UNDEFINED = 0,
D3D_PRIMITIVE_TOPOLOGY_POINTLIST = 1,
D3D_PRIMITIVE_TOPOLOGY_LINELIST = 2,
D3D_PRIMITIVE_TOPOLOGY_LINESTRIP = 3,
D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST = 4,
D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = 5,
// 6 is reserved for legacy triangle fans
// Adjacency values should be equal to (0x8 & non-adjacency):
D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = 10,
D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = 11,
D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = 12,
D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = 13,
D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST = 33,
D3D_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST = 34,
D3D_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST = 35,
D3D_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST = 36,
D3D_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST = 37,
D3D_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST = 38,
D3D_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST = 39,
D3D_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST = 40,
D3D_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST = 41,
D3D_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST = 42,
D3D_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST = 43,
D3D_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST = 44,
D3D_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST = 45,
D3D_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST = 46,
D3D_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST = 47,
D3D_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST = 48,
D3D_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST = 49,
D3D_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST = 50,
D3D_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST = 51,
D3D_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST = 52,
D3D_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST = 53,
D3D_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST = 54,
D3D_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST = 55,
D3D_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST = 56,
D3D_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST = 57,
D3D_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST = 58,
D3D_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST = 59,
D3D_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST = 60,
D3D_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST = 61,
D3D_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST = 62,
D3D_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST = 63,
D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST = 64,
D3D10_PRIMITIVE_TOPOLOGY_UNDEFINED = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED,
D3D10_PRIMITIVE_TOPOLOGY_POINTLIST = D3D_PRIMITIVE_TOPOLOGY_POINTLIST,
D3D10_PRIMITIVE_TOPOLOGY_LINELIST = D3D_PRIMITIVE_TOPOLOGY_LINELIST,
D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP,
D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST,
D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP,
D3D10_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ,
D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ,
D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ,
D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ,
D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED,
D3D11_PRIMITIVE_TOPOLOGY_POINTLIST = D3D_PRIMITIVE_TOPOLOGY_POINTLIST,
D3D11_PRIMITIVE_TOPOLOGY_LINELIST = D3D_PRIMITIVE_TOPOLOGY_LINELIST,
D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP,
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST,
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP,
D3D11_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ,
D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ,
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ,
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ,
D3D11_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST,
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,
} D3D_PRIMITIVE_TOPOLOGY;
typedef enum D3D_PRIMITIVE
{
D3D_PRIMITIVE_UNDEFINED = 0,
D3D_PRIMITIVE_POINT = 1,
D3D_PRIMITIVE_LINE = 2,
D3D_PRIMITIVE_TRIANGLE = 3,
// Adjacency values should be equal to (0x4 & non-adjacency):
D3D_PRIMITIVE_LINE_ADJ = 6,
D3D_PRIMITIVE_TRIANGLE_ADJ = 7,
D3D_PRIMITIVE_1_CONTROL_POINT_PATCH = 8,
D3D_PRIMITIVE_2_CONTROL_POINT_PATCH = 9,
D3D_PRIMITIVE_3_CONTROL_POINT_PATCH = 10,
D3D_PRIMITIVE_4_CONTROL_POINT_PATCH = 11,
D3D_PRIMITIVE_5_CONTROL_POINT_PATCH = 12,
D3D_PRIMITIVE_6_CONTROL_POINT_PATCH = 13,
D3D_PRIMITIVE_7_CONTROL_POINT_PATCH = 14,
D3D_PRIMITIVE_8_CONTROL_POINT_PATCH = 15,
D3D_PRIMITIVE_9_CONTROL_POINT_PATCH = 16,
D3D_PRIMITIVE_10_CONTROL_POINT_PATCH = 17,
D3D_PRIMITIVE_11_CONTROL_POINT_PATCH = 18,
D3D_PRIMITIVE_12_CONTROL_POINT_PATCH = 19,
D3D_PRIMITIVE_13_CONTROL_POINT_PATCH = 20,
D3D_PRIMITIVE_14_CONTROL_POINT_PATCH = 21,
D3D_PRIMITIVE_15_CONTROL_POINT_PATCH = 22,
D3D_PRIMITIVE_16_CONTROL_POINT_PATCH = 23,
D3D_PRIMITIVE_17_CONTROL_POINT_PATCH = 24,
D3D_PRIMITIVE_18_CONTROL_POINT_PATCH = 25,
D3D_PRIMITIVE_19_CONTROL_POINT_PATCH = 26,
D3D_PRIMITIVE_20_CONTROL_POINT_PATCH = 27,
D3D_PRIMITIVE_21_CONTROL_POINT_PATCH = 28,
D3D_PRIMITIVE_22_CONTROL_POINT_PATCH = 29,
D3D_PRIMITIVE_23_CONTROL_POINT_PATCH = 30,
D3D_PRIMITIVE_24_CONTROL_POINT_PATCH = 31,
D3D_PRIMITIVE_25_CONTROL_POINT_PATCH = 32,
D3D_PRIMITIVE_26_CONTROL_POINT_PATCH = 33,
D3D_PRIMITIVE_27_CONTROL_POINT_PATCH = 34,
D3D_PRIMITIVE_28_CONTROL_POINT_PATCH = 35,
D3D_PRIMITIVE_29_CONTROL_POINT_PATCH = 36,
D3D_PRIMITIVE_30_CONTROL_POINT_PATCH = 37,
D3D_PRIMITIVE_31_CONTROL_POINT_PATCH = 38,
D3D_PRIMITIVE_32_CONTROL_POINT_PATCH = 39,
D3D10_PRIMITIVE_UNDEFINED = D3D_PRIMITIVE_UNDEFINED,
D3D10_PRIMITIVE_POINT = D3D_PRIMITIVE_POINT,
D3D10_PRIMITIVE_LINE = D3D_PRIMITIVE_LINE,
D3D10_PRIMITIVE_TRIANGLE = D3D_PRIMITIVE_TRIANGLE,
D3D10_PRIMITIVE_LINE_ADJ = D3D_PRIMITIVE_LINE_ADJ,
D3D10_PRIMITIVE_TRIANGLE_ADJ = D3D_PRIMITIVE_TRIANGLE_ADJ,
D3D11_PRIMITIVE_UNDEFINED = D3D_PRIMITIVE_UNDEFINED,
D3D11_PRIMITIVE_POINT = D3D_PRIMITIVE_POINT,
D3D11_PRIMITIVE_LINE = D3D_PRIMITIVE_LINE,
D3D11_PRIMITIVE_TRIANGLE = D3D_PRIMITIVE_TRIANGLE,
D3D11_PRIMITIVE_LINE_ADJ = D3D_PRIMITIVE_LINE_ADJ,
D3D11_PRIMITIVE_TRIANGLE_ADJ = D3D_PRIMITIVE_TRIANGLE_ADJ,
D3D11_PRIMITIVE_1_CONTROL_POINT_PATCH = D3D_PRIMITIVE_1_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_2_CONTROL_POINT_PATCH = D3D_PRIMITIVE_2_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_3_CONTROL_POINT_PATCH = D3D_PRIMITIVE_3_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_4_CONTROL_POINT_PATCH = D3D_PRIMITIVE_4_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_5_CONTROL_POINT_PATCH = D3D_PRIMITIVE_5_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_6_CONTROL_POINT_PATCH = D3D_PRIMITIVE_6_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_7_CONTROL_POINT_PATCH = D3D_PRIMITIVE_7_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_8_CONTROL_POINT_PATCH = D3D_PRIMITIVE_8_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_9_CONTROL_POINT_PATCH = D3D_PRIMITIVE_9_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_10_CONTROL_POINT_PATCH = D3D_PRIMITIVE_10_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_11_CONTROL_POINT_PATCH = D3D_PRIMITIVE_11_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_12_CONTROL_POINT_PATCH = D3D_PRIMITIVE_12_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_13_CONTROL_POINT_PATCH = D3D_PRIMITIVE_13_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_14_CONTROL_POINT_PATCH = D3D_PRIMITIVE_14_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_15_CONTROL_POINT_PATCH = D3D_PRIMITIVE_15_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_16_CONTROL_POINT_PATCH = D3D_PRIMITIVE_16_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_17_CONTROL_POINT_PATCH = D3D_PRIMITIVE_17_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_18_CONTROL_POINT_PATCH = D3D_PRIMITIVE_18_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_19_CONTROL_POINT_PATCH = D3D_PRIMITIVE_19_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_20_CONTROL_POINT_PATCH = D3D_PRIMITIVE_20_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_21_CONTROL_POINT_PATCH = D3D_PRIMITIVE_21_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_22_CONTROL_POINT_PATCH = D3D_PRIMITIVE_22_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_23_CONTROL_POINT_PATCH = D3D_PRIMITIVE_23_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_24_CONTROL_POINT_PATCH = D3D_PRIMITIVE_24_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_25_CONTROL_POINT_PATCH = D3D_PRIMITIVE_25_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_26_CONTROL_POINT_PATCH = D3D_PRIMITIVE_26_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_27_CONTROL_POINT_PATCH = D3D_PRIMITIVE_27_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_28_CONTROL_POINT_PATCH = D3D_PRIMITIVE_28_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_29_CONTROL_POINT_PATCH = D3D_PRIMITIVE_29_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_30_CONTROL_POINT_PATCH = D3D_PRIMITIVE_30_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_31_CONTROL_POINT_PATCH = D3D_PRIMITIVE_31_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_32_CONTROL_POINT_PATCH = D3D_PRIMITIVE_32_CONTROL_POINT_PATCH,
} D3D_PRIMITIVE;
typedef enum D3D_SRV_DIMENSION
{
D3D_SRV_DIMENSION_UNKNOWN = 0,
D3D_SRV_DIMENSION_BUFFER = 1,
D3D_SRV_DIMENSION_TEXTURE1D = 2,
D3D_SRV_DIMENSION_TEXTURE1DARRAY = 3,
D3D_SRV_DIMENSION_TEXTURE2D = 4,
D3D_SRV_DIMENSION_TEXTURE2DARRAY = 5,
D3D_SRV_DIMENSION_TEXTURE2DMS = 6,
D3D_SRV_DIMENSION_TEXTURE2DMSARRAY = 7,
D3D_SRV_DIMENSION_TEXTURE3D = 8,
D3D_SRV_DIMENSION_TEXTURECUBE = 9,
D3D_SRV_DIMENSION_TEXTURECUBEARRAY = 10,
D3D_SRV_DIMENSION_BUFFEREX = 11,
D3D10_SRV_DIMENSION_UNKNOWN = D3D_SRV_DIMENSION_UNKNOWN,
D3D10_SRV_DIMENSION_BUFFER = D3D_SRV_DIMENSION_BUFFER,
D3D10_SRV_DIMENSION_TEXTURE1D = D3D_SRV_DIMENSION_TEXTURE1D,
D3D10_SRV_DIMENSION_TEXTURE1DARRAY = D3D_SRV_DIMENSION_TEXTURE1DARRAY,
D3D10_SRV_DIMENSION_TEXTURE2D = D3D_SRV_DIMENSION_TEXTURE2D,
D3D10_SRV_DIMENSION_TEXTURE2DARRAY = D3D_SRV_DIMENSION_TEXTURE2DARRAY,
D3D10_SRV_DIMENSION_TEXTURE2DMS = D3D_SRV_DIMENSION_TEXTURE2DMS,
D3D10_SRV_DIMENSION_TEXTURE2DMSARRAY = D3D_SRV_DIMENSION_TEXTURE2DMSARRAY,
D3D10_SRV_DIMENSION_TEXTURE3D = D3D_SRV_DIMENSION_TEXTURE3D,
D3D10_SRV_DIMENSION_TEXTURECUBE = D3D_SRV_DIMENSION_TEXTURECUBE,
D3D10_1_SRV_DIMENSION_UNKNOWN = D3D_SRV_DIMENSION_UNKNOWN,
D3D10_1_SRV_DIMENSION_BUFFER = D3D_SRV_DIMENSION_BUFFER,
D3D10_1_SRV_DIMENSION_TEXTURE1D = D3D_SRV_DIMENSION_TEXTURE1D,
D3D10_1_SRV_DIMENSION_TEXTURE1DARRAY = D3D_SRV_DIMENSION_TEXTURE1DARRAY,
D3D10_1_SRV_DIMENSION_TEXTURE2D = D3D_SRV_DIMENSION_TEXTURE2D,
D3D10_1_SRV_DIMENSION_TEXTURE2DARRAY = D3D_SRV_DIMENSION_TEXTURE2DARRAY,
D3D10_1_SRV_DIMENSION_TEXTURE2DMS = D3D_SRV_DIMENSION_TEXTURE2DMS,
D3D10_1_SRV_DIMENSION_TEXTURE2DMSARRAY = D3D_SRV_DIMENSION_TEXTURE2DMSARRAY,
D3D10_1_SRV_DIMENSION_TEXTURE3D = D3D_SRV_DIMENSION_TEXTURE3D,
D3D10_1_SRV_DIMENSION_TEXTURECUBE = D3D_SRV_DIMENSION_TEXTURECUBE,
D3D10_1_SRV_DIMENSION_TEXTURECUBEARRAY = D3D_SRV_DIMENSION_TEXTURECUBEARRAY,
D3D11_SRV_DIMENSION_UNKNOWN = D3D_SRV_DIMENSION_UNKNOWN,
D3D11_SRV_DIMENSION_BUFFER = D3D_SRV_DIMENSION_BUFFER,
D3D11_SRV_DIMENSION_TEXTURE1D = D3D_SRV_DIMENSION_TEXTURE1D,
D3D11_SRV_DIMENSION_TEXTURE1DARRAY = D3D_SRV_DIMENSION_TEXTURE1DARRAY,
D3D11_SRV_DIMENSION_TEXTURE2D = D3D_SRV_DIMENSION_TEXTURE2D,
D3D11_SRV_DIMENSION_TEXTURE2DARRAY = D3D_SRV_DIMENSION_TEXTURE2DARRAY,
D3D11_SRV_DIMENSION_TEXTURE2DMS = D3D_SRV_DIMENSION_TEXTURE2DMS,
D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY = D3D_SRV_DIMENSION_TEXTURE2DMSARRAY,
D3D11_SRV_DIMENSION_TEXTURE3D = D3D_SRV_DIMENSION_TEXTURE3D,
D3D11_SRV_DIMENSION_TEXTURECUBE = D3D_SRV_DIMENSION_TEXTURECUBE,
D3D11_SRV_DIMENSION_TEXTURECUBEARRAY = D3D_SRV_DIMENSION_TEXTURECUBEARRAY,
D3D11_SRV_DIMENSION_BUFFEREX = D3D_SRV_DIMENSION_BUFFEREX,
} D3D_SRV_DIMENSION;
// Bits in shaders indicating features they use which the runtime checks against current device support:
cpp_quote("#define D3D_SHADER_FEATURE_DOUBLES 0x00001")
cpp_quote("#define D3D_SHADER_FEATURE_COMPUTE_SHADERS_PLUS_RAW_AND_STRUCTURED_BUFFERS_VIA_SHADER_4_X 0x00002")
cpp_quote("#define D3D_SHADER_FEATURE_UAVS_AT_EVERY_STAGE 0x00004")
cpp_quote("#define D3D_SHADER_FEATURE_64_UAVS 0x00008")
cpp_quote("#define D3D_SHADER_FEATURE_MINIMUM_PRECISION 0x00010")
cpp_quote("#define D3D_SHADER_FEATURE_11_1_DOUBLE_EXTENSIONS 0x00020")
cpp_quote("#define D3D_SHADER_FEATURE_11_1_SHADER_EXTENSIONS 0x00040")
cpp_quote("#define D3D_SHADER_FEATURE_LEVEL_9_COMPARISON_FILTERING 0x00080")
cpp_quote("#define D3D_SHADER_FEATURE_TILED_RESOURCES 0x00100")
cpp_quote("#define D3D_SHADER_FEATURE_STENCIL_REF 0x00200")
cpp_quote("#define D3D_SHADER_FEATURE_INNER_COVERAGE 0x00400")
cpp_quote("#define D3D_SHADER_FEATURE_TYPED_UAV_LOAD_ADDITIONAL_FORMATS 0x00800")
cpp_quote("#define D3D_SHADER_FEATURE_ROVS 0x01000")
cpp_quote("#define D3D_SHADER_FEATURE_VIEWPORT_AND_RT_ARRAY_INDEX_FROM_ANY_SHADER_FEEDING_RASTERIZER 0x02000")
cpp_quote("#define D3D_SHADER_FEATURE_WAVE_OPS 0x04000")
cpp_quote("#define D3D_SHADER_FEATURE_INT64_OPS 0x08000")
cpp_quote("#define D3D_SHADER_FEATURE_VIEW_ID 0x10000")
cpp_quote("#define D3D_SHADER_FEATURE_BARYCENTRICS 0x20000")
cpp_quote("#define D3D_SHADER_FEATURE_NATIVE_16BIT_OPS 0x40000")
cpp_quote("#define D3D_SHADER_FEATURE_SHADING_RATE 0x80000")
cpp_quote("#define D3D_SHADER_FEATURE_RAYTRACING_TIER_1_1 0x100000")
cpp_quote("#define D3D_SHADER_FEATURE_SAMPLER_FEEDBACK 0x200000")
cpp_quote("#define D3D_SHADER_FEATURE_ATOMIC_INT64_ON_TYPED_RESOURCE 0x400000")
cpp_quote("#define D3D_SHADER_FEATURE_ATOMIC_INT64_ON_GROUP_SHARED 0x800000")
cpp_quote("#define D3D_SHADER_FEATURE_DERIVATIVES_IN_MESH_AND_AMPLIFICATION_SHADERS 0x1000000")
cpp_quote("#define D3D_SHADER_FEATURE_RESOURCE_DESCRIPTOR_HEAP_INDEXING 0x2000000")
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")
// 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.
//----------------------------------------------------------------------------
//
// Shader compilation information.
//
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// D3D_SHADER_MACRO:
// ----------
// Preprocessor macro definition. The application pass in a NULL-terminated
// array of this structure to various D3D APIs. This enables the application
// to #define tokens at runtime, before the file is parsed.
//----------------------------------------------------------------------------
typedef struct _D3D_SHADER_MACRO
{
LPCSTR Name;
LPCSTR Definition;
} D3D_SHADER_MACRO, *LPD3D_SHADER_MACRO;
//----------------------------------------------------------------------------
// ID3DBlob:
// ------------
// The buffer object is used by D3D to return arbitrary size data.
// For compatibility with D3D10 this interface is also called ID3D10Blob,
// but the version-neutral form is preferred.
//
// GetBufferPointer -
// Returns a pointer to the beginning of the buffer.
//
// GetBufferSize -
// Returns the size of the buffer, in bytes.
//----------------------------------------------------------------------------
// {8BA5FB08-5195-40e2-AC58-0D989C3A0102}
cpp_quote("DEFINE_GUID(IID_ID3D10Blob, 0x8ba5fb08, 0x5195, 0x40e2, 0xac, 0x58, 0xd, 0x98, 0x9c, 0x3a, 0x1, 0x2);")
[ uuid( 8BA5FB08-5195-40e2-AC58-0D989C3A0102 ), object, local, pointer_default( unique ) ]
interface ID3D10Blob : IUnknown
{
LPVOID GetBufferPointer();
SIZE_T GetBufferSize();
};
cpp_quote("typedef interface ID3D10Blob* LPD3D10BLOB;")
typedef ID3D10Blob ID3DBlob;
cpp_quote("typedef ID3DBlob* LPD3DBLOB;")
cpp_quote("#define IID_ID3DBlob IID_ID3D10Blob")
// ID3DDestructionNotifier: An interface to QI for, to set a callback which is triggered when the object is fully destroyed
typedef void(__stdcall *PFN_DESTRUCTION_CALLBACK)(void* pData);
[uuid(a06eb39a-50da-425b-8c31-4eecd6c270f3), object, local, pointer_default(unique)]
interface ID3DDestructionNotifier
: IUnknown
{
HRESULT RegisterDestructionCallback(
[annotation("_In_")] PFN_DESTRUCTION_CALLBACK callbackFn,
[annotation("_In_")] void* pData,
[annotation("_Out_")] UINT* pCallbackID
);
HRESULT UnregisterDestructionCallback(
[annotation("_In_")] UINT callbackID
);
};
typedef enum _D3D_INCLUDE_TYPE
{
D3D_INCLUDE_LOCAL,
D3D_INCLUDE_SYSTEM,
D3D10_INCLUDE_LOCAL = D3D_INCLUDE_LOCAL,
D3D10_INCLUDE_SYSTEM = D3D_INCLUDE_SYSTEM,
// force 32-bit size enum
D3D_INCLUDE_FORCE_DWORD = 0x7fffffff
} D3D_INCLUDE_TYPE;
//----------------------------------------------------------------------------
// ID3DInclude:
// -------------
// This interface is intended to be implemented by the application, and can
// be used by various D3D APIs. This enables application-specific handling
// of #include directives in source files.
//
// Open()
// Opens an include file. If successful, it should fill in ppData and
// pBytes. The data pointer returned must remain valid until Close is
// subsequently called. The name of the file is encoded in UTF-8 format.
// Close()
// Closes an include file. If Open was successful, Close is guaranteed
// to be called before the API using this interface returns.
//----------------------------------------------------------------------------
cpp_quote("typedef interface ID3DInclude ID3DInclude;")
cpp_quote("#undef INTERFACE")
cpp_quote("#define INTERFACE ID3DInclude")
cpp_quote("DECLARE_INTERFACE(ID3DInclude)")
cpp_quote("{")
cpp_quote(" STDMETHOD(Open)(THIS_ D3D_INCLUDE_TYPE IncludeType, LPCSTR pFileName, LPCVOID pParentData, LPCVOID *ppData, UINT *pBytes) PURE;")
cpp_quote(" STDMETHOD(Close)(THIS_ LPCVOID pData) PURE;")
cpp_quote("};")
cpp_quote("typedef ID3DInclude* LPD3DINCLUDE;")
//----------------------------------------------------------------------------
//
// Shader reflection information.
//
//----------------------------------------------------------------------------
typedef enum _D3D_SHADER_VARIABLE_CLASS
{
D3D_SVC_SCALAR,
D3D_SVC_VECTOR,
D3D_SVC_MATRIX_ROWS,
D3D_SVC_MATRIX_COLUMNS,
D3D_SVC_OBJECT,
D3D_SVC_STRUCT,
D3D_SVC_INTERFACE_CLASS,
D3D_SVC_INTERFACE_POINTER,
D3D10_SVC_SCALAR = D3D_SVC_SCALAR,
D3D10_SVC_VECTOR = D3D_SVC_VECTOR,
D3D10_SVC_MATRIX_ROWS = D3D_SVC_MATRIX_ROWS,
D3D10_SVC_MATRIX_COLUMNS = D3D_SVC_MATRIX_COLUMNS,
D3D10_SVC_OBJECT = D3D_SVC_OBJECT,
D3D10_SVC_STRUCT = D3D_SVC_STRUCT,
D3D11_SVC_INTERFACE_CLASS = D3D_SVC_INTERFACE_CLASS,
D3D11_SVC_INTERFACE_POINTER = D3D_SVC_INTERFACE_POINTER,
// force 32-bit size enum
D3D_SVC_FORCE_DWORD = 0x7fffffff
} D3D_SHADER_VARIABLE_CLASS;
typedef enum _D3D_SHADER_VARIABLE_FLAGS
{
D3D_SVF_USERPACKED = 1,
D3D_SVF_USED = 2,
D3D_SVF_INTERFACE_POINTER = 4,
D3D_SVF_INTERFACE_PARAMETER = 8,
D3D10_SVF_USERPACKED = D3D_SVF_USERPACKED,
D3D10_SVF_USED = D3D_SVF_USED,
D3D11_SVF_INTERFACE_POINTER = D3D_SVF_INTERFACE_POINTER,
D3D11_SVF_INTERFACE_PARAMETER = D3D_SVF_INTERFACE_PARAMETER,
// force 32-bit size enum
D3D_SVF_FORCE_DWORD = 0x7fffffff
} D3D_SHADER_VARIABLE_FLAGS;
typedef enum _D3D_SHADER_VARIABLE_TYPE
{
D3D_SVT_VOID = 0,
D3D_SVT_BOOL = 1,
D3D_SVT_INT = 2,
D3D_SVT_FLOAT = 3,
D3D_SVT_STRING = 4,
D3D_SVT_TEXTURE = 5,
D3D_SVT_TEXTURE1D = 6,
D3D_SVT_TEXTURE2D = 7,
D3D_SVT_TEXTURE3D = 8,
D3D_SVT_TEXTURECUBE = 9,
D3D_SVT_SAMPLER = 10,
D3D_SVT_SAMPLER1D = 11,
D3D_SVT_SAMPLER2D = 12,
D3D_SVT_SAMPLER3D = 13,
D3D_SVT_SAMPLERCUBE = 14,
D3D_SVT_PIXELSHADER = 15,
D3D_SVT_VERTEXSHADER = 16,
D3D_SVT_PIXELFRAGMENT = 17,
D3D_SVT_VERTEXFRAGMENT = 18,
D3D_SVT_UINT = 19,
D3D_SVT_UINT8 = 20,
D3D_SVT_GEOMETRYSHADER = 21,
D3D_SVT_RASTERIZER = 22,
D3D_SVT_DEPTHSTENCIL = 23,
D3D_SVT_BLEND = 24,
D3D_SVT_BUFFER = 25,
D3D_SVT_CBUFFER = 26,
D3D_SVT_TBUFFER = 27,
D3D_SVT_TEXTURE1DARRAY = 28,
D3D_SVT_TEXTURE2DARRAY = 29,
D3D_SVT_RENDERTARGETVIEW = 30,
D3D_SVT_DEPTHSTENCILVIEW = 31,
D3D_SVT_TEXTURE2DMS = 32,
D3D_SVT_TEXTURE2DMSARRAY = 33,
D3D_SVT_TEXTURECUBEARRAY = 34,
D3D_SVT_HULLSHADER = 35,
D3D_SVT_DOMAINSHADER = 36,
D3D_SVT_INTERFACE_POINTER = 37,
D3D_SVT_COMPUTESHADER = 38,
D3D_SVT_DOUBLE = 39,
D3D_SVT_RWTEXTURE1D = 40,
D3D_SVT_RWTEXTURE1DARRAY = 41,
D3D_SVT_RWTEXTURE2D = 42,
D3D_SVT_RWTEXTURE2DARRAY = 43,
D3D_SVT_RWTEXTURE3D = 44,
D3D_SVT_RWBUFFER = 45,
D3D_SVT_BYTEADDRESS_BUFFER = 46,
D3D_SVT_RWBYTEADDRESS_BUFFER = 47,
D3D_SVT_STRUCTURED_BUFFER = 48,
D3D_SVT_RWSTRUCTURED_BUFFER = 49,
D3D_SVT_APPEND_STRUCTURED_BUFFER = 50,
D3D_SVT_CONSUME_STRUCTURED_BUFFER = 51,
D3D_SVT_MIN8FLOAT = 52,
D3D_SVT_MIN10FLOAT = 53,
D3D_SVT_MIN16FLOAT = 54,
D3D_SVT_MIN12INT = 55,
D3D_SVT_MIN16INT = 56,
D3D_SVT_MIN16UINT = 57,
D3D_SVT_INT16 = 58,
D3D_SVT_UINT16 = 59,
D3D_SVT_FLOAT16 = 60,
D3D_SVT_INT64 = 61,
D3D_SVT_UINT64 = 62,
D3D10_SVT_VOID = D3D_SVT_VOID,
D3D10_SVT_BOOL = D3D_SVT_BOOL,
D3D10_SVT_INT = D3D_SVT_INT,
D3D10_SVT_FLOAT = D3D_SVT_FLOAT,
D3D10_SVT_STRING = D3D_SVT_STRING,
D3D10_SVT_TEXTURE = D3D_SVT_TEXTURE,
D3D10_SVT_TEXTURE1D = D3D_SVT_TEXTURE1D,
D3D10_SVT_TEXTURE2D = D3D_SVT_TEXTURE2D,
D3D10_SVT_TEXTURE3D = D3D_SVT_TEXTURE3D,
D3D10_SVT_TEXTURECUBE = D3D_SVT_TEXTURECUBE,
D3D10_SVT_SAMPLER = D3D_SVT_SAMPLER,
D3D10_SVT_SAMPLER1D = D3D_SVT_SAMPLER1D,
D3D10_SVT_SAMPLER2D = D3D_SVT_SAMPLER2D,
D3D10_SVT_SAMPLER3D = D3D_SVT_SAMPLER3D,
D3D10_SVT_SAMPLERCUBE = D3D_SVT_SAMPLERCUBE,
D3D10_SVT_PIXELSHADER = D3D_SVT_PIXELSHADER,
D3D10_SVT_VERTEXSHADER = D3D_SVT_VERTEXSHADER,
D3D10_SVT_PIXELFRAGMENT = D3D_SVT_PIXELFRAGMENT,
D3D10_SVT_VERTEXFRAGMENT = D3D_SVT_VERTEXFRAGMENT,
D3D10_SVT_UINT = D3D_SVT_UINT,
D3D10_SVT_UINT8 = D3D_SVT_UINT8,
D3D10_SVT_GEOMETRYSHADER = D3D_SVT_GEOMETRYSHADER,
D3D10_SVT_RASTERIZER = D3D_SVT_RASTERIZER,
D3D10_SVT_DEPTHSTENCIL = D3D_SVT_DEPTHSTENCIL,
D3D10_SVT_BLEND = D3D_SVT_BLEND,
D3D10_SVT_BUFFER = D3D_SVT_BUFFER,
D3D10_SVT_CBUFFER = D3D_SVT_CBUFFER,
D3D10_SVT_TBUFFER = D3D_SVT_TBUFFER,
D3D10_SVT_TEXTURE1DARRAY = D3D_SVT_TEXTURE1DARRAY,
D3D10_SVT_TEXTURE2DARRAY = D3D_SVT_TEXTURE2DARRAY,
D3D10_SVT_RENDERTARGETVIEW = D3D_SVT_RENDERTARGETVIEW,
D3D10_SVT_DEPTHSTENCILVIEW = D3D_SVT_DEPTHSTENCILVIEW,
D3D10_SVT_TEXTURE2DMS = D3D_SVT_TEXTURE2DMS,
D3D10_SVT_TEXTURE2DMSARRAY = D3D_SVT_TEXTURE2DMSARRAY,
D3D10_SVT_TEXTURECUBEARRAY = D3D_SVT_TEXTURECUBEARRAY,
D3D11_SVT_HULLSHADER = D3D_SVT_HULLSHADER,
D3D11_SVT_DOMAINSHADER = D3D_SVT_DOMAINSHADER,
D3D11_SVT_INTERFACE_POINTER = D3D_SVT_INTERFACE_POINTER,
D3D11_SVT_COMPUTESHADER = D3D_SVT_COMPUTESHADER,
D3D11_SVT_DOUBLE = D3D_SVT_DOUBLE,
D3D11_SVT_RWTEXTURE1D = D3D_SVT_RWTEXTURE1D,
D3D11_SVT_RWTEXTURE1DARRAY = D3D_SVT_RWTEXTURE1DARRAY,
D3D11_SVT_RWTEXTURE2D = D3D_SVT_RWTEXTURE2D,
D3D11_SVT_RWTEXTURE2DARRAY = D3D_SVT_RWTEXTURE2DARRAY,
D3D11_SVT_RWTEXTURE3D = D3D_SVT_RWTEXTURE3D,
D3D11_SVT_RWBUFFER = D3D_SVT_RWBUFFER,
D3D11_SVT_BYTEADDRESS_BUFFER = D3D_SVT_BYTEADDRESS_BUFFER,
D3D11_SVT_RWBYTEADDRESS_BUFFER = D3D_SVT_RWBYTEADDRESS_BUFFER,
D3D11_SVT_STRUCTURED_BUFFER = D3D_SVT_STRUCTURED_BUFFER,
D3D11_SVT_RWSTRUCTURED_BUFFER = D3D_SVT_RWSTRUCTURED_BUFFER,
D3D11_SVT_APPEND_STRUCTURED_BUFFER = D3D_SVT_APPEND_STRUCTURED_BUFFER,
D3D11_SVT_CONSUME_STRUCTURED_BUFFER = D3D_SVT_CONSUME_STRUCTURED_BUFFER,
// force 32-bit size enum
D3D_SVT_FORCE_DWORD = 0x7fffffff
} D3D_SHADER_VARIABLE_TYPE;
typedef enum _D3D_SHADER_INPUT_FLAGS
{
D3D_SIF_USERPACKED = 0x01,
D3D_SIF_COMPARISON_SAMPLER = 0x02, // is this a comparison sampler?
D3D_SIF_TEXTURE_COMPONENT_0 = 0x04, // this 2-bit value encodes c - 1, where c
D3D_SIF_TEXTURE_COMPONENT_1 = 0x08, // is the number of components in the texture
D3D_SIF_TEXTURE_COMPONENTS = 0x0c,
D3D_SIF_UNUSED = 0x10,
D3D10_SIF_USERPACKED = D3D_SIF_USERPACKED,
D3D10_SIF_COMPARISON_SAMPLER = D3D_SIF_COMPARISON_SAMPLER,
D3D10_SIF_TEXTURE_COMPONENT_0 = D3D_SIF_TEXTURE_COMPONENT_0,
D3D10_SIF_TEXTURE_COMPONENT_1 = D3D_SIF_TEXTURE_COMPONENT_1,
D3D10_SIF_TEXTURE_COMPONENTS = D3D_SIF_TEXTURE_COMPONENTS,
// force 32-bit size enum
D3D_SIF_FORCE_DWORD = 0x7fffffff
} D3D_SHADER_INPUT_FLAGS;
typedef enum _D3D_SHADER_INPUT_TYPE
{
D3D_SIT_CBUFFER,
D3D_SIT_TBUFFER,
D3D_SIT_TEXTURE,
D3D_SIT_SAMPLER,
D3D_SIT_UAV_RWTYPED,
D3D_SIT_STRUCTURED,
D3D_SIT_UAV_RWSTRUCTURED,
D3D_SIT_BYTEADDRESS,
D3D_SIT_UAV_RWBYTEADDRESS,
D3D_SIT_UAV_APPEND_STRUCTURED,
D3D_SIT_UAV_CONSUME_STRUCTURED,
D3D_SIT_UAV_RWSTRUCTURED_WITH_COUNTER,
D3D_SIT_RTACCELERATIONSTRUCTURE,
D3D_SIT_UAV_FEEDBACKTEXTURE,
D3D10_SIT_CBUFFER = D3D_SIT_CBUFFER,
D3D10_SIT_TBUFFER = D3D_SIT_TBUFFER,
D3D10_SIT_TEXTURE = D3D_SIT_TEXTURE,
D3D10_SIT_SAMPLER = D3D_SIT_SAMPLER,
D3D11_SIT_UAV_RWTYPED = D3D_SIT_UAV_RWTYPED,
D3D11_SIT_STRUCTURED = D3D_SIT_STRUCTURED,
D3D11_SIT_UAV_RWSTRUCTURED = D3D_SIT_UAV_RWSTRUCTURED,
D3D11_SIT_BYTEADDRESS = D3D_SIT_BYTEADDRESS,
D3D11_SIT_UAV_RWBYTEADDRESS = D3D_SIT_UAV_RWBYTEADDRESS,
D3D11_SIT_UAV_APPEND_STRUCTURED = D3D_SIT_UAV_APPEND_STRUCTURED,
D3D11_SIT_UAV_CONSUME_STRUCTURED = D3D_SIT_UAV_CONSUME_STRUCTURED,
D3D11_SIT_UAV_RWSTRUCTURED_WITH_COUNTER = D3D_SIT_UAV_RWSTRUCTURED_WITH_COUNTER,
} D3D_SHADER_INPUT_TYPE;
typedef enum _D3D_SHADER_CBUFFER_FLAGS
{
D3D_CBF_USERPACKED = 1,
D3D10_CBF_USERPACKED = D3D_CBF_USERPACKED,
// force 32-bit size enum
D3D_CBF_FORCE_DWORD = 0x7fffffff
} D3D_SHADER_CBUFFER_FLAGS;
typedef enum _D3D_CBUFFER_TYPE
{
D3D_CT_CBUFFER,
D3D_CT_TBUFFER,
D3D_CT_INTERFACE_POINTERS,
D3D_CT_RESOURCE_BIND_INFO,
D3D10_CT_CBUFFER = D3D_CT_CBUFFER,
D3D10_CT_TBUFFER = D3D_CT_TBUFFER,
D3D11_CT_CBUFFER = D3D_CT_CBUFFER,
D3D11_CT_TBUFFER = D3D_CT_TBUFFER,
D3D11_CT_INTERFACE_POINTERS = D3D_CT_INTERFACE_POINTERS,
D3D11_CT_RESOURCE_BIND_INFO = D3D_CT_RESOURCE_BIND_INFO,
} D3D_CBUFFER_TYPE;
typedef enum D3D_NAME
{
D3D_NAME_UNDEFINED = 0,
// Names meaningful to both HLSL and hardware
D3D_NAME_POSITION = 1,
D3D_NAME_CLIP_DISTANCE = 2,
D3D_NAME_CULL_DISTANCE = 3,
D3D_NAME_RENDER_TARGET_ARRAY_INDEX = 4,
D3D_NAME_VIEWPORT_ARRAY_INDEX = 5,
D3D_NAME_VERTEX_ID = 6,
D3D_NAME_PRIMITIVE_ID = 7,
D3D_NAME_INSTANCE_ID = 8,
D3D_NAME_IS_FRONT_FACE = 9,
D3D_NAME_SAMPLE_INDEX = 10,
D3D_NAME_FINAL_QUAD_EDGE_TESSFACTOR = 11,
D3D_NAME_FINAL_QUAD_INSIDE_TESSFACTOR = 12,
D3D_NAME_FINAL_TRI_EDGE_TESSFACTOR = 13,
D3D_NAME_FINAL_TRI_INSIDE_TESSFACTOR = 14,
D3D_NAME_FINAL_LINE_DETAIL_TESSFACTOR = 15,
D3D_NAME_FINAL_LINE_DENSITY_TESSFACTOR = 16,
D3D_NAME_BARYCENTRICS = 23,
D3D_NAME_SHADINGRATE = 24,
D3D_NAME_CULLPRIMITIVE = 25,
// Names meaningful to HLSL only
D3D_NAME_TARGET = 64,
D3D_NAME_DEPTH = 65,
D3D_NAME_COVERAGE = 66,
D3D_NAME_DEPTH_GREATER_EQUAL = 67,
D3D_NAME_DEPTH_LESS_EQUAL = 68,
D3D_NAME_STENCIL_REF = 69,
D3D_NAME_INNER_COVERAGE = 70,
D3D10_NAME_UNDEFINED = D3D_NAME_UNDEFINED,
D3D10_NAME_POSITION = D3D_NAME_POSITION,
D3D10_NAME_CLIP_DISTANCE = D3D_NAME_CLIP_DISTANCE,
D3D10_NAME_CULL_DISTANCE = D3D_NAME_CULL_DISTANCE,
D3D10_NAME_RENDER_TARGET_ARRAY_INDEX = D3D_NAME_RENDER_TARGET_ARRAY_INDEX,
D3D10_NAME_VIEWPORT_ARRAY_INDEX = D3D_NAME_VIEWPORT_ARRAY_INDEX,
D3D10_NAME_VERTEX_ID = D3D_NAME_VERTEX_ID,
D3D10_NAME_PRIMITIVE_ID = D3D_NAME_PRIMITIVE_ID,
D3D10_NAME_INSTANCE_ID = D3D_NAME_INSTANCE_ID,
D3D10_NAME_IS_FRONT_FACE = D3D_NAME_IS_FRONT_FACE,
D3D10_NAME_SAMPLE_INDEX = D3D_NAME_SAMPLE_INDEX,
D3D10_NAME_TARGET = D3D_NAME_TARGET,
D3D10_NAME_DEPTH = D3D_NAME_DEPTH,
D3D10_NAME_COVERAGE = D3D_NAME_COVERAGE,
D3D11_NAME_FINAL_QUAD_EDGE_TESSFACTOR = D3D_NAME_FINAL_QUAD_EDGE_TESSFACTOR,
D3D11_NAME_FINAL_QUAD_INSIDE_TESSFACTOR = D3D_NAME_FINAL_QUAD_INSIDE_TESSFACTOR,
D3D11_NAME_FINAL_TRI_EDGE_TESSFACTOR = D3D_NAME_FINAL_TRI_EDGE_TESSFACTOR,
D3D11_NAME_FINAL_TRI_INSIDE_TESSFACTOR = D3D_NAME_FINAL_TRI_INSIDE_TESSFACTOR,
D3D11_NAME_FINAL_LINE_DETAIL_TESSFACTOR = D3D_NAME_FINAL_LINE_DETAIL_TESSFACTOR,
D3D11_NAME_FINAL_LINE_DENSITY_TESSFACTOR = D3D_NAME_FINAL_LINE_DENSITY_TESSFACTOR,
D3D11_NAME_DEPTH_GREATER_EQUAL = D3D_NAME_DEPTH_GREATER_EQUAL,
D3D11_NAME_DEPTH_LESS_EQUAL = D3D_NAME_DEPTH_LESS_EQUAL,
D3D11_NAME_STENCIL_REF = D3D_NAME_STENCIL_REF,
D3D11_NAME_INNER_COVERAGE = D3D_NAME_INNER_COVERAGE,
D3D12_NAME_BARYCENTRICS = D3D_NAME_BARYCENTRICS,
D3D12_NAME_SHADINGRATE = D3D_NAME_SHADINGRATE,
D3D12_NAME_CULLPRIMITIVE = D3D_NAME_CULLPRIMITIVE,
} D3D_NAME;
typedef enum D3D_RESOURCE_RETURN_TYPE
{
D3D_RETURN_TYPE_UNORM = 1,
D3D_RETURN_TYPE_SNORM = 2,
D3D_RETURN_TYPE_SINT = 3,
D3D_RETURN_TYPE_UINT = 4,
D3D_RETURN_TYPE_FLOAT = 5,
D3D_RETURN_TYPE_MIXED = 6,
D3D_RETURN_TYPE_DOUBLE = 7,
D3D_RETURN_TYPE_CONTINUED = 8,
D3D10_RETURN_TYPE_UNORM = D3D_RETURN_TYPE_UNORM,
D3D10_RETURN_TYPE_SNORM = D3D_RETURN_TYPE_SNORM,
D3D10_RETURN_TYPE_SINT = D3D_RETURN_TYPE_SINT,
D3D10_RETURN_TYPE_UINT = D3D_RETURN_TYPE_UINT,
D3D10_RETURN_TYPE_FLOAT = D3D_RETURN_TYPE_FLOAT,
D3D10_RETURN_TYPE_MIXED = D3D_RETURN_TYPE_MIXED,
D3D11_RETURN_TYPE_UNORM = D3D_RETURN_TYPE_UNORM,
D3D11_RETURN_TYPE_SNORM = D3D_RETURN_TYPE_SNORM,
D3D11_RETURN_TYPE_SINT = D3D_RETURN_TYPE_SINT,
D3D11_RETURN_TYPE_UINT = D3D_RETURN_TYPE_UINT,
D3D11_RETURN_TYPE_FLOAT = D3D_RETURN_TYPE_FLOAT,
D3D11_RETURN_TYPE_MIXED = D3D_RETURN_TYPE_MIXED,
D3D11_RETURN_TYPE_DOUBLE = D3D_RETURN_TYPE_DOUBLE,
D3D11_RETURN_TYPE_CONTINUED = D3D_RETURN_TYPE_CONTINUED,
} D3D_RESOURCE_RETURN_TYPE;
typedef enum D3D_REGISTER_COMPONENT_TYPE
{
D3D_REGISTER_COMPONENT_UNKNOWN = 0,
D3D_REGISTER_COMPONENT_UINT32 = 1,
D3D_REGISTER_COMPONENT_SINT32 = 2,
D3D_REGISTER_COMPONENT_FLOAT32 = 3,
D3D10_REGISTER_COMPONENT_UNKNOWN = D3D_REGISTER_COMPONENT_UNKNOWN,
D3D10_REGISTER_COMPONENT_UINT32 = D3D_REGISTER_COMPONENT_UINT32,
D3D10_REGISTER_COMPONENT_SINT32 = D3D_REGISTER_COMPONENT_SINT32,
D3D10_REGISTER_COMPONENT_FLOAT32 = D3D_REGISTER_COMPONENT_FLOAT32,
} D3D_REGISTER_COMPONENT_TYPE;
typedef enum D3D_TESSELLATOR_DOMAIN
{
D3D_TESSELLATOR_DOMAIN_UNDEFINED = 0,
D3D_TESSELLATOR_DOMAIN_ISOLINE = 1,
D3D_TESSELLATOR_DOMAIN_TRI = 2,
D3D_TESSELLATOR_DOMAIN_QUAD = 3,
D3D11_TESSELLATOR_DOMAIN_UNDEFINED = D3D_TESSELLATOR_DOMAIN_UNDEFINED,
D3D11_TESSELLATOR_DOMAIN_ISOLINE = D3D_TESSELLATOR_DOMAIN_ISOLINE,
D3D11_TESSELLATOR_DOMAIN_TRI = D3D_TESSELLATOR_DOMAIN_TRI,
D3D11_TESSELLATOR_DOMAIN_QUAD = D3D_TESSELLATOR_DOMAIN_QUAD,
} D3D_TESSELLATOR_DOMAIN;
typedef enum D3D_TESSELLATOR_PARTITIONING
{
D3D_TESSELLATOR_PARTITIONING_UNDEFINED = 0,
D3D_TESSELLATOR_PARTITIONING_INTEGER = 1,
D3D_TESSELLATOR_PARTITIONING_POW2 = 2,
D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD = 3,
D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN = 4,
D3D11_TESSELLATOR_PARTITIONING_UNDEFINED = D3D_TESSELLATOR_PARTITIONING_UNDEFINED,
D3D11_TESSELLATOR_PARTITIONING_INTEGER = D3D_TESSELLATOR_PARTITIONING_INTEGER,
D3D11_TESSELLATOR_PARTITIONING_POW2 = D3D_TESSELLATOR_PARTITIONING_POW2,
D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD = D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD,
D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN = D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN,
} D3D_TESSELLATOR_PARTITIONING;
typedef enum D3D_TESSELLATOR_OUTPUT_PRIMITIVE
{
D3D_TESSELLATOR_OUTPUT_UNDEFINED = 0,
D3D_TESSELLATOR_OUTPUT_POINT = 1,
D3D_TESSELLATOR_OUTPUT_LINE = 2,
D3D_TESSELLATOR_OUTPUT_TRIANGLE_CW = 3,
D3D_TESSELLATOR_OUTPUT_TRIANGLE_CCW = 4,
D3D11_TESSELLATOR_OUTPUT_UNDEFINED = D3D_TESSELLATOR_OUTPUT_UNDEFINED,
D3D11_TESSELLATOR_OUTPUT_POINT = D3D_TESSELLATOR_OUTPUT_POINT,
D3D11_TESSELLATOR_OUTPUT_LINE = D3D_TESSELLATOR_OUTPUT_LINE,
D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CW = D3D_TESSELLATOR_OUTPUT_TRIANGLE_CW,
D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CCW = D3D_TESSELLATOR_OUTPUT_TRIANGLE_CCW,
} D3D_TESSELLATOR_OUTPUT_PRIMITIVE;
typedef enum D3D_MIN_PRECISION
{
D3D_MIN_PRECISION_DEFAULT = 0, // Default precision for the shader model
D3D_MIN_PRECISION_FLOAT_16 = 1, // Min 16 bit/component float
D3D_MIN_PRECISION_FLOAT_2_8 = 2, // Min 10(2.8)bit/comp. float
D3D_MIN_PRECISION_RESERVED = 3, // Reserved for future use
D3D_MIN_PRECISION_SINT_16 = 4, // Min 16 bit/comp. signed integer
D3D_MIN_PRECISION_UINT_16 = 5, // Min 16 bit/comp. unsigned integer
// These values are abstractions of width only for use in situations
// where a general width is needed instead of specific types. They
// will never be used in shader operands.
D3D_MIN_PRECISION_ANY_16 = 0xf0,
D3D_MIN_PRECISION_ANY_10 = 0xf1,
} D3D_MIN_PRECISION;
typedef enum D3D_INTERPOLATION_MODE
{
D3D_INTERPOLATION_UNDEFINED = 0,
D3D_INTERPOLATION_CONSTANT = 1,
D3D_INTERPOLATION_LINEAR = 2,
D3D_INTERPOLATION_LINEAR_CENTROID = 3,
D3D_INTERPOLATION_LINEAR_NOPERSPECTIVE = 4,
D3D_INTERPOLATION_LINEAR_NOPERSPECTIVE_CENTROID = 5,
D3D_INTERPOLATION_LINEAR_SAMPLE = 6,
D3D_INTERPOLATION_LINEAR_NOPERSPECTIVE_SAMPLE = 7,
} D3D_INTERPOLATION_MODE;
// Parameter flags.
typedef enum _D3D_PARAMETER_FLAGS
{
D3D_PF_NONE = 0x00000000,
D3D_PF_IN = 0x00000001,
D3D_PF_OUT = 0x00000002,
D3D_PF_FORCE_DWORD = 0x7fffffff
} D3D_PARAMETER_FLAGS;
// Well-Known Private Data IDs (WKPDID_*):
// WKPDID_D3DDebugObjectName provides a unique name to objects in order to assist the developer during debugging.
//
// const char c_szName[] = "texture.jpg";
// pObject->SetPrivateData( WKPDID_D3DDebugObjectName, sizeof( c_szName ) - 1, c_szName );
cpp_quote("DEFINE_GUID(WKPDID_D3DDebugObjectName,0x429b8c22,0x9188,0x4b0c,0x87,0x42,0xac,0xb0,0xbf,0x85,0xc2,0x00);")
cpp_quote("DEFINE_GUID(WKPDID_D3DDebugObjectNameW,0x4cca5fd8,0x921f,0x42c8,0x85,0x66,0x70,0xca,0xf2,0xa9,0xb7,0x41);")
cpp_quote("DEFINE_GUID(WKPDID_CommentStringW,0xd0149dc0,0x90e8,0x4ec8,0x81, 0x44, 0xe9, 0x00, 0xad, 0x26, 0x6b, 0xb2);")
cpp_quote("DEFINE_GUID(WKPDID_D3D12UniqueObjectId, 0x1b39de15, 0xec04, 0x4bae, 0xba, 0x4d, 0x8c, 0xef, 0x79, 0xfc, 0x04, 0xc1);")
cpp_quote("#define D3D_SET_OBJECT_NAME_N_A(pObject, Chars, pName) (pObject)->SetPrivateData(WKPDID_D3DDebugObjectName, Chars, pName)")
cpp_quote("#define D3D_SET_OBJECT_NAME_A(pObject, pName) D3D_SET_OBJECT_NAME_N_A(pObject, lstrlenA(pName), pName)")
cpp_quote("#define D3D_SET_OBJECT_NAME_N_W(pObject, Chars, pName) (pObject)->SetPrivateData(WKPDID_D3DDebugObjectNameW, Chars*2, pName)")
cpp_quote("#define D3D_SET_OBJECT_NAME_W(pObject, pName) D3D_SET_OBJECT_NAME_N_W(pObject, wcslen(pName), pName)")
cpp_quote("#define D3D_COMPONENT_MASK_X 1")
cpp_quote("#define D3D_COMPONENT_MASK_Y 2")
cpp_quote("#define D3D_COMPONENT_MASK_Z 4")
cpp_quote("#define D3D_COMPONENT_MASK_W 8")
cpp_quote("DEFINE_GUID(D3D_TEXTURE_LAYOUT_ROW_MAJOR,0xb5dc234f,0x72bb,0x4bec,0x97,0x05,0x8c,0xf2,0x58,0xdf,0x6b,0x6c);") // Feature_D3D1XDisplayable
cpp_quote("DEFINE_GUID(D3D_TEXTURE_LAYOUT_64KB_STANDARD_SWIZZLE,0x4c0f29e3,0x3f5f,0x4d35,0x84,0xc9,0xbc,0x09,0x83,0xb6,0x2c,0x28);") // Feature_D3D1XDisplayable

5032
include/directx/d3dx12.h Normal file

File diff suppressed because it is too large Load Diff

41
include/directx/dxcore.h Normal file
View File

@ -0,0 +1,41 @@
/************************************************************
* *
* Copyright (c) Microsoft Corporation. *
* Licensed under the MIT license. *
* *
************************************************************/
#ifndef _DXCOREEXTMODULE_H_
#define _DXCOREEXTMODULE_H_
#include <winapifamily.h>
#include "dxcore_interface.h"
#pragma region Application Family or OneCore Family
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM)
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN10)
STDAPI
DXCoreCreateAdapterFactory(
REFIID riid,
_COM_Outptr_ void** ppvFactory
);
template <class T>
HRESULT
DXCoreCreateAdapterFactory(
_COM_Outptr_ T** ppvFactory
)
{
return DXCoreCreateAdapterFactory(IID_PPV_ARGS(ppvFactory));
}
#endif // (_WIN32_WINNT >= _WIN32_WINNT_WIN10)
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM) */
#pragma endregion
#endif // _DXCOREEXTMODULE_H_

View File

@ -0,0 +1,316 @@
//
// DXCore Interface
// Copyright (C) Microsoft Corporation.
// Licensed under the MIT license.
//
#ifndef __dxcore_interface_h__
#define __dxcore_interface_h__
#ifndef COM_NO_WINDOWS_H
#include "windows.h"
#include "ole2.h"
#endif /*COM_NO_WINDOWS_H*/
#include <stdint.h>
#ifdef __cplusplus
#define _FACDXCORE 0x880
#define MAKE_DXCORE_HRESULT( code ) MAKE_HRESULT( 1, _FACDXCORE, code )
enum class DXCoreAdapterProperty : uint32_t
{
InstanceLuid = 0,
DriverVersion = 1,
DriverDescription = 2,
HardwareID = 3, // Use HardwareIDParts instead, if available.
KmdModelVersion = 4,
ComputePreemptionGranularity = 5,
GraphicsPreemptionGranularity = 6,
DedicatedAdapterMemory = 7,
DedicatedSystemMemory = 8,
SharedSystemMemory = 9,
AcgCompatible = 10,
IsHardware = 11,
IsIntegrated = 12,
IsDetachable = 13,
HardwareIDParts = 14
};
enum class DXCoreAdapterState : uint32_t
{
IsDriverUpdateInProgress = 0,
AdapterMemoryBudget = 1
};
enum class DXCoreSegmentGroup : uint32_t
{
Local = 0,
NonLocal = 1
};
enum class DXCoreNotificationType : uint32_t
{
AdapterListStale = 0,
AdapterNoLongerValid = 1,
AdapterBudgetChange = 2,
AdapterHardwareContentProtectionTeardown = 3
};
enum class DXCoreAdapterPreference : uint32_t
{
Hardware = 0,
MinimumPower = 1,
HighPerformance = 2
};
struct DXCoreHardwareID
{
uint32_t vendorID;
uint32_t deviceID;
uint32_t subSysID;
uint32_t revision;
};
struct DXCoreHardwareIDParts
{
uint32_t vendorID;
uint32_t deviceID;
uint32_t subSystemID;
uint32_t subVendorID;
uint32_t revisionID;
};
struct DXCoreAdapterMemoryBudgetNodeSegmentGroup
{
uint32_t nodeIndex;
DXCoreSegmentGroup segmentGroup;
};
struct DXCoreAdapterMemoryBudget
{
uint64_t budget;
uint64_t currentUsage;
uint64_t availableForReservation;
uint64_t currentReservation;
};
typedef void (STDMETHODCALLTYPE *PFN_DXCORE_NOTIFICATION_CALLBACK)(
DXCoreNotificationType notificationType,
_In_ IUnknown *object,
_In_opt_ void *context);
static_assert(sizeof(bool) == 1, "bool assumed as one byte");
DEFINE_GUID(IID_IDXCoreAdapterFactory, 0x78ee5945, 0xc36e, 0x4b13, 0xa6, 0x69, 0x00, 0x5d, 0xd1, 0x1c, 0x0f, 0x06);
DEFINE_GUID(IID_IDXCoreAdapterList, 0x526c7776, 0x40e9, 0x459b, 0xb7, 0x11, 0xf3, 0x2a, 0xd7, 0x6d, 0xfc, 0x28);
DEFINE_GUID(IID_IDXCoreAdapter, 0xf0db4c7f, 0xfe5a, 0x42a2, 0xbd, 0x62, 0xf2, 0xa6, 0xcf, 0x6f, 0xc8, 0x3e);
DEFINE_GUID(DXCORE_ADAPTER_ATTRIBUTE_D3D11_GRAPHICS, 0x8c47866b, 0x7583, 0x450d, 0xf0, 0xf0, 0x6b, 0xad, 0xa8, 0x95, 0xaf, 0x4b);
DEFINE_GUID(DXCORE_ADAPTER_ATTRIBUTE_D3D12_GRAPHICS, 0x0c9ece4d, 0x2f6e, 0x4f01, 0x8c, 0x96, 0xe8, 0x9e, 0x33, 0x1b, 0x47, 0xb1);
DEFINE_GUID(DXCORE_ADAPTER_ATTRIBUTE_D3D12_CORE_COMPUTE, 0x248e2800, 0xa793, 0x4724, 0xab, 0xaa, 0x23, 0xa6, 0xde, 0x1b, 0xe0, 0x90);
/* interface IDXCoreAdapter */
MIDL_INTERFACE("f0db4c7f-fe5a-42a2-bd62-f2a6cf6fc83e")
IDXCoreAdapter : public IUnknown
{
public:
virtual bool STDMETHODCALLTYPE IsValid() = 0;
virtual bool STDMETHODCALLTYPE IsAttributeSupported(
REFGUID attributeGUID) = 0;
virtual bool STDMETHODCALLTYPE IsPropertySupported(
DXCoreAdapterProperty property) = 0;
virtual HRESULT STDMETHODCALLTYPE GetProperty(
DXCoreAdapterProperty property,
size_t bufferSize,
_Out_writes_bytes_(bufferSize) void *propertyData) = 0;
template <class T>
HRESULT GetProperty(
DXCoreAdapterProperty property,
_Out_writes_bytes_(sizeof(T)) T *propertyData)
{
return GetProperty(property,
sizeof(T),
(void*)propertyData);
}
virtual HRESULT STDMETHODCALLTYPE GetPropertySize(
DXCoreAdapterProperty property,
_Out_ size_t *bufferSize) = 0;
virtual bool STDMETHODCALLTYPE IsQueryStateSupported(
DXCoreAdapterState property) = 0;
virtual HRESULT STDMETHODCALLTYPE QueryState(
DXCoreAdapterState state,
size_t inputStateDetailsSize,
_In_reads_bytes_opt_(inputStateDetailsSize) const void *inputStateDetails,
size_t outputBufferSize,
_Out_writes_bytes_(outputBufferSize) void *outputBuffer) = 0;
template <class T1, class T2>
HRESULT QueryState(
DXCoreAdapterState state,
_In_reads_bytes_opt_(sizeof(T1)) const T1 *inputStateDetails,
_Out_writes_bytes_(sizeof(T2)) T2 *outputBuffer)
{
return QueryState(state,
sizeof(T1),
(const void*)inputStateDetails,
sizeof(T2),
(void*)outputBuffer);
}
template <class T>
HRESULT QueryState(
DXCoreAdapterState state,
_Out_writes_bytes_(sizeof(T)) T *outputBuffer)
{
return QueryState(state,
0,
nullptr,
sizeof(T),
(void*)outputBuffer);
}
virtual bool STDMETHODCALLTYPE IsSetStateSupported(
DXCoreAdapterState property) = 0;
virtual HRESULT STDMETHODCALLTYPE SetState(
DXCoreAdapterState state,
size_t inputStateDetailsSize,
_In_reads_bytes_opt_(inputStateDetailsSize) const void *inputStateDetails,
size_t inputDataSize,
_In_reads_bytes_(inputDataSize) const void *inputData) = 0;
template <class T1, class T2>
HRESULT SetState(
DXCoreAdapterState state,
const T1 *inputStateDetails,
const T2 *inputData)
{
return SetState(state,
sizeof(T1),
(const void*)inputStateDetails,
sizeof(T2),
(const void*)inputData);
}
virtual HRESULT STDMETHODCALLTYPE GetFactory(
REFIID riid,
_COM_Outptr_ void** ppvFactory
) = 0;
template <class T>
HRESULT GetFactory(
_COM_Outptr_ T** ppvFactory
)
{
return GetFactory(IID_PPV_ARGS(ppvFactory));
}
};
/* interface IDXCoreAdapterList */
MIDL_INTERFACE("526c7776-40e9-459b-b711-f32ad76dfc28")
IDXCoreAdapterList : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE GetAdapter(
uint32_t index,
REFIID riid,
_COM_Outptr_ void **ppvAdapter) = 0;
template<class T>
HRESULT STDMETHODCALLTYPE GetAdapter(
uint32_t index,
_COM_Outptr_ T **ppvAdapter)
{
return GetAdapter(index,
IID_PPV_ARGS(ppvAdapter));
}
virtual uint32_t STDMETHODCALLTYPE GetAdapterCount() = 0;
virtual bool STDMETHODCALLTYPE IsStale() = 0;
virtual HRESULT STDMETHODCALLTYPE GetFactory(
REFIID riid,
_COM_Outptr_ void** ppvFactory
) = 0;
template <class T>
HRESULT GetFactory(
_COM_Outptr_ T** ppvFactory
)
{
return GetFactory(IID_PPV_ARGS(ppvFactory));
}
virtual HRESULT STDMETHODCALLTYPE Sort(
uint32_t numPreferences,
_In_reads_(numPreferences) const DXCoreAdapterPreference* preferences) = 0;
virtual bool STDMETHODCALLTYPE IsAdapterPreferenceSupported(
DXCoreAdapterPreference preference) = 0;
};
/* interface IDXCoreAdapterFactory */
MIDL_INTERFACE("78ee5945-c36e-4b13-a669-005dd11c0f06")
IDXCoreAdapterFactory : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE CreateAdapterList(
uint32_t numAttributes,
_In_reads_(numAttributes) const GUID *filterAttributes,
REFIID riid,
_COM_Outptr_ void **ppvAdapterList) = 0;
template<class T>
HRESULT STDMETHODCALLTYPE CreateAdapterList(
uint32_t numAttributes,
_In_reads_(numAttributes) const GUID *filterAttributes,
_COM_Outptr_ T **ppvAdapterList)
{
return CreateAdapterList(numAttributes,
filterAttributes,
IID_PPV_ARGS(ppvAdapterList));
}
virtual HRESULT STDMETHODCALLTYPE GetAdapterByLuid(
const LUID &adapterLUID,
REFIID riid,
_COM_Outptr_ void **ppvAdapter) = 0;
template<class T>
HRESULT STDMETHODCALLTYPE GetAdapterByLuid(
const LUID &adapterLUID,
_COM_Outptr_ T **ppvAdapter)
{
return GetAdapterByLuid(adapterLUID,
IID_PPV_ARGS(ppvAdapter));
}
virtual bool STDMETHODCALLTYPE IsNotificationTypeSupported(
DXCoreNotificationType notificationType) = 0;
virtual HRESULT STDMETHODCALLTYPE RegisterEventNotification(
_In_ IUnknown *dxCoreObject,
DXCoreNotificationType notificationType,
_In_ PFN_DXCORE_NOTIFICATION_CALLBACK callbackFunction,
_In_opt_ void *callbackContext,
_Out_ uint32_t *eventCookie) = 0;
virtual HRESULT STDMETHODCALLTYPE UnregisterEventNotification(
uint32_t eventCookie) = 0;
};
#endif // __cplusplus
#endif // __dxcore_interface_h__

View File

@ -0,0 +1,57 @@
//
// Copyright (C) Microsoft Corporation.
// Licensed under the MIT license
//
#ifndef __dxgicommon_h__
#define __dxgicommon_h__
typedef struct DXGI_RATIONAL
{
UINT Numerator;
UINT Denominator;
} DXGI_RATIONAL;
// The following values are used with DXGI_SAMPLE_DESC::Quality:
#define DXGI_STANDARD_MULTISAMPLE_QUALITY_PATTERN 0xffffffff
#define DXGI_CENTER_MULTISAMPLE_QUALITY_PATTERN 0xfffffffe
typedef struct DXGI_SAMPLE_DESC
{
UINT Count;
UINT Quality;
} DXGI_SAMPLE_DESC;
typedef enum DXGI_COLOR_SPACE_TYPE
{
DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 = 0,
DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709 = 1,
DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P709 = 2,
DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P2020 = 3,
DXGI_COLOR_SPACE_RESERVED = 4,
DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601 = 5,
DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601 = 6,
DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P601 = 7,
DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709 = 8,
DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P709 = 9,
DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020 = 10,
DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020 = 11,
DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020 = 12,
DXGI_COLOR_SPACE_YCBCR_STUDIO_G2084_LEFT_P2020 = 13,
DXGI_COLOR_SPACE_RGB_STUDIO_G2084_NONE_P2020 = 14,
DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_TOPLEFT_P2020 = 15,
DXGI_COLOR_SPACE_YCBCR_STUDIO_G2084_TOPLEFT_P2020 = 16,
DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P2020 = 17,
DXGI_COLOR_SPACE_YCBCR_STUDIO_GHLG_TOPLEFT_P2020 = 18,
DXGI_COLOR_SPACE_YCBCR_FULL_GHLG_TOPLEFT_P2020 = 19,
DXGI_COLOR_SPACE_RGB_STUDIO_G24_NONE_P709 = 20,
DXGI_COLOR_SPACE_RGB_STUDIO_G24_NONE_P2020 = 21,
DXGI_COLOR_SPACE_YCBCR_STUDIO_G24_LEFT_P709 = 22,
DXGI_COLOR_SPACE_YCBCR_STUDIO_G24_LEFT_P2020 = 23,
DXGI_COLOR_SPACE_YCBCR_STUDIO_G24_TOPLEFT_P2020 = 24,
DXGI_COLOR_SPACE_CUSTOM = 0xFFFFFFFF
} DXGI_COLOR_SPACE_TYPE;
#endif // __dxgicommon_h__

View File

@ -0,0 +1,52 @@
//
// Copyright (C) Microsoft Corporation.
// Licensed under the MIT license
//
typedef struct DXGI_RATIONAL
{
UINT Numerator;
UINT Denominator;
} DXGI_RATIONAL;
// The following values are used with DXGI_SAMPLE_DESC::Quality:
#define DXGI_STANDARD_MULTISAMPLE_QUALITY_PATTERN 0xffffffff
#define DXGI_CENTER_MULTISAMPLE_QUALITY_PATTERN 0xfffffffe
typedef struct DXGI_SAMPLE_DESC
{
UINT Count;
UINT Quality;
} DXGI_SAMPLE_DESC;
typedef enum DXGI_COLOR_SPACE_TYPE
{
DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 = 0,
DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709 = 1,
DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P709 = 2,
DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P2020 = 3,
DXGI_COLOR_SPACE_RESERVED = 4,
DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601 = 5,
DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601 = 6,
DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P601 = 7,
DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709 = 8,
DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P709 = 9,
DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020 = 10,
DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020 = 11,
DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020 = 12,
DXGI_COLOR_SPACE_YCBCR_STUDIO_G2084_LEFT_P2020 = 13,
DXGI_COLOR_SPACE_RGB_STUDIO_G2084_NONE_P2020 = 14,
DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_TOPLEFT_P2020 = 15,
DXGI_COLOR_SPACE_YCBCR_STUDIO_G2084_TOPLEFT_P2020 = 16,
DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P2020 = 17,
DXGI_COLOR_SPACE_YCBCR_STUDIO_GHLG_TOPLEFT_P2020 = 18,
DXGI_COLOR_SPACE_YCBCR_FULL_GHLG_TOPLEFT_P2020 = 19,
DXGI_COLOR_SPACE_RGB_STUDIO_G24_NONE_P709 = 20,
DXGI_COLOR_SPACE_RGB_STUDIO_G24_NONE_P2020 = 21,
DXGI_COLOR_SPACE_YCBCR_STUDIO_G24_LEFT_P709 = 22,
DXGI_COLOR_SPACE_YCBCR_STUDIO_G24_LEFT_P2020 = 23,
DXGI_COLOR_SPACE_YCBCR_STUDIO_G24_TOPLEFT_P2020 = 24,
DXGI_COLOR_SPACE_CUSTOM = 0xFFFFFFFF
} DXGI_COLOR_SPACE_TYPE;

View File

@ -0,0 +1,142 @@
//
// Copyright (C) Microsoft Corporation.
// Licensed under the MIT license
//
#ifndef __dxgiformat_h__
#define __dxgiformat_h__
#define DXGI_FORMAT_DEFINED 1
typedef enum DXGI_FORMAT
{
DXGI_FORMAT_UNKNOWN = 0,
DXGI_FORMAT_R32G32B32A32_TYPELESS = 1,
DXGI_FORMAT_R32G32B32A32_FLOAT = 2,
DXGI_FORMAT_R32G32B32A32_UINT = 3,
DXGI_FORMAT_R32G32B32A32_SINT = 4,
DXGI_FORMAT_R32G32B32_TYPELESS = 5,
DXGI_FORMAT_R32G32B32_FLOAT = 6,
DXGI_FORMAT_R32G32B32_UINT = 7,
DXGI_FORMAT_R32G32B32_SINT = 8,
DXGI_FORMAT_R16G16B16A16_TYPELESS = 9,
DXGI_FORMAT_R16G16B16A16_FLOAT = 10,
DXGI_FORMAT_R16G16B16A16_UNORM = 11,
DXGI_FORMAT_R16G16B16A16_UINT = 12,
DXGI_FORMAT_R16G16B16A16_SNORM = 13,
DXGI_FORMAT_R16G16B16A16_SINT = 14,
DXGI_FORMAT_R32G32_TYPELESS = 15,
DXGI_FORMAT_R32G32_FLOAT = 16,
DXGI_FORMAT_R32G32_UINT = 17,
DXGI_FORMAT_R32G32_SINT = 18,
DXGI_FORMAT_R32G8X24_TYPELESS = 19,
DXGI_FORMAT_D32_FLOAT_S8X24_UINT = 20,
DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS = 21,
DXGI_FORMAT_X32_TYPELESS_G8X24_UINT = 22,
DXGI_FORMAT_R10G10B10A2_TYPELESS = 23,
DXGI_FORMAT_R10G10B10A2_UNORM = 24,
DXGI_FORMAT_R10G10B10A2_UINT = 25,
DXGI_FORMAT_R11G11B10_FLOAT = 26,
DXGI_FORMAT_R8G8B8A8_TYPELESS = 27,
DXGI_FORMAT_R8G8B8A8_UNORM = 28,
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = 29,
DXGI_FORMAT_R8G8B8A8_UINT = 30,
DXGI_FORMAT_R8G8B8A8_SNORM = 31,
DXGI_FORMAT_R8G8B8A8_SINT = 32,
DXGI_FORMAT_R16G16_TYPELESS = 33,
DXGI_FORMAT_R16G16_FLOAT = 34,
DXGI_FORMAT_R16G16_UNORM = 35,
DXGI_FORMAT_R16G16_UINT = 36,
DXGI_FORMAT_R16G16_SNORM = 37,
DXGI_FORMAT_R16G16_SINT = 38,
DXGI_FORMAT_R32_TYPELESS = 39,
DXGI_FORMAT_D32_FLOAT = 40,
DXGI_FORMAT_R32_FLOAT = 41,
DXGI_FORMAT_R32_UINT = 42,
DXGI_FORMAT_R32_SINT = 43,
DXGI_FORMAT_R24G8_TYPELESS = 44,
DXGI_FORMAT_D24_UNORM_S8_UINT = 45,
DXGI_FORMAT_R24_UNORM_X8_TYPELESS = 46,
DXGI_FORMAT_X24_TYPELESS_G8_UINT = 47,
DXGI_FORMAT_R8G8_TYPELESS = 48,
DXGI_FORMAT_R8G8_UNORM = 49,
DXGI_FORMAT_R8G8_UINT = 50,
DXGI_FORMAT_R8G8_SNORM = 51,
DXGI_FORMAT_R8G8_SINT = 52,
DXGI_FORMAT_R16_TYPELESS = 53,
DXGI_FORMAT_R16_FLOAT = 54,
DXGI_FORMAT_D16_UNORM = 55,
DXGI_FORMAT_R16_UNORM = 56,
DXGI_FORMAT_R16_UINT = 57,
DXGI_FORMAT_R16_SNORM = 58,
DXGI_FORMAT_R16_SINT = 59,
DXGI_FORMAT_R8_TYPELESS = 60,
DXGI_FORMAT_R8_UNORM = 61,
DXGI_FORMAT_R8_UINT = 62,
DXGI_FORMAT_R8_SNORM = 63,
DXGI_FORMAT_R8_SINT = 64,
DXGI_FORMAT_A8_UNORM = 65,
DXGI_FORMAT_R1_UNORM = 66,
DXGI_FORMAT_R9G9B9E5_SHAREDEXP = 67,
DXGI_FORMAT_R8G8_B8G8_UNORM = 68,
DXGI_FORMAT_G8R8_G8B8_UNORM = 69,
DXGI_FORMAT_BC1_TYPELESS = 70,
DXGI_FORMAT_BC1_UNORM = 71,
DXGI_FORMAT_BC1_UNORM_SRGB = 72,
DXGI_FORMAT_BC2_TYPELESS = 73,
DXGI_FORMAT_BC2_UNORM = 74,
DXGI_FORMAT_BC2_UNORM_SRGB = 75,
DXGI_FORMAT_BC3_TYPELESS = 76,
DXGI_FORMAT_BC3_UNORM = 77,
DXGI_FORMAT_BC3_UNORM_SRGB = 78,
DXGI_FORMAT_BC4_TYPELESS = 79,
DXGI_FORMAT_BC4_UNORM = 80,
DXGI_FORMAT_BC4_SNORM = 81,
DXGI_FORMAT_BC5_TYPELESS = 82,
DXGI_FORMAT_BC5_UNORM = 83,
DXGI_FORMAT_BC5_SNORM = 84,
DXGI_FORMAT_B5G6R5_UNORM = 85,
DXGI_FORMAT_B5G5R5A1_UNORM = 86,
DXGI_FORMAT_B8G8R8A8_UNORM = 87,
DXGI_FORMAT_B8G8R8X8_UNORM = 88,
DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM = 89,
DXGI_FORMAT_B8G8R8A8_TYPELESS = 90,
DXGI_FORMAT_B8G8R8A8_UNORM_SRGB = 91,
DXGI_FORMAT_B8G8R8X8_TYPELESS = 92,
DXGI_FORMAT_B8G8R8X8_UNORM_SRGB = 93,
DXGI_FORMAT_BC6H_TYPELESS = 94,
DXGI_FORMAT_BC6H_UF16 = 95,
DXGI_FORMAT_BC6H_SF16 = 96,
DXGI_FORMAT_BC7_TYPELESS = 97,
DXGI_FORMAT_BC7_UNORM = 98,
DXGI_FORMAT_BC7_UNORM_SRGB = 99,
DXGI_FORMAT_AYUV = 100,
DXGI_FORMAT_Y410 = 101,
DXGI_FORMAT_Y416 = 102,
DXGI_FORMAT_NV12 = 103,
DXGI_FORMAT_P010 = 104,
DXGI_FORMAT_P016 = 105,
DXGI_FORMAT_420_OPAQUE = 106,
DXGI_FORMAT_YUY2 = 107,
DXGI_FORMAT_Y210 = 108,
DXGI_FORMAT_Y216 = 109,
DXGI_FORMAT_NV11 = 110,
DXGI_FORMAT_AI44 = 111,
DXGI_FORMAT_IA44 = 112,
DXGI_FORMAT_P8 = 113,
DXGI_FORMAT_A8P8 = 114,
DXGI_FORMAT_B4G4R4A4_UNORM = 115,
DXGI_FORMAT_P208 = 130,
DXGI_FORMAT_V208 = 131,
DXGI_FORMAT_V408 = 132,
DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE = 189,
DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE = 190,
DXGI_FORMAT_FORCE_UINT = 0xffffffff
} DXGI_FORMAT;
#endif // __dxgiformat_h__

View File

@ -0,0 +1,137 @@
//
// Copyright (C) Microsoft Corporation.
// Licensed under the MIT license
//
typedef enum DXGI_FORMAT
{
DXGI_FORMAT_UNKNOWN = 0,
DXGI_FORMAT_R32G32B32A32_TYPELESS = 1,
DXGI_FORMAT_R32G32B32A32_FLOAT = 2,
DXGI_FORMAT_R32G32B32A32_UINT = 3,
DXGI_FORMAT_R32G32B32A32_SINT = 4,
DXGI_FORMAT_R32G32B32_TYPELESS = 5,
DXGI_FORMAT_R32G32B32_FLOAT = 6,
DXGI_FORMAT_R32G32B32_UINT = 7,
DXGI_FORMAT_R32G32B32_SINT = 8,
DXGI_FORMAT_R16G16B16A16_TYPELESS = 9,
DXGI_FORMAT_R16G16B16A16_FLOAT = 10,
DXGI_FORMAT_R16G16B16A16_UNORM = 11,
DXGI_FORMAT_R16G16B16A16_UINT = 12,
DXGI_FORMAT_R16G16B16A16_SNORM = 13,
DXGI_FORMAT_R16G16B16A16_SINT = 14,
DXGI_FORMAT_R32G32_TYPELESS = 15,
DXGI_FORMAT_R32G32_FLOAT = 16,
DXGI_FORMAT_R32G32_UINT = 17,
DXGI_FORMAT_R32G32_SINT = 18,
DXGI_FORMAT_R32G8X24_TYPELESS = 19,
DXGI_FORMAT_D32_FLOAT_S8X24_UINT = 20,
DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS = 21,
DXGI_FORMAT_X32_TYPELESS_G8X24_UINT = 22,
DXGI_FORMAT_R10G10B10A2_TYPELESS = 23,
DXGI_FORMAT_R10G10B10A2_UNORM = 24,
DXGI_FORMAT_R10G10B10A2_UINT = 25,
DXGI_FORMAT_R11G11B10_FLOAT = 26,
DXGI_FORMAT_R8G8B8A8_TYPELESS = 27,
DXGI_FORMAT_R8G8B8A8_UNORM = 28,
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = 29,
DXGI_FORMAT_R8G8B8A8_UINT = 30,
DXGI_FORMAT_R8G8B8A8_SNORM = 31,
DXGI_FORMAT_R8G8B8A8_SINT = 32,
DXGI_FORMAT_R16G16_TYPELESS = 33,
DXGI_FORMAT_R16G16_FLOAT = 34,
DXGI_FORMAT_R16G16_UNORM = 35,
DXGI_FORMAT_R16G16_UINT = 36,
DXGI_FORMAT_R16G16_SNORM = 37,
DXGI_FORMAT_R16G16_SINT = 38,
DXGI_FORMAT_R32_TYPELESS = 39,
DXGI_FORMAT_D32_FLOAT = 40,
DXGI_FORMAT_R32_FLOAT = 41,
DXGI_FORMAT_R32_UINT = 42,
DXGI_FORMAT_R32_SINT = 43,
DXGI_FORMAT_R24G8_TYPELESS = 44,
DXGI_FORMAT_D24_UNORM_S8_UINT = 45,
DXGI_FORMAT_R24_UNORM_X8_TYPELESS = 46,
DXGI_FORMAT_X24_TYPELESS_G8_UINT = 47,
DXGI_FORMAT_R8G8_TYPELESS = 48,
DXGI_FORMAT_R8G8_UNORM = 49,
DXGI_FORMAT_R8G8_UINT = 50,
DXGI_FORMAT_R8G8_SNORM = 51,
DXGI_FORMAT_R8G8_SINT = 52,
DXGI_FORMAT_R16_TYPELESS = 53,
DXGI_FORMAT_R16_FLOAT = 54,
DXGI_FORMAT_D16_UNORM = 55,
DXGI_FORMAT_R16_UNORM = 56,
DXGI_FORMAT_R16_UINT = 57,
DXGI_FORMAT_R16_SNORM = 58,
DXGI_FORMAT_R16_SINT = 59,
DXGI_FORMAT_R8_TYPELESS = 60,
DXGI_FORMAT_R8_UNORM = 61,
DXGI_FORMAT_R8_UINT = 62,
DXGI_FORMAT_R8_SNORM = 63,
DXGI_FORMAT_R8_SINT = 64,
DXGI_FORMAT_A8_UNORM = 65,
DXGI_FORMAT_R1_UNORM = 66,
DXGI_FORMAT_R9G9B9E5_SHAREDEXP = 67,
DXGI_FORMAT_R8G8_B8G8_UNORM = 68,
DXGI_FORMAT_G8R8_G8B8_UNORM = 69,
DXGI_FORMAT_BC1_TYPELESS = 70,
DXGI_FORMAT_BC1_UNORM = 71,
DXGI_FORMAT_BC1_UNORM_SRGB = 72,
DXGI_FORMAT_BC2_TYPELESS = 73,
DXGI_FORMAT_BC2_UNORM = 74,
DXGI_FORMAT_BC2_UNORM_SRGB = 75,
DXGI_FORMAT_BC3_TYPELESS = 76,
DXGI_FORMAT_BC3_UNORM = 77,
DXGI_FORMAT_BC3_UNORM_SRGB = 78,
DXGI_FORMAT_BC4_TYPELESS = 79,
DXGI_FORMAT_BC4_UNORM = 80,
DXGI_FORMAT_BC4_SNORM = 81,
DXGI_FORMAT_BC5_TYPELESS = 82,
DXGI_FORMAT_BC5_UNORM = 83,
DXGI_FORMAT_BC5_SNORM = 84,
DXGI_FORMAT_B5G6R5_UNORM = 85,
DXGI_FORMAT_B5G5R5A1_UNORM = 86,
DXGI_FORMAT_B8G8R8A8_UNORM = 87,
DXGI_FORMAT_B8G8R8X8_UNORM = 88,
DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM = 89,
DXGI_FORMAT_B8G8R8A8_TYPELESS = 90,
DXGI_FORMAT_B8G8R8A8_UNORM_SRGB = 91,
DXGI_FORMAT_B8G8R8X8_TYPELESS = 92,
DXGI_FORMAT_B8G8R8X8_UNORM_SRGB = 93,
DXGI_FORMAT_BC6H_TYPELESS = 94,
DXGI_FORMAT_BC6H_UF16 = 95,
DXGI_FORMAT_BC6H_SF16 = 96,
DXGI_FORMAT_BC7_TYPELESS = 97,
DXGI_FORMAT_BC7_UNORM = 98,
DXGI_FORMAT_BC7_UNORM_SRGB = 99,
DXGI_FORMAT_AYUV = 100,
DXGI_FORMAT_Y410 = 101,
DXGI_FORMAT_Y416 = 102,
DXGI_FORMAT_NV12 = 103,
DXGI_FORMAT_P010 = 104,
DXGI_FORMAT_P016 = 105,
DXGI_FORMAT_420_OPAQUE = 106,
DXGI_FORMAT_YUY2 = 107,
DXGI_FORMAT_Y210 = 108,
DXGI_FORMAT_Y216 = 109,
DXGI_FORMAT_NV11 = 110,
DXGI_FORMAT_AI44 = 111,
DXGI_FORMAT_IA44 = 112,
DXGI_FORMAT_P8 = 113,
DXGI_FORMAT_A8P8 = 114,
DXGI_FORMAT_B4G4R4A4_UNORM = 115,
DXGI_FORMAT_P208 = 130,
DXGI_FORMAT_V208 = 131,
DXGI_FORMAT_V408 = 132,
DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE = 189,
DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE = 190,
DXGI_FORMAT_FORCE_UINT = 0xffffffff
} DXGI_FORMAT;

126
include/dxguids/dxguids.h Normal file
View File

@ -0,0 +1,126 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#pragma once
#ifndef __cplusplus
#error "This header requires C++"
#endif
constexpr inline bool ConstexprIsEqualGUID(REFGUID a, REFGUID b)
{
return a.Data1 == b.Data1 &&
a.Data2 == b.Data2 &&
a.Data3 == b.Data3 &&
a.Data4[0] == b.Data4[0] &&
a.Data4[1] == b.Data4[1] &&
a.Data4[2] == b.Data4[2] &&
a.Data4[3] == b.Data4[3] &&
a.Data4[4] == b.Data4[4] &&
a.Data4[5] == b.Data4[5] &&
a.Data4[6] == b.Data4[6] &&
a.Data4[7] == b.Data4[7];
}
// 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;
#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);
#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
// Direct3D
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);
WINADAPTER_IID(ID3D12RootSignatureDeserializer, 0x34AB647B, 0x3CC8, 0x46AC, 0x84, 0x1B, 0xC0, 0x96, 0x56, 0x45, 0xC0, 0x46);
WINADAPTER_IID(ID3D12VersionedRootSignatureDeserializer, 0x7F91CE67, 0x090C, 0x4BB7, 0xB7, 0x8E, 0xED, 0x8F, 0xF2, 0xE3, 0x1D, 0xA0);
WINADAPTER_IID(ID3D12Pageable, 0x63ee58fb, 0x1268, 0x4835, 0x86, 0xda, 0xf0, 0x08, 0xce, 0x62, 0xf0, 0xd6);
WINADAPTER_IID(ID3D12Heap, 0x6b3b2502, 0x6e51, 0x45b3, 0x90, 0xee, 0x98, 0x84, 0x26, 0x5e, 0x8d, 0xf3);
WINADAPTER_IID(ID3D12Resource, 0x696442be, 0xa72e, 0x4059, 0xbc, 0x79, 0x5b, 0x5c, 0x98, 0x04, 0x0f, 0xad);
WINADAPTER_IID(ID3D12CommandAllocator, 0x6102dee4, 0xaf59, 0x4b09, 0xb9, 0x99, 0xb4, 0x4d, 0x73, 0xf0, 0x9b, 0x24);
WINADAPTER_IID(ID3D12Fence, 0x0a753dcf, 0xc4d8, 0x4b91, 0xad, 0xf6, 0xbe, 0x5a, 0x60, 0xd9, 0x5a, 0x76);
WINADAPTER_IID(ID3D12Fence1, 0x433685fe, 0xe22b, 0x4ca0, 0xa8, 0xdb, 0xb5, 0xb4, 0xf4, 0xdd, 0x0e, 0x4a);
WINADAPTER_IID(ID3D12PipelineState, 0x765a30f3, 0xf624, 0x4c6f, 0xa8, 0x28, 0xac, 0xe9, 0x48, 0x62, 0x24, 0x45);
WINADAPTER_IID(ID3D12DescriptorHeap, 0x8efb471d, 0x616c, 0x4f49, 0x90, 0xf7, 0x12, 0x7b, 0xb7, 0x63, 0xfa, 0x51);
WINADAPTER_IID(ID3D12QueryHeap, 0x0d9658ae, 0xed45, 0x469e, 0xa6, 0x1d, 0x97, 0x0e, 0xc5, 0x83, 0xca, 0xb4);
WINADAPTER_IID(ID3D12CommandSignature, 0xc36a797c, 0xec80, 0x4f0a, 0x89, 0x85, 0xa7, 0xb2, 0x47, 0x50, 0x82, 0xd1);
WINADAPTER_IID(ID3D12CommandList, 0x7116d91c, 0xe7e4, 0x47ce, 0xb8, 0xc6, 0xec, 0x81, 0x68, 0xf4, 0x37, 0xe5);
WINADAPTER_IID(ID3D12GraphicsCommandList, 0x5b160d0f, 0xac1b, 0x4185, 0x8b, 0xa8, 0xb3, 0xae, 0x42, 0xa5, 0xa4, 0x55);
WINADAPTER_IID(ID3D12GraphicsCommandList1, 0x553103fb, 0x1fe7, 0x4557, 0xbb, 0x38, 0x94, 0x6d, 0x7d, 0x0e, 0x7c, 0xa7);
WINADAPTER_IID(ID3D12GraphicsCommandList2, 0x38C3E585, 0xFF17, 0x412C, 0x91, 0x50, 0x4F, 0xC6, 0xF9, 0xD7, 0x2A, 0x28);
WINADAPTER_IID(ID3D12CommandQueue, 0x0ec870a6, 0x5d7e, 0x4c22, 0x8c, 0xfc, 0x5b, 0xaa, 0xe0, 0x76, 0x16, 0xed);
WINADAPTER_IID(ID3D12Device, 0x189819f1, 0x1db6, 0x4b57, 0xbe, 0x54, 0x18, 0x21, 0x33, 0x9b, 0x85, 0xf7);
WINADAPTER_IID(ID3D12PipelineLibrary, 0xc64226a8, 0x9201, 0x46af, 0xb4, 0xcc, 0x53, 0xfb, 0x9f, 0xf7, 0x41, 0x4f);
WINADAPTER_IID(ID3D12PipelineLibrary1, 0x80eabf42, 0x2568, 0x4e5e, 0xbd, 0x82, 0xc3, 0x7f, 0x86, 0x96, 0x1d, 0xc3);
WINADAPTER_IID(ID3D12Device1, 0x77acce80, 0x638e, 0x4e65, 0x88, 0x95, 0xc1, 0xf2, 0x33, 0x86, 0x86, 0x3e);
WINADAPTER_IID(ID3D12Device2, 0x30baa41e, 0xb15b, 0x475c, 0xa0, 0xbb, 0x1a, 0xf5, 0xc5, 0xb6, 0x43, 0x28);
WINADAPTER_IID(ID3D12Device3, 0x81dadc15, 0x2bad, 0x4392, 0x93, 0xc5, 0x10, 0x13, 0x45, 0xc4, 0xaa, 0x98);
WINADAPTER_IID(ID3D12ProtectedSession, 0xA1533D18, 0x0AC1, 0x4084, 0x85, 0xB9, 0x89, 0xA9, 0x61, 0x16, 0x80, 0x6B);
WINADAPTER_IID(ID3D12ProtectedResourceSession, 0x6CD696F4, 0xF289, 0x40CC, 0x80, 0x91, 0x5A, 0x6C, 0x0A, 0x09, 0x9C, 0x3D);
WINADAPTER_IID(ID3D12Device4, 0xe865df17, 0xa9ee, 0x46f9, 0xa4, 0x63, 0x30, 0x98, 0x31, 0x5a, 0xa2, 0xe5);
WINADAPTER_IID(ID3D12LifetimeOwner, 0xe667af9f, 0xcd56, 0x4f46, 0x83, 0xce, 0x03, 0x2e, 0x59, 0x5d, 0x70, 0xa8);
WINADAPTER_IID(ID3D12SwapChainAssistant, 0xf1df64b6, 0x57fd, 0x49cd, 0x88, 0x07, 0xc0, 0xeb, 0x88, 0xb4, 0x5c, 0x8f);
WINADAPTER_IID(ID3D12LifetimeTracker, 0x3fd03d36, 0x4eb1, 0x424a, 0xa5, 0x82, 0x49, 0x4e, 0xcb, 0x8b, 0xa8, 0x13);
WINADAPTER_IID(ID3D12StateObject, 0x47016943, 0xfca8, 0x4594, 0x93, 0xea, 0xaf, 0x25, 0x8b, 0x55, 0x34, 0x6d);
WINADAPTER_IID(ID3D12StateObjectProperties, 0xde5fa827, 0x9bf9, 0x4f26, 0x89, 0xff, 0xd7, 0xf5, 0x6f, 0xde, 0x38, 0x60);
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(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(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);
WINADAPTER_IID(ID3D12Device8, 0x9218E6BB, 0xF944, 0x4F7E, 0xA7, 0x5C, 0xB1, 0xB2, 0xC7, 0xB7, 0x01, 0xF3);
WINADAPTER_IID(ID3D12Resource1, 0x9D5E227A, 0x4430, 0x4161, 0x88, 0xB3, 0x3E, 0xCA, 0x6B, 0xB1, 0x6E, 0x19);
WINADAPTER_IID(ID3D12Resource2, 0xBE36EC3B, 0xEA85, 0x4AEB, 0xA4, 0x5A, 0xE9, 0xD7, 0x64, 0x04, 0xA4, 0x95);
WINADAPTER_IID(ID3D12Heap1, 0x572F7389, 0x2168, 0x49E3, 0x96, 0x93, 0xD6, 0xDF, 0x58, 0x71, 0xBF, 0x6D);
WINADAPTER_IID(ID3D12GraphicsCommandList3, 0x6FDA83A7, 0xB84C, 0x4E38, 0x9A, 0xC8, 0xC7, 0xBD, 0x22, 0x01, 0x6B, 0x3D);
WINADAPTER_IID(ID3D12MetaCommand, 0xDBB84C27, 0x36CE, 0x4FC9, 0xB8, 0x01, 0xF0, 0x48, 0xC4, 0x6A, 0xC5, 0x70);
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(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(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);
#ifdef __d3d12sdklayers_h__
WINADAPTER_IID(ID3D12Debug, 0x344488b7, 0x6846, 0x474b, 0xb9, 0x89, 0xf0, 0x27, 0x44, 0x82, 0x45, 0xe0);
WINADAPTER_IID(ID3D12Debug1, 0xaffaa4ca, 0x63fe, 0x4d8e, 0xb8, 0xad, 0x15, 0x90, 0x00, 0xaf, 0x43, 0x04);
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(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(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(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);
#endif
// DXCore
#ifdef __dxcore_interface_h__
WINADAPTER_IID(IDXCoreAdapterFactory, 0x78ee5945, 0xc36e, 0x4b13, 0xa6, 0x69, 0x00, 0x5d, 0xd1, 0x1c, 0x0f, 0x06);
WINADAPTER_IID(IDXCoreAdapterList, 0x526c7776, 0x40e9, 0x459b, 0xb7, 0x11, 0xf3, 0x2a, 0xd7, 0x6d, 0xfc, 0x28);
WINADAPTER_IID(IDXCoreAdapter, 0xf0db4c7f, 0xfe5a, 0x42a2, 0xbd, 0x62, 0xf2, 0xa6, 0xcf, 0x6f, 0xc8, 0x3e);
#endif

View File

@ -0,0 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
// Stub header to satisfy d3d12.h include
#pragma once

View File

@ -0,0 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
// Stub header to satisfy d3d12.h include
#pragma once

5
include/wsl/stubs/rpc.h Normal file
View File

@ -0,0 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
// Stub header to satisfy d3d12.h include
#pragma once

View File

@ -0,0 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
// Stub header to satisfy d3d12.h include
#pragma once
#define __RPCNDR_H_VERSION__

View File

@ -0,0 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
// Stub header to satisfy d3d12.h include. Unconditionally light up all APIs.
#pragma once
#define WINAPI_FAMILY_PARTITION(Partitions) 1

View File

@ -0,0 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
// Stub to satisfy d3dx12.h include
#pragma once
#include "../wrladapter.h"

View File

@ -0,0 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
// Stub to satisfy DML TF runtime includes
#pragma once
#include "wrladapter.h"

404
include/wsl/winadapter.h Normal file
View File

@ -0,0 +1,404 @@
// 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;
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

803
include/wsl/wrladapter.h Normal file
View File

@ -0,0 +1,803 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#pragma once
#include "winadapter.h"
// defined by winadapter.h and needed by some windows headers, but conflicts
// with some libc++ implementation headers
#ifdef __in
#undef __in
#endif
#ifdef __out
#undef __out
#endif
#include <type_traits>
#include <atomic>
#include <memory>
#include <new>
#include <climits>
#include <cassert>
namespace Microsoft
{
namespace WRL
{
namespace Details
{
struct BoolStruct { int Member; };
typedef int BoolStruct::* BoolType;
template <typename T> // T should be the ComPtr<T> or a derived type of it, not just the interface
class ComPtrRefBase
{
public:
typedef typename T::InterfaceType InterfaceType;
operator IUnknown**() const throw()
{
static_assert(__is_base_of(IUnknown, InterfaceType), "Invalid cast: InterfaceType does not derive from IUnknown");
return reinterpret_cast<IUnknown**>(ptr_->ReleaseAndGetAddressOf());
}
protected:
T* ptr_;
};
template <typename T>
class ComPtrRef : public Details::ComPtrRefBase<T> // T should be the ComPtr<T> or a derived type of it, not just the interface
{
using Super = Details::ComPtrRefBase<T>;
using InterfaceType = typename Super::InterfaceType;
public:
ComPtrRef(_In_opt_ T* ptr) throw()
{
this->ptr_ = ptr;
}
// Conversion operators
operator void**() const throw()
{
return reinterpret_cast<void**>(this->ptr_->ReleaseAndGetAddressOf());
}
// This is our operator ComPtr<U> (or the latest derived class from ComPtr (e.g. WeakRef))
operator T*() throw()
{
*this->ptr_ = nullptr;
return this->ptr_;
}
// We define operator InterfaceType**() here instead of on ComPtrRefBase<T>, since
// if InterfaceType is IUnknown or IInspectable, having it on the base will collide.
operator InterfaceType**() throw()
{
return this->ptr_->ReleaseAndGetAddressOf();
}
// This is used for IID_PPV_ARGS in order to do __uuidof(**(ppType)).
// It does not need to clear ptr_ at this point, it is done at IID_PPV_ARGS_Helper(ComPtrRef&) later in this file.
InterfaceType* operator *() throw()
{
return this->ptr_->Get();
}
// Explicit functions
InterfaceType* const * GetAddressOf() const throw()
{
return this->ptr_->GetAddressOf();
}
InterfaceType** ReleaseAndGetAddressOf() throw()
{
return this->ptr_->ReleaseAndGetAddressOf();
}
};
}
template <typename T>
class ComPtr
{
public:
typedef T InterfaceType;
protected:
InterfaceType *ptr_;
template<class U> friend class ComPtr;
void InternalAddRef() const throw()
{
if (ptr_ != nullptr)
{
ptr_->AddRef();
}
}
unsigned long InternalRelease() throw()
{
unsigned long ref = 0;
T* temp = ptr_;
if (temp != nullptr)
{
ptr_ = nullptr;
ref = temp->Release();
}
return ref;
}
public:
ComPtr() throw() : ptr_(nullptr)
{
}
ComPtr(decltype(nullptr)) throw() : ptr_(nullptr)
{
}
template<class U>
ComPtr(_In_opt_ U *other) throw() : ptr_(other)
{
InternalAddRef();
}
ComPtr(const ComPtr& other) throw() : ptr_(other.ptr_)
{
InternalAddRef();
}
// copy constructor that allows to instantiate class when U* is convertible to T*
template<class U>
ComPtr(const ComPtr<U> &other, typename std::enable_if<std::is_convertible<U*, T*>::value, void *>::type * = 0) throw() :
ptr_(other.ptr_)
{
InternalAddRef();
}
ComPtr(_Inout_ ComPtr &&other) throw() : ptr_(nullptr)
{
if (this != reinterpret_cast<ComPtr*>(&reinterpret_cast<unsigned char&>(other)))
{
Swap(other);
}
}
// Move constructor that allows instantiation of a class when U* is convertible to T*
template<class U>
ComPtr(_Inout_ ComPtr<U>&& other, typename std::enable_if<std::is_convertible<U*, T*>::value, void *>::type * = 0) throw() :
ptr_(other.ptr_)
{
other.ptr_ = nullptr;
}
~ComPtr() throw()
{
InternalRelease();
}
ComPtr& operator=(decltype(nullptr)) throw()
{
InternalRelease();
return *this;
}
ComPtr& operator=(_In_opt_ T *other) throw()
{
if (ptr_ != other)
{
ComPtr(other).Swap(*this);
}
return *this;
}
template <typename U>
ComPtr& operator=(_In_opt_ U *other) throw()
{
ComPtr(other).Swap(*this);
return *this;
}
ComPtr& operator=(const ComPtr &other) throw()
{
if (ptr_ != other.ptr_)
{
ComPtr(other).Swap(*this);
}
return *this;
}
template<class U>
ComPtr& operator=(const ComPtr<U>& other) throw()
{
ComPtr(other).Swap(*this);
return *this;
}
ComPtr& operator=(_Inout_ ComPtr &&other) throw()
{
ComPtr(static_cast<ComPtr&&>(other)).Swap(*this);
return *this;
}
template<class U>
ComPtr& operator=(_Inout_ ComPtr<U>&& other) throw()
{
ComPtr(static_cast<ComPtr<U>&&>(other)).Swap(*this);
return *this;
}
void Swap(_Inout_ ComPtr&& r) throw()
{
T* tmp = ptr_;
ptr_ = r.ptr_;
r.ptr_ = tmp;
}
void Swap(_Inout_ ComPtr& r) throw()
{
T* tmp = ptr_;
ptr_ = r.ptr_;
r.ptr_ = tmp;
}
operator Details::BoolType() const throw()
{
return Get() != nullptr ? &Details::BoolStruct::Member : nullptr;
}
T* Get() const throw()
{
return ptr_;
}
InterfaceType* operator->() const throw()
{
return ptr_;
}
Details::ComPtrRef<ComPtr<T>> operator&() throw()
{
return Details::ComPtrRef<ComPtr<T>>(this);
}
const Details::ComPtrRef<const ComPtr<T>> operator&() const throw()
{
return Details::ComPtrRef<const ComPtr<T>>(this);
}
T* const* GetAddressOf() const throw()
{
return &ptr_;
}
T** GetAddressOf() throw()
{
return &ptr_;
}
T** ReleaseAndGetAddressOf() throw()
{
InternalRelease();
return &ptr_;
}
T* Detach() throw()
{
T* ptr = ptr_;
ptr_ = nullptr;
return ptr;
}
void Attach(_In_opt_ InterfaceType* other) throw()
{
if (ptr_ != nullptr)
{
auto ref = ptr_->Release();
// DBG_UNREFERENCED_LOCAL_VARIABLE(ref);
// Attaching to the same object only works if duplicate references are being coalesced. Otherwise
// re-attaching will cause the pointer to be released and may cause a crash on a subsequent dereference.
assert(ref != 0 || ptr_ != other);
}
ptr_ = other;
}
unsigned long Reset()
{
return InternalRelease();
}
// Previously, unsafe behavior could be triggered when 'this' is ComPtr<IInspectable> or ComPtr<IUnknown> and CopyTo is used to copy to another type U.
// The user will use operator& to convert the destination into a ComPtrRef, which can then implicit cast to IInspectable** and IUnknown**.
// If this overload of CopyTo is not present, it will implicitly cast to IInspectable or IUnknown and match CopyTo(InterfaceType**) instead.
// A valid polymoprhic downcast requires run-time type checking via QueryInterface, so CopyTo(InterfaceType**) will break type safety.
// This overload matches ComPtrRef before the implicit cast takes place, preventing the unsafe downcast.
template <typename U>
HRESULT CopyTo(Details::ComPtrRef<ComPtr<U>> ptr, typename std::enable_if<
(std::is_same<T, IUnknown>::value)
&& !std::is_same<U*, T*>::value, void *>::type * = 0) const throw()
{
return ptr_->QueryInterface(uuidof<U>(), ptr);
}
HRESULT CopyTo(_Outptr_result_maybenull_ InterfaceType** ptr) const throw()
{
InternalAddRef();
*ptr = ptr_;
return S_OK;
}
HRESULT CopyTo(REFIID riid, _Outptr_result_nullonfailure_ void** ptr) const throw()
{
return ptr_->QueryInterface(riid, ptr);
}
template<typename U>
HRESULT CopyTo(_Outptr_result_nullonfailure_ U** ptr) const throw()
{
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);
}
// 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()));
}
// query for riid interface and return as IUnknown
HRESULT AsIID(REFIID riid, _Out_ ComPtr<IUnknown>* p) const throw()
{
return ptr_->QueryInterface(riid, reinterpret_cast<void**>(p->ReleaseAndGetAddressOf()));
}
}; // ComPtr
namespace Details
{
// Empty struct used as default template parameter
class Nil
{
};
// Empty struct used for validating template parameter types in Implements
struct ImplementsBase
{
};
class RuntimeClassBase
{
protected:
template<typename T>
static HRESULT AsIID(_In_ T* implements, REFIID riid, _Outptr_result_nullonfailure_ void **ppvObject) noexcept
{
*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>()))
{
*ppvObject = implements->CastToUnknown();
static_cast<IUnknown*>(*ppvObject)->AddRef();
return S_OK;
}
HRESULT hr = implements->CanCastTo(riid, ppvObject, &isRefDelegated);
if (SUCCEEDED(hr) && !isRefDelegated)
{
static_cast<IUnknown*>(*ppvObject)->AddRef();
}
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 6102) // '*ppvObject' is used but may not be initialized
#endif
_Analysis_assume_(SUCCEEDED(hr) || (*ppvObject == nullptr));
#ifdef _MSC_VER
#pragma warning(pop)
#endif
return hr;
}
public:
HRESULT RuntimeClassInitialize() noexcept
{
return S_OK;
}
};
// Interface traits provides casting and filling iids methods helpers
template<typename I0>
struct InterfaceTraits
{
typedef I0 Base;
template<typename T>
static Base* CastToBase(_In_ T* ptr) noexcept
{
return static_cast<Base*>(ptr);
}
template<typename T>
static IUnknown* CastToUnknown(_In_ T* ptr) noexcept
{
return static_cast<IUnknown*>(static_cast<Base*>(ptr));
}
template <typename T>
_Success_(return == true)
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>()))
{
*ppv = static_cast<Base*>(ptr);
return true;
}
return false;
}
};
// Specialization for Nil parameter
template<>
struct InterfaceTraits<Nil>
{
typedef Nil Base;
template <typename T>
_Success_(return == true)
static bool CanCastTo(_In_ T*, REFIID, _Outptr_ void **) noexcept
{
return false;
}
};
// ChainInterfaces - template allows specifying a derived COM interface along with its class hierarchy to allow QI for the base interfaces
template <typename I0, typename I1, typename I2 = Nil, typename I3 = Nil,
typename I4 = Nil, typename I5 = Nil, typename I6 = Nil,
typename I7 = Nil, typename I8 = Nil, typename I9 = Nil>
struct ChainInterfaces : I0
{
protected:
HRESULT CanCastTo(REFIID riid, _Outptr_ void **ppv) throw()
{
typename InterfaceTraits<I0>::Base* ptr = InterfaceTraits<I0>::CastToBase(this);
return (InterfaceTraits<I0>::CanCastTo(this, riid, ppv) ||
InterfaceTraits<I1>::CanCastTo(ptr, riid, ppv) ||
InterfaceTraits<I2>::CanCastTo(ptr, riid, ppv) ||
InterfaceTraits<I3>::CanCastTo(ptr, riid, ppv) ||
InterfaceTraits<I4>::CanCastTo(ptr, riid, ppv) ||
InterfaceTraits<I5>::CanCastTo(ptr, riid, ppv) ||
InterfaceTraits<I6>::CanCastTo(ptr, riid, ppv) ||
InterfaceTraits<I7>::CanCastTo(ptr, riid, ppv) ||
InterfaceTraits<I8>::CanCastTo(ptr, riid, ppv) ||
InterfaceTraits<I9>::CanCastTo(ptr, riid, ppv)) ? S_OK : E_NOINTERFACE;
}
IUnknown* CastToUnknown() throw()
{
return InterfaceTraits<I0>::CastToUnknown(this);
}
};
// Helper template used by Implements. This template traverses a list of interfaces and adds them as base class and information
// to enable QI.
template <typename ...TInterfaces>
struct ImplementsHelper;
template <typename T>
struct ImplementsMarker
{};
template <typename I0, bool isImplements>
struct MarkImplements;
template <typename I0>
struct MarkImplements<I0, false>
{
typedef I0 Type;
};
template <typename I0>
struct MarkImplements<I0, true>
{
typedef ImplementsMarker<I0> Type;
};
// AdjustImplements pre-processes the type list for more efficient builds.
template <typename ...Bases>
struct AdjustImplements;
template <typename I0, typename ...Bases>
struct AdjustImplements<I0, Bases...>
{
typedef ImplementsHelper<typename MarkImplements<I0, std::is_base_of<ImplementsBase, I0>::value>::Type, Bases...> Type;
};
// Use AdjustImplements to remove instances of "Nil" from the type list.
template <typename ...Bases>
struct AdjustImplements<Nil, Bases...>
{
typedef typename AdjustImplements<Bases...>::Type Type;
};
template <>
struct AdjustImplements<>
{
typedef ImplementsHelper<> Type;
};
// Specialization handles unadorned interfaces
template <typename I0, typename ...TInterfaces>
struct ImplementsHelper<I0, TInterfaces...> :
I0,
AdjustImplements<TInterfaces...>::Type
{
template <typename ...> friend struct ImplementsHelper;
friend class RuntimeClassBase;
protected:
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>()))
{
*ppv = reinterpret_cast<I0*>(reinterpret_cast<void*>(this));
return S_OK;
}
return AdjustImplements<TInterfaces...>::Type::CanCastTo(riid, ppv, pRefDelegated);
}
IUnknown* CastToUnknown() noexcept
{
return reinterpret_cast<I0*>(reinterpret_cast<void*>(this));
}
};
// Selector is used to "tag" base interfaces to be used in casting, since a runtime class may indirectly derive from
// the same interface or Implements<> template multiple times
template <typename base, typename disciminator>
struct Selector : public base
{
};
// Specialization handles types that derive from ImplementsHelper (e.g. nested Implements).
template <typename I0, typename ...TInterfaces>
struct ImplementsHelper<ImplementsMarker<I0>, TInterfaces...> :
Selector<I0, ImplementsHelper<ImplementsMarker<I0>, TInterfaces...>>,
Selector<typename AdjustImplements<TInterfaces...>::Type, ImplementsHelper<ImplementsMarker<I0>, TInterfaces...>>
{
template <typename ...> friend struct ImplementsHelper;
friend class RuntimeClassBase;
protected:
typedef Selector<I0, ImplementsHelper<ImplementsMarker<I0>, TInterfaces...>> CurrentType;
typedef Selector<typename AdjustImplements<TInterfaces...>::Type, ImplementsHelper<ImplementsMarker<I0>, TInterfaces...>> BaseType;
HRESULT CanCastTo(REFIID riid, _Outptr_ void **ppv, bool *pRefDelegated = nullptr) noexcept
{
HRESULT hr = CurrentType::CanCastTo(riid, ppv);
if (hr == E_NOINTERFACE)
{
hr = BaseType::CanCastTo(riid, ppv, pRefDelegated);
}
return hr;
}
IUnknown* CastToUnknown() noexcept
{
// First in list wins.
return CurrentType::CastToUnknown();
}
};
// terminal case specialization.
template <>
struct ImplementsHelper<>
{
template <typename ...> friend struct ImplementsHelper;
friend class RuntimeClassBase;
protected:
HRESULT CanCastTo(_In_ REFIID /*riid*/, _Outptr_ void ** /*ppv*/, bool * /*pRefDelegated*/ = nullptr) noexcept
{
return E_NOINTERFACE;
}
// IUnknown* CastToUnknown() noexcept; // not defined for terminal case.
};
// Specialization handles chaining interfaces
template <typename C0, typename C1, typename C2, typename C3, typename C4, typename C5, typename C6, typename C7, typename C8, typename C9, typename ...TInterfaces>
struct ImplementsHelper<ChainInterfaces<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9>, TInterfaces...> :
ChainInterfaces<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9>,
AdjustImplements<TInterfaces...>::Type
{
template <typename ...> friend struct ImplementsHelper;
friend class RuntimeClassBase;
protected:
typedef typename AdjustImplements<TInterfaces...>::Type BaseType;
HRESULT CanCastTo(REFIID riid, _Outptr_ void **ppv, bool *pRefDelegated = nullptr) noexcept
{
HRESULT hr = ChainInterfaces<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9>::CanCastTo(riid, ppv);
if (FAILED(hr))
{
hr = BaseType::CanCastTo(riid, ppv, pRefDelegated);
}
return hr;
}
IUnknown* CastToUnknown() noexcept
{
return ChainInterfaces<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9>::CastToUnknown();
}
};
// Implements - template implementing QI using the information provided through its template parameters
// Each template parameter has to be one of the following:
// * COM Interface
// * A class that implements one or more COM interfaces
// * ChainInterfaces template
template <typename I0, typename ...TInterfaces>
struct Implements :
AdjustImplements<I0, TInterfaces...>::Type,
ImplementsBase
{
public:
typedef I0 FirstInterface;
protected:
typedef typename AdjustImplements<I0, TInterfaces...>::Type BaseType;
template <typename ...> friend struct ImplementsHelper;
friend class RuntimeClassBase;
HRESULT CanCastTo(REFIID riid, _Outptr_ void **ppv) noexcept
{
return BaseType::CanCastTo(riid, ppv);
}
IUnknown* CastToUnknown() noexcept
{
return BaseType::CastToUnknown();
}
};
// Used on RuntimeClass to protect it from being constructed with new
class DontUseNewUseMake
{
private:
void* operator new(size_t) noexcept
{
assert(false);
return 0;
}
public:
void* operator new(size_t, _In_ void* placement) noexcept
{
return placement;
}
};
template <typename ...TInterfaces>
class RuntimeClassImpl :
public AdjustImplements<TInterfaces...>::Type,
public RuntimeClassBase,
public DontUseNewUseMake
{
public:
STDMETHOD(QueryInterface)(REFIID riid, _Outptr_result_nullonfailure_ void **ppvObject)
{
return Super::AsIID(this, riid, ppvObject);
}
STDMETHOD_(ULONG, AddRef)()
{
return InternalAddRef();
}
STDMETHOD_(ULONG, Release)()
{
ULONG ref = InternalRelease();
if (ref == 0)
{
this->~RuntimeClassImpl();
delete[] reinterpret_cast<char*>(this);
}
return ref;
}
protected:
using Super = RuntimeClassBase;
static const LONG c_lProtectDestruction = -(LONG_MAX / 2);
RuntimeClassImpl() noexcept = default;
virtual ~RuntimeClassImpl() noexcept
{
// Set refcount_ to -(LONG_MAX/2) to protect destruction and
// also catch mismatched Release in debug builds
refcount_ = static_cast<ULONG>(c_lProtectDestruction);
}
ULONG InternalAddRef() noexcept
{
return ++refcount_;
}
ULONG InternalRelease() noexcept
{
return --refcount_;
}
unsigned long GetRefCount() const noexcept
{
return refcount_;
}
std::atomic<ULONG> refcount_{1};
};
}
template <typename ...TInterfaces>
class Base : public Details::RuntimeClassImpl<TInterfaces...>
{
Base(const Base&) = delete;
Base& operator=(const Base&) = delete;
protected:
HRESULT CustomQueryInterface(REFIID /*riid*/, _Outptr_result_nullonfailure_ void** /*ppvObject*/, _Out_ bool *handled)
{
*handled = false;
return S_OK;
}
public:
Base() throw() = default;
typedef Base RuntimeClassT;
};
// Creates a Nano-COM object wrapped in a smart pointer.
template <typename T, typename ...TArgs>
ComPtr<T> Make(TArgs&&... args)
{
std::unique_ptr<char[]> buffer(new(std::nothrow) char[sizeof(T)]);
ComPtr<T> object;
if (buffer)
{
T* ptr = new (buffer.get())T(std::forward<TArgs>(args)...);
object.Attach(ptr);
buffer.release();
}
return object;
}
using Details::ChainInterfaces;
}
}
// Overloaded global function to provide to IID_PPV_ARGS that support Details::ComPtrRef
template<typename T>
void** IID_PPV_ARGS_Helper(Microsoft::WRL::Details::ComPtrRef<T> pp) throw()
{
return pp;
}

35
meson.build Normal file
View File

@ -0,0 +1,35 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
project('DirectX-Headers', 'cpp', version : '1.4.9',
default_options : ['cpp_std=c++14'])
inc_dirs = [include_directories('include', is_system : true)]
install_inc_subdirs = ['']
if host_machine.system() != 'windows'
inc_dirs += include_directories('include/wsl/stubs', is_system : true)
install_inc_subdirs += ['', 'wsl/stubs', 'directx']
endif
guids_lib = static_library('DirectX-Guids', 'src/dxguids.cpp', include_directories : inc_dirs, install : true)
dep_dxheaders = declare_dependency(
link_with : guids_lib,
include_directories : inc_dirs)
if meson.version().version_compare('>=0.54.0')
meson.override_dependency('DirectX-Headers', dep_dxheaders)
endif
if not meson.is_subproject() and get_option('build-test')
subdir('test')
endif
pkg = import('pkgconfig')
pkg.generate(name : 'DirectX-Headers',
description : 'Headers for using D3D12',
libraries : [guids_lib],
version : meson.project_version(),
subdirs : install_inc_subdirs)
install_subdir('include', install_dir : '')

7
meson_options.txt Normal file
View File

@ -0,0 +1,7 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
option('build-test',
type : 'boolean',
value : true,
description : 'Build the test')

12
src/dxguids.cpp Normal file
View File

@ -0,0 +1,12 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
// 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>

9
test/CMakeLists.txt Normal file
View File

@ -0,0 +1,9 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
project(DirectX-Headers-Test CXX)
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)

624
test/feature_check_test.cpp Normal file
View File

@ -0,0 +1,624 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#ifndef _WIN32
#include <wsl/winadapter.h>
#endif
#include <iostream>
#include <directx/d3d12.h>
#include <directx/dxcore.h>
#include <directx/d3dx12.h>
#include "dxguids/dxguids.h"
// -----------------------------------------------------------------------------------------------------------------
// Helper Macros for verifying feature check results
// -----------------------------------------------------------------------------------------------------------------
// Verifies the correctness of a feature check that should not fail
#define VERIFY_FEATURE_CHECK_NO_DEFAULT(Feature) \
{ \
if (features.Feature() != Data.Feature) \
{ \
std::cout << "Verification failed: " << #Feature << std::endl \
<< "Old API: " << Data.Feature << std::endl \
<< "New API: " << features.Feature() << std::endl; \
return -1; \
} \
}
// Verifies the return value from a feature check with a different name from the old API that should not fail
#define VERIFY_RENAMED_FEATURE_CHECK_NO_DEFAULT(NewFeature, OldFeature) \
{ \
if (features.NewFeature() != Data.OldFeature) \
{ \
std::cout << "Verification failed: " << #NewFeature << std::endl \
<< "Old API: " << Data.OldFeature << std::endl \
<< "New API: " << features.NewFeature() << std::endl; \
return -1; \
} \
}
// Verifies if the feature check returns the correct default value upon failure
#define VERIFY_DEFAULT(Feature, Default) \
{ \
if (features.Feature() != Default) \
{ \
std::cout << "Verification failed: " << #Feature << std::endl \
<< "Default: " << Default << std::endl \
<< "Actual: " << features.Feature() << std::endl; \
return -1; \
} \
}
// Verifies the result of a feature check.
// If the feature check failed because it's not supported by runtime, ensures that it returns the default value
#define VERIFY_FEATURE_CHECK(Feature, Default) \
{ \
if (FAILED(InitResult)) \
{ \
VERIFY_DEFAULT(Feature, Default); \
} \
else \
{ \
VERIFY_FEATURE_CHECK_NO_DEFAULT(Feature); \
} \
}
// Verifies the result of a feature check. The requested capability may have a different name in the new API
// If the feature check failed because it's not supported by runtime, ensures that it returns the default value
#define VERIFY_RENAMED_FEATURE_CHECK(Feature, OldName, Default) \
{ \
if (FAILED(InitResult)) \
{ \
VERIFY_DEFAULT(Feature, Default); \
} \
else \
{ \
VERIFY_RENAMED_FEATURE_CHECK_NO_DEFAULT(Feature, OldName); \
} \
}
// Initialize the feature support data structure to be used in the original CheckFeatureSupport API
#define INITIALIZE_FEATURE_SUPPORT_DATA(FeatureName) \
HRESULT InitResult; \
if (FAILED(InitResult = device->CheckFeatureSupport(D3D12_FEATURE_##FeatureName, &Data, sizeof(D3D12_FEATURE_DATA_##FeatureName)))) \
{ \
std::cout << "Feature not supported by device: " << #FeatureName << std::endl; \
}
// Prints out the mismatched feature check result to stdout
#define PRINT_CHECK_FAILED_MESSAGE(FeatureName, OldFeature, NewFeature) \
std::cout << "Verification failed: " << #FeatureName << std::endl \
<< "Old API: " << OldFeature << std::endl \
<< "New API: " << NewFeature << std::endl;
// -----------------------------------------------------------------------------------------------------------------
// Main function
// -----------------------------------------------------------------------------------------------------------------
int main()
{
ID3D12Device *device = nullptr;
if (FAILED(D3D12CreateDevice(nullptr, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&device))))
{
return -1;
}
// Initialize the new FeatureSupport class
// Notice that it is shared among all feature checks
CD3DX12FeatureSupport features;
if (FAILED(features.Init(device)))
{
return -1;
}
UINT NodeCount = device->GetNodeCount();
// Each feature comes with two code sections
// The first section shows how to use the API's of the new FeautreSupport class
// The second section contains tests that ensures the new API returns the same result as the old API
// 0: D3D12_OPTIONS
{
BOOL DoublePrecisionFloatShaderOps = features.DoublePrecisionFloatShaderOps();
BOOL OutputMergerLogicOp = features.OutputMergerLogicOp();
D3D12_TILED_RESOURCES_TIER TiledResourceTier = features.TiledResourcesTier();
D3D12_RESOURCE_BINDING_TIER ResourceBindingTier = features.ResourceBindingTier();
BOOL PSSpecifiedStencilRefSupported = features.PSSpecifiedStencilRefSupported();
BOOL TypedUAVLoadAdditionalFormats = features.TypedUAVLoadAdditionalFormats();
BOOL ROVsSupported = features.ROVsSupported();
D3D12_CONSERVATIVE_RASTERIZATION_TIER ConservativeRasterizationTier = features.ConservativeRasterizationTier();
BOOL StandardSwizzle64KBSupported = features.StandardSwizzle64KBSupported();
BOOL CrossAdapterRowMajorTextureSupported = features.CrossAdapterRowMajorTextureSupported();
BOOL VPAndRTArrayIndexFromAnyShaderFeedingRasterizerSupportedWithoutGSEmulation = features.VPAndRTArrayIndexFromAnyShaderFeedingRasterizerSupportedWithoutGSEmulation();
D3D12_RESOURCE_HEAP_TIER ResourceHeapTier = features.ResourceHeapTier();
D3D12_CROSS_NODE_SHARING_TIER CrossNodeSharingTier = features.CrossNodeSharingTier();
UINT MaxGPUVirtualAddressBitsPerResource = features.MaxGPUVirtualAddressBitsPerResource();
D3D12_FEATURE_DATA_D3D12_OPTIONS Data;
device->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS, &Data, sizeof(D3D12_FEATURE_DATA_D3D12_OPTIONS));
VERIFY_FEATURE_CHECK_NO_DEFAULT(DoublePrecisionFloatShaderOps);
VERIFY_FEATURE_CHECK_NO_DEFAULT(OutputMergerLogicOp);
VERIFY_FEATURE_CHECK_NO_DEFAULT(TiledResourcesTier);
VERIFY_FEATURE_CHECK_NO_DEFAULT(ResourceBindingTier);
VERIFY_FEATURE_CHECK_NO_DEFAULT(PSSpecifiedStencilRefSupported);
VERIFY_FEATURE_CHECK_NO_DEFAULT(TypedUAVLoadAdditionalFormats);
VERIFY_FEATURE_CHECK_NO_DEFAULT(ROVsSupported);
VERIFY_FEATURE_CHECK_NO_DEFAULT(ConservativeRasterizationTier);
VERIFY_FEATURE_CHECK_NO_DEFAULT(StandardSwizzle64KBSupported);
VERIFY_FEATURE_CHECK_NO_DEFAULT(CrossAdapterRowMajorTextureSupported);
VERIFY_FEATURE_CHECK_NO_DEFAULT(VPAndRTArrayIndexFromAnyShaderFeedingRasterizerSupportedWithoutGSEmulation);
VERIFY_FEATURE_CHECK_NO_DEFAULT(ResourceHeapTier);
VERIFY_FEATURE_CHECK_NO_DEFAULT(CrossNodeSharingTier);
VERIFY_FEATURE_CHECK_NO_DEFAULT(MaxGPUVirtualAddressBitsPerResource);
}
// 2: Feature Levels
{
D3D_FEATURE_LEVEL HighestLevelSupported = features.MaxSupportedFeatureLevel();
D3D12_FEATURE_DATA_FEATURE_LEVELS Data;
D3D_FEATURE_LEVEL KnownFeatureLevels[] =
{
D3D_FEATURE_LEVEL_1_0_CORE,
D3D_FEATURE_LEVEL_9_1,
D3D_FEATURE_LEVEL_9_2,
D3D_FEATURE_LEVEL_9_3,
D3D_FEATURE_LEVEL_10_0,
D3D_FEATURE_LEVEL_10_1,
D3D_FEATURE_LEVEL_11_0,
D3D_FEATURE_LEVEL_11_1,
D3D_FEATURE_LEVEL_12_0,
D3D_FEATURE_LEVEL_12_1,
D3D_FEATURE_LEVEL_12_2
};
Data.pFeatureLevelsRequested = KnownFeatureLevels;
Data.NumFeatureLevels = sizeof(KnownFeatureLevels) / sizeof(D3D_FEATURE_LEVEL);
device->CheckFeatureSupport(D3D12_FEATURE_FEATURE_LEVELS, &Data, sizeof(D3D12_FEATURE_DATA_FEATURE_LEVELS));
VERIFY_FEATURE_CHECK_NO_DEFAULT(MaxSupportedFeatureLevel);
}
// 3: Format Support
{
D3D12_FORMAT_SUPPORT1 Support1;
D3D12_FORMAT_SUPPORT2 Support2;
if (FAILED(features.FormatSupport(DXGI_FORMAT_R16G16B16A16_FLOAT, Support1, Support2))) {
std::cout << "Error: FormatSupport failed" << std::endl;
return -1;
}
D3D12_FEATURE_DATA_FORMAT_SUPPORT Data;
Data.Format = DXGI_FORMAT_R16G16B16A16_FLOAT;
if (SUCCEEDED(device->CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT, &Data, sizeof(D3D12_FEATURE_DATA_FORMAT_SUPPORT))))
{
if (Support1 != Data.Support1)
{
std::cout << "Verification failed: " << "FormatSupport1" << std::endl
<< "Old API: " << Data.Support1 << std::endl
<< "New API: " << Support1 << std::endl;
return -1;
}
if (Support2 != Data.Support2)
{
std::cout << "Verification failed: " << "FormatSupport2" << std::endl
<< "Old API: " << Data.Support2 << std::endl
<< "New API: " << Support2 << std::endl;
return -1;
}
}
}
// 4: Multisample Quality Support
{
UINT NumQualityLevels;
if (FAILED(features.MultisampleQualityLevels(DXGI_FORMAT_R16G16B16A16_FLOAT, 1, D3D12_MULTISAMPLE_QUALITY_LEVELS_FLAG_NONE, NumQualityLevels))) {
std::cout << "Error: MultisampleQualityLevels failed" << std::endl;
return -1;
}
D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS Data;
Data.Format = DXGI_FORMAT_R16G16B16A16_FLOAT;
Data.Flags = D3D12_MULTISAMPLE_QUALITY_LEVELS_FLAG_NONE;
Data.SampleCount = 1;
device->CheckFeatureSupport(D3D12_FEATURE_MULTISAMPLE_QUALITY_LEVELS, &Data, sizeof(D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS));
if (NumQualityLevels != Data.NumQualityLevels)
{
std::cout << "Verification failed: " << "MultisampleQualityLevels" << std::endl
<< "Old API: " << Data.NumQualityLevels << std::endl
<< "New API: " << NumQualityLevels << std::endl;
return -1;
}
}
// 5: Format Info
{
UINT8 PlaneCount;
if (FAILED(features.FormatInfo(DXGI_FORMAT_R16G16B16A16_FLOAT, PlaneCount)))
{
std::cout << "Error: FormatInfo failed" << std::endl;
return -1;
}
D3D12_FEATURE_DATA_FORMAT_INFO Data;
Data.Format = DXGI_FORMAT_R16G16B16A16_FLOAT;
device->CheckFeatureSupport(D3D12_FEATURE_FORMAT_INFO, &Data, sizeof(D3D12_FEATURE_DATA_FORMAT_INFO));
if (PlaneCount != Data.PlaneCount)
{
PRINT_CHECK_FAILED_MESSAGE(FormatInfo, Data.PlaneCount, PlaneCount);
}
}
// 6: GPU Virtual Address Support
{
UINT MaxGPUVABitsPerProcess = features.MaxGPUVirtualAddressBitsPerProcess();
UINT MaxGPUVABitsPerResource = features.MaxGPUVirtualAddressBitsPerResource();
D3D12_FEATURE_DATA_GPU_VIRTUAL_ADDRESS_SUPPORT Data;
device->CheckFeatureSupport(D3D12_FEATURE_GPU_VIRTUAL_ADDRESS_SUPPORT, &Data, sizeof(D3D12_FEATURE_DATA_GPU_VIRTUAL_ADDRESS_SUPPORT));
VERIFY_FEATURE_CHECK_NO_DEFAULT(MaxGPUVirtualAddressBitsPerProcess);
VERIFY_FEATURE_CHECK_NO_DEFAULT(MaxGPUVirtualAddressBitsPerResource);
}
// 7: Shader Model
{
D3D_SHADER_MODEL HighestShaderModel = features.HighestShaderModel();
D3D12_FEATURE_DATA_SHADER_MODEL Data;
D3D_SHADER_MODEL KnownShaderModels[] =
{
D3D_SHADER_MODEL_6_7,
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
};
UINT NumKnownShaderModels = sizeof(KnownShaderModels) / sizeof(D3D_SHADER_MODEL);
for (UINT i = 0; i < NumKnownShaderModels; i++)
{
Data.HighestShaderModel = D3D_SHADER_MODEL_6_7; // Highest Known Shader Model
if (SUCCEEDED(device->CheckFeatureSupport(D3D12_FEATURE_SHADER_MODEL, &Data, sizeof(D3D12_FEATURE_DATA_SHADER_MODEL))))
{
VERIFY_FEATURE_CHECK_NO_DEFAULT(HighestShaderModel);
}
}
}
// 8: Options1
{
BOOL WaveOps = features.WaveOps();
UINT WaveLaneCountMin = features.WaveLaneCountMin();
UINT WaveLaneCountMax = features.WaveLaneCountMax();
D3D12_FEATURE_DATA_D3D12_OPTIONS1 Data;
INITIALIZE_FEATURE_SUPPORT_DATA(D3D12_OPTIONS1);
VERIFY_FEATURE_CHECK(WaveOps, false);
VERIFY_FEATURE_CHECK(WaveLaneCountMax, 0);
VERIFY_FEATURE_CHECK(WaveLaneCountMin, 0);
}
// 10: Protected Resource Session Support
for (UINT NodeId = 0; NodeId < NodeCount; NodeId++)
{
D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAGS ProtectedResourceSessionSupport = features.ProtectedResourceSessionSupport(NodeId);
D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_SUPPORT Data;
Data.NodeIndex = NodeId;
INITIALIZE_FEATURE_SUPPORT_DATA(PROTECTED_RESOURCE_SESSION_SUPPORT);
VERIFY_RENAMED_FEATURE_CHECK(ProtectedResourceSessionSupport, Support, D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAG_NONE);
}
// 12: Root Signature
{
D3D_ROOT_SIGNATURE_VERSION HighestRootSignatureVersion = features.HighestRootSignatureVersion();
D3D12_FEATURE_DATA_ROOT_SIGNATURE Data;
Data.HighestVersion = D3D_ROOT_SIGNATURE_VERSION_1_1; // Highest Known Version
INITIALIZE_FEATURE_SUPPORT_DATA(ROOT_SIGNATURE);
VERIFY_RENAMED_FEATURE_CHECK(HighestRootSignatureVersion, HighestVersion, (D3D_ROOT_SIGNATURE_VERSION)0);
}
// 16: Architecture1
for (UINT NodeId = 0; NodeId < NodeCount; NodeId++)
{
BOOL IsolatedMMU = features.IsolatedMMU(NodeId);
BOOL TileBasedRenderer = features.TileBasedRenderer(NodeId);
BOOL UMA = features.UMA(NodeId);
BOOL CacheCoherentUMA = features.CacheCoherentUMA(NodeId);
D3D12_FEATURE_DATA_ARCHITECTURE1 Data;
Data.NodeIndex = NodeId;
INITIALIZE_FEATURE_SUPPORT_DATA(ARCHITECTURE1);
if (FAILED(InitResult))
{
D3D12_FEATURE_DATA_ARCHITECTURE Data;
Data.NodeIndex = NodeId;
INITIALIZE_FEATURE_SUPPORT_DATA(ARCHITECTURE);
VERIFY_FEATURE_CHECK_NO_DEFAULT(TileBasedRenderer);
VERIFY_FEATURE_CHECK_NO_DEFAULT(UMA);
VERIFY_FEATURE_CHECK_NO_DEFAULT(CacheCoherentUMA);
}
else
{
VERIFY_FEATURE_CHECK(TileBasedRenderer, false);
VERIFY_FEATURE_CHECK(UMA, false);
VERIFY_FEATURE_CHECK(CacheCoherentUMA, false);
}
VERIFY_FEATURE_CHECK(IsolatedMMU, false);
}
// 18: Options2
{
BOOL DepthBoundsTestSupported = features.DepthBoundsTestSupported();
D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER ProgrammableSamplePositionsTier = features.ProgrammableSamplePositionsTier();
D3D12_FEATURE_DATA_D3D12_OPTIONS2 Data;
INITIALIZE_FEATURE_SUPPORT_DATA(D3D12_OPTIONS2);
VERIFY_FEATURE_CHECK(DepthBoundsTestSupported, false);
VERIFY_FEATURE_CHECK(ProgrammableSamplePositionsTier, D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER_NOT_SUPPORTED);
}
// 19: Shader Cache
{
D3D12_SHADER_CACHE_SUPPORT_FLAGS ShaderCacheSupportFlags = features.ShaderCacheSupportFlags();
D3D12_FEATURE_DATA_SHADER_CACHE Data;
INITIALIZE_FEATURE_SUPPORT_DATA(SHADER_CACHE);
VERIFY_RENAMED_FEATURE_CHECK(ShaderCacheSupportFlags, SupportFlags, D3D12_SHADER_CACHE_FLAG_NONE);
}
// 20: Command Queue Prioirity
{
// Basic check
BOOL CommandQueuePrioritySupportedPositive = features.CommandQueuePrioritySupported(D3D12_COMMAND_LIST_TYPE_DIRECT, D3D12_COMMAND_QUEUE_PRIORITY_NORMAL);
// Check for Global Realtime support
BOOL CommandQueuePrioritySupportedRealtime = features.CommandQueuePrioritySupported(D3D12_COMMAND_LIST_TYPE_COPY, D3D12_COMMAND_QUEUE_PRIORITY_GLOBAL_REALTIME);
// Test on invalid inputs
BOOL CommandQueuePrioritySupportedInvalid = features.CommandQueuePrioritySupported((D3D12_COMMAND_LIST_TYPE)7, 0);
D3D12_FEATURE_DATA_COMMAND_QUEUE_PRIORITY Data;
{
Data.CommandListType = D3D12_COMMAND_LIST_TYPE_DIRECT;
Data.Priority = D3D12_COMMAND_QUEUE_PRIORITY_NORMAL;
INITIALIZE_FEATURE_SUPPORT_DATA(COMMAND_QUEUE_PRIORITY);
if (CommandQueuePrioritySupportedPositive != Data.PriorityForTypeIsSupported)
{
PRINT_CHECK_FAILED_MESSAGE(CommandQueuePriority, Data.PriorityForTypeIsSupported, CommandQueuePrioritySupportedPositive);
}
}
{
Data.CommandListType = D3D12_COMMAND_LIST_TYPE_COPY;
Data.Priority = D3D12_COMMAND_QUEUE_PRIORITY_GLOBAL_REALTIME;
INITIALIZE_FEATURE_SUPPORT_DATA(COMMAND_QUEUE_PRIORITY);
if (CommandQueuePrioritySupportedRealtime != Data.PriorityForTypeIsSupported)
{
PRINT_CHECK_FAILED_MESSAGE(CommandQueuePriority, Data.PriorityForTypeIsSupported, CommandQueuePrioritySupportedRealtime);
}
}
if (CommandQueuePrioritySupportedInvalid)
{
std::cout << "Error: Wrong result from Command Queue Priority - Invalid Test Case\n"
<< "New API returned true on invalid Command List Types\n"
<< "Check if the list of command list types has updated\n";
return -1;
}
}
// 21: Options3
{
BOOL CopyQueueTimestampQueriesSupported = features.CopyQueueTimestampQueriesSupported();
BOOL CastingFullyTypedFormatSupported = features.CastingFullyTypedFormatSupported();
D3D12_COMMAND_LIST_SUPPORT_FLAGS WriteBufferImmediateSupportFlags = features.WriteBufferImmediateSupportFlags();
D3D12_VIEW_INSTANCING_TIER ViewInstancingTier = features.ViewInstancingTier();
BOOL BarycentricsSupported = features.BarycentricsSupported();
D3D12_FEATURE_DATA_D3D12_OPTIONS3 Data;
INITIALIZE_FEATURE_SUPPORT_DATA(D3D12_OPTIONS3);
VERIFY_FEATURE_CHECK(CopyQueueTimestampQueriesSupported, false);
VERIFY_FEATURE_CHECK(CastingFullyTypedFormatSupported, false);
VERIFY_FEATURE_CHECK(WriteBufferImmediateSupportFlags, D3D12_COMMAND_LIST_SUPPORT_FLAG_NONE);
VERIFY_FEATURE_CHECK(ViewInstancingTier, D3D12_VIEW_INSTANCING_TIER_NOT_SUPPORTED);
VERIFY_FEATURE_CHECK(BarycentricsSupported, false);
}
// 22: Existing Heaps
{
BOOL ExistingHeapsSupported = features.ExistingHeapsSupported();
D3D12_FEATURE_DATA_EXISTING_HEAPS Data;
INITIALIZE_FEATURE_SUPPORT_DATA(EXISTING_HEAPS);
VERIFY_RENAMED_FEATURE_CHECK(ExistingHeapsSupported, Supported, false);
}
// 23: D3D12 Options4
{
BOOL MSAA64KBAlignedTextureSupported = features.MSAA64KBAlignedTextureSupported();
D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER SharedResourceCompatibilityTier = features.SharedResourceCompatibilityTier();
BOOL Native16BitShaderOpsSupported = features.Native16BitShaderOpsSupported();
D3D12_FEATURE_DATA_D3D12_OPTIONS4 Data;
INITIALIZE_FEATURE_SUPPORT_DATA(D3D12_OPTIONS4);
VERIFY_FEATURE_CHECK(MSAA64KBAlignedTextureSupported, false);
VERIFY_FEATURE_CHECK(SharedResourceCompatibilityTier, D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_0);
VERIFY_FEATURE_CHECK(Native16BitShaderOpsSupported, false);
}
// 24: Serialization
{
D3D12_HEAP_SERIALIZATION_TIER HeapSerializationTier = features.HeapSerializationTier();
D3D12_FEATURE_DATA_SERIALIZATION Data;
INITIALIZE_FEATURE_SUPPORT_DATA(SERIALIZATION);
VERIFY_FEATURE_CHECK(HeapSerializationTier, D3D12_HEAP_SERIALIZATION_TIER_0);
}
// 25: Cross Node
{
BOOL CrossNodeAtomicShaderInstructions = features.CrossNodeAtomicShaderInstructions();
D3D12_FEATURE_DATA_CROSS_NODE Data;
INITIALIZE_FEATURE_SUPPORT_DATA(CROSS_NODE);
VERIFY_RENAMED_FEATURE_CHECK(CrossNodeAtomicShaderInstructions, AtomicShaderInstructions, false);
}
// 27: Options5
{
BOOL SRVOnlyTiledResourceTier3 = features.SRVOnlyTiledResourceTier3();
D3D12_RENDER_PASS_TIER RenderPassesTier = features.RenderPassesTier();
D3D12_RAYTRACING_TIER RaytracingTier = features.RaytracingTier();
D3D12_FEATURE_DATA_D3D12_OPTIONS5 Data;
INITIALIZE_FEATURE_SUPPORT_DATA(D3D12_OPTIONS5);
VERIFY_FEATURE_CHECK(SRVOnlyTiledResourceTier3, false);
VERIFY_FEATURE_CHECK(RenderPassesTier, D3D12_RENDER_PASS_TIER_0);
VERIFY_FEATURE_CHECK(RaytracingTier, D3D12_RAYTRACING_TIER_NOT_SUPPORTED);
}
// 28: Displayable
{
BOOL DisplayableTexture = features.DisplayableTexture();
D3D12_FEATURE_DATA_DISPLAYABLE Data;
INITIALIZE_FEATURE_SUPPORT_DATA(DISPLAYABLE);
VERIFY_FEATURE_CHECK(DisplayableTexture, false);
}
// 30: Options6
{
BOOL AdditionalShadingRatesSupported = features.AdditionalShadingRatesSupported();
BOOL PerPrimitiveShadingRateSupportedWithViewportIndexing = features.PerPrimitiveShadingRateSupportedWithViewportIndexing();
D3D12_VARIABLE_SHADING_RATE_TIER VariableShadingRateTier = features.VariableShadingRateTier();
BOOL ShadingRateImageTileSize = features.ShadingRateImageTileSize();
BOOL BackgroundProcessingSupported = features.BackgroundProcessingSupported();
D3D12_FEATURE_DATA_D3D12_OPTIONS6 Data;
INITIALIZE_FEATURE_SUPPORT_DATA(D3D12_OPTIONS6);
VERIFY_FEATURE_CHECK(AdditionalShadingRatesSupported, false);
VERIFY_FEATURE_CHECK(PerPrimitiveShadingRateSupportedWithViewportIndexing, false);
VERIFY_FEATURE_CHECK(VariableShadingRateTier, D3D12_VARIABLE_SHADING_RATE_TIER_NOT_SUPPORTED);
VERIFY_FEATURE_CHECK(ShadingRateImageTileSize, false);
VERIFY_FEATURE_CHECK(BackgroundProcessingSupported, false);
}
// 31: Query Metacommand
// The function is simply a forwarding call to the old API
// Takes in a pointer to D3D12_FEATURE_DATA_QUERY_METACOMMAND as input parameter
// No need to test specifically
// 32: Options7
{
D3D12_MESH_SHADER_TIER MeshShaderTier = features.MeshShaderTier();
D3D12_SAMPLER_FEEDBACK_TIER SamplerFeedbackTier = features.SamplerFeedbackTier();
D3D12_FEATURE_DATA_D3D12_OPTIONS7 Data;
INITIALIZE_FEATURE_SUPPORT_DATA(D3D12_OPTIONS7);
VERIFY_FEATURE_CHECK(MeshShaderTier, D3D12_MESH_SHADER_TIER_NOT_SUPPORTED);
VERIFY_FEATURE_CHECK(SamplerFeedbackTier, D3D12_SAMPLER_FEEDBACK_TIER_NOT_SUPPORTED);
}
// 33: Session Type Count
for (UINT NodeId = 0; NodeId < NodeCount; NodeId++)
{
UINT ProtectedResourceSessionTypeCount = features.ProtectedResourceSessionTypeCount(NodeId);
D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_TYPE_COUNT Data;
Data.NodeIndex = NodeId;
INITIALIZE_FEATURE_SUPPORT_DATA(PROTECTED_RESOURCE_SESSION_TYPE_COUNT);
VERIFY_RENAMED_FEATURE_CHECK(ProtectedResourceSessionTypeCount, Count, 0);
}
// 34: Session Types
for (UINT NodeId = 0; NodeId < NodeCount; NodeId++)
{
std::vector<GUID> ProtectedResourceSessionTypes = features.ProtectedResourceSessionTypes(NodeId);
D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_TYPE_COUNT CountData;
CountData.NodeIndex = NodeId;
if (FAILED(device->CheckFeatureSupport(D3D12_FEATURE_PROTECTED_RESOURCE_SESSION_TYPE_COUNT, &CountData, sizeof(D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_TYPE_COUNT))))
{
if (ProtectedResourceSessionTypes.size() != 0)
{
std::cout << "Error: Wrong result from Protected Resource Session Types on Node " << NodeId << std::endl
<< "Type count check failed but types vector is not empty\n";
return -1;
}
continue;
}
if (CountData.Count != ProtectedResourceSessionTypes.size())
{
std::cout << "Error: Wrong result from Protected Resource Session Types on Node " << NodeId << std::endl
<< "Types vector size does not equal type count\n";
return -1;
}
D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_TYPES Data;
Data.NodeIndex = NodeId;
Data.Count = CountData.Count;
Data.pTypes = new GUID[Data.Count];
INITIALIZE_FEATURE_SUPPORT_DATA(PROTECTED_RESOURCE_SESSION_TYPES);
if (SUCCEEDED(InitResult))
{
for (unsigned int i = 0; i < Data.Count; i++)
{
if (ProtectedResourceSessionTypes[i] != Data.pTypes[i])
{
std::cout << "Error: Result mismatch from Proteted Resource Session Types\n"
<< "Node Index: " << NodeId << std::endl
<< "Type Index: " << i << std::endl;
return -1;
}
}
}
}
// 36: Options8
{
BOOL UnalignedBlockTexturesSupported = features.UnalignedBlockTexturesSupported();
D3D12_FEATURE_DATA_D3D12_OPTIONS8 Data;
INITIALIZE_FEATURE_SUPPORT_DATA(D3D12_OPTIONS8);
VERIFY_FEATURE_CHECK(UnalignedBlockTexturesSupported, false);
}
// 37: Options9
{
BOOL MeshShaderPipelineStatsSupported = features.MeshShaderPipelineStatsSupported();
BOOL MeshShaderSupportsFullRangeRenderTargetArrayIndex = features.MeshShaderSupportsFullRangeRenderTargetArrayIndex();
D3D12_WAVE_MMA_TIER WaveMMATier = features.WaveMMATier();
D3D12_FEATURE_DATA_D3D12_OPTIONS9 Data;
INITIALIZE_FEATURE_SUPPORT_DATA(D3D12_OPTIONS9);
VERIFY_FEATURE_CHECK(MeshShaderPipelineStatsSupported, false);
VERIFY_FEATURE_CHECK(MeshShaderSupportsFullRangeRenderTargetArrayIndex, false);
VERIFY_FEATURE_CHECK(WaveMMATier, D3D12_WAVE_MMA_TIER_NOT_SUPPORTED);
}
// 39: Options10
{
BOOL VariableRateShadingSumCombinerSupported = features.VariableRateShadingSumCombinerSupported();
BOOL MeshShaderPerPrimitiveShadingRateSupported = features.MeshShaderPerPrimitiveShadingRateSupported();
D3D12_FEATURE_DATA_D3D12_OPTIONS10 Data;
INITIALIZE_FEATURE_SUPPORT_DATA(D3D12_OPTIONS10);
VERIFY_FEATURE_CHECK(VariableRateShadingSumCombinerSupported, false);
VERIFY_FEATURE_CHECK(MeshShaderPerPrimitiveShadingRateSupported, false);
}
// 40: Options11
{
BOOL AtomicInt64OnDescriptorHeapResourceSupported = features.AtomicInt64OnDescriptorHeapResourceSupported();
D3D12_FEATURE_DATA_D3D12_OPTIONS11 Data;
INITIALIZE_FEATURE_SUPPORT_DATA(D3D12_OPTIONS11);
VERIFY_FEATURE_CHECK(AtomicInt64OnDescriptorHeapResourceSupported, false);
}
std::cout << "Test completed with no errors." << std::endl;
return 0;
}

9
test/meson.build Normal file
View File

@ -0,0 +1,9 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
cpp = meson.get_compiler('cpp')
d3d12_lib = cpp.find_library('d3d12')
dxcore_lib = cpp.find_library('dxcore')
headers_test = executable('DirectX-Headers-Test', 'test.cpp',
dependencies : [dep_dxheaders, d3d12_lib, dxcore_lib])

33
test/test.cpp Normal file
View File

@ -0,0 +1,33 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#ifndef _WIN32
#include <wsl/winadapter.h>
#endif
#include <directx/d3d12.h>
#include <directx/d3d12video.h>
#include <directx/dxcore.h>
#include <directx/d3dx12.h>
#include "dxguids/dxguids.h"
int main()
{
IDXCoreAdapter *adapter = nullptr;
ID3D12Device *device = nullptr;
{
IDXCoreAdapterFactory *factory = nullptr;
if (FAILED(DXCoreCreateAdapterFactory(&factory)))
return -1;
IDXCoreAdapterList *list = nullptr;
if (FAILED(factory->CreateAdapterList(1, &DXCORE_ADAPTER_ATTRIBUTE_D3D12_CORE_COMPUTE, &list)))
return -1;
if (FAILED(list->GetAdapter(0, &adapter)))
return -1;
}
return D3D12CreateDevice(adapter, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&device));
}