Skip to content

Commit

Permalink
fixup! generator: Separate Fn struct
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralith committed Mar 17, 2024
1 parent 05d0cf0 commit f06c0c7
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 21 deletions.
8 changes: 4 additions & 4 deletions ash-examples/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use std::os::raw::c_char;

#[cfg(any(target_os = "macos", target_os = "ios"))]
use ash::vk::{
KhrGetPhysicalDeviceProperties2Fn, KhrPortabilityEnumerationFn, KhrPortabilitySubsetFn,
khr_get_physical_device_properties2, khr_portability_enumeration, khr_portability_subset,
};

use winit::{
Expand Down Expand Up @@ -238,9 +238,9 @@ impl ExampleBase {

#[cfg(any(target_os = "macos", target_os = "ios"))]
{
extension_names.push(KhrPortabilityEnumerationFn::NAME.as_ptr());
extension_names.push(khr_portability_enumeration::NAME.as_ptr());
// Enabling this extension is a requirement when using `VK_KHR_portability_subset`
extension_names.push(KhrGetPhysicalDeviceProperties2Fn::NAME.as_ptr());
extension_names.push(khr_get_physical_device_properties2::NAME.as_ptr());
}

let appinfo = vk::ApplicationInfo::default()
Expand Down Expand Up @@ -324,7 +324,7 @@ impl ExampleBase {
let device_extension_names_raw = [
swapchain::NAME.as_ptr(),
#[cfg(any(target_os = "macos", target_os = "ios"))]
KhrPortabilitySubsetFn::NAME.as_ptr(),
khr_portability_subset::NAME.as_ptr(),
];
let features = vk::PhysicalDeviceFeatures {
shader_clip_distance: 1,
Expand Down
6 changes: 4 additions & 2 deletions ash-window/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

use std::os::raw::c_char;

#[cfg(doc)]
use ash::extensions::khr;
use ash::{
extensions::{
ext::metal_surface,
Expand All @@ -23,9 +25,9 @@ use raw_window_handle::{RawDisplayHandle, RawWindowHandle};
///
/// There is a [parent/child relation] between [`Instance`] and [`Entry`], and the resulting
/// [`vk::SurfaceKHR`]. The application must not [destroy][Instance::destroy_instance()] these
/// parent objects before first [destroying][khr::Surface::destroy_surface()] the returned
/// parent objects before first [destroying][khr::surface::Instance::destroy_surface()] the returned
/// [`vk::SurfaceKHR`] child object. [`vk::SurfaceKHR`] does _not_ implement [drop][drop()]
/// semantics and can only be destroyed via [`destroy_surface()`][khr::Surface::destroy_surface()].
/// semantics and can only be destroyed via [`destroy_surface()`][khr::surface::Instance::destroy_surface()].
///
/// See the [`Entry::create_instance()`] documentation for more destruction ordering rules on
/// [`Instance`].
Expand Down
6 changes: 3 additions & 3 deletions ash/src/extensions/ext/host_image_copy.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_host_image_copy.html>
#[cfg(doc)]
use super::{super::khr::Maintenance5, ImageCompressionControl};
use super::{super::khr::maintenance5, image_compression_control};
use crate::prelude::*;
use crate::vk;
use std::ffi::CStr;
Expand Down Expand Up @@ -67,10 +67,10 @@ impl Device {

/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetImageSubresourceLayout2EXT.html>
///
/// Also available as [`Maintenance5::get_image_subresource_layout2()`]
/// Also available as [`maintenance5::Device::get_image_subresource_layout2()`]
/// when [`VK_KHR_maintenance5`] is enabled.
///
/// Also available as [`ImageCompressionControl::get_image_subresource_layout2()`]
/// Also available as [`image_compression_control::Device::get_image_subresource_layout2()`]
/// when [`VK_EXT_image_compression_control`] is enabled.
///
/// [`VK_KHR_maintenance5`]: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_maintenance5.html
Expand Down
6 changes: 3 additions & 3 deletions ash/src/extensions/ext/image_compression_control.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_image_compression_control.html>
#[cfg(doc)]
use super::{super::khr::Maintenance5, HostImageCopy};
use super::{super::khr::maintenance5, host_image_copy};
use crate::vk;
use std::ffi::CStr;
use std::mem;
Expand All @@ -25,10 +25,10 @@ impl Device {

/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetImageSubresourceLayout2EXT.html>
///
/// Also available as [`Maintenance5::get_image_subresource_layout2()`]
/// Also available as [`maintenance5::Device::get_image_subresource_layout2()`]
/// when [`VK_KHR_maintenance5`] is enabled.
///
/// Also available as [`HostImageCopy::get_image_subresource_layout2()`]
/// Also available as [`host_image_copy::Device::get_image_subresource_layout2()`]
/// when [`VK_EXT_host_image_copy`] is enabled.
///
/// [`VK_KHR_maintenance5`]: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_maintenance5.html
Expand Down
2 changes: 1 addition & 1 deletion ash/src/extensions/khr/device_group.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_device_group.html>
#[cfg(doc)]
use super::swapchain::{Device, Instance};
use super::swapchain;
use crate::prelude::*;
use crate::vk;
use std::ffi::CStr;
Expand Down
6 changes: 3 additions & 3 deletions ash/src/extensions/khr/maintenance5.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_maintenance5.html>
#[cfg(doc)]
use super::super::ext::{HostImageCopy, ImageCompressionControl};
use super::super::ext::{host_image_copy, image_compression_control};
use crate::vk;
use std::ffi::CStr;
use std::mem;
Expand Down Expand Up @@ -63,10 +63,10 @@ impl Device {

/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetImageSubresourceLayout2KHR.html>
///
/// Also available as [`HostImageCopy::get_image_subresource_layout2()`]
/// Also available as [`host_image_copy::Device::get_image_subresource_layout2()`]
/// when [`VK_EXT_host_image_copy`] is enabled.
///
/// Also available as [`ImageCompressionControl::get_image_subresource_layout2()`]
/// Also available as [`image_compression_control::Device::get_image_subresource_layout2()`]
/// when [`VK_EXT_image_compression_control`] is enabled.
///
/// [`VK_EXT_host_image_copy`]: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_host_image_copy.html
Expand Down
10 changes: 5 additions & 5 deletions ash/src/extensions/khr/swapchain.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_swapchain.html>
#[cfg(doc)]
use super::{DeviceGroupDevice, DeviceGroupInstance};
use super::device_group;
use crate::prelude::*;
use crate::vk;
use crate::RawPtr;
Expand Down Expand Up @@ -110,7 +110,7 @@ impl Device {

/// Only available since [Vulkan 1.1].
///
/// Also available as [`DeviceGroupDevice::get_device_group_present_capabilities()`]
/// Also available as [`device_group::Device::get_device_group_present_capabilities()`]
/// when [`VK_KHR_surface`] is enabled.
///
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetDeviceGroupPresentCapabilitiesKHR.html>
Expand All @@ -131,7 +131,7 @@ impl Device {

/// Only available since [Vulkan 1.1].
///
/// Also available as [`DeviceGroupDevice::get_device_group_surface_present_modes()`]
/// Also available as [`device_group::Device::get_device_group_surface_present_modes()`]
/// when [`VK_KHR_surface`] is enabled.
///
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetDeviceGroupSurfacePresentModesKHR.html>
Expand All @@ -156,7 +156,7 @@ impl Device {
///
/// Only available since [Vulkan 1.1].
///
/// Also available as [`DeviceGroupDevice::acquire_next_image2()`]
/// Also available as [`device_group::Device::acquire_next_image2()`]
/// when [`VK_KHR_swapchain`] is enabled.
///
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkAcquireNextImage2KHR.html>
Expand Down Expand Up @@ -205,7 +205,7 @@ impl Instance {

/// Only available since [Vulkan 1.1].
///
/// Also available as [`DeviceGroupInstance::get_physical_device_present_rectangles()`]
/// Also available as [`device_group::Instance::get_physical_device_present_rectangles()`]
/// when [`VK_KHR_surface`] is enabled.
///
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDevicePresentRectanglesKHR.html>
Expand Down
1 change: 1 addition & 0 deletions ash/src/vk/extensions.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![allow(unused_qualifications)]
#![allow(unused_imports)]
use crate::vk::aliases::*;
use crate::vk::bitflags::*;
use crate::vk::definitions::*;
Expand Down
1 change: 1 addition & 0 deletions generator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3269,6 +3269,7 @@ pub fn write_source_code<P: AsRef<Path>>(vk_headers_dir: &Path, src_dir: P) {

let extension_code = quote! {
#![allow(unused_qualifications)] // Because we do not know in what file the PFNs are defined
#![allow(unused_imports)] // for sometimes-dead `use super::*` from generate_extension_commands

use std::os::raw::*;
use crate::vk::platform_types::*;
Expand Down

0 comments on commit f06c0c7

Please sign in to comment.