1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 10:42:36 +01:00

perf overlay: add datapoint settings to GUI

This commit is contained in:
Megamouse 2021-03-01 22:44:47 +01:00
parent 86dbb859b7
commit 73ca2119ed
7 changed files with 119 additions and 11 deletions

View File

@ -1097,6 +1097,7 @@ namespace rsx
void set_color(color4f color);
void set_guide_interval(f32 guide_interval);
u16 get_height() const;
u32 get_datapoint_count() const;
void record_datapoint(f32 datapoint);
void update();
compiled_resource& get_compiled() override;

View File

@ -264,7 +264,7 @@ namespace rsx
visible = true;
}
void perf_metrics_overlay::set_framerate_graph_enabled(bool enabled, u32 datapoint_count)
void perf_metrics_overlay::set_framerate_graph_enabled(bool enabled)
{
if (m_framerate_graph_enabled == enabled)
return;
@ -275,7 +275,6 @@ namespace rsx
{
m_fps_graph.set_title(" Framerate");
m_fps_graph.set_font_size(static_cast<u16>(m_font_size * 0.8));
m_fps_graph.set_count(datapoint_count);
m_fps_graph.set_color(convert_color_code(m_color_body, m_opacity));
m_fps_graph.set_guide_interval(10);
}
@ -283,7 +282,7 @@ namespace rsx
m_force_repaint = true;
}
void perf_metrics_overlay::set_frametime_graph_enabled(bool enabled, u32 datapoint_count)
void perf_metrics_overlay::set_frametime_graph_enabled(bool enabled)
{
if (m_frametime_graph_enabled == enabled)
return;
@ -294,7 +293,6 @@ namespace rsx
{
m_frametime_graph.set_title(" Frametime");
m_frametime_graph.set_font_size(static_cast<u16>(m_font_size * 0.8));
m_frametime_graph.set_count(datapoint_count);
m_frametime_graph.set_color(convert_color_code(m_color_body, m_opacity));
m_frametime_graph.set_guide_interval(8);
}
@ -302,6 +300,24 @@ namespace rsx
m_force_repaint = true;
}
void perf_metrics_overlay::set_framerate_datapoint_count(u32 datapoint_count)
{
if (m_fps_graph.get_datapoint_count() == datapoint_count)
return;
m_fps_graph.set_count(datapoint_count);
m_force_repaint = true;
}
void perf_metrics_overlay::set_frametime_datapoint_count(u32 datapoint_count)
{
if (m_frametime_graph.get_datapoint_count() == datapoint_count)
return;
m_frametime_graph.set_count(datapoint_count);
m_force_repaint = true;
}
void perf_metrics_overlay::set_detail_level(detail_level level)
{
if (m_detail == level)
@ -640,7 +656,20 @@ namespace rsx
void graph::set_count(u32 datapoint_count)
{
m_datapoint_count = datapoint_count;
m_datapoints.resize(datapoint_count, 0);
if (m_datapoints.empty())
{
m_datapoints.resize(m_datapoint_count, 0);
}
else if (m_datapoints.empty() || m_datapoint_count < m_datapoints.size())
{
std::copy(m_datapoints.begin() + m_datapoints.size() - m_datapoint_count, m_datapoints.end(), m_datapoints.begin());
m_datapoints.resize(m_datapoint_count);
}
else
{
m_datapoints.insert(m_datapoints.begin(), m_datapoint_count - m_datapoints.size(), 0);
}
}
void graph::set_color(color4f color)
@ -658,6 +687,11 @@ namespace rsx
return h + m_label.h + m_label.padding_top + m_label.padding_bottom;
}
u32 graph::get_datapoint_count() const
{
return m_datapoint_count;
}
void graph::record_datapoint(f32 datapoint)
{
ensure(datapoint >= 0.0f);
@ -773,8 +807,10 @@ namespace rsx
perf_overlay->set_opacity(perf_settings.opacity / 100.f);
perf_overlay->set_body_colors(perf_settings.color_body, perf_settings.background_body);
perf_overlay->set_title_colors(perf_settings.color_title, perf_settings.background_title);
perf_overlay->set_framerate_graph_enabled(perf_settings.framerate_graph_enabled.get(), perf_settings.framerate_datapoint_count);
perf_overlay->set_frametime_graph_enabled(perf_settings.frametime_graph_enabled.get(), perf_settings.frametime_datapoint_count);
perf_overlay->set_framerate_datapoint_count(perf_settings.framerate_datapoint_count);
perf_overlay->set_frametime_datapoint_count(perf_settings.frametime_datapoint_count);
perf_overlay->set_framerate_graph_enabled(perf_settings.framerate_graph_enabled.get());
perf_overlay->set_frametime_graph_enabled(perf_settings.frametime_graph_enabled.get());
perf_overlay->init();
}
else if (perf_overlay)

View File

@ -85,8 +85,10 @@ namespace rsx
public:
void init();
void set_framerate_graph_enabled(bool enabled, u32 datapoint_count);
void set_frametime_graph_enabled(bool enabled, u32 datapoint_count);
void set_framerate_graph_enabled(bool enabled);
void set_frametime_graph_enabled(bool enabled);
void set_framerate_datapoint_count(u32 datapoint_count);
void set_frametime_datapoint_count(u32 datapoint_count);
void set_detail_level(detail_level level);
void set_position(screen_quadrant quadrant);
void set_update_interval(u32 update_interval);

View File

@ -81,6 +81,8 @@ enum class emu_settings_type
PerfOverlayEnabled,
PerfOverlayFramerateGraphEnabled,
PerfOverlayFrametimeGraphEnabled,
PerfOverlayFramerateDatapoints,
PerfOverlayFrametimeDatapoints,
PerfOverlayDetailLevel,
PerfOverlayPosition,
PerfOverlayUpdateInterval,
@ -227,6 +229,8 @@ static const QMap<emu_settings_type, cfg_location> settings_location =
{ emu_settings_type::PerfOverlayEnabled, { "Video", "Performance Overlay", "Enabled" } },
{ emu_settings_type::PerfOverlayFramerateGraphEnabled, { "Video", "Performance Overlay", "Enable Framerate Graph" } },
{ emu_settings_type::PerfOverlayFrametimeGraphEnabled, { "Video", "Performance Overlay", "Enable Frametime Graph" } },
{ emu_settings_type::PerfOverlayFramerateDatapoints, { "Video", "Performance Overlay", "Framerate datapoints" } },
{ emu_settings_type::PerfOverlayFrametimeDatapoints, { "Video", "Performance Overlay", "Frametime datapoints" } },
{ emu_settings_type::PerfOverlayDetailLevel, { "Video", "Performance Overlay", "Detail level" } },
{ emu_settings_type::PerfOverlayPosition, { "Video", "Performance Overlay", "Position" } },
{ emu_settings_type::PerfOverlayUpdateInterval, { "Video", "Performance Overlay", "Metrics update interval (ms)" } },

View File

@ -1255,6 +1255,12 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
EnhanceSlider(emu_settings_type::PerfOverlayOpacity, ui->perfOverlayOpacity, ui->label_opacity, tr("Opacity: %0 %", "Performance overlay opacity"));
SubscribeTooltip(ui->perf_overlay_opacity, tooltips.settings.perf_overlay_opacity);
EnhanceSlider(emu_settings_type::PerfOverlayFramerateDatapoints, ui->slider_framerate_datapoints, ui->label_framerate_datapoints, tr("Framerate datapoints: %0", "Framerate graph datapoints"));
SubscribeTooltip(ui->perf_overlay_framerate_datapoints, tooltips.settings.perf_overlay_framerate_datapoints);
EnhanceSlider(emu_settings_type::PerfOverlayFrametimeDatapoints, ui->slider_frametime_datapoints, ui->label_frametime_datapoints, tr("Frametime datapoints: %0", "Frametime graph datapoints"));
SubscribeTooltip(ui->perf_overlay_frametime_datapoints, tooltips.settings.perf_overlay_frametime_datapoints);
EnhanceSlider(emu_settings_type::ShaderLoadBgDarkening, ui->shaderLoadBgDarkening, ui->label_shaderLoadBgDarkening, tr("Background darkening: %0 %", "Shader load background darkening"));
SubscribeTooltip(ui->shaderLoadBgDarkening, tooltips.settings.shader_load_bg_darkening);

View File

@ -1983,8 +1983,7 @@
<enum>QLayout::SetNoConstraint</enum>
</property>
<item>
<widget class="QLineEdit" name="searchBox">
</widget>
<widget class="QLineEdit" name="searchBox"/>
</item>
<item>
<widget class="QPushButton" name="resetLleList">
@ -2858,6 +2857,64 @@
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="perf_overlay_framerate_datapoints" native="true">
<layout class="QVBoxLayout" name="layout_perf_overlay_framerate_datapoints">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_framerate_datapoints">
<property name="text">
<string>Framerate datapoints:</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="slider_framerate_datapoints">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="perf_overlay_frametime_datapoints" native="true">
<layout class="QVBoxLayout" name="layout_perf_overlay_frametime_datapoints">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_frametime_datapoints">
<property name="text">
<string>Frametime datapoints:</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="slider_frametime_datapoints">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="emulatorTabSpacerRight">
<property name="orientation">

View File

@ -119,6 +119,8 @@ public:
const QString perf_overlay_enabled = tr("Enables or disables the performance overlay.");
const QString perf_overlay_framerate_graph_enabled = tr("Enables or disables the framerate graph.");
const QString perf_overlay_frametime_graph_enabled = tr("Enables or disables the frametime graph.");
const QString perf_overlay_framerate_datapoints = tr("Sets the amount of datapoints used in the framerate graph.");
const QString perf_overlay_frametime_datapoints = tr("Sets the amount of datapoints used in the frametime graph.");
const QString perf_overlay_position = tr("Sets the on-screen position (quadrant) of the performance overlay.");
const QString perf_overlay_detail_level = tr("Controls the amount of information displayed on the performance overlay.");
const QString perf_overlay_update_interval = tr("Sets the time interval in which the performance overlay is being updated (measured in milliseconds).");