vulkayes_core/queue/
error.rs

1vk_result_error! {
2	#[derive(Debug)]
3	pub enum QueueSubmitError {
4		vk {
5			NOT_READY,
6			ERROR_OUT_OF_HOST_MEMORY,
7			ERROR_OUT_OF_DEVICE_MEMORY,
8			ERROR_DEVICE_LOST
9		}
10
11		#[cfg(feature = "runtime_implicit_validations")]
12		#[error("Queue family of the command buffer and of the queue does not match")]
13		QueueFamilyMismatch,
14
15		#[cfg(feature = "runtime_implicit_validations")]
16		#[error("Queue and fence must be from the same device")]
17		QueueFenceDeviceMismatch,
18
19		#[cfg(feature = "runtime_implicit_validations")]
20		#[error("Wait stage flags must not be empty for any of the the waits")]
21		WaitStagesEmpty,
22
23		#[cfg(feature = "runtime_implicit_validations")]
24		#[error("Wait semaphores, command buffers and signal semaphores must be from the same device")]
25		WaitBufferSignalDeviceMismatch,
26	}
27}
28
29vk_result_error! {
30	#[derive(Debug)]
31	pub enum QueueWaitError {
32		vk {
33			ERROR_OUT_OF_HOST_MEMORY,
34			ERROR_OUT_OF_DEVICE_MEMORY,
35			ERROR_DEVICE_LOST
36		}
37	}
38}
39
40vk_result_error! {
41	#[derive(Debug)]
42	pub enum QueuePresentError {
43		vk {
44			ERROR_OUT_OF_HOST_MEMORY,
45			ERROR_OUT_OF_DEVICE_MEMORY,
46			ERROR_DEVICE_LOST,
47			ERROR_OUT_OF_DATE_KHR,
48			ERROR_SURFACE_LOST_KHR,
49			ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT
50		}
51
52		#[cfg(feature = "runtime_implicit_validations")]
53		#[error("Swapchains element must contain at least one element")]
54		SwapchainsEmpty,
55
56		#[cfg(feature = "runtime_implicit_validations")]
57		#[error("Swapchains and wait semaphores must come from the same instance")]
58		SwapchainsSempahoredInstanceMismatch
59	}
60}
61#[derive(Debug)]
62#[allow(non_camel_case_types)]
63pub enum QueuePresentResultValue {
64	SUCCESS,
65	SUBOPTIMAL_KHR
66}
67impl From<bool> for QueuePresentResultValue {
68	fn from(value: bool) -> Self {
69		if value {
70			QueuePresentResultValue::SUBOPTIMAL_KHR
71		} else {
72			QueuePresentResultValue::SUCCESS
73		}
74	}
75}
76pub type QueuePresentResult = Result<QueuePresentResultValue, QueuePresentError>;
77#[derive(Debug)]
78pub enum QueuePresentMultipleResult<A: AsRef<[QueuePresentResult]> = [QueuePresentResult; 0]> {
79	Single(QueuePresentResult),
80	Multiple(A)
81}
82impl<A: AsRef<[QueuePresentResult]>> QueuePresentMultipleResult<A> {
83	pub fn get_single(self) -> Option<QueuePresentResult> {
84		match self {
85			QueuePresentMultipleResult::Single(v) => Some(v),
86			_ => None
87		}
88	}
89
90	pub fn get_multiple(self) -> Option<A> {
91		match self {
92			QueuePresentMultipleResult::Multiple(v) => Some(v),
93			_ => None
94		}
95	}
96}
97impl<A: AsRef<[QueuePresentResult]>> From<QueuePresentResult> for QueuePresentMultipleResult<A> {
98	fn from(value: QueuePresentResult) -> Self {
99		QueuePresentMultipleResult::Single(value)
100	}
101}