From 89a4d9ae67e82913af71a93611f396530a05f61d Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Fri, 24 May 2024 21:47:57 +0200 Subject: [PATCH] cmake+d3d12: d3d12 now builds succesfully on older Windows SDKs, so simplify the checks --- CMakeLists.txt | 9 +-------- src/render/direct3d12/SDL_render_d3d12.c | 8 +++++--- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4284bf4e1..7db1aab8f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1869,14 +1869,7 @@ elseif(WINDOWS) check_include_file(d3d9.h HAVE_D3D_H) check_include_file(d3d11_1.h HAVE_D3D11_H) - check_c_source_compiles(" - #include - #include - #include - ID3D12Device1 *device; - #if WDK_NTDDI_VERSION > 0x0A000008 - int main(int argc, char **argv) { return 0; } - #endif" HAVE_D3D12_H) + check_include_file(d3d12.h HAVE_D3D12_H) check_include_file(ddraw.h HAVE_DDRAW_H) check_include_file(dsound.h HAVE_DSOUND_H) check_include_file(dinput.h HAVE_DINPUT_H) diff --git a/src/render/direct3d12/SDL_render_d3d12.c b/src/render/direct3d12/SDL_render_d3d12.c index ffb7996e0..9f08a0de1 100644 --- a/src/render/direct3d12/SDL_render_d3d12.c +++ b/src/render/direct3d12/SDL_render_d3d12.c @@ -42,6 +42,7 @@ #include #include #include +#include #endif #include "SDL_shaders_d3d12.h" @@ -75,15 +76,16 @@ #endif /* - * Older Windows SDK headers declare some d3d12 functions with the wrong function prototype. + * Older MS Windows SDK headers declare some d3d12 functions with the wrong function prototype. * - ID3D12Heap::GetDesc * - ID3D12Resource::GetDesc * - ID3D12DescriptorHeap::GetDesc * (and 9 more) - * */ + * This is fixed in SDKs since WDK_NTDDI_VERSION >= NTDDI_WIN10_FE (0x0A00000A) + */ #if !(defined(__MINGW32__) || defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)) \ - && (!defined(D3D12_SDK_VERSION) || D3D12_SDK_VERSION < 3) + && (WDK_NTDDI_VERSION < 0x0A00000A) #define D3D_CALL_RET_ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(THIS, ...) do { \ void (STDMETHODCALLTYPE * func)(ID3D12DescriptorHeap * This, D3D12_CPU_DESCRIPTOR_HANDLE * Handle) = \