mirror of
https://github.com/holub/mame
synced 2025-06-01 18:41:47 +03:00
Add bgfx_backend and bgfx_debug options, fix compile error on mac, nw
This commit is contained in:
parent
e37b96b68d
commit
03b2de3556
@ -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" },
|
||||
|
@ -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); }
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user