Make sure we're actually running on Windows before using D3D renderers

This commit is contained in:
Sam Lantinga
2024-07-08 11:36:11 -07:00
parent 4d5f139f0f
commit d6c8485f28
4 changed files with 17 additions and 5 deletions

View File

@@ -976,6 +976,11 @@ static HRESULT D3D11_CreateSwapChain(SDL_Renderer *renderer, int w, int h)
} else {
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)
HWND hwnd = (HWND)SDL_GetProperty(SDL_GetWindowProperties(renderer->window), SDL_PROP_WINDOW_WIN32_HWND_POINTER, NULL);
if (!hwnd) {
SDL_SetError("Couldn't get window handle");
result = E_FAIL;
goto done;
}
result = IDXGIFactory2_CreateSwapChainForHwnd(data->dxgiFactory,
(IUnknown *)data->d3dDevice,