Restore test in fb/sys.rs, plus various fixes

This commit is contained in:
Pierre Krieger 2017-04-22 12:52:27 +02:00
parent b61a89cb5c
commit 5bfff5d11a

View File

@ -44,7 +44,7 @@ use vk;
/// you can turn any `Arc<RenderPass<D>>` into a `Arc<RenderPassAbstract + Send + Sync>` if you need to.
pub struct RenderPass<D> {
// The internal Vulkan object.
renderpass: vk::RenderPass,
render_pass: vk::RenderPass,
// Device this render pass was created from.
device: Arc<Device>,
@ -57,7 +57,7 @@ pub struct RenderPass<D> {
}
impl<D> RenderPass<D> where D: RenderPassDesc {
/// Builds a new renderpass.
/// Builds a new render pass.
///
/// # Panic
///
@ -103,7 +103,7 @@ impl<D> RenderPass<D> where D: RenderPassDesc {
}
}).collect::<SmallVec<[_; 16]>>();
// 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<D> RenderPass<D> where D: RenderPassDesc {
}
}).collect::<SmallVec<[_; 16]>>();
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<D> RenderPass<D> 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<D> RenderPass<D> {
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<D> RenderPass<D> {
}
}
/// Returns the device that was used to create this render pass.
#[inline]
pub fn device(&self) -> &Arc<Device> {
&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<C, D> RenderPassDescClearValues<C> for RenderPass<D>
unsafe impl<D> RenderPassAbstract for RenderPass<D> where D: RenderPassDesc {
#[inline]
fn inner(&self) -> RenderPassSys {
RenderPassSys(self.renderpass, PhantomData)
RenderPassSys(self.render_pass, PhantomData)
}
}
@ -402,7 +396,7 @@ impl<D> Drop for RenderPass<D> {
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<Error> 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!()
}
}
}*/
}