woweee, vkprocessor compiles now

master
mitchellhansen 5 years ago
parent f5bf07085d
commit 86b4f7d9a3

@ -105,7 +105,7 @@ pub struct VkProcessor<'a> {
pub images: Option<Vec<Arc<SwapchainImage<Window>>>>,
pub xy: (u32, u32),
pub render_pass: Option<Arc<RenderPassAbstract + Send + Sync>>,
pub vertex_buffer: Option<Arc<CpuAccessibleBuffer<[tVertex]>>>,
pub vertex_buffer: Option<Arc<(dyn BufferAccess + std::marker::Send + std::marker::Sync + 'static)>>,
}
impl<'a> VkProcessor<'a> {
@ -381,7 +381,7 @@ impl<'a> VkProcessor<'a> {
//
// Since we need to draw to multiple images, we are going to create a different framebuffer for
// each image.
let mut framebuffers = window_size_dependent_setup(&self.images.unwrap(), self.render_pass.clone().unwrap().clone(), &mut dynamic_state);
let mut framebuffers = window_size_dependent_setup(&self.images.clone().unwrap().clone(), self.render_pass.clone().unwrap().clone(), &mut dynamic_state);
// Initialization is finally finished!
@ -422,7 +422,7 @@ impl<'a> VkProcessor<'a> {
return;
};
let (new_swapchain, new_images) = match self.swapchain.unwrap().recreate_with_dimension(dimensions) {
let (new_swapchain, new_images) = match self.swapchain.clone().unwrap().recreate_with_dimension(dimensions) {
Ok(r) => r,
// This error tends to happen when the user is manually resizing the window.
// Simply restarting the loop is the easiest way to fix this issue.
@ -433,7 +433,7 @@ impl<'a> VkProcessor<'a> {
self.swapchain = Some(new_swapchain);
// Because framebuffers contains an Arc on the old swapchain, we need to
// recreate framebuffers as well.
framebuffers = window_size_dependent_setup(&new_images, self.render_pass.unwrap().clone(), &mut dynamic_state);
framebuffers = window_size_dependent_setup(&new_images, self.render_pass.clone().unwrap().clone(), &mut dynamic_state);
recreate_swapchain = false;
}
@ -445,7 +445,7 @@ impl<'a> VkProcessor<'a> {
//
// This function can block if no image is available. The parameter is an optional timeout
// after which the function call will return an error.
let (image_num, acquire_future) = match vulkano::swapchain::acquire_next_image(self.swapchain.unwrap().clone(), None) {
let (image_num, acquire_future) = match vulkano::swapchain::acquire_next_image(self.swapchain.clone().unwrap().clone(), None) {
Ok(r) => r,
Err(AcquireError::OutOfDate) => {
recreate_swapchain = true;
@ -468,6 +468,9 @@ impl<'a> VkProcessor<'a> {
//
// Note that we have to pass a queue family when we create the command buffer. The command
// buffer will only be executable on that given queue family.
let mut v = Vec::new();
v.push(self.vertex_buffer.clone().unwrap().clone());
let command_buffer =
AutoCommandBufferBuilder::primary_one_time_submit(self.device.clone(), self.queue.family())
.unwrap()
@ -490,7 +493,7 @@ impl<'a> VkProcessor<'a> {
//
// The last two parameters contain the list of resources to pass to the shaders.
// Since we used an `EmptyPipeline` object, the objects have to be `()`.
.draw(self.pipeline.clone(), &dynamic_state, self.vertex_buffer.clone().unwrap().clone(), (), ())
.draw(self.pipeline.clone().unwrap().clone(), &dynamic_state, v, (), ())
.unwrap()
// We leave the render pass by calling `draw_end`. Note that if we had multiple
@ -511,7 +514,7 @@ impl<'a> VkProcessor<'a> {
// This function does not actually present the image immediately. Instead it submits a
// present command at the end of the queue. This means that it will only be presented once
// the GPU has finished executing the command buffer that draws the triangle.
.then_swapchain_present(self.queue.clone(), self.swapchain.unwrap().clone(), image_num)
.then_swapchain_present(self.queue.clone(), self.swapchain.clone().unwrap().clone(), image_num)
.then_signal_fence_and_flush();
match future {
@ -630,8 +633,6 @@ impl<'a> VkProcessor<'a> {
// We now create a buffer that will store the shape of our triangle.
let vertex_buffer = {
#[derive(Default, Debug, Clone)]
struct Vertex { position: [f32; 2] }
vulkano::impl_vertex!(tVertex, position);
CpuAccessibleBuffer::from_iter(self.device.clone(), BufferUsage::all(), [

Loading…
Cancel
Save