mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-25 16:25:31 +00:00
PersistentDescriptorSetError: Expand missing usage errors (#1021)
Expand MissingUsage into MissingBufferUsage and MissingImageUsage each with an enum so that the usage that is missing is obvious in the error, e.g.: thread 'main' panicked at 'add curimage: MissingImageUsage(Storage)' Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
This commit is contained in:
parent
c720da66cd
commit
40e0bbf77e
@ -1,4 +1,7 @@
|
|||||||
# Unreleased
|
# Unreleased (Breaking)
|
||||||
|
|
||||||
|
- Split 'PersistentDescriptorSetError::MissingUsage' into 'MissingImageUsage' and 'MissingBufferUsage'
|
||||||
|
each with a matching enum indicating the usage that was missing.
|
||||||
|
|
||||||
# Version 0.10.0 (2018-08-10)
|
# Version 0.10.0 (2018-08-10)
|
||||||
|
|
||||||
|
@ -418,7 +418,8 @@ impl<L, R> PersistentDescriptorSetBuilderArray<L, R>
|
|||||||
|
|
||||||
if buffer_desc.storage {
|
if buffer_desc.storage {
|
||||||
if !buffer.inner().buffer.usage_storage_buffer() {
|
if !buffer.inner().buffer.usage_storage_buffer() {
|
||||||
return Err(PersistentDescriptorSetError::MissingUsage);
|
return Err(PersistentDescriptorSetError::MissingBufferUsage(
|
||||||
|
MissingBufferUsage::StorageBuffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
@ -428,7 +429,8 @@ impl<L, R> PersistentDescriptorSetBuilderArray<L, R>
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if !buffer.inner().buffer.usage_uniform_buffer() {
|
if !buffer.inner().buffer.usage_uniform_buffer() {
|
||||||
return Err(PersistentDescriptorSetError::MissingUsage);
|
return Err(PersistentDescriptorSetError::MissingBufferUsage(
|
||||||
|
MissingBufferUsage::UniformBuffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
@ -487,7 +489,8 @@ impl<L, R> PersistentDescriptorSetBuilderArray<L, R>
|
|||||||
// TODO: storage_texel_buffer_atomic
|
// TODO: storage_texel_buffer_atomic
|
||||||
|
|
||||||
if !view.view().storage_texel_buffer() {
|
if !view.view().storage_texel_buffer() {
|
||||||
return Err(PersistentDescriptorSetError::MissingUsage);
|
return Err(PersistentDescriptorSetError::MissingBufferUsage(
|
||||||
|
MissingBufferUsage::StorageTexelBuffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
DescriptorWrite::storage_texel_buffer(self.builder.binding_id as u32,
|
DescriptorWrite::storage_texel_buffer(self.builder.binding_id as u32,
|
||||||
@ -495,7 +498,8 @@ impl<L, R> PersistentDescriptorSetBuilderArray<L, R>
|
|||||||
view.view())
|
view.view())
|
||||||
} else {
|
} else {
|
||||||
if !view.view().uniform_texel_buffer() {
|
if !view.view().uniform_texel_buffer() {
|
||||||
return Err(PersistentDescriptorSetError::MissingUsage);
|
return Err(PersistentDescriptorSetError::MissingBufferUsage(
|
||||||
|
MissingBufferUsage::UniformTexelBuffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
DescriptorWrite::uniform_texel_buffer(self.builder.binding_id as u32,
|
DescriptorWrite::uniform_texel_buffer(self.builder.binding_id as u32,
|
||||||
@ -572,7 +576,8 @@ impl<L, R> PersistentDescriptorSetBuilderArray<L, R>
|
|||||||
array_layers,
|
array_layers,
|
||||||
} => {
|
} => {
|
||||||
if !image_view.parent().inner().image.usage_input_attachment() {
|
if !image_view.parent().inner().image.usage_input_attachment() {
|
||||||
return Err(PersistentDescriptorSetError::MissingUsage);
|
return Err(PersistentDescriptorSetError::MissingImageUsage(
|
||||||
|
MissingImageUsage::InputAttachment));
|
||||||
}
|
}
|
||||||
|
|
||||||
if multisampled && image_view.samples() == 1 {
|
if multisampled && image_view.samples() == 1 {
|
||||||
@ -756,9 +761,11 @@ fn image_match_desc<I>(image_view: &I, desc: &DescriptorImageDesc)
|
|||||||
where I: ?Sized + ImageViewAccess
|
where I: ?Sized + ImageViewAccess
|
||||||
{
|
{
|
||||||
if desc.sampled && !image_view.parent().inner().image.usage_sampled() {
|
if desc.sampled && !image_view.parent().inner().image.usage_sampled() {
|
||||||
return Err(PersistentDescriptorSetError::MissingUsage);
|
return Err(PersistentDescriptorSetError::MissingImageUsage(
|
||||||
|
MissingImageUsage::Sampled));
|
||||||
} else if !desc.sampled && !image_view.parent().inner().image.usage_storage() {
|
} else if !desc.sampled && !image_view.parent().inner().image.usage_storage() {
|
||||||
return Err(PersistentDescriptorSetError::MissingUsage);
|
return Err(PersistentDescriptorSetError::MissingImageUsage(
|
||||||
|
MissingImageUsage::Storage));
|
||||||
}
|
}
|
||||||
|
|
||||||
let image_view_ty = DescriptorImageDescDimensions::from_dimensions(image_view.dimensions());
|
let image_view_ty = DescriptorImageDescDimensions::from_dimensions(image_view.dimensions());
|
||||||
@ -983,6 +990,20 @@ unsafe impl<R> PersistentDescriptorSetResources for (R, PersistentDescriptorSetS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Part of the PersisitentDescriptorSetError for the case
|
||||||
|
// of missing usage on a buffer.
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub enum MissingBufferUsage {
|
||||||
|
StorageBuffer, UniformBuffer, StorageTexelBuffer, UniformTexelBuffer
|
||||||
|
}
|
||||||
|
|
||||||
|
// Part of the PersisitentDescriptorSetError for the case
|
||||||
|
// of missing usage on an image.
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub enum MissingImageUsage {
|
||||||
|
InputAttachment, Sampled, Storage
|
||||||
|
}
|
||||||
|
|
||||||
/// Error related to the persistent descriptor set.
|
/// Error related to the persistent descriptor set.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum PersistentDescriptorSetError {
|
pub enum PersistentDescriptorSetError {
|
||||||
@ -1009,8 +1030,11 @@ pub enum PersistentDescriptorSetError {
|
|||||||
/// The image view isn't compatible with the sampler.
|
/// The image view isn't compatible with the sampler.
|
||||||
IncompatibleImageViewSampler,
|
IncompatibleImageViewSampler,
|
||||||
|
|
||||||
/// The buffer or image is missing the correct usage.
|
/// The buffer is missing the correct usage.
|
||||||
MissingUsage,
|
MissingBufferUsage(MissingBufferUsage),
|
||||||
|
|
||||||
|
/// The image is missing the correct usage.
|
||||||
|
MissingImageUsage(MissingImageUsage),
|
||||||
|
|
||||||
/// Expected a multisampled image, but got a single-sampled image.
|
/// Expected a multisampled image, but got a single-sampled image.
|
||||||
ExpectedMultisampled,
|
ExpectedMultisampled,
|
||||||
@ -1062,8 +1086,11 @@ impl error::Error for PersistentDescriptorSetError {
|
|||||||
PersistentDescriptorSetError::IncompatibleImageViewSampler => {
|
PersistentDescriptorSetError::IncompatibleImageViewSampler => {
|
||||||
"the image view isn't compatible with the sampler"
|
"the image view isn't compatible with the sampler"
|
||||||
},
|
},
|
||||||
PersistentDescriptorSetError::MissingUsage => {
|
PersistentDescriptorSetError::MissingBufferUsage { .. } => {
|
||||||
"the buffer or image is missing the correct usage"
|
"the buffer is missing the correct usage"
|
||||||
|
},
|
||||||
|
PersistentDescriptorSetError::MissingImageUsage { .. } => {
|
||||||
|
"the image is missing the correct usage"
|
||||||
},
|
},
|
||||||
PersistentDescriptorSetError::ExpectedMultisampled => {
|
PersistentDescriptorSetError::ExpectedMultisampled => {
|
||||||
"expected a multisampled image, but got a single-sampled image"
|
"expected a multisampled image, but got a single-sampled image"
|
||||||
|
Loading…
Reference in New Issue
Block a user