summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/examples/common/entry
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/bgfx/examples/common/entry')
-rw-r--r--3rdparty/bgfx/examples/common/entry/entry.cpp5
-rw-r--r--3rdparty/bgfx/examples/common/entry/entry.h4
-rw-r--r--3rdparty/bgfx/examples/common/entry/entry_android.cpp6
-rw-r--r--3rdparty/bgfx/examples/common/entry/entry_glfw.cpp13
-rw-r--r--3rdparty/bgfx/examples/common/entry/entry_html5.cpp6
-rw-r--r--3rdparty/bgfx/examples/common/entry/entry_ios.mm6
-rw-r--r--3rdparty/bgfx/examples/common/entry/entry_noop.cpp6
-rw-r--r--3rdparty/bgfx/examples/common/entry/entry_osx.mm6
-rw-r--r--3rdparty/bgfx/examples/common/entry/entry_sdl.cpp61
-rw-r--r--3rdparty/bgfx/examples/common/entry/entry_windows.cpp6
-rw-r--r--3rdparty/bgfx/examples/common/entry/entry_x11.cpp6
11 files changed, 106 insertions, 19 deletions
diff --git a/3rdparty/bgfx/examples/common/entry/entry.cpp b/3rdparty/bgfx/examples/common/entry/entry.cpp
index 58a671e6a70..07621f3cd25 100644
--- a/3rdparty/bgfx/examples/common/entry/entry.cpp
+++ b/3rdparty/bgfx/examples/common/entry/entry.cpp
@@ -1037,3 +1037,8 @@ extern "C" void* entry_get_native_display_handle()
{
return entry::getNativeDisplayHandle();
}
+
+extern "C" bgfx::NativeWindowHandleType::Enum entry_get_native_window_handle_type()
+{
+ return entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
+}
diff --git a/3rdparty/bgfx/examples/common/entry/entry.h b/3rdparty/bgfx/examples/common/entry/entry.h
index 2dc7acc7b56..443066e304f 100644
--- a/3rdparty/bgfx/examples/common/entry/entry.h
+++ b/3rdparty/bgfx/examples/common/entry/entry.h
@@ -7,6 +7,7 @@
#define ENTRY_H_HEADER_GUARD
#include "dbg.h"
+#include <bgfx/bgfx.h>
#include <bx/bx.h>
#include <bx/filepath.h>
#include <bx/string.h>
@@ -298,6 +299,9 @@ namespace entry
void* getNativeDisplayHandle();
///
+ bgfx::NativeWindowHandleType::Enum getNativeWindowHandleType(WindowHandle _handle);
+
+ ///
void setCurrentDir(const char* _dir);
///
diff --git a/3rdparty/bgfx/examples/common/entry/entry_android.cpp b/3rdparty/bgfx/examples/common/entry/entry_android.cpp
index 3a6ac8561d3..a99735b6df5 100644
--- a/3rdparty/bgfx/examples/common/entry/entry_android.cpp
+++ b/3rdparty/bgfx/examples/common/entry/entry_android.cpp
@@ -550,6 +550,12 @@ namespace entry
return NULL;
}
+ bgfx::NativeWindowHandleType::Enum getNativeWindowHandleType(WindowHandle _handle)
+ {
+ BX_UNUSED(_handle);
+ return bgfx::NativeWindowHandleType::Default;
+ }
+
int32_t MainThreadEntry::threadFunc(bx::Thread* _thread, void* _userData)
{
BX_UNUSED(_thread);
diff --git a/3rdparty/bgfx/examples/common/entry/entry_glfw.cpp b/3rdparty/bgfx/examples/common/entry/entry_glfw.cpp
index da15502409c..d27745d1390 100644
--- a/3rdparty/bgfx/examples/common/entry/entry_glfw.cpp
+++ b/3rdparty/bgfx/examples/common/entry/entry_glfw.cpp
@@ -875,6 +875,19 @@ namespace entry
# endif // BX_PLATFORM_*
}
+ bgfx::NativeWindowHandleType::Enum getNativeWindowHandleType(WindowHandle _handle)
+ {
+# if BX_PLATFORM_LINUX || BX_PLATFORM_BSD
+# if ENTRY_CONFIG_USE_WAYLAND
+ return bgfx::NativeWindowHandleType::Wayland;
+# else
+ return bgfx::NativeWindowHandleType::Default;
+# endif // ENTRY_CONFIG_USE_WAYLAND
+# else
+ return bgfx::NativeWindowHandleType::Default;
+# endif // BX_PLATFORM_*
+ }
+
int32_t MainThreadEntry::threadFunc(bx::Thread* _thread, void* _userData)
{
BX_UNUSED(_thread);
diff --git a/3rdparty/bgfx/examples/common/entry/entry_html5.cpp b/3rdparty/bgfx/examples/common/entry/entry_html5.cpp
index 884a563b783..d33879229f9 100644
--- a/3rdparty/bgfx/examples/common/entry/entry_html5.cpp
+++ b/3rdparty/bgfx/examples/common/entry/entry_html5.cpp
@@ -427,6 +427,12 @@ namespace entry
{
return NULL;
}
+
+ bgfx::NativeWindowHandleType::Enum getNativeWindowHandleType(WindowHandle _handle)
+ {
+ BX_UNUSED(_handle);
+ return bgfx::NativeWindowHandleType::Default;
+ }
}
int main(int _argc, const char* const* _argv)
diff --git a/3rdparty/bgfx/examples/common/entry/entry_ios.mm b/3rdparty/bgfx/examples/common/entry/entry_ios.mm
index f123b6684ea..8592a33c43e 100644
--- a/3rdparty/bgfx/examples/common/entry/entry_ios.mm
+++ b/3rdparty/bgfx/examples/common/entry/entry_ios.mm
@@ -161,6 +161,12 @@ namespace entry
return NULL;
}
+ bgfx::NativeWindowHandleType::Enum getNativeWindowHandleType(WindowHandle _handle)
+ {
+ BX_UNUSED(_handle);
+ return bgfx::NativeWindowHandleType::Default;
+ }
+
} // namespace entry
using namespace entry;
diff --git a/3rdparty/bgfx/examples/common/entry/entry_noop.cpp b/3rdparty/bgfx/examples/common/entry/entry_noop.cpp
index 22d160f592c..5e4bb0fafa4 100644
--- a/3rdparty/bgfx/examples/common/entry/entry_noop.cpp
+++ b/3rdparty/bgfx/examples/common/entry/entry_noop.cpp
@@ -78,6 +78,12 @@ namespace entry
return NULL;
}
+ bgfx::NativeWindowHandleType::Enum getNativeWindowHandleType(WindowHandle _handle)
+ {
+ BX_UNUSED(_handle);
+ return bgfx::NativeWindowHandleType::Default;
+ }
+
} // namespace entry
int main(int _argc, const char* const* _argv)
diff --git a/3rdparty/bgfx/examples/common/entry/entry_osx.mm b/3rdparty/bgfx/examples/common/entry/entry_osx.mm
index 948483ca93e..98869d7df04 100644
--- a/3rdparty/bgfx/examples/common/entry/entry_osx.mm
+++ b/3rdparty/bgfx/examples/common/entry/entry_osx.mm
@@ -725,6 +725,12 @@ namespace entry
return NULL;
}
+ bgfx::NativeWindowHandleType::Enum getNativeWindowHandleType(WindowHandle _handle)
+ {
+ BX_UNUSED(_handle);
+ return bgfx::NativeWindowHandleType::Default;
+ }
+
} // namespace entry
@implementation AppDelegate
diff --git a/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp b/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp
index 8744b98e763..5a862c0ca05 100644
--- a/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp
+++ b/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp
@@ -50,21 +50,24 @@ namespace entry
# if BX_PLATFORM_LINUX || BX_PLATFORM_BSD
# if ENTRY_CONFIG_USE_WAYLAND
- wl_egl_window *win_impl = (wl_egl_window*)SDL_GetWindowData(_window, "wl_egl_window");
- if(!win_impl)
- {
- int width, height;
- SDL_GetWindowSize(_window, &width, &height);
- struct wl_surface* surface = wmi.info.wl.surface;
- if(!surface)
- return nullptr;
- win_impl = wl_egl_window_create(surface, width, height);
- SDL_SetWindowData(_window, "wl_egl_window", win_impl);
- }
- return (void*)(uintptr_t)win_impl;
-# else
- return (void*)wmi.info.x11.window;
-# endif
+ if (wmi.subsystem == SDL_SYSWM_WAYLAND)
+ {
+ wl_egl_window *win_impl = (wl_egl_window*)SDL_GetWindowData(_window, "wl_egl_window");
+ if(!win_impl)
+ {
+ int width, height;
+ SDL_GetWindowSize(_window, &width, &height);
+ struct wl_surface* surface = wmi.info.wl.surface;
+ if(!surface)
+ return nullptr;
+ win_impl = wl_egl_window_create(surface, width, height);
+ SDL_SetWindowData(_window, "wl_egl_window", win_impl);
+ }
+ return (void*)(uintptr_t)win_impl;
+ }
+ else
+# endif // ENTRY_CONFIG_USE_WAYLAND
+ return (void*)wmi.info.x11.window;
# elif BX_PLATFORM_OSX || BX_PLATFORM_IOS
return wmi.info.cocoa.window;
# elif BX_PLATFORM_WINDOWS
@@ -1145,18 +1148,38 @@ namespace entry
{
return NULL;
}
-
# if BX_PLATFORM_LINUX || BX_PLATFORM_BSD
# if ENTRY_CONFIG_USE_WAYLAND
- return wmi.info.wl.display;
-# else
- return wmi.info.x11.display;
+ if (wmi.subsystem == SDL_SYSWM_WAYLAND)
+ return wmi.info.wl.display;
+ else
# endif // ENTRY_CONFIG_USE_WAYLAND
+ return wmi.info.x11.display;
# else
return NULL;
# endif // BX_PLATFORM_*
}
+ bgfx::NativeWindowHandleType::Enum getNativeWindowHandleType(WindowHandle _handle)
+ {
+ SDL_SysWMinfo wmi;
+ SDL_VERSION(&wmi.version);
+ if (!SDL_GetWindowWMInfo(s_ctx.m_window[_handle.idx], &wmi) )
+ {
+ return bgfx::NativeWindowHandleType::Default;
+ }
+# if BX_PLATFORM_LINUX || BX_PLATFORM_BSD
+# if ENTRY_CONFIG_USE_WAYLAND
+ if (wmi.subsystem == SDL_SYSWM_WAYLAND)
+ return bgfx::NativeWindowHandleType::Wayland;
+ else
+# endif // ENTRY_CONFIG_USE_WAYLAND
+ return bgfx::NativeWindowHandleType::Default;
+# else
+ return bgfx::NativeWindowHandleType::Default;
+# endif // BX_PLATFORM_*
+ }
+
int32_t MainThreadEntry::threadFunc(bx::Thread* _thread, void* _userData)
{
BX_UNUSED(_thread);
diff --git a/3rdparty/bgfx/examples/common/entry/entry_windows.cpp b/3rdparty/bgfx/examples/common/entry/entry_windows.cpp
index 5d60573d08e..754039a6db7 100644
--- a/3rdparty/bgfx/examples/common/entry/entry_windows.cpp
+++ b/3rdparty/bgfx/examples/common/entry/entry_windows.cpp
@@ -1169,6 +1169,12 @@ namespace entry
return NULL;
}
+ bgfx::NativeWindowHandleType::Enum getNativeWindowHandleType(WindowHandle _handle)
+ {
+ BX_UNUSED(_handle);
+ return bgfx::NativeWindowHandleType::Default;
+ }
+
int32_t MainThreadEntry::threadFunc(bx::Thread* /*_thread*/, void* _userData)
{
MainThreadEntry* self = (MainThreadEntry*)_userData;
diff --git a/3rdparty/bgfx/examples/common/entry/entry_x11.cpp b/3rdparty/bgfx/examples/common/entry/entry_x11.cpp
index a5f4b3fa6da..407a1d9e5dc 100644
--- a/3rdparty/bgfx/examples/common/entry/entry_x11.cpp
+++ b/3rdparty/bgfx/examples/common/entry/entry_x11.cpp
@@ -771,6 +771,12 @@ namespace entry
return s_ctx.m_display;
}
+ bgfx::NativeWindowHandleType::Enum getNativeWindowHandleType(WindowHandle _handle)
+ {
+ BX_UNUSED(_handle);
+ return bgfx::NativeWindowHandleType::Default;
+ }
+
} // namespace entry
int main(int _argc, const char* const* _argv)