File tree 1 file changed +18
-1
lines changed
1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 1
- use crate :: MTLStorageMode ;
1
+ use crate :: { MTLStorageMode , NSUInteger } ;
2
+ use std:: mem;
2
3
3
4
/// See <https://developer.apple.com/documentation/metal/mtlcountersamplebufferdescriptor>
4
5
pub enum MTLCounterSampleBufferDescriptor { }
@@ -63,6 +64,22 @@ foreign_obj_type! {
63
64
pub struct CounterSampleBuffer ;
64
65
}
65
66
67
+ impl CounterSampleBufferRef {
68
+ pub fn sample_count ( & self ) -> u64 {
69
+ unsafe { msg_send ! [ self , sampleCount] }
70
+ }
71
+
72
+ pub fn resolve_counter_range ( & self , range : crate :: NSRange ) -> Vec < NSUInteger > {
73
+ let mut data = vec ! [ 0 as NSUInteger ; range. length as usize ] ;
74
+ let total_bytes = range. length * mem:: size_of :: < NSUInteger > ( ) as u64 ;
75
+ unsafe {
76
+ let ns_data: * mut crate :: Object = msg_send ! [ self , resolveCounterRange: range] ;
77
+ let ( ) = msg_send ! [ ns_data, getBytes: data. as_mut_ptr( ) length: total_bytes] ;
78
+ }
79
+ data
80
+ }
81
+ }
82
+
66
83
/// See <https://developer.apple.com/documentation/metal/mtlcounter>
67
84
pub enum MTLCounter { }
68
85
You can’t perform that action at this time.
0 commit comments