Skip to content

Commit 60b5179

Browse files
committed
extension: Rename wrapper structs to Device or Instance
1 parent 226b2b3 commit 60b5179

File tree

82 files changed

+170
-248
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+170
-248
lines changed

ash-examples/src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,9 @@ pub struct ExampleBase {
146146
pub entry: Entry,
147147
pub instance: Instance,
148148
pub device: Device,
149-
pub surface_loader: surface::Surface,
150-
pub swapchain_loader: swapchain::SwapchainDevice,
151-
pub debug_utils_loader: debug_utils::DebugUtilsInstance,
149+
pub surface_loader: surface::Instance,
150+
pub swapchain_loader: swapchain::Device,
151+
pub debug_utils_loader: debug_utils::Instance,
152152
pub window: winit::window::Window,
153153
pub event_loop: RefCell<EventLoop<()>>,
154154
pub debug_call_back: vk::DebugUtilsMessengerEXT,
@@ -279,7 +279,7 @@ impl ExampleBase {
279279
)
280280
.pfn_user_callback(Some(vulkan_debug_callback));
281281

282-
let debug_utils_loader = debug_utils::DebugUtilsInstance::new(&entry, &instance);
282+
let debug_utils_loader = debug_utils::Instance::new(&entry, &instance);
283283
let debug_call_back = debug_utils_loader
284284
.create_debug_utils_messenger(&debug_info, None)
285285
.unwrap();
@@ -294,7 +294,7 @@ impl ExampleBase {
294294
let pdevices = instance
295295
.enumerate_physical_devices()
296296
.expect("Physical device error");
297-
let surface_loader = surface::Surface::new(&entry, &instance);
297+
let surface_loader = surface::Instance::new(&entry, &instance);
298298
let (pdevice, queue_family_index) = pdevices
299299
.iter()
300300
.find_map(|pdevice| {
@@ -383,7 +383,7 @@ impl ExampleBase {
383383
.cloned()
384384
.find(|&mode| mode == vk::PresentModeKHR::MAILBOX)
385385
.unwrap_or(vk::PresentModeKHR::FIFO);
386-
let swapchain_loader = swapchain::SwapchainDevice::new(&instance, &device);
386+
let swapchain_loader = swapchain::Device::new(&instance, &device);
387387

388388
let swapchain_create_info = vk::SwapchainCreateInfoKHR::default()
389389
.surface(surface)

ash-window/examples/winit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ fn main() -> Result<(), Box<dyn Error>> {
4141
window.raw_window_handle(),
4242
None,
4343
)?;
44-
let surface_fn = ash::extensions::khr::surface::Surface::new(&entry, &instance);
44+
let surface_fn = ash::extensions::khr::surface::Instance::new(&entry, &instance);
4545
println!("surface: {surface:?}");
4646

4747
event_loop.run(move |event, _, control_flow| match event {

ash-window/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ pub unsafe fn create_surface(
9494
};
9595

9696
let surface_desc = vk::MetalSurfaceCreateInfoEXT::default().layer(&*layer);
97-
let surface_fn = metal_surface::MetalSurface::new(entry, instance);
97+
let surface_fn = metal_surface::Instance::new(entry, instance);
9898
surface_fn.create_metal_surface(&surface_desc, allocation_callbacks)
9999
}
100100

@@ -108,7 +108,7 @@ pub unsafe fn create_surface(
108108
};
109109

110110
let surface_desc = vk::MetalSurfaceCreateInfoEXT::default().layer(&*layer);
111-
let surface_fn = metal_surface::MetalSurface::new(entry, instance);
111+
let surface_fn = metal_surface::Instance::new(entry, instance);
112112
surface_fn.create_metal_surface(&surface_desc, allocation_callbacks)
113113
}
114114

ash/src/extensions/amd/buffer_marker.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
use crate::vk;
2-
use crate::{Device, Instance};
32
use std::ffi::CStr;
43
use std::mem;
54

65
pub const NAME: &CStr = vk::amd_buffer_marker::NAME;
76

87
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_AMD_buffer_marker.html>
98
#[derive(Clone)]
10-
pub struct BufferMarker {
9+
pub struct Device {
1110
fp: vk::amd_buffer_marker::DeviceFn,
1211
}
1312

14-
impl BufferMarker {
15-
pub fn new(instance: &Instance, device: &Device) -> Self {
13+
impl Device {
14+
pub fn new(instance: &crate::Instance, device: &crate::Device) -> Self {
1615
let fp = vk::amd_buffer_marker::DeviceFn::load(|name| unsafe {
1716
mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr()))
1817
});

ash/src/extensions/amd/shader_info.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
use crate::prelude::*;
22
use crate::vk;
3-
use crate::{Device, Instance};
43
use std::ffi::CStr;
54
use std::mem;
65

76
pub const NAME: &CStr = vk::amd_shader_info::NAME;
87

98
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_AMD_shader_info.html>
109
#[derive(Clone)]
11-
pub struct ShaderInfo {
10+
pub struct Device {
1211
handle: vk::Device,
1312
fp: vk::amd_shader_info::DeviceFn,
1413
}
1514

16-
impl ShaderInfo {
17-
pub fn new(instance: &Instance, device: &Device) -> Self {
15+
impl Device {
16+
pub fn new(instance: &crate::Instance, device: &crate::Device) -> Self {
1817
let handle = device.handle();
1918
let fp = vk::amd_shader_info::DeviceFn::load(|name| unsafe {
2019
mem::transmute(instance.get_device_proc_addr(handle, name.as_ptr()))

ash/src/extensions/amdx/shader_enqueue.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
use crate::prelude::*;
22
use crate::vk;
33
use crate::RawPtr;
4-
use crate::{Device, Instance};
54
use std::ffi::CStr;
65
use std::mem;
76

87
pub const NAME: &CStr = vk::amdx_shader_enqueue::NAME;
98

109
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_AMDX_shader_enqueue.html>
1110
#[derive(Clone)]
12-
pub struct ShaderEnqueue {
11+
pub struct Device {
1312
handle: vk::Device,
1413
fp: vk::amdx_shader_enqueue::DeviceFn,
1514
}
1615

17-
impl ShaderEnqueue {
18-
pub fn new(instance: &Instance, device: &Device) -> Self {
16+
impl Device {
17+
pub fn new(instance: &crate::Instance, device: &crate::Device) -> Self {
1918
let handle = device.handle();
2019
let fp = vk::amdx_shader_enqueue::DeviceFn::load(|name| unsafe {
2120
mem::transmute(instance.get_device_proc_addr(handle, name.as_ptr()))

ash/src/extensions/android/external_memory_android_hardware_buffer.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
use crate::prelude::*;
22
use crate::vk;
3-
use crate::{Device, Instance};
43
use std::ffi::CStr;
54
use std::mem;
65

76
pub const NAME: &CStr = vk::android_external_memory_android_hardware_buffer::NAME;
87

98
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_ANDROID_external_memory_android_hardware_buffer.html>
109
#[derive(Clone)]
11-
pub struct ExternalMemoryAndroidHardwareBuffer {
10+
pub struct Device {
1211
handle: vk::Device,
1312
fp: vk::android_external_memory_android_hardware_buffer::DeviceFn,
1413
}
1514

16-
impl ExternalMemoryAndroidHardwareBuffer {
17-
pub fn new(instance: &Instance, device: &Device) -> Self {
15+
impl Device {
16+
pub fn new(instance: &crate::Instance, device: &crate::Device) -> Self {
1817
let handle = device.handle();
1918
let fp =
2019
vk::android_external_memory_android_hardware_buffer::DeviceFn::load(|name| unsafe {

ash/src/extensions/ext/acquire_drm_display.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
use crate::prelude::*;
22
use crate::vk;
3-
use crate::{Entry, Instance};
43
use std::ffi::CStr;
54
use std::mem;
65

76
pub const NAME: &CStr = vk::ext_acquire_drm_display::NAME;
87

98
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_EXT_acquire_drm_display.html>
109
#[derive(Clone)]
11-
pub struct AcquireDrmDisplay {
10+
pub struct Instance {
1211
fp: vk::ext_acquire_drm_display::InstanceFn,
1312
}
1413

15-
impl AcquireDrmDisplay {
16-
pub fn new(entry: &Entry, instance: &Instance) -> Self {
14+
impl Instance {
15+
pub fn new(entry: &crate::Entry, instance: &crate::Instance) -> Self {
1716
let handle = instance.handle();
1817
let fp = vk::ext_acquire_drm_display::InstanceFn::load(|name| unsafe {
1918
mem::transmute(entry.get_instance_proc_addr(handle, name.as_ptr()))

ash/src/extensions/ext/buffer_device_address.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
use crate::vk;
2-
use crate::{Device, Instance};
32
use std::ffi::CStr;
43
use std::mem;
54

65
pub const NAME: &CStr = vk::ext_buffer_device_address::NAME;
76

87
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_buffer_device_address.html>
98
#[derive(Clone)]
10-
pub struct BufferDeviceAddress {
9+
pub struct Device {
1110
handle: vk::Device,
1211
fp: vk::ext_buffer_device_address::DeviceFn,
1312
}
1413

15-
impl BufferDeviceAddress {
16-
pub fn new(instance: &Instance, device: &Device) -> Self {
14+
impl Device {
15+
pub fn new(instance: &crate::Instance, device: &crate::Device) -> Self {
1716
let handle = device.handle();
1817
let fp = vk::ext_buffer_device_address::DeviceFn::load(|name| unsafe {
1918
mem::transmute(instance.get_device_proc_addr(handle, name.as_ptr()))

ash/src/extensions/ext/calibrated_timestamps.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use crate::prelude::*;
22
use crate::vk;
3-
use crate::{Device, Entry, Instance};
43
use std::ffi::CStr;
54
use std::mem;
65

@@ -9,13 +8,13 @@ pub const NAME: &CStr = vk::ext_calibrated_timestamps::NAME;
98
/// High-level device function wrapper for
109
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_calibrated_timestamps.html>
1110
#[derive(Clone)]
12-
pub struct CalibratedTimestampsDevice {
11+
pub struct Device {
1312
handle: vk::Device,
1413
fp: vk::ext_calibrated_timestamps::DeviceFn,
1514
}
1615

17-
impl CalibratedTimestampsDevice {
18-
pub fn new(instance: &Instance, device: &Device) -> Self {
16+
impl Device {
17+
pub fn new(instance: &crate::Instance, device: &crate::Device) -> Self {
1918
let handle = device.handle();
2019
let fp = vk::ext_calibrated_timestamps::DeviceFn::load(|name| unsafe {
2120
mem::transmute(instance.get_device_proc_addr(handle, name.as_ptr()))
@@ -59,12 +58,12 @@ impl CalibratedTimestampsDevice {
5958
/// High-level instance function wrapper for
6059
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_calibrated_timestamps.html>
6160
#[derive(Clone)]
62-
pub struct CalibratedTimestampsInstance {
61+
pub struct Instance {
6362
fp: vk::ext_calibrated_timestamps::InstanceFn,
6463
}
6564

66-
impl CalibratedTimestampsInstance {
67-
pub fn new(entry: &Entry, instance: &Instance) -> Self {
65+
impl Instance {
66+
pub fn new(entry: &crate::Entry, instance: &crate::Instance) -> Self {
6867
let handle = instance.handle();
6968
let fp = vk::ext_calibrated_timestamps::InstanceFn::load(|name| unsafe {
7069
mem::transmute(entry.get_instance_proc_addr(handle, name.as_ptr()))

0 commit comments

Comments
 (0)