Add initial support for 1.1
This commit is contained in:
parent
e9db6b516a
commit
60915eacb2
3 changed files with 136 additions and 28 deletions
|
@ -1,10 +1,22 @@
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
use prelude::*;
|
use prelude::*;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use version::{FunctionPointers, V1_0};
|
use version::{FunctionPointers, V1_0, V1_1};
|
||||||
use vk;
|
use vk;
|
||||||
use RawPtr;
|
use RawPtr;
|
||||||
|
|
||||||
|
#[allow(non_camel_case_types)]
|
||||||
|
pub trait DeviceV1_1: DeviceV1_0 {
|
||||||
|
fn fp_v1_1(&self) -> &vk::DeviceFnV1_1;
|
||||||
|
unsafe fn bind_buffer_memory2(&self, bind_infos: &[vk::BindBufferMemoryInfo]) -> vk::Result {
|
||||||
|
self.fp_v1_1().bind_buffer_memory2(
|
||||||
|
self.handle(),
|
||||||
|
bind_infos.len() as _,
|
||||||
|
bind_infos.as_ptr(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
pub trait DeviceV1_0 {
|
pub trait DeviceV1_0 {
|
||||||
fn handle(&self) -> vk::Device;
|
fn handle(&self) -> vk::Device;
|
||||||
|
@ -1495,6 +1507,22 @@ impl DeviceV1_0 for Device<V1_0> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl DeviceV1_0 for Device<V1_1> {
|
||||||
|
fn handle(&self) -> vk::Device {
|
||||||
|
self.handle
|
||||||
|
}
|
||||||
|
|
||||||
|
fn fp_v1_0(&self) -> &vk::DeviceFnV1_0 {
|
||||||
|
&self.device_fn.device_fn_1_0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl DeviceV1_1 for Device<V1_1> {
|
||||||
|
fn fp_v1_1(&self) -> &vk::DeviceFnV1_1 {
|
||||||
|
&self.device_fn.device_fn_1_1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<V: FunctionPointers> Device<V> {
|
impl<V: FunctionPointers> Device<V> {
|
||||||
pub fn handle(&self) -> vk::Device {
|
pub fn handle(&self) -> vk::Device {
|
||||||
self.handle
|
self.handle
|
||||||
|
|
|
@ -6,7 +6,7 @@ use std::fmt;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use version::DeviceLoader;
|
use version::DeviceLoader;
|
||||||
use version::{FunctionPointers, V1_0};
|
use version::{FunctionPointers, V1_0, V1_1};
|
||||||
use vk;
|
use vk;
|
||||||
use RawPtr;
|
use RawPtr;
|
||||||
|
|
||||||
|
@ -51,6 +51,24 @@ impl InstanceV1_0 for Instance<V1_0> {
|
||||||
&self.instance_fp.instance_fn
|
&self.instance_fp.instance_fn
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl InstanceV1_0 for Instance<V1_1> {
|
||||||
|
type Fp = V1_1;
|
||||||
|
fn handle(&self) -> vk::Instance {
|
||||||
|
self.handle
|
||||||
|
}
|
||||||
|
|
||||||
|
fn fp_v1_0(&self) -> &vk::InstanceFnV1_0 {
|
||||||
|
&self.instance_fp.instance_fn_1_0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl InstanceV1_1 for Instance<V1_1> {
|
||||||
|
fn fp_v1_1(&self) -> &vk::InstanceFnV1_1 {
|
||||||
|
&self.instance_fp.instance_fn_1_1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<V: FunctionPointers> Instance<V> {
|
impl<V: FunctionPointers> Instance<V> {
|
||||||
pub fn handle(&self) -> vk::Instance {
|
pub fn handle(&self) -> vk::Instance {
|
||||||
self.handle
|
self.handle
|
||||||
|
@ -64,6 +82,15 @@ impl<V: FunctionPointers> Instance<V> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(non_camel_case_types)]
|
||||||
|
pub trait InstanceV1_1: InstanceV1_0 {
|
||||||
|
fn fp_v1_1(&self) -> &vk::InstanceFnV1_1;
|
||||||
|
unsafe fn enumerate_instance_version(&self, api_version: &vk::uint32_t) -> vk::Result {
|
||||||
|
self.fp_v1_1()
|
||||||
|
.enumerate_instance_version(api_version as *const _)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
pub trait InstanceV1_0 {
|
pub trait InstanceV1_0 {
|
||||||
type Fp: FunctionPointers;
|
type Fp: FunctionPointers;
|
||||||
|
@ -253,6 +280,3 @@ pub trait InstanceV1_0 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// pub trait InstanceMajor1Minor1: InstanceMajor1Minor0 {}
|
|
||||||
// pub trait InstanceMajor1Minor2: InstanceMajor1Minor1 {}
|
|
||||||
|
|
|
@ -11,17 +11,20 @@ pub trait FunctionPointers {
|
||||||
|
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct V1_0;
|
pub struct V1_1;
|
||||||
impl FunctionPointers for V1_0 {
|
impl FunctionPointers for V1_1 {
|
||||||
type InstanceFp = InstanceFpV1_0;
|
type InstanceFp = InstanceFpV1_1;
|
||||||
type DeviceFp = DeviceFpV1_0;
|
type DeviceFp = DeviceFpV1_1;
|
||||||
type EntryFp = EntryFpV1_0;
|
type EntryFp = EntryFpV1_0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct InstanceFpV1_0 {
|
pub struct V1_0;
|
||||||
pub instance_fn: vk::InstanceFnV1_0,
|
impl FunctionPointers for V1_0 {
|
||||||
|
type InstanceFp = InstanceFpV1_0;
|
||||||
|
type DeviceFp = DeviceFpV1_0;
|
||||||
|
type EntryFp = EntryFpV1_0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
|
@ -48,13 +51,58 @@ pub trait EntryLoader: Sized {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait InstanceLoader: Sized {
|
pub trait InstanceLoader: Sized {
|
||||||
fn fp_v1_0(&self) -> &vk::InstanceFnV1_0;
|
|
||||||
unsafe fn load(
|
unsafe fn load(
|
||||||
static_fn: &vk::StaticFn,
|
static_fn: &vk::StaticFn,
|
||||||
instance: vk::Instance,
|
instance: vk::Instance,
|
||||||
) -> Result<Self, Vec<&'static str>>;
|
) -> Result<Self, Vec<&'static str>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(non_camel_case_types)]
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub struct InstanceFpV1_0 {
|
||||||
|
pub instance_fn: vk::InstanceFnV1_0,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl InstanceLoader for InstanceFpV1_0 {
|
||||||
|
unsafe fn load(
|
||||||
|
static_fn: &vk::StaticFn,
|
||||||
|
instance: vk::Instance,
|
||||||
|
) -> Result<Self, Vec<&'static str>> {
|
||||||
|
let instance_fn = vk::InstanceFnV1_0::load(|name| {
|
||||||
|
mem::transmute(static_fn.get_instance_proc_addr(instance, name.as_ptr()))
|
||||||
|
})?;
|
||||||
|
Ok(InstanceFpV1_0 {
|
||||||
|
instance_fn: instance_fn,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(non_camel_case_types)]
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub struct InstanceFpV1_1 {
|
||||||
|
pub instance_fn_1_0: vk::InstanceFnV1_0,
|
||||||
|
pub instance_fn_1_1: vk::InstanceFnV1_1,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl InstanceLoader for InstanceFpV1_1 {
|
||||||
|
unsafe fn load(
|
||||||
|
static_fn: &vk::StaticFn,
|
||||||
|
instance: vk::Instance,
|
||||||
|
) -> Result<Self, Vec<&'static str>> {
|
||||||
|
let instance_fn_1_0 = vk::InstanceFnV1_0::load(|name| {
|
||||||
|
mem::transmute(static_fn.get_instance_proc_addr(instance, name.as_ptr()))
|
||||||
|
})?;
|
||||||
|
let instance_fn_1_1 = vk::InstanceFnV1_1::load(|name| {
|
||||||
|
mem::transmute(static_fn.get_instance_proc_addr(instance, name.as_ptr()))
|
||||||
|
})?;
|
||||||
|
|
||||||
|
Ok(InstanceFpV1_1 {
|
||||||
|
instance_fn_1_0,
|
||||||
|
instance_fn_1_1,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub trait DeviceLoader: Sized {
|
pub trait DeviceLoader: Sized {
|
||||||
unsafe fn load(
|
unsafe fn load(
|
||||||
instance_fn: &vk::InstanceFnV1_0,
|
instance_fn: &vk::InstanceFnV1_0,
|
||||||
|
@ -62,6 +110,12 @@ pub trait DeviceLoader: Sized {
|
||||||
) -> Result<Self, Vec<&'static str>>;
|
) -> Result<Self, Vec<&'static str>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(non_camel_case_types)]
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub struct DeviceFpV1_0 {
|
||||||
|
pub device_fn: vk::DeviceFnV1_0,
|
||||||
|
}
|
||||||
|
|
||||||
impl DeviceLoader for DeviceFpV1_0 {
|
impl DeviceLoader for DeviceFpV1_0 {
|
||||||
unsafe fn load(
|
unsafe fn load(
|
||||||
instance_fn: &vk::InstanceFnV1_0,
|
instance_fn: &vk::InstanceFnV1_0,
|
||||||
|
@ -76,25 +130,27 @@ impl DeviceLoader for DeviceFpV1_0 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl InstanceLoader for InstanceFpV1_0 {
|
#[allow(non_camel_case_types)]
|
||||||
fn fp_v1_0(&self) -> &vk::InstanceFnV1_0 {
|
#[derive(Clone)]
|
||||||
&self.instance_fn
|
pub struct DeviceFpV1_1 {
|
||||||
}
|
pub device_fn_1_0: vk::DeviceFnV1_0,
|
||||||
|
pub device_fn_1_1: vk::DeviceFnV1_1,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl DeviceLoader for DeviceFpV1_1 {
|
||||||
unsafe fn load(
|
unsafe fn load(
|
||||||
static_fn: &vk::StaticFn,
|
instance_fn: &vk::InstanceFnV1_0,
|
||||||
instance: vk::Instance,
|
device: vk::Device,
|
||||||
) -> Result<Self, Vec<&'static str>> {
|
) -> Result<Self, Vec<&'static str>> {
|
||||||
let instance_fn = vk::InstanceFnV1_0::load(|name| {
|
let device_fn_1_0 = vk::DeviceFnV1_0::load(|name| {
|
||||||
mem::transmute(static_fn.get_instance_proc_addr(instance, name.as_ptr()))
|
mem::transmute(instance_fn.get_device_proc_addr(device, name.as_ptr()))
|
||||||
})?;
|
})?;
|
||||||
Ok(InstanceFpV1_0 {
|
let device_fn_1_1 = vk::DeviceFnV1_1::load(|name| {
|
||||||
instance_fn: instance_fn,
|
mem::transmute(instance_fn.get_device_proc_addr(device, name.as_ptr()))
|
||||||
|
})?;
|
||||||
|
Ok(DeviceFpV1_1 {
|
||||||
|
device_fn_1_0,
|
||||||
|
device_fn_1_1,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_camel_case_types)]
|
|
||||||
#[derive(Clone)]
|
|
||||||
pub struct DeviceFpV1_0 {
|
|
||||||
pub device_fn: vk::DeviceFnV1_0,
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue