mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-21 22:34:43 +00:00
Impl DescriptorSetCollection for vec (#1094)
This commit is contained in:
parent
3fe7fc4495
commit
7189c7fa84
@ -17,6 +17,7 @@
|
||||
- Use [google/shaderc](https://github.com/google/shaderc-rs) for shader compilation
|
||||
- Reject generation of rust types for SPIR-V arrays that would have incorrect array stride.
|
||||
- Removed the `Layout` prefix of the descriptions used for a render pass.
|
||||
- Implemented DescriptorSetCollection for `Vec<T>` which allows easier use of construction them for usage when drawing.
|
||||
|
||||
# Version 0.10.0 (2018-08-10)
|
||||
|
||||
|
@ -70,6 +70,28 @@ unsafe impl<T> DescriptorSetsCollection for T
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl<T> DescriptorSetsCollection for Vec<T>
|
||||
where T: DescriptorSet + Send + Sync + 'static
|
||||
{
|
||||
#[inline]
|
||||
fn into_vec(self) -> Vec<Box<DescriptorSet + Send + Sync>> {
|
||||
let mut v = Vec::new();
|
||||
for o in self {
|
||||
v.push(Box::new(o) as Box<_>);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn num_bindings_in_set(&self, set: usize) -> Option<usize> {
|
||||
self.get(set).map(|x| x.num_bindings())
|
||||
}
|
||||
#[inline]
|
||||
fn descriptor(&self, set: usize, binding: usize) -> Option<DescriptorDesc> {
|
||||
self.get(set).and_then(|x| x.descriptor(binding))
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! impl_collection {
|
||||
($first:ident $(, $others:ident)+) => (
|
||||
unsafe impl<$first$(, $others)+> DescriptorSetsCollection for ($first, $($others),+)
|
||||
|
Loading…
Reference in New Issue
Block a user