mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-23 15:24:25 +00:00
Some tweaks to UnsafeDescriptorSetLayout
This commit is contained in:
parent
d59e00102d
commit
df2f859584
@ -21,6 +21,7 @@ use vk;
|
||||
use descriptor::descriptor::DescriptorDesc;
|
||||
use descriptor::descriptor_set::DescriptorsCount;
|
||||
use device::Device;
|
||||
use device::DeviceOwned;
|
||||
|
||||
/// Describes to the Vulkan implementation the layout of all descriptors within a descriptor set.
|
||||
///
|
||||
@ -94,12 +95,6 @@ impl UnsafeDescriptorSetLayout {
|
||||
})
|
||||
}
|
||||
|
||||
/// Returns the device used to create this layout.
|
||||
#[inline]
|
||||
pub fn device(&self) -> &Arc<Device> {
|
||||
&self.device
|
||||
}
|
||||
|
||||
/// Returns the number of descriptors of each type.
|
||||
#[inline]
|
||||
pub fn descriptors_count(&self) -> &DescriptorsCount {
|
||||
@ -107,6 +102,13 @@ impl UnsafeDescriptorSetLayout {
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl DeviceOwned for UnsafeDescriptorSetLayout {
|
||||
#[inline]
|
||||
fn device(&self) -> &Arc<Device> {
|
||||
&self.device
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl VulkanObject for UnsafeDescriptorSetLayout {
|
||||
type Object = vk::DescriptorSetLayout;
|
||||
|
||||
@ -130,11 +132,40 @@ impl Drop for UnsafeDescriptorSetLayout {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::iter;
|
||||
use descriptor::descriptor_set::unsafe_layout::UnsafeDescriptorSetLayout;
|
||||
use descriptor::descriptor::DescriptorDesc;
|
||||
use descriptor::descriptor::DescriptorDescTy;
|
||||
use descriptor::descriptor::DescriptorBufferDesc;
|
||||
use descriptor::descriptor::DescriptorBufferContentDesc;
|
||||
use descriptor::descriptor::ShaderStages;
|
||||
use descriptor::descriptor_set::DescriptorsCount;
|
||||
use descriptor::descriptor_set::UnsafeDescriptorSetLayout;
|
||||
|
||||
#[test]
|
||||
fn empty() {
|
||||
let (device, _) = gfx_dev_and_queue!();
|
||||
let _layout = UnsafeDescriptorSetLayout::new(device, iter::empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn basic_create() {
|
||||
let (device, _) = gfx_dev_and_queue!();
|
||||
|
||||
let layout = DescriptorDesc {
|
||||
ty: DescriptorDescTy::Buffer(DescriptorBufferDesc {
|
||||
dynamic: Some(false),
|
||||
storage: false,
|
||||
content: DescriptorBufferContentDesc::F32,
|
||||
}),
|
||||
array_count: 1,
|
||||
stages: ShaderStages::all_graphics(),
|
||||
readonly: true,
|
||||
};
|
||||
|
||||
let sl = UnsafeDescriptorSetLayout::new(device.clone(), iter::once(Some(layout))).unwrap();
|
||||
|
||||
assert_eq!(sl.descriptors_count(), &DescriptorsCount {
|
||||
uniform_buffer: 1,
|
||||
.. DescriptorsCount::zero()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user