1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-27 04:54:15 +01:00

[native] Add SDL2 native headers

Not included by DXVK at all, but used by external applications.
This commit is contained in:
Joshua Ashton 2022-08-20 23:11:36 +00:00 committed by Joshie
parent e969f49cee
commit 91a5123ad0
2 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,25 @@
#include <windows.h>
#include <SDL2/SDL.h>
namespace dxvk::wsi {
inline SDL_Window* fromHwnd(HWND hWindow) {
return reinterpret_cast<SDL_Window*>(hWindow);
}
inline HWND toHwnd(SDL_Window* pWindow) {
return reinterpret_cast<HWND>(pWindow);
}
// Offset so null HMONITORs go to -1
inline int32_t fromHmonitor(HMONITOR hMonitor) {
return static_cast<int32_t>(reinterpret_cast<intptr_t>(hMonitor)) - 1;
}
// Offset so -1 display id goes to 0 == NULL
inline HMONITOR toHmonitor(int32_t displayId) {
return reinterpret_cast<HMONITOR>(static_cast<intptr_t>(displayId + 1));
}
}

View File

@ -0,0 +1,9 @@
#pragma once
#ifdef DXVK_WSI_WIN32
#error You shouldnt be using this code path.
#elif DXVK_WSI_SDL2
#include "wsi/native_sdl2.h"
#else
#error Unknown wsi!
#endif