diff options
-rw-r--r-- | src/osd/modules/lib/osdobj_common.cpp | 2 | ||||
-rw-r--r-- | src/osd/modules/lib/osdobj_common.h | 4 | ||||
-rw-r--r-- | src/osd/modules/render/drawbgfx.cpp | 36 | ||||
-rw-r--r-- | src/osd/sdl/window.cpp | 2 |
4 files changed, 39 insertions, 5 deletions
diff --git a/src/osd/modules/lib/osdobj_common.cpp b/src/osd/modules/lib/osdobj_common.cpp index 57007ee7600..9e8b4b208a1 100644 --- a/src/osd/modules/lib/osdobj_common.cpp +++ b/src/osd/modules/lib/osdobj_common.cpp @@ -142,6 +142,8 @@ const options_entry osd_options::s_option_entries[] = { nullptr, nullptr, OPTION_HEADER, "BGFX POST-PROCESSING OPTIONS" }, { OSDOPTION_BGFX_PATH, "bgfx", OPTION_STRING, "path to BGFX-related files" }, + { OSDOPTION_BGFX_BACKEND, "auto", OPTION_STRING, "BGFX backend to use (d3d9, d3d11, metal, opengl, gles)" }, + { OSDOPTION_BGFX_DEBUG, "0", OPTION_BOOLEAN, "enable BGFX debugging statistics" }, { OSDOPTION_BGFX_SCREEN_CHAIN, "hlsl", OPTION_STRING, "screen chain JSON file to use" }, { OSDOPTION_BGFX_SHADOW_MASK, "shadow-mask.png", OPTION_STRING, "shadow mask texture name" }, { OSDOPTION_BGFX_PRESCALE_X, "1", OPTION_INTEGER, "x prescale" }, diff --git a/src/osd/modules/lib/osdobj_common.h b/src/osd/modules/lib/osdobj_common.h index d53ad78b8bd..7bf895a07b3 100644 --- a/src/osd/modules/lib/osdobj_common.h +++ b/src/osd/modules/lib/osdobj_common.h @@ -78,6 +78,8 @@ #define OSDOPTVAL_NONE "none" #define OSDOPTION_BGFX_PATH "bgfx_path" +#define OSDOPTION_BGFX_BACKEND "bgfx_backend" +#define OSDOPTION_BGFX_DEBUG "bgfx_debug" #define OSDOPTION_BGFX_SCREEN_CHAIN "bgfx_screen_chain" #define OSDOPTION_BGFX_SHADOW_MASK "bgfx_shadow_mask" #define OSDOPTION_BGFX_PRESCALE_X "bgfx_prescale_x" @@ -153,6 +155,8 @@ public: // BGFX specific options const char *bgfx_path() const { return value(OSDOPTION_BGFX_PATH); } + const char *bgfx_backend() const { return value(OSDOPTION_BGFX_BACKEND); } + const bool bgfx_debug() const { return bool_value(OSDOPTION_BGFX_DEBUG); } const char *bgfx_screen_chain() const { return value(OSDOPTION_BGFX_SCREEN_CHAIN); } const char *bgfx_shadow_mask() const { return value(OSDOPTION_BGFX_SHADOW_MASK); } const uint32_t bgfx_prescale_x() const { return int_value(OSDOPTION_BGFX_PRESCALE_X); } diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index f4a377a29c3..f5fbf9f3876 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -108,6 +108,7 @@ int renderer_bgfx::create() { // create renderer + osd_options& options = downcast<osd_options &>(window().machine().options()); osd_dim wdim = window().get_size(); m_width[window().m_index] = wdim.width(); m_height[window().m_index] = wdim.height(); @@ -130,14 +131,43 @@ int renderer_bgfx::create() #else bgfx::sdlSetWindow(window().sdl_window()); #endif - bgfx::init(); + std::string backend(options.bgfx_backend()); + printf("1\n"); fflush(stdout); + if (backend == "auto") + { + bgfx::init(); + } + else if (backend == "dx9" || backend == "d3d9") + { + bgfx::init(bgfx::RendererType::Direct3D9); + } + else if (backend == "dx11" || backend == "d3d11") + { + bgfx::init(bgfx::RendererType::Direct3D11); + } + else if (backend == "gles") + { + bgfx::init(bgfx::RendererType::OpenGLES); + } + else if (backend == "glsl" || backend == "opengl") + { + bgfx::init(bgfx::RendererType::OpenGL); + } + else if (backend == "metal") + { + bgfx::init(bgfx::RendererType::Metal); + } + else + { + osd_printf_verbose("Unknown backend type '%s'\n", backend.c_str()); + assert(false); + } bgfx::reset(m_width[window().m_index], m_height[window().m_index], video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE); // Enable debug text. - bgfx::setDebug(window().machine().options().verbose() ? BGFX_DEBUG_STATS : BGFX_DEBUG_TEXT); + bgfx::setDebug(options.bgfx_debug() ? BGFX_DEBUG_STATS : BGFX_DEBUG_TEXT); m_dimensions = osd_dim(m_width[0], m_height[0]); } - osd_options& options = downcast<osd_options &>(window().machine().options()); m_textures = new texture_manager(); m_targets = new target_manager(*m_textures); diff --git a/src/osd/sdl/window.cpp b/src/osd/sdl/window.cpp index cc5b6972f6c..617dca4c971 100644 --- a/src/osd/sdl/window.cpp +++ b/src/osd/sdl/window.cpp @@ -90,8 +90,6 @@ sdl_window_info *sdl_window_list; static sdl_window_info **last_window_ptr; // event handling -static osd_work_queue *work_queue; - static SDL_threadID main_threadid; static SDL_threadID window_threadid; |