Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ gltf = { version = "1.0.0", default-features = false, features = ["utils"] }
metrics = "0.24.0"
hdrhistogram = { version = "7", default-features = false }
save = { path = "../save" }
lru-slab = "0.1.2"

[features]
default = ["use-repo-assets"]
Expand Down
17 changes: 8 additions & 9 deletions client/src/graphics/voxels/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ mod tests;
use std::{sync::Arc, time::Instant};

use ash::{Device, vk};
use lru_slab::LruSlab;
use metrics::histogram;
use tracing::warn;

Expand All @@ -15,10 +16,8 @@ use crate::{
graphics::{Base, Frustum},
};
use common::{
LruSlab,
dodeca::{self, Vertex},
graph::NodeId,
lru_slab::SlotId,
math::{MIsometry, MPoint},
node::{Chunk, ChunkId, VoxelData},
};
Expand Down Expand Up @@ -135,7 +134,7 @@ impl Voxels {
self.states.get_mut(slot).refcount += 1;
frame.drawn.push(slot);
// Transfer transform
frame.surface.transforms_mut()[slot.0 as usize] =
frame.surface.transforms_mut()[slot as usize] =
na::Matrix4::from(*node_transform) * vertex.chunk_to_node();
}
if let (None, &VoxelData::Dense(ref data)) = (&surface, voxels) {
Expand Down Expand Up @@ -183,9 +182,9 @@ impl Voxels {
let node_is_odd = sim.graph.depth(node) & 1 != 0;
extractions.push(ExtractTask {
index: scratch_slot,
indirect_offset: self.surfaces.indirect_offset(slot.0),
face_offset: self.surfaces.face_offset(slot.0),
draw_id: slot.0,
indirect_offset: self.surfaces.indirect_offset(slot),
face_offset: self.surfaces.face_offset(slot),
draw_id: slot,
reverse_winding: vertex.parity() ^ node_is_odd,
});
}
Expand Down Expand Up @@ -224,8 +223,8 @@ impl Voxels {
) {
return;
}
for chunk in &frame.drawn {
self.draw.draw(device, cmd, &self.surfaces, chunk.0);
for &chunk in &frame.drawn {
self.draw.draw(device, cmd, &self.surfaces, chunk);
}
histogram!("frame.cpu.voxels.draw").record(started.elapsed());
}
Expand All @@ -245,7 +244,7 @@ pub struct Frame {
surface: surface::Frame,
/// Scratch slots completed in this frame
extracted: Vec<u32>,
drawn: Vec<SlotId>,
drawn: Vec<u32>,
}

impl Frame {
Expand Down
2 changes: 0 additions & 2 deletions common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ pub mod graph;
pub mod graph_collision;
mod graph_entities;
pub mod graph_ray_casting;
pub mod lru_slab;
mod margins;
pub mod math;
pub mod node;
Expand All @@ -35,7 +34,6 @@ pub mod worldgen;

pub use chunks::Chunks;
pub use graph_entities::GraphEntities;
pub use lru_slab::LruSlab;
pub use sim_config::{SimConfig, SimConfigRaw};

// Stable IDs made of 8 random bytes for easy persistent references
Expand Down
306 changes: 0 additions & 306 deletions common/src/lru_slab.rs

This file was deleted.

Loading