Skip to content

Commit

Permalink
overlays: move debug overlay to native overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
Megamouse committed Dec 18, 2023
1 parent a4bcba8 commit 37538af
Show file tree
Hide file tree
Showing 26 changed files with 196 additions and 955 deletions.
1 change: 1 addition & 0 deletions rpcs3/Emu/CMakeLists.txt
Expand Up @@ -487,6 +487,7 @@ target_sources(rpcs3_emu PRIVATE
RSX/Overlays/overlay_animation.cpp
RSX/Overlays/overlay_controls.cpp
RSX/Overlays/overlay_cursor.cpp
RSX/Overlays/overlay_debug_overlay.cpp
RSX/Overlays/overlay_edit_text.cpp
RSX/Overlays/overlay_fonts.cpp
RSX/Overlays/overlay_list_view.cpp
Expand Down
252 changes: 0 additions & 252 deletions rpcs3/Emu/RSX/Common/TextGlyphs.h

This file was deleted.

1 change: 0 additions & 1 deletion rpcs3/Emu/RSX/GL/GLGSRender.cpp
Expand Up @@ -505,7 +505,6 @@ void GLGSRender::on_exit()
}

m_null_textures.clear();
m_text_printer.close();
m_gl_texture_cache.destroy();
m_ui_renderer.destroy();
m_video_output_pass.destroy();
Expand Down
2 changes: 0 additions & 2 deletions rpcs3/Emu/RSX/GL/GLGSRender.h
Expand Up @@ -5,7 +5,6 @@
#include "GLTextureCache.h"
#include "GLRenderTargets.h"
#include "GLProgramBuffer.h"
#include "GLTextOut.h"
#include "GLOverlays.h"
#include "GLShaderInterpreter.h"

Expand Down Expand Up @@ -114,7 +113,6 @@ class GLGSRender : public GSRender, public ::rsx::reports::ZCULL_control

bool manually_flush_ring_buffers = false;

gl::text_writer m_text_printer;
gl::ui_overlay_renderer m_ui_renderer;
gl::video_out_calibration_pass m_video_output_pass;

Expand Down
57 changes: 21 additions & 36 deletions rpcs3/Emu/RSX/GL/GLPresent.cpp
Expand Up @@ -2,6 +2,7 @@
#include "GLGSRender.h"
#include "Emu/Cell/Modules/cellVideoOut.h"
#include "Emu/RSX/Overlays/overlay_manager.h"
#include "Emu/RSX/Overlays/overlay_debug_overlay.h"
#include "util/video_provider.h"

LOG_CHANNEL(screenshot_log, "SCREENSHOT");
Expand Down Expand Up @@ -323,36 +324,8 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info)
}
}

if (g_cfg.video.overlay && gl::get_driver_caps().ARB_shader_draw_parameters_supported)
if (g_cfg.video.overlay)
{
if (!m_text_printer.is_enabled())
{
m_text_printer.init();
m_text_printer.set_enabled(true);
}

// Disable depth test
gl_state.depth_func(GL_ALWAYS);

gl::screen.bind();
glViewport(0, 0, width, height);

m_text_printer.set_scale(m_frame->client_device_pixel_ratio());

int y_loc = 0;
const auto println = [&](const std::string& text)
{
m_text_printer.print_text(cmd, 4, y_loc, width, height, text);
y_loc += 16;
};

println(fmt::format("RSX Load: %3d%%", get_load()));
println(fmt::format("draw calls: %16d", info.stats.draw_calls));
println(fmt::format("draw call setup: %11dus", info.stats.setup_time));
println(fmt::format("vertex upload time: %8dus", info.stats.vertex_upload_time));
println(fmt::format("textures upload time: %6dus", info.stats.textures_upload_time));
println(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 texture_memory_size = m_gl_texture_cache.get_texture_memory_in_use() / (1024 * 1024);
const auto num_flushes = m_gl_texture_cache.get_num_flush_requests();
Expand All @@ -365,17 +338,29 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info)
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_copies_ellided = m_gl_texture_cache.get_texture_copies_ellided_this_frame();

println(fmt::format("Unreleased textures: %7d", num_dirty_textures));
println(fmt::format("Texture memory: %12dM", texture_memory_size));
println(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));
println(fmt::format("Texture uploads: %11u (%u from CPU - %02u%%, %u copies avoided)", num_texture_upload, num_texture_upload_miss, texture_upload_miss_ratio, texture_copies_ellided));

const auto vertex_cache_hit_count = (info.stats.vertex_cache_request_count - info.stats.vertex_cache_miss_count);
const auto vertex_cache_hit_ratio = info.stats.vertex_cache_request_count
? (vertex_cache_hit_count * 100) / info.stats.vertex_cache_request_count
: 0;
println(fmt::format("Vertex cache hits: %9u/%u (%u%%)", vertex_cache_hit_count, info.stats.vertex_cache_request_count, vertex_cache_hit_ratio));

rsx::overlays::set_debug_overlay_text(fmt::format(
"RSX Load: %3d%%\n"
"draw calls: %16d\n"
"draw call setup: %11dus\n"
"vertex upload time: %8dus\n"
"textures upload time: %6dus\n"
"draw call execution: %7dus\n"
"Unreleased textures: %7d\n"
"Texture memory: %12dM\n"
"Flush requests: %12d = %2d (%3d%%) hard faults, %2d unavoidable, %2d misprediction(s), %2d speculation(s)\n"
"Texture uploads: %11u (%u from CPU - %02u%%, %u copies avoided)\n"
"Vertex cache hits: %9u/%u (%u%%)",
get_load(), info.stats.draw_calls, info.stats.setup_time, info.stats.vertex_upload_time,
info.stats.textures_upload_time, info.stats.draw_exec_time, num_dirty_textures, texture_memory_size,
num_flushes, num_misses, cache_miss_ratio, num_unavoidable, num_mispredict, num_speculate,
num_texture_upload, num_texture_upload_miss, texture_upload_miss_ratio, texture_copies_ellided,
vertex_cache_hit_count, info.stats.vertex_cache_request_count, vertex_cache_hit_ratio)
);
}

if (gl::debug::g_vis_texture)
Expand Down

0 comments on commit 37538af

Please sign in to comment.