From 373ed4240225ed6a51910560028b50dc08566671 Mon Sep 17 00:00:00 2001 From: Maik Klein Date: Sun, 11 Nov 2018 10:46:03 +0100 Subject: [PATCH] Remove unused versioning --- ash/src/device.rs | 1 - ash/src/entry.rs | 1 - ash/src/instance.rs | 2 - ash/src/version.rs | 179 ----------------------------------- examples/src/bin/texture.rs | 1 - examples/src/bin/triangle.rs | 1 - 6 files changed, 185 deletions(-) diff --git a/ash/src/device.rs b/ash/src/device.rs index d0a9a06..8b9cbc0 100644 --- a/ash/src/device.rs +++ b/ash/src/device.rs @@ -3,7 +3,6 @@ use prelude::*; use std::mem; use std::os::raw::c_void; use std::ptr; -use version::{FunctionPointers, V1_0, V1_1}; use vk; use RawPtr; diff --git a/ash/src/entry.rs b/ash/src/entry.rs index 164659c..a6955d0 100644 --- a/ash/src/entry.rs +++ b/ash/src/entry.rs @@ -7,7 +7,6 @@ use std::mem; use std::os::raw::c_char; use std::path::Path; use std::ptr; -use version::{EntryLoader, FunctionPointers, InstanceLoader, V1_0, V1_1}; use vk; use RawPtr; diff --git a/ash/src/instance.rs b/ash/src/instance.rs index 3df66fc..6137c1d 100644 --- a/ash/src/instance.rs +++ b/ash/src/instance.rs @@ -4,8 +4,6 @@ use prelude::*; use std::mem; use std::os::raw::c_char; use std::ptr; -use version::DeviceLoader; -use version::{FunctionPointers, V1_0, V1_1}; use vk; use RawPtr; diff --git a/ash/src/version.rs b/ash/src/version.rs index 4d86da3..922f6bf 100644 --- a/ash/src/version.rs +++ b/ash/src/version.rs @@ -1,182 +1,3 @@ pub use device::{DeviceV1_0, DeviceV1_1}; pub use entry::{EntryV1_0, EntryV1_1}; pub use instance::{InstanceV1_0, InstanceV1_1}; -use std::mem; -use vk; -pub trait FunctionPointers { - type InstanceFp: InstanceLoader + Clone; - type DeviceFp: DeviceLoader + Clone; - type EntryFp: EntryLoader + Clone; -} - -#[allow(non_camel_case_types)] -#[derive(Clone)] -pub struct V1_1; -impl FunctionPointers for V1_1 { - type InstanceFp = InstanceFpV1_1; - type DeviceFp = DeviceFpV1_1; - type EntryFp = EntryFpV1_1; -} - -#[allow(non_camel_case_types)] -#[derive(Clone)] -pub struct V1_0; -impl FunctionPointers for V1_0 { - type InstanceFp = InstanceFpV1_0; - type DeviceFp = DeviceFpV1_0; - type EntryFp = EntryFpV1_0; -} - -#[allow(non_camel_case_types)] -#[derive(Clone)] -pub struct EntryFpV1_0 { - pub entry_fn: vk::EntryFnV1_0, -} - -impl EntryLoader for EntryFpV1_0 { - fn fp_v1_0(&self) -> &vk::EntryFnV1_0 { - &self.entry_fn - } - unsafe fn load(static_fn: &vk::StaticFn) -> Self { - let entry_fn = vk::EntryFnV1_0::load(|name| { - mem::transmute(static_fn.get_instance_proc_addr(vk::Instance::null(), name.as_ptr())) - }); - EntryFpV1_0 { entry_fn: entry_fn } - } -} - -pub trait EntryLoader: Sized { - fn fp_v1_0(&self) -> &vk::EntryFnV1_0; - unsafe fn load(static_fn: &vk::StaticFn) -> Self; -} - -#[allow(non_camel_case_types)] -#[derive(Clone)] -pub struct EntryFpV1_1 { - pub entry_fn_1_0: vk::EntryFnV1_0, - pub entry_fn_1_1: vk::EntryFnV1_1, -} - -impl EntryLoader for EntryFpV1_1 { - fn fp_v1_0(&self) -> &vk::EntryFnV1_0 { - &self.entry_fn_1_0 - } - unsafe fn load(static_fn: &vk::StaticFn) -> Self { - let entry_fn_1_0 = vk::EntryFnV1_0::load(|name| { - mem::transmute(static_fn.get_instance_proc_addr(vk::Instance::null(), name.as_ptr())) - }); - let entry_fn_1_1 = vk::EntryFnV1_1::load(|name| { - mem::transmute(static_fn.get_instance_proc_addr(vk::Instance::null(), name.as_ptr())) - }); - - EntryFpV1_1 { - entry_fn_1_0, - entry_fn_1_1, - } - } -} - -pub trait InstanceLoader: Sized { - unsafe fn load( - static_fn: &vk::StaticFn, - instance: vk::Instance, - ) -> Self; -} - -#[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, - ) -> Self { - let instance_fn = vk::InstanceFnV1_0::load(|name| { - mem::transmute(static_fn.get_instance_proc_addr(instance, name.as_ptr())) - }); - 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, - ) -> Self { - 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())) - }); - - InstanceFpV1_1 { - instance_fn_1_0, - instance_fn_1_1, - } - } -} - -pub trait DeviceLoader: Sized { - unsafe fn load( - instance_fn: &vk::InstanceFnV1_0, - device: vk::Device, - ) -> Self; -} - -#[allow(non_camel_case_types)] -#[derive(Clone)] -pub struct DeviceFpV1_0 { - pub device_fn: vk::DeviceFnV1_0, -} - -impl DeviceLoader for DeviceFpV1_0 { - unsafe fn load( - instance_fn: &vk::InstanceFnV1_0, - device: vk::Device, - ) -> Self { - let device_fn = vk::DeviceFnV1_0::load(|name| { - mem::transmute(instance_fn.get_device_proc_addr(device, name.as_ptr())) - }); - DeviceFpV1_0 { - device_fn: device_fn, - } - } -} - -#[allow(non_camel_case_types)] -#[derive(Clone)] -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( - instance_fn: &vk::InstanceFnV1_0, - device: vk::Device, - ) -> Self { - let device_fn_1_0 = vk::DeviceFnV1_0::load(|name| { - mem::transmute(instance_fn.get_device_proc_addr(device, name.as_ptr())) - }); - let device_fn_1_1 = vk::DeviceFnV1_1::load(|name| { - mem::transmute(instance_fn.get_device_proc_addr(device, name.as_ptr())) - }); - DeviceFpV1_1 { - device_fn_1_0, - device_fn_1_1, - } - } -} diff --git a/examples/src/bin/texture.rs b/examples/src/bin/texture.rs index d87df89..5aece4c 100644 --- a/examples/src/bin/texture.rs +++ b/examples/src/bin/texture.rs @@ -1,5 +1,4 @@ extern crate ash; -#[macro_use] extern crate examples; extern crate image; diff --git a/examples/src/bin/triangle.rs b/examples/src/bin/triangle.rs index 12a3b85..c0ba9f1 100644 --- a/examples/src/bin/triangle.rs +++ b/examples/src/bin/triangle.rs @@ -1,5 +1,4 @@ extern crate ash; -#[macro_use] extern crate examples; use ash::util::*;