Use g_fxo for display_manager

This commit is contained in:
Nekotekina 2019-08-26 03:08:16 +03:00
parent 6811ec562c
commit d2eba2387b
10 changed files with 27 additions and 25 deletions

View File

@ -47,7 +47,7 @@ error_code open_msg_dialog(bool is_blocking, u32 type, vm::cptr<char> msgString,
if (res == CELL_OK && is_blocking) if (res == CELL_OK && is_blocking)
{ {
if (auto manager = fxm::get<rsx::overlays::display_manager>()) if (auto manager = g_fxo->get<rsx::overlays::display_manager>())
{ {
while (auto dlg = manager->get<rsx::overlays::message_dialog>()) while (auto dlg = manager->get<rsx::overlays::message_dialog>())
{ {
@ -167,7 +167,7 @@ error_code cellMsgDialogOpen2(u32 type, vm::cptr<char> msgString, vm::ptr<CellMs
cellSysutil.error(msgString.get_ptr()); cellSysutil.error(msgString.get_ptr());
} }
if (auto manager = fxm::get<rsx::overlays::display_manager>()) if (auto manager = g_fxo->get<rsx::overlays::display_manager>())
{ {
if (manager->get<rsx::overlays::message_dialog>()) if (manager->get<rsx::overlays::message_dialog>())
{ {
@ -338,7 +338,7 @@ error_code cellMsgDialogClose(f32 delay)
extern u64 get_guest_system_time(); extern u64 get_guest_system_time();
const u64 wait_until = get_guest_system_time() + static_cast<s64>(std::max<float>(delay, 0.0f) * 1000); const u64 wait_until = get_guest_system_time() + static_cast<s64>(std::max<float>(delay, 0.0f) * 1000);
if (auto manager = fxm::get<rsx::overlays::display_manager>()) if (auto manager = g_fxo->get<rsx::overlays::display_manager>())
{ {
if (auto dlg = manager->get<rsx::overlays::message_dialog>()) if (auto dlg = manager->get<rsx::overlays::message_dialog>())
{ {
@ -388,7 +388,7 @@ error_code cellMsgDialogAbort()
{ {
cellSysutil.warning("cellMsgDialogAbort()"); cellSysutil.warning("cellMsgDialogAbort()");
if (auto manager = fxm::get<rsx::overlays::display_manager>()) if (auto manager = g_fxo->get<rsx::overlays::display_manager>())
{ {
if (auto dlg = manager->get<rsx::overlays::message_dialog>()) if (auto dlg = manager->get<rsx::overlays::message_dialog>())
{ {
@ -437,7 +437,7 @@ error_code cellMsgDialogProgressBarSetMsg(u32 progressBarIndex, vm::cptr<char> m
return CELL_MSGDIALOG_ERROR_PARAM; return CELL_MSGDIALOG_ERROR_PARAM;
} }
if (auto manager = fxm::get<rsx::overlays::display_manager>()) if (auto manager = g_fxo->get<rsx::overlays::display_manager>())
{ {
if (auto dlg = manager->get<rsx::overlays::message_dialog>()) if (auto dlg = manager->get<rsx::overlays::message_dialog>())
{ {
@ -469,7 +469,7 @@ error_code cellMsgDialogProgressBarReset(u32 progressBarIndex)
{ {
cellSysutil.warning("cellMsgDialogProgressBarReset(progressBarIndex=%d)", progressBarIndex); cellSysutil.warning("cellMsgDialogProgressBarReset(progressBarIndex=%d)", progressBarIndex);
if (auto manager = fxm::get<rsx::overlays::display_manager>()) if (auto manager = g_fxo->get<rsx::overlays::display_manager>())
{ {
if (auto dlg = manager->get<rsx::overlays::message_dialog>()) if (auto dlg = manager->get<rsx::overlays::message_dialog>())
{ {
@ -501,7 +501,7 @@ error_code cellMsgDialogProgressBarInc(u32 progressBarIndex, u32 delta)
{ {
cellSysutil.warning("cellMsgDialogProgressBarInc(progressBarIndex=%d, delta=%d)", progressBarIndex, delta); cellSysutil.warning("cellMsgDialogProgressBarInc(progressBarIndex=%d, delta=%d)", progressBarIndex, delta);
if (auto manager = fxm::get<rsx::overlays::display_manager>()) if (auto manager = g_fxo->get<rsx::overlays::display_manager>())
{ {
if (auto dlg = manager->get<rsx::overlays::message_dialog>()) if (auto dlg = manager->get<rsx::overlays::message_dialog>())
{ {

View File

@ -34,7 +34,7 @@ OskDialogBase::~OskDialogBase()
std::shared_ptr<OskDialogBase> _get_osk_dialog(bool always = false) std::shared_ptr<OskDialogBase> _get_osk_dialog(bool always = false)
{ {
if (auto manager = fxm::get<rsx::overlays::display_manager>()) if (auto manager = g_fxo->get<rsx::overlays::display_manager>())
{ {
// NOTE: Osk lifetime is managed by fxm, not display manager // NOTE: Osk lifetime is managed by fxm, not display manager
// Visibility is still managed by display manager // Visibility is still managed by display manager

View File

@ -38,7 +38,6 @@ GLGSRender::GLGSRender() : GSRender()
supports_hw_a2c = false; supports_hw_a2c = false;
supports_multidraw = true; supports_multidraw = true;
supports_native_ui = (bool)g_cfg.misc.use_native_interface;
} }
extern CellGcmContextData current_context; extern CellGcmContextData current_context;
@ -896,7 +895,7 @@ void GLGSRender::on_init_thread()
m_gl_texture_cache.initialize(); m_gl_texture_cache.initialize();
if (!supports_native_ui) if (!m_overlay_manager)
{ {
m_frame->hide(); m_frame->hide();
m_shaders_cache->load(nullptr); m_shaders_cache->load(nullptr);
@ -918,7 +917,7 @@ void GLGSRender::on_init_thread()
type.disable_cancel = true; type.disable_cancel = true;
type.progress_bar_count = 2; type.progress_bar_count = 2;
dlg = fxm::get<rsx::overlays::display_manager>()->create<rsx::overlays::message_dialog>((bool)g_cfg.video.shader_preloading_dialog.use_custom_background); dlg = g_fxo->get<rsx::overlays::display_manager>()->create<rsx::overlays::message_dialog>((bool)g_cfg.video.shader_preloading_dialog.use_custom_background);
dlg->progress_bar_set_taskbar_index(-1); dlg->progress_bar_set_taskbar_index(-1);
dlg->show("Loading precompiled shaders from disk...", type, [](s32 status) dlg->show("Loading precompiled shaders from disk...", type, [](s32 status)
{ {

View File

@ -309,7 +309,7 @@ namespace rsx
{ {
// Force unload // Force unload
exit = true; exit = true;
if (auto manager = fxm::get<display_manager>()) if (auto manager = g_fxo->get<display_manager>())
{ {
if (auto dlg = manager->get<rsx::overlays::message_dialog>()) if (auto dlg = manager->get<rsx::overlays::message_dialog>())
{ {

View File

@ -97,7 +97,7 @@ namespace rsx
class display_manager class display_manager
{ {
private: private:
atomic_t<u32> m_uid_ctr { 0u }; atomic_t<u32> m_uid_ctr = 0;
std::vector<std::shared_ptr<overlay>> m_iface_list; std::vector<std::shared_ptr<overlay>> m_iface_list;
std::vector<std::shared_ptr<overlay>> m_dirty_list; std::vector<std::shared_ptr<overlay>> m_dirty_list;
@ -158,8 +158,10 @@ namespace rsx
} }
public: public:
display_manager() = default; // Disable default construction to make it conditionally available in g_fxo
~display_manager() = default; explicit display_manager(int) noexcept
{
}
// Adds an object to the internal list. Optionally removes other objects of the same type. // Adds an object to the internal list. Optionally removes other objects of the same type.
// Original handle loses ownership but a usable pointer is returned // Original handle loses ownership but a usable pointer is returned

View File

@ -271,6 +271,11 @@ namespace rsx
memset(m_vertex_textures_dirty, -1, sizeof(m_vertex_textures_dirty)); memset(m_vertex_textures_dirty, -1, sizeof(m_vertex_textures_dirty));
m_graphics_state = pipeline_state::all_dirty; m_graphics_state = pipeline_state::all_dirty;
if (g_cfg.misc.use_native_interface && (g_cfg.video.renderer == video_renderer::opengl || g_cfg.video.renderer == video_renderer::vulkan))
{
m_overlay_manager = g_fxo->init<rsx::overlays::display_manager>(0);
}
} }
thread::~thread() thread::~thread()
@ -420,10 +425,8 @@ namespace rsx
return fmt::format("RSX [0x%07x]", +rsx->ctrl->get); return fmt::format("RSX [0x%07x]", +rsx->ctrl->get);
}; };
if (supports_native_ui) if (m_overlay_manager)
{ {
m_overlay_manager = fxm::make_always<rsx::overlays::display_manager>();
if (g_cfg.video.perf_overlay.perf_overlay_enabled) if (g_cfg.video.perf_overlay.perf_overlay_enabled)
{ {
auto perf_overlay = m_overlay_manager->create<rsx::overlays::perf_metrics_overlay>(); auto perf_overlay = m_overlay_manager->create<rsx::overlays::perf_metrics_overlay>();

View File

@ -429,7 +429,6 @@ namespace rsx
bool skip_frame = false; bool skip_frame = false;
bool supports_multidraw = false; // Draw call batching bool supports_multidraw = false; // Draw call batching
bool supports_native_ui = false; // Native UI rendering
bool supports_hw_a2c = false; // Alpha to coverage bool supports_hw_a2c = false; // Alpha to coverage
// FIFO // FIFO
@ -447,7 +446,7 @@ namespace rsx
bool framebuffer_status_valid = false; bool framebuffer_status_valid = false;
// Overlays // Overlays
std::shared_ptr<rsx::overlays::display_manager> m_overlay_manager; rsx::overlays::display_manager* m_overlay_manager = nullptr;
// Invalidated memory range // Invalidated memory range
address_range m_invalidated_memory_range; address_range m_invalidated_memory_range;

View File

@ -529,7 +529,6 @@ VKGSRender::VKGSRender() : GSRender()
m_ui_renderer->create(*m_current_command_buffer, m_texture_upload_buffer_ring_info); m_ui_renderer->create(*m_current_command_buffer, m_texture_upload_buffer_ring_info);
supports_multidraw = true; supports_multidraw = true;
supports_native_ui = (bool)g_cfg.misc.use_native_interface;
// NOTE: We do not actually need multiple sample support for A2C to work // NOTE: We do not actually need multiple sample support for A2C to work
// This is here for visual consistency - will be removed when AA problems due to mipmaps are fixed // This is here for visual consistency - will be removed when AA problems due to mipmaps are fixed
supports_hw_a2c = (g_cfg.video.antialiasing_level != msaa_level::none); supports_hw_a2c = (g_cfg.video.antialiasing_level != msaa_level::none);
@ -1809,7 +1808,7 @@ void VKGSRender::on_init_thread()
GSRender::on_init_thread(); GSRender::on_init_thread();
zcull_ctrl.reset(static_cast<::rsx::reports::ZCULL_control*>(this)); zcull_ctrl.reset(static_cast<::rsx::reports::ZCULL_control*>(this));
if (!supports_native_ui) if (!m_overlay_manager)
{ {
m_frame->hide(); m_frame->hide();
m_shaders_cache->load(nullptr, *m_device, pipeline_layout); m_shaders_cache->load(nullptr, *m_device, pipeline_layout);
@ -1831,7 +1830,7 @@ void VKGSRender::on_init_thread()
type.disable_cancel = true; type.disable_cancel = true;
type.progress_bar_count = 2; type.progress_bar_count = 2;
dlg = fxm::get<rsx::overlays::display_manager>()->create<rsx::overlays::message_dialog>((bool)g_cfg.video.shader_preloading_dialog.use_custom_background); dlg = g_fxo->get<rsx::overlays::display_manager>()->create<rsx::overlays::message_dialog>((bool)g_cfg.video.shader_preloading_dialog.use_custom_background);
dlg->progress_bar_set_taskbar_index(-1); dlg->progress_bar_set_taskbar_index(-1);
dlg->show("Loading precompiled shaders from disk...", type, [](s32 status) dlg->show("Loading precompiled shaders from disk...", type, [](s32 status)
{ {

View File

@ -7,7 +7,7 @@
s32 save_data_dialog::ShowSaveDataList(std::vector<SaveDataEntry>& save_entries, s32 focused, u32 op, vm::ptr<CellSaveDataListSet> listSet) s32 save_data_dialog::ShowSaveDataList(std::vector<SaveDataEntry>& save_entries, s32 focused, u32 op, vm::ptr<CellSaveDataListSet> listSet)
{ {
// TODO: Install native shell as an Emu callback // TODO: Install native shell as an Emu callback
if (auto manager = fxm::get<rsx::overlays::display_manager>()) if (auto manager = g_fxo->get<rsx::overlays::display_manager>())
{ {
auto result = manager->create<rsx::overlays::save_dialog>()->show(save_entries, focused, op, listSet); auto result = manager->create<rsx::overlays::save_dialog>()->show(save_entries, focused, op, listSet);
if (result != rsx::overlays::user_interface::selection_code::error) if (result != rsx::overlays::user_interface::selection_code::error)

View File

@ -7,7 +7,7 @@
s32 trophy_notification_helper::ShowTrophyNotification(const SceNpTrophyDetails& trophy, const std::vector<uchar>& trophy_icon_buffer) s32 trophy_notification_helper::ShowTrophyNotification(const SceNpTrophyDetails& trophy, const std::vector<uchar>& trophy_icon_buffer)
{ {
if (auto manager = fxm::get<rsx::overlays::display_manager>()) if (auto manager = g_fxo->get<rsx::overlays::display_manager>())
{ {
return manager->create<rsx::overlays::trophy_notification>()->show(trophy, trophy_icon_buffer); return manager->create<rsx::overlays::trophy_notification>()->show(trophy, trophy_icon_buffer);
} }