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)]
use prelude::*;
use std::mem;
use instance::Instance;
use entry::Entry;
use vk;
use std::ffi::CStr;
use ::RawPtr;
use version::{EntryV1_0, InstanceV1_0};
#[derive(Clone)]
pub struct AndroidSurface {
@ -14,7 +13,9 @@ pub struct 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| {
unsafe {
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
@ -37,9 +38,9 @@ impl AndroidSurface {
let mut surface = mem::uninitialized();
let err_code = self.android_surface_fn
.create_android_surface_khr(self.handle,
create_info,
allocation_callbacks.as_raw_ptr(),
&mut surface);
create_info,
allocation_callbacks.as_raw_ptr(),
&mut surface);
match err_code {
vk::Result::Success => Ok(surface),
_ => Err(err_code),

View file

@ -1,11 +1,10 @@
#![allow(dead_code)]
use prelude::*;
use std::mem;
use instance::Instance;
use entry::Entry;
use vk;
use std::ffi::CStr;
use ::RawPtr;
use version::{EntryV1_0, InstanceV1_0};
#[derive(Clone)]
pub struct MirSurface {
@ -14,7 +13,9 @@ pub struct 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| {
unsafe {
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,
create_info: &vk::MirSurfaceCreateInfoKHR,
allocation_callbacks: Option<&vk::AllocationCallbacks>)
-> VkResult<vk::SurfaceKHR> {
create_info: &vk::MirSurfaceCreateInfoKHR,
allocation_callbacks: Option<&vk::AllocationCallbacks>)
-> VkResult<vk::SurfaceKHR> {
let mut surface = mem::uninitialized();
let err_code = self.mir_surface_fn
.create_mir_surface_khr(self.handle,
create_info,
allocation_callbacks.as_raw_ptr(),
&mut surface);
create_info,
allocation_callbacks.as_raw_ptr(),
&mut surface);
match err_code {
vk::Result::Success => Ok(surface),
_ => Err(err_code),

View file

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

View file

@ -1,10 +1,10 @@
#![allow(dead_code)]
use prelude::*;
use std::mem;
use instance::Instance;
use entry::Entry;
use vk;
use std::ffi::CStr;
use ::RawPtr;
use version::{EntryV1_0, InstanceV1_0};
#[derive(Clone)]
pub struct WaylandSurface {
@ -13,7 +13,9 @@ pub struct 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| {
unsafe {
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
@ -36,9 +38,9 @@ impl WaylandSurface {
let mut surface = mem::uninitialized();
let err_code = self.wayland_surface_fn
.create_wayland_surface_khr(self.handle,
create_info,
allocation_callbacks.as_raw_ptr(),
&mut surface);
create_info,
allocation_callbacks.as_raw_ptr(),
&mut surface);
match err_code {
vk::Result::Success => Ok(surface),
_ => Err(err_code),

View file

@ -1,11 +1,10 @@
#![allow(dead_code)]
use prelude::*;
use std::mem;
use instance::Instance;
use entry::Entry;
use vk;
use std::ffi::CStr;
use ::RawPtr;
use version::{EntryV1_0, InstanceV1_0};
#[derive(Clone)]
pub struct XcbSurface {
@ -14,7 +13,9 @@ pub struct 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| {
unsafe {
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,
create_info: &vk::XcbSurfaceCreateInfoKHR,
allocation_callbacks: Option<&vk::AllocationCallbacks>)
-> VkResult<vk::SurfaceKHR> {
create_info: &vk::XcbSurfaceCreateInfoKHR,
allocation_callbacks: Option<&vk::AllocationCallbacks>)
-> VkResult<vk::SurfaceKHR> {
let mut surface = mem::uninitialized();
let err_code = self.xcb_surface_fn
.create_xcb_surface_khr(self.handle,
create_info,
allocation_callbacks.as_raw_ptr(),
&mut surface);
create_info,
allocation_callbacks.as_raw_ptr(),
&mut surface);
match err_code {
vk::Result::Success => Ok(surface),
_ => Err(err_code),