rsx: Add program cache lookup ellision rate to overlay

This commit is contained in:
kd-11 2025-03-08 19:35:47 +03:00 committed by kd-11
parent a1c8f3a528
commit eca86ad449
10 changed files with 56 additions and 13 deletions

View file

@ -717,7 +717,7 @@ error_code cellPadGetData(u32 port_no, vm::ptr<CellPadData> data)
pad_get_data(port_no, data.get_ptr());
if (g_cfg.io.debug_overlay && !g_cfg.video.overlay && port_no == 0)
if (g_cfg.io.debug_overlay && !g_cfg.video.debug_overlay && port_no == 0)
{
show_debug_overlay(*data, *pad, config);
}

View file

@ -59,6 +59,9 @@ namespace rsx
u32 vertex_cache_request_count;
u32 vertex_cache_miss_count;
u32 program_cache_lookups_total;
u32 program_cache_lookups_ellided;
framebuffer_statistics_t framebuffer_stats;
};

View file

@ -780,6 +780,19 @@ bool GLGSRender::load_program()
if (shadermode != shader_mode::interpreter_only) [[likely]]
{
if (g_cfg.video.debug_overlay)
{
m_frame_stats.program_cache_lookups_total += 2;
if (m_program_cache_hint.has_fragment_program())
{
m_frame_stats.program_cache_lookups_ellided++;
}
if (m_program_cache_hint.has_vertex_program())
{
m_frame_stats.program_cache_lookups_ellided++;
}
}
void* pipeline_properties = nullptr;
std::tie(m_program, m_vertex_prog, m_fragment_prog) = m_prog_buffer.get_graphics_pipeline(
&m_program_cache_hint,

View file

@ -382,7 +382,7 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info)
}
}
if (g_cfg.video.overlay)
if (g_cfg.video.debug_overlay)
{
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);
@ -400,6 +400,11 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info)
const auto vertex_cache_hit_ratio = info.stats.vertex_cache_request_count
? (vertex_cache_hit_count * 100) / info.stats.vertex_cache_request_count
: 0;
const auto program_cache_lookups = info.stats.program_cache_lookups_total;
const auto program_cache_ellided = info.stats.program_cache_lookups_ellided;
const auto program_cache_ellision_rate = program_cache_lookups
? (program_cache_ellided * 100) / program_cache_lookups
: 0;
rsx::overlays::set_debug_overlay_text(fmt::format(
"Internal Resolution: %s\n"
@ -413,13 +418,15 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info)
"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%%)",
"Vertex cache hits: %9u/%u (%u%%)\n"
"Program cache lookup ellision: %u/%u (%u%%)",
info.stats.framebuffer_stats.to_string(!backend_config.supports_hw_msaa),
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)
vertex_cache_hit_count, info.stats.vertex_cache_request_count, vertex_cache_hit_ratio,
program_cache_ellided, program_cache_lookups, program_cache_ellision_rate)
);
}

View file

@ -132,7 +132,7 @@ namespace rsx
home_menu_settings_debug::home_menu_settings_debug(s16 x, s16 y, u16 width, u16 height, bool use_separators, home_menu_page* parent)
: home_menu_settings_page(x, y, width, height, use_separators, parent, get_localized_string(localized_string_id::HOME_MENU_SETTINGS_DEBUG))
{
add_checkbox(&g_cfg.video.overlay, localized_string_id::HOME_MENU_SETTINGS_DEBUG_OVERLAY);
add_checkbox(&g_cfg.video.debug_overlay, localized_string_id::HOME_MENU_SETTINGS_DEBUG_OVERLAY);
add_checkbox(&g_cfg.io.debug_overlay, localized_string_id::HOME_MENU_SETTINGS_DEBUG_INPUT_OVERLAY);
add_checkbox(&g_cfg.video.disable_video_output, localized_string_id::HOME_MENU_SETTINGS_DEBUG_DISABLE_VIDEO_OUTPUT);
add_float_slider(&g_cfg.video.texture_lod_bias, localized_string_id::HOME_MENU_SETTINGS_DEBUG_TEXTURE_LOD_BIAS, "", 0.25f);

View file

@ -50,7 +50,7 @@ namespace rsx
{
auto overlay = manager->get<rsx::overlays::debug_overlay>();
if (g_cfg.video.overlay || g_cfg.io.debug_overlay)
if (g_cfg.video.debug_overlay || g_cfg.io.debug_overlay)
{
if (!overlay)
{
@ -66,7 +66,7 @@ namespace rsx
extern void set_debug_overlay_text(std::string&& text)
{
if (!g_cfg.misc.use_native_interface || (!g_cfg.video.overlay && !g_cfg.io.debug_overlay))
if (!g_cfg.misc.use_native_interface || (!g_cfg.video.debug_overlay && !g_cfg.io.debug_overlay))
return;
if (auto manager = g_fxo->try_get<rsx::overlays::display_manager>())

View file

@ -3151,7 +3151,7 @@ namespace rsx
// Reset current stats
m_frame_stats = {};
m_profiler.enabled = !!g_cfg.video.overlay;
m_profiler.enabled = !!g_cfg.video.debug_overlay;
}
f64 thread::get_cached_display_refresh_rate()

View file

@ -1959,6 +1959,19 @@ bool VKGSRender::load_program()
{
vk::enter_uninterruptible();
if (g_cfg.video.debug_overlay)
{
m_frame_stats.program_cache_lookups_total += 2;
if (m_program_cache_hint.has_fragment_program())
{
m_frame_stats.program_cache_lookups_ellided++;
}
if (m_program_cache_hint.has_vertex_program())
{
m_frame_stats.program_cache_lookups_ellided++;
}
}
// Load current program from cache
std::tie(m_program, m_vertex_prog, m_fragment_prog) = m_prog_buffer->get_graphics_pipeline(
&m_program_cache_hint,

View file

@ -766,7 +766,7 @@ void VKGSRender::flip(const rsx::display_flip_info_t& info)
}
const bool has_overlay = (m_overlay_manager && m_overlay_manager->has_visible());
if (g_cfg.video.overlay || has_overlay)
if (g_cfg.video.debug_overlay || has_overlay)
{
if (target_layout != VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL)
{
@ -809,7 +809,7 @@ void VKGSRender::flip(const rsx::display_flip_info_t& info)
}
}
if (g_cfg.video.overlay)
if (g_cfg.video.debug_overlay)
{
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);
@ -828,6 +828,11 @@ void VKGSRender::flip(const rsx::display_flip_info_t& info)
const auto vertex_cache_hit_ratio = info.stats.vertex_cache_request_count
? (vertex_cache_hit_count * 100) / info.stats.vertex_cache_request_count
: 0;
const auto program_cache_lookups = info.stats.program_cache_lookups_total;
const auto program_cache_ellided = info.stats.program_cache_lookups_ellided;
const auto program_cache_ellision_rate = program_cache_lookups
? (program_cache_ellided * 100) / program_cache_lookups
: 0;
rsx::overlays::set_debug_overlay_text(fmt::format(
"Internal Resolution: %s\n"
@ -844,14 +849,16 @@ void VKGSRender::flip(const rsx::display_flip_info_t& info)
"Temporary texture memory: %3dM\n"
"Flush requests: %13d = %2d (%3d%%) hard faults, %2d unavoidable, %2d misprediction(s), %2d speculation(s)\n"
"Texture uploads: %12u (%u from CPU - %02u%%, %u copies avoided)\n"
"Vertex cache hits: %10u/%u (%u%%)",
"Vertex cache hits: %10u/%u (%u%%)\n"
"Program cache lookup ellision: %u/%u (%u%%)",
info.stats.framebuffer_stats.to_string(!backend_config.supports_hw_msaa),
get_load(), info.stats.draw_calls, info.stats.submit_count, info.stats.setup_time, info.stats.vertex_upload_time,
info.stats.textures_upload_time, info.stats.draw_exec_time, info.stats.flip_time,
num_dirty_textures, texture_memory_size, tmp_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)
vertex_cache_hit_count, info.stats.vertex_cache_request_count, vertex_cache_hit_ratio,
program_cache_ellided, program_cache_lookups, program_cache_ellision_rate)
);
}

View file

@ -141,7 +141,7 @@ struct cfg_root : cfg::node
cfg::_bool log_programs{ this, "Log shader programs" };
cfg::_bool vsync{ this, "VSync" };
cfg::_bool debug_output{ this, "Debug output" };
cfg::_bool overlay{ this, "Debug overlay", false, true };
cfg::_bool debug_overlay{ this, "Debug overlay", false, true };
cfg::_bool renderdoc_compatiblity{ this, "Renderdoc Compatibility Mode" };
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 };