diff --git a/vulkano/src/pipeline/graphics_pipeline/mod.rs b/vulkano/src/pipeline/graphics_pipeline/mod.rs index d0d39731c3..52bdb296bf 100644 --- a/vulkano/src/pipeline/graphics_pipeline/mod.rs +++ b/vulkano/src/pipeline/graphics_pipeline/mod.rs @@ -16,6 +16,7 @@ use std::sync::Arc; use std::u32; use smallvec::SmallVec; +use buffer::Buffer; use buffer::BufferInner; use device::Device; use device::DeviceOwned; @@ -1123,13 +1124,13 @@ impl Drop for Inner { /// Trait implemented on objects that reference a graphics pipeline. Can be made into a trait /// object. -pub unsafe trait GraphicsPipelineAbstract: PipelineLayoutAbstract + RenderPassAbstract /* + ... */ { +pub unsafe trait GraphicsPipelineAbstract: PipelineLayoutAbstract + RenderPassAbstract + VertexSource>> { /// Returns an opaque object that represents the inside of the graphics pipeline. fn inner(&self) -> GraphicsPipelineSys; } unsafe impl GraphicsPipelineAbstract for GraphicsPipeline - where L: PipelineLayoutAbstract, Rp: RenderPassAbstract + where L: PipelineLayoutAbstract, Rp: RenderPassAbstract, Mv: VertexSource>> { #[inline] fn inner(&self) -> GraphicsPipelineSys { diff --git a/vulkano/src/pipeline/vertex.rs b/vulkano/src/pipeline/vertex.rs index fcf93a5811..32e6fd29a9 100644 --- a/vulkano/src/pipeline/vertex.rs +++ b/vulkano/src/pipeline/vertex.rs @@ -68,8 +68,10 @@ use std::fmt; use std::marker::PhantomData; use std::mem; use std::option::IntoIter as OptionIntoIter; +use std::sync::Arc; use std::vec::IntoIter as VecIntoIter; +use buffer::Buffer; use buffer::BufferInner; use buffer::TypedBuffer; use format::Format; @@ -163,7 +165,7 @@ pub struct AttributeInfo { } /// Trait for types that describe the definition of the vertex input used by a graphics pipeline. -pub unsafe trait VertexDefinition { +pub unsafe trait VertexDefinition: VertexSource>> { /// Iterator that returns the offset, the stride (in bytes) and input rate of each buffer. type BuffersIter: ExactSizeIterator; /// Iterator that returns the attribute location, buffer id, and infos. @@ -297,6 +299,18 @@ unsafe impl VertexDefinition for SingleBufferDefinition } } +unsafe impl VertexSource>> for SingleBufferDefinition + where V: Vertex +{ + #[inline] + fn decode<'l>(&self, source: &'l Vec>) -> (Vec>, usize, usize) { + // FIXME: safety + assert_eq!(source.len(), 1); + let len = source[0].size() / mem::size_of::(); + (vec![source[0].inner()], len, 1) + } +} + unsafe impl<'a, B, V> VertexSource for SingleBufferDefinition where B: TypedBuffer, V: Vertex { @@ -367,6 +381,15 @@ unsafe impl VertexDefinition for TwoBuffersDefinition } } +unsafe impl VertexSource>> for TwoBuffersDefinition + where T: Vertex, U: Vertex +{ + #[inline] + fn decode<'l>(&self, source: &'l Vec>) -> (Vec>, usize, usize) { + unimplemented!() // FIXME: implement + } +} + unsafe impl<'a, T, U, Bt, Bu> VertexSource<(Bt, Bu)> for TwoBuffersDefinition where T: Vertex, Bt: TypedBuffer, U: Vertex, Bu: TypedBuffer @@ -439,6 +462,15 @@ unsafe impl VertexDefinition for OneVertexOneInstanceDefinition VertexSource>> for OneVertexOneInstanceDefinition + where T: Vertex, U: Vertex +{ + #[inline] + fn decode<'l>(&self, source: &'l Vec>) -> (Vec>, usize, usize) { + unimplemented!() // FIXME: implement + } +} + unsafe impl<'a, T, U, Bt, Bu> VertexSource<(Bt, Bu)> for OneVertexOneInstanceDefinition where T: Vertex, Bt: TypedBuffer, U: Vertex, Bu: TypedBuffer