Skip to content

Commit

Permalink
Impl trait functions directly on EntryCustom/Instance/Device (#412)
Browse files Browse the repository at this point in the history
* Implement EntryV1_x, InstanceV1_x, DeviceV1_x functions directly
  • Loading branch information
Rua authored Apr 30, 2021
1 parent 3fe13fa commit f5e7cfe
Show file tree
Hide file tree
Showing 48 changed files with 715 additions and 750 deletions.
2 changes: 1 addition & 1 deletion ash-window/examples/winit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//!
//! On instance extensions platform specific extensions need to be enabled.

use ash::{version::EntryV1_0, vk};
use ash::vk;
use std::error::Error;

fn main() -> Result<(), Box<dyn Error>> {
Expand Down
19 changes: 5 additions & 14 deletions ash-window/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
use ash::{
extensions::khr,
prelude::*,
version::{EntryV1_0, InstanceV1_0},
vk,
};
use ash::{extensions::khr, prelude::*, vk, EntryCustom, Instance};
use raw_window_handle::{HasRawWindowHandle, RawWindowHandle};
use std::ffi::CStr;

Expand All @@ -19,16 +14,12 @@ use ash::extensions::ext; // portability extensions
/// In order for the created `SurfaceKHR` to be valid for the duration of its
/// usage, the `Instance` this was called on must be dropped later than the
/// resulting `SurfaceKHR`.
pub unsafe fn create_surface<E, I>(
entry: &E,
instance: &I,
pub unsafe fn create_surface<L>(
entry: &EntryCustom<L>,
instance: &Instance,
window_handle: &dyn HasRawWindowHandle,
allocation_callbacks: Option<&vk::AllocationCallbacks>,
) -> VkResult<vk::SurfaceKHR>
where
E: EntryV1_0,
I: InstanceV1_0,
{
) -> VkResult<vk::SurfaceKHR> {
match window_handle.raw_window_handle() {
#[cfg(target_os = "windows")]
RawWindowHandle::Windows(handle) => {
Expand Down
Loading

0 comments on commit f5e7cfe

Please sign in to comment.