Skip to content

Commit

Permalink
chore: fix bug and add needed method
Browse files Browse the repository at this point in the history
  • Loading branch information
FL33TW00D authored and kvark committed May 4, 2023
1 parent 7510de0 commit 875d91e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/counters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,17 @@ impl CounterSampleBufferDescriptorRef {
}

pub fn label(&self) -> &str {
unsafe { msg_send![self, label] }
unsafe {
let label = msg_send![self, label];
crate::nsstring_as_str(label)
}
}

pub fn set_label(&self, label: &str) {
unsafe { msg_send![self, setLabel: label] }
unsafe {
let nslabel = crate::nsstring_from_str(label);
let () = msg_send![self, setLabel: nslabel];
}
}

pub fn sample_count(&self) -> u64 {
Expand Down
17 changes: 17 additions & 0 deletions src/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1395,6 +1395,23 @@ impl BlitCommandEncoderRef {
unsafe { msg_send![self, waitForFence: fence] }
}

/// See: <https://developer.apple.com/documentation/metal/mtlblitcommandencoder/3194348-samplecountersinbuffer>
pub fn sample_counters_in_buffer(
&self,
sample_buffer: &CounterSampleBufferRef,
sample_index: NSUInteger,
with_barrier: bool,
) {
unsafe {
msg_send![self,
sampleCountersInBuffer: sample_buffer
atSampleIndex: sample_index
withBarrier: with_barrier
]
}
}

/// See: <https://developer.apple.com/documentation/metal/mtlblitcommandencoder/3194347-resolvecounters>
pub fn resolve_counters(
&self,
sample_buffer: &CounterSampleBufferRef,
Expand Down

0 comments on commit 875d91e

Please sign in to comment.