Replace EmptySinglePassRenderPass with EmptySinglePassRenderPassDesc

This commit is contained in:
Pierre Krieger 2016-11-25 16:05:49 +01:00
parent a32b2c7842
commit b542a62a53
3 changed files with 21 additions and 65 deletions

View File

@ -21,7 +21,8 @@ use command_buffer::CommandsListSinkCaller;
use command_buffer::DynamicState;
use command_buffer::RawCommandBufferPrototype;
use device::Device;
use framebuffer::EmptySinglePassRenderPass;
use framebuffer::EmptySinglePassRenderPassDesc;
use framebuffer::RenderPass;
use framebuffer::RenderPassRef;
use framebuffer::Framebuffer;
use framebuffer::Subpass;
@ -58,14 +59,14 @@ pub enum Kind<'a, R, F: 'a> {
},
}
impl<'a> Kind<'a, EmptySinglePassRenderPass, Framebuffer<EmptySinglePassRenderPass, ()>> {
impl<'a> Kind<'a, RenderPass<EmptySinglePassRenderPassDesc>, Framebuffer<RenderPass<EmptySinglePassRenderPassDesc>, ()>> {
/// Equivalent to `Kind::Primary`.
///
/// > **Note**: If you use `let kind = Kind::Primary;` in your code, you will probably get a
/// > compilation error because the Rust compiler couldn't determine the template parameters
/// > of `Kind`. To solve that problem in an easy way you can use this function instead.
#[inline]
pub fn primary() -> Kind<'a, EmptySinglePassRenderPass, Framebuffer<EmptySinglePassRenderPass, ()>> {
pub fn primary() -> Kind<'a, RenderPass<EmptySinglePassRenderPassDesc>, Framebuffer<RenderPass<EmptySinglePassRenderPassDesc>, ()>> {
Kind::Primary
}
}

View File

@ -7,62 +7,29 @@
// notice may not be copied, modified, or distributed except
// according to those terms.
use std::sync::Arc;
use device::Device;
use framebuffer::sys::RenderPass;
use framebuffer::sys::RenderPassSys;
use framebuffer::sys::RenderPassCreationError;
use framebuffer::traits::RenderPassRef;
use framebuffer::traits::RenderPassDesc;
use framebuffer::traits::LayoutAttachmentDescription;
use framebuffer::traits::LayoutPassDescription;
use framebuffer::traits::LayoutPassDependencyDescription;
/// Implementation of `RenderPassRef` with no attachment at all and a single pass.
/// Description of an empty render pass.
///
/// When you use a `EmptySinglePassRenderPass`, the list of attachments and clear values must
/// be `()`.
pub struct EmptySinglePassRenderPass {
render_pass: RenderPass,
}
/// Can be used to create a render pass with one subpass and no attachment.
///
/// # Example
///
/// ```
/// use vulkano::framebuffer::EmptySinglePassRenderPassDesc;
/// use vulkano::framebuffer::RenderPassDesc;
///
/// # let device: std::sync::Arc<vulkano::device::Device> = return;
/// let rp = EmptySinglePassRenderPassDesc.build_render_pass(device.clone());
/// ```
///
#[derive(Debug, Copy, Clone)]
pub struct EmptySinglePassRenderPassDesc;
impl EmptySinglePassRenderPass {
/// See the docs of new().
pub fn raw(device: &Arc<Device>) -> Result<EmptySinglePassRenderPass, RenderPassCreationError> {
unimplemented!()
}
/// Builds the render pass.
///
/// # Panic
///
/// - Panics if the device or host ran out of memory.
///
#[inline]
pub fn new(device: &Arc<Device>) -> Arc<EmptySinglePassRenderPass> {
Arc::new(EmptySinglePassRenderPass::raw(device).unwrap())
}
}
unsafe impl RenderPassRef for EmptySinglePassRenderPass {
#[inline]
fn device(&self) -> &Arc<Device> {
unimplemented!()
}
#[inline]
fn inner(&self) -> RenderPassSys {
unimplemented!()
}
#[inline]
fn desc(&self) -> &RenderPassDesc {
unimplemented!()
}
}
unsafe impl RenderPassDesc for EmptySinglePassRenderPass {
unsafe impl RenderPassDesc for EmptySinglePassRenderPassDesc {
#[inline]
fn num_attachments(&self) -> usize {
0
@ -162,15 +129,3 @@ unsafe impl RenderPassDesc for EmptySinglePassRenderPass {
}
}
}
#[cfg(test)]
mod tests {
use framebuffer::EmptySinglePassRenderPass;
#[test]
#[ignore] // TODO: crashes on AMD+Windows
fn create() {
let (device, _) = gfx_dev_and_queue!();
let _ = EmptySinglePassRenderPass::new(&device);
}
}

View File

@ -66,7 +66,7 @@
//! `EmptySinglePassRenderPass`, you have to pass `()` for the list of attachments.
//!
pub use self::empty::EmptySinglePassRenderPass;
pub use self::empty::EmptySinglePassRenderPassDesc;
pub use self::framebuffer::Framebuffer;
pub use self::framebuffer::FramebufferCreationError;
pub use self::framebuffer::FramebufferSys;