Cleanup additional warnings

This commit is contained in:
maik klein 2017-01-05 09:52:32 +01:00
parent 42c1f97ffc
commit 6bc682893c
3 changed files with 30 additions and 34 deletions

View file

@ -422,20 +422,18 @@ pub trait DeviceV1_0 {
} }
unsafe fn create_pipeline_layout(&self, unsafe fn create_pipeline_layout(&self,
create_info: &vk::PipelineLayoutCreateInfo, create_info: &vk::PipelineLayoutCreateInfo,
allocation_callbacks: Option<&vk::AllocationCallbacks>) allocation_callbacks: Option<&vk::AllocationCallbacks>)
-> VkResult<vk::PipelineLayout> { -> VkResult<vk::PipelineLayout> {
unsafe { let mut pipeline_layout = mem::uninitialized();
let mut pipeline_layout = mem::uninitialized(); let err_code = self.fp_v1_0()
let err_code = self.fp_v1_0() .create_pipeline_layout(self.handle(),
.create_pipeline_layout(self.handle(), create_info,
create_info, allocation_callbacks.as_raw_ptr(),
allocation_callbacks.as_raw_ptr(), &mut pipeline_layout);
&mut pipeline_layout); match err_code {
match err_code { vk::Result::Success => Ok(pipeline_layout),
vk::Result::Success => Ok(pipeline_layout), _ => Err(err_code),
_ => Err(err_code),
}
} }
} }
@ -463,20 +461,18 @@ pub trait DeviceV1_0 {
} }
unsafe fn create_framebuffer(&self, unsafe fn create_framebuffer(&self,
create_info: &vk::FramebufferCreateInfo, create_info: &vk::FramebufferCreateInfo,
allocation_callbacks: Option<&vk::AllocationCallbacks>) allocation_callbacks: Option<&vk::AllocationCallbacks>)
-> VkResult<vk::Framebuffer> { -> VkResult<vk::Framebuffer> {
unsafe { let mut framebuffer = mem::uninitialized();
let mut framebuffer = mem::uninitialized(); let err_code = self.fp_v1_0()
let err_code = self.fp_v1_0() .create_framebuffer(self.handle(),
.create_framebuffer(self.handle(), create_info,
create_info, allocation_callbacks.as_raw_ptr(),
allocation_callbacks.as_raw_ptr(), &mut framebuffer);
&mut framebuffer); match err_code {
match err_code { vk::Result::Success => Ok(framebuffer),
vk::Result::Success => Ok(framebuffer), _ => Err(err_code),
_ => Err(err_code),
}
} }
} }

View file

@ -1,11 +1,10 @@
#![allow(dead_code)]
use prelude::*; use prelude::*;
use std::mem; use std::mem;
use instance::Instance;
use entry::Entry;
use vk; use vk;
use std::ffi::CStr; use std::ffi::CStr;
use ::RawPtr; use ::RawPtr;
use version::{V1_0, EntryV1_0}; use version::{EntryV1_0, InstanceV1_0};
#[derive(Clone)] #[derive(Clone)]
pub struct DebugReport { pub struct DebugReport {
@ -14,9 +13,9 @@ pub struct DebugReport {
} }
impl DebugReport { impl DebugReport {
pub fn new(entry: &Entry<V1_0>, pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E,
instance: &Instance<V1_0>) instance: &I)
-> Result<DebugReport, Vec<&'static str>> { -> Result<DebugReport, Vec<&'static str>> {
let debug_report_fn = vk::DebugReportFn::load(|name| { let debug_report_fn = vk::DebugReportFn::load(|name| {
unsafe { unsafe {
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr())) mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))

View file

@ -1,3 +1,4 @@
#![allow(dead_code)]
use prelude::*; use prelude::*;
use std::ptr; use std::ptr;
use std::mem; use std::mem;