diff options
Diffstat (limited to 'src/osd/modules')
-rw-r--r-- | src/osd/modules/render/bgfx/target.cpp | 2 | ||||
-rw-r--r-- | src/osd/modules/render/bgfx/texture.cpp | 12 | ||||
-rw-r--r-- | src/osd/modules/render/drawbgfx.cpp | 54 |
3 files changed, 56 insertions, 12 deletions
diff --git a/src/osd/modules/render/bgfx/target.cpp b/src/osd/modules/render/bgfx/target.cpp index e6ec9061389..74b284dfb1d 100644 --- a/src/osd/modules/render/bgfx/target.cpp +++ b/src/osd/modules/render/bgfx/target.cpp @@ -37,7 +37,7 @@ bgfx_target::bgfx_target(std::string name, bgfx::TextureFormat::Enum format, uin m_targets = new bgfx::FrameBufferHandle[m_page_count]; for (int page = 0; page < m_page_count; page++) { - m_textures[page] = bgfx::createTexture2D(m_width, m_height, 1, format, wrap_mode | filter_mode | BGFX_TEXTURE_RT); + m_textures[page] = bgfx::createTexture2D(m_width, m_height, false, 1, format, wrap_mode | filter_mode | BGFX_TEXTURE_RT); assert(m_textures[page].idx != 0xffff); m_targets[page] = bgfx::createFrameBuffer(1, &m_textures[page], false); assert(m_targets[page].idx != 0xffff); diff --git a/src/osd/modules/render/bgfx/texture.cpp b/src/osd/modules/render/bgfx/texture.cpp index c698f7a9ac5..ac2d9008568 100644 --- a/src/osd/modules/render/bgfx/texture.cpp +++ b/src/osd/modules/render/bgfx/texture.cpp @@ -17,18 +17,18 @@ bgfx_texture::bgfx_texture(std::string name, bgfx::TextureFormat::Enum format, u , m_height(height) { bgfx::TextureInfo info; - bgfx::calcTextureSize(info, width, height, 1, false, 1, format); + bgfx::calcTextureSize(info, width, height, 1, false, false, 1, format); if (data != nullptr) { - m_texture = bgfx::createTexture2D(width, height, 1, format, flags, bgfx::copy(data, info.storageSize)); + m_texture = bgfx::createTexture2D(width, height, false, 1, format, flags, bgfx::copy(data, info.storageSize)); } else { - m_texture = bgfx::createTexture2D(width, height, 1, format, flags); + m_texture = bgfx::createTexture2D(width, height, false, 1, format, flags); const bgfx::Memory* memory = bgfx::alloc(info.storageSize); memset(memory->data, 0, info.storageSize); - bgfx::updateTexture2D(m_texture, 0, 0, 0, width, height, memory, info.storageSize / height); + bgfx::updateTexture2D(m_texture, 0, 0, 0, 0, width, height, memory, info.storageSize / height); } } @@ -39,8 +39,8 @@ bgfx_texture::bgfx_texture(std::string name, bgfx::TextureFormat::Enum format, u , m_height(height) { bgfx::TextureInfo info; - bgfx::calcTextureSize(info, width, height, 1, false, 1, format); - m_texture = bgfx::createTexture2D(width, height, 1, format, flags, data); + bgfx::calcTextureSize(info, width, height, 1, false, false, 1, format); + m_texture = bgfx::createTexture2D(width, height, false, 1, format, flags, data); } bgfx_texture::~bgfx_texture() diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index 29721c65b77..8c623cf6a67 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -146,6 +146,50 @@ static void* sdlNativeWindowHandle(SDL_Window* _window) } #endif +inline void winSetHwnd(::HWND _window) +{ + bgfx::PlatformData pd; + pd.ndt = NULL; + pd.nwh = _window; + pd.context = NULL; + pd.backBuffer = NULL; + pd.backBufferDS = NULL; + bgfx::setPlatformData(pd); +} + +#ifdef OSD_SDL +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; +} +#endif + int renderer_bgfx::create() { // create renderer @@ -168,9 +212,9 @@ int renderer_bgfx::create() bgfx::setPlatformData(blank_pd); } #ifdef OSD_WINDOWS - bgfx::winSetHwnd(win->platform_window<HWND>()); + winSetHwnd(win->platform_window<HWND>()); #else - bgfx::sdlSetWindow(win->platform_window<SDL_Window*>()); + sdlSetWindow(win->platform_window<SDL_Window*>()); #endif std::string backend(m_options.bgfx_backend()); if (backend == "auto") @@ -285,7 +329,7 @@ void renderer_bgfx::record() { m_avi_writer->record(m_options.bgfx_avi_name()); m_avi_target = m_targets->create_target("avibuffer", bgfx::TextureFormat::RGBA8, m_width[0], m_height[0], TARGET_STYLE_CUSTOM, false, true, 1, 0); - m_avi_texture = bgfx::createTexture2D(m_width[0], m_height[0], 1, bgfx::TextureFormat::RGBA8, BGFX_TEXTURE_BLIT_DST | BGFX_TEXTURE_READ_BACK); + m_avi_texture = bgfx::createTexture2D(m_width[0], m_height[0], false, 1, bgfx::TextureFormat::RGBA8, BGFX_TEXTURE_BLIT_DST | BGFX_TEXTURE_READ_BACK); } } @@ -477,7 +521,7 @@ void renderer_bgfx::render_textured_quad(render_primitive* prim, bgfx::Transient const bgfx::Memory* mem = bgfx_util::mame_texture_data_to_bgfx_texture_data(prim->flags & PRIMFLAG_TEXFORMAT_MASK, tex_width, tex_height, prim->texture.rowpixels, prim->texture.palette, prim->texture.base); - bgfx::TextureHandle texture = bgfx::createTexture2D(tex_width, tex_height, 1, bgfx::TextureFormat::RGBA8, texture_flags, mem); + bgfx::TextureHandle texture = bgfx::createTexture2D(tex_width, tex_height, false, 1, bgfx::TextureFormat::RGBA8, texture_flags, mem); bgfx_effect** effects = PRIMFLAG_GET_SCREENTEX(prim->flags) ? m_screen_effect : m_gui_effect; @@ -1084,7 +1128,7 @@ void renderer_bgfx::process_atlas_packs(std::vector<std::vector<rectangle_packer } m_hash_to_entry[rect.hash()] = rect; const bgfx::Memory* mem = bgfx_util::mame_texture_data_to_bgfx_texture_data(rect.format(), rect.width(), rect.height(), rect.rowpixels(), rect.palette(), rect.base()); - bgfx::updateTexture2D(m_texture_cache->texture(), 0, rect.x(), rect.y(), rect.width(), rect.height(), mem); + bgfx::updateTexture2D(m_texture_cache->texture(), 0, 0, rect.x(), rect.y(), rect.width(), rect.height(), mem); } } } |