mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-30 03:32:55 +00:00
rsx: Add some texture upload statistics to the texture cache
This commit is contained in:
parent
fb1c790350
commit
d3686dbb75
@ -332,6 +332,8 @@ namespace rsx
|
||||
atomic_t<u32> m_misses_this_frame = { 0 };
|
||||
atomic_t<u32> m_speculations_this_frame = { 0 };
|
||||
atomic_t<u32> m_unavoidable_hard_faults_this_frame = { 0 };
|
||||
atomic_t<u32> m_texture_upload_calls_this_frame = { 0 };
|
||||
atomic_t<u32> m_texture_upload_misses_this_frame = { 0 };
|
||||
static const u32 m_predict_max_flushes_per_frame = 50; // Above this number the predictions are disabled
|
||||
|
||||
// Invalidation
|
||||
@ -1810,6 +1812,8 @@ namespace rsx
|
||||
template <typename RsxTextureType, typename surface_store_type, typename ...Args>
|
||||
sampled_image_descriptor upload_texture(commandbuffer_type& cmd, RsxTextureType& tex, surface_store_type& m_rtts, Args&&... extras)
|
||||
{
|
||||
m_texture_upload_calls_this_frame++;
|
||||
|
||||
image_section_attributes_t attributes{};
|
||||
texture_cache_search_options options{};
|
||||
attributes.address = rsx::get_address(tex.offset(), tex.location());
|
||||
@ -2004,6 +2008,8 @@ namespace rsx
|
||||
}
|
||||
|
||||
// Do direct upload from CPU as the last resort
|
||||
m_texture_upload_misses_this_frame++;
|
||||
|
||||
const auto subresources_layout = get_subresources_layout(tex);
|
||||
const auto format_class = classify_format(attributes.gcm_format);
|
||||
|
||||
@ -2961,6 +2967,8 @@ namespace rsx
|
||||
m_misses_this_frame.store(0u);
|
||||
m_speculations_this_frame.store(0u);
|
||||
m_unavoidable_hard_faults_this_frame.store(0u);
|
||||
m_texture_upload_calls_this_frame.store(0u);
|
||||
m_texture_upload_misses_this_frame.store(0u);
|
||||
}
|
||||
|
||||
void on_flush()
|
||||
@ -3028,5 +3036,20 @@ namespace rsx
|
||||
const auto num_flushes = m_flushes_this_frame.load();
|
||||
return (num_flushes == 0u) ? 0.f : static_cast<f32>(m_misses_this_frame.load()) / num_flushes;
|
||||
}
|
||||
|
||||
u32 get_texture_upload_calls_this_frame()
|
||||
{
|
||||
return m_texture_upload_calls_this_frame;
|
||||
}
|
||||
|
||||
u32 get_texture_upload_misses_this_frame()
|
||||
{
|
||||
return m_texture_upload_misses_this_frame;
|
||||
}
|
||||
|
||||
u32 get_texture_upload_miss_percentage()
|
||||
{
|
||||
return (m_texture_upload_calls_this_frame)? (m_texture_upload_misses_this_frame * 100 / m_texture_upload_calls_this_frame) : 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -319,9 +319,13 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info)
|
||||
const auto num_misses = m_gl_texture_cache.get_num_cache_misses();
|
||||
const auto num_unavoidable = m_gl_texture_cache.get_num_unavoidable_hard_faults();
|
||||
const auto cache_miss_ratio = static_cast<u32>(ceil(m_gl_texture_cache.get_cache_miss_ratio() * 100));
|
||||
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 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(0, 144, m_frame->client_width(), m_frame->client_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(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_frame->flip(m_context);
|
||||
|
@ -754,10 +754,14 @@ void VKGSRender::flip(const rsx::display_flip_info_t& info)
|
||||
const auto num_misses = m_texture_cache.get_num_cache_misses();
|
||||
const auto num_unavoidable = m_texture_cache.get_num_unavoidable_hard_faults();
|
||||
const auto cache_miss_ratio = static_cast<u32>(ceil(m_texture_cache.get_cache_miss_ratio() * 100));
|
||||
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 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, 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, 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, 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, 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));
|
||||
}
|
||||
|
||||
direct_fbo->release();
|
||||
|
Loading…
x
Reference in New Issue
Block a user