vulkanalia/vk/
enums.rs

1// SPDX-License-Identifier: Apache-2.0
2
3// DO NOT EDIT.
4//
5// This file has been generated by the Kotlin project in the `generator`
6// directory from a Vulkan API registry.
7
8#![allow(
9    non_camel_case_types,
10    non_snake_case,
11    clippy::bad_bit_mask,
12    clippy::let_unit_value,
13    clippy::missing_safety_doc,
14    clippy::missing_transmute_annotations,
15    clippy::too_many_arguments,
16    clippy::type_complexity,
17    clippy::unnecessary_cast,
18    clippy::upper_case_acronyms,
19    clippy::useless_transmute
20)]
21
22use core::fmt;
23
24#[cfg(all(feature = "no_std_error", not(feature = "std")))]
25use core::error;
26#[cfg(feature = "std")]
27use std::error;
28
29use super::Result;
30
31/// Result codes that indicate successes.
32#[repr(transparent)]
33#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
34pub struct SuccessCode(i32);
35
36impl SuccessCode {
37    pub const SUCCESS: Self = Self(0);
38    pub const NOT_READY: Self = Self(1);
39    pub const TIMEOUT: Self = Self(2);
40    pub const EVENT_SET: Self = Self(3);
41    pub const EVENT_RESET: Self = Self(4);
42    pub const INCOMPLETE: Self = Self(5);
43    pub const PIPELINE_COMPILE_REQUIRED: Self = Self(1000297000);
44    pub const SUBOPTIMAL_KHR: Self = Self(1000001003);
45    pub const THREAD_IDLE_KHR: Self = Self(1000268000);
46    pub const THREAD_DONE_KHR: Self = Self(1000268001);
47    pub const OPERATION_DEFERRED_KHR: Self = Self(1000268002);
48    pub const OPERATION_NOT_DEFERRED_KHR: Self = Self(1000268003);
49    pub const INCOMPATIBLE_SHADER_BINARY_EXT: Self = Self(1000482000);
50    pub const PIPELINE_BINARY_MISSING_KHR: Self = Self(1000483000);
51
52    /// Constructs an instance of this enum with the supplied underlying value.
53    #[inline]
54    pub const fn from_raw(value: i32) -> Self {
55        Self(value)
56    }
57
58    /// Gets the underlying value for this enum instance.
59    #[inline]
60    pub const fn as_raw(self) -> i32 {
61        self.0
62    }
63}
64
65impl fmt::Debug for SuccessCode {
66    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
67        Result::from_raw(self.as_raw()).fmt(f)
68    }
69}
70
71impl fmt::Display for SuccessCode {
72    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
73        Result::from_raw(self.as_raw()).fmt(f)
74    }
75}
76
77impl From<Result> for SuccessCode {
78    #[inline]
79    fn from(result: Result) -> Self {
80        Self::from_raw(result.as_raw())
81    }
82}
83
84impl From<SuccessCode> for Result {
85    #[inline]
86    fn from(code: SuccessCode) -> Self {
87        Result::from_raw(code.as_raw())
88    }
89}
90
91/// Result codes that indicate errors.
92#[repr(transparent)]
93#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
94pub struct ErrorCode(i32);
95
96impl ErrorCode {
97    pub const OUT_OF_HOST_MEMORY: Self = Self(-1);
98    pub const OUT_OF_DEVICE_MEMORY: Self = Self(-2);
99    pub const INITIALIZATION_FAILED: Self = Self(-3);
100    pub const DEVICE_LOST: Self = Self(-4);
101    pub const MEMORY_MAP_FAILED: Self = Self(-5);
102    pub const LAYER_NOT_PRESENT: Self = Self(-6);
103    pub const EXTENSION_NOT_PRESENT: Self = Self(-7);
104    pub const FEATURE_NOT_PRESENT: Self = Self(-8);
105    pub const INCOMPATIBLE_DRIVER: Self = Self(-9);
106    pub const TOO_MANY_OBJECTS: Self = Self(-10);
107    pub const FORMAT_NOT_SUPPORTED: Self = Self(-11);
108    pub const FRAGMENTED_POOL: Self = Self(-12);
109    pub const UNKNOWN: Self = Self(-13);
110    pub const OUT_OF_POOL_MEMORY: Self = Self(-1000069000);
111    pub const INVALID_EXTERNAL_HANDLE: Self = Self(-1000072003);
112    pub const FRAGMENTATION: Self = Self(-1000161000);
113    pub const INVALID_OPAQUE_CAPTURE_ADDRESS: Self = Self(-1000257000);
114    pub const NOT_PERMITTED: Self = Self(-1000174001);
115    pub const SURFACE_LOST_KHR: Self = Self(-1000000000);
116    pub const NATIVE_WINDOW_IN_USE_KHR: Self = Self(-1000000001);
117    pub const OUT_OF_DATE_KHR: Self = Self(-1000001004);
118    pub const INCOMPATIBLE_DISPLAY_KHR: Self = Self(-1000003001);
119    pub const VALIDATION_FAILED_EXT: Self = Self(-1000011001);
120    pub const INVALID_SHADER_NV: Self = Self(-1000012000);
121    pub const IMAGE_USAGE_NOT_SUPPORTED_KHR: Self = Self(-1000023000);
122    pub const VIDEO_PICTURE_LAYOUT_NOT_SUPPORTED_KHR: Self = Self(-1000023001);
123    pub const VIDEO_PROFILE_OPERATION_NOT_SUPPORTED_KHR: Self = Self(-1000023002);
124    pub const VIDEO_PROFILE_FORMAT_NOT_SUPPORTED_KHR: Self = Self(-1000023003);
125    pub const VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR: Self = Self(-1000023004);
126    pub const VIDEO_STD_VERSION_NOT_SUPPORTED_KHR: Self = Self(-1000023005);
127    pub const INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT: Self = Self(-1000158000);
128    pub const FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT: Self = Self(-1000255000);
129    pub const INVALID_VIDEO_STD_PARAMETERS_KHR: Self = Self(-1000299000);
130    pub const COMPRESSION_EXHAUSTED_EXT: Self = Self(-1000338000);
131    pub const NOT_ENOUGH_SPACE_KHR: Self = Self(-1000483000);
132
133    /// Constructs an instance of this enum with the supplied underlying value.
134    #[inline]
135    pub const fn from_raw(value: i32) -> Self {
136        Self(value)
137    }
138
139    /// Gets the underlying value for this enum instance.
140    #[inline]
141    pub const fn as_raw(self) -> i32 {
142        self.0
143    }
144}
145
146impl fmt::Debug for ErrorCode {
147    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
148        Result::from_raw(self.as_raw()).fmt(f)
149    }
150}
151
152impl fmt::Display for ErrorCode {
153    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
154        Result::from_raw(self.as_raw()).fmt(f)
155    }
156}
157
158#[cfg(any(feature = "std", feature = "no_std_error"))]
159impl error::Error for ErrorCode {}
160
161impl From<Result> for ErrorCode {
162    #[inline]
163    fn from(result: Result) -> Self {
164        Self::from_raw(result.as_raw())
165    }
166}
167
168impl From<ErrorCode> for Result {
169    #[inline]
170    fn from(code: ErrorCode) -> Self {
171        Result::from_raw(code.as_raw())
172    }
173}