Implement PipelineLayoutRef on more types

This commit is contained in:
Pierre Krieger 2016-10-15 11:15:53 +02:00
parent 9d9732a3a1
commit fe00a7f920
2 changed files with 42 additions and 17 deletions

View File

@ -24,6 +24,7 @@ use vk;
use descriptor::descriptor::ShaderStages;
use descriptor::descriptor_set::UnsafeDescriptorSetLayout;
use descriptor::pipeline_layout::PipelineLayoutDesc;
use descriptor::pipeline_layout::PipelineLayoutRef;
use device::Device;
/// Low-level struct that represents the layout of the resources available to your shaders.
@ -132,24 +133,22 @@ impl<L> PipelineLayout<L> where L: PipelineLayoutDesc {
pub fn descriptor_set_layout(&self, index: usize) -> Option<&Arc<UnsafeDescriptorSetLayout>> {
self.layouts.get(index)
}
}
/// Returns the device used to create this pipeline layout.
unsafe impl<D> PipelineLayoutRef for PipelineLayout<D> where D: PipelineLayoutDesc {
#[inline]
pub fn device(&self) -> &Arc<Device> {
&self.device
fn sys(&self) -> PipelineLayoutSys {
PipelineLayoutSys(&self.layout)
}
#[inline]
pub fn desc(&self) -> &PipelineLayoutDesc {
fn desc(&self) -> &PipelineLayoutDesc {
&self.desc
}
/// Returns an opaque object that allows internal access to the pipeline layout.
///
/// > **Note**: This is an internal function that you normally don't need to call.
#[inline]
pub fn sys(&self) -> PipelineLayoutSys {
PipelineLayoutSys(&self.layout)
fn device(&self) -> &Arc<Device> {
&self.device
}
}

View File

@ -19,31 +19,57 @@ use device::Device;
/// Trait for objects that describe the layout of the descriptors and push constants of a pipeline.
pub unsafe trait PipelineLayoutRef {
/// Returns an opaque struct representing the pipeline layout.
/// Returns an opaque object that allows internal access to the pipeline layout.
///
/// Can be obtained by calling `PipelineLayout::sys()` on the referenced pipeline layout.
/// Can be obtained by calling `PipelineLayoutRef::sys()` on the pipeline layout.
///
/// > **Note**: This is an internal function that you normally don't need to call.
fn sys(&self) -> PipelineLayoutSys;
/// Returns the description of the pipeline layout.
///
/// Can be obtained by calling `PipelineLayoutRef::desc()` on the pipeline layout.
fn desc(&self) -> &PipelineLayoutDesc;
/// Returns the device that this pipeline layout belongs to.
///
/// Can be obtained by calling `PipelineLayoutRef::device()` on the pipeline layout.
fn device(&self) -> &Arc<Device>;
}
/*unsafe impl<T> PipelineLayoutRef for Arc<T> where T: PipelineLayoutRef {
unsafe impl<T> PipelineLayoutRef for Arc<T> where T: PipelineLayoutRef {
#[inline]
fn inner(&self) -> &PipelineLayout {
(**self).inner()
fn sys(&self) -> PipelineLayoutSys {
(**self).sys()
}
#[inline]
fn desc(&self) -> &PipelineLayoutDesc {
(**self).desc()
}
#[inline]
fn device(&self) -> &Arc<Device> {
(**self).device()
}
}
unsafe impl<'a, T> PipelineLayoutRef for &'a T where T: 'a + PipelineLayoutRef {
#[inline]
fn inner(&self) -> &PipelineLayout {
(**self).inner()
fn sys(&self) -> PipelineLayoutSys {
(**self).sys()
}
}*/
#[inline]
fn desc(&self) -> &PipelineLayoutDesc {
(**self).desc()
}
#[inline]
fn device(&self) -> &Arc<Device> {
(**self).device()
}
}
/// Trait for objects that describe the layout of the descriptors and push constants of a pipeline.
pub unsafe trait PipelineLayoutDesc {