d3d12: Import DirectX-Headers, use local d3d12.h in SDL_render.

This avoids lots of build issues with the various D3D12 headers out there (MinGW, old Windows SDKs, etc) and also opens the door for WSL2 libd3d12.so support.

Note that the build system has not been changed; technically _all_ platforms now have d3d12.h but we should only enable the backend when it's actually expected to work.
This commit is contained in:
Ethan Lee 2024-07-31 20:18:57 -04:00 committed by Sam Lantinga
parent c5a99f1515
commit 55e9a8ca45
4 changed files with 39224 additions and 2 deletions

View File

@ -38,7 +38,18 @@
#define D3D12_TEXTURE_DATA_PITCH_ALIGNMENT 256
#endif
#else
#include <d3d12.h>
/* From the DirectX-Headers build system:
* "MinGW has RPC headers which define old versions, and complain if D3D
* headers are included before the RPC headers, since D3D headers were
* generated with new MIDL and "require" new RPC headers."
*/
#define __REQUIRED_RPCNDR_H_VERSION__ 475
#ifndef WINAPI_PARTITION_GAMES
#define WINAPI_PARTITION_GAMES 0
#endif /* WINAPI_PARTITION_GAMES */
#include "../../video/directx/d3d12.h"
#include <dxgi1_6.h>
#include <dxgidebug.h>
#include <d3d12sdklayers.h>

View File

@ -23,7 +23,17 @@
#if SDL_VIDEO_RENDER_D3D12 && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
#include "../../core/windows/SDL_windows.h"
#include <d3d12.h>
/* From the DirectX-Headers build system:
* "MinGW has RPC headers which define old versions, and complain if D3D
* headers are included before the RPC headers, since D3D headers were
* generated with new MIDL and "require" new RPC headers."
*/
#define __REQUIRED_RPCNDR_H_VERSION__ 475
#ifndef WINAPI_PARTITION_GAMES
#define WINAPI_PARTITION_GAMES 0
#endif /* WINAPI_PARTITION_GAMES */
#include "../../video/directx/d3d12.h"
#include "SDL_shaders_d3d12.h"

34938
src/video/directx/d3d12.h Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff