Fix release mode crashing

This commit is contained in:
Pierre Krieger 2016-02-24 18:23:47 +01:00
parent fdb5784bda
commit 2619be95e9
3 changed files with 8 additions and 8 deletions

View File

@ -170,7 +170,7 @@ impl Instance {
// Enumerating all physical devices.
let physical_devices: Vec<vk::PhysicalDevice> = unsafe {
let mut num = mem::uninitialized();
let mut num = 0;
try!(check_errors(vk.EnumeratePhysicalDevices(instance, &mut num, ptr::null_mut())));
let mut devices = Vec::with_capacity(num as usize);
@ -192,7 +192,7 @@ impl Instance {
};
let queue_families = unsafe {
let mut num = mem::uninitialized();
let mut num = 0;
vk.GetPhysicalDeviceQueueFamilyProperties(device, &mut num, ptr::null_mut());
let mut families = Vec::with_capacity(num as usize);
@ -343,7 +343,7 @@ impl From<Error> for InstanceCreationError {
/// Queries the list of layers that are available when creating an instance.
pub fn layers_list() -> Result<Vec<LayerProperties>, OomError> {
unsafe {
let mut num = mem::uninitialized();
let mut num = 0;
try!(check_errors(VK_ENTRY.EnumerateInstanceLayerProperties(&mut num, ptr::null_mut())));
let mut layers: Vec<vk::LayerProperties> = Vec::with_capacity(num as usize);

View File

@ -72,7 +72,7 @@ impl DisplayPlane {
let vk = device.instance().pointers();
let num = unsafe {
let mut num: u32 = mem::uninitialized();
let mut num: u32 = 0;
try!(check_errors(vk.GetPhysicalDeviceDisplayPlanePropertiesKHR(device.internal_object(),
&mut num, ptr::null_mut())));
num
@ -90,7 +90,7 @@ impl DisplayPlane {
Ok(planes.into_iter().enumerate().map(|(index, prop)| {
let num = unsafe {
let mut num: u32 = mem::uninitialized();
let mut num: u32 = 0;
check_errors(vk.GetDisplayPlaneSupportedDisplaysKHR(device.internal_object(), index as u32,
&mut num, ptr::null_mut())).unwrap(); // TODO: shouldn't unwrap
num
@ -140,7 +140,7 @@ impl Display {
let vk = device.instance().pointers();
let num = unsafe {
let mut num = mem::uninitialized();
let mut num = 0;
try!(check_errors(vk.GetPhysicalDeviceDisplayPropertiesKHR(device.internal_object(),
&mut num, ptr::null_mut())));
num
@ -185,7 +185,7 @@ impl Display {
let vk = self.device.instance().pointers();
let num = unsafe {
let mut num = mem::uninitialized();
let mut num = 0;
try!(check_errors(vk.GetDisplayModePropertiesKHR(self.device.internal_object(),
self.properties.display,
&mut num, ptr::null_mut())));

View File

@ -133,7 +133,7 @@ impl Swapchain {
});
let images = unsafe {
let mut num = mem::uninitialized();
let mut num = 0;
try!(check_errors(vk.GetSwapchainImagesKHR(device.internal_object(),
swapchain.swapchain, &mut num,
ptr::null_mut())));