mirror of
https://github.com/maplibre/maplibre-rs.git
synced 2025-12-08 19:05:57 +00:00
Add instruments
This commit is contained in:
parent
8563dbe72a
commit
f1be6ec9be
@ -145,6 +145,7 @@ impl WorldTileCoords {
|
||||
})
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub fn transform_for_zoom(&self, zoom: f64) -> Matrix4<f64> {
|
||||
/*
|
||||
For tile.z = zoom:
|
||||
@ -163,10 +164,10 @@ impl WorldTileCoords {
|
||||
));
|
||||
|
||||
// Divide by EXTENT to normalize tile
|
||||
let normalize = Matrix4::from_nonuniform_scale(1.0 / EXTENT, 1.0 / EXTENT, 1.0);
|
||||
// Scale tiles where the zoom level matches its z to 512x512
|
||||
let scale = Matrix4::from_nonuniform_scale(tile_scale, tile_scale, 1.0);
|
||||
translate * normalize * scale
|
||||
// Scale tiles where zoom level = self.z to 512x512
|
||||
let normalize_and_scale =
|
||||
Matrix4::from_nonuniform_scale(tile_scale / EXTENT, tile_scale / EXTENT, 1.0);
|
||||
translate * normalize_and_scale
|
||||
}
|
||||
|
||||
pub fn into_aligned(self) -> AlignedWorldTileCoords {
|
||||
@ -389,7 +390,11 @@ impl ViewRegion {
|
||||
&& world_coords.y <= self.max_tile.y + self.padding
|
||||
&& world_coords.x >= self.min_tile.x - self.padding
|
||||
&& world_coords.y >= self.min_tile.y - self.padding
|
||||
&& world_coords.z == self.z
|
||||
&& (world_coords.z == self.z
|
||||
|| world_coords.z.checked_sub(1).unwrap_or(0) == self.z
|
||||
|| world_coords.z.checked_sub(2).unwrap_or(0) == self.z
|
||||
|| world_coords.z.checked_sub(3).unwrap_or(0) == self.z
|
||||
|| world_coords.z + 1 == self.z)
|
||||
}
|
||||
|
||||
pub fn iter(&self) -> impl Iterator<Item = WorldTileCoords> + '_ {
|
||||
|
||||
@ -129,6 +129,7 @@ pub trait UpdateState {
|
||||
}
|
||||
|
||||
impl UpdateState for InputController {
|
||||
#[tracing::instrument(skip_all)]
|
||||
fn update_state(&mut self, state: &mut RenderState, tile_cache: &TileCache, dt: Duration) {
|
||||
self.pan_handler.update_state(state, tile_cache, dt);
|
||||
self.pinch_handler.update_state(state, tile_cache, dt);
|
||||
|
||||
@ -243,12 +243,6 @@ pub struct IOScheduler {
|
||||
schedule_method: ScheduleMethod,
|
||||
}
|
||||
|
||||
impl fmt::Debug for IOScheduler {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "IOScheduler")
|
||||
}
|
||||
}
|
||||
|
||||
const _: () = {
|
||||
fn assert_send<T: Send>() {}
|
||||
|
||||
@ -268,7 +262,7 @@ impl IOScheduler {
|
||||
}
|
||||
}
|
||||
|
||||
#[tracing::instrument]
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub fn try_populate_cache(&mut self) {
|
||||
if let Ok(mut tile_request_state) = self.tile_request_state.try_lock() {
|
||||
if let Ok(result) = self.tessellate_channel.1.try_recv() {
|
||||
|
||||
@ -32,6 +32,7 @@ impl ViewProjection {
|
||||
self.0 * vector
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub fn to_model_view_projection(&self, projection: Matrix4<f64>) -> ModelViewProjection {
|
||||
ModelViewProjection(self.0 * projection)
|
||||
}
|
||||
|
||||
@ -357,7 +357,7 @@ impl RenderState {
|
||||
}
|
||||
|
||||
/// Request tiles which are currently in view
|
||||
#[tracing::instrument]
|
||||
#[tracing::instrument(skip_all)]
|
||||
fn request_tiles_in_view(&self, view_region: &ViewRegion, scheduler: &mut IOScheduler) {
|
||||
let source_layers: HashSet<String> = self
|
||||
.style
|
||||
@ -377,7 +377,7 @@ impl RenderState {
|
||||
/// Update tile metadata for all required tiles on the GPU according to current zoom, camera and perspective
|
||||
/// We perform the update before uploading new tessellated tiles, such that each
|
||||
/// tile metadata in the the `buffer_pool` gets updated exactly once and not twice.
|
||||
#[tracing::instrument]
|
||||
#[tracing::instrument(skip_all)]
|
||||
fn update_metadata(
|
||||
&self,
|
||||
_scheduler: &mut IOScheduler,
|
||||
@ -472,7 +472,7 @@ impl RenderState {
|
||||
}
|
||||
}
|
||||
|
||||
#[tracing::instrument]
|
||||
#[tracing::instrument(skip_all)]
|
||||
fn upload_tile_geometry(
|
||||
&mut self,
|
||||
view_proj: &ViewProjection,
|
||||
@ -565,7 +565,7 @@ impl RenderState {
|
||||
}
|
||||
}
|
||||
|
||||
#[tracing::instrument]
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub fn prepare_render_data(&mut self, scheduler: &mut IOScheduler) {
|
||||
let visible_z = self.visible_z();
|
||||
|
||||
@ -748,9 +748,3 @@ impl RenderState {
|
||||
self.suspended = false;
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for RenderState {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "RenderState")
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user