Use less verbose span names when the tracy feature is off

This commit is contained in:
Imbris 2020-09-07 00:59:16 -04:00
parent 7efbc74551
commit f39d1e9bb5
40 changed files with 112 additions and 73 deletions

View File

@ -32,7 +32,7 @@ impl Clock {
pub fn get_avg_delta(&self) -> Duration { Duration::from_secs_f64(self.running_tps_average) } pub fn get_avg_delta(&self) -> Duration { Duration::from_secs_f64(self.running_tps_average) }
pub fn tick(&mut self, tgt: Duration) { pub fn tick(&mut self, tgt: Duration) {
span!(_guard, "Clock::tick"); span!(_guard, "tick", "Clock::tick");
let delta = Instant::now().duration_since(self.last_sys_time); let delta = Instant::now().duration_since(self.last_sys_time);
// Attempt to sleep to fill the gap. // Attempt to sleep to fill the gap.

View File

@ -328,7 +328,7 @@ impl Chaser {
where where
V: BaseVol<Vox = Block> + ReadVol, V: BaseVol<Vox = Block> + ReadVol,
{ {
span!(_guard, "Chaser::chase"); span!(_guard, "chase", "Chaser::chase");
let pos_to_tgt = pos.distance(tgt); let pos_to_tgt = pos.distance(tgt);
// If we're already close to the target then there's nothing to do // If we're already close to the target then there's nothing to do

View File

@ -55,7 +55,7 @@ impl<'a, V: ReadVol, F: RayUntil<V::Vox>, G: RayForEach<V::Vox>> Ray<'a, V, F, G
} }
pub fn cast(mut self) -> (f32, Result<Option<&'a V::Vox>, V::Error>) { pub fn cast(mut self) -> (f32, Result<Option<&'a V::Vox>, V::Error>) {
span!(_guard, "Ray::cast"); span!(_guard, "cast", "Ray::cast");
// TODO: Fully test this! // TODO: Fully test this!
const PLANCK: f32 = 0.001; const PLANCK: f32 = 0.001;

View File

@ -107,7 +107,7 @@ impl RegionMap {
// TODO maintain within a system? // TODO maintain within a system?
// TODO special case large entities // TODO special case large entities
pub fn tick(&mut self, pos: ReadStorage<Pos>, vel: ReadStorage<Vel>, entities: Entities) { pub fn tick(&mut self, pos: ReadStorage<Pos>, vel: ReadStorage<Vel>, entities: Entities) {
span!(_guard, "Region::tick"); span!(_guard, "tick", "Region::tick");
self.tick += 1; self.tick += 1;
// Clear events within each region // Clear events within each region
for i in 0..self.regions.len() { for i in 0..self.regions.len() {

View File

@ -84,7 +84,7 @@ impl<'a> System<'a> for Sys {
invites, invites,
): Self::SystemData, ): Self::SystemData,
) { ) {
span!(_guard, "agent::Sys::run"); span!(_guard, "run", "agent::Sys::run");
for ( for (
entity, entity,
pos, pos,

View File

@ -184,7 +184,7 @@ impl<'a> System<'a> for Sys {
mountings, mountings,
): Self::SystemData, ): Self::SystemData,
) { ) {
span!(_guard, "character_behavior::Sys::run"); span!(_guard, "run", "character_behavior::Sys::run");
let mut server_emitter = server_bus.emitter(); let mut server_emitter = server_bus.emitter();
let mut local_emitter = local_bus.emitter(); let mut local_emitter = local_bus.emitter();

View File

@ -53,7 +53,7 @@ impl<'a> System<'a> for Sys {
character_states, character_states,
): Self::SystemData, ): Self::SystemData,
) { ) {
span!(_guard, "combat::Sys::run"); span!(_guard, "run", "combat::Sys::run");
let mut server_emitter = server_bus.emitter(); let mut server_emitter = server_bus.emitter();
let mut local_emitter = local_bus.emitter(); let mut local_emitter = local_bus.emitter();
// Attacks // Attacks

View File

@ -44,7 +44,7 @@ impl<'a> System<'a> for Sys {
uids, uids,
): Self::SystemData, ): Self::SystemData,
) { ) {
span!(_guard, "controller::Sys::run"); span!(_guard, "run", "controller::Sys::run");
let mut server_emitter = server_bus.emitter(); let mut server_emitter = server_bus.emitter();
for (entity, _uid, controller, character_state) in for (entity, _uid, controller, character_state) in

View File

@ -37,7 +37,7 @@ impl<'a> System<'a> for Sys {
mut orientations, mut orientations,
): Self::SystemData, ): Self::SystemData,
) { ) {
span!(_guard, "mount::Sys::run"); span!(_guard, "run", "mount::Sys::run");
// Mounted entities. // Mounted entities.
for (entity, mut mount_states) in (&entities, &mut mount_state.restrict_mut()).join() { for (entity, mut mount_states) in (&entities, &mut mount_state.restrict_mut()).join() {
match mount_states.get_unchecked() { match mount_states.get_unchecked() {

View File

@ -95,7 +95,7 @@ impl<'a> System<'a> for Sys {
projectiles, projectiles,
): Self::SystemData, ): Self::SystemData,
) { ) {
span!(_guard, "phys::Sys::run"); span!(_guard, "run", "phys::Sys::run");
let mut event_emitter = event_bus.emitter(); let mut event_emitter = event_bus.emitter();
// Add/reset physics state components // Add/reset physics state components

View File

@ -49,7 +49,7 @@ impl<'a> System<'a> for Sys {
loadouts, loadouts,
): Self::SystemData, ): Self::SystemData,
) { ) {
span!(_guard, "projectile::Sys::run"); span!(_guard, "run", "projectile::Sys::run");
let mut local_emitter = local_bus.emitter(); let mut local_emitter = local_bus.emitter();
let mut server_emitter = server_bus.emitter(); let mut server_emitter = server_bus.emitter();

View File

@ -25,7 +25,7 @@ impl<'a> System<'a> for Sys {
&mut self, &mut self,
(entities, dt, server_event_bus, character_states, mut stats, mut energies): Self::SystemData, (entities, dt, server_event_bus, character_states, mut stats, mut energies): Self::SystemData,
) { ) {
span!(_guard, "stats::Sys::run"); span!(_guard, "run", "stats::Sys::run");
let mut server_event_emitter = server_event_bus.emitter(); let mut server_event_emitter = server_event_bus.emitter();
// Increment last change timer // Increment last change timer

View File

@ -40,6 +40,12 @@ macro_rules! span {
0, 0,
); );
}; };
($guard_name:tt, $no_tracy_name:expr, $tracy_name:expr) => {
#[cfg(not(feature = "tracy"))]
$crate::span!($guard_name, $no_tracy_name);
#[cfg(feature = "tracy")]
$crate::span!($guard_name, $tracy_name);
};
} }
/// There's no guard, but really this is actually the guard /// There's no guard, but really this is actually the guard

View File

@ -39,7 +39,7 @@ pub enum Event {
impl Server { impl Server {
pub fn handle_events(&mut self) -> Vec<Event> { pub fn handle_events(&mut self) -> Vec<Event> {
span!(_guard, "Server::handle_events"); span!(_guard, "handle_events", "Server::handle_events");
let mut frontend_events = Vec::new(); let mut frontend_events = Vec::new();
let mut requested_chunks = Vec::new(); let mut requested_chunks = Vec::new();

View File

@ -78,7 +78,7 @@ impl<'a> System<'a> for Sys {
trackers, trackers,
): Self::SystemData, ): Self::SystemData,
) { ) {
span!(_guard, "entity_sync::Sys::run"); span!(_guard, "run", "entity_sync::Sys::run");
timer.start(); timer.start();
let tick = tick.0; let tick = tick.0;

View File

@ -25,7 +25,7 @@ impl<'a> System<'a> for Sys {
&mut self, &mut self,
(entities, mut invites, mut pending_invites, mut clients, uids, mut timer): Self::SystemData, (entities, mut invites, mut pending_invites, mut clients, uids, mut timer): Self::SystemData,
) { ) {
span!(_guard, "invite_timeout::Sys::run"); span!(_guard, "run", "invite_timeout::Sys::run");
timer.start(); timer.start();
let now = std::time::Instant::now(); let now = std::time::Instant::now();

View File

@ -455,7 +455,7 @@ impl<'a> System<'a> for Sys {
alias_validator, alias_validator,
): Self::SystemData, ): Self::SystemData,
) { ) {
span!(_guard, "message::Sys::run"); span!(_guard, "run", "message::Sys::run");
timer.start(); timer.start();
let mut server_emitter = server_event_bus.emitter(); let mut server_emitter = server_event_bus.emitter();

View File

@ -24,7 +24,7 @@ impl<'a> System<'a> for Sys {
&mut self, &mut self,
(entities, _dt, server_bus, positions, velocities, physics_states, mut objects): Self::SystemData, (entities, _dt, server_bus, positions, velocities, physics_states, mut objects): Self::SystemData,
) { ) {
span!(_guard, "object::Sys::run"); span!(_guard, "run", "object::Sys::run");
let mut server_emitter = server_bus.emitter(); let mut server_emitter = server_bus.emitter();
// Objects // Objects

View File

@ -34,7 +34,7 @@ impl<'a> System<'a> for Sys {
mut timer, mut timer,
): Self::SystemData, ): Self::SystemData,
) { ) {
span!(_guard, "persistence::Sys::run"); span!(_guard, "run", "persistence::Sys::run");
if scheduler.should_run() { if scheduler.should_run() {
timer.start(); timer.start();
updater.batch_update( updater.batch_update(

View File

@ -27,7 +27,7 @@ impl<'a> System<'a> for Sys {
); );
fn run(&mut self, (mut timer, comps, mut trackers): Self::SystemData) { fn run(&mut self, (mut timer, comps, mut trackers): Self::SystemData) {
span!(_guard, "sentinel::Sys::run"); span!(_guard, "run", "sentinel::Sys::run");
timer.start(); timer.start();
record_changes(&comps, &mut trackers); record_changes(&comps, &mut trackers);

View File

@ -56,7 +56,7 @@ impl<'a> System<'a> for Sys {
tracked_comps, tracked_comps,
): Self::SystemData, ): Self::SystemData,
) { ) {
span!(_guard, "subscription::Sys::run"); span!(_guard, "run", "subscription::Sys::run");
timer.start(); timer.start();
// To update subscriptions // To update subscriptions

View File

@ -56,7 +56,7 @@ impl<'a> System<'a> for Sys {
mut clients, mut clients,
): Self::SystemData, ): Self::SystemData,
) { ) {
span!(_guard, "terrain::Sys::run"); span!(_guard, "run", "terrain::Sys::run");
timer.start(); timer.start();
let mut server_emitter = server_event_bus.emitter(); let mut server_emitter = server_event_bus.emitter();

View File

@ -27,7 +27,7 @@ impl<'a> System<'a> for Sys {
&mut self, &mut self,
(terrain, terrain_changes, mut timer, positions, players, mut clients): Self::SystemData, (terrain, terrain_changes, mut timer, positions, players, mut clients): Self::SystemData,
) { ) {
span!(_guard, "terrain_sync::Sys::run"); span!(_guard, "run", "terrain_sync::Sys::run");
timer.start(); timer.start();
// Sync changed chunks // Sync changed chunks

View File

@ -31,7 +31,7 @@ impl<'a> System<'a> for Sys {
&mut self, &mut self,
(entities, positions, players, waypoint_areas, mut waypoints, mut clients, time, mut timer): Self::SystemData, (entities, positions, players, waypoint_areas, mut waypoints, mut clients, time, mut timer): Self::SystemData,
) { ) {
span!(_guard, "waypoint::Sys::run"); span!(_guard, "run", "waypoint::Sys::run");
timer.start(); timer.start();
for (entity, player_pos, _, client) in for (entity, player_pos, _, client) in

View File

@ -688,7 +688,7 @@ impl Hud {
info: HudInfo, info: HudInfo,
camera: &Camera, camera: &Camera,
) -> Vec<Event> { ) -> Vec<Event> {
span!(_guard, "Hud::update_layout"); span!(_guard, "update_layout", "Hud::update_layout");
let mut events = std::mem::replace(&mut self.events, Vec::new()); let mut events = std::mem::replace(&mut self.events, Vec::new());
let (ref mut ui_widgets, ref mut tooltip_manager) = self.ui.set_widgets(); let (ref mut ui_widgets, ref mut tooltip_manager) = self.ui.set_widgets();
// pulse time for pulsating elements // pulse time for pulsating elements
@ -2533,7 +2533,7 @@ impl Hud {
dt: Duration, dt: Duration,
info: HudInfo, info: HudInfo,
) -> Vec<Event> { ) -> Vec<Event> {
span!(_guard, "Hud::maintain"); span!(_guard, "maintain", "Hud::maintain");
// conrod eats tabs. Un-eat a tabstop so tab completion can work // conrod eats tabs. Un-eat a tabstop so tab completion can work
if self.ui.ui.global_input().events().any(|event| { if self.ui.ui.global_input().events().any(|event| {
use conrod_core::{event, input}; use conrod_core::{event, input};
@ -2578,7 +2578,7 @@ impl Hud {
} }
pub fn render(&self, renderer: &mut Renderer, globals: &Consts<Globals>) { pub fn render(&self, renderer: &mut Renderer, globals: &Consts<Globals>) {
span!(_guard, "Hud::render"); span!(_guard, "render", "Hud::render");
// Don't show anything if the UI is toggled off. // Don't show anything if the UI is toggled off.
if self.show.ui { if self.show.ui {
self.ui.render(renderer, Some(globals)); self.ui.render(renderer, Some(globals));

View File

@ -10,7 +10,7 @@ use crate::{
Direction, GlobalState, PlayState, PlayStateResult, Direction, GlobalState, PlayState, PlayStateResult,
}; };
use client::{self, Client}; use client::{self, Client};
use common::{assets::Asset, comp, msg::ClientState, state::DeltaTime}; use common::{assets::Asset, comp, msg::ClientState, span, state::DeltaTime};
use specs::WorldExt; use specs::WorldExt;
use std::{cell::RefCell, rc::Rc}; use std::{cell::RefCell, rc::Rc};
use tracing::error; use tracing::error;
@ -60,6 +60,7 @@ impl PlayState for CharSelectionState {
} }
fn tick(&mut self, global_state: &mut GlobalState, events: Vec<WinEvent>) -> PlayStateResult { fn tick(&mut self, global_state: &mut GlobalState, events: Vec<WinEvent>) -> PlayStateResult {
span!(_guard, "tick", "<CharSelectionState as PlayState>::tick");
let client_state = self.client.borrow().get_client_state(); let client_state = self.client.borrow().get_client_state();
if let ClientState::Pending | ClientState::Registered = client_state { if let ClientState::Pending | ClientState::Registered = client_state {
// Handle window events // Handle window events

View File

@ -9,7 +9,7 @@ use crate::{
PlayStateResult, PlayStateResult,
}; };
use client_init::{ClientInit, Error as InitError, Msg as InitMsg}; use client_init::{ClientInit, Error as InitError, Msg as InitMsg};
use common::{assets::Asset, comp}; use common::{assets::Asset, comp, span};
use tracing::{error, warn}; use tracing::{error, warn};
use ui::{Event as MainMenuEvent, MainMenuUi}; use ui::{Event as MainMenuEvent, MainMenuUi};
@ -46,6 +46,7 @@ impl PlayState for MainMenuState {
} }
fn tick(&mut self, global_state: &mut GlobalState, events: Vec<Event>) -> PlayStateResult { fn tick(&mut self, global_state: &mut GlobalState, events: Vec<Event>) -> PlayStateResult {
span!(_guard, "tick", "<MainMenuState as PlayState>::tick");
let localized_strings = crate::i18n::VoxygenLocalization::load_expect( let localized_strings = crate::i18n::VoxygenLocalization::load_expect(
&crate::i18n::i18n_asset_key(&global_state.settings.language.selected_language), &crate::i18n::i18n_asset_key(&global_state.settings.language.selected_language),
); );

View File

@ -102,7 +102,7 @@ impl<'a> GreedyMesh<'a> {
/// most 30 bits total, meaning we are restricted to "only" at most 2^15 /// most 30 bits total, meaning we are restricted to "only" at most 2^15
/// × 2^15 atlases even if the hardware supports larger ones. /// × 2^15 atlases even if the hardware supports larger ones.
pub fn new(max_size: guillotiere::Size) -> Self { pub fn new(max_size: guillotiere::Size) -> Self {
span!(_guard, "GreedyMesh::new"); span!(_guard, "new", "GreedyMesh::new");
let min_max_dim = max_size.width.min(max_size.height); let min_max_dim = max_size.width.min(max_size.height);
assert!( assert!(
min_max_dim >= 4, min_max_dim >= 4,
@ -150,7 +150,7 @@ impl<'a> GreedyMesh<'a> {
FS: for<'r> FnMut(&'r mut D, Vec3<i32>, Vec3<i32>, Vec2<Vec3<i32>>) -> Option<(bool, M)>, FS: for<'r> FnMut(&'r mut D, Vec3<i32>, Vec3<i32>, Vec2<Vec3<i32>>) -> Option<(bool, M)>,
FP: FnMut(Vec2<u16>, Vec2<Vec2<u16>>, Vec3<f32>, Vec2<Vec3<f32>>, Vec3<f32>, &M), FP: FnMut(Vec2<u16>, Vec2<Vec2<u16>>, Vec3<f32>, Vec2<Vec3<f32>>, Vec3<f32>, &M),
{ {
span!(_guard, "GreedyMesh::push"); span!(_guard, "push", "GreedyMesh::push");
let cont = greedy_mesh( let cont = greedy_mesh(
&mut self.atlas, &mut self.atlas,
&mut self.col_lights_size, &mut self.col_lights_size,
@ -170,7 +170,7 @@ impl<'a> GreedyMesh<'a> {
/// ///
/// Returns the ColLightsInfo corresponding to the constructed atlas. /// Returns the ColLightsInfo corresponding to the constructed atlas.
pub fn finalize(self) -> ColLightInfo { pub fn finalize(self) -> ColLightInfo {
span!(_guard, "GreedyMesh::finalize"); span!(_guard, "finalize", "GreedyMesh::finalize");
let cur_size = self.col_lights_size; let cur_size = self.col_lights_size;
let col_lights = vec![ let col_lights = vec![
TerrainVertex::make_col_light(254, Rgb::broadcast(254)); TerrainVertex::make_col_light(254, Rgb::broadcast(254));

View File

@ -242,7 +242,11 @@ impl<'a, V: RectRasterableVol<Vox = Block> + ReadVol + Debug>
self, self,
(range, max_texture_size): Self::Supplement, (range, max_texture_size): Self::Supplement,
) -> MeshGen<TerrainPipeline, FluidPipeline, Self> { ) -> MeshGen<TerrainPipeline, FluidPipeline, Self> {
span!(_guard, "<&VolGrid2d as Meshable<_, _>>::generate_mesh"); span!(
_guard,
"generate_mesh",
"<&VolGrid2d as Meshable<_, _>>::generate_mesh"
);
// Find blocks that should glow // Find blocks that should glow
// FIXME: Replace with real lit blocks when we actually have blocks that glow. // FIXME: Replace with real lit blocks when we actually have blocks that glow.
let lit_blocks = core::iter::empty(); let lit_blocks = core::iter::empty();

View File

@ -606,7 +606,7 @@ impl Renderer {
/// Queue the clearing of the shadow targets ready for a new frame to be /// Queue the clearing of the shadow targets ready for a new frame to be
/// rendered. /// rendered.
pub fn clear_shadows(&mut self) { pub fn clear_shadows(&mut self) {
span!(_guard, "Renderer::clear_shadows"); span!(_guard, "clear_shadows", "Renderer::clear_shadows");
if !self.mode.shadow.is_map() { if !self.mode.shadow.is_map() {
return; return;
} }
@ -679,7 +679,7 @@ impl Renderer {
/// Queue the clearing of the depth target ready for a new frame to be /// Queue the clearing of the depth target ready for a new frame to be
/// rendered. /// rendered.
pub fn clear(&mut self) { pub fn clear(&mut self) {
span!(_guard, "Renderer::clear"); span!(_guard, "clear", "Renderer::clear");
self.encoder.clear_depth(&self.tgt_depth_stencil_view, 1.0); self.encoder.clear_depth(&self.tgt_depth_stencil_view, 1.0);
// self.encoder.clear_stencil(&self.tgt_depth_stencil_view, 0); // self.encoder.clear_stencil(&self.tgt_depth_stencil_view, 0);
self.encoder.clear_depth(&self.win_depth_view, 1.0); self.encoder.clear_depth(&self.win_depth_view, 1.0);
@ -715,7 +715,7 @@ impl Renderer {
/// Perform all queued draw calls for this frame and clean up discarded /// Perform all queued draw calls for this frame and clean up discarded
/// items. /// items.
pub fn flush(&mut self) { pub fn flush(&mut self) {
span!(_guard, "Renderer::flush"); span!(_guard, "flush", "Renderer::flush");
self.encoder.flush(&mut self.device); self.encoder.flush(&mut self.device);
self.device.cleanup(); self.device.cleanup();

View File

@ -92,7 +92,6 @@ fn handle_main_events_cleared(
let mut exit = true; let mut exit = true;
while let Some(state_result) = states.last_mut().map(|last| { while let Some(state_result) = states.last_mut().map(|last| {
let events = global_state.window.fetch_events(); let events = global_state.window.fetch_events();
span!(_guard, "PlayState::tick");
last.tick(global_state, events) last.tick(global_state, events)
}) { }) {
// Implement state transfer logic. // Implement state transfer logic.

View File

@ -81,7 +81,7 @@ impl Camera {
/// Compute the transformation matrices (view matrix and projection matrix) /// Compute the transformation matrices (view matrix and projection matrix)
/// and position of the camera. /// and position of the camera.
pub fn compute_dependents(&mut self, terrain: &impl ReadVol) { pub fn compute_dependents(&mut self, terrain: &impl ReadVol) {
span!(_guard, "Camera::compute_dependents"); span!(_guard, "compute_dependents", "Camera::compute_dependents");
let dist = { let dist = {
let (start, end) = (self.focus - self.forward() * self.dist, self.focus); let (start, end) = (self.focus - self.forward() * self.dist, self.focus);

View File

@ -196,7 +196,7 @@ impl FigureMgrStates {
} }
fn retain(&mut self, mut f: impl FnMut(&EcsEntity, &mut FigureStateMeta) -> bool) { fn retain(&mut self, mut f: impl FnMut(&EcsEntity, &mut FigureStateMeta) -> bool) {
span!(_guard, "FigureManagerStates::retain"); span!(_guard, "retain", "FigureManagerStates::retain");
self.character_states.retain(|k, v| f(k, &mut *v)); self.character_states.retain(|k, v| f(k, &mut *v));
self.quadruped_small_states.retain(|k, v| f(k, &mut *v)); self.quadruped_small_states.retain(|k, v| f(k, &mut *v));
self.quadruped_medium_states.retain(|k, v| f(k, &mut *v)); self.quadruped_medium_states.retain(|k, v| f(k, &mut *v));
@ -339,7 +339,7 @@ impl FigureMgr {
pub fn col_lights(&self) -> &FigureColLights { &self.col_lights } pub fn col_lights(&self) -> &FigureColLights { &self.col_lights }
pub fn clean(&mut self, tick: u64) { pub fn clean(&mut self, tick: u64) {
span!(_guard, "FigureManager::clean"); span!(_guard, "clean", "FigureManager::clean");
self.model_cache.clean(&mut self.col_lights, tick); self.model_cache.clean(&mut self.col_lights, tick);
self.critter_model_cache.clean(&mut self.col_lights, tick); self.critter_model_cache.clean(&mut self.col_lights, tick);
self.quadruped_small_model_cache self.quadruped_small_model_cache
@ -366,7 +366,7 @@ impl FigureMgr {
#[allow(clippy::redundant_pattern_matching)] #[allow(clippy::redundant_pattern_matching)]
// TODO: Pending review in #587 // TODO: Pending review in #587
pub fn update_lighting(&mut self, scene_data: &SceneData) { pub fn update_lighting(&mut self, scene_data: &SceneData) {
span!(_guard, "FigureManager::update_lighting"); span!(_guard, "update_lighting", "FigureManager::update_lighting");
let ecs = scene_data.state.ecs(); let ecs = scene_data.state.ecs();
for (entity, body, light_emitter) in ( for (entity, body, light_emitter) in (
&ecs.entities(), &ecs.entities(),
@ -455,7 +455,7 @@ impl FigureMgr {
visible_psr_bounds: math::Aabr<f32>, visible_psr_bounds: math::Aabr<f32>,
camera: &Camera, camera: &Camera,
) -> anim::vek::Aabb<f32> { ) -> anim::vek::Aabb<f32> {
span!(_guard, "FigureManager::maintain"); span!(_guard, "maintain", "FigureManager::maintain");
let state = scene_data.state; let state = scene_data.state;
let time = state.get_time(); let time = state.get_time();
let tick = scene_data.tick; let tick = scene_data.tick;
@ -2135,7 +2135,7 @@ impl FigureMgr {
(is_daylight, _light_data): super::LightData, (is_daylight, _light_data): super::LightData,
(camera, figure_lod_render_distance): CameraData, (camera, figure_lod_render_distance): CameraData,
) { ) {
span!(_guard, "FigureManager::render_shadows"); span!(_guard, "render_shadows", "FigureManager::render_shadows");
let ecs = state.ecs(); let ecs = state.ecs();
if is_daylight && renderer.render_mode().shadow.is_map() { if is_daylight && renderer.render_mode().shadow.is_map() {
@ -2187,7 +2187,7 @@ impl FigureMgr {
lod: &LodData, lod: &LodData,
(camera, figure_lod_render_distance): CameraData, (camera, figure_lod_render_distance): CameraData,
) { ) {
span!(_guard, "FigureManager::render"); span!(_guard, "render", "FigureManager::render");
let ecs = state.ecs(); let ecs = state.ecs();
let character_state_storage = state.read_storage::<common::comp::CharacterState>(); let character_state_storage = state.read_storage::<common::comp::CharacterState>();
@ -2238,7 +2238,7 @@ impl FigureMgr {
lod: &LodData, lod: &LodData,
(camera, figure_lod_render_distance): CameraData, (camera, figure_lod_render_distance): CameraData,
) { ) {
span!(_guard, "FigureManager::render_player"); span!(_guard, "render_player", "FigureManager::render_player");
let ecs = state.ecs(); let ecs = state.ecs();
let character_state_storage = state.read_storage::<common::comp::CharacterState>(); let character_state_storage = state.read_storage::<common::comp::CharacterState>();
@ -2622,7 +2622,7 @@ impl FigureColLights {
(opaque, bounds): (Mesh<TerrainPipeline>, math::Aabb<f32>), (opaque, bounds): (Mesh<TerrainPipeline>, math::Aabb<f32>),
vertex_range: [Range<u32>; N], vertex_range: [Range<u32>; N],
) -> Result<FigureModelEntry<N>, RenderError> { ) -> Result<FigureModelEntry<N>, RenderError> {
span!(_guard, "FigureColLights::create_figure"); span!(_guard, "create_figure", "FigureColLights::create_figure");
let atlas = &mut self.atlas; let atlas = &mut self.atlas;
let allocation = atlas let allocation = atlas
.allocate(guillotiere::Size::new( .allocate(guillotiere::Size::new(

View File

@ -380,7 +380,7 @@ impl Scene {
scene_data: &SceneData, scene_data: &SceneData,
audio: &mut AudioFrontend, audio: &mut AudioFrontend,
) { ) {
span!(_guard, "Scene::handle_outcome"); span!(_guard, "handle_outcome", "Scene::handle_outcome");
self.particle_mgr.handle_outcome(&outcome, &scene_data); self.particle_mgr.handle_outcome(&outcome, &scene_data);
self.sfx_mgr.handle_outcome(&outcome, audio); self.sfx_mgr.handle_outcome(&outcome, audio);
@ -424,7 +424,7 @@ impl Scene {
audio: &mut AudioFrontend, audio: &mut AudioFrontend,
scene_data: &SceneData, scene_data: &SceneData,
) { ) {
span!(_guard, "Scene::maintain"); span!(_guard, "maintain", "Scene::maintain");
// Get player position. // Get player position.
let ecs = scene_data.state.ecs(); let ecs = scene_data.state.ecs();
@ -976,7 +976,7 @@ impl Scene {
tick: u64, tick: u64,
scene_data: &SceneData, scene_data: &SceneData,
) { ) {
span!(_guard, "Scene::render"); span!(_guard, "render", "Scene::render");
let sun_dir = scene_data.get_sun_dir(); let sun_dir = scene_data.get_sun_dir();
let is_daylight = sun_dir.z < 0.0; let is_daylight = sun_dir.z < 0.0;
let focus_pos = self.camera.get_focus_pos(); let focus_pos = self.camera.get_focus_pos();

View File

@ -49,7 +49,7 @@ impl ParticleMgr {
} }
pub fn handle_outcome(&mut self, outcome: &Outcome, scene_data: &SceneData) { pub fn handle_outcome(&mut self, outcome: &Outcome, scene_data: &SceneData) {
span!(_guard, "ParticleMgr::handle_outcome"); span!(_guard, "handle_outcome", "ParticleMgr::handle_outcome");
let time = scene_data.state.get_time(); let time = scene_data.state.get_time();
let mut rng = rand::thread_rng(); let mut rng = rand::thread_rng();
@ -100,7 +100,7 @@ impl ParticleMgr {
scene_data: &SceneData, scene_data: &SceneData,
terrain: &Terrain<TerrainChunk>, terrain: &Terrain<TerrainChunk>,
) { ) {
span!(_guard, "ParticleMgr::maintain"); span!(_guard, "maintain", "ParticleMgr::maintain");
if scene_data.particles_enabled { if scene_data.particles_enabled {
// update timings // update timings
self.scheduler.maintain(scene_data.state.get_time()); self.scheduler.maintain(scene_data.state.get_time());
@ -125,7 +125,11 @@ impl ParticleMgr {
} }
fn maintain_body_particles(&mut self, scene_data: &SceneData) { fn maintain_body_particles(&mut self, scene_data: &SceneData) {
span!(_guard, "ParticleMgr::maintain_body_particles"); span!(
_guard,
"body_particles",
"ParticleMgr::maintain_body_particles"
);
let ecs = scene_data.state.ecs(); let ecs = scene_data.state.ecs();
for (body, pos) in (&ecs.read_storage::<Body>(), &ecs.read_storage::<Pos>()).join() { for (body, pos) in (&ecs.read_storage::<Body>(), &ecs.read_storage::<Pos>()).join() {
match body { match body {
@ -152,7 +156,11 @@ impl ParticleMgr {
} }
fn maintain_campfirelit_particles(&mut self, scene_data: &SceneData, pos: &Pos) { fn maintain_campfirelit_particles(&mut self, scene_data: &SceneData, pos: &Pos) {
span!(_guard, "ParticleMgr::maintain_campfirelit_particles"); span!(
_guard,
"campfirelit_particles",
"ParticleMgr::maintain_campfirelit_particles"
);
let time = scene_data.state.get_time(); let time = scene_data.state.get_time();
for _ in 0..self.scheduler.heartbeats(Duration::from_millis(10)) { for _ in 0..self.scheduler.heartbeats(Duration::from_millis(10)) {
@ -173,7 +181,11 @@ impl ParticleMgr {
} }
fn maintain_boltfire_particles(&mut self, scene_data: &SceneData, pos: &Pos) { fn maintain_boltfire_particles(&mut self, scene_data: &SceneData, pos: &Pos) {
span!(_guard, "ParticleMgr::maintain_boltfire_particles"); span!(
_guard,
"boltfire_particles",
"ParticleMgr::maintain_boltfire_particles"
);
let time = scene_data.state.get_time(); let time = scene_data.state.get_time();
for _ in 0..self.scheduler.heartbeats(Duration::from_millis(10)) { for _ in 0..self.scheduler.heartbeats(Duration::from_millis(10)) {
@ -193,7 +205,11 @@ impl ParticleMgr {
} }
fn maintain_boltfirebig_particles(&mut self, scene_data: &SceneData, pos: &Pos) { fn maintain_boltfirebig_particles(&mut self, scene_data: &SceneData, pos: &Pos) {
span!(_guard, "ParticleMgr::maintain_boltfirebig_particles"); span!(
_guard,
"boltfirebig_particles",
"ParticleMgr::maintain_boltfirebig_particles"
);
let time = scene_data.state.get_time(); let time = scene_data.state.get_time();
// fire // fire
@ -224,7 +240,11 @@ impl ParticleMgr {
} }
fn maintain_bomb_particles(&mut self, scene_data: &SceneData, pos: &Pos) { fn maintain_bomb_particles(&mut self, scene_data: &SceneData, pos: &Pos) {
span!(_guard, "ParticleMgr::maintain_bomb_particles"); span!(
_guard,
"bomb_particles",
"ParticleMgr::maintain_bomb_particles"
);
let time = scene_data.state.get_time(); let time = scene_data.state.get_time();
for _ in 0..self.scheduler.heartbeats(Duration::from_millis(10)) { for _ in 0..self.scheduler.heartbeats(Duration::from_millis(10)) {
@ -247,7 +267,11 @@ impl ParticleMgr {
} }
fn maintain_boost_particles(&mut self, scene_data: &SceneData) { fn maintain_boost_particles(&mut self, scene_data: &SceneData) {
span!(_guard, "ParticleMgr::maintain_boost_particles"); span!(
_guard,
"boost_particles",
"ParticleMgr::maintain_boost_particles"
);
let state = scene_data.state; let state = scene_data.state;
let ecs = state.ecs(); let ecs = state.ecs();
let time = state.get_time(); let time = state.get_time();
@ -281,7 +305,11 @@ impl ParticleMgr {
scene_data: &SceneData, scene_data: &SceneData,
terrain: &Terrain<TerrainChunk>, terrain: &Terrain<TerrainChunk>,
) { ) {
span!(_guard, "ParticleMgr::maintain_block_particles"); span!(
_guard,
"block_particles",
"ParticleMgr::maintain_block_particles"
);
let dt = scene_data.state.ecs().fetch::<DeltaTime>().0; let dt = scene_data.state.ecs().fetch::<DeltaTime>().0;
let time = scene_data.state.get_time(); let time = scene_data.state.get_time();
let player_pos = scene_data let player_pos = scene_data
@ -393,7 +421,7 @@ impl ParticleMgr {
} }
fn upload_particles(&mut self, renderer: &mut Renderer) { fn upload_particles(&mut self, renderer: &mut Renderer) {
span!(_guard, "ParticleMgr::upload_particles"); span!(_guard, "upload_particles", "ParticleMgr::upload_particles");
let all_cpu_instances = self let all_cpu_instances = self
.particles .particles
.iter() .iter()
@ -415,7 +443,7 @@ impl ParticleMgr {
global: &GlobalModel, global: &GlobalModel,
lod: &LodData, lod: &LodData,
) { ) {
span!(_guard, "ParticleMgr::render"); span!(_guard, "render", "ParticleMgr::render");
if scene_data.particles_enabled { if scene_data.particles_enabled {
let model = &self let model = &self
.model_cache .model_cache
@ -501,7 +529,7 @@ impl HeartbeatScheduler {
/// updates the last elapsed times and elapsed counts /// updates the last elapsed times and elapsed counts
/// this should be called once, and only once per tick. /// this should be called once, and only once per tick.
pub fn maintain(&mut self, now: f64) { pub fn maintain(&mut self, now: f64) {
span!(_guard, "HeartbeatScheduler::maintain"); span!(_guard, "maintain", "HeartbeatScheduler::maintain");
self.last_known_time = now; self.last_known_time = now;
for (frequency, (last_update, heartbeats)) in self.timers.iter_mut() { for (frequency, (last_update, heartbeats)) in self.timers.iter_mut() {

View File

@ -385,7 +385,7 @@ impl<V: RectRasterableVol> Terrain<V> {
fn make_atlas( fn make_atlas(
renderer: &mut Renderer, renderer: &mut Renderer,
) -> Result<(AtlasAllocator, Texture<ColLightFmt>), RenderError> { ) -> Result<(AtlasAllocator, Texture<ColLightFmt>), RenderError> {
span!(_guard, "Terrain::make_atlas"); span!(_guard, "male_atlas", "Terrain::make_atlas");
let max_texture_size = renderer.max_texture_size(); let max_texture_size = renderer.max_texture_size();
let atlas_size = let atlas_size =
guillotiere::Size::new(i32::from(max_texture_size), i32::from(max_texture_size)); guillotiere::Size::new(i32::from(max_texture_size), i32::from(max_texture_size));
@ -453,7 +453,7 @@ impl<V: RectRasterableVol> Terrain<V> {
view_mat: Mat4<f32>, view_mat: Mat4<f32>,
proj_mat: Mat4<f32>, proj_mat: Mat4<f32>,
) -> (Aabb<f32>, Vec<math::Vec3<f32>>, math::Aabr<f32>) { ) -> (Aabb<f32>, Vec<math::Vec3<f32>>, math::Aabr<f32>) {
span!(_guard, "Terrain::maintain"); span!(_guard, "maintain", "Terrain::maintain");
let current_tick = scene_data.tick; let current_tick = scene_data.tick;
let current_time = scene_data.state.get_time(); let current_time = scene_data.state.get_time();
let mut visible_bounding_box: Option<Aabb<f32>> = None; let mut visible_bounding_box: Option<Aabb<f32>> = None;
@ -951,7 +951,7 @@ impl<V: RectRasterableVol> Terrain<V> {
(is_daylight, light_data): super::LightData, (is_daylight, light_data): super::LightData,
focus_pos: Vec3<f32>, focus_pos: Vec3<f32>,
) { ) {
span!(_guard, "Terrain::render_shadows"); span!(_guard, "render_shadows", "Terrain::render_shadows");
if !renderer.render_mode().shadow.is_map() { if !renderer.render_mode().shadow.is_map() {
return; return;
}; };
@ -1013,7 +1013,7 @@ impl<V: RectRasterableVol> Terrain<V> {
lod: &LodData, lod: &LodData,
focus_pos: Vec3<f32>, focus_pos: Vec3<f32>,
) { ) {
span!(_guard, "Terrain::render"); span!(_guard, "render", "Terrain::render");
let focus_chunk = Vec2::from(focus_pos).map2(TerrainChunk::RECT_SIZE, |e: f32, sz| { let focus_chunk = Vec2::from(focus_pos).map2(TerrainChunk::RECT_SIZE, |e: f32, sz| {
(e as i32).div_euclid(sz as i32) (e as i32).div_euclid(sz as i32)
}); });
@ -1047,7 +1047,7 @@ impl<V: RectRasterableVol> Terrain<V> {
cam_pos: Vec3<f32>, cam_pos: Vec3<f32>,
sprite_render_distance: f32, sprite_render_distance: f32,
) { ) {
span!(_guard, "Terrain::render_translucent"); span!(_guard, "render_translucent", "Terrain::render_translucent");
let focus_chunk = Vec2::from(focus_pos).map2(TerrainChunk::RECT_SIZE, |e: f32, sz| { let focus_chunk = Vec2::from(focus_pos).map2(TerrainChunk::RECT_SIZE, |e: f32, sz| {
(e as i32).div_euclid(sz as i32) (e as i32).div_euclid(sz as i32)
}); });

View File

@ -17,7 +17,7 @@ pub struct BlocksOfInterest {
impl BlocksOfInterest { impl BlocksOfInterest {
pub fn from_chunk(chunk: &TerrainChunk) -> Self { pub fn from_chunk(chunk: &TerrainChunk) -> Self {
span!(_guard, "BlocksOfInterest::from_chunk"); span!(_guard, "from_chunk", "BlocksOfInterest::from_chunk");
let mut leaves = Vec::new(); let mut leaves = Vec::new();
let mut grass = Vec::new(); let mut grass = Vec::new();
let mut embers = Vec::new(); let mut embers = Vec::new();

View File

@ -112,7 +112,7 @@ impl SessionState {
global_state: &mut GlobalState, global_state: &mut GlobalState,
outcomes: &mut Vec<Outcome>, outcomes: &mut Vec<Outcome>,
) -> Result<TickAction, Error> { ) -> Result<TickAction, Error> {
span!(_guard, "Session::tick"); span!(_guard, "tick", "Session::tick");
self.inputs.tick(dt); self.inputs.tick(dt);
let mut client = self.client.borrow_mut(); let mut client = self.client.borrow_mut();
@ -197,7 +197,7 @@ impl PlayState for SessionState {
} }
fn tick(&mut self, global_state: &mut GlobalState, events: Vec<Event>) -> PlayStateResult { fn tick(&mut self, global_state: &mut GlobalState, events: Vec<Event>) -> PlayStateResult {
span!(_guard, "<Session as PlayState>::tick"); span!(_guard, "tick", "<Session as PlayState>::tick");
// NOTE: Not strictly necessary, but useful for hotloading translation changes. // NOTE: Not strictly necessary, but useful for hotloading translation changes.
self.voxygen_i18n = VoxygenLocalization::load_expect(&i18n_asset_key( self.voxygen_i18n = VoxygenLocalization::load_expect(&i18n_asset_key(
&global_state.settings.language.selected_language, &global_state.settings.language.selected_language,
@ -1116,7 +1116,7 @@ impl PlayState for SessionState {
/// ///
/// This method should be called once per frame. /// This method should be called once per frame.
fn render(&mut self, renderer: &mut Renderer, settings: &Settings) { fn render(&mut self, renderer: &mut Renderer, settings: &Settings) {
span!(_guard, "<Session as PlayState>::render"); span!(_guard, "render", "<Session as PlayState>::render");
// Render the screen using the global renderer // Render the screen using the global renderer
{ {
let client = self.client.borrow(); let client = self.client.borrow();

View File

@ -292,7 +292,7 @@ impl Ui {
#[allow(clippy::float_cmp)] // TODO: Pending review in #587 #[allow(clippy::float_cmp)] // TODO: Pending review in #587
pub fn maintain(&mut self, renderer: &mut Renderer, view_projection_mat: Option<Mat4<f32>>) { pub fn maintain(&mut self, renderer: &mut Renderer, view_projection_mat: Option<Mat4<f32>>) {
span!(_guard, "Ui::maintain"); span!(_guard, "maintain", "Ui::maintain");
// Maintain tooltip manager // Maintain tooltip manager
self.tooltip_manager self.tooltip_manager
.maintain(self.ui.global_input(), self.scale.scale_factor_logical()); .maintain(self.ui.global_input(), self.scale.scale_factor_logical());
@ -334,7 +334,7 @@ impl Ui {
view_projection_mat: Option<Mat4<f32>>, view_projection_mat: Option<Mat4<f32>>,
retry: &mut bool, retry: &mut bool,
) { ) {
span!(_guard, "Ui::maintain_internal"); span!(_guard, "internal", "Ui::maintain_internal");
let (graphic_cache, text_cache, glyph_cache, cache_tex) = self.cache.cache_mut_and_tex(); let (graphic_cache, text_cache, glyph_cache, cache_tex) = self.cache.cache_mut_and_tex();
let mut primitives = if *retry { let mut primitives = if *retry {
@ -979,7 +979,7 @@ impl Ui {
} }
pub fn render(&self, renderer: &mut Renderer, maybe_globals: Option<&Consts<Globals>>) { pub fn render(&self, renderer: &mut Renderer, maybe_globals: Option<&Consts<Globals>>) {
span!(_guard, "Ui::render"); span!(_guard, "render", "Ui::render");
let mut scissor = default_scissor(renderer); let mut scissor = default_scissor(renderer);
let globals = maybe_globals.unwrap_or(&self.default_globals); let globals = maybe_globals.unwrap_or(&self.default_globals);
let mut locals = &self.interface_locals; let mut locals = &self.interface_locals;

View File

@ -1049,7 +1049,7 @@ impl Window {
} }
pub fn swap_buffers(&self) -> Result<(), Error> { pub fn swap_buffers(&self) -> Result<(), Error> {
span!(_guard, "Window::swap_buffers"); span!(_guard, "swap_buffers", "Window::swap_buffers");
self.window self.window
.swap_buffers() .swap_buffers()
.map_err(|err| Error::BackendError(Box::new(err))) .map_err(|err| Error::BackendError(Box::new(err)))