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) {
|
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]]) {
|
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) {
|
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) {
|
unsafe fn resize(&mut self, _width: u32, _height: u32, factor: u32, window: &Window) {
|
||||||
*self = unsafe { Self::new(factor, window) };
|
*self = Self::new(factor, window);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new_frame(&mut self, buffer: &[[u8; 4]]) {
|
unsafe fn new_frame(&mut self, buffer: &[[u8; 4]]) {
|
||||||
unsafe {
|
|
||||||
let image_ptr = self
|
let image_ptr = self
|
||||||
.device
|
.device
|
||||||
.map_memory(
|
.map_memory(
|
||||||
|
@ -939,10 +938,8 @@ impl VulkanWindowInner {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn render(&mut self) {
|
unsafe fn render(&mut self) {
|
||||||
unsafe {
|
|
||||||
let (present_index, _) = self
|
let (present_index, _) = self
|
||||||
.swapchain_loader
|
.swapchain_loader
|
||||||
.acquire_next_image(
|
.acquire_next_image(
|
||||||
|
@ -1017,7 +1014,6 @@ impl VulkanWindowInner {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
impl Drop for VulkanWindowInner {
|
impl Drop for VulkanWindowInner {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
|
@ -1073,7 +1069,7 @@ impl Drop for VulkanWindowInner {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[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,
|
device: &Device,
|
||||||
command_buffer: vk::CommandBuffer,
|
command_buffer: vk::CommandBuffer,
|
||||||
command_buffer_reuse_fence: vk::Fence,
|
command_buffer_reuse_fence: vk::Fence,
|
||||||
|
@ -1083,7 +1079,6 @@ fn record_submit_commandbuffer<F: FnOnce(&Device, vk::CommandBuffer)>(
|
||||||
signal_semaphores: &[vk::Semaphore],
|
signal_semaphores: &[vk::Semaphore],
|
||||||
f: F,
|
f: F,
|
||||||
) {
|
) {
|
||||||
unsafe {
|
|
||||||
device
|
device
|
||||||
.wait_for_fences(&[command_buffer_reuse_fence], true, std::u64::MAX)
|
.wait_for_fences(&[command_buffer_reuse_fence], true, std::u64::MAX)
|
||||||
.expect("Wait for fence failed.");
|
.expect("Wait for fence failed.");
|
||||||
|
@ -1124,7 +1119,6 @@ fn record_submit_commandbuffer<F: FnOnce(&Device, vk::CommandBuffer)>(
|
||||||
.queue_submit(submit_queue, &[submit_info], command_buffer_reuse_fence)
|
.queue_submit(submit_queue, &[submit_info], command_buffer_reuse_fence)
|
||||||
.expect("queue submit failed.");
|
.expect("queue submit failed.");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn find_memorytype_index(
|
fn find_memorytype_index(
|
||||||
memory_req: &vk::MemoryRequirements,
|
memory_req: &vk::MemoryRequirements,
|
||||||
|
|
Loading…
Add table
Reference in a new issue