Fixed warnings (#1363)

* Fixed all warnings as of Rust 1.43.1

* Update CHANGELOG_VULKANO.md

- Fixed all warnings as of Rust 1.43.1
This commit is contained in:
one-bit 2020-05-13 01:57:40 +01:00 committed by GitHub
parent df493136cf
commit c96309e55e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
57 changed files with 467 additions and 781 deletions

View File

@ -1,5 +1,6 @@
# Unreleased
- Fixed all warnings as of Rust 1.43.1
- Provides new API to fetch additional information of the Physical Device from the `PhysicalDeviceProperties2KHR` structure whenever it possible. In the current implementation only `subgroupSize` property is fetching. This interface can be extended in the future to obtain more metadata depending on community needs.
- `dynamic-local-size` compute shader example added showing how to utilize `subgroupSize` to compute and set shader's local size in run time.
- Fixed Vulkano Shaders bug when compute shader local group layout values bound to specialization constants. Now it is possible to define the layout in form of `layout(local_size_x_id = 12, local_size_y_id = 13, local_size_z = 1) in;` and then set the values as `SpecializationConstants {constant_12: 8, constant_13: 4, ...}`.

View File

@ -1011,9 +1011,9 @@ pub const DESCRIPTOR_UPDATE_TEMPLATE_TYPE_BEGIN_RANGE_KHR: u32 =
pub const DESCRIPTOR_UPDATE_TEMPLATE_TYPE_END_RANGE_KHR: u32 =
DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR;
pub const DESCRIPTOR_UPDATE_TEMPLATE_TYPE_RANGE_SIZE_KHR: u32 =
(DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR
DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR
- DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET_KHR
+ 1);
+ 1;
pub type DescriptorUpdateTemplateCreateFlagsKHR = Flags;
pub type PFN_vkAllocationFunction =

View File

@ -152,7 +152,7 @@ pub fn compile(
) -> Result<CompilationArtifact, String> {
let mut compiler = Compiler::new().ok_or("failed to create GLSL compiler")?;
let mut compile_options = CompileOptions::new().ok_or("failed to initialize compile option")?;
const ENV_VULKAN_VERSION: u32 = ((1 << 22) | (1 << 12));
const ENV_VULKAN_VERSION: u32 = (1 << 22) | (1 << 12);
compile_options.set_target_env(TargetEnv::Vulkan, ENV_VULKAN_VERSION);
let root_source_path = if let &Some(ref path) = &path {
path

View File

@ -91,14 +91,6 @@ pub enum CreationError {
}
impl error::Error for CreationError {
#[inline]
fn description(&self) -> &str {
match *self {
CreationError::SurfaceCreationError(_) => "error while creating the surface",
CreationError::WindowCreationError(_) => "error while creating the window",
}
}
#[inline]
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
@ -111,7 +103,10 @@ impl error::Error for CreationError {
impl fmt::Display for CreationError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
CreationError::SurfaceCreationError(_) => "error while creating the surface",
CreationError::WindowCreationError(_) => "error while creating the window",
})
}
}

View File

@ -567,24 +567,19 @@ pub enum ReadLockError {
GpuWriteLocked,
}
impl error::Error for ReadLockError {
impl error::Error for ReadLockError {}
impl fmt::Display for ReadLockError {
#[inline]
fn description(&self) -> &str {
match *self {
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", match *self {
ReadLockError::CpuWriteLocked => {
"the buffer is already locked for write mode by the CPU"
}
ReadLockError::GpuWriteLocked => {
"the buffer is already locked for write mode by the GPU"
}
}
}
}
impl fmt::Display for ReadLockError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
})
}
}
@ -636,20 +631,15 @@ pub enum WriteLockError {
GpuLocked,
}
impl error::Error for WriteLockError {
#[inline]
fn description(&self) -> &str {
match *self {
WriteLockError::CpuLocked => "the buffer is already locked by the CPU",
WriteLockError::GpuLocked => "the buffer is already locked by the GPU",
}
}
}
impl error::Error for WriteLockError {}
impl fmt::Display for WriteLockError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
WriteLockError::CpuLocked => "the buffer is already locked by the CPU",
WriteLockError::GpuLocked => "the buffer is already locked by the GPU",
})
}
}

View File

@ -430,22 +430,6 @@ pub enum BufferCreationError {
}
impl error::Error for BufferCreationError {
#[inline]
fn description(&self) -> &str {
match *self {
BufferCreationError::AllocError(_) => "allocating memory failed",
BufferCreationError::SparseBindingFeatureNotEnabled => {
"sparse binding was requested but the corresponding feature wasn't enabled"
}
BufferCreationError::SparseResidencyBufferFeatureNotEnabled => {
"sparse residency was requested but the corresponding feature wasn't enabled"
}
BufferCreationError::SparseResidencyAliasedFeatureNotEnabled => {
"sparse aliasing was requested but the corresponding feature wasn't enabled"
}
}
}
#[inline]
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
@ -458,7 +442,18 @@ impl error::Error for BufferCreationError {
impl fmt::Display for BufferCreationError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
BufferCreationError::AllocError(_) => "allocating memory failed",
BufferCreationError::SparseBindingFeatureNotEnabled => {
"sparse binding was requested but the corresponding feature wasn't enabled"
}
BufferCreationError::SparseResidencyBufferFeatureNotEnabled => {
"sparse residency was requested but the corresponding feature wasn't enabled"
}
BufferCreationError::SparseResidencyAliasedFeatureNotEnabled => {
"sparse aliasing was requested but the corresponding feature wasn't enabled"
}
})
}
}

View File

@ -316,8 +316,18 @@ pub enum BufferViewCreationError {
impl error::Error for BufferViewCreationError {
#[inline]
fn description(&self) -> &str {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
BufferViewCreationError::OomError(ref err) => Some(err),
_ => None,
}
}
}
impl fmt::Display for BufferViewCreationError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", match *self {
BufferViewCreationError::OomError(_) => "out of memory when creating buffer view",
BufferViewCreationError::WrongBufferUsage => {
"the buffer is missing correct usage flags"
@ -332,22 +342,7 @@ impl error::Error for BufferViewCreationError {
BufferViewCreationError::MaxTexelBufferElementsExceeded => {
"the maximum number of texel elements is exceeded"
}
}
}
#[inline]
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
BufferViewCreationError::OomError(ref err) => Some(err),
_ => None,
}
}
}
impl fmt::Display for BufferViewCreationError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
})
}
}

View File

@ -1830,17 +1830,6 @@ macro_rules! err_gen {
}
impl error::Error for $name {
#[inline]
fn description(&self) -> &str {
match *self {
$(
$name::$err(_) => {
concat!("a ", stringify!($err))
}
)+
}
}
#[inline]
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
@ -1854,7 +1843,13 @@ macro_rules! err_gen {
impl fmt::Display for $name {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
$(
$name::$err(_) => {
concat!("a ", stringify!($err))
}
)+
})
}
}
@ -1999,10 +1994,12 @@ pub enum AutoCommandBufferBuilderContextError {
IncompatibleRenderPass,
}
impl error::Error for AutoCommandBufferBuilderContextError {
impl error::Error for AutoCommandBufferBuilderContextError {}
impl fmt::Display for AutoCommandBufferBuilderContextError {
#[inline]
fn description(&self) -> &str {
match *self {
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", match *self {
AutoCommandBufferBuilderContextError::ForbiddenInSecondary => {
"operation forbidden in a secondary command buffer"
}
@ -2032,13 +2029,6 @@ impl error::Error for AutoCommandBufferBuilderContextError {
"tried to use a graphics pipeline whose render pass is incompatible with the \
current render pass"
}
}
}
}
impl fmt::Display for AutoCommandBufferBuilderContextError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
})
}
}

View File

@ -307,21 +307,16 @@ pub enum CommandPoolTrimError {
Maintenance1ExtensionNotEnabled,
}
impl error::Error for CommandPoolTrimError {
#[inline]
fn description(&self) -> &str {
match *self {
CommandPoolTrimError::Maintenance1ExtensionNotEnabled => {
"the `KHR_maintenance1` extension was not enabled"
}
}
}
}
impl error::Error for CommandPoolTrimError {}
impl fmt::Display for CommandPoolTrimError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
CommandPoolTrimError::Maintenance1ExtensionNotEnabled => {
"the `KHR_maintenance1` extension was not enabled"
}
})
}
}

View File

@ -479,14 +479,6 @@ pub enum SubmitBindSparseError {
}
impl error::Error for SubmitBindSparseError {
#[inline]
fn description(&self) -> &str {
match *self {
SubmitBindSparseError::OomError(_) => "not enough memory",
SubmitBindSparseError::DeviceLost => "the connection to the device has been lost",
}
}
#[inline]
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
@ -499,7 +491,10 @@ impl error::Error for SubmitBindSparseError {
impl fmt::Display for SubmitBindSparseError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
SubmitBindSparseError::OomError(_) => "not enough memory",
SubmitBindSparseError::DeviceLost => "the connection to the device has been lost",
})
}
}

View File

@ -223,19 +223,6 @@ pub enum SubmitPresentError {
}
impl error::Error for SubmitPresentError {
#[inline]
fn description(&self) -> &str {
match *self {
SubmitPresentError::OomError(_) => "not enough memory",
SubmitPresentError::DeviceLost => "the connection to the device has been lost",
SubmitPresentError::SurfaceLost => "the surface of this swapchain is no longer valid",
SubmitPresentError::OutOfDate => "the swapchain needs to be recreated",
SubmitPresentError::FullscreenExclusiveLost => {
"the swapchain no longer has fullscreen exclusivity"
}
}
}
#[inline]
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
@ -248,7 +235,15 @@ impl error::Error for SubmitPresentError {
impl fmt::Display for SubmitPresentError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
SubmitPresentError::OomError(_) => "not enough memory",
SubmitPresentError::DeviceLost => "the connection to the device has been lost",
SubmitPresentError::SurfaceLost => "the surface of this swapchain is no longer valid",
SubmitPresentError::OutOfDate => "the swapchain needs to be recreated",
SubmitPresentError::FullscreenExclusiveLost => {
"the swapchain no longer has fullscreen exclusivity"
}
})
}
}

View File

@ -261,14 +261,6 @@ pub enum SubmitCommandBufferError {
}
impl error::Error for SubmitCommandBufferError {
#[inline]
fn description(&self) -> &str {
match *self {
SubmitCommandBufferError::OomError(_) => "not enough memory",
SubmitCommandBufferError::DeviceLost => "the connection to the device has been lost",
}
}
#[inline]
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
@ -281,7 +273,10 @@ impl error::Error for SubmitCommandBufferError {
impl fmt::Display for SubmitCommandBufferError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
SubmitCommandBufferError::OomError(_) => "not enough memory",
SubmitCommandBufferError::DeviceLost => "the connection to the device has been lost",
})
}
}

View File

@ -155,19 +155,14 @@ pub enum SyncCommandBufferBuilderError {
},
}
impl error::Error for SyncCommandBufferBuilderError {
#[inline]
fn description(&self) -> &str {
match *self {
SyncCommandBufferBuilderError::Conflict { .. } => "unsolvable conflict",
}
}
}
impl error::Error for SyncCommandBufferBuilderError {}
impl fmt::Display for SyncCommandBufferBuilderError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
SyncCommandBufferBuilderError::Conflict { .. } => "unsolvable conflict",
})
}
}

View File

@ -405,22 +405,6 @@ pub enum CommandBufferExecError {
}
impl error::Error for CommandBufferExecError {
#[inline]
fn description(&self) -> &str {
match *self {
CommandBufferExecError::AccessError { .. } => "access to a resource has been denied",
CommandBufferExecError::OneTimeSubmitAlreadySubmitted => {
"the command buffer or one of the secondary command buffers it executes was \
created with the \"one time submit\" flag, but has already been submitted it \
the past"
}
CommandBufferExecError::ExclusiveAlreadyInUse => {
"the command buffer or one of the secondary command buffers it executes is \
already in use by the GPU and was not created with the \"concurrent\" flag"
}
}
}
#[inline]
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
@ -433,6 +417,17 @@ impl error::Error for CommandBufferExecError {
impl fmt::Display for CommandBufferExecError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
CommandBufferExecError::AccessError { .. } => "access to a resource has been denied",
CommandBufferExecError::OneTimeSubmitAlreadySubmitted => {
"the command buffer or one of the secondary command buffers it executes was \
created with the \"one time submit\" flag, but has already been submitted it \
the past"
}
CommandBufferExecError::ExclusiveAlreadyInUse => {
"the command buffer or one of the secondary command buffers it executes is \
already in use by the GPU and was not created with the \"concurrent\" flag"
}
})
}
}

View File

@ -248,10 +248,12 @@ pub enum CheckBlitImageError {
IncompatibleRangeForImageType,
}
impl error::Error for CheckBlitImageError {
impl error::Error for CheckBlitImageError {}
impl fmt::Display for CheckBlitImageError {
#[inline]
fn description(&self) -> &str {
match *self {
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", match *self {
CheckBlitImageError::MissingTransferSourceUsage => {
"the source is missing the transfer source usage"
}
@ -288,13 +290,6 @@ impl error::Error for CheckBlitImageError {
CheckBlitImageError::IncompatibleRangeForImageType => {
"the top-left and/or bottom-right coordinates are incompatible with the image type"
}
}
}
}
impl fmt::Display for CheckBlitImageError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
})
}
}

View File

@ -60,23 +60,18 @@ pub enum CheckClearColorImageError {
OutOfRange,
}
impl error::Error for CheckClearColorImageError {
impl error::Error for CheckClearColorImageError {}
impl fmt::Display for CheckClearColorImageError {
#[inline]
fn description(&self) -> &str {
match *self {
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", match *self {
CheckClearColorImageError::MissingTransferUsage => {
"the image is missing the transfer destination usage"
}
CheckClearColorImageError::OutOfRange => {
"the array layers and mipmap levels are out of range"
}
}
}
}
impl fmt::Display for CheckClearColorImageError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
})
}
}

View File

@ -80,10 +80,12 @@ pub enum CheckCopyBufferError {
OverlappingRanges,
}
impl error::Error for CheckCopyBufferError {
impl error::Error for CheckCopyBufferError {}
impl fmt::Display for CheckCopyBufferError {
#[inline]
fn description(&self) -> &str {
match *self {
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", match *self {
CheckCopyBufferError::SourceMissingTransferUsage => {
"the source buffer is missing the transfer source usage"
}
@ -91,13 +93,6 @@ impl error::Error for CheckCopyBufferError {
"the destination buffer is missing the transfer destination usage"
}
CheckCopyBufferError::OverlappingRanges => "the source and destination are overlapping",
}
}
}
impl fmt::Display for CheckCopyBufferError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
})
}
}

View File

@ -200,10 +200,12 @@ pub enum CheckCopyImageError {
IncompatibleRangeForImageType,
}
impl error::Error for CheckCopyImageError {
impl error::Error for CheckCopyImageError {}
impl fmt::Display for CheckCopyImageError {
#[inline]
fn description(&self) -> &str {
match *self {
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", match *self {
CheckCopyImageError::MissingTransferSourceUsage => {
"the source is missing the transfer source usage"
}
@ -231,13 +233,6 @@ impl error::Error for CheckCopyImageError {
CheckCopyImageError::IncompatibleRangeForImageType => {
"the offsets or extent are incompatible with the image type"
}
}
}
}
impl fmt::Display for CheckCopyImageError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
})
}
}

View File

@ -211,9 +211,18 @@ pub enum CheckCopyBufferImageError {
}
impl error::Error for CheckCopyBufferImageError {
#[inline]
fn description(&self) -> &str {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
CheckCopyBufferImageError::WrongPixelType(ref err) => Some(err),
_ => None,
}
}
}
impl fmt::Display for CheckCopyBufferImageError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", match *self {
CheckCopyBufferImageError::SourceMissingTransferUsage => {
"the source buffer is missing the transfer source usage"
}
@ -235,21 +244,7 @@ impl error::Error for CheckCopyBufferImageError {
CheckCopyBufferImageError::BufferTooSmall { .. } => {
"the buffer is too small for the copy operation"
}
}
}
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
CheckCopyBufferImageError::WrongPixelType(ref err) => Some(err),
_ => None,
}
}
}
impl fmt::Display for CheckCopyBufferImageError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
})
}
}

View File

@ -80,18 +80,6 @@ pub enum CheckDescriptorSetsValidityError {
}
impl error::Error for CheckDescriptorSetsValidityError {
#[inline]
fn description(&self) -> &str {
match *self {
CheckDescriptorSetsValidityError::MissingDescriptor { .. } => {
"a descriptor is missing in the descriptor sets that were provided"
}
CheckDescriptorSetsValidityError::IncompatibleDescriptor { .. } => {
"a descriptor in the provided sets is not compatible with what is expected"
}
}
}
#[inline]
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
@ -106,7 +94,14 @@ impl error::Error for CheckDescriptorSetsValidityError {
impl fmt::Display for CheckDescriptorSetsValidityError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
CheckDescriptorSetsValidityError::MissingDescriptor { .. } => {
"a descriptor is missing in the descriptor sets that were provided"
}
CheckDescriptorSetsValidityError::IncompatibleDescriptor { .. } => {
"a descriptor in the provided sets is not compatible with what is expected"
}
})
}
}

View File

@ -41,21 +41,16 @@ pub enum CheckDispatchError {
},
}
impl error::Error for CheckDispatchError {
#[inline]
fn description(&self) -> &str {
match *self {
CheckDispatchError::UnsupportedDimensions { .. } => {
"the dimensions are too large for the device's limits"
}
}
}
}
impl error::Error for CheckDispatchError {}
impl fmt::Display for CheckDispatchError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
CheckDispatchError::UnsupportedDimensions { .. } => {
"the dimensions are too large for the device's limits"
}
})
}
}

View File

@ -150,10 +150,12 @@ pub enum CheckDynamicStateValidityError {
ReferenceMissing,
}
impl error::Error for CheckDynamicStateValidityError {
impl error::Error for CheckDynamicStateValidityError {}
impl fmt::Display for CheckDynamicStateValidityError {
#[inline]
fn description(&self) -> &str {
match *self {
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", match *self {
CheckDynamicStateValidityError::LineWidthNotDynamic => {
"passed a dynamic line width, while the pipeline doesn't have line width set as \
dynamic"
@ -202,14 +204,7 @@ impl error::Error for CheckDynamicStateValidityError {
CheckDynamicStateValidityError::ReferenceMissing => {
"the pipeline has dynamic reference, but no reference was passed"
},
}
}
}
impl fmt::Display for CheckDynamicStateValidityError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
})
}
}

View File

@ -50,22 +50,17 @@ pub enum CheckFillBufferError {
WrongAlignment,
}
impl error::Error for CheckFillBufferError {
#[inline]
fn description(&self) -> &str {
match *self {
CheckFillBufferError::BufferMissingUsage => {
"the transfer destination usage must be enabled on the buffer"
}
CheckFillBufferError::WrongAlignment => "the offset or size are not aligned to 4 bytes",
}
}
}
impl error::Error for CheckFillBufferError {}
impl fmt::Display for CheckFillBufferError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
CheckFillBufferError::BufferMissingUsage => {
"the transfer destination usage must be enabled on the buffer"
}
CheckFillBufferError::WrongAlignment => "the offset or size are not aligned to 4 bytes",
})
}
}

View File

@ -67,10 +67,12 @@ pub enum CheckIndexBufferError {
UnsupportIndexType,
}
impl error::Error for CheckIndexBufferError {
impl error::Error for CheckIndexBufferError {}
impl fmt::Display for CheckIndexBufferError {
#[inline]
fn description(&self) -> &str {
match *self {
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", match *self {
CheckIndexBufferError::BufferMissingUsage => {
"the index buffer usage must be enabled on the index buffer"
}
@ -81,14 +83,7 @@ impl error::Error for CheckIndexBufferError {
CheckIndexBufferError::UnsupportIndexType => {
"the type of the indices is not supported by the device"
}
}
}
}
impl fmt::Display for CheckIndexBufferError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
})
}
}

View File

@ -36,20 +36,15 @@ pub enum CheckPushConstantsValidityError {
IncompatiblePushConstants,
}
impl error::Error for CheckPushConstantsValidityError {
#[inline]
fn description(&self) -> &str {
match *self {
CheckPushConstantsValidityError::IncompatiblePushConstants => {
"the push constants are incompatible with the pipeline layout"
}
}
}
}
impl error::Error for CheckPushConstantsValidityError {}
impl fmt::Display for CheckPushConstantsValidityError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
CheckPushConstantsValidityError::IncompatiblePushConstants => {
"the push constants are incompatible with the pipeline layout"
}
})
}
}

View File

@ -69,10 +69,12 @@ pub enum CheckUpdateBufferError {
DataTooLarge,
}
impl error::Error for CheckUpdateBufferError {
impl error::Error for CheckUpdateBufferError {}
impl fmt::Display for CheckUpdateBufferError {
#[inline]
fn description(&self) -> &str {
match *self {
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", match *self {
CheckUpdateBufferError::BufferMissingUsage => {
"the transfer destination usage must be enabled on the buffer"
}
@ -80,14 +82,7 @@ impl error::Error for CheckUpdateBufferError {
"the offset or size are not aligned to 4 bytes"
}
CheckUpdateBufferError::DataTooLarge => "data is too large",
}
}
}
impl fmt::Display for CheckUpdateBufferError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
})
}
}

View File

@ -68,20 +68,15 @@ pub enum CheckVertexBufferError {
},
}
impl error::Error for CheckVertexBufferError {
#[inline]
fn description(&self) -> &str {
match *self {
CheckVertexBufferError::BufferMissingUsage { .. } => {
"the vertex buffer usage is missing on a vertex buffer"
}
}
}
}
impl error::Error for CheckVertexBufferError {}
impl fmt::Display for CheckVertexBufferError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
CheckVertexBufferError::BufferMissingUsage { .. } => {
"the vertex buffer usage is missing on a vertex buffer"
}
})
}
}

View File

@ -594,10 +594,12 @@ pub enum DescriptorDescSupersetError {
},
}
impl error::Error for DescriptorDescSupersetError {
impl error::Error for DescriptorDescSupersetError {}
impl fmt::Display for DescriptorDescSupersetError {
#[inline]
fn description(&self) -> &str {
match *self {
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", match *self {
DescriptorDescSupersetError::ArrayTooSmall { .. } => {
"the number of array elements of the descriptor is smaller than expected"
}
@ -622,14 +624,7 @@ impl error::Error for DescriptorDescSupersetError {
DescriptorDescSupersetError::IncompatibleArrayLayers { .. } => {
"the array layers of the descriptors aren't compatible"
}
}
}
}
impl fmt::Display for DescriptorDescSupersetError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
})
}
}
@ -810,18 +805,13 @@ pub enum ShaderStagesSupersetError {
NotSuperset,
}
impl error::Error for ShaderStagesSupersetError {
#[inline]
fn description(&self) -> &str {
match *self {
ShaderStagesSupersetError::NotSuperset => "shader stages not a superset",
}
}
}
impl error::Error for ShaderStagesSupersetError {}
impl fmt::Display for ShaderStagesSupersetError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
ShaderStagesSupersetError::NotSuperset => "shader stages not a superset",
})
}
}

View File

@ -1191,10 +1191,12 @@ pub enum PersistentDescriptorSetError {
},
}
impl error::Error for PersistentDescriptorSetError {
impl error::Error for PersistentDescriptorSetError {}
impl fmt::Display for PersistentDescriptorSetError {
#[inline]
fn description(&self) -> &str {
match *self {
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", match *self {
PersistentDescriptorSetError::WrongDescriptorTy { .. } => {
"expected one type of resource but got another"
}
@ -1231,14 +1233,7 @@ impl error::Error for PersistentDescriptorSetError {
PersistentDescriptorSetError::ImageViewTypeMismatch { .. } => {
"the type of an image view doesn't match what was expected"
}
}
}
}
impl fmt::Display for PersistentDescriptorSetError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
})
}
}
@ -1257,17 +1252,7 @@ pub enum PersistentDescriptorSetBuildError {
},
}
impl error::Error for PersistentDescriptorSetBuildError {
#[inline]
fn description(&self) -> &str {
match *self {
PersistentDescriptorSetBuildError::MissingDescriptors { .. } => {
"didn't fill all the descriptors before building"
}
PersistentDescriptorSetBuildError::OomError(_) => "not enough memory available",
}
}
}
impl error::Error for PersistentDescriptorSetBuildError {}
impl From<OomError> for PersistentDescriptorSetBuildError {
#[inline]
@ -1279,6 +1264,11 @@ impl From<OomError> for PersistentDescriptorSetBuildError {
impl fmt::Display for PersistentDescriptorSetBuildError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
PersistentDescriptorSetBuildError::MissingDescriptors { .. } => {
"didn't fill all the descriptors before building"
}
PersistentDescriptorSetBuildError::OomError(_) => "not enough memory available",
})
}
}

View File

@ -519,10 +519,12 @@ pub enum DescriptorPoolAllocError {
OutOfPoolMemory,
}
impl error::Error for DescriptorPoolAllocError {
impl error::Error for DescriptorPoolAllocError {}
impl fmt::Display for DescriptorPoolAllocError {
#[inline]
fn description(&self) -> &str {
match *self {
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", match *self {
DescriptorPoolAllocError::OutOfHostMemory => "no memory available on the host",
DescriptorPoolAllocError::OutOfDeviceMemory => {
"no memory available on the graphical device"
@ -533,14 +535,7 @@ impl error::Error for DescriptorPoolAllocError {
DescriptorPoolAllocError::OutOfPoolMemory => {
"there is no more space available in the descriptor pool"
}
}
}
}
impl fmt::Display for DescriptorPoolAllocError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
})
}
}

View File

@ -375,10 +375,12 @@ pub enum PipelineLayoutLimitsError {
},
}
impl error::Error for PipelineLayoutLimitsError {
impl error::Error for PipelineLayoutLimitsError {}
impl fmt::Display for PipelineLayoutLimitsError {
#[inline]
fn description(&self) -> &str {
match *self {
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", match *self {
PipelineLayoutLimitsError::MaxDescriptorSetsLimitExceeded { .. } => {
"the maximum number of descriptor sets has been exceeded"
}
@ -430,14 +432,7 @@ impl error::Error for PipelineLayoutLimitsError {
PipelineLayoutLimitsError::MaxDescriptorSetInputAttachmentsLimitExceeded { .. } => {
"the `max_descriptor_set_input_attachments()` limit has been exceeded"
}
}
}
}
impl fmt::Display for PipelineLayoutLimitsError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
})
}
}

View File

@ -105,21 +105,16 @@ pub enum RuntimePipelineDescError {
},
}
impl error::Error for RuntimePipelineDescError {
#[inline]
fn description(&self) -> &str {
match *self {
RuntimePipelineDescError::PushConstantsConflict { .. } => {
"conflict between different push constants ranges"
}
}
}
}
impl error::Error for RuntimePipelineDescError {}
impl fmt::Display for RuntimePipelineDescError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
RuntimePipelineDescError::PushConstantsConflict { .. } => {
"conflict between different push constants ranges"
}
})
}
}

View File

@ -280,19 +280,6 @@ pub enum PipelineLayoutCreationError {
}
impl error::Error for PipelineLayoutCreationError {
#[inline]
fn description(&self) -> &str {
match *self {
PipelineLayoutCreationError::OomError(_) => "not enough memory available",
PipelineLayoutCreationError::LimitsError(_) => {
"the pipeline layout description doesn't fulfill the limit requirements"
}
PipelineLayoutCreationError::InvalidPushConstant => {
"one of the push constants range didn't obey the rules"
}
}
}
#[inline]
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
@ -306,7 +293,15 @@ impl error::Error for PipelineLayoutCreationError {
impl fmt::Display for PipelineLayoutCreationError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
PipelineLayoutCreationError::OomError(_) => "not enough memory available",
PipelineLayoutCreationError::LimitsError(_) => {
"the pipeline layout description doesn't fulfill the limit requirements"
}
PipelineLayoutCreationError::InvalidPushConstant => {
"one of the push constants range didn't obey the rules"
}
})
}
}

View File

@ -251,21 +251,6 @@ pub enum PipelineLayoutNotSupersetError {
}
impl error::Error for PipelineLayoutNotSupersetError {
#[inline]
fn description(&self) -> &str {
match *self {
PipelineLayoutNotSupersetError::DescriptorsCountMismatch { .. } => {
"there are more descriptors in the child than in the parent layout"
}
PipelineLayoutNotSupersetError::ExpectedEmptyDescriptor { .. } => {
"expected an empty descriptor, but got something instead"
}
PipelineLayoutNotSupersetError::IncompatibleDescriptors { .. } => {
"two descriptors are incompatible"
}
}
}
#[inline]
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
@ -280,7 +265,17 @@ impl error::Error for PipelineLayoutNotSupersetError {
impl fmt::Display for PipelineLayoutNotSupersetError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
PipelineLayoutNotSupersetError::DescriptorsCountMismatch { .. } => {
"there are more descriptors in the child than in the parent layout"
}
PipelineLayoutNotSupersetError::ExpectedEmptyDescriptor { .. } => {
"expected an empty descriptor, but got something instead"
}
PipelineLayoutNotSupersetError::IncompatibleDescriptors { .. } => {
"two descriptors are incompatible"
}
})
}
}

View File

@ -716,10 +716,12 @@ pub enum DeviceCreationError {
OutOfDeviceMemory,
}
impl error::Error for DeviceCreationError {
impl error::Error for DeviceCreationError {}
impl fmt::Display for DeviceCreationError {
#[inline]
fn description(&self) -> &str {
match *self {
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", match *self {
DeviceCreationError::InitializationFailed => {
"failed to create the device for an implementation-specific reason"
}
@ -742,14 +744,7 @@ impl error::Error for DeviceCreationError {
"you have reached the limit to the number of devices that can be created from the
same physical device"
}
}
}
}
impl fmt::Display for DeviceCreationError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
})
}
}

View File

@ -9,7 +9,6 @@
use std::error;
use std::fmt;
use std::str;
use instance::loader::LoadingError;
use Error;
@ -184,14 +183,6 @@ pub enum SupportedExtensionsError {
}
impl error::Error for SupportedExtensionsError {
#[inline]
fn description(&self) -> &str {
match *self {
SupportedExtensionsError::LoadingError(_) => "failed to load the Vulkan shared library",
SupportedExtensionsError::OomError(_) => "not enough memory available",
}
}
#[inline]
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
@ -204,7 +195,10 @@ impl error::Error for SupportedExtensionsError {
impl fmt::Display for SupportedExtensionsError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
SupportedExtensionsError::LoadingError(_) => "failed to load the Vulkan shared library",
SupportedExtensionsError::OomError(_) => "not enough memory available",
})
}
}

View File

@ -139,17 +139,12 @@ unsafe impl Data for u8 {
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct IncompatiblePixelsType;
impl error::Error for IncompatiblePixelsType {
#[inline]
fn description(&self) -> &str {
"supplied pixels' type is incompatible with this format"
}
}
impl error::Error for IncompatiblePixelsType {}
impl fmt::Display for IncompatiblePixelsType {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", "supplied pixels' type is incompatible with this format")
}
}

View File

@ -141,10 +141,12 @@ pub enum IncompatibleRenderPassAttachmentError {
MissingInputAttachmentUsage,
}
impl error::Error for IncompatibleRenderPassAttachmentError {
impl error::Error for IncompatibleRenderPassAttachmentError {}
impl fmt::Display for IncompatibleRenderPassAttachmentError {
#[inline]
fn description(&self) -> &str {
match *self {
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", match *self {
IncompatibleRenderPassAttachmentError::FormatMismatch { .. } => {
"mismatch between the format expected by the render pass and the actual format"
}
@ -166,14 +168,7 @@ impl error::Error for IncompatibleRenderPassAttachmentError {
"the image is used as an input attachment but is missing the input \
attachment usage"
}
}
}
}
impl fmt::Display for IncompatibleRenderPassAttachmentError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
})
}
}

View File

@ -515,8 +515,19 @@ impl From<OomError> for FramebufferCreationError {
impl error::Error for FramebufferCreationError {
#[inline]
fn description(&self) -> &str {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
FramebufferCreationError::OomError(ref err) => Some(err),
FramebufferCreationError::IncompatibleAttachment(ref err) => Some(err),
_ => None,
}
}
}
impl fmt::Display for FramebufferCreationError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", match *self {
FramebufferCreationError::OomError(_) => "no memory available",
FramebufferCreationError::DimensionsTooLarge => {
"the dimensions of the framebuffer are too large"
@ -533,23 +544,7 @@ impl error::Error for FramebufferCreationError {
FramebufferCreationError::CantDetermineDimensions => {
"the framebuffer has no attachment and no dimension was specified"
}
}
}
#[inline]
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
FramebufferCreationError::OomError(ref err) => Some(err),
FramebufferCreationError::IncompatibleAttachment(ref err) => Some(err),
_ => None,
}
}
}
impl fmt::Display for FramebufferCreationError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
})
}
}

View File

@ -545,16 +545,6 @@ pub enum RenderPassCreationError {
}
impl error::Error for RenderPassCreationError {
#[inline]
fn description(&self) -> &str {
match *self {
RenderPassCreationError::OomError(_) => "not enough memory available",
RenderPassCreationError::ColorAttachmentsLimitExceeded => {
"the maximum number of color attachments has been exceeded"
}
}
}
#[inline]
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
@ -567,7 +557,12 @@ impl error::Error for RenderPassCreationError {
impl fmt::Display for RenderPassCreationError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
RenderPassCreationError::OomError(_) => "not enough memory available",
RenderPassCreationError::ColorAttachmentsLimitExceeded => {
"the maximum number of color attachments has been exceeded"
}
})
}
}

View File

@ -922,8 +922,18 @@ pub enum ImageCreationError {
impl error::Error for ImageCreationError {
#[inline]
fn description(&self) -> &str {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
ImageCreationError::AllocError(ref err) => Some(err),
_ => None,
}
}
}
impl fmt::Display for ImageCreationError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", match *self {
ImageCreationError::AllocError(_) => "allocating memory failed",
ImageCreationError::InvalidMipmapsCount { .. } => {
"a wrong number of mipmaps was provided"
@ -945,22 +955,7 @@ impl error::Error for ImageCreationError {
"the `shader_storage_image_multisample` feature must be enabled to create such \
an image"
}
}
}
#[inline]
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
ImageCreationError::AllocError(ref err) => Some(err),
_ => None,
}
}
}
impl fmt::Display for ImageCreationError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
})
}
}

View File

@ -333,21 +333,16 @@ pub enum DebugCallbackCreationError {
MissingExtension,
}
impl error::Error for DebugCallbackCreationError {
#[inline]
fn description(&self) -> &str {
match *self {
DebugCallbackCreationError::MissingExtension => {
"the `EXT_debug_report` extension was not enabled"
}
}
}
}
impl error::Error for DebugCallbackCreationError {}
impl fmt::Display for DebugCallbackCreationError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
DebugCallbackCreationError::MissingExtension => {
"the `EXT_debug_report` extension was not enabled"
}
})
}
}

View File

@ -670,18 +670,6 @@ pub enum InstanceCreationError {
}
impl error::Error for InstanceCreationError {
#[inline]
fn description(&self) -> &str {
match *self {
InstanceCreationError::LoadingError(_) => "failed to load the Vulkan shared library",
InstanceCreationError::OomError(_) => "not enough memory available",
InstanceCreationError::InitializationFailed => "initialization failed",
InstanceCreationError::LayerNotPresent => "layer not present",
InstanceCreationError::ExtensionNotPresent => "extension not present",
InstanceCreationError::IncompatibleDriver => "incompatible driver",
}
}
#[inline]
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
@ -695,7 +683,14 @@ impl error::Error for InstanceCreationError {
impl fmt::Display for InstanceCreationError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
InstanceCreationError::LoadingError(_) => "failed to load the Vulkan shared library",
InstanceCreationError::OomError(_) => "not enough memory available",
InstanceCreationError::InitializationFailed => "initialization failed",
InstanceCreationError::LayerNotPresent => "layer not present",
InstanceCreationError::ExtensionNotPresent => "extension not present",
InstanceCreationError::IncompatibleDriver => "incompatible driver",
})
}
}

View File

@ -172,14 +172,6 @@ pub enum LayersListError {
}
impl error::Error for LayersListError {
#[inline]
fn description(&self) -> &str {
match *self {
LayersListError::LoadingError(_) => "failed to load the Vulkan shared library",
LayersListError::OomError(_) => "not enough memory available",
}
}
#[inline]
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
@ -192,7 +184,10 @@ impl error::Error for LayersListError {
impl fmt::Display for LayersListError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
LayersListError::LoadingError(_) => "failed to load the Vulkan shared library",
LayersListError::OomError(_) => "not enough memory available",
})
}
}

View File

@ -245,17 +245,6 @@ pub enum LoadingError {
}
impl error::Error for LoadingError {
#[inline]
fn description(&self) -> &str {
match *self {
LoadingError::LibraryLoadFailure(_) => "failed to load the Vulkan shared library",
LoadingError::MissingEntryPoint(_) => {
"one of the entry points required to be supported by the Vulkan implementation \
is missing"
}
}
}
/*#[inline]
fn cause(&self) -> Option<&error::Error> {
match *self {
@ -268,7 +257,13 @@ impl error::Error for LoadingError {
impl fmt::Display for LoadingError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
LoadingError::LibraryLoadFailure(_) => "failed to load the Vulkan shared library",
LoadingError::MissingEntryPoint(_) => {
"one of the entry points required to be supported by the Vulkan implementation \
is missing"
}
})
}
}

View File

@ -155,20 +155,15 @@ pub enum OomError {
OutOfDeviceMemory,
}
impl error::Error for OomError {
#[inline]
fn description(&self) -> &str {
match *self {
OomError::OutOfHostMemory => "no memory available on the host",
OomError::OutOfDeviceMemory => "no memory available on the graphical device",
}
}
}
impl error::Error for OomError {}
impl fmt::Display for OomError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
OomError::OutOfHostMemory => "no memory available on the host",
OomError::OutOfDeviceMemory => "no memory available on the graphical device",
})
}
}

View File

@ -484,17 +484,6 @@ pub enum DeviceMemoryAllocError {
}
impl error::Error for DeviceMemoryAllocError {
#[inline]
fn description(&self) -> &str {
match *self {
DeviceMemoryAllocError::OomError(_) => "not enough memory available",
DeviceMemoryAllocError::TooManyObjects => {
"the maximum number of allocations has been exceeded"
}
DeviceMemoryAllocError::MemoryMapFailed => "memory map failed",
}
}
#[inline]
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
@ -507,7 +496,13 @@ impl error::Error for DeviceMemoryAllocError {
impl fmt::Display for DeviceMemoryAllocError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
DeviceMemoryAllocError::OomError(_) => "not enough memory available",
DeviceMemoryAllocError::TooManyObjects => {
"the maximum number of allocations has been exceeded"
}
DeviceMemoryAllocError::MemoryMapFailed => "memory map failed",
})
}
}

View File

@ -324,19 +324,6 @@ pub enum ComputePipelineCreationError {
}
impl error::Error for ComputePipelineCreationError {
#[inline]
fn description(&self) -> &str {
match *self {
ComputePipelineCreationError::OomError(_) => "not enough memory available",
ComputePipelineCreationError::PipelineLayoutCreationError(_) => {
"error while creating the pipeline layout object"
}
ComputePipelineCreationError::IncompatiblePipelineLayout(_) => {
"the pipeline layout is not compatible with what the shader expects"
}
}
}
#[inline]
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
@ -350,7 +337,15 @@ impl error::Error for ComputePipelineCreationError {
impl fmt::Display for ComputePipelineCreationError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
ComputePipelineCreationError::OomError(_) => "not enough memory available",
ComputePipelineCreationError::PipelineLayoutCreationError(_) => {
"error while creating the pipeline layout object"
}
ComputePipelineCreationError::IncompatiblePipelineLayout(_) => {
"the pipeline layout is not compatible with what the shader expects"
}
})
}
}

View File

@ -186,9 +186,28 @@ pub enum GraphicsPipelineCreationError {
impl error::Error for GraphicsPipelineCreationError {
#[inline]
// TODO: finish
fn description(&self) -> &str {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
GraphicsPipelineCreationError::OomError(ref err) => Some(err),
GraphicsPipelineCreationError::IncompatiblePipelineLayout(ref err) => Some(err),
GraphicsPipelineCreationError::VertexGeometryStagesMismatch(ref err) => Some(err),
GraphicsPipelineCreationError::VertexTessControlStagesMismatch(ref err) => Some(err),
GraphicsPipelineCreationError::VertexFragmentStagesMismatch(ref err) => Some(err),
GraphicsPipelineCreationError::TessControlTessEvalStagesMismatch(ref err) => Some(err),
GraphicsPipelineCreationError::TessEvalGeometryStagesMismatch(ref err) => Some(err),
GraphicsPipelineCreationError::TessEvalFragmentStagesMismatch(ref err) => Some(err),
GraphicsPipelineCreationError::GeometryFragmentStagesMismatch(ref err) => Some(err),
GraphicsPipelineCreationError::IncompatibleVertexDefinition(ref err) => Some(err),
_ => None,
}
}
}
impl fmt::Display for GraphicsPipelineCreationError {
// TODO: finish
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", match *self {
GraphicsPipelineCreationError::OomError(_) => "not enough memory available",
GraphicsPipelineCreationError::VertexGeometryStagesMismatch(_) => {
"the interface between the vertex shader and the geometry shader mismatches"
@ -319,31 +338,7 @@ impl error::Error for GraphicsPipelineCreationError {
GraphicsPipelineCreationError::AlphaToOneFeatureNotEnabled => {
"the `alpha_to_one` feature must be enabled in order to use alpha-to-one"
}
}
}
#[inline]
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
GraphicsPipelineCreationError::OomError(ref err) => Some(err),
GraphicsPipelineCreationError::IncompatiblePipelineLayout(ref err) => Some(err),
GraphicsPipelineCreationError::VertexGeometryStagesMismatch(ref err) => Some(err),
GraphicsPipelineCreationError::VertexTessControlStagesMismatch(ref err) => Some(err),
GraphicsPipelineCreationError::VertexFragmentStagesMismatch(ref err) => Some(err),
GraphicsPipelineCreationError::TessControlTessEvalStagesMismatch(ref err) => Some(err),
GraphicsPipelineCreationError::TessEvalGeometryStagesMismatch(ref err) => Some(err),
GraphicsPipelineCreationError::TessEvalFragmentStagesMismatch(ref err) => Some(err),
GraphicsPipelineCreationError::GeometryFragmentStagesMismatch(ref err) => Some(err),
GraphicsPipelineCreationError::IncompatibleVertexDefinition(ref err) => Some(err),
_ => None,
}
}
}
impl fmt::Display for GraphicsPipelineCreationError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
})
}
}

View File

@ -556,10 +556,12 @@ pub enum ShaderInterfaceMismatchError {
},
}
impl error::Error for ShaderInterfaceMismatchError {
impl error::Error for ShaderInterfaceMismatchError {}
impl fmt::Display for ShaderInterfaceMismatchError {
#[inline]
fn description(&self) -> &str {
match *self {
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", match *self {
ShaderInterfaceMismatchError::ElementsCountMismatch { .. } => {
"the number of elements mismatches"
}
@ -567,14 +569,7 @@ impl error::Error for ShaderInterfaceMismatchError {
ShaderInterfaceMismatchError::FormatMismatch { .. } => {
"the format of an element does not match"
}
}
}
}
impl fmt::Display for ShaderInterfaceMismatchError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
})
}
}

View File

@ -91,22 +91,17 @@ pub enum IncompatibleVertexDefinitionError {
},
}
impl error::Error for IncompatibleVertexDefinitionError {
#[inline]
fn description(&self) -> &str {
match *self {
IncompatibleVertexDefinitionError::MissingAttribute { .. } => "an attribute is missing",
IncompatibleVertexDefinitionError::FormatMismatch { .. } => {
"the format of an attribute does not match"
}
}
}
}
impl error::Error for IncompatibleVertexDefinitionError {}
impl fmt::Display for IncompatibleVertexDefinitionError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
IncompatibleVertexDefinitionError::MissingAttribute { .. } => "an attribute is missing",
IncompatibleVertexDefinitionError::FormatMismatch { .. } => {
"the format of an attribute does not match"
}
})
}
}

View File

@ -275,17 +275,6 @@ pub enum QueryPoolCreationError {
}
impl error::Error for QueryPoolCreationError {
#[inline]
fn description(&self) -> &str {
match *self {
QueryPoolCreationError::OomError(_) => "not enough memory available",
QueryPoolCreationError::PipelineStatisticsQueryFeatureNotEnabled => {
"a pipeline statistics pool was requested but the corresponding feature \
wasn't enabled"
}
}
}
#[inline]
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
@ -298,7 +287,13 @@ impl error::Error for QueryPoolCreationError {
impl fmt::Display for QueryPoolCreationError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
QueryPoolCreationError::OomError(_) => "not enough memory available",
QueryPoolCreationError::PipelineStatisticsQueryFeatureNotEnabled => {
"a pipeline statistics pool was requested but the corresponding feature \
wasn't enabled"
}
})
}
}

View File

@ -723,22 +723,6 @@ pub enum SamplerCreationError {
}
impl error::Error for SamplerCreationError {
#[inline]
fn description(&self) -> &str {
match *self {
SamplerCreationError::OomError(_) => "not enough memory available",
SamplerCreationError::TooManyObjects => "too many simultaneous sampler objects",
SamplerCreationError::SamplerAnisotropyFeatureNotEnabled => {
"the `sampler_anisotropy` feature is not enabled"
}
SamplerCreationError::AnisotropyLimitExceeded { .. } => "anisotropy limit exceeded",
SamplerCreationError::MipLodBiasLimitExceeded { .. } => "mip lod bias limit exceeded",
SamplerCreationError::SamplerMirrorClampToEdgeExtensionNotEnabled => {
"the device extension `VK_KHR_sampler_mirror_clamp_to_edge` is not enabled"
}
}
}
#[inline]
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
@ -751,7 +735,18 @@ impl error::Error for SamplerCreationError {
impl fmt::Display for SamplerCreationError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
SamplerCreationError::OomError(_) => "not enough memory available",
SamplerCreationError::TooManyObjects => "too many simultaneous sampler objects",
SamplerCreationError::SamplerAnisotropyFeatureNotEnabled => {
"the `sampler_anisotropy` feature is not enabled"
}
SamplerCreationError::AnisotropyLimitExceeded { .. } => "anisotropy limit exceeded",
SamplerCreationError::MipLodBiasLimitExceeded { .. } => "mip lod bias limit exceeded",
SamplerCreationError::SamplerMirrorClampToEdgeExtensionNotEnabled => {
"the device extension `VK_KHR_sampler_mirror_clamp_to_edge` is not enabled"
}
})
}
}

View File

@ -707,16 +707,6 @@ pub enum SurfaceCreationError {
}
impl error::Error for SurfaceCreationError {
#[inline]
fn description(&self) -> &str {
match *self {
SurfaceCreationError::OomError(_) => "not enough memory available",
SurfaceCreationError::MissingExtension { .. } => {
"the extension required for this function was not enabled"
}
}
}
#[inline]
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
@ -729,7 +719,12 @@ impl error::Error for SurfaceCreationError {
impl fmt::Display for SurfaceCreationError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
SurfaceCreationError::OomError(_) => "not enough memory available",
SurfaceCreationError::MissingExtension { .. } => {
"the extension required for this function was not enabled"
}
})
}
}
@ -763,14 +758,6 @@ pub enum CapabilitiesError {
}
impl error::Error for CapabilitiesError {
#[inline]
fn description(&self) -> &str {
match *self {
CapabilitiesError::OomError(_) => "not enough memory",
CapabilitiesError::SurfaceLost => "the surface is no longer valid",
}
}
#[inline]
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
@ -783,7 +770,10 @@ impl error::Error for CapabilitiesError {
impl fmt::Display for CapabilitiesError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
CapabilitiesError::OomError(_) => "not enough memory",
CapabilitiesError::SurfaceLost => "the surface is no longer valid",
})
}
}

View File

@ -955,8 +955,18 @@ pub enum SwapchainCreationError {
impl error::Error for SwapchainCreationError {
#[inline]
fn description(&self) -> &str {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
SwapchainCreationError::OomError(ref err) => Some(err),
_ => None,
}
}
}
impl fmt::Display for SwapchainCreationError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", match *self {
SwapchainCreationError::OomError(_) => "not enough memory available",
SwapchainCreationError::DeviceLost => "the device was lost",
SwapchainCreationError::SurfaceLost => "the surface was lost",
@ -1008,22 +1018,7 @@ impl error::Error for SwapchainCreationError {
SwapchainCreationError::UnsupportedImageConfiguration => {
"the requested image configuration is not supported by the physical device"
}
}
}
#[inline]
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
SwapchainCreationError::OomError(ref err) => Some(err),
_ => None,
}
}
}
impl fmt::Display for SwapchainCreationError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
})
}
}
@ -1209,13 +1204,6 @@ pub enum FullscreenExclusiveError {
NotAppControlled,
}
impl fmt::Display for FullscreenExclusiveError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
}
}
impl From<Error> for FullscreenExclusiveError {
#[inline]
fn from(err: Error) -> FullscreenExclusiveError {
@ -1240,8 +1228,18 @@ impl From<OomError> for FullscreenExclusiveError {
impl error::Error for FullscreenExclusiveError {
#[inline]
fn description(&self) -> &str {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
FullscreenExclusiveError::OomError(ref err) => Some(err),
_ => None,
}
}
}
impl fmt::Display for FullscreenExclusiveError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", match *self {
FullscreenExclusiveError::OomError(_) => "not enough memory",
FullscreenExclusiveError::SurfaceLost => {
"the surface of this swapchain is no longer valid"
@ -1254,18 +1252,11 @@ impl error::Error for FullscreenExclusiveError {
FullscreenExclusiveError::NotAppControlled => {
"swapchain is not in fullscreen exclusive app controlled mode"
}
}
}
#[inline]
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
FullscreenExclusiveError::OomError(ref err) => Some(err),
_ => None,
}
})
}
}
/// Error that can happen when calling `acquire_next_image`.
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[repr(u32)]
@ -1292,20 +1283,6 @@ pub enum AcquireError {
}
impl error::Error for AcquireError {
#[inline]
fn description(&self) -> &str {
match *self {
AcquireError::OomError(_) => "not enough memory",
AcquireError::DeviceLost => "the connection to the device has been lost",
AcquireError::Timeout => "no image is available for acquiring yet",
AcquireError::SurfaceLost => "the surface of this swapchain is no longer valid",
AcquireError::OutOfDate => "the swapchain needs to be recreated",
AcquireError::FullscreenExclusiveLost => {
"the swapchain no longer has fullscreen exclusivity"
}
}
}
#[inline]
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
@ -1318,7 +1295,16 @@ impl error::Error for AcquireError {
impl fmt::Display for AcquireError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
AcquireError::OomError(_) => "not enough memory",
AcquireError::DeviceLost => "the connection to the device has been lost",
AcquireError::Timeout => "no image is available for acquiring yet",
AcquireError::SurfaceLost => "the surface of this swapchain is no longer valid",
AcquireError::OutOfDate => "the swapchain needs to be recreated",
AcquireError::FullscreenExclusiveLost => {
"the swapchain no longer has fullscreen exclusivity"
}
})
}
}

View File

@ -364,15 +364,6 @@ pub enum FenceWaitError {
}
impl error::Error for FenceWaitError {
#[inline]
fn description(&self) -> &str {
match *self {
FenceWaitError::OomError(_) => "no memory available",
FenceWaitError::Timeout => "the timeout has been reached",
FenceWaitError::DeviceLostError => "the device was lost",
}
}
#[inline]
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
@ -385,7 +376,11 @@ impl error::Error for FenceWaitError {
impl fmt::Display for FenceWaitError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
FenceWaitError::OomError(_) => "no memory available",
FenceWaitError::Timeout => "the timeout has been reached",
FenceWaitError::DeviceLostError => "the device was lost",
})
}
}

View File

@ -379,10 +379,12 @@ pub enum AccessError {
SwapchainImageAcquireOnly,
}
impl error::Error for AccessError {
impl error::Error for AccessError {}
impl fmt::Display for AccessError {
#[inline]
fn description(&self) -> &str {
match *self {
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", match *self {
AccessError::ExclusiveDenied => "only shared access is allowed for this resource",
AccessError::AlreadyInUse => {
"the resource is already in use, and there is no tracking of concurrent usages"
@ -401,14 +403,7 @@ impl error::Error for AccessError {
"trying to use a swapchain image without depending on a corresponding acquire \
image future"
}
}
}
}
impl fmt::Display for AccessError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
})
}
}
@ -421,20 +416,15 @@ pub enum AccessCheckError {
Unknown,
}
impl error::Error for AccessCheckError {
#[inline]
fn description(&self) -> &str {
match *self {
AccessCheckError::Denied(_) => "access to the resource has been denied",
AccessCheckError::Unknown => "the resource is unknown",
}
}
}
impl error::Error for AccessCheckError {}
impl fmt::Display for AccessCheckError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
AccessCheckError::Denied(_) => "access to the resource has been denied",
AccessCheckError::Unknown => "the resource is unknown",
})
}
}
@ -473,24 +463,6 @@ pub enum FlushError {
}
impl error::Error for FlushError {
#[inline]
fn description(&self) -> &str {
match *self {
FlushError::AccessError(_) => "access to a resource has been denied",
FlushError::OomError(_) => "not enough memory",
FlushError::DeviceLost => "the connection to the device has been lost",
FlushError::SurfaceLost => "the surface of this swapchain is no longer valid",
FlushError::OutOfDate => "the swapchain needs to be recreated",
FlushError::FullscreenExclusiveLost => {
"the swapchain no longer has fullscreen exclusivity"
}
FlushError::Timeout => {
"the flush operation needed to block, but the timeout has \
elapsed"
}
}
}
#[inline]
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
@ -504,7 +476,20 @@ impl error::Error for FlushError {
impl fmt::Display for FlushError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(fmt, "{}", error::Error::description(self))
write!(fmt, "{}", match *self {
FlushError::AccessError(_) => "access to a resource has been denied",
FlushError::OomError(_) => "not enough memory",
FlushError::DeviceLost => "the connection to the device has been lost",
FlushError::SurfaceLost => "the surface of this swapchain is no longer valid",
FlushError::OutOfDate => "the swapchain needs to be recreated",
FlushError::FullscreenExclusiveLost => {
"the swapchain no longer has fullscreen exclusivity"
}
FlushError::Timeout => {
"the flush operation needed to block, but the timeout has \
elapsed"
}
})
}
}