summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/osd/modules')
-rw-r--r--src/osd/modules/lib/osdobj_common.cpp2
-rw-r--r--src/osd/modules/render/bgfx/chainentry.cpp65
-rw-r--r--src/osd/modules/render/drawbgfx.cpp103
3 files changed, 104 insertions, 66 deletions
diff --git a/src/osd/modules/lib/osdobj_common.cpp b/src/osd/modules/lib/osdobj_common.cpp
index 9e8b4b208a1..df6cdeedffc 100644
--- a/src/osd/modules/lib/osdobj_common.cpp
+++ b/src/osd/modules/lib/osdobj_common.cpp
@@ -144,7 +144,7 @@ const options_entry osd_options::s_option_entries[] =
{ 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_SCREEN_CHAIN, "default", 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" },
{ OSDOPTION_BGFX_PRESCALE_Y, "1", OPTION_INTEGER, "y prescale" },
diff --git a/src/osd/modules/render/bgfx/chainentry.cpp b/src/osd/modules/render/bgfx/chainentry.cpp
index 6ca690c812d..7fde23992e8 100644
--- a/src/osd/modules/render/bgfx/chainentry.cpp
+++ b/src/osd/modules/render/bgfx/chainentry.cpp
@@ -163,12 +163,9 @@ bool bgfx_chain_entry::setup_view(int view, uint16_t screen_width, uint16_t scre
bgfx::setViewFrameBuffer(view, handle);
bgfx::setViewRect(view, 0, 0, width, height);
- float viewMat[16];
- bx::mtxIdentity(viewMat);
-
float projMat[16];
bx::mtxOrtho(projMat, 0.0f, screen_width, screen_height, 0.0f, 0.0f, 100.0f);
- bgfx::setViewTransform(view, viewMat, projMat);
+ bgfx::setViewTransform(view, nullptr, projMat);
bgfx::setViewClear(view, BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH, 0x000000ff, 1.0f, 0);
return true;
@@ -187,47 +184,59 @@ void bgfx_chain_entry::put_screen_buffer(render_primitive* prim, bgfx::Transient
ScreenVertex* vertex = reinterpret_cast<ScreenVertex*>(buffer->data);
- vertex[0].m_x = prim->bounds.x0;
- vertex[0].m_y = prim->bounds.y0;
+ float x[4] = { prim->bounds.x0, prim->bounds.x1, prim->bounds.x0, prim->bounds.x1 };
+ float y[4] = { prim->bounds.y0, prim->bounds.y0, prim->bounds.y1, prim->bounds.y1 };
+ float u[4] = { 0, 1, 0, 1 };
+ float v[4] = { 0, 0, 1, 1 };
+
+ bgfx::RendererType::Enum renderer_type = bgfx::getRendererType();
+ if (renderer_type == bgfx::RendererType::OpenGL || renderer_type == bgfx::RendererType::OpenGLES)
+ {
+ v[0] = v[1] = 1;
+ v[2] = v[3] = 0;
+ }
+
+ vertex[0].m_x = x[0];
+ vertex[0].m_y = y[0];
vertex[0].m_z = 0;
vertex[0].m_rgba = 0xffffffff;
- vertex[0].m_u = prim->texcoords.tl.u;
- vertex[0].m_v = prim->texcoords.tl.v;
+ vertex[0].m_u = u[0];
+ vertex[0].m_v = v[0];
- vertex[1].m_x = prim->bounds.x1;
- vertex[1].m_y = prim->bounds.y0;
+ vertex[1].m_x = x[1];
+ vertex[1].m_y = y[1];
vertex[1].m_z = 0;
vertex[1].m_rgba = 0xffffffff;
- vertex[1].m_u = prim->texcoords.tr.u;
- vertex[1].m_v = prim->texcoords.tr.v;
+ vertex[1].m_u = u[1];
+ vertex[1].m_v = v[1];
- vertex[2].m_x = prim->bounds.x1;
- vertex[2].m_y = prim->bounds.y1;
+ vertex[2].m_x = x[3];
+ vertex[2].m_y = y[3];
vertex[2].m_z = 0;
vertex[2].m_rgba = 0xffffffff;
- vertex[2].m_u = prim->texcoords.br.u;
- vertex[2].m_v = prim->texcoords.br.v;
+ vertex[2].m_u = u[3];
+ vertex[2].m_v = v[3];
- vertex[3].m_x = prim->bounds.x1;
- vertex[3].m_y = prim->bounds.y1;
+ vertex[3].m_x = x[3];
+ vertex[3].m_y = y[3];
vertex[3].m_z = 0;
vertex[3].m_rgba = 0xffffffff;
- vertex[3].m_u = prim->texcoords.br.u;
- vertex[3].m_v = prim->texcoords.br.v;
+ vertex[3].m_u = u[3];
+ vertex[3].m_v = v[3];
- vertex[4].m_x = prim->bounds.x0;
- vertex[4].m_y = prim->bounds.y1;
+ vertex[4].m_x = x[2];
+ vertex[4].m_y = y[2];
vertex[4].m_z = 0;
vertex[4].m_rgba = 0xffffffff;
- vertex[4].m_u = prim->texcoords.bl.u;
- vertex[4].m_v = prim->texcoords.bl.v;
+ vertex[4].m_u = u[2];
+ vertex[4].m_v = v[2];
- vertex[5].m_x = prim->bounds.x0;
- vertex[5].m_y = prim->bounds.y0;
+ vertex[5].m_x = x[0];
+ vertex[5].m_y = y[0];
vertex[5].m_z = 0;
vertex[5].m_rgba = 0xffffffff;
- vertex[5].m_u = prim->texcoords.tl.u;
- vertex[5].m_v = prim->texcoords.tl.v;
+ vertex[5].m_u = u[0];
+ vertex[5].m_v = v[0];
}
bool bgfx_chain_entry::skip()
diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp
index f2a909d5773..951d2c56e63 100644
--- a/src/osd/modules/render/drawbgfx.cpp
+++ b/src/osd/modules/render/drawbgfx.cpp
@@ -271,6 +271,13 @@ void renderer_bgfx::put_packed_quad(render_primitive *prim, UINT32 hash, ScreenV
float u[4] = { u0, u1, u0, u1 };
float v[4] = { v0, v0, v1, v1 };
+ bgfx::RendererType::Enum renderer_type = bgfx::getRendererType();
+ if (renderer_type == bgfx::RendererType::OpenGL || renderer_type == bgfx::RendererType::OpenGLES)
+ {
+ v[0] = v[1] = v1;
+ v[2] = v[3] = v0;
+ }
+
if (PRIMFLAG_GET_TEXORIENT(prim->flags) & ORIENTATION_SWAP_XY)
{
std::swap(u[1], u[2]);
@@ -364,47 +371,74 @@ void renderer_bgfx::render_post_screen_quad(int view, render_primitive* prim, bg
{
ScreenVertex* vertex = reinterpret_cast<ScreenVertex*>(buffer->data);
- vertex[0].m_x = prim->bounds.x0;
- vertex[0].m_y = prim->bounds.y0;
+ float x[4] = { prim->bounds.x0, prim->bounds.x1, prim->bounds.x0, prim->bounds.x1 };
+ float y[4] = { prim->bounds.y0, prim->bounds.y0, prim->bounds.y1, prim->bounds.y1 };
+ float u[4] = { prim->texcoords.tl.u, prim->texcoords.tr.u, prim->texcoords.bl.u, prim->texcoords.br.u };
+ float v[4] = { prim->texcoords.tl.v, prim->texcoords.tr.v, prim->texcoords.bl.v, prim->texcoords.br.v };
+
+ if (PRIMFLAG_GET_TEXORIENT(prim->flags) & ORIENTATION_SWAP_XY)
+ {
+ std::swap(u[1], u[2]);
+ std::swap(v[1], v[2]);
+ }
+
+ if (PRIMFLAG_GET_TEXORIENT(prim->flags) & ORIENTATION_FLIP_X)
+ {
+ std::swap(u[0], u[1]);
+ std::swap(v[0], v[1]);
+ std::swap(u[2], u[3]);
+ std::swap(v[2], v[3]);
+ }
+
+ if (PRIMFLAG_GET_TEXORIENT(prim->flags) & ORIENTATION_FLIP_Y)
+ {
+ std::swap(u[0], u[2]);
+ std::swap(v[0], v[2]);
+ std::swap(u[1], u[3]);
+ std::swap(v[1], v[3]);
+ }
+
+ vertex[0].m_x = x[0];
+ vertex[0].m_y = y[0];
vertex[0].m_z = 0;
vertex[0].m_rgba = 0xffffffff;
- vertex[0].m_u = prim->texcoords.tl.u;
- vertex[0].m_v = prim->texcoords.tl.v;
+ vertex[0].m_u = u[0];
+ vertex[0].m_v = v[0];
- vertex[1].m_x = prim->bounds.x1;
- vertex[1].m_y = prim->bounds.y0;
+ vertex[1].m_x = x[1];
+ vertex[1].m_y = y[1];
vertex[1].m_z = 0;
vertex[1].m_rgba = 0xffffffff;
- vertex[1].m_u = prim->texcoords.tr.u;
- vertex[1].m_v = prim->texcoords.tr.v;
+ vertex[1].m_u = u[1];
+ vertex[1].m_v = v[1];
- vertex[2].m_x = prim->bounds.x1;
- vertex[2].m_y = prim->bounds.y1;
+ vertex[2].m_x = x[3];
+ vertex[2].m_y = y[3];
vertex[2].m_z = 0;
vertex[2].m_rgba = 0xffffffff;
- vertex[2].m_u = prim->texcoords.br.u;
- vertex[2].m_v = prim->texcoords.br.v;
+ vertex[2].m_u = u[3];
+ vertex[2].m_v = v[3];
- vertex[3].m_x = prim->bounds.x1;
- vertex[3].m_y = prim->bounds.y1;
+ vertex[3].m_x = x[3];
+ vertex[3].m_y = y[3];
vertex[3].m_z = 0;
vertex[3].m_rgba = 0xffffffff;
- vertex[3].m_u = prim->texcoords.br.u;
- vertex[3].m_v = prim->texcoords.br.v;
+ vertex[3].m_u = u[3];
+ vertex[3].m_v = v[3];
- vertex[4].m_x = prim->bounds.x0;
- vertex[4].m_y = prim->bounds.y1;
+ vertex[4].m_x = x[2];
+ vertex[4].m_y = y[2];
vertex[4].m_z = 0;
vertex[4].m_rgba = 0xffffffff;
- vertex[4].m_u = prim->texcoords.bl.u;
- vertex[4].m_v = prim->texcoords.bl.v;
+ vertex[4].m_u = u[2];
+ vertex[4].m_v = v[2];
- vertex[5].m_x = prim->bounds.x0;
- vertex[5].m_y = prim->bounds.y0;
+ vertex[5].m_x = x[0];
+ vertex[5].m_y = y[0];
vertex[5].m_z = 0;
vertex[5].m_rgba = 0xffffffff;
- vertex[5].m_u = prim->texcoords.tl.u;
- vertex[5].m_v = prim->texcoords.tl.v;
+ vertex[5].m_u = u[0];
+ vertex[5].m_v = v[0];
UINT32 blend = PRIMFLAG_GET_BLENDMODE(prim->flags);
bgfx::setVertexBuffer(buffer);
@@ -785,18 +819,10 @@ int renderer_bgfx::draw(int update)
bgfx::setViewRect(view_index, 0, 0, m_width[window_index], m_height[window_index]);
// Setup view transform.
- {
- float view[16];
- bx::mtxIdentity(view);
-
- float left = 0.0f;
- float top = 0.0f;
- float right = m_width[window_index];
- float bottom = m_height[window_index];
- float proj[16];
- bx::mtxOrtho(proj, left, right, bottom, top, 0.0f, 100.0f);
- bgfx::setViewTransform(view_index, view, proj);
- }
+ float proj[16];
+ bx::mtxOrtho(proj, 0.0f, m_width[window_index], m_height[window_index], 0.0f, 0.0f, 100.0f);
+ bgfx::setViewTransform(view_index, nullptr, proj);
+
bgfx::setViewClear(view_index
, BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH
, 0x000000ff
@@ -1117,7 +1143,10 @@ slider_state* renderer_bgfx::get_slider_list()
tailptr = &(*tailptr)->next;
}
}
- (*tailptr)->next = nullptr;
+ if (*tailptr != nullptr)
+ {
+ (*tailptr)->next = nullptr;
+ }
m_sliders_dirty = false;
return listhead;
}