Naming scheme for function pointers
This commit is contained in:
parent
0c0b147502
commit
b9273b8db5
4 changed files with 10 additions and 10 deletions
|
@ -10,12 +10,12 @@ use instance::{VkVersion, V1_0};
|
|||
// unsafe impl Send for Device {}
|
||||
|
||||
pub struct DeviceFpV1_0 {
|
||||
pub device_fn: vk::DeviceFn,
|
||||
pub device_fn: vk::DeviceFnV1_0,
|
||||
}
|
||||
|
||||
pub trait DeviceV1_0 {
|
||||
fn handle(&self) -> vk::Device;
|
||||
fn fp_v1_0(&self) -> &vk::DeviceFn;
|
||||
fn fp_v1_0(&self) -> &vk::DeviceFnV1_0;
|
||||
unsafe fn destroy_device(&self, allocation_callbacks: Option<&vk::AllocationCallbacks>) {
|
||||
self.fp_v1_0().destroy_device(self.handle(), allocation_callbacks.as_raw_ptr());
|
||||
}
|
||||
|
@ -761,7 +761,7 @@ impl DeviceV1_0 for Device<V1_0> {
|
|||
self.handle
|
||||
}
|
||||
|
||||
fn fp_v1_0(&self) -> &vk::DeviceFn {
|
||||
fn fp_v1_0(&self) -> &vk::DeviceFnV1_0 {
|
||||
&self.device_fn.device_fn
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ impl Entry<V1_0>{
|
|||
if err_code != vk::Result::Success {
|
||||
return Err(InstanceError::VkError(err_code));
|
||||
}
|
||||
let instance_fn = vk::InstanceFn::load(|name| {
|
||||
let instance_fn = vk::InstanceFnV1_0::load(|name| {
|
||||
mem::transmute(self.static_fn.get_instance_proc_addr(instance, name.as_ptr()))
|
||||
}).map_err(|err| InstanceError::LoadError(err))?;
|
||||
Ok(Instance::from_raw(instance, InstanceFpV1_0 { instance_fn: instance_fn }))
|
||||
|
|
|
@ -26,7 +26,7 @@ impl VkVersion for V1_0 {
|
|||
|
||||
#[warn(non_camel_case_types)]
|
||||
pub struct InstanceFpV1_0 {
|
||||
pub instance_fn: vk::InstanceFn,
|
||||
pub instance_fn: vk::InstanceFnV1_0,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -40,7 +40,7 @@ impl InstanceV1_0 for Instance<V1_0> {
|
|||
self.handle
|
||||
}
|
||||
|
||||
fn fp_v1_0(&self) -> &vk::InstanceFn {
|
||||
fn fp_v1_0(&self) -> &vk::InstanceFnV1_0 {
|
||||
&self.instance_fp.instance_fn
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ impl Instance<V1_0> {
|
|||
if err_code != vk::Result::Success {
|
||||
return Err(DeviceError::VkError(err_code));
|
||||
}
|
||||
let device_fn = vk::DeviceFn::load(|name| {
|
||||
let device_fn = vk::DeviceFnV1_0::load(|name| {
|
||||
mem::transmute(self.fp_v1_0().get_device_proc_addr(device, name.as_ptr()))
|
||||
}).map_err(|err| DeviceError::LoadError(err))?;
|
||||
Ok(Device::from_raw(device, DeviceFpV1_0 { device_fn: device_fn }))
|
||||
|
@ -82,7 +82,7 @@ impl Instance<V1_0> {
|
|||
#[warn(non_camel_case_types)]
|
||||
pub trait InstanceV1_0 {
|
||||
fn handle(&self) -> vk::Instance;
|
||||
fn fp_v1_0(&self) -> &vk::InstanceFn;
|
||||
fn fp_v1_0(&self) -> &vk::InstanceFnV1_0;
|
||||
fn get_device_proc_addr(&self,
|
||||
device: vk::Device,
|
||||
p_name: *const vk::c_char)
|
||||
|
|
|
@ -3730,7 +3730,7 @@ vk_functions!{
|
|||
}
|
||||
|
||||
vk_functions!{
|
||||
InstanceFn,
|
||||
InstanceFnV1_0,
|
||||
|
||||
"vkDestroyInstance", destroy_instance(
|
||||
instance: Instance,
|
||||
|
@ -3819,7 +3819,7 @@ vk_functions!{
|
|||
}
|
||||
|
||||
vk_functions!{
|
||||
DeviceFn,
|
||||
DeviceFnV1_0,
|
||||
"vkDestroyDevice", destroy_device(
|
||||
device: Device,
|
||||
p_allocator: *const AllocationCallbacks,
|
||||
|
|
Loading…
Add table
Reference in a new issue