Skip to main content

mtl_gpu/enums/
capture.rs

1//! Capture manager enumerations.
2//!
3//! Corresponds to `Metal/MTLCaptureManager.hpp`.
4
5use mtl_foundation::Integer;
6
7/// Capture error codes.
8///
9/// C++ equivalent: `MTL::CaptureError`
10#[repr(transparent)]
11#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
12pub struct CaptureError(pub Integer);
13
14impl CaptureError {
15    pub const NOT_SUPPORTED: Self = Self(1);
16    pub const ALREADY_CAPTURING: Self = Self(2);
17    pub const INVALID_DESCRIPTOR: Self = Self(3);
18}
19
20/// Capture destination.
21///
22/// C++ equivalent: `MTL::CaptureDestination`
23#[repr(transparent)]
24#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
25pub struct CaptureDestination(pub Integer);
26
27impl CaptureDestination {
28    pub const DEVELOPER_TOOLS: Self = Self(1);
29    pub const GPU_TRACE_DOCUMENT: Self = Self(2);
30}
31
32#[cfg(test)]
33mod tests {
34    use super::*;
35
36    #[test]
37    fn test_capture_error_values() {
38        assert_eq!(CaptureError::NOT_SUPPORTED.0, 1);
39        assert_eq!(CaptureError::ALREADY_CAPTURING.0, 2);
40        assert_eq!(CaptureError::INVALID_DESCRIPTOR.0, 3);
41    }
42
43    #[test]
44    fn test_capture_destination_values() {
45        assert_eq!(CaptureDestination::DEVELOPER_TOOLS.0, 1);
46        assert_eq!(CaptureDestination::GPU_TRACE_DOCUMENT.0, 2);
47    }
48}