mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-15 19:28:43 +12:00
overlays: Avoid race condition between rendering and layout operations for system widgets
- System widgets are callable from outside RSX code. - Responding to draw requests while setup is in progress can cause malformed cached output - Fixes glitched layouts for system message dialogs
This commit is contained in:
parent
f6ebd88687
commit
cd40bc8c61
7 changed files with 32 additions and 5 deletions
|
@ -75,6 +75,11 @@ namespace rsx
|
||||||
|
|
||||||
compiled_resource message_dialog::get_compiled()
|
compiled_resource message_dialog::get_compiled()
|
||||||
{
|
{
|
||||||
|
if (!visible)
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
compiled_resource result;
|
compiled_resource result;
|
||||||
|
|
||||||
if (background_image && background_image->data)
|
if (background_image && background_image->data)
|
||||||
|
@ -158,6 +163,8 @@ namespace rsx
|
||||||
|
|
||||||
error_code message_dialog::show(bool is_blocking, const std::string& text, const MsgDialogType& type, std::function<void(s32 status)> on_close)
|
error_code message_dialog::show(bool is_blocking, const std::string& text, const MsgDialogType& type, std::function<void(s32 status)> on_close)
|
||||||
{
|
{
|
||||||
|
visible = false;
|
||||||
|
|
||||||
num_progress_bars = type.progress_bar_count;
|
num_progress_bars = type.progress_bar_count;
|
||||||
if (num_progress_bars)
|
if (num_progress_bars)
|
||||||
{
|
{
|
||||||
|
@ -207,6 +214,7 @@ namespace rsx
|
||||||
}
|
}
|
||||||
|
|
||||||
this->on_close = std::move(on_close);
|
this->on_close = std::move(on_close);
|
||||||
|
visible = true;
|
||||||
|
|
||||||
if (is_blocking)
|
if (is_blocking)
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace rsx
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
m_visible = false;
|
visible = false;
|
||||||
close();
|
close();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -178,8 +178,8 @@ namespace rsx
|
||||||
m_btn_cancel.set_image_resource(resource_config::standard_image_resource::circle);
|
m_btn_cancel.set_image_resource(resource_config::standard_image_resource::circle);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_visible = true;
|
|
||||||
m_update = true;
|
m_update = true;
|
||||||
|
visible = true;
|
||||||
exit = false;
|
exit = false;
|
||||||
|
|
||||||
fade_animation.current = color4f(0.f);
|
fade_animation.current = color4f(0.f);
|
||||||
|
@ -495,7 +495,7 @@ namespace rsx
|
||||||
|
|
||||||
compiled_resource osk_dialog::get_compiled()
|
compiled_resource osk_dialog::get_compiled()
|
||||||
{
|
{
|
||||||
if (!m_visible)
|
if (!visible)
|
||||||
{
|
{
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,6 +205,7 @@ namespace rsx
|
||||||
update();
|
update();
|
||||||
|
|
||||||
m_is_initialised = true;
|
m_is_initialised = true;
|
||||||
|
visible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void perf_metrics_overlay::set_framerate_graph_enabled(bool enabled)
|
void perf_metrics_overlay::set_framerate_graph_enabled(bool enabled)
|
||||||
|
@ -700,6 +701,8 @@ namespace rsx
|
||||||
perf_overlay = manager->create<rsx::overlays::perf_metrics_overlay>();
|
perf_overlay = manager->create<rsx::overlays::perf_metrics_overlay>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::scoped_lock lock(*manager);
|
||||||
|
|
||||||
perf_overlay->set_detail_level(perf_settings.level);
|
perf_overlay->set_detail_level(perf_settings.level);
|
||||||
perf_overlay->set_position(perf_settings.position);
|
perf_overlay->set_position(perf_settings.position);
|
||||||
perf_overlay->set_update_interval(perf_settings.update_interval);
|
perf_overlay->set_update_interval(perf_settings.update_interval);
|
||||||
|
|
|
@ -143,6 +143,11 @@ namespace rsx
|
||||||
|
|
||||||
compiled_resource save_dialog::get_compiled()
|
compiled_resource save_dialog::get_compiled()
|
||||||
{
|
{
|
||||||
|
if (!visible)
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
compiled_resource result;
|
compiled_resource result;
|
||||||
result.add(m_dim_background->get_compiled());
|
result.add(m_dim_background->get_compiled());
|
||||||
result.add(m_list->get_compiled());
|
result.add(m_list->get_compiled());
|
||||||
|
@ -157,6 +162,8 @@ namespace rsx
|
||||||
|
|
||||||
s32 save_dialog::show(std::vector<SaveDataEntry>& save_entries, u32 focused, u32 op, vm::ptr<CellSaveDataListSet> listSet)
|
s32 save_dialog::show(std::vector<SaveDataEntry>& save_entries, u32 focused, u32 op, vm::ptr<CellSaveDataListSet> listSet)
|
||||||
{
|
{
|
||||||
|
visible = false;
|
||||||
|
|
||||||
std::vector<u8> icon;
|
std::vector<u8> icon;
|
||||||
std::vector<std::unique_ptr<overlay_element>> entries;
|
std::vector<std::unique_ptr<overlay_element>> entries;
|
||||||
|
|
||||||
|
@ -248,6 +255,7 @@ namespace rsx
|
||||||
}
|
}
|
||||||
|
|
||||||
static_cast<label*>(m_description.get())->auto_resize();
|
static_cast<label*>(m_description.get())->auto_resize();
|
||||||
|
visible = true;
|
||||||
|
|
||||||
if (auto err = run_input_loop())
|
if (auto err = run_input_loop())
|
||||||
return err;
|
return err;
|
||||||
|
|
|
@ -30,6 +30,7 @@ namespace rsx
|
||||||
|
|
||||||
// Disable forced refresh unless fps dips below 4
|
// Disable forced refresh unless fps dips below 4
|
||||||
min_refresh_duration_us = 250000;
|
min_refresh_duration_us = 250000;
|
||||||
|
visible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void shader_compile_notification::update_animation(u64 t)
|
void shader_compile_notification::update_animation(u64 t)
|
||||||
|
@ -81,6 +82,11 @@ namespace rsx
|
||||||
|
|
||||||
compiled_resource shader_compile_notification::get_compiled()
|
compiled_resource shader_compile_notification::get_compiled()
|
||||||
{
|
{
|
||||||
|
if (!visible)
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
auto compiled = m_text.get_compiled();
|
auto compiled = m_text.get_compiled();
|
||||||
compiled.add(dots[0].get_compiled());
|
compiled.add(dots[0].get_compiled());
|
||||||
compiled.add(dots[1].get_compiled());
|
compiled.add(dots[1].get_compiled());
|
||||||
|
|
|
@ -93,7 +93,7 @@ namespace rsx
|
||||||
|
|
||||||
compiled_resource trophy_notification::get_compiled()
|
compiled_resource trophy_notification::get_compiled()
|
||||||
{
|
{
|
||||||
if (!creation_time)
|
if (!creation_time || !visible)
|
||||||
{
|
{
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -110,6 +110,7 @@ namespace rsx
|
||||||
{
|
{
|
||||||
// Schedule to display this trophy
|
// Schedule to display this trophy
|
||||||
display_sched_id = s_trophy_semaphore.enqueue();
|
display_sched_id = s_trophy_semaphore.enqueue();
|
||||||
|
visible = false;
|
||||||
|
|
||||||
if (!trophy_icon_buffer.empty())
|
if (!trophy_icon_buffer.empty())
|
||||||
{
|
{
|
||||||
|
@ -135,6 +136,7 @@ namespace rsx
|
||||||
u16 margin_sz = text_view.x - image.w - image.x;
|
u16 margin_sz = text_view.x - image.w - image.x;
|
||||||
frame.w = text_view.x + text_view.w + margin_sz;
|
frame.w = text_view.x + text_view.w + margin_sz;
|
||||||
|
|
||||||
|
visible = true;
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
} // namespace overlays
|
} // namespace overlays
|
||||||
|
|
|
@ -34,6 +34,7 @@ namespace rsx
|
||||||
u16 virtual_height = 720;
|
u16 virtual_height = 720;
|
||||||
|
|
||||||
u32 min_refresh_duration_us = 16600;
|
u32 min_refresh_duration_us = 16600;
|
||||||
|
atomic_t<bool> visible = false;
|
||||||
|
|
||||||
virtual ~overlay() = default;
|
virtual ~overlay() = default;
|
||||||
|
|
||||||
|
@ -399,7 +400,6 @@ namespace rsx
|
||||||
// Fade in/out
|
// Fade in/out
|
||||||
animation_color_interpolate fade_animation;
|
animation_color_interpolate fade_animation;
|
||||||
|
|
||||||
bool m_visible = false;
|
|
||||||
bool m_update = true;
|
bool m_update = true;
|
||||||
compiled_resource m_cached_resource;
|
compiled_resource m_cached_resource;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue