Added GraphicsPipelineBuilder::with_pipeline_layout (#859)

This commit is contained in:
tomaka 2017-10-08 17:38:58 +02:00 committed by GitHub
parent 3e56a917ab
commit 82225bb3ad
2 changed files with 19 additions and 5 deletions

View File

@ -1,6 +1,7 @@
# Unreleased
- Allow `impl_vertex!` to support generic structs.
- Added `GraphicsPipelineBuilder::with_pipeline_layout`.
- Fixed creating a buffer view not checking the `min_texel_buffer_offset_alignment` limit.
- Added support for loading the `VK_EXT_debug_marker` extension and adding debug markers to
`UnsafeCommandBufferBuilder`

View File

@ -154,13 +154,9 @@ impl<Vdef, Vs, Vss, Tcs, Tcss, Tes, Tess, Gs, Gss, Fs, Fss, Rp>
{
/// Builds the graphics pipeline.
// TODO: replace Box<PipelineLayoutAbstract> with a PipelineUnion struct without template params
pub fn build(mut self, device: Arc<Device>)
pub fn build(self, device: Arc<Device>)
-> Result<GraphicsPipeline<Vdef, Box<PipelineLayoutAbstract + Send + Sync>, Rp>,
GraphicsPipelineCreationError> {
// TODO: return errors instead of panicking if missing param
let vk = device.pointers();
let pipeline_layout;
if let Some(ref tess) = self.tessellation {
@ -282,6 +278,23 @@ impl<Vdef, Vs, Vss, Tcs, Tcss, Tes, Tess, Gs, Gss, Fs, Fss, Rp>
}
}
self.with_pipeline_layout(device, pipeline_layout)
}
/// Builds the graphics pipeline.
///
/// Does the same as `build`, except that `build` automatically builds the pipeline layout
/// object corresponding to the union of your shaders while this function allows you to specify
/// the pipeline layout.
pub fn with_pipeline_layout<Pl>(mut self, device: Arc<Device>, pipeline_layout: Pl)
-> Result<GraphicsPipeline<Vdef, Pl, Rp>,
GraphicsPipelineCreationError>
where Pl: PipelineLayoutAbstract
{
// TODO: return errors instead of panicking if missing param
let vk = device.pointers();
// Checking that the pipeline layout matches the shader stages.
// TODO: more details in the errors
PipelineLayoutSuperset::ensure_superset_of(&pipeline_layout,