Skip to content

Commit a5df1ce

Browse files
committed
Unvendor lru-slab
1 parent 1fc59de commit a5df1ce

6 files changed

Lines changed: 12 additions & 320 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ gltf = { version = "1.0.0", default-features = false, features = ["utils"] }
3939
metrics = "0.24.0"
4040
hdrhistogram = { version = "7", default-features = false }
4141
save = { path = "../save" }
42+
lru-slab = "0.1.2"
4243

4344
[features]
4445
default = ["use-repo-assets"]

client/src/graphics/voxels/mod.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ mod tests;
77
use std::{sync::Arc, time::Instant};
88

99
use ash::{Device, vk};
10+
use lru_slab::LruSlab;
1011
use metrics::histogram;
1112
use tracing::warn;
1213

@@ -15,10 +16,8 @@ use crate::{
1516
graphics::{Base, Frustum},
1617
};
1718
use common::{
18-
LruSlab,
1919
dodeca::{self, Vertex},
2020
graph::NodeId,
21-
lru_slab::SlotId,
2221
math::{MIsometry, MPoint},
2322
node::{Chunk, ChunkId, VoxelData},
2423
};
@@ -135,7 +134,7 @@ impl Voxels {
135134
self.states.get_mut(slot).refcount += 1;
136135
frame.drawn.push(slot);
137136
// Transfer transform
138-
frame.surface.transforms_mut()[slot.0 as usize] =
137+
frame.surface.transforms_mut()[slot as usize] =
139138
na::Matrix4::from(*node_transform) * vertex.chunk_to_node();
140139
}
141140
if let (None, &VoxelData::Dense(ref data)) = (&surface, voxels) {
@@ -183,9 +182,9 @@ impl Voxels {
183182
let node_is_odd = sim.graph.depth(node) & 1 != 0;
184183
extractions.push(ExtractTask {
185184
index: scratch_slot,
186-
indirect_offset: self.surfaces.indirect_offset(slot.0),
187-
face_offset: self.surfaces.face_offset(slot.0),
188-
draw_id: slot.0,
185+
indirect_offset: self.surfaces.indirect_offset(slot),
186+
face_offset: self.surfaces.face_offset(slot),
187+
draw_id: slot,
189188
reverse_winding: vertex.parity() ^ node_is_odd,
190189
});
191190
}
@@ -224,8 +223,8 @@ impl Voxels {
224223
) {
225224
return;
226225
}
227-
for chunk in &frame.drawn {
228-
self.draw.draw(device, cmd, &self.surfaces, chunk.0);
226+
for &chunk in &frame.drawn {
227+
self.draw.draw(device, cmd, &self.surfaces, chunk);
229228
}
230229
histogram!("frame.cpu.voxels.draw").record(started.elapsed());
231230
}
@@ -245,7 +244,7 @@ pub struct Frame {
245244
surface: surface::Frame,
246245
/// Scratch slots completed in this frame
247246
extracted: Vec<u32>,
248-
drawn: Vec<SlotId>,
247+
drawn: Vec<u32>,
249248
}
250249

251250
impl Frame {

common/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ pub mod graph;
2121
pub mod graph_collision;
2222
mod graph_entities;
2323
pub mod graph_ray_casting;
24-
pub mod lru_slab;
2524
mod margins;
2625
pub mod math;
2726
pub mod node;
@@ -35,7 +34,6 @@ pub mod worldgen;
3534

3635
pub use chunks::Chunks;
3736
pub use graph_entities::GraphEntities;
38-
pub use lru_slab::LruSlab;
3937
pub use sim_config::{SimConfig, SimConfigRaw};
4038

4139
// Stable IDs made of 8 random bytes for easy persistent references

common/src/lru_slab.rs

Lines changed: 0 additions & 306 deletions
This file was deleted.

0 commit comments

Comments
 (0)