Fixed render target dimension swap for BGFX (nw)

This commit is contained in:
ImJezze 2016-04-03 12:08:56 +02:00
parent 88e84e7c52
commit 370aa2e8f5
4 changed files with 17 additions and 14 deletions

View File

@ -120,6 +120,16 @@ public:
float pixel_aspect() const { return monitor()->pixel_aspect(); }
bool swap_xy()
{
bool orientation_swap_xy =
(machine().system().flags & ORIENTATION_SWAP_XY) == ORIENTATION_SWAP_XY;
bool rotation_swap_xy =
(target()->orientation() & ROT90) == ROT90 ||
(target()->orientation() & ROT270) == ROT270;
return orientation_swap_xy ^ rotation_swap_xy;
};
virtual osd_dim get_size() = 0;
#ifdef OSD_SDL

View File

@ -1789,7 +1789,7 @@ d3d_render_target* shaders::get_texture_target(render_primitive *prim, texture_i
return nullptr;
}
bool swap_xy = d3d->swap_xy();
bool swap_xy = d3d->window().swap_xy();
int target_width = swap_xy
? static_cast<int>(prim->get_quad_height() + 0.5f)
: static_cast<int>(prim->get_quad_width() + 0.5f);
@ -1944,7 +1944,7 @@ bool shaders::register_texture(render_primitive *prim, texture_info *texture)
return false;
}
bool swap_xy = d3d->swap_xy();
bool swap_xy = d3d->window().swap_xy();
int target_width = swap_xy
? static_cast<int>(prim->get_quad_height() + 0.5f)
: static_cast<int>(prim->get_quad_width() + 0.5f);
@ -2617,7 +2617,7 @@ void uniform::update()
case CU_SWAP_XY:
{
m_shader->set_bool("SwapXY", d3d->swap_xy());
m_shader->set_bool("SwapXY", d3d->window().swap_xy());
break;
}
case CU_ORIENTATION_SWAP:

View File

@ -809,6 +809,10 @@ int renderer_bgfx::handle_screen_chains()
}
uint16_t screen_width(floor((prim->bounds.x1 - prim->bounds.x0) + 0.5f));
uint16_t screen_height(floor((prim->bounds.y1 - prim->bounds.y0) + 0.5f));
if(window().swap_xy())
{
std::swap(screen_width, screen_height);
}
m_targets->update_target_sizes(screen_index, screen_width, screen_height, TARGET_STYLE_NATIVE);
process_screen_quad(screen_index, prim);
screen_index++;

View File

@ -54,17 +54,6 @@ public:
virtual void record() override;
virtual void toggle_fsfx() override;
bool swap_xy()
{
// todo: move to osd_window
bool orientation_swap_xy =
(window().machine().system().flags & ORIENTATION_SWAP_XY) == ORIENTATION_SWAP_XY;
bool rotation_swap_xy =
(window().target()->orientation() & ROT90) == ROT90 ||
(window().target()->orientation() & ROT270) == ROT270;
return orientation_swap_xy ^ rotation_swap_xy;
};
int initialize();
int device_create(HWND device_HWND);