mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-03 21:41:26 +12:00
scale debug overlay based on current dpi settings
Depending on the dpi settings, the debug overlay was almost unreadable. I also took the liberty to refactor some redundant client size calls and to add some margin to the left of the debug text.
This commit is contained in:
parent
44f0ca08e2
commit
83d3658ef0
8 changed files with 62 additions and 31 deletions
|
@ -178,9 +178,13 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info)
|
||||||
buffer_height = present_info.height;
|
buffer_height = present_info.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get window state
|
||||||
|
const int width = m_frame->client_width();
|
||||||
|
const int height = m_frame->client_height();
|
||||||
|
|
||||||
// Calculate blit coordinates
|
// Calculate blit coordinates
|
||||||
coordi aspect_ratio;
|
coordi aspect_ratio;
|
||||||
sizei csize(m_frame->client_width(), m_frame->client_height());
|
sizei csize(width, height);
|
||||||
sizei new_size = csize;
|
sizei new_size = csize;
|
||||||
|
|
||||||
if (!g_cfg.video.stretch_to_display_area)
|
if (!g_cfg.video.stretch_to_display_area)
|
||||||
|
@ -302,14 +306,16 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info)
|
||||||
gl_state.depth_func(GL_ALWAYS);
|
gl_state.depth_func(GL_ALWAYS);
|
||||||
|
|
||||||
gl::screen.bind();
|
gl::screen.bind();
|
||||||
glViewport(0, 0, m_frame->client_width(), m_frame->client_height());
|
glViewport(0, 0, width, height);
|
||||||
|
|
||||||
m_text_printer.print_text(0, 0, m_frame->client_width(), m_frame->client_height(), fmt::format("RSX Load: %3d%%", get_load()));
|
m_text_printer.set_scale(m_frame->client_device_pixel_ratio());
|
||||||
m_text_printer.print_text(0, 18, m_frame->client_width(), m_frame->client_height(), fmt::format("draw calls: %16d", info.stats.draw_calls));
|
|
||||||
m_text_printer.print_text(0, 36, m_frame->client_width(), m_frame->client_height(), fmt::format("draw call setup: %11dus", info.stats.setup_time));
|
m_text_printer.print_text(4, 0, width, height, fmt::format("RSX Load: %3d%%", get_load()));
|
||||||
m_text_printer.print_text(0, 54, m_frame->client_width(), m_frame->client_height(), fmt::format("vertex upload time: %8dus", info.stats.vertex_upload_time));
|
m_text_printer.print_text(4, 18, width, height, fmt::format("draw calls: %16d", info.stats.draw_calls));
|
||||||
m_text_printer.print_text(0, 72, m_frame->client_width(), m_frame->client_height(), fmt::format("textures upload time: %6dus", info.stats.textures_upload_time));
|
m_text_printer.print_text(4, 36, width, height, fmt::format("draw call setup: %11dus", info.stats.setup_time));
|
||||||
m_text_printer.print_text(0, 90, m_frame->client_width(), m_frame->client_height(), fmt::format("draw call execution: %7dus", info.stats.draw_exec_time));
|
m_text_printer.print_text(4, 54, width, height, fmt::format("vertex upload time: %8dus", info.stats.vertex_upload_time));
|
||||||
|
m_text_printer.print_text(4, 72, width, height, fmt::format("textures upload time: %6dus", info.stats.textures_upload_time));
|
||||||
|
m_text_printer.print_text(4, 90, width, height, fmt::format("draw call execution: %7dus", info.stats.draw_exec_time));
|
||||||
|
|
||||||
const auto num_dirty_textures = m_gl_texture_cache.get_unreleased_textures_count();
|
const auto num_dirty_textures = m_gl_texture_cache.get_unreleased_textures_count();
|
||||||
const auto texture_memory_size = m_gl_texture_cache.get_texture_memory_in_use() / (1024 * 1024);
|
const auto texture_memory_size = m_gl_texture_cache.get_texture_memory_in_use() / (1024 * 1024);
|
||||||
|
@ -322,10 +328,10 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info)
|
||||||
const auto num_texture_upload = m_gl_texture_cache.get_texture_upload_calls_this_frame();
|
const auto num_texture_upload = m_gl_texture_cache.get_texture_upload_calls_this_frame();
|
||||||
const auto num_texture_upload_miss = m_gl_texture_cache.get_texture_upload_misses_this_frame();
|
const auto num_texture_upload_miss = m_gl_texture_cache.get_texture_upload_misses_this_frame();
|
||||||
const auto texture_upload_miss_ratio = m_gl_texture_cache.get_texture_upload_miss_percentage();
|
const auto texture_upload_miss_ratio = m_gl_texture_cache.get_texture_upload_miss_percentage();
|
||||||
m_text_printer.print_text(0, 126, m_frame->client_width(), m_frame->client_height(), fmt::format("Unreleased textures: %7d", num_dirty_textures));
|
m_text_printer.print_text(4, 126, width, height, fmt::format("Unreleased textures: %7d", num_dirty_textures));
|
||||||
m_text_printer.print_text(0, 144, m_frame->client_width(), m_frame->client_height(), fmt::format("Texture memory: %12dM", texture_memory_size));
|
m_text_printer.print_text(4, 144, width, height, fmt::format("Texture memory: %12dM", texture_memory_size));
|
||||||
m_text_printer.print_text(0, 162, m_frame->client_width(), m_frame->client_height(), fmt::format("Flush requests: %12d = %2d (%3d%%) hard faults, %2d unavoidable, %2d misprediction(s), %2d speculation(s)", num_flushes, num_misses, cache_miss_ratio, num_unavoidable, num_mispredict, num_speculate));
|
m_text_printer.print_text(4, 162, width, height, fmt::format("Flush requests: %12d = %2d (%3d%%) hard faults, %2d unavoidable, %2d misprediction(s), %2d speculation(s)", num_flushes, num_misses, cache_miss_ratio, num_unavoidable, num_mispredict, num_speculate));
|
||||||
m_text_printer.print_text(0, 180, m_frame->client_width(), m_frame->client_height(), fmt::format("Texture uploads: %15u (%u from CPU - %02u%%)", num_texture_upload, num_texture_upload_miss, texture_upload_miss_ratio));
|
m_text_printer.print_text(4, 180, width, height, fmt::format("Texture uploads: %15u (%u from CPU - %02u%%)", num_texture_upload, num_texture_upload_miss, texture_upload_miss_ratio));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_frame->flip(m_context);
|
m_frame->flip(m_context);
|
||||||
|
|
|
@ -25,6 +25,8 @@ namespace gl
|
||||||
bool initialized = false;
|
bool initialized = false;
|
||||||
bool enabled = false;
|
bool enabled = false;
|
||||||
|
|
||||||
|
double m_scale = 1.0;
|
||||||
|
|
||||||
void init_program()
|
void init_program()
|
||||||
{
|
{
|
||||||
std::string vs =
|
std::string vs =
|
||||||
|
@ -138,11 +140,11 @@ namespace gl
|
||||||
char *s = const_cast<char *>(text.c_str());
|
char *s = const_cast<char *>(text.c_str());
|
||||||
|
|
||||||
//Y is in raster coordinates: convert to bottom-left origin
|
//Y is in raster coordinates: convert to bottom-left origin
|
||||||
y = (target_h - y - 16);
|
y = ((target_h / m_scale) - y - 16);
|
||||||
|
|
||||||
//Compress [0, w] and [0, h] into range [-1, 1]
|
//Compress [0, w] and [0, h] into range [-1, 1]
|
||||||
float scale_x = 2.f / target_w;
|
float scale_x = m_scale * 2.f / target_w;
|
||||||
float scale_y = 2.f / target_h;
|
float scale_y = m_scale * 2.f / target_h;
|
||||||
|
|
||||||
float base_offset = 0.f;
|
float base_offset = 0.f;
|
||||||
shader_offsets.reserve(text.length() * 2);
|
shader_offsets.reserve(text.length() * 2);
|
||||||
|
@ -207,5 +209,11 @@ namespace gl
|
||||||
initialized = false;
|
initialized = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set_scale(double scale)
|
||||||
|
{
|
||||||
|
// Restrict scale to 2. The dots are gonna be too sparse otherwise.
|
||||||
|
m_scale = std::min(scale, 2.0);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ public:
|
||||||
virtual void flip(draw_context_t ctx, bool skip_frame = false) = 0;
|
virtual void flip(draw_context_t ctx, bool skip_frame = false) = 0;
|
||||||
virtual int client_width() = 0;
|
virtual int client_width() = 0;
|
||||||
virtual int client_height() = 0;
|
virtual int client_height() = 0;
|
||||||
|
virtual double client_device_pixel_ratio() const = 0;
|
||||||
|
|
||||||
virtual display_handle_t handle() const = 0;
|
virtual display_handle_t handle() const = 0;
|
||||||
|
|
||||||
|
|
|
@ -741,13 +741,15 @@ void VKGSRender::flip(const rsx::display_flip_info_t& info)
|
||||||
m_text_writer->init(*m_device, vk::get_renderpass(*m_device, key));
|
m_text_writer->init(*m_device, vk::get_renderpass(*m_device, key));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_text_writer->print_text(*m_current_command_buffer, *direct_fbo, 0, 0, direct_fbo->width(), direct_fbo->height(), fmt::format("RSX Load: %3d%%", get_load()));
|
m_text_writer->set_scale(m_frame->client_device_pixel_ratio());
|
||||||
m_text_writer->print_text(*m_current_command_buffer, *direct_fbo, 0, 18, direct_fbo->width(), direct_fbo->height(), fmt::format("draw calls: %17d", info.stats.draw_calls));
|
|
||||||
m_text_writer->print_text(*m_current_command_buffer, *direct_fbo, 0, 36, direct_fbo->width(), direct_fbo->height(), fmt::format("draw call setup: %12dus", info.stats.setup_time));
|
m_text_writer->print_text(*m_current_command_buffer, *direct_fbo, 4, 0, direct_fbo->width(), direct_fbo->height(), fmt::format("RSX Load: %3d%%", get_load()));
|
||||||
m_text_writer->print_text(*m_current_command_buffer, *direct_fbo, 0, 54, direct_fbo->width(), direct_fbo->height(), fmt::format("vertex upload time: %9dus", info.stats.vertex_upload_time));
|
m_text_writer->print_text(*m_current_command_buffer, *direct_fbo, 4, 18, direct_fbo->width(), direct_fbo->height(), fmt::format("draw calls: %17d", info.stats.draw_calls));
|
||||||
m_text_writer->print_text(*m_current_command_buffer, *direct_fbo, 0, 72, direct_fbo->width(), direct_fbo->height(), fmt::format("texture upload time: %8dus", info.stats.textures_upload_time));
|
m_text_writer->print_text(*m_current_command_buffer, *direct_fbo, 4, 36, direct_fbo->width(), direct_fbo->height(), fmt::format("draw call setup: %12dus", info.stats.setup_time));
|
||||||
m_text_writer->print_text(*m_current_command_buffer, *direct_fbo, 0, 90, direct_fbo->width(), direct_fbo->height(), fmt::format("draw call execution: %8dus", info.stats.draw_exec_time));
|
m_text_writer->print_text(*m_current_command_buffer, *direct_fbo, 4, 54, direct_fbo->width(), direct_fbo->height(), fmt::format("vertex upload time: %9dus", info.stats.vertex_upload_time));
|
||||||
m_text_writer->print_text(*m_current_command_buffer, *direct_fbo, 0, 108, direct_fbo->width(), direct_fbo->height(), fmt::format("submit and flip: %12dus", info.stats.flip_time));
|
m_text_writer->print_text(*m_current_command_buffer, *direct_fbo, 4, 72, direct_fbo->width(), direct_fbo->height(), fmt::format("texture upload time: %8dus", info.stats.textures_upload_time));
|
||||||
|
m_text_writer->print_text(*m_current_command_buffer, *direct_fbo, 4, 90, direct_fbo->width(), direct_fbo->height(), fmt::format("draw call execution: %8dus", info.stats.draw_exec_time));
|
||||||
|
m_text_writer->print_text(*m_current_command_buffer, *direct_fbo, 4, 108, direct_fbo->width(), direct_fbo->height(), fmt::format("submit and flip: %12dus", info.stats.flip_time));
|
||||||
|
|
||||||
const auto num_dirty_textures = m_texture_cache.get_unreleased_textures_count();
|
const auto num_dirty_textures = m_texture_cache.get_unreleased_textures_count();
|
||||||
const auto texture_memory_size = m_texture_cache.get_texture_memory_in_use() / (1024 * 1024);
|
const auto texture_memory_size = m_texture_cache.get_texture_memory_in_use() / (1024 * 1024);
|
||||||
|
@ -761,11 +763,11 @@ void VKGSRender::flip(const rsx::display_flip_info_t& info)
|
||||||
const auto num_texture_upload = m_texture_cache.get_texture_upload_calls_this_frame();
|
const auto num_texture_upload = m_texture_cache.get_texture_upload_calls_this_frame();
|
||||||
const auto num_texture_upload_miss = m_texture_cache.get_texture_upload_misses_this_frame();
|
const auto num_texture_upload_miss = m_texture_cache.get_texture_upload_misses_this_frame();
|
||||||
const auto texture_upload_miss_ratio = m_texture_cache.get_texture_upload_miss_percentage();
|
const auto texture_upload_miss_ratio = m_texture_cache.get_texture_upload_miss_percentage();
|
||||||
m_text_writer->print_text(*m_current_command_buffer, *direct_fbo, 0, 144, direct_fbo->width(), direct_fbo->height(), fmt::format("Unreleased textures: %8d", num_dirty_textures));
|
m_text_writer->print_text(*m_current_command_buffer, *direct_fbo, 4, 144, direct_fbo->width(), direct_fbo->height(), fmt::format("Unreleased textures: %8d", num_dirty_textures));
|
||||||
m_text_writer->print_text(*m_current_command_buffer, *direct_fbo, 0, 162, direct_fbo->width(), direct_fbo->height(), fmt::format("Texture cache memory: %7dM", texture_memory_size));
|
m_text_writer->print_text(*m_current_command_buffer, *direct_fbo, 4, 162, direct_fbo->width(), direct_fbo->height(), fmt::format("Texture cache memory: %7dM", texture_memory_size));
|
||||||
m_text_writer->print_text(*m_current_command_buffer, *direct_fbo, 0, 180, direct_fbo->width(), direct_fbo->height(), fmt::format("Temporary texture memory: %3dM", tmp_texture_memory_size));
|
m_text_writer->print_text(*m_current_command_buffer, *direct_fbo, 4, 180, direct_fbo->width(), direct_fbo->height(), fmt::format("Temporary texture memory: %3dM", tmp_texture_memory_size));
|
||||||
m_text_writer->print_text(*m_current_command_buffer, *direct_fbo, 0, 198, direct_fbo->width(), direct_fbo->height(), fmt::format("Flush requests: %13d = %2d (%3d%%) hard faults, %2d unavoidable, %2d misprediction(s), %2d speculation(s)", num_flushes, num_misses, cache_miss_ratio, num_unavoidable, num_mispredict, num_speculate));
|
m_text_writer->print_text(*m_current_command_buffer, *direct_fbo, 4, 198, direct_fbo->width(), direct_fbo->height(), fmt::format("Flush requests: %13d = %2d (%3d%%) hard faults, %2d unavoidable, %2d misprediction(s), %2d speculation(s)", num_flushes, num_misses, cache_miss_ratio, num_unavoidable, num_mispredict, num_speculate));
|
||||||
m_text_writer->print_text(*m_current_command_buffer, *direct_fbo, 0, 216, direct_fbo->width(), direct_fbo->height(), fmt::format("Texture uploads: %14u (%u from CPU - %02u%%)", num_texture_upload, num_texture_upload_miss, texture_upload_miss_ratio));
|
m_text_writer->print_text(*m_current_command_buffer, *direct_fbo, 4, 216, direct_fbo->width(), direct_fbo->height(), fmt::format("Texture uploads: %14u (%u from CPU - %02u%%)", num_texture_upload, num_texture_upload_miss, texture_upload_miss_ratio));
|
||||||
}
|
}
|
||||||
|
|
||||||
direct_fbo->release();
|
direct_fbo->release();
|
||||||
|
|
|
@ -33,6 +33,8 @@ namespace vk
|
||||||
u32 m_uniform_buffer_offset = 0;
|
u32 m_uniform_buffer_offset = 0;
|
||||||
u32 m_uniform_buffer_size = 0;
|
u32 m_uniform_buffer_size = 0;
|
||||||
|
|
||||||
|
double m_scale = 1.0;
|
||||||
|
|
||||||
bool initialized = false;
|
bool initialized = false;
|
||||||
std::unordered_map<u8, std::pair<u32, u32>> m_offsets;
|
std::unordered_map<u8, std::pair<u32, u32>> m_offsets;
|
||||||
|
|
||||||
|
@ -293,12 +295,12 @@ namespace vk
|
||||||
char *s = const_cast<char *>(text.c_str());
|
char *s = const_cast<char *>(text.c_str());
|
||||||
|
|
||||||
//Y is in raster coordinates: convert to bottom-left origin
|
//Y is in raster coordinates: convert to bottom-left origin
|
||||||
y = (target_h - y - 16);
|
y = ((target_h / m_scale) - y - 16);
|
||||||
|
|
||||||
//Compress [0, w] and [0, h] into range [-1, 1]
|
//Compress [0, w] and [0, h] into range [-1, 1]
|
||||||
//Flip Y scaling
|
//Flip Y scaling
|
||||||
float scale_x = +2.f / target_w;
|
float scale_x = m_scale * +2.f / target_w;
|
||||||
float scale_y = -2.f / target_h;
|
float scale_y = m_scale * -2.f / target_h;
|
||||||
|
|
||||||
float base_offset = 0.f;
|
float base_offset = 0.f;
|
||||||
shader_offsets.reserve(text.length() * 2);
|
shader_offsets.reserve(text.length() * 2);
|
||||||
|
@ -366,5 +368,11 @@ namespace vk
|
||||||
m_descriptor_pool.reset(0);
|
m_descriptor_pool.reset(0);
|
||||||
m_used_descriptors = 0;
|
m_used_descriptors = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set_scale(double scale)
|
||||||
|
{
|
||||||
|
// Restrict scale to 2. The dots are gonna be too sparse otherwise.
|
||||||
|
m_scale = std::min(scale, 2.0);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -400,6 +400,11 @@ int gs_frame::client_height()
|
||||||
return height() * devicePixelRatio();
|
return height() * devicePixelRatio();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double gs_frame::client_device_pixel_ratio() const
|
||||||
|
{
|
||||||
|
return devicePixelRatio();
|
||||||
|
}
|
||||||
|
|
||||||
void gs_frame::flip(draw_context_t, bool /*skip_frame*/)
|
void gs_frame::flip(draw_context_t, bool /*skip_frame*/)
|
||||||
{
|
{
|
||||||
static Timer fps_t;
|
static Timer fps_t;
|
||||||
|
|
|
@ -90,6 +90,7 @@ protected:
|
||||||
void flip(draw_context_t context, bool skip_frame = false) override;
|
void flip(draw_context_t context, bool skip_frame = false) override;
|
||||||
int client_width() override;
|
int client_width() override;
|
||||||
int client_height() override;
|
int client_height() override;
|
||||||
|
double client_device_pixel_ratio() const override;
|
||||||
|
|
||||||
bool event(QEvent* ev) override;
|
bool event(QEvent* ev) override;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue