summaryrefslogtreecommitdiffstats
path: root/src/libs/dxvk-native-1.9.2a/include/native/wsi
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 16:49:04 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 16:49:04 +0000
commit16f504a9dca3fe3b70568f67b7d41241ae485288 (patch)
treec60f36ada0496ba928b7161059ba5ab1ab224f9d /src/libs/dxvk-native-1.9.2a/include/native/wsi
parentInitial commit. (diff)
downloadvirtualbox-16f504a9dca3fe3b70568f67b7d41241ae485288.tar.xz
virtualbox-16f504a9dca3fe3b70568f67b7d41241ae485288.zip
Adding upstream version 7.0.6-dfsg.upstream/7.0.6-dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/libs/dxvk-native-1.9.2a/include/native/wsi')
-rw-r--r--src/libs/dxvk-native-1.9.2a/include/native/wsi/native_headless.h24
-rw-r--r--src/libs/dxvk-native-1.9.2a/include/native/wsi/native_sdl2.h26
-rw-r--r--src/libs/dxvk-native-1.9.2a/include/native/wsi/native_wsi.h11
3 files changed, 61 insertions, 0 deletions
diff --git a/src/libs/dxvk-native-1.9.2a/include/native/wsi/native_headless.h b/src/libs/dxvk-native-1.9.2a/include/native/wsi/native_headless.h
new file mode 100644
index 00000000..7dab4cce
--- /dev/null
+++ b/src/libs/dxvk-native-1.9.2a/include/native/wsi/native_headless.h
@@ -0,0 +1,24 @@
+#include <cstdint>
+#include <windows.h>
+
+namespace dxvk::wsi {
+
+ inline void* fromHwnd(HWND hWindow) {
+ return reinterpret_cast<void *>(hWindow);
+ }
+
+ inline HWND toHwnd(void* 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/src/libs/dxvk-native-1.9.2a/include/native/wsi/native_sdl2.h b/src/libs/dxvk-native-1.9.2a/include/native/wsi/native_sdl2.h
new file mode 100644
index 00000000..9281c403
--- /dev/null
+++ b/src/libs/dxvk-native-1.9.2a/include/native/wsi/native_sdl2.h
@@ -0,0 +1,26 @@
+#include <cstdint>
+#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/src/libs/dxvk-native-1.9.2a/include/native/wsi/native_wsi.h b/src/libs/dxvk-native-1.9.2a/include/native/wsi/native_wsi.h
new file mode 100644
index 00000000..42a07a2e
--- /dev/null
+++ b/src/libs/dxvk-native-1.9.2a/include/native/wsi/native_wsi.h
@@ -0,0 +1,11 @@
+#pragma once
+
+#ifdef DXVK_WSI_WIN32
+#error You shouldnt be using this code path.
+#elif DXVK_WSI_SDL2
+#include "wsi/native_sdl2.h"
+#elif DXVK_WSI_HEADLESS /*VBOX - begin*/
+#include "wsi/native_headless.h"
+#else
+#error Unknown wsi!
+#endif \ No newline at end of file