desktop: Send wgpu stats to tracy
This commit is contained in:
parent
5597535471
commit
2729da8ec0
|
@ -3,8 +3,8 @@ use crate::custom_event::RuffleEvent;
|
|||
use crate::gui::{GuiController, MENU_HEIGHT};
|
||||
use crate::player::{PlayerController, PlayerOptions};
|
||||
use crate::util::{
|
||||
get_screen_size, parse_url, pick_file, winit_key_to_char, winit_to_ruffle_key_code,
|
||||
winit_to_ruffle_text_control,
|
||||
get_screen_size, parse_url, pick_file, plot_stats_in_tracy, winit_key_to_char,
|
||||
winit_to_ruffle_key_code, winit_to_ruffle_text_control,
|
||||
};
|
||||
use anyhow::{Context, Error};
|
||||
use ruffle_core::{PlayerEvent, StageDisplayState};
|
||||
|
@ -136,10 +136,7 @@ impl App {
|
|||
} else {
|
||||
self.gui.borrow_mut().render(None);
|
||||
}
|
||||
#[cfg(feature = "tracy")]
|
||||
tracing_tracy::client::Client::running()
|
||||
.expect("tracy client must be running")
|
||||
.frame_mark();
|
||||
plot_stats_in_tracy(&self.gui.borrow().descriptors().wgpu_instance);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -342,3 +342,42 @@ pub fn pick_file(in_ui: bool, path: Option<PathBuf>) -> Option<PathBuf> {
|
|||
pub fn pick_file(_in_ui: bool, path: Option<PathBuf>) -> Option<PathBuf> {
|
||||
actually_pick_file(path)
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "tracy"))]
|
||||
pub fn plot_stats_in_tracy(_instance: &wgpu::Instance) {}
|
||||
|
||||
#[cfg(feature = "tracy")]
|
||||
pub fn plot_stats_in_tracy(instance: &wgpu::Instance) {
|
||||
use tracing_tracy::client::*;
|
||||
const BIND_GROUPS: PlotName = plot_name!("Bind Groups");
|
||||
const BUFFERS: PlotName = plot_name!("Buffers");
|
||||
const TEXTURES: PlotName = plot_name!("Textures");
|
||||
const TEXTURE_VIEWS: PlotName = plot_name!("Texture Views");
|
||||
|
||||
let tracy = Client::running().expect("tracy client must be running");
|
||||
let report = instance.generate_report();
|
||||
|
||||
#[allow(unused_mut)]
|
||||
let mut backend = None;
|
||||
#[cfg(not(any(target_os = "macos", target_os = "ios")))]
|
||||
{
|
||||
backend = backend.or(report.vulkan).or(report.gl);
|
||||
}
|
||||
#[cfg(windows)]
|
||||
{
|
||||
backend = backend.or(report.dx12).or(report.dx11);
|
||||
}
|
||||
#[cfg(any(target_os = "macos", target_os = "ios"))]
|
||||
{
|
||||
backend = backend.or(report.metal);
|
||||
}
|
||||
|
||||
if let Some(stats) = backend {
|
||||
tracy.plot(BIND_GROUPS, stats.bind_groups.num_occupied as f64);
|
||||
tracy.plot(BUFFERS, stats.buffers.num_occupied as f64);
|
||||
tracy.plot(TEXTURES, stats.textures.num_occupied as f64);
|
||||
tracy.plot(TEXTURE_VIEWS, stats.texture_views.num_occupied as f64);
|
||||
}
|
||||
|
||||
tracy.frame_mark();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue