diff options
author | Joshua Ashton <joshua@froggi.es> | 2022-08-21 02:11:36 +0300 |
---|---|---|
committer | Joshie <joshua@froggi.es> | 2022-08-21 21:31:33 +0300 |
commit | 91a5123ad0b254a863885fbee35b85151462d3ee (patch) | |
tree | 283a294893c68d28db67dcb07eb6b9ee007df2dc /include | |
parent | e969f49cee2ee4ccf815c5ef8225947f6324b28c (diff) |
[native] Add SDL2 native headers
Not included by DXVK at all, but used by external applications.
Diffstat (limited to 'include')
-rw-r--r-- | include/native/wsi/native_sdl2.h | 25 | ||||
-rw-r--r-- | include/native/wsi/native_wsi.h | 9 |
2 files changed, 34 insertions, 0 deletions
diff --git a/include/native/wsi/native_sdl2.h b/include/native/wsi/native_sdl2.h new file mode 100644 index 00000000..b197d952 --- /dev/null +++ b/include/native/wsi/native_sdl2.h @@ -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)); + } + +}
\ No newline at end of file diff --git a/include/native/wsi/native_wsi.h b/include/native/wsi/native_wsi.h new file mode 100644 index 00000000..00a29906 --- /dev/null +++ b/include/native/wsi/native_wsi.h @@ -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
\ No newline at end of file |