API changes to the Subpass struct

This commit is contained in:
Pierre Krieger 2016-03-04 17:18:48 +01:00
parent 2be13286d8
commit ca146dd125
3 changed files with 21 additions and 19 deletions

View File

@ -468,7 +468,7 @@ impl<R> SecondaryGraphicsCommandBufferBuilder<R>
let inner = try!(InnerCommandBufferBuilder::new(pool, true));
Ok(SecondaryGraphicsCommandBufferBuilder {
inner: inner,
renderpass_layout: subpass.renderpass().layout().clone(),
renderpass_layout: subpass.render_pass().layout().clone(),
renderpass_subpass: subpass.index(),
})
}

View File

@ -648,19 +648,7 @@ impl<L> RenderPass<L> where L: Layout {
self.num_passes
}
/// Returns a handle that represents a subpass of this renderpass.
#[inline]
pub fn subpass(&self, id: u32) -> Option<Subpass<L>> {
if id < self.num_passes {
Some(Subpass {
renderpass: self,
subpass_id: id,
})
} else {
None
}
}
// TODO: add a `subpass` method that takes `Arc<Self>` as parameter
/// Returns true if this renderpass is compatible with another one.
///
@ -705,15 +693,29 @@ impl<L> Drop for RenderPass<L> {
/// combination of a render pass and subpass ID.
#[derive(Copy, Clone)]
pub struct Subpass<'a, L: 'a> {
renderpass: &'a RenderPass<L>,
render_pass: &'a Arc<RenderPass<L>>,
subpass_id: u32,
}
impl<'a, L: 'a> Subpass<'a, L> {
/// Returns the renderpass of this subpass.
/// Returns a handle that represents a subpass of a render pass.
#[inline]
pub fn renderpass(&self) -> &'a RenderPass<L> {
self.renderpass
pub fn from(render_pass: &Arc<RenderPass<L>>, id: u32) -> Option<Subpass<L>> {
if id < render_pass.num_passes {
Some(Subpass {
render_pass: render_pass,
subpass_id: id,
})
} else {
None
}
}
/// Returns the render pass of this subpass.
#[inline]
pub fn render_pass(&self) -> &'a Arc<RenderPass<L>> {
self.render_pass
}
/// Returns the index of this subpass within the renderpass.

View File

@ -306,7 +306,7 @@ impl<MV, L> GraphicsPipeline<MV, L>
pColorBlendState: &blend,
pDynamicState: &dynamic_states,
layout: layout.internal_object(),
renderPass: render_pass.renderpass().internal_object(),
renderPass: render_pass.render_pass().internal_object(),
subpass: render_pass.index(),
basePipelineHandle: 0, // TODO:
basePipelineIndex: -1, // TODO: