Rename DescriptorSetDesc to SetLayout

This commit is contained in:
Pierre Krieger 2016-02-29 13:53:10 +01:00
parent 2b274381d4
commit e392bfaed3
5 changed files with 17 additions and 17 deletions

View File

@ -383,7 +383,7 @@ fn write_descriptor_sets(doc: &parse::Spirv) -> String {
#[derive(Default)]
pub struct Set{set};
unsafe impl ::vulkano::descriptor_set::DescriptorSetDesc for Set{set} {{
unsafe impl ::vulkano::descriptor_set::SetLayout for Set{set} {{
type Write = {write_ty};
type Init = {write_ty};

View File

@ -34,7 +34,7 @@ pub unsafe trait PipelineLayoutDesc {
}
/// Types that describe a single descriptor set.
pub unsafe trait DescriptorSetDesc {
pub unsafe trait SetLayout {
/// Represents a modification of a descriptor set. A parameter of this type must be passed
/// when you modify a descriptor set.
type Write;
@ -53,7 +53,7 @@ pub unsafe trait DescriptorSetDesc {
fn decode_init(&self, Self::Init) -> Vec<DescriptorWrite>; // TODO: better perfs
// FIXME: implement this correctly
fn is_compatible_with<S>(&self, _: &S) -> bool where S: DescriptorSetDesc { true }
fn is_compatible_with<S>(&self, _: &S) -> bool where S: SetLayout { true }
}
// FIXME: shoud allow multiple array binds at once

View File

@ -14,20 +14,20 @@
//!
//! To build a `PipelineLayout`, you need to pass a collection of `DescriptorSetLayout` structs.
//! A `DescriptorSetLayout<T>` if the equivalent of `PipelineLayout` but for a single descriptor
//! set. The `T` parameter must implement the `DescriptorSetDesc` trait.
//! set. The `T` parameter must implement the `SetLayout` trait.
//!
//! # Binding resources
//!
//! In parallel of the pipeline initialization, you have to create a `DescriptorSet<T>`. This
//! struct contains the list of actual resources that will be bound when the pipeline is executed.
//! To build a `DescriptorSet<T>`, you need to pass a `DescriptorSetLayout<T>`. The `T` parameter
//! must implement `DescriptorSetDesc` as if the same for both the descriptor set and its layout.
//! must implement `SetLayout` as if the same for both the descriptor set and its layout.
//!
//! TODO: describe descriptor set writes
//!
//! # Shader analyser
//!
//! While you can manually implement the `PipelineLayoutDesc` and `DescriptorSetDesc` traits on
//! While you can manually implement the `PipelineLayoutDesc` and `SetLayout` traits on
//! your own types, it is encouraged to use the `vulkano-shaders` crate instead. This crate will
//! automatically parse your SPIR-V code and generate structs that implement these traits and
//! describe the pipeline layout to vulkano.
@ -36,7 +36,7 @@ use std::option::IntoIter as OptionIntoIter;
use std::sync::Arc;
pub use self::layout_def::PipelineLayoutDesc;
pub use self::layout_def::DescriptorSetDesc;
pub use self::layout_def::SetLayout;
pub use self::layout_def::DescriptorWrite;
pub use self::layout_def::DescriptorBind;
pub use self::layout_def::DescriptorDesc;
@ -84,7 +84,7 @@ unsafe impl DescriptorSetsCollection for () {
}
unsafe impl<T> DescriptorSetsCollection for Arc<DescriptorSet<T>>
where T: 'static + DescriptorSetDesc
where T: 'static + SetLayout
{
type Iter = OptionIntoIter<Arc<AbstractDescriptorSet>>;
@ -108,7 +108,7 @@ macro_rules! pipeline_layout {
use std::sync::Arc;
use $crate::descriptor_set::DescriptorType;
use $crate::descriptor_set::DescriptorDesc;
use $crate::descriptor_set::DescriptorSetDesc;
use $crate::descriptor_set::SetLayout;
use $crate::descriptor_set::DescriptorWrite;
use $crate::descriptor_set::DescriptorBind;
use $crate::descriptor_set::PipelineLayout;
@ -118,7 +118,7 @@ macro_rules! pipeline_layout {
$(
pub struct $set_name;
unsafe impl DescriptorSetDesc for $set_name {
unsafe impl SetLayout for $set_name {
type Write = ( // FIXME: variable number of elems
Arc<AbstractBuffer> // FIXME: strong typing
);

View File

@ -4,7 +4,7 @@ use descriptor_set::AbstractDescriptorSet;
use descriptor_set::AbstractDescriptorSetLayout;
use descriptor_set::DescriptorBind;
use descriptor_set::DescriptorDesc;
use descriptor_set::DescriptorSetDesc;
use descriptor_set::SetLayout;
use descriptor_set::DescriptorWrite;
use descriptor_set::PipelineLayoutDesc;
@ -50,7 +50,7 @@ pub struct RuntimeDescriptorSetDesc {
pub descriptors: Vec<DescriptorDesc>,
}
unsafe impl DescriptorSetDesc for RuntimeDescriptorSetDesc {
unsafe impl SetLayout for RuntimeDescriptorSetDesc {
type Write = Vec<(u32, DescriptorBind)>;
type Init = Vec<(u32, DescriptorBind)>;

View File

@ -4,7 +4,7 @@ use std::sync::Arc;
use buffer::AbstractBuffer;
use descriptor_set::layout_def::PipelineLayoutDesc;
use descriptor_set::layout_def::DescriptorSetDesc;
use descriptor_set::layout_def::SetLayout;
use descriptor_set::layout_def::DescriptorWrite;
use descriptor_set::layout_def::DescriptorBind;
use descriptor_set::pool::DescriptorPool;
@ -32,7 +32,7 @@ pub struct DescriptorSet<S> {
resources_buffers: Vec<Arc<AbstractBuffer>>,
}
impl<S> DescriptorSet<S> where S: DescriptorSetDesc {
impl<S> DescriptorSet<S> where S: SetLayout {
///
/// # Panic
///
@ -91,9 +91,9 @@ impl<S> DescriptorSet<S> where S: DescriptorSetDesc {
/// Modifies a descriptor set.
///
/// The parameter depends on your implementation of `DescriptorSetDesc`.
/// The parameter depends on your implementation of `SetLayout`.
///
/// This function trusts the implementation of `DescriptorSetDesc` when it comes to making sure
/// This function trusts the implementation of `SetLayout` when it comes to making sure
/// that the correct resource type is written to the correct descriptor.
pub fn write(&mut self, write: S::Write) {
let write = self.layout.description().decode_write(write);
@ -273,7 +273,7 @@ pub struct DescriptorSetLayout<S> {
description: S,
}
impl<S> DescriptorSetLayout<S> where S: DescriptorSetDesc {
impl<S> DescriptorSetLayout<S> where S: SetLayout {
pub fn new(device: &Arc<Device>, description: S)
-> Result<Arc<DescriptorSetLayout<S>>, OomError>
{