From d193abb0ad0827d5ecc0915d65b67faf68a87097 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 3 Sep 2016 13:30:42 +0200 Subject: Update BGFX and BX packages and update MAME code to support new API (nw) Generated missing shaders (nw) --- 3rdparty/bgfx/examples/common/entry/entry_sdl.cpp | 39 ++++++++++++++++++++--- 1 file changed, 35 insertions(+), 4 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 0e4f49424e2..1ff49264d93 100644 --- a/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp +++ b/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp @@ -15,10 +15,10 @@ #include -BX_PRAGMA_DIAGNOSTIC_PUSH_CLANG() +BX_PRAGMA_DIAGNOSTIC_PUSH() BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG("-Wextern-c-compat") #include -BX_PRAGMA_DIAGNOSTIC_POP_CLANG() +BX_PRAGMA_DIAGNOSTIC_POP() #include #if defined(None) // X11 defines this... @@ -35,6 +35,37 @@ BX_PRAGMA_DIAGNOSTIC_POP_CLANG() namespace entry { + 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 + pd.ndt = wmi.info.x11.display; + pd.nwh = (void*)(uintptr_t)wmi.info.x11.window; +# elif BX_PLATFORM_OSX + pd.ndt = NULL; + pd.nwh = wmi.info.cocoa.window; +# elif BX_PLATFORM_WINDOWS + pd.ndt = NULL; + pd.nwh = wmi.info.win.window; +# elif BX_PLATFORM_STEAMLINK + pd.ndt = wmi.info.vivante.display; + pd.nwh = wmi.info.vivante.window; +# endif // BX_PLATFORM_ + pd.context = NULL; + pd.backBuffer = NULL; + pd.backBufferDS = NULL; + bgfx::setPlatformData(pd); + + return true; + } + static uint8_t translateKeyModifiers(uint16_t _sdl) { uint8_t modifiers = 0; @@ -446,7 +477,7 @@ namespace entry s_userEventStart = SDL_RegisterEvents(7); - bgfx::sdlSetWindow(m_window[0]); + sdlSetWindow(m_window[0]); bgfx::renderFrame(); m_thread.init(MainThreadEntry::threadFunc, &m_mte); @@ -789,8 +820,8 @@ namespace entry void* nwh = sdlNativeWindowHandle(m_window[handle.idx]); if (NULL != nwh) { - m_eventQueue.postWindowEvent(handle, nwh); m_eventQueue.postSizeEvent(handle, msg->m_width, msg->m_height); + m_eventQueue.postWindowEvent(handle, nwh); } delete msg; -- cgit v1.2.3-70-g09d2