mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-23 06:55:38 +00:00
Fix build on Windows targets without dxgi.h, like MingW32.
This commit is contained in:
parent
7528f94ca5
commit
2a7aa9bde8
|
@ -804,6 +804,7 @@ elseif(WINDOWS)
|
|||
check_include_file(dsound.h HAVE_DSOUND_H)
|
||||
check_include_file(dinput.h HAVE_DINPUT_H)
|
||||
check_include_file(xaudio2.h HAVE_XAUDIO2_H)
|
||||
check_include_file(dxgi.h HAVE_DXGI_H)
|
||||
if(HAVE_D3D_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H OR HAVE_XAUDIO2_H)
|
||||
set(HAVE_DIRECTX TRUE)
|
||||
# TODO: change $ENV{DXSDL_DIR} to get the path from the include checks
|
||||
|
|
|
@ -2404,6 +2404,7 @@ AC_HELP_STRING([--enable-directx], [use DirectX for Windows audio/video [[defaul
|
|||
AC_CHECK_HEADER(dsound.h, have_dsound=yes)
|
||||
AC_CHECK_HEADER(dinput.h, have_dinput=yes)
|
||||
AC_CHECK_HEADER(xaudio2.h, have_xaudio2=yes)
|
||||
AC_CHECK_HEADER(dxgi.h, have_dxgi=yes)
|
||||
|
||||
SUMMARY_video="${SUMMARY_video} directx"
|
||||
SUMMARY_audio="${SUMMARY_audio} directx"
|
||||
|
@ -2830,6 +2831,9 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
|
|||
AC_DEFINE(SDL_VIDEO_RENDER_D3D11, 1, [ ])
|
||||
fi
|
||||
fi
|
||||
if test x$have_dxgi = xyes; then
|
||||
AC_DEFINE(HAVE_DXGI_H, 1, [ ])
|
||||
fi
|
||||
# Set up files for the audio library
|
||||
if test x$enable_audio = xyes; then
|
||||
AC_DEFINE(SDL_AUDIO_DRIVER_WINMM, 1, [ ])
|
||||
|
|
|
@ -48,6 +48,8 @@
|
|||
#cmakedefine HAVE_GCC_SYNC_LOCK_TEST_AND_SET @HAVE_GCC_SYNC_LOCK_TEST_AND_SET@
|
||||
#cmakedefine HAVE_PTHREAD_SPINLOCK @HAVE_PTHREAD_SPINLOCK@
|
||||
|
||||
#cmakedefine HAVE_DXGI_H @HAVE_DXGI_H@
|
||||
|
||||
/* Comment this if you want to build without any C library requirements */
|
||||
#cmakedefine HAVE_LIBC 1
|
||||
#if HAVE_LIBC
|
||||
|
|
|
@ -51,6 +51,8 @@
|
|||
#undef HAVE_GCC_SYNC_LOCK_TEST_AND_SET
|
||||
#undef HAVE_PTHREAD_SPINLOCK
|
||||
|
||||
#undef HAVE_DXGI_H
|
||||
|
||||
/* Comment this if you want to build without any C library requirements */
|
||||
#undef HAVE_LIBC
|
||||
#if HAVE_LIBC
|
||||
|
|
|
@ -76,6 +76,8 @@ typedef unsigned int uintptr_t;
|
|||
# define SIZEOF_VOIDP 4
|
||||
#endif
|
||||
|
||||
#define HAVE_DXGI_H 1
|
||||
|
||||
/* This is disabled by default to avoid C runtime dependencies and manifest requirements */
|
||||
#ifdef HAVE_LIBC
|
||||
/* Useful headers */
|
||||
|
|
|
@ -77,6 +77,7 @@ typedef unsigned int uintptr_t;
|
|||
#endif
|
||||
|
||||
/* Useful headers */
|
||||
#define HAVE_DXGI_H 1
|
||||
#define HAVE_LIBC 1
|
||||
#define HAVE_STDIO_H 1
|
||||
#define STDC_HEADERS 1
|
||||
|
|
|
@ -245,11 +245,12 @@ SDL_Direct3D9GetAdapterIndex( int displayIndex )
|
|||
}
|
||||
}
|
||||
|
||||
#if HAVE_DXGI_H
|
||||
#define CINTERFACE
|
||||
#define COBJMACROS
|
||||
#include <dxgi.h>
|
||||
|
||||
SDL_bool
|
||||
static SDL_bool
|
||||
DXGI_LoadDLL(void **pDXGIDLL, IDXGIFactory **pDXGIFactory)
|
||||
{
|
||||
*pDXGIDLL = SDL_LoadObject("DXGI.DLL");
|
||||
|
@ -277,18 +278,25 @@ DXGI_LoadDLL(void **pDXGIDLL, IDXGIFactory **pDXGIFactory)
|
|||
return SDL_FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
SDL_bool
|
||||
SDL_DXGIGetOutputInfo(int displayIndex, int *adapterIndex, int *outputIndex)
|
||||
{
|
||||
#if !HAVE_DXGI_H
|
||||
if (adapterIndex) *adapterIndex = -1;
|
||||
if (outputIndex) *outputIndex = -1;
|
||||
SDL_SetError("SDL was compiled without DXGI support due to missing dxgi.h header");
|
||||
return SDL_FALSE;
|
||||
#else
|
||||
SDL_DisplayData *pData = (SDL_DisplayData *)SDL_GetDisplayDriverData(displayIndex);
|
||||
void *pDXGIDLL;
|
||||
char *displayName;
|
||||
int nAdapter, nOutput;
|
||||
IDXGIFactory *pDXGIFactory;
|
||||
IDXGIAdapter *pDXGIAdapter;
|
||||
IDXGIOutput* pDXGIOutput;
|
||||
char *displayName;
|
||||
int nAdapter, nOutput;
|
||||
|
||||
if (!adapterIndex) {
|
||||
SDL_InvalidParamError("adapterIndex");
|
||||
|
@ -344,6 +352,7 @@ SDL_DXGIGetOutputInfo(int displayIndex, int *adapterIndex, int *outputIndex)
|
|||
} else {
|
||||
return SDL_TRUE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* SDL_VIDEO_DRIVER_WINDOWS */
|
||||
|
|
Loading…
Reference in a new issue