mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-22 06:45:23 +00:00
More docs
This commit is contained in:
parent
81bba8dbb2
commit
55434db16f
@ -36,7 +36,8 @@ pub unsafe trait DescriptorSetDesc {
|
||||
/// when you modify a descriptor set.
|
||||
type Write;
|
||||
|
||||
///
|
||||
/// Contains the list of attachments that must be passed at the initialization of a
|
||||
/// descriptor set object.
|
||||
type Init;
|
||||
|
||||
/// Returns the list of descriptors contained in this set.
|
||||
@ -113,11 +114,17 @@ impl DescriptorType {
|
||||
/// Describes which shader stages have access to a descriptor.
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct ShaderStages {
|
||||
/// `True` means that the descriptor will be used by the vertex shader.
|
||||
pub vertex: bool,
|
||||
/// `True` means that the descriptor will be used by the tessellation control shader.
|
||||
pub tessellation_control: bool,
|
||||
/// `True` means that the descriptor will be used by the tessellation evaluation shader.
|
||||
pub tessellation_evaluation: bool,
|
||||
/// `True` means that the descriptor will be used by the geometry shader.
|
||||
pub geometry: bool,
|
||||
/// `True` means that the descriptor will be used by the fragment shader.
|
||||
pub fragment: bool,
|
||||
/// `True` means that the descriptor will be used by the compute shader.
|
||||
pub compute: bool,
|
||||
}
|
||||
|
||||
@ -163,4 +170,3 @@ impl Into<vk::ShaderStageFlags> for ShaderStages {
|
||||
result
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,9 +57,12 @@ mod pool;
|
||||
mod runtime_desc;
|
||||
mod vk_objects;
|
||||
|
||||
/// A collection of descriptor set objects.
|
||||
pub unsafe trait DescriptorSetsCollection {
|
||||
/// An iterator that produces the list of descriptor set objects contained in this collection.
|
||||
type Iter: ExactSizeIterator<Item = Arc<AbstractDescriptorSet>>;
|
||||
|
||||
/// Returns the list of descriptor set objects of this collection.
|
||||
fn list(&self) -> Self::Iter;
|
||||
|
||||
fn is_compatible_with<P>(&self, pipeline_layout: &Arc<PipelineLayout<P>>) -> bool;
|
||||
|
@ -11,12 +11,17 @@ use check_errors;
|
||||
use vk;
|
||||
|
||||
/// Pool from which descriptor sets are allocated from.
|
||||
///
|
||||
/// A pool has a maximum number of descriptor sets and a maximum number of descriptors (one value
|
||||
/// per descriptor type) it can allocate.
|
||||
pub struct DescriptorPool {
|
||||
pool: vk::DescriptorPool,
|
||||
device: Arc<Device>,
|
||||
}
|
||||
|
||||
impl DescriptorPool {
|
||||
/// Initializes a new pool.
|
||||
// FIXME: capacity of the pool
|
||||
pub fn new(device: &Arc<Device>) -> Result<Arc<DescriptorPool>, OomError> {
|
||||
let vk = device.pointers();
|
||||
|
||||
@ -50,6 +55,7 @@ impl DescriptorPool {
|
||||
}))
|
||||
}
|
||||
|
||||
/// Returns the device this pool was created from.
|
||||
#[inline]
|
||||
pub fn device(&self) -> &Arc<Device> {
|
||||
&self.device
|
||||
@ -74,3 +80,21 @@ impl Drop for DescriptorPool {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use descriptor_set::DescriptorPool;
|
||||
|
||||
#[test]
|
||||
fn create() {
|
||||
let (device, _) = gfx_dev_and_queue!();
|
||||
let _ = DescriptorPool::new(&device).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn device() {
|
||||
let (device, _) = gfx_dev_and_queue!();
|
||||
let pool = DescriptorPool::new(&device).unwrap();
|
||||
assert_eq!(&**pool.device() as *const _, &*device as *const _);
|
||||
}
|
||||
}
|
||||
|
@ -29,10 +29,7 @@ unsafe impl PipelineLayoutDesc for RuntimeDesc {
|
||||
}
|
||||
}
|
||||
|
||||
/// Dummy implementation of `PipelineLayoutDesc` that describes an empty pipeline.
|
||||
///
|
||||
/// The descriptors, descriptor sets and push constants are all `()`. You have to pass `()` when
|
||||
/// drawing when you use a `EmptyPipelineDesc`.
|
||||
/// Implementation of `PipelineLayoutDesc` that describes an empty pipeline.
|
||||
#[derive(Debug, Copy, Clone, Default)]
|
||||
pub struct EmptyPipelineDesc;
|
||||
unsafe impl PipelineLayoutDesc for EmptyPipelineDesc {
|
||||
|
Loading…
Reference in New Issue
Block a user