ash-window: Make enumerate_required_extensions
return &[*const c_char]
(#590)
* Constify generated extension names * Constify hand-written extension names * Make ash-window list extensions as &[*const c_char] This alters enumerate_required_extensions() to return the same type that is expected by vk::InstanceCreateInfoBuilder::enabled_extension_names(), allowing simple Vulkan apps to omit the boilerplate of mapping to an intermediate Vec<*const c_char>. Co-authored-by: Steve Wooster <s.f.m.wooster@gmail.com>
This commit is contained in:
parent
fde6f92c70
commit
1cd810653c
|
@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- Update Vulkan-Headers to 1.3.208 (#597)
|
- Update Vulkan-Headers to 1.3.208 (#597)
|
||||||
- Added `VK_EXT_headless_surface` instance extension (#589)
|
- Added `VK_EXT_headless_surface` instance extension (#589)
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Constified extension names (#590)
|
||||||
|
|
||||||
## [0.36.0] - 2022-02-21
|
## [0.36.0] - 2022-02-21
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
## [Unreleased] - ReleaseDate
|
## [Unreleased] - ReleaseDate
|
||||||
|
|
||||||
|
- Make `enumerate_required_extensions()` return `&[*const c_char]` instead of `Vec<&CStr>` to match `ash::vk::InstanceCreateInfo` (#590)
|
||||||
|
|
||||||
## [0.9.1] - 2022-02-21
|
## [0.9.1] - 2022-02-21
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
|
@ -17,14 +17,10 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let entry = ash::Entry::linked();
|
let entry = ash::Entry::linked();
|
||||||
let surface_extensions = ash_window::enumerate_required_extensions(&window)?;
|
let surface_extensions = ash_window::enumerate_required_extensions(&window)?;
|
||||||
let instance_extensions = surface_extensions
|
|
||||||
.iter()
|
|
||||||
.map(|ext| ext.as_ptr())
|
|
||||||
.collect::<Vec<_>>();
|
|
||||||
let app_desc = vk::ApplicationInfo::builder().api_version(vk::make_api_version(0, 1, 0, 0));
|
let app_desc = vk::ApplicationInfo::builder().api_version(vk::make_api_version(0, 1, 0, 0));
|
||||||
let instance_desc = vk::InstanceCreateInfo::builder()
|
let instance_desc = vk::InstanceCreateInfo::builder()
|
||||||
.application_info(&app_desc)
|
.application_info(&app_desc)
|
||||||
.enabled_extension_names(&instance_extensions);
|
.enabled_extension_names(surface_extensions);
|
||||||
|
|
||||||
let instance = entry.create_instance(&instance_desc, None)?;
|
let instance = entry.create_instance(&instance_desc, None)?;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
#![warn(trivial_casts, trivial_numeric_casts)]
|
#![warn(trivial_casts, trivial_numeric_casts)]
|
||||||
|
|
||||||
|
use std::os::raw::c_char;
|
||||||
|
|
||||||
use ash::{extensions::khr, prelude::*, vk, Entry, Instance};
|
use ash::{extensions::khr, prelude::*, vk, Entry, Instance};
|
||||||
use raw_window_handle::{HasRawWindowHandle, RawWindowHandle};
|
use raw_window_handle::{HasRawWindowHandle, RawWindowHandle};
|
||||||
use std::ffi::CStr;
|
|
||||||
|
|
||||||
#[cfg(any(target_os = "macos", target_os = "ios"))]
|
#[cfg(any(target_os = "macos", target_os = "ios"))]
|
||||||
use ash::extensions::ext; // portability extensions
|
use ash::extensions::ext; // portability extensions
|
||||||
|
@ -122,10 +123,16 @@ pub unsafe fn create_surface(
|
||||||
/// The returned extensions will include all extension dependencies.
|
/// The returned extensions will include all extension dependencies.
|
||||||
pub fn enumerate_required_extensions(
|
pub fn enumerate_required_extensions(
|
||||||
window_handle: &dyn HasRawWindowHandle,
|
window_handle: &dyn HasRawWindowHandle,
|
||||||
) -> VkResult<Vec<&'static CStr>> {
|
) -> VkResult<&'static [*const c_char]> {
|
||||||
let extensions = match window_handle.raw_window_handle() {
|
let extensions = match window_handle.raw_window_handle() {
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
RawWindowHandle::Windows(_) => vec![khr::Surface::name(), khr::Win32Surface::name()],
|
RawWindowHandle::Windows(_) => {
|
||||||
|
const WINDOWS_EXTS: [*const c_char; 2] = [
|
||||||
|
khr::Surface::name().as_ptr(),
|
||||||
|
khr::Win32Surface::name().as_ptr(),
|
||||||
|
];
|
||||||
|
&WINDOWS_EXTS
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
target_os = "linux",
|
target_os = "linux",
|
||||||
|
@ -134,7 +141,13 @@ pub fn enumerate_required_extensions(
|
||||||
target_os = "netbsd",
|
target_os = "netbsd",
|
||||||
target_os = "openbsd"
|
target_os = "openbsd"
|
||||||
))]
|
))]
|
||||||
RawWindowHandle::Wayland(_) => vec![khr::Surface::name(), khr::WaylandSurface::name()],
|
RawWindowHandle::Wayland(_) => {
|
||||||
|
const WAYLAND_EXTS: [*const c_char; 2] = [
|
||||||
|
khr::Surface::name().as_ptr(),
|
||||||
|
khr::WaylandSurface::name().as_ptr(),
|
||||||
|
];
|
||||||
|
&WAYLAND_EXTS
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
target_os = "linux",
|
target_os = "linux",
|
||||||
|
@ -143,7 +156,13 @@ pub fn enumerate_required_extensions(
|
||||||
target_os = "netbsd",
|
target_os = "netbsd",
|
||||||
target_os = "openbsd"
|
target_os = "openbsd"
|
||||||
))]
|
))]
|
||||||
RawWindowHandle::Xlib(_) => vec![khr::Surface::name(), khr::XlibSurface::name()],
|
RawWindowHandle::Xlib(_) => {
|
||||||
|
const XLIB_EXTS: [*const c_char; 2] = [
|
||||||
|
khr::Surface::name().as_ptr(),
|
||||||
|
khr::XlibSurface::name().as_ptr(),
|
||||||
|
];
|
||||||
|
&XLIB_EXTS
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
target_os = "linux",
|
target_os = "linux",
|
||||||
|
@ -152,16 +171,40 @@ pub fn enumerate_required_extensions(
|
||||||
target_os = "netbsd",
|
target_os = "netbsd",
|
||||||
target_os = "openbsd"
|
target_os = "openbsd"
|
||||||
))]
|
))]
|
||||||
RawWindowHandle::Xcb(_) => vec![khr::Surface::name(), khr::XcbSurface::name()],
|
RawWindowHandle::Xcb(_) => {
|
||||||
|
const XCB_EXTS: [*const c_char; 2] = [
|
||||||
|
khr::Surface::name().as_ptr(),
|
||||||
|
khr::XcbSurface::name().as_ptr(),
|
||||||
|
];
|
||||||
|
&XCB_EXTS
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(any(target_os = "android"))]
|
#[cfg(any(target_os = "android"))]
|
||||||
RawWindowHandle::Android(_) => vec![khr::Surface::name(), khr::AndroidSurface::name()],
|
RawWindowHandle::Android(_) => {
|
||||||
|
const ANDROID_EXTS: [*const c_char; 2] = [
|
||||||
|
khr::Surface::name().as_ptr(),
|
||||||
|
khr::AndroidSurface::name().as_ptr(),
|
||||||
|
];
|
||||||
|
&ANDROID_EXTS
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(any(target_os = "macos"))]
|
#[cfg(any(target_os = "macos"))]
|
||||||
RawWindowHandle::MacOS(_) => vec![khr::Surface::name(), ext::MetalSurface::name()],
|
RawWindowHandle::MacOS(_) => {
|
||||||
|
const MACOS_EXTS: [*const c_char; 2] = [
|
||||||
|
khr::Surface::name().as_ptr(),
|
||||||
|
ext::MetalSurface::name().as_ptr(),
|
||||||
|
];
|
||||||
|
&MACOS_EXTS
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(any(target_os = "ios"))]
|
#[cfg(any(target_os = "ios"))]
|
||||||
RawWindowHandle::IOS(_) => vec![khr::Surface::name(), ext::MetalSurface::name()],
|
RawWindowHandle::IOS(_) => {
|
||||||
|
const IOS_EXTS: [*const c_char; 2] = [
|
||||||
|
khr::Surface::name().as_ptr(),
|
||||||
|
ext::MetalSurface::name().as_ptr(),
|
||||||
|
];
|
||||||
|
&IOS_EXTS
|
||||||
|
}
|
||||||
|
|
||||||
_ => return Err(vk::Result::ERROR_EXTENSION_NOT_PRESENT),
|
_ => return Err(vk::Result::ERROR_EXTENSION_NOT_PRESENT),
|
||||||
};
|
};
|
||||||
|
|
|
@ -26,7 +26,7 @@ impl BufferDeviceAddress {
|
||||||
self.fp.get_buffer_device_address_ext(self.handle, info)
|
self.fp.get_buffer_device_address_ext(self.handle, info)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::ExtBufferDeviceAddressFn::name()
|
vk::ExtBufferDeviceAddressFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ impl CalibratedTimestamps {
|
||||||
.result_with_success((timestamps, max_deviation))
|
.result_with_success((timestamps, max_deviation))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::ExtCalibratedTimestampsFn::name()
|
vk::ExtCalibratedTimestampsFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ impl DebugMarker {
|
||||||
.cmd_debug_marker_insert_ext(command_buffer, marker_info);
|
.cmd_debug_marker_insert_ext(command_buffer, marker_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::ExtDebugMarkerFn::name()
|
vk::ExtDebugMarkerFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ impl DebugReport {
|
||||||
.result_with_success(debug_cb)
|
.result_with_success(debug_cb)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::ExtDebugReportFn::name()
|
vk::ExtDebugReportFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ impl DebugUtils {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::ExtDebugUtilsFn::name()
|
vk::ExtDebugUtilsFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -175,7 +175,7 @@ impl ExtendedDynamicState {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::ExtExtendedDynamicStateFn::name()
|
vk::ExtExtendedDynamicStateFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ impl ExtendedDynamicState2 {
|
||||||
.cmd_set_primitive_restart_enable_ext(command_buffer, primitive_restart_enable.into())
|
.cmd_set_primitive_restart_enable_ext(command_buffer, primitive_restart_enable.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::ExtExtendedDynamicState2Fn::name()
|
vk::ExtExtendedDynamicState2Fn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ impl FullScreenExclusive {
|
||||||
.result_with_success(present_modes)
|
.result_with_success(present_modes)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::ExtFullScreenExclusiveFn::name()
|
vk::ExtFullScreenExclusiveFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ impl HeadlessSurface {
|
||||||
.result_with_success(surface)
|
.result_with_success(surface)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::ExtHeadlessSurfaceFn::name()
|
vk::ExtHeadlessSurfaceFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ impl MetalSurface {
|
||||||
.result_with_success(surface)
|
.result_with_success(surface)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::ExtMetalSurfaceFn::name()
|
vk::ExtMetalSurfaceFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ impl PhysicalDeviceDrm {
|
||||||
props_drm
|
props_drm
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::ExtPhysicalDeviceDrmFn::name()
|
vk::ExtPhysicalDeviceDrmFn::name()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ impl PrivateData {
|
||||||
data
|
data
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::ExtPrivateDataFn::name()
|
vk::ExtPrivateDataFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ impl ToolingInfo {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::ExtToolingInfoFn::name()
|
vk::ExtToolingInfoFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -299,7 +299,7 @@ impl AccelerationStructure {
|
||||||
size_info
|
size_info
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::KhrAccelerationStructureFn::name()
|
vk::KhrAccelerationStructureFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ impl AndroidSurface {
|
||||||
.result_with_success(surface)
|
.result_with_success(surface)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::KhrAndroidSurfaceFn::name()
|
vk::KhrAndroidSurfaceFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ impl BufferDeviceAddress {
|
||||||
.get_device_memory_opaque_capture_address_khr(self.handle, info)
|
.get_device_memory_opaque_capture_address_khr(self.handle, info)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::KhrBufferDeviceAddressFn::name()
|
vk::KhrBufferDeviceAddressFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ impl CopyCommands2 {
|
||||||
.cmd_resolve_image2_khr(command_buffer, resolve_image_info)
|
.cmd_resolve_image2_khr(command_buffer, resolve_image_info)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::KhrCopyCommands2Fn::name()
|
vk::KhrCopyCommands2Fn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ impl CreateRenderPass2 {
|
||||||
.cmd_end_render_pass2_khr(command_buffer, subpass_end_info);
|
.cmd_end_render_pass2_khr(command_buffer, subpass_end_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::KhrCreateRenderpass2Fn::name()
|
vk::KhrCreateRenderpass2Fn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ impl DeferredHostOperations {
|
||||||
.result()
|
.result()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::KhrDeferredHostOperationsFn::name()
|
vk::KhrDeferredHostOperationsFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,7 @@ impl Display {
|
||||||
.result_with_success(surface.assume_init())
|
.result_with_success(surface.assume_init())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::KhrDisplayFn::name()
|
vk::KhrDisplayFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ impl DisplaySwapchain {
|
||||||
err_code.result_with_success(swapchains)
|
err_code.result_with_success(swapchains)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::KhrDisplaySwapchainFn::name()
|
vk::KhrDisplaySwapchainFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ impl DrawIndirectCount {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::KhrDrawIndirectCountFn::name()
|
vk::KhrDrawIndirectCountFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ impl DynamicRendering {
|
||||||
self.fp.cmd_end_rendering_khr(command_buffer)
|
self.fp.cmd_end_rendering_khr(command_buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::KhrDynamicRenderingFn::name()
|
vk::KhrDynamicRenderingFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ impl ExternalFenceFd {
|
||||||
.result_with_success(fd)
|
.result_with_success(fd)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::KhrExternalFenceFdFn::name()
|
vk::KhrExternalFenceFdFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ impl ExternalFenceWin32 {
|
||||||
.result_with_success(handle)
|
.result_with_success(handle)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::KhrExternalFenceWin32Fn::name()
|
vk::KhrExternalFenceWin32Fn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ impl ExternalMemoryFd {
|
||||||
.result_with_success(memory_fd_properties)
|
.result_with_success(memory_fd_properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::KhrExternalMemoryFdFn::name()
|
vk::KhrExternalMemoryFdFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ impl ExternalMemoryWin32 {
|
||||||
.result_with_success(memory_win32_handle_properties)
|
.result_with_success(memory_win32_handle_properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::KhrExternalMemoryWin32Fn::name()
|
vk::KhrExternalMemoryWin32Fn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ impl ExternalSemaphoreFd {
|
||||||
.result_with_success(fd)
|
.result_with_success(fd)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::KhrExternalSemaphoreFdFn::name()
|
vk::KhrExternalSemaphoreFdFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ impl ExternalSemaphoreWin32 {
|
||||||
.result_with_success(handle)
|
.result_with_success(handle)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::KhrExternalSemaphoreWin32Fn::name()
|
vk::KhrExternalSemaphoreWin32Fn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ impl GetMemoryRequirements2 {
|
||||||
assert_eq!(count as usize, out.len());
|
assert_eq!(count as usize, out.len());
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::KhrGetMemoryRequirements2Fn::name()
|
vk::KhrGetMemoryRequirements2Fn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,7 @@ impl GetPhysicalDeviceProperties2 {
|
||||||
assert_eq!(count as usize, out.len());
|
assert_eq!(count as usize, out.len());
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::KhrGetPhysicalDeviceProperties2Fn::name()
|
vk::KhrGetPhysicalDeviceProperties2Fn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ impl GetSurfaceCapabilities2 {
|
||||||
err_code.result()
|
err_code.result()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::KhrGetSurfaceCapabilities2Fn::name()
|
vk::KhrGetSurfaceCapabilities2Fn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ impl Maintenance1 {
|
||||||
.trim_command_pool_khr(self.handle, command_pool, flags);
|
.trim_command_pool_khr(self.handle, command_pool, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::KhrMaintenance1Fn::name()
|
vk::KhrMaintenance1Fn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ impl Maintenance3 {
|
||||||
.get_descriptor_set_layout_support_khr(self.handle, create_info, out);
|
.get_descriptor_set_layout_support_khr(self.handle, create_info, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::KhrMaintenance3Fn::name()
|
vk::KhrMaintenance3Fn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ impl Maintenance4 {
|
||||||
assert_eq!(count as usize, out.len());
|
assert_eq!(count as usize, out.len());
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::KhrMaintenance4Fn::name()
|
vk::KhrMaintenance4Fn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ impl PipelineExecutableProperties {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::KhrPipelineExecutablePropertiesFn::name()
|
vk::KhrPipelineExecutablePropertiesFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ impl PresentWait {
|
||||||
.result()
|
.result()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::KhrPresentWaitFn::name()
|
vk::KhrPresentWaitFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ impl PushDescriptor {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::KhrPushDescriptorFn::name()
|
vk::KhrPushDescriptorFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -166,7 +166,7 @@ impl RayTracingPipeline {
|
||||||
.cmd_set_ray_tracing_pipeline_stack_size_khr(command_buffer, pipeline_stack_size);
|
.cmd_set_ray_tracing_pipeline_stack_size_khr(command_buffer, pipeline_stack_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::KhrRayTracingPipelineFn::name()
|
vk::KhrRayTracingPipelineFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ impl Surface {
|
||||||
.destroy_surface_khr(self.handle, surface, allocation_callbacks.as_raw_ptr());
|
.destroy_surface_khr(self.handle, surface, allocation_callbacks.as_raw_ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::KhrSurfaceFn::name()
|
vk::KhrSurfaceFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ impl Swapchain {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::KhrSwapchainFn::name()
|
vk::KhrSwapchainFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ impl Synchronization2 {
|
||||||
.result()
|
.result()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::KhrSynchronization2Fn::name()
|
vk::KhrSynchronization2Fn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ impl TimelineSemaphore {
|
||||||
.result()
|
.result()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::KhrTimelineSemaphoreFn::name()
|
vk::KhrTimelineSemaphoreFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ impl WaylandSurface {
|
||||||
b > 0
|
b > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::KhrWaylandSurfaceFn::name()
|
vk::KhrWaylandSurfaceFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ impl Win32Surface {
|
||||||
b > 0
|
b > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::KhrWin32SurfaceFn::name()
|
vk::KhrWin32SurfaceFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ impl XcbSurface {
|
||||||
b > 0
|
b > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::KhrXcbSurfaceFn::name()
|
vk::KhrXcbSurfaceFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ impl XlibSurface {
|
||||||
b > 0
|
b > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::KhrXlibSurfaceFn::name()
|
vk::KhrXlibSurfaceFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ impl IOSSurface {
|
||||||
.result_with_success(surface)
|
.result_with_success(surface)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::MvkIosSurfaceFn::name()
|
vk::MvkIosSurfaceFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ impl MacOSSurface {
|
||||||
.result_with_success(surface)
|
.result_with_success(surface)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::MvkMacosSurfaceFn::name()
|
vk::MvkMacosSurfaceFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ impl ViSurface {
|
||||||
.result_with_success(surface)
|
.result_with_success(surface)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::NnViSurfaceFn::name()
|
vk::NnViSurfaceFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ impl DeviceDiagnosticCheckpoints {
|
||||||
checkpoint_data
|
checkpoint_data
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::NvDeviceDiagnosticCheckpointsFn::name()
|
vk::NvDeviceDiagnosticCheckpointsFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ impl MeshShader {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::NvMeshShaderFn::name()
|
vk::NvMeshShaderFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -249,7 +249,7 @@ impl RayTracing {
|
||||||
.result()
|
.result()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name() -> &'static CStr {
|
pub const fn name() -> &'static CStr {
|
||||||
vk::NvRayTracingFn::name()
|
vk::NvRayTracingFn::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -228,12 +228,10 @@ impl ExampleBase {
|
||||||
.map(|raw_name| raw_name.as_ptr())
|
.map(|raw_name| raw_name.as_ptr())
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let surface_extensions = ash_window::enumerate_required_extensions(&window).unwrap();
|
let mut extension_names = ash_window::enumerate_required_extensions(&window)
|
||||||
let mut extension_names_raw = surface_extensions
|
.unwrap()
|
||||||
.iter()
|
.to_vec();
|
||||||
.map(|ext| ext.as_ptr())
|
extension_names.push(DebugUtils::name().as_ptr());
|
||||||
.collect::<Vec<_>>();
|
|
||||||
extension_names_raw.push(DebugUtils::name().as_ptr());
|
|
||||||
|
|
||||||
let appinfo = vk::ApplicationInfo::builder()
|
let appinfo = vk::ApplicationInfo::builder()
|
||||||
.application_name(app_name)
|
.application_name(app_name)
|
||||||
|
@ -245,7 +243,7 @@ impl ExampleBase {
|
||||||
let create_info = vk::InstanceCreateInfo::builder()
|
let create_info = vk::InstanceCreateInfo::builder()
|
||||||
.application_info(&appinfo)
|
.application_info(&appinfo)
|
||||||
.enabled_layer_names(&layers_names_raw)
|
.enabled_layer_names(&layers_names_raw)
|
||||||
.enabled_extension_names(&extension_names_raw);
|
.enabled_extension_names(&extension_names);
|
||||||
|
|
||||||
let instance: Instance = entry
|
let instance: Instance = entry
|
||||||
.create_instance(&create_info, None)
|
.create_instance(&create_info, None)
|
||||||
|
|
|
@ -1037,7 +1037,7 @@ pub fn generate_extension_commands<'a>(
|
||||||
let byte_name_ident = Literal::byte_string(format!("{}\0", extension_name).as_bytes());
|
let byte_name_ident = Literal::byte_string(format!("{}\0", extension_name).as_bytes());
|
||||||
let extension_cstr = quote! {
|
let extension_cstr = quote! {
|
||||||
impl #ident {
|
impl #ident {
|
||||||
pub fn name() -> &'static ::std::ffi::CStr {
|
pub const fn name() -> &'static ::std::ffi::CStr {
|
||||||
unsafe { ::std::ffi::CStr::from_bytes_with_nul_unchecked(#byte_name_ident) }
|
unsafe { ::std::ffi::CStr::from_bytes_with_nul_unchecked(#byte_name_ident) }
|
||||||
}
|
}
|
||||||
#spec_version
|
#spec_version
|
||||||
|
|
Loading…
Reference in a new issue