Refactored for similarity to surrounding code

This commit is contained in:
Sam Lantinga 2022-09-06 12:29:42 -07:00
parent 5ffede35d9
commit 4fd6bba257
1 changed files with 10 additions and 13 deletions

View File

@ -720,13 +720,9 @@ D3D12_CreateDeviceResources(SDL_Renderer* renderer)
PFN_CREATE_DXGI_FACTORY CreateDXGIFactoryFunc; PFN_CREATE_DXGI_FACTORY CreateDXGIFactoryFunc;
PFN_D3D12_CREATE_DEVICE D3D12CreateDeviceFunc; PFN_D3D12_CREATE_DEVICE D3D12CreateDeviceFunc;
#endif #endif
#ifndef __GDK__
HMODULE kernel32;
typedef HANDLE(WINAPI* PFN_CREATE_EVENT_EX)(LPSECURITY_ATTRIBUTES lpEventAttributes, LPCWSTR lpName, DWORD dwFlags, DWORD dwDesiredAccess); typedef HANDLE(WINAPI* PFN_CREATE_EVENT_EX)(LPSECURITY_ATTRIBUTES lpEventAttributes, LPCWSTR lpName, DWORD dwFlags, DWORD dwDesiredAccess);
PFN_CREATE_EVENT_EX CreateEventExFunc; PFN_CREATE_EVENT_EX CreateEventExFunc;
#else
#define CreateEventExFunc CreateEventEx
#endif
D3D12_RenderData* data = (D3D12_RenderData*)renderer->driverdata; D3D12_RenderData* data = (D3D12_RenderData*)renderer->driverdata;
ID3D12Device* d3dDevice = NULL; ID3D12Device* d3dDevice = NULL;
HRESULT result = S_OK; HRESULT result = S_OK;
@ -755,20 +751,21 @@ D3D12_CreateDeviceResources(SDL_Renderer* renderer)
/* See if we need debug interfaces */ /* See if we need debug interfaces */
createDebug = SDL_GetHintBoolean(SDL_HINT_RENDER_DIRECT3D11_DEBUG, SDL_FALSE); createDebug = SDL_GetHintBoolean(SDL_HINT_RENDER_DIRECT3D11_DEBUG, SDL_FALSE);
#ifndef __GDK__ #ifdef __GDK__
CreateEventExFunc = CreateEventExW;
#else
/* CreateEventEx() arrived in Vista, so we need to load it with GetProcAddress for XP. */ /* CreateEventEx() arrived in Vista, so we need to load it with GetProcAddress for XP. */
kernel32 = GetModuleHandle(TEXT("kernel32.dll")); {
if (!kernel32) { HMODULE kernel32 = GetModuleHandle(TEXT("kernel32.dll"));
result = E_FAIL; if (kernel32) {
goto done; CreateEventExFunc = (PFN_CREATE_EVENT_EX) GetProcAddress(kernel32, "CreateEventExW");
}
} }
#endif
CreateEventExFunc = (PFN_CREATE_EVENT_EX) GetProcAddress(kernel32, "CreateEventExW");
if (!CreateEventExFunc) { if (!CreateEventExFunc) {
result = E_FAIL; result = E_FAIL;
goto done; goto done;
} }
#endif
#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
data->hDXGIMod = SDL_LoadObject("dxgi.dll"); data->hDXGIMod = SDL_LoadObject("dxgi.dll");