cmake+d3d12: d3d12 now builds succesfully on older Windows SDKs, so simplify the checks

This commit is contained in:
Anonymous Maarten 2024-05-24 21:47:57 +02:00
parent 318ab9361b
commit 89a4d9ae67
2 changed files with 6 additions and 11 deletions

View File

@ -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 <winsdkver.h>
#include <sdkddkver.h>
#include <d3d12.h>
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)

View File

@ -42,6 +42,7 @@
#include <dxgi1_6.h>
#include <dxgidebug.h>
#include <d3d12sdklayers.h>
#include <sdkddkver.h>
#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) = \