Fix RT timer

This commit is contained in:
2026-09-11 17:12:38 +02:00
parent f8087c3a2c
commit 54c5e91a7f
2 changed files with 29 additions and 222 deletions
+15 -15
View File
@@ -561,21 +561,6 @@ impl State
},
);
// ~~ Get Ray-marching timestamps, report time ~~
let cloned_rm_time = self.rm_time.clone();
let cloned_queue = self.queue.clone();
DownloadBuffer::read_buffer(
&self.device,
&self.queue,
&timestamp_buffer.slice(..),
move |buffer| {
let buffer_slice = buffer.unwrap();
let slice: &[u64] = cast_slice(&buffer_slice);
let time = (slice[1] - slice[0]) as f32 * cloned_queue.get_timestamp_period();
*cloned_rm_time.lock() = time;
},
);
// ~~ Do cache managment
if !self
.camera
@@ -592,6 +577,21 @@ impl State
self.window.pre_present_notify();
self.queue.present(surface_texture);
// ~~ Get Ray-marching timestamps, report time ~~
let cloned_rm_time = self.rm_time.clone();
let cloned_queue = self.queue.clone();
DownloadBuffer::read_buffer(
&self.device,
&self.queue,
&timestamp_buffer.slice(..),
move |buffer| {
let buffer_slice = buffer.unwrap();
let slice: &[u64] = cast_slice(&buffer_slice);
let time = (slice[1] - slice[0]) as f32 * cloned_queue.get_timestamp_period();
*cloned_rm_time.lock() = time;
},
);
// ~~ Do cache managment
if !self
.camera