summaryrefslogtreecommitdiff
path: root/alligator_render/src
diff options
context:
space:
mode:
authorMicha White <botahamec@outlook.com>2022-10-20 23:19:00 -0400
committerMicha White <botahamec@outlook.com>2022-10-20 23:19:00 -0400
commit11077150cbc909e414cf5b27f18d02629e6b01da (patch)
treebb1bfd66457e4d901be5225abf0aeeef8c06316d /alligator_render/src
parent09df670b8e45a3ffe2853773e648b80b6b6d6254 (diff)
Made the run function generic
Diffstat (limited to 'alligator_render/src')
-rw-r--r--alligator_render/src/instance.rs8
-rw-r--r--alligator_render/src/renderer.rs2
2 files changed, 7 insertions, 3 deletions
diff --git a/alligator_render/src/instance.rs b/alligator_render/src/instance.rs
index 2d1808f..e346cae 100644
--- a/alligator_render/src/instance.rs
+++ b/alligator_render/src/instance.rs
@@ -151,8 +151,12 @@ impl InstanceBuffer {
}
// the instances must be sorted by z-index before being handed to the GPU
- let mut sorted = self.instances.clone();
- sorted.sort_by(|a, b| a.z_index.total_cmp(&b.z_index));
+ let sorted = {
+ profiling::scope!("depth sorting");
+ let mut sorted = self.instances.clone();
+ sorted.sort_by(|a, b| a.z_index.total_cmp(&b.z_index));
+ sorted
+ };
queue.write_buffer(
&self.instance_buffer,
diff --git a/alligator_render/src/renderer.rs b/alligator_render/src/renderer.rs
index ec3cac5..9f4aad1 100644
--- a/alligator_render/src/renderer.rs
+++ b/alligator_render/src/renderer.rs
@@ -372,7 +372,7 @@ impl Renderer {
}
/// Run the renderer indefinitely
- pub fn run(mut self, f: &'static mut dyn FnMut(&mut Self)) -> ! {
+ pub fn run<F: FnMut(&mut Self) + 'static>(mut self, mut f: F) -> ! {
self.window.set_visible(true);
let event_loop = self.event_loop();
event_loop.run(move |event, _, control_flow| match event {