Update ash to 0.35 (#63)

* Update ash to 0.34

* Update ash to 0.35
This commit is contained in:
Ashley Hauck 2021-12-28 14:04:00 +01:00 committed by GitHub
parent 6d8a0e6e79
commit 823fbb851a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 29 deletions

View file

@ -14,7 +14,7 @@ documentation = "https://docs.rs/ash-molten"
build = "build/build.rs"
[dependencies]
ash = { version = "0.33", default-features = false }
ash = { version = "0.35", default-features = false }
[build-dependencies]
anyhow = "1.0"

View file

@ -74,7 +74,7 @@ use ash::vk;
use std::ffi::CString;
fn main() {
unsafe {
let entry = ash_molten::MoltenEntry::load();
let entry = ash_molten::load();
let app_name = CString::new("Hello Static Molten").unwrap();
let appinfo = vk::ApplicationInfo::builder()

View file

@ -70,9 +70,7 @@
// crate-specific exceptions:
#![allow(unsafe_code)]
use std::ops::Deref;
use ash::{vk, EntryCustom};
use ash::{vk, Entry};
extern "system" {
fn vkGetInstanceProcAddr(
@ -81,28 +79,10 @@ extern "system" {
) -> vk::PFN_vkVoidFunction;
}
/// The entry point for the statically linked molten library
pub struct MoltenEntry(EntryCustom<()>);
impl MoltenEntry {
/// Fetches the function pointer to `vkGetInstanceProcAddr` which is statically linked.
pub fn load() -> Self {
Self(
EntryCustom::new_custom((), |(), name| {
assert_eq!(name.to_bytes_with_nul(), b"vkGetInstanceProcAddr\0");
vkGetInstanceProcAddr as _
})
// This can never fail because we always return the address of
// `vkGetInstanceProcAddr` from the closure:
.unwrap(),
)
}
}
impl Deref for MoltenEntry {
type Target = EntryCustom<()>;
fn deref(&self) -> &Self::Target {
&self.0
}
/// Fetches the function pointer to `vkGetInstanceProcAddr` which is statically linked.
pub fn load() -> Entry {
let static_fn = vk::StaticFn {
get_instance_proc_addr: vkGetInstanceProcAddr,
};
unsafe { Entry::from_static_fn(static_fn) }
}