summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.rs33
1 files changed, 12 insertions, 21 deletions
diff --git a/src/main.rs b/src/main.rs
index eb9c5d3..15f38e8 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -200,6 +200,7 @@ impl Surreality {
     }
   }
 
+  #[allow(unsafe_code)]
   fn init(&mut self, event_loop: &ActiveEventLoop) -> Result<()> {
     let window = Self::init_window(event_loop)?;
 
@@ -214,7 +215,17 @@ impl Surreality {
          enable_portability, enable_validation)
         = Self::init_vulkan(&window)?;
 
-    let surface = Self::init_surface(&window, &instance)?;
+    //   Conveniently, Vulkanalia's "window" feature allows it to get the
+    // platform-specific stuff directly out of winit for us. This wrapper does
+    // not correspond 1:1 to a Vulkan function; rather, it picks the Vulkan
+    // function from the appropriate platform-specific extension.
+    //
+    //   The reason it takes the window twice is that that first one is
+    // actually there to reference the display (in the x11 sense of "display"
+    // meaning the connection to the windowing system).
+    let surface = unsafe {
+      vulkanalia::window::create_surface(&instance, &window, &window)
+    }?;
 
     let (physical_device, device,
          indices, graphics_queue, presentation_queue,
@@ -446,26 +457,6 @@ impl Surreality {
         enable_portability, enable_validation))
   }
 
-  // TODO this is so short that it can likely be eliminated
-  #[allow(unsafe_code)]
-  fn init_surface(window: &Window, instance: &Instance)
-      -> Result<vk::SurfaceKHR>
-  {
-    //   Conveniently, Vulkanalia's "window" feature allows it to get the
-    // platform-specific stuff directly out of winit for us. This wrapper does
-    // not correspond 1:1 to a Vulkan function; rather, it picks the Vulkan
-    // function from the appropriate platform-specific extension.
-    //
-    //   The reason it takes the window twice is that that first one is
-    // actually there to reference the display (in the x11 sense of "display"
-    // meaning the connection to the windowing system).
-    let surface = unsafe {
-      vulkanalia::window::create_surface(&instance, &window, &window)
-    }?;
-
-    Ok(surface)
-  }
-
   #[allow(unsafe_code)]
   fn init_vulkan_device(instance: &Instance, surface: &vk::SurfaceKHR,
                         enable_validation: EnableValidation,