From 91a5123ad0b254a863885fbee35b85151462d3ee Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Sat, 20 Aug 2022 23:11:36 +0000 Subject: [PATCH] [native] Add SDL2 native headers Not included by DXVK at all, but used by external applications. --- include/native/wsi/native_sdl2.h | 25 +++++++++++++++++++++++++ include/native/wsi/native_wsi.h | 9 +++++++++ 2 files changed, 34 insertions(+) create mode 100644 include/native/wsi/native_sdl2.h create mode 100644 include/native/wsi/native_wsi.h diff --git a/include/native/wsi/native_sdl2.h b/include/native/wsi/native_sdl2.h new file mode 100644 index 000000000..b197d9527 --- /dev/null +++ b/include/native/wsi/native_sdl2.h @@ -0,0 +1,25 @@ +#include + +#include + +namespace dxvk::wsi { + + inline SDL_Window* fromHwnd(HWND hWindow) { + return reinterpret_cast(hWindow); + } + + inline HWND toHwnd(SDL_Window* pWindow) { + return reinterpret_cast(pWindow); + } + + // Offset so null HMONITORs go to -1 + inline int32_t fromHmonitor(HMONITOR hMonitor) { + return static_cast(reinterpret_cast(hMonitor)) - 1; + } + + // Offset so -1 display id goes to 0 == NULL + inline HMONITOR toHmonitor(int32_t displayId) { + return reinterpret_cast(static_cast(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 000000000..00a299060 --- /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