mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-27 01:05:03 +00:00
Finish turning Framebuffer into a trait
This commit is contained in:
parent
cedd503b2b
commit
4fed4df0b6
@ -27,6 +27,7 @@ use command_buffer::sys::Kind;
|
||||
use device::Device;
|
||||
use device::Queue;
|
||||
use framebuffer::EmptySinglePassRenderPass;
|
||||
use framebuffer::Framebuffer as OldFramebuffer;
|
||||
use image::traits::TrackedImage;
|
||||
use instance::QueueFamily;
|
||||
use pipeline::ComputePipeline;
|
||||
@ -97,7 +98,7 @@ unsafe impl<P> StdCommandsList for PrimaryCbBuilder<P> where P: CommandPool {
|
||||
where F: FnOnce(&mut UnsafeCommandBufferBuilder<Self::Pool>),
|
||||
I: Iterator<Item = (usize, PipelineBarrierBuilder)>
|
||||
{
|
||||
let kind = Kind::Primary::<EmptySinglePassRenderPass, EmptySinglePassRenderPass>;
|
||||
let kind = Kind::Primary::<EmptySinglePassRenderPass, OldFramebuffer<EmptySinglePassRenderPass>>;
|
||||
let mut cb = UnsafeCommandBufferBuilder::new(self.pool, kind,
|
||||
self.flags).unwrap(); // TODO: handle error
|
||||
|
||||
|
@ -47,8 +47,8 @@ pub struct BeginRenderPassCommand<L, Rp, F>
|
||||
framebuffer: F,
|
||||
}
|
||||
|
||||
impl<L, Rp, F> BeginRenderPassCommand<L, Rp, F>
|
||||
where L: StdCommandsList + OutsideRenderPass, Rp: RenderPass, F: Framebuffer
|
||||
impl<L, F> BeginRenderPassCommand<L, F::RenderPass, F>
|
||||
where L: StdCommandsList + OutsideRenderPass, F: Framebuffer
|
||||
{
|
||||
/// See the documentation of the `begin_render_pass` method.
|
||||
// TODO: allow setting more parameters
|
||||
|
@ -21,6 +21,7 @@ use command_buffer::sys::UnsafeCommandBuffer;
|
||||
use device::Device;
|
||||
use device::Queue;
|
||||
use framebuffer::EmptySinglePassRenderPass;
|
||||
use framebuffer::Framebuffer as OldFramebuffer;
|
||||
use sync::Fence;
|
||||
use sync::PipelineStages;
|
||||
use sync::Semaphore;
|
||||
@ -291,7 +292,7 @@ unsafe impl<C, R> SubmitList for (C, R) where C: CommandBuffer + 'static, R: Sub
|
||||
if !current_infos.pre_pipeline_barrier.is_empty() {
|
||||
let mut cb = UnsafeCommandBufferBuilder::new(Device::standard_command_pool(&device, queue.family()),
|
||||
Kind::Primary::<EmptySinglePassRenderPass,
|
||||
EmptySinglePassRenderPass>,
|
||||
OldFramebuffer<EmptySinglePassRenderPass>>,
|
||||
Flags::OneTimeSubmit).unwrap();
|
||||
cb.pipeline_barrier(current_infos.pre_pipeline_barrier);
|
||||
new_submit.commandBufferCount += 1;
|
||||
@ -304,7 +305,7 @@ unsafe impl<C, R> SubmitList for (C, R) where C: CommandBuffer + 'static, R: Sub
|
||||
if !current_infos.post_pipeline_barrier.is_empty() {
|
||||
let mut cb = UnsafeCommandBufferBuilder::new(Device::standard_command_pool(&device, queue.family()),
|
||||
Kind::Primary::<EmptySinglePassRenderPass,
|
||||
EmptySinglePassRenderPass>,
|
||||
OldFramebuffer<EmptySinglePassRenderPass>>,
|
||||
Flags::OneTimeSubmit).unwrap();
|
||||
cb.pipeline_barrier(current_infos.post_pipeline_barrier);
|
||||
new_submit.commandBufferCount += 1;
|
||||
@ -349,6 +350,7 @@ mod tests {
|
||||
use device::Device;
|
||||
use device::Queue;
|
||||
use framebuffer::EmptySinglePassRenderPass;
|
||||
use framebuffer::Framebuffer as OldFramebuffer;
|
||||
use sync::Fence;
|
||||
use sync::PipelineStages;
|
||||
use sync::Semaphore;
|
||||
@ -380,7 +382,7 @@ mod tests {
|
||||
let (device, queue) = gfx_dev_and_queue!();
|
||||
|
||||
let pool = Device::standard_command_pool(&device, queue.family());
|
||||
let kind = Kind::Primary::<EmptySinglePassRenderPass, EmptySinglePassRenderPass>;
|
||||
let kind = Kind::Primary::<EmptySinglePassRenderPass, OldFramebuffer<EmptySinglePassRenderPass>>;
|
||||
|
||||
let cb = UnsafeCommandBufferBuilder::new(pool, kind, Flags::OneTimeSubmit).unwrap();
|
||||
let cb = Basic { inner: cb.build().unwrap() };
|
||||
|
@ -691,9 +691,9 @@ impl<P> UnsafeCommandBufferBuilder<P> where P: CommandPool {
|
||||
/// - The render pass and the framebuffer must be compatible.
|
||||
/// - The clear values must be valid for the attachments.
|
||||
///
|
||||
pub unsafe fn begin_render_pass<L, I, F>(&mut self, render_pass: &UnsafeRenderPass,
|
||||
framebuffer: &F, clear_values: I,
|
||||
rect: [Range<u32>; 2], secondary: bool)
|
||||
pub unsafe fn begin_render_pass<I, F>(&mut self, render_pass: &UnsafeRenderPass,
|
||||
framebuffer: &F, clear_values: I,
|
||||
rect: [Range<u32>; 2], secondary: bool)
|
||||
where I: Iterator<Item = ClearValue>,
|
||||
F: Framebuffer
|
||||
{
|
||||
|
@ -176,7 +176,7 @@ impl<L> Framebuffer<L> {
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl<L> FramebufferTrait for Framebuffer<L> {
|
||||
unsafe impl<L> FramebufferTrait for Framebuffer<L> where L: RenderPass {
|
||||
type RenderPass = L;
|
||||
|
||||
#[inline]
|
||||
|
@ -26,7 +26,7 @@ use vk;
|
||||
use VulkanObject;
|
||||
|
||||
pub unsafe trait Framebuffer: VulkanObject<Object = vk::Framebuffer> {
|
||||
type RenderPass;
|
||||
type RenderPass: RenderPass;
|
||||
|
||||
// TODO: don't return an Arc
|
||||
fn render_pass(&self) -> &Arc<Self::RenderPass>;
|
||||
|
Loading…
Reference in New Issue
Block a user