mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-03-26 12:28:34 -06:00
overlays: addresses comments and fixes overlay sizing issue
This commit is contained in:
parent
a793b272b6
commit
cb3ff7e0a5
@ -399,7 +399,10 @@ namespace gl
|
||||
|
||||
void ui_overlay_renderer::run(gl::command_context& cmd_, const areau& viewport, GLuint target, rsx::overlays::overlay& ui, bool flip_vertically)
|
||||
{
|
||||
ui.set_render_viewport(viewport.width(), viewport.height());
|
||||
ui.set_render_viewport(
|
||||
static_cast<u16>(std::min<u32>(viewport.width(), std::numeric_limits<u16>::max())),
|
||||
static_cast<u16>(std::min<u32>(viewport.height(), std::numeric_limits<u16>::max()))
|
||||
);
|
||||
const auto ui_scale = color4f(static_cast<f32>(ui.virtual_width), static_cast<f32>(ui.virtual_height), 1.f, 1.f);
|
||||
const auto ui_viewport = color4f(static_cast<f32>(viewport.width()), static_cast<f32>(viewport.height()), static_cast<f32>(viewport.x1), static_cast<f32>(viewport.y1));
|
||||
|
||||
|
||||
@ -115,6 +115,7 @@ namespace rsx
|
||||
{
|
||||
graph_height += m_padding;
|
||||
}
|
||||
|
||||
const u16 overlay_width = std::max(m_body.w, graph_width);
|
||||
const u16 overlay_height = static_cast<u16>(m_body.h + graph_height);
|
||||
const auto percent_to_margin_px = [](f32 margin_percent, u16 virtual_size, u16 overlay_size) -> u32
|
||||
@ -450,15 +451,24 @@ namespace rsx
|
||||
m_force_update = true;
|
||||
}
|
||||
|
||||
void perf_metrics_overlay::set_render_viewport(u32 width, u32 height)
|
||||
void perf_metrics_overlay::set_render_viewport(u16 width, u16 height)
|
||||
{
|
||||
u16 new_virtual_width = virtual_width;
|
||||
u16 new_virtual_height = virtual_height;
|
||||
|
||||
if (use_window_space && width > 0 && height > 0)
|
||||
{
|
||||
new_virtual_width = static_cast<u16>(std::min<u32>(width, std::numeric_limits<u16>::max()));
|
||||
new_virtual_height = static_cast<u16>(std::min<u32>(height, std::numeric_limits<u16>::max()));
|
||||
const double scale_x = static_cast<double>(width) / virtual_width;
|
||||
const double scale_y = static_cast<double>(height) / virtual_height;
|
||||
const double scale = std::min(scale_x, scale_y);
|
||||
|
||||
new_virtual_width = static_cast<u16>(std::min<u32>(
|
||||
static_cast<u32>(std::lround(width / scale)),
|
||||
std::numeric_limits<u16>::max()));
|
||||
|
||||
new_virtual_height = static_cast<u16>(std::min<u32>(
|
||||
static_cast<u32>(std::lround(height / scale)),
|
||||
std::numeric_limits<u16>::max()));
|
||||
}
|
||||
|
||||
if (m_virtual_width == new_virtual_width && m_virtual_height == new_virtual_height)
|
||||
|
||||
@ -103,7 +103,7 @@ namespace rsx
|
||||
void set_body_colors(std::string color, std::string background);
|
||||
void set_title_colors(std::string color, std::string background);
|
||||
void force_next_update();
|
||||
void set_render_viewport(u32 width, u32 height) override;
|
||||
void set_render_viewport(u16 width, u16 height) override;
|
||||
u16 get_virtual_width() const override { return m_virtual_width; }
|
||||
u16 get_virtual_height() const override { return m_virtual_height; }
|
||||
|
||||
|
||||
@ -58,9 +58,9 @@ namespace rsx
|
||||
virtual compiled_resource get_compiled() = 0;
|
||||
|
||||
void refresh() const;
|
||||
virtual u16 get_virtual_width() const { return virtual_width;}
|
||||
virtual u16 get_virtual_height() const { return virtual_height;}
|
||||
virtual void set_render_viewport(u32 /*width*/, u32 /*height*/) {}
|
||||
virtual u16 get_virtual_width() const { return virtual_width; }
|
||||
virtual u16 get_virtual_height() const { return virtual_height; }
|
||||
virtual void set_render_viewport(u16 /*width*/, u16 /*height*/) {}
|
||||
};
|
||||
|
||||
// Interactable UI element
|
||||
|
||||
@ -628,7 +628,10 @@ namespace vk
|
||||
void ui_overlay_renderer::run(vk::command_buffer& cmd, const areau& viewport, vk::framebuffer* target, VkRenderPass render_pass,
|
||||
vk::data_heap& upload_heap, rsx::overlays::overlay& ui)
|
||||
{
|
||||
ui.set_render_viewport(viewport.width(), viewport.height());
|
||||
ui.set_render_viewport(
|
||||
static_cast<u16>(std::min<u32>(viewport.width(), std::numeric_limits<u16>::max())),
|
||||
static_cast<u16>(std::min<u32>(viewport.height(), std::numeric_limits<u16>::max()))
|
||||
);
|
||||
m_scale_offset = color4f(ui.get_virtual_width(), ui.get_virtual_height(), 1.f, 1.f);
|
||||
m_viewport = { { static_cast<f32>(viewport.x1), static_cast<f32>(viewport.y1) }, { static_cast<f32>(viewport.width()), static_cast<f32>(viewport.height()) } };
|
||||
|
||||
|
||||
@ -209,8 +209,8 @@ struct cfg_root : cfg::node
|
||||
cfg::uint<4, 36> font_size{ this, "Font size (px)", 10, true };
|
||||
cfg::_enum<screen_quadrant> position{ this, "Position", screen_quadrant::top_left, true };
|
||||
cfg::string font{ this, "Font", "n023055ms.ttf", true };
|
||||
cfg::_float<0, 100> margin_x{ this, "Horizontal Margin (%)", 1.5, true }; // horizontal distance to the window border relative to the screen_quadrant in percent of the window width
|
||||
cfg::_float<0, 100> margin_y{ this, "Vertical Margin (%)", 4.5, true }; // vertical distance to the window border relative to the screen_quadrant in percent of the window height
|
||||
cfg::_float<0, 100> margin_x{ this, "Horizontal Margin (%)", 4, true }; // horizontal distance to the window border relative to the screen_quadrant in percent of the window width
|
||||
cfg::_float<0, 100> margin_y{ this, "Vertical Margin (%)", 7, true }; // vertical distance to the window border relative to the screen_quadrant in percent of the window height
|
||||
cfg::_bool center_x{ this, "Center Horizontally", false, true };
|
||||
cfg::_bool center_y{ this, "Center Vertically", false, true };
|
||||
cfg::uint<0, 100> opacity{ this, "Opacity (%)", 70, true };
|
||||
|
||||
@ -169,11 +169,11 @@ public:
|
||||
const QString perf_overlay_update_interval = tr("Sets the time interval in which the performance overlay is being updated (measured in milliseconds).\nSetting this to 16 milliseconds will refresh the performance overlay at roughly 60Hz.\nThe performance overlay refresh rate does not affect the frame graph statistics and can only be as fast as the current game allows.");
|
||||
const QString perf_overlay_font_size = tr("Sets the font size of the performance overlay (measured in pixels).");
|
||||
const QString perf_overlay_opacity = tr("Sets the opacity of the performance overlay (measured in %).");
|
||||
const QString perf_overlay_margin_x = tr("Sets the horizontal distance to the screen border relative to the screen quadrant (measured as a percentage of the window width).");
|
||||
const QString perf_overlay_margin_y = tr("Sets the vertical distance to the screen border relative to the screen quadrant (measured as a percentage of the window height).");
|
||||
const QString perf_overlay_margin_x = tr("Sets the horizontal distance to the screen border relative to the screen quadrant (measured in %).");
|
||||
const QString perf_overlay_margin_y = tr("Sets the vertical distance to the screen border relative to the screen quadrant (measured in %).");
|
||||
const QString perf_overlay_center_x = tr("Centers the performance overlay horizontally and overrides the horizontal margin.");
|
||||
const QString perf_overlay_center_y = tr("Centers the performance overlay vertically and overrides the vertical margin.");
|
||||
const QString perf_overlay_use_window_space = tr("Position overlay relative to the full window surface, enabling placement outside game's framebuffer area.");
|
||||
const QString perf_overlay_use_window_space = tr("Position overlay relative to the full window surface, enabling placement outside game's render area.");
|
||||
|
||||
const QString shader_load_bg_enabled = tr("Shows a background image during the native shader loading dialog/loading screen.\nBy default the used image will be <gamedir>/PS3_GAME/PIC1.PNG.");
|
||||
const QString shader_load_bg_darkening = tr("Changes the background image darkening effect strength of the native shader loading dialog.\nThis may be used to improve readability and/or aesthetics.");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user