New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch from mem::zeroed to MaybeUninit<T> #19
Comments
I don't think I think there's a couple of options:
I experimented with /// Construct `AllocatorCreateInfo` with default values
///
/// Note that the default `device` and `instance` fields are filled with dummy
/// implementations that will panic if used. These fields must be overwritten.
impl Default for AllocatorCreateInfo {
fn default() -> Self {
extern "C" fn get_device_proc_addr(
_: ash::vk::Instance,
_: *const std::os::raw::c_char,
) -> *const std::os::raw::c_void {
std::ptr::null()
}
extern "C" fn get_instance_proc_addr(
_: ash::vk::Instance,
name: *const std::os::raw::c_char,
) -> *const std::os::raw::c_void {
get_device_proc_addr as *const _
}
let static_fn = ash::vk::StaticFn::load(|_| get_instance_proc_addr as *const _);
let instance = unsafe { ash::Instance::load(&static_fn, ash::vk::Instance::null()) };
let device = unsafe { ash::Device::load(&instance.fp_v1_0(), ash::vk::Device::null()) };
AllocatorCreateInfo {
physical_device: ash::vk::PhysicalDevice::null(),
device,
instance,
flags: AllocatorCreateFlags::NONE,
preferred_large_heap_block_size: 0,
frame_in_use_count: 0,
heap_size_limits: None,
}
}
} |
Sure, that's probably a fine approach to start with for now. |
aloucks
added a commit
to aloucks/vk-mem-rs
that referenced
this issue
Sep 30, 2020
Nightly rust has now turned the mem::zeroed warning into a runtime panic. Fixes gwihlidal#19
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Newer rust compiler now warns about usage of mem::zeroed.
This warning is currently silenced in lib.rs:
It would be good to remove the allow pragma and switch to MaybeUninit.
The text was updated successfully, but these errors were encountered: