Exposed missing extensions

This commit is contained in:
maik klein 2017-01-05 09:17:14 +01:00
parent 9ec4f33ddf
commit 642b6ca2df
5 changed files with 44 additions and 39 deletions

View file

@ -1,11 +1,10 @@
#![allow(dead_code)] #![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::{EntryV1_0, InstanceV1_0};
#[derive(Clone)] #[derive(Clone)]
pub struct AndroidSurface { pub struct AndroidSurface {
@ -14,7 +13,9 @@ pub struct AndroidSurface {
} }
impl AndroidSurface { impl AndroidSurface {
pub fn new(entry: &Entry, instance: &Instance) -> Result<AndroidSurface, Vec<&'static str>> { pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E,
instance: &I)
-> Result<AndroidSurface, Vec<&'static str>> {
let surface_fn = vk::AndroidSurfaceFn::load(|name| { let surface_fn = vk::AndroidSurfaceFn::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()))
@ -37,9 +38,9 @@ impl AndroidSurface {
let mut surface = mem::uninitialized(); let mut surface = mem::uninitialized();
let err_code = self.android_surface_fn let err_code = self.android_surface_fn
.create_android_surface_khr(self.handle, .create_android_surface_khr(self.handle,
create_info, create_info,
allocation_callbacks.as_raw_ptr(), allocation_callbacks.as_raw_ptr(),
&mut surface); &mut surface);
match err_code { match err_code {
vk::Result::Success => Ok(surface), vk::Result::Success => Ok(surface),
_ => Err(err_code), _ => Err(err_code),

View file

@ -1,11 +1,10 @@
#![allow(dead_code)] #![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::{EntryV1_0, InstanceV1_0};
#[derive(Clone)] #[derive(Clone)]
pub struct MirSurface { pub struct MirSurface {
@ -14,7 +13,9 @@ pub struct MirSurface {
} }
impl MirSurface { impl MirSurface {
pub fn new(entry: &Entry, instance: &Instance) -> Result<MirSurface, Vec<&'static str>> { pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E,
instance: &I)
-> Result<MirSurface, Vec<&'static str>> {
let surface_fn = vk::MirSurfaceFn::load(|name| { let surface_fn = vk::MirSurfaceFn::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()))
@ -31,15 +32,15 @@ impl MirSurface {
} }
pub unsafe fn create_mir_surface_khr(&self, pub unsafe fn create_mir_surface_khr(&self,
create_info: &vk::MirSurfaceCreateInfoKHR, create_info: &vk::MirSurfaceCreateInfoKHR,
allocation_callbacks: Option<&vk::AllocationCallbacks>) allocation_callbacks: Option<&vk::AllocationCallbacks>)
-> VkResult<vk::SurfaceKHR> { -> VkResult<vk::SurfaceKHR> {
let mut surface = mem::uninitialized(); let mut surface = mem::uninitialized();
let err_code = self.mir_surface_fn let err_code = self.mir_surface_fn
.create_mir_surface_khr(self.handle, .create_mir_surface_khr(self.handle,
create_info, create_info,
allocation_callbacks.as_raw_ptr(), allocation_callbacks.as_raw_ptr(),
&mut surface); &mut surface);
match err_code { match err_code {
vk::Result::Success => Ok(surface), vk::Result::Success => Ok(surface),
_ => Err(err_code), _ => Err(err_code),

View file

@ -3,17 +3,17 @@ pub use self::surface::Surface;
pub use self::xlib_surface::XlibSurface; pub use self::xlib_surface::XlibSurface;
pub use self::debug_report::DebugReport; pub use self::debug_report::DebugReport;
pub use self::win32_surface::Win32Surface; pub use self::win32_surface::Win32Surface;
//pub use self::mir_surface::MirSurface; pub use self::mir_surface::MirSurface;
//pub use self::xcb_surface::XcbSurface; pub use self::xcb_surface::XcbSurface;
//pub use self::wayland_surface::WaylandSurface; pub use self::wayland_surface::WaylandSurface;
//pub use self::android_surface::AndroidSurface; pub use self::android_surface::AndroidSurface;
//
mod swapchain; mod swapchain;
mod surface; mod surface;
mod xlib_surface; mod xlib_surface;
mod win32_surface; mod win32_surface;
mod debug_report; mod debug_report;
//mod mir_surface; mod mir_surface;
//mod android_surface; mod android_surface;
//mod wayland_surface; mod wayland_surface;
//mod xcb_surface; mod xcb_surface;

View file

@ -1,10 +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::{EntryV1_0, InstanceV1_0};
#[derive(Clone)] #[derive(Clone)]
pub struct WaylandSurface { pub struct WaylandSurface {
@ -13,7 +13,9 @@ pub struct WaylandSurface {
} }
impl WaylandSurface { impl WaylandSurface {
pub fn new(entry: &Entry, instance: &Instance) -> Result<WaylandSurface, Vec<&'static str>> { pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E,
instance: &I)
-> Result<WaylandSurface, Vec<&'static str>> {
let surface_fn = vk::WaylandSurfaceFn::load(|name| { let surface_fn = vk::WaylandSurfaceFn::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()))
@ -36,9 +38,9 @@ impl WaylandSurface {
let mut surface = mem::uninitialized(); let mut surface = mem::uninitialized();
let err_code = self.wayland_surface_fn let err_code = self.wayland_surface_fn
.create_wayland_surface_khr(self.handle, .create_wayland_surface_khr(self.handle,
create_info, create_info,
allocation_callbacks.as_raw_ptr(), allocation_callbacks.as_raw_ptr(),
&mut surface); &mut surface);
match err_code { match err_code {
vk::Result::Success => Ok(surface), vk::Result::Success => Ok(surface),
_ => Err(err_code), _ => Err(err_code),

View file

@ -1,11 +1,10 @@
#![allow(dead_code)] #![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::{EntryV1_0, InstanceV1_0};
#[derive(Clone)] #[derive(Clone)]
pub struct XcbSurface { pub struct XcbSurface {
@ -14,7 +13,9 @@ pub struct XcbSurface {
} }
impl XcbSurface { impl XcbSurface {
pub fn new(entry: &Entry, instance: &Instance) -> Result<XcbSurface, Vec<&'static str>> { pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E,
instance: &I)
-> Result<XcbSurface, Vec<&'static str>> {
let surface_fn = vk::XcbSurfaceFn::load(|name| { let surface_fn = vk::XcbSurfaceFn::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()))
@ -31,15 +32,15 @@ impl XcbSurface {
} }
pub unsafe fn create_xcb_surface_khr(&self, pub unsafe fn create_xcb_surface_khr(&self,
create_info: &vk::XcbSurfaceCreateInfoKHR, create_info: &vk::XcbSurfaceCreateInfoKHR,
allocation_callbacks: Option<&vk::AllocationCallbacks>) allocation_callbacks: Option<&vk::AllocationCallbacks>)
-> VkResult<vk::SurfaceKHR> { -> VkResult<vk::SurfaceKHR> {
let mut surface = mem::uninitialized(); let mut surface = mem::uninitialized();
let err_code = self.xcb_surface_fn let err_code = self.xcb_surface_fn
.create_xcb_surface_khr(self.handle, .create_xcb_surface_khr(self.handle,
create_info, create_info,
allocation_callbacks.as_raw_ptr(), allocation_callbacks.as_raw_ptr(),
&mut surface); &mut surface);
match err_code { match err_code {
vk::Result::Success => Ok(surface), vk::Result::Success => Ok(surface),
_ => Err(err_code), _ => Err(err_code),