Minimise unsafe block size, in examples (#2591)

This commit is contained in:
Rua 2024-10-23 12:07:00 +02:00 committed by GitHub
parent 54dafb73bf
commit 6da1f96c73
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
41 changed files with 144 additions and 302 deletions

View File

@ -217,11 +217,9 @@ fn main() {
)
.unwrap();
unsafe {
// The command buffer only does one thing: execute the compute pipeline. This is called a
// *dispatch* operation.
builder.dispatch([1024, 1, 1]).unwrap();
}
// The command buffer only does one thing: execute the compute pipeline. This is called a
// *dispatch* operation.
unsafe { builder.dispatch([1024, 1, 1]) }.unwrap();
// Finish building the command buffer by calling `build`.
let command_buffer = builder.build().unwrap();

View File

@ -445,9 +445,7 @@ impl ApplicationHandler for App {
.bind_vertex_buffers(0, buffer)
.unwrap();
unsafe {
builder.draw(num_vertices, 1, 0, 0).unwrap();
}
unsafe { builder.draw(num_vertices, 1, 0, 0) }.unwrap();
builder.end_render_pass(Default::default()).unwrap();

View File

@ -113,8 +113,8 @@ fn main() {
))
},
)
.ok()
};
}
.ok();
// Create Vulkan objects in the same way as the other examples.
let device_extensions = DeviceExtensions {

View File

@ -204,12 +204,7 @@ impl AmbientLightingSystem {
.unwrap()
.bind_vertex_buffers(0, self.vertex_buffer.clone())
.unwrap();
unsafe {
builder
.draw(self.vertex_buffer.len() as u32, 1, 0, 0)
.unwrap();
}
unsafe { builder.draw(self.vertex_buffer.len() as u32, 1, 0, 0) }.unwrap();
builder.build().unwrap()
}

View File

@ -218,12 +218,7 @@ impl DirectionalLightingSystem {
.unwrap()
.bind_vertex_buffers(0, self.vertex_buffer.clone())
.unwrap();
unsafe {
builder
.draw(self.vertex_buffer.len() as u32, 1, 0, 0)
.unwrap();
}
unsafe { builder.draw(self.vertex_buffer.len() as u32, 1, 0, 0) }.unwrap();
builder.build().unwrap()
}

View File

@ -231,12 +231,7 @@ impl PointLightingSystem {
.unwrap()
.bind_vertex_buffers(0, self.vertex_buffer.clone())
.unwrap();
unsafe {
builder
.draw(self.vertex_buffer.len() as u32, 1, 0, 0)
.unwrap();
}
unsafe { builder.draw(self.vertex_buffer.len() as u32, 1, 0, 0) }.unwrap();
builder.build().unwrap()
}

View File

@ -153,12 +153,7 @@ impl TriangleDrawSystem {
.unwrap()
.bind_vertex_buffers(0, self.vertex_buffer.clone())
.unwrap();
unsafe {
builder
.draw(self.vertex_buffer.len() as u32, 1, 0, 0)
.unwrap();
}
unsafe { builder.draw(self.vertex_buffer.len() as u32, 1, 0, 0) }.unwrap();
builder.build().unwrap()
}

View File

@ -255,10 +255,7 @@ fn main() {
set.clone().offsets([index * align as u32]),
)
.unwrap();
unsafe {
builder.dispatch([12, 1, 1]).unwrap();
}
unsafe { builder.dispatch([12, 1, 1]) }.unwrap();
}
let command_buffer = builder.build().unwrap();

View File

@ -267,12 +267,8 @@ fn main() {
)
.unwrap();
unsafe {
// Note that dispatch dimensions must be proportional to the local size.
builder
.dispatch([1024 / local_size_x, 1024 / local_size_y, 1])
.unwrap();
}
// Note that dispatch dimensions must be proportional to the local size.
unsafe { builder.dispatch([1024 / local_size_x, 1024 / local_size_y, 1]) }.unwrap();
builder
.copy_image_to_buffer(CopyImageToBufferInfo::image_buffer(image, buf.clone()))

View File

@ -178,8 +178,8 @@ mod linux {
},
)),
)
.unwrap()
};
}
.unwrap();
let device_extensions = DeviceExtensions {
khr_external_semaphore: true,
@ -326,12 +326,11 @@ mod linux {
.unwrap();
// SAFETY: we just created this raw image and hasn't bound any memory to it.
let image = Arc::new(unsafe {
raw_image
.bind_memory([ResourceMemory::new_dedicated(image_memory)])
let image = Arc::new(
unsafe { raw_image.bind_memory([ResourceMemory::new_dedicated(image_memory)]) }
.map_err(|(err, _, _)| err)
.unwrap()
});
.unwrap(),
);
let image_view = ImageView::new_default(image).unwrap();
@ -370,16 +369,10 @@ mod linux {
.unwrap(),
);
let acquire_fd = unsafe {
acquire_sem
.export_fd(ExternalSemaphoreHandleType::OpaqueFd)
.unwrap()
};
let release_fd = unsafe {
release_sem
.export_fd(ExternalSemaphoreHandleType::OpaqueFd)
.unwrap()
};
let acquire_fd =
unsafe { acquire_sem.export_fd(ExternalSemaphoreHandleType::OpaqueFd) }.unwrap();
let release_fd =
unsafe { release_sem.export_fd(ExternalSemaphoreHandleType::OpaqueFd) }.unwrap();
let barrier_clone = barrier.clone();
let barrier_2_clone = barrier_2.clone();
@ -407,13 +400,12 @@ mod linux {
let gl_acquire_sem = unsafe {
glium::semaphore::Semaphore::new_from_fd(gl_display.as_ref(), acquire_fd)
.unwrap()
};
}
.unwrap();
let gl_release_sem = unsafe {
glium::semaphore::Semaphore::new_from_fd(gl_display.as_ref(), release_fd)
.unwrap()
};
}
.unwrap();
let rotation_start = Instant::now();
@ -733,12 +725,7 @@ mod linux {
.unwrap()
.bind_vertex_buffers(0, self.vertex_buffer.clone())
.unwrap();
unsafe {
builder
.draw(self.vertex_buffer.len() as u32, 1, 0, 0)
.unwrap();
}
unsafe { builder.draw(self.vertex_buffer.len() as u32, 1, 0, 0) }.unwrap();
builder.end_render_pass(Default::default()).unwrap();

View File

@ -554,12 +554,7 @@ impl ApplicationHandler for App {
.unwrap()
.bind_vertex_buffers(0, self.vertex_buffer.clone())
.unwrap();
unsafe {
builder
.draw(self.vertex_buffer.len() as u32, 1, 0, 0)
.unwrap();
}
unsafe { builder.draw(self.vertex_buffer.len() as u32, 1, 0, 0) }.unwrap();
builder.end_render_pass(Default::default()).unwrap();

View File

@ -498,12 +498,7 @@ impl ApplicationHandler for App {
.unwrap()
.bind_vertex_buffers(0, self.vertex_buffer.clone())
.unwrap();
unsafe {
builder
.draw(self.vertex_buffer.len() as u32, 1, 0, 0)
.unwrap();
}
unsafe { builder.draw(self.vertex_buffer.len() as u32, 1, 0, 0) }.unwrap();
builder.end_render_pass(Default::default()).unwrap();

View File

@ -517,12 +517,7 @@ impl ApplicationHandler for App {
.unwrap()
.bind_vertex_buffers(0, self.vertex_buffer.clone())
.unwrap();
unsafe {
builder
.draw(self.vertex_buffer.len() as u32, 1, 0, 0)
.unwrap();
}
unsafe { builder.draw(self.vertex_buffer.len() as u32, 1, 0, 0) }.unwrap();
builder.end_render_pass(Default::default()).unwrap();

View File

@ -541,10 +541,7 @@ impl ApplicationHandler for App {
cs_descriptor_set,
)
.unwrap();
unsafe {
builder.dispatch([1, 1, 1]).unwrap();
}
unsafe { builder.dispatch([1, 1, 1]) }.unwrap();
builder
.begin_render_pass(
@ -564,11 +561,9 @@ impl ApplicationHandler for App {
.bind_vertex_buffers(0, vertices)
.unwrap();
unsafe {
// The indirect draw call is placed in the command buffer with a reference to
// the buffer that will contain the arguments for the draw.
builder.draw_indirect(indirect_buffer).unwrap();
}
// The indirect draw call is placed in the command buffer with a reference to
// the buffer that will contain the arguments for the draw.
unsafe { builder.draw_indirect(indirect_buffer) }.unwrap();
builder.end_render_pass(Default::default()).unwrap();

View File

@ -470,17 +470,15 @@ impl ApplicationHandler for App {
(self.vertex_buffer.clone(), self.instance_buffer.clone()),
)
.unwrap();
unsafe {
builder
.draw(
self.vertex_buffer.len() as u32,
self.instance_buffer.len() as u32,
0,
0,
)
.unwrap();
builder.draw(
self.vertex_buffer.len() as u32,
self.instance_buffer.len() as u32,
0,
0,
)
}
.unwrap();
builder.end_render_pass(Default::default()).unwrap();

View File

@ -175,12 +175,7 @@ impl FractalComputePipeline {
.unwrap()
.push_constants(self.pipeline.layout().clone(), 0, push_constants)
.unwrap();
unsafe {
builder
.dispatch([image_extent[0] / 8, image_extent[1] / 8, 1])
.unwrap();
}
unsafe { builder.dispatch([image_extent[0] / 8, image_extent[1] / 8, 1]) }.unwrap();
let command_buffer = builder.build().unwrap();
let finished = command_buffer.execute(self.queue.clone()).unwrap();

View File

@ -162,10 +162,7 @@ impl PixelsDrawPipeline {
self.create_descriptor_set(image),
)
.unwrap();
unsafe {
builder.draw(6, 1, 0, 0).unwrap();
}
unsafe { builder.draw(6, 1, 0, 0) }.unwrap();
builder.build().unwrap()
}

View File

@ -476,10 +476,7 @@ impl ApplicationHandler for App {
rcx.descriptor_set.clone(),
)
.unwrap();
unsafe {
builder.draw_mesh_tasks([self.cols, self.rows, 1]).unwrap();
}
unsafe { builder.draw_mesh_tasks([self.cols, self.rows, 1]) }.unwrap();
builder.end_render_pass(Default::default()).unwrap();

View File

@ -401,10 +401,7 @@ fn main() {
.unwrap()
.bind_vertex_buffers(0, vertex_buffer.clone())
.unwrap();
unsafe {
builder.draw(vertex_buffer.len() as u32, 1, 0, 0).unwrap();
}
unsafe { builder.draw(vertex_buffer.len() as u32, 1, 0, 0) }.unwrap();
builder
.end_render_pass(Default::default())

View File

@ -205,12 +205,7 @@ impl GameOfLifeComputePipeline {
push_constants,
)
.unwrap();
unsafe {
builder
.dispatch([image_extent[0] / 8, image_extent[1] / 8, 1])
.unwrap();
}
unsafe { builder.dispatch([image_extent[0] / 8, image_extent[1] / 8, 1]) }.unwrap();
}
}

View File

@ -158,10 +158,7 @@ impl PixelsDrawPipeline {
self.create_image_sampler_nearest(image),
)
.unwrap();
unsafe {
builder.draw(6, 1, 0, 0).unwrap();
}
unsafe { builder.draw(6, 1, 0, 0) }.unwrap();
builder.build().unwrap()
}

View File

@ -450,12 +450,7 @@ impl ApplicationHandler for App {
.unwrap()
.bind_vertex_buffers(0, self.vertex_buffer.clone())
.unwrap();
unsafe {
builder
.draw(self.vertex_buffer.len() as u32, 1, 0, 0)
.unwrap();
}
unsafe { builder.draw(self.vertex_buffer.len() as u32, 1, 0, 0) }.unwrap();
builder.end_render_pass(Default::default()).unwrap();

View File

@ -349,12 +349,10 @@ fn main() {
.bind_vertex_buffers(0, vertex_buffer.clone())
.unwrap();
unsafe {
// Drawing commands are broadcast to each view in the view mask of the active renderpass
// which means only a single draw call is needed to draw to multiple layers of the
// framebuffer.
builder.draw(vertex_buffer.len() as u32, 1, 0, 0).unwrap();
}
// Drawing commands are broadcast to each view in the view mask of the active renderpass
// which means only a single draw call is needed to draw to multiple layers of the
// framebuffer.
unsafe { builder.draw(vertex_buffer.len() as u32, 1, 0, 0) }.unwrap();
builder.end_render_pass(Default::default()).unwrap();

View File

@ -485,68 +485,72 @@ impl ApplicationHandler for App {
)
.unwrap();
// A query must be reset before each use, including the first use. This
// must be done outside a render pass.
// Beginning or resetting a query is unsafe for now.
unsafe { builder.reset_query_pool(self.query_pool.clone(), 0..3) }.unwrap();
builder
.set_viewport(0, [rcx.viewport.clone()].into_iter().collect())
.unwrap()
.bind_pipeline_graphics(rcx.pipeline.clone())
.unwrap()
.begin_render_pass(
RenderPassBeginInfo {
clear_values: vec![Some([0.0, 0.0, 1.0, 1.0].into()), Some(1.0.into())],
..RenderPassBeginInfo::framebuffer(
rcx.framebuffers[image_index as usize].clone(),
)
},
Default::default(),
)
.unwrap();
// Begin query 0, then draw the red triangle. Enabling the
// `QueryControlFlags::PRECISE` flag would give exact numeric results. This
// needs the `occlusion_query_precise` feature to be enabled on the device.
unsafe {
builder
// A query must be reset before each use, including the first use. This
// must be done outside a render pass.
.reset_query_pool(self.query_pool.clone(), 0..3)
.unwrap()
.set_viewport(0, [rcx.viewport.clone()].into_iter().collect())
.unwrap()
.bind_pipeline_graphics(rcx.pipeline.clone())
.unwrap()
.begin_render_pass(
RenderPassBeginInfo {
clear_values: vec![
Some([0.0, 0.0, 1.0, 1.0].into()),
Some(1.0.into()),
],
..RenderPassBeginInfo::framebuffer(
rcx.framebuffers[image_index as usize].clone(),
)
},
Default::default(),
)
.unwrap()
// Begin query 0, then draw the red triangle. Enabling the
// `QueryControlFlags::PRECISE` flag would give exact numeric results. This
// needs the `occlusion_query_precise` feature to be enabled on the device.
.begin_query(
self.query_pool.clone(),
0,
QueryControlFlags::empty(),
// QueryControlFlags::PRECISE,
)
.unwrap()
.bind_vertex_buffers(0, self.triangle1.clone())
.unwrap()
.draw(self.triangle1.len() as u32, 1, 0, 0)
.unwrap()
// End query 0.
.end_query(self.query_pool.clone(), 0)
.unwrap()
// Begin query 1 for the cyan triangle.
.begin_query(self.query_pool.clone(), 1, QueryControlFlags::empty())
.unwrap()
.bind_vertex_buffers(0, self.triangle2.clone())
.unwrap()
.draw(self.triangle2.len() as u32, 1, 0, 0)
.unwrap()
.end_query(self.query_pool.clone(), 1)
.unwrap()
// Finally, query 2 for the green triangle.
.begin_query(self.query_pool.clone(), 2, QueryControlFlags::empty())
.unwrap()
.bind_vertex_buffers(0, self.triangle3.clone())
.unwrap()
.draw(self.triangle3.len() as u32, 1, 0, 0)
.unwrap()
.end_query(self.query_pool.clone(), 2)
.unwrap()
.end_render_pass(Default::default())
.unwrap();
builder.begin_query(
self.query_pool.clone(),
0,
QueryControlFlags::empty(),
// QueryControlFlags::PRECISE,
)
}
.unwrap();
builder
.bind_vertex_buffers(0, self.triangle1.clone())
.unwrap();
unsafe { builder.draw(self.triangle1.len() as u32, 1, 0, 0) }.unwrap();
// End query 0.
builder.end_query(self.query_pool.clone(), 0).unwrap();
// Begin query 1 for the cyan triangle.
unsafe {
builder.begin_query(self.query_pool.clone(), 1, QueryControlFlags::empty())
}
.unwrap();
builder
.bind_vertex_buffers(0, self.triangle2.clone())
.unwrap();
unsafe { builder.draw(self.triangle2.len() as u32, 1, 0, 0) }.unwrap();
builder.end_query(self.query_pool.clone(), 1).unwrap();
// Finally, query 2 for the green triangle.
unsafe {
builder.begin_query(self.query_pool.clone(), 2, QueryControlFlags::empty())
}
.unwrap();
builder
.bind_vertex_buffers(0, self.triangle3.clone())
.unwrap();
unsafe { builder.draw(self.triangle3.len() as u32, 1, 0, 0) }.unwrap();
builder
.end_query(self.query_pool.clone(), 2)
.unwrap()
.end_render_pass(Default::default())
.unwrap();
let command_buffer = builder.build().unwrap();

View File

@ -297,10 +297,7 @@ fn main() {
.unwrap()
.bind_vertex_buffers(0, vertex_buffer.clone())
.unwrap();
unsafe {
builder.draw(vertex_buffer.len() as u32, 1, 0, 0).unwrap();
}
unsafe { builder.draw(vertex_buffer.len() as u32, 1, 0, 0) }.unwrap();
builder.end_render_pass(Default::default()).unwrap();

View File

@ -93,7 +93,7 @@ fn main() {
.unwrap();
// We are creating an empty PipelineCache to start somewhere.
let pipeline_cache = unsafe { PipelineCache::new(device.clone(), Default::default()).unwrap() };
let pipeline_cache = unsafe { PipelineCache::new(device.clone(), Default::default()) }.unwrap();
// We need to create the compute pipeline that describes our operation. We are using the shader
// from the basic-compute-shader example.
@ -192,8 +192,8 @@ fn main() {
..Default::default()
},
)
.unwrap()
};
}
.unwrap();
// As the `PipelineCache` of the Vulkan implementation saves an opaque blob of data, there is
// no real way to know if the data is correct. There might be differences in the byte blob

View File

@ -199,10 +199,7 @@ fn main() {
.unwrap()
.push_constants(pipeline.layout().clone(), 0, push_constants)
.unwrap();
unsafe {
builder.dispatch([1024, 1, 1]).unwrap();
}
unsafe { builder.dispatch([1024, 1, 1]) }.unwrap();
let command_buffer = builder.build().unwrap();

View File

@ -490,12 +490,7 @@ impl ApplicationHandler for App {
.unwrap()
.bind_vertex_buffers(0, self.vertex_buffer.clone())
.unwrap();
unsafe {
builder
.draw(self.vertex_buffer.len() as u32, 1, 0, 0)
.unwrap();
}
unsafe { builder.draw(self.vertex_buffer.len() as u32, 1, 0, 0) }.unwrap();
builder.end_render_pass(Default::default()).unwrap();

View File

@ -625,12 +625,7 @@ impl ApplicationHandler for App {
.unwrap()
.bind_vertex_buffers(0, self.vertex_buffer.clone())
.unwrap();
unsafe {
builder
.draw(self.vertex_buffer.len() as u32, 1, 0, 0)
.unwrap();
}
unsafe { builder.draw(self.vertex_buffer.len() as u32, 1, 0, 0) }.unwrap();
builder.end_render_pass(Default::default()).unwrap();

View File

@ -258,8 +258,8 @@ impl ApplicationHandler for App {
// NOTE: You will have to verify correctness of the data by yourself!
let module = unsafe {
ShaderModule::new(self.device.clone(), ShaderModuleCreateInfo::new(&code))
.unwrap()
};
}
.unwrap();
module.entry_point("main").unwrap()
};
@ -268,8 +268,8 @@ impl ApplicationHandler for App {
let module = unsafe {
ShaderModule::new(self.device.clone(), ShaderModuleCreateInfo::new(&code))
.unwrap()
};
}
.unwrap();
module.entry_point("main").unwrap()
};
@ -414,12 +414,7 @@ impl ApplicationHandler for App {
.unwrap()
.bind_vertex_buffers(0, self.vertex_buffer.clone())
.unwrap();
unsafe {
builder
.draw(self.vertex_buffer.len() as u32, 1, 0, 0)
.unwrap();
}
unsafe { builder.draw(self.vertex_buffer.len() as u32, 1, 0, 0) }.unwrap();
builder.end_render_pass(Default::default()).unwrap();

View File

@ -192,10 +192,7 @@ fn main() {
set,
)
.unwrap();
unsafe {
builder.dispatch([1024, 1, 1]).unwrap();
}
unsafe { builder.dispatch([1024, 1, 1]) }.unwrap();
let command_buffer = builder.build().unwrap();

View File

@ -183,10 +183,7 @@ fn main() {
set,
)
.unwrap();
unsafe {
builder.dispatch([1024, 1, 1]).unwrap();
}
unsafe { builder.dispatch([1024, 1, 1]) }.unwrap();
let command_buffer = builder.build().unwrap();
let future = sync::now(device)

View File

@ -211,10 +211,7 @@ fn main() {
.unwrap()
.push_constants(pipeline.layout().clone(), 0, parameters)
.unwrap();
unsafe {
builder.dispatch([1024, 1, 1]).unwrap();
}
unsafe { builder.dispatch([1024, 1, 1]) }.unwrap();
let command_buffer = builder.build().unwrap();
let future = sync::now(queue.device().clone())

View File

@ -559,12 +559,7 @@ impl ApplicationHandler for App {
self.descriptor_set.clone(),
)
.unwrap();
unsafe {
builder
.dispatch([PARTICLE_COUNT as u32 / 128, 1, 1])
.unwrap();
}
unsafe { builder.dispatch([PARTICLE_COUNT as u32 / 128, 1, 1]) }.unwrap();
// Use render-pass to draw particles to swapchain.
builder
@ -582,10 +577,7 @@ impl ApplicationHandler for App {
.unwrap()
.bind_vertex_buffers(0, self.vertex_buffer.clone())
.unwrap();
unsafe {
builder.draw(PARTICLE_COUNT as u32, 1, 0, 0).unwrap();
}
unsafe { builder.draw(PARTICLE_COUNT as u32, 1, 0, 0) }.unwrap();
builder.end_render_pass(Default::default()).unwrap();

View File

@ -186,10 +186,7 @@ fn main() {
descriptor_set,
)
.unwrap();
unsafe {
builder.dispatch([1024, 1, 1]).unwrap();
}
unsafe { builder.dispatch([1024, 1, 1]) }.unwrap();
let command_buffer = builder.build().unwrap();

View File

@ -481,12 +481,8 @@ impl ApplicationHandler for App {
.unwrap()
.bind_index_buffer(self.index_buffer.clone())
.unwrap();
unsafe {
builder
.draw_indexed(self.index_buffer.len() as u32, 1, 0, 0, 0)
.unwrap();
}
unsafe { builder.draw_indexed(self.index_buffer.len() as u32, 1, 0, 0, 0) }
.unwrap();
builder.end_render_pass(Default::default()).unwrap();

View File

@ -441,12 +441,7 @@ impl ApplicationHandler for App {
.unwrap()
.bind_vertex_buffers(0, self.vertex_buffer.clone())
.unwrap();
unsafe {
builder
.draw(self.vertex_buffer.len() as u32, 1, 0, 0)
.unwrap();
}
unsafe { builder.draw(self.vertex_buffer.len() as u32, 1, 0, 0) }.unwrap();
builder.end_render_pass(Default::default()).unwrap();

View File

@ -511,12 +511,7 @@ impl ApplicationHandler for App {
.unwrap()
.bind_vertex_buffers(0, self.vertex_buffer.clone())
.unwrap();
unsafe {
builder
.draw(self.vertex_buffer.len() as u32, 3, 0, 0)
.unwrap();
}
unsafe { builder.draw(self.vertex_buffer.len() as u32, 3, 0, 0) }.unwrap();
builder.end_render_pass(Default::default()).unwrap();

View File

@ -424,12 +424,8 @@ impl ApplicationHandler for App {
.bind_vertex_buffers(0, self.vertex_buffer.clone())
.unwrap();
unsafe {
builder
// We add a draw command.
.draw(self.vertex_buffer.len() as u32, 1, 0, 0)
.unwrap();
}
// We add a draw command.
unsafe { builder.draw(self.vertex_buffer.len() as u32, 1, 0, 0) }.unwrap();
builder
// We leave the render pass. Note that if we had multiple subpasses we could

View File

@ -690,12 +690,8 @@ impl ApplicationHandler for App {
.bind_vertex_buffers(0, self.vertex_buffer.clone())
.unwrap();
unsafe {
builder
// We add a draw command.
.draw(self.vertex_buffer.len() as u32, 1, 0, 0)
.unwrap();
}
// We add a draw command.
unsafe { builder.draw(self.vertex_buffer.len() as u32, 1, 0, 0) }.unwrap();
builder
// We leave the render pass.

View File

@ -690,12 +690,8 @@ impl ApplicationHandler for App {
.bind_vertex_buffers(0, self.vertex_buffer.clone())
.unwrap();
unsafe {
builder
// We add a draw command.
.draw(self.vertex_buffer.len() as u32, 1, 0, 0)
.unwrap();
}
// We add a draw command.
unsafe { builder.draw(self.vertex_buffer.len() as u32, 1, 0, 0) }.unwrap();
builder
// We leave the render pass. Note that if we had multiple subpasses we could