From 5bfff5d11a75813390e15d326bbab1e2f3bf6e75 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Sat, 22 Apr 2017 12:52:27 +0200 Subject: [PATCH] Restore test in fb/sys.rs, plus various fixes --- vulkano/src/framebuffer/sys.rs | 49 +++++++++++++++------------------- 1 file changed, 21 insertions(+), 28 deletions(-) diff --git a/vulkano/src/framebuffer/sys.rs b/vulkano/src/framebuffer/sys.rs index f8cbe92b..be81aca7 100644 --- a/vulkano/src/framebuffer/sys.rs +++ b/vulkano/src/framebuffer/sys.rs @@ -44,7 +44,7 @@ use vk; /// you can turn any `Arc>` into a `Arc` if you need to. pub struct RenderPass { // The internal Vulkan object. - renderpass: vk::RenderPass, + render_pass: vk::RenderPass, // Device this render pass was created from. device: Arc, @@ -57,7 +57,7 @@ pub struct RenderPass { } impl RenderPass where D: RenderPassDesc { - /// Builds a new renderpass. + /// Builds a new render pass. /// /// # Panic /// @@ -103,7 +103,7 @@ impl RenderPass where D: RenderPassDesc { } }).collect::>(); - // We need to pass pointers to vkAttachmentReference structs when creating the renderpass. + // We need to pass pointers to vkAttachmentReference structs when creating the render pass. // Therefore we need to allocate them in advance. // // This block allocates, for each pass, in order, all color attachment references, then all @@ -250,7 +250,7 @@ impl RenderPass where D: RenderPassDesc { } }).collect::>(); - let renderpass = unsafe { + let render_pass = unsafe { let infos = vk::RenderPassCreateInfo { sType: vk::STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO, pNext: ptr::null(), @@ -273,7 +273,7 @@ impl RenderPass where D: RenderPassDesc { Ok(RenderPass { device: device.clone(), - renderpass: renderpass, + render_pass: render_pass, desc: description, granularity: Mutex::new(None), }) @@ -309,7 +309,7 @@ impl RenderPass { let vk = self.device.pointers(); let mut out = mem::uninitialized(); vk.GetRenderAreaGranularity(self.device.internal_object(), - self.renderpass, &mut out); + self.render_pass, &mut out); let gran = [out.width, out.height]; *granularity = Some(gran); @@ -317,12 +317,6 @@ impl RenderPass { } } - /// Returns the device that was used to create this render pass. - #[inline] - pub fn device(&self) -> &Arc { - &self.device - } - /// Returns the description of the render pass. /// /// > **Note**: You must not somehow modify the description. This shouldn't be possible anyway @@ -386,7 +380,7 @@ unsafe impl RenderPassDescClearValues for RenderPass unsafe impl RenderPassAbstract for RenderPass where D: RenderPassDesc { #[inline] fn inner(&self) -> RenderPassSys { - RenderPassSys(self.renderpass, PhantomData) + RenderPassSys(self.render_pass, PhantomData) } } @@ -402,7 +396,7 @@ impl Drop for RenderPass { fn drop(&mut self) { unsafe { let vk = self.device.pointers(); - vk.DestroyRenderPass(self.device.internal_object(), self.renderpass, ptr::null()); + vk.DestroyRenderPass(self.device.internal_object(), self.render_pass, ptr::null()); } } } @@ -478,10 +472,9 @@ impl From for RenderPassCreationError { } } -// FIXME: restore -/*#[cfg(test)] +#[cfg(test)] mod tests { - use format::R8G8B8A8Unorm; + use format::Format; use framebuffer::RenderPassCreationError; #[test] @@ -495,16 +488,16 @@ mod tests { let rp = single_pass_renderpass! { device.clone(), attachments: { - a1: { load: Clear, store: DontCare, format: R8G8B8A8Unorm, samples: 1, }, - a2: { load: Clear, store: DontCare, format: R8G8B8A8Unorm, samples: 1, }, - a3: { load: Clear, store: DontCare, format: R8G8B8A8Unorm, samples: 1, }, - a4: { load: Clear, store: DontCare, format: R8G8B8A8Unorm, samples: 1, }, - a5: { load: Clear, store: DontCare, format: R8G8B8A8Unorm, samples: 1, }, - a6: { load: Clear, store: DontCare, format: R8G8B8A8Unorm, samples: 1, }, - a7: { load: Clear, store: DontCare, format: R8G8B8A8Unorm, samples: 1, }, - a8: { load: Clear, store: DontCare, format: R8G8B8A8Unorm, samples: 1, }, - a9: { load: Clear, store: DontCare, format: R8G8B8A8Unorm, samples: 1, }, - a10: { load: Clear, store: DontCare, format: R8G8B8A8Unorm, samples: 1, } + a1: { load: Clear, store: DontCare, format: Format::R8G8B8A8Unorm, samples: 1, }, + a2: { load: Clear, store: DontCare, format: Format::R8G8B8A8Unorm, samples: 1, }, + a3: { load: Clear, store: DontCare, format: Format::R8G8B8A8Unorm, samples: 1, }, + a4: { load: Clear, store: DontCare, format: Format::R8G8B8A8Unorm, samples: 1, }, + a5: { load: Clear, store: DontCare, format: Format::R8G8B8A8Unorm, samples: 1, }, + a6: { load: Clear, store: DontCare, format: Format::R8G8B8A8Unorm, samples: 1, }, + a7: { load: Clear, store: DontCare, format: Format::R8G8B8A8Unorm, samples: 1, }, + a8: { load: Clear, store: DontCare, format: Format::R8G8B8A8Unorm, samples: 1, }, + a9: { load: Clear, store: DontCare, format: Format::R8G8B8A8Unorm, samples: 1, }, + a10: { load: Clear, store: DontCare, format: Format::R8G8B8A8Unorm, samples: 1, } }, pass: { color: [a1, a2, a3, a4, a5, a6, a7, a8, a9, a10], @@ -517,4 +510,4 @@ mod tests { _ => panic!() } } -}*/ +}