From 812e6094f47bb8d1da5a6b421aa4c724cf2035c0 Mon Sep 17 00:00:00 2001 From: Miodrag Milanović Date: Thu, 5 Jan 2023 15:32:40 +0100 Subject: Update BGFX, BX and BIMG (#10789) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update to bgfx a93a714632b79b5ddbf5c86ac323fa9b76ed3433 Co-authored-by: Бранимир Караџић --- 3rdparty/bgfx/examples/common/entry/entry_sdl.cpp | 61 +++++++++++------------ 1 file changed, 28 insertions(+), 33 deletions(-) (limited to '3rdparty/bgfx/examples/common/entry/entry_sdl.cpp') diff --git a/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp b/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp index 360d1df0add..8744b98e763 100644 --- a/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp +++ b/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp @@ -1,6 +1,6 @@ /* - * Copyright 2011-2021 Branimir Karadzic. All rights reserved. - * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ #include "entry_p.h" @@ -74,35 +74,6 @@ namespace entry # endif // BX_PLATFORM_ } - inline bool sdlSetWindow(SDL_Window* _window) - { - SDL_SysWMinfo wmi; - SDL_VERSION(&wmi.version); - if (!SDL_GetWindowWMInfo(_window, &wmi) ) - { - return false; - } - - bgfx::PlatformData pd; -# if BX_PLATFORM_LINUX || BX_PLATFORM_BSD -# if ENTRY_CONFIG_USE_WAYLAND - pd.ndt = wmi.info.wl.display; -# else - pd.ndt = wmi.info.x11.display; -# endif -# else - pd.ndt = NULL; -# endif // BX_PLATFORM_ - pd.nwh = sdlNativeWindowHandle(_window); - - pd.context = NULL; - pd.backBuffer = NULL; - pd.backBufferDS = NULL; - bgfx::setPlatformData(pd); - - return true; - } - static void sdlDestroyWindow(SDL_Window* _window) { if(!_window) @@ -513,7 +484,6 @@ namespace entry s_userEventStart = SDL_RegisterEvents(7); - sdlSetWindow(m_window[0]); bgfx::renderFrame(); m_thread.init(MainThreadEntry::threadFunc, &m_mte); @@ -536,7 +506,7 @@ namespace entry bx::AllocatorI* allocator = getAllocator(); uint32_t size = (uint32_t)bx::getSize(reader); void* data = BX_ALLOC(allocator, size + 1); - bx::read(reader, data, size); + bx::read(reader, data, size, bx::ErrorAssert{}); bx::close(reader); ((char*)data)[size] = '\0'; @@ -1162,6 +1132,31 @@ namespace entry sdlPostEvent(SDL_USER_WINDOW_MOUSE_LOCK, _handle, NULL, _lock); } + void* getNativeWindowHandle(WindowHandle _handle) + { + return sdlNativeWindowHandle(s_ctx.m_window[_handle.idx]); + } + + void* getNativeDisplayHandle() + { + SDL_SysWMinfo wmi; + SDL_VERSION(&wmi.version); + if (!SDL_GetWindowWMInfo(s_ctx.m_window[0], &wmi) ) + { + 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; +# endif // ENTRY_CONFIG_USE_WAYLAND +# else + return NULL; +# endif // BX_PLATFORM_* + } + int32_t MainThreadEntry::threadFunc(bx::Thread* _thread, void* _userData) { BX_UNUSED(_thread); -- cgit v1.2.3-70-g09d2