rsx: Make debug overlay dynamic

This commit is contained in:
kd-11 2020-12-14 20:26:20 +03:00 committed by kd-11
parent 0ef5743261
commit fb1c790350
7 changed files with 22 additions and 20 deletions

View file

@ -276,15 +276,6 @@ void GLGSRender::on_init_thread()
m_vao.element_array_buffer = *m_index_ring_buffer; m_vao.element_array_buffer = *m_index_ring_buffer;
if (g_cfg.video.overlay)
{
if (gl_caps.ARB_shader_draw_parameters_supported)
{
m_text_printer.init();
m_text_printer.set_enabled(true);
}
}
int image_unit = 0; int image_unit = 0;
for (auto &sampler : m_fs_sampler_states) for (auto &sampler : m_fs_sampler_states)
{ {

View file

@ -290,8 +290,14 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info)
} }
} }
if (g_cfg.video.overlay) if (g_cfg.video.overlay && gl::get_driver_caps().ARB_shader_draw_parameters_supported)
{ {
if (!m_text_printer.is_enabled())
{
m_text_printer.init();
m_text_printer.set_enabled(true);
}
// Disable depth test // Disable depth test
gl_state.depth_func(GL_ALWAYS); gl_state.depth_func(GL_ALWAYS);

View file

@ -118,6 +118,11 @@ namespace gl
enabled = state; enabled = state;
} }
bool is_enabled()
{
return enabled;
}
void print_text(int x, int y, int target_w, int target_h, const std::string &text, color4f color = { 0.3f, 1.f, 0.3f, 1.f }) void print_text(int x, int y, int target_w, int target_h, const std::string &text, color4f color = { 0.3f, 1.f, 0.3f, 1.f })
{ {
if (!enabled) return; if (!enabled) return;

View file

@ -478,7 +478,6 @@ namespace rsx
on_init_thread(); on_init_thread();
method_registers.init(); method_registers.init();
m_profiler.enabled = !!g_cfg.video.overlay;
if (!zcull_ctrl) if (!zcull_ctrl)
{ {
@ -2843,6 +2842,7 @@ namespace rsx
// Reset current stats // Reset current stats
m_frame_stats = {}; m_frame_stats = {};
m_profiler.enabled = !!g_cfg.video.overlay;
} }
void thread::request_emu_flip(u32 buffer) void thread::request_emu_flip(u32 buffer)

View file

@ -477,13 +477,6 @@ VKGSRender::VKGSRender() : GSRender()
vk::initialize_compiler_context(); vk::initialize_compiler_context();
vk::initialize_pipe_compiler(g_cfg.video.shader_compiler_threads_count); vk::initialize_pipe_compiler(g_cfg.video.shader_compiler_threads_count);
if (g_cfg.video.overlay)
{
auto key = vk::get_renderpass_key(m_swapchain->get_surface_format());
m_text_writer = std::make_unique<vk::text_writer>();
m_text_writer->init(*m_device, vk::get_renderpass(*m_device, key));
}
m_prog_buffer = std::make_unique<vk::program_cache> m_prog_buffer = std::make_unique<vk::program_cache>
( (
[this](const vk::pipeline_props& props, const RSXVertexProgram& vp, const RSXFragmentProgram& fp) [this](const vk::pipeline_props& props, const RSXVertexProgram& vp, const RSXFragmentProgram& fp)

View file

@ -190,7 +190,7 @@ void VKGSRender::frame_context_cleanup(vk::frame_context_t *ctx, bool free_resou
if (free_resources) if (free_resources)
{ {
if (g_cfg.video.overlay) if (m_text_writer)
{ {
m_text_writer->reset_descriptors(); m_text_writer->reset_descriptors();
} }
@ -730,6 +730,13 @@ void VKGSRender::flip(const rsx::display_flip_info_t& info)
if (g_cfg.video.overlay) if (g_cfg.video.overlay)
{ {
if (!m_text_writer)
{
auto key = vk::get_renderpass_key(m_swapchain->get_surface_format());
m_text_writer = std::make_unique<vk::text_writer>();
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->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->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, 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, 0, 36, direct_fbo->width(), direct_fbo->height(), fmt::format("draw call setup: %12dus", info.stats.setup_time));

View file

@ -126,7 +126,7 @@ struct cfg_root : cfg::node
cfg::_bool log_programs{ this, "Log shader programs" }; cfg::_bool log_programs{ this, "Log shader programs" };
cfg::_bool vsync{ this, "VSync" }; cfg::_bool vsync{ this, "VSync" };
cfg::_bool debug_output{ this, "Debug output" }; cfg::_bool debug_output{ this, "Debug output" };
cfg::_bool overlay{ this, "Debug overlay" }; cfg::_bool overlay{ this, "Debug overlay", false, true };
cfg::_bool gl_legacy_buffers{ this, "Use Legacy OpenGL Buffers" }; cfg::_bool gl_legacy_buffers{ this, "Use Legacy OpenGL Buffers" };
cfg::_bool use_gpu_texture_scaling{ this, "Use GPU texture scaling", false }; cfg::_bool use_gpu_texture_scaling{ this, "Use GPU texture scaling", false };
cfg::_bool stretch_to_display_area{ this, "Stretch To Display Area", false, true }; cfg::_bool stretch_to_display_area{ this, "Stretch To Display Area", false, true };