Add Error trait to vk::Result
This commit is contained in:
parent
5bf9acbdfc
commit
9939be179c
|
@ -1,6 +1,7 @@
|
||||||
pub use std::os::raw::c_ulonglong;
|
pub use std::os::raw::c_ulonglong;
|
||||||
pub use self::types::*;
|
pub use self::types::*;
|
||||||
pub use self::cmds::*;
|
pub use self::cmds::*;
|
||||||
|
use std::error::Error;
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
|
@ -679,13 +680,17 @@ pub mod types {
|
||||||
max_tessellation_generation_level: self.max_tessellation_generation_level.clone(),
|
max_tessellation_generation_level: self.max_tessellation_generation_level.clone(),
|
||||||
max_tessellation_patch_size: self.max_tessellation_patch_size.clone(),
|
max_tessellation_patch_size: self.max_tessellation_patch_size.clone(),
|
||||||
max_tessellation_control_per_vertex_input_components:
|
max_tessellation_control_per_vertex_input_components:
|
||||||
self.max_tessellation_control_per_vertex_input_components.clone(),
|
self.max_tessellation_control_per_vertex_input_components
|
||||||
|
.clone(),
|
||||||
max_tessellation_control_per_vertex_output_components:
|
max_tessellation_control_per_vertex_output_components:
|
||||||
self.max_tessellation_control_per_vertex_output_components.clone(),
|
self.max_tessellation_control_per_vertex_output_components
|
||||||
|
.clone(),
|
||||||
max_tessellation_control_per_patch_output_components:
|
max_tessellation_control_per_patch_output_components:
|
||||||
self.max_tessellation_control_per_patch_output_components.clone(),
|
self.max_tessellation_control_per_patch_output_components
|
||||||
|
.clone(),
|
||||||
max_tessellation_control_total_output_components:
|
max_tessellation_control_total_output_components:
|
||||||
self.max_tessellation_control_total_output_components.clone(),
|
self.max_tessellation_control_total_output_components
|
||||||
|
.clone(),
|
||||||
max_tessellation_evaluation_input_components:
|
max_tessellation_evaluation_input_components:
|
||||||
self.max_tessellation_evaluation_input_components.clone(),
|
self.max_tessellation_evaluation_input_components.clone(),
|
||||||
max_tessellation_evaluation_output_components:
|
max_tessellation_evaluation_output_components:
|
||||||
|
@ -2658,6 +2663,71 @@ pub mod types {
|
||||||
ErrorValidationFailedExt = -1000011001,
|
ErrorValidationFailedExt = -1000011001,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for Result {
|
||||||
|
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
writeln!(fmt, "vk::Result::{:?}", self)?;
|
||||||
|
match *self {
|
||||||
|
Result::Success => write!(fmt, "Command successfully completed"),
|
||||||
|
Result::NotReady => write!(fmt, "A fence or query has not yet completed"),
|
||||||
|
Result::Timeout => {
|
||||||
|
write!(fmt,
|
||||||
|
"A wait operation has not completed in the specified time")
|
||||||
|
}
|
||||||
|
Result::EventSet => write!(fmt, "An event is signaled"),
|
||||||
|
Result::EventReset => write!(fmt, "An event is unsignaled"),
|
||||||
|
Result::Incomplete => write!(fmt, "A return array was too small for the result"),
|
||||||
|
Result::ErrorOutOfHostMemory => write!(fmt, "A host memory allocation has failed."),
|
||||||
|
Result::ErrorOutOfDeviceMemory => {
|
||||||
|
write!(fmt, "A device memory allocation has failed.")
|
||||||
|
}
|
||||||
|
Result::ErrorInitializationFailed => {
|
||||||
|
write!(fmt,
|
||||||
|
"Initialization of an object could not be completed for implementation-specific reasons.")
|
||||||
|
}
|
||||||
|
Result::ErrorDeviceLost => {
|
||||||
|
write!(fmt,
|
||||||
|
"The logical or physical device has been lost. See Lost Device")
|
||||||
|
}
|
||||||
|
Result::ErrorMemoryMapFailed => {
|
||||||
|
write!(fmt, "Mapping of a memory object has failed.")
|
||||||
|
}
|
||||||
|
Result::ErrorLayerNotPresent => {
|
||||||
|
write!(fmt,
|
||||||
|
"A requested layer is not present or could not be loaded.")
|
||||||
|
}
|
||||||
|
Result::ErrorExtensionNotPresent => {
|
||||||
|
write!(fmt, "A requested extension is not supported.")
|
||||||
|
}
|
||||||
|
Result::ErrorFeatureNotPresent => {
|
||||||
|
write!(fmt, "A requested feature is not supported.")
|
||||||
|
}
|
||||||
|
Result::ErrorIncompatibleDriver => {
|
||||||
|
write!(fmt,
|
||||||
|
"The requested version of Vulkan is not supported by the driver or is otherwise incompatible for implementation-specific reasons.")
|
||||||
|
}
|
||||||
|
Result::ErrorTooManyObjects => {
|
||||||
|
write!(fmt,
|
||||||
|
"Too many objects of the type have already been created.")
|
||||||
|
}
|
||||||
|
|
||||||
|
Result::ErrorFormatNotSupported => {
|
||||||
|
write!(fmt, "A requested format is not supported on this device.")
|
||||||
|
}
|
||||||
|
Result::ErrorFragmentedPool => {
|
||||||
|
write!(fmt,
|
||||||
|
"A pool allocation has failed due to fragmentation of the pool’s memory. This must only be returned if no attempt to allocate host or device memory was made to accomodate the new allocation.")
|
||||||
|
}
|
||||||
|
_ => write!(fmt, ""),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Error for Result {
|
||||||
|
fn description(&self) -> &str {
|
||||||
|
"vk::Result"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
pub enum Format {
|
pub enum Format {
|
||||||
|
|
Loading…
Reference in a new issue