move unsafe
This commit is contained in:
parent
fa501247ad
commit
520d2e148b
1 changed files with 197 additions and 203 deletions
|
@ -52,15 +52,15 @@ impl WindowData {
|
|||
}
|
||||
|
||||
pub fn resize(&mut self, width: u32, height: u32, factor: u32, window: &Window) {
|
||||
self.inner.resize(width, height, factor, window);
|
||||
unsafe { self.inner.resize(width, height, factor, window) };
|
||||
}
|
||||
|
||||
pub fn new_frame(&mut self, buffer: &[[u8; 4]]) {
|
||||
self.inner.new_frame(buffer);
|
||||
unsafe { self.inner.new_frame(buffer) };
|
||||
}
|
||||
|
||||
pub fn render(&mut self) {
|
||||
self.inner.render();
|
||||
unsafe { self.inner.render() };
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -838,12 +838,11 @@ impl VulkanWindowInner {
|
|||
}
|
||||
}
|
||||
|
||||
fn resize(&mut self, _width: u32, _height: u32, factor: u32, window: &Window) {
|
||||
*self = unsafe { Self::new(factor, window) };
|
||||
unsafe fn resize(&mut self, _width: u32, _height: u32, factor: u32, window: &Window) {
|
||||
*self = Self::new(factor, window);
|
||||
}
|
||||
|
||||
fn new_frame(&mut self, buffer: &[[u8; 4]]) {
|
||||
unsafe {
|
||||
unsafe fn new_frame(&mut self, buffer: &[[u8; 4]]) {
|
||||
let image_ptr = self
|
||||
.device
|
||||
.map_memory(
|
||||
|
@ -939,10 +938,8 @@ impl VulkanWindowInner {
|
|||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
fn render(&mut self) {
|
||||
unsafe {
|
||||
unsafe fn render(&mut self) {
|
||||
let (present_index, _) = self
|
||||
.swapchain_loader
|
||||
.acquire_next_image(
|
||||
|
@ -1016,7 +1013,6 @@ impl VulkanWindowInner {
|
|||
.queue_present(self.present_queue, &present_info)
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for VulkanWindowInner {
|
||||
|
@ -1073,7 +1069,7 @@ impl Drop for VulkanWindowInner {
|
|||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn record_submit_commandbuffer<F: FnOnce(&Device, vk::CommandBuffer)>(
|
||||
unsafe fn record_submit_commandbuffer<F: FnOnce(&Device, vk::CommandBuffer)>(
|
||||
device: &Device,
|
||||
command_buffer: vk::CommandBuffer,
|
||||
command_buffer_reuse_fence: vk::Fence,
|
||||
|
@ -1083,7 +1079,6 @@ fn record_submit_commandbuffer<F: FnOnce(&Device, vk::CommandBuffer)>(
|
|||
signal_semaphores: &[vk::Semaphore],
|
||||
f: F,
|
||||
) {
|
||||
unsafe {
|
||||
device
|
||||
.wait_for_fences(&[command_buffer_reuse_fence], true, std::u64::MAX)
|
||||
.expect("Wait for fence failed.");
|
||||
|
@ -1123,7 +1118,6 @@ fn record_submit_commandbuffer<F: FnOnce(&Device, vk::CommandBuffer)>(
|
|||
device
|
||||
.queue_submit(submit_queue, &[submit_info], command_buffer_reuse_fence)
|
||||
.expect("queue submit failed.");
|
||||
}
|
||||
}
|
||||
|
||||
fn find_memorytype_index(
|
||||
|
|
Loading…
Add table
Reference in a new issue