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
16 changes: 16 additions & 0 deletions crates/victory-gpu/src/descriptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ fn mirror(handle: u64) {
/// heap at indices in their data, where a slot never mirrored reads nothing.
#[cfg(windows)]
pub(crate) fn sync_heaps() {
#[cfg(feature = "diagnostics")]
host::stats::tick();
sync_heaps_with(
|heap| heap.host.get()?.as_ref().map(std::sync::Arc::clone),
|host, first, last, step, bytes| host.mirror_bytes(first, last, step, bytes),
Expand Down Expand Up @@ -302,6 +304,20 @@ pub(crate) fn with_host<R>(heap: usize, f: impl FnOnce(&host::HostHeap) -> R) ->
Some(f(host))
}

/// Diagnostics: how the host view heaps' title blocks and dynamic slots
/// are used, over the last `frames` frames.
#[cfg(all(windows, feature = "diagnostics"))]
pub(crate) fn log_heaps(frames: f64) {
let heaps = SHADER_HEAPS.lock().unwrap_or_else(|e| e.into_inner());
for &(_, _, at) in heaps.iter() {
// SAFETY: registered heaps are live (removed when dropped, which
// waits for the lock we hold).
if let Some(Some(host)) = unsafe { &*(at as *const Heap) }.host.get() {
host.log_stats(frames);
}
}
}

#[cfg(windows)]
impl Drop for Heap {
fn drop(&mut self) {
Expand Down
Loading