mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-22 14:56:42 +00:00
Improved display of some error and remove unimplemented!
for UnexpectedImageLayout
display (#2305)
It appeared to me quite often that I've it some error and the message was lost on display because some `Display` implementation don't record the cause. Improved some of those that I've spotted while debugging some bad code I had. Also removed the `unimplemented` for `AccessError::UnexpectedImageLayout` and now giving a more descriptive message.
This commit is contained in:
parent
c8ad5a4512
commit
d1a17f9510
@ -482,22 +482,28 @@ impl Error for CommandBufferExecError {
|
|||||||
|
|
||||||
impl Display for CommandBufferExecError {
|
impl Display for CommandBufferExecError {
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
|
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
|
||||||
write!(
|
let value = match self {
|
||||||
f,
|
CommandBufferExecError::AccessError {
|
||||||
"{}",
|
error,
|
||||||
match self {
|
command_name,
|
||||||
CommandBufferExecError::AccessError { .. } =>
|
command_offset,
|
||||||
"access to a resource has been denied",
|
command_param,
|
||||||
CommandBufferExecError::OneTimeSubmitAlreadySubmitted => {
|
} => return write!(
|
||||||
"the command buffer or one of the secondary command buffers it executes was \
|
f,
|
||||||
created with the \"one time submit\" flag, but has already been submitted in \
|
"access to a resource has been denied on command {} (offset: {}, param: {}): {}",
|
||||||
the past"
|
command_name, command_offset, command_param, error
|
||||||
}
|
),
|
||||||
CommandBufferExecError::ExclusiveAlreadyInUse => {
|
CommandBufferExecError::OneTimeSubmitAlreadySubmitted => {
|
||||||
"the command buffer or one of the secondary command buffers it executes is \
|
"the command buffer or one of the secondary command buffers it executes was \
|
||||||
already in use was not created with the \"concurrent\" flag"
|
created with the \"one time submit\" flag, but has already been submitted in \
|
||||||
}
|
the past"
|
||||||
}
|
}
|
||||||
)
|
CommandBufferExecError::ExclusiveAlreadyInUse => {
|
||||||
|
"the command buffer or one of the secondary command buffers it executes is \
|
||||||
|
already in use was not created with the \"concurrent\" flag"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
write!(f, "{}", value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -502,26 +502,28 @@ impl Error for AccessError {}
|
|||||||
|
|
||||||
impl Display for AccessError {
|
impl Display for AccessError {
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
|
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
|
||||||
write!(
|
let value = match self {
|
||||||
f,
|
AccessError::AlreadyInUse => {
|
||||||
"{}",
|
"the resource is already in use, and there is no tracking of concurrent usages"
|
||||||
match self {
|
|
||||||
AccessError::AlreadyInUse => {
|
|
||||||
"the resource is already in use, and there is no tracking of concurrent usages"
|
|
||||||
}
|
|
||||||
AccessError::UnexpectedImageLayout { .. } => {
|
|
||||||
unimplemented!() // TODO: find a description
|
|
||||||
}
|
|
||||||
AccessError::ImageNotInitialized { .. } => {
|
|
||||||
"trying to use an image without transitioning it from the undefined or \
|
|
||||||
preinitialized layouts first"
|
|
||||||
}
|
|
||||||
AccessError::SwapchainImageNotAcquired => {
|
|
||||||
"trying to use a swapchain image without depending on a corresponding acquire \
|
|
||||||
image future"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
)
|
AccessError::UnexpectedImageLayout { allowed, requested } => {
|
||||||
|
return write!(
|
||||||
|
f,
|
||||||
|
"unexpected image layout: requested {:?}, allowed {:?}",
|
||||||
|
allowed, requested
|
||||||
|
)
|
||||||
|
}
|
||||||
|
AccessError::ImageNotInitialized { .. } => {
|
||||||
|
"trying to use an image without transitioning it from the undefined or \
|
||||||
|
preinitialized layouts first"
|
||||||
|
}
|
||||||
|
AccessError::SwapchainImageNotAcquired => {
|
||||||
|
"trying to use a swapchain image without depending on a corresponding acquire \
|
||||||
|
image future"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
write!(f, "{}", value,)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -538,14 +540,12 @@ impl Error for AccessCheckError {}
|
|||||||
|
|
||||||
impl Display for AccessCheckError {
|
impl Display for AccessCheckError {
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
|
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
|
||||||
write!(
|
match self {
|
||||||
f,
|
AccessCheckError::Denied(err) => {
|
||||||
"{}",
|
write!(f, "access to the resource has been denied: {}", err)
|
||||||
match self {
|
|
||||||
AccessCheckError::Denied(_) => "access to the resource has been denied",
|
|
||||||
AccessCheckError::Unknown => "the resource is unknown",
|
|
||||||
}
|
}
|
||||||
)
|
AccessCheckError::Unknown => write!(f, "the resource is unknown"),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user