Skip to content

Commit

Permalink
Inline predule module contents into their parent modules
Browse files Browse the repository at this point in the history
We've never used `prelude` in a sensible way, both modules inside
the crate root and `vk` namespace have always abused these modules to
store a random combination of private utilities next to a few extra
hand-written type/trait definitions and implementations.

Neither of these need to glob-imported by users to make easy use of
`ash` functionality besides perhaps ensuring traits like `Handle` and
`TaggedStructure` are in scope.  Their glob imports were only useful
to `ash` itself, and even then the `vk::prelude` was already fully
glob-reexported in `vk`.

Besides inlining its contents, I've shuffled some private helpers like
`debug_flags()` closer to where they are being used.
  • Loading branch information
MarijnS95 committed Dec 7, 2024
1 parent 986d7bb commit 4f41c00
Show file tree
Hide file tree
Showing 77 changed files with 378 additions and 361 deletions.
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
The expected length of this array can be queried with the respective `*_len()` variant of these functions.
- `push_next()` has been renamed to `extend()` and marked as `unsafe`. Users are encouraged to call `push()` for singular structs instead. (#909)

### Removed

- Removed `ash::prelude` and `ash::vk::prelude` in favour of capturing all contents directly in their parent module. (#972)

## [0.38.0] - 2024-04-01

With over two years of collecting breaking changes (since the `0.37.0` release in March 2022), April 2024 marks the next breaking release of `ash`. This release introduces an overhaul of all Vulkan structures, restructures modules around extensions, and separates extension wrappers between `Instance` and `Device` functions. The crate contains all bindings defined by the latest `1.3.281` Vulkan specification, and many old and new extensions have received a hand-written extension wrapper. For a full overview of all individual changes, see the list at the end of this post.
Expand Down
3 changes: 1 addition & 2 deletions ash-window/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ use std::os::raw::c_char;
use ash::{
ext::metal_surface,
khr::{android_surface, surface, wayland_surface, win32_surface, xcb_surface, xlib_surface},
prelude::*,
vk, Entry, Instance,
vk, Entry, Instance, VkResult,
};
use raw_window_handle::{RawDisplayHandle, RawWindowHandle};

Expand Down
3 changes: 2 additions & 1 deletion ash/src/device.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#![allow(clippy::trivially_copy_pass_by_ref)]
use crate::prelude::*;
use crate::read_into_uninitialized_vector;
use crate::vk;
use crate::RawPtr;
use crate::VkResult;
use alloc::vec::Vec;
use core::ffi;
use core::mem;
Expand Down
3 changes: 2 additions & 1 deletion ash/src/entry.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use crate::instance::Instance;
#[cfg(doc)]
use crate::khr;
use crate::prelude::*;
use crate::read_into_uninitialized_vector;
use crate::vk;
use crate::RawPtr;
use crate::VkResult;
use alloc::vec::Vec;
use core::ffi;
use core::fmt;
Expand Down
3 changes: 2 additions & 1 deletion ash/src/extensions/amd/shader_info.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
//! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_AMD_shader_info.html>
use crate::prelude::*;
use crate::read_into_uninitialized_vector;
use crate::vk;
use crate::VkResult;
use alloc::vec::Vec;
use core::mem;
use core::mem::size_of_val; // TODO: Remove when bumping MSRV to 1.80
Expand Down
2 changes: 1 addition & 1 deletion ash/src/extensions/amdx/shader_enqueue.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_AMDX_shader_enqueue.html>
use crate::prelude::*;
use crate::vk;
use crate::RawPtr;
use crate::VkResult;
use alloc::vec::Vec;
use core::mem;

Expand Down
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_ANDROID_external_memory_android_hardware_buffer.html>
use crate::prelude::*;
use crate::vk;
use crate::VkResult;
use core::mem;

impl crate::android::external_memory_android_hardware_buffer::Device {
Expand Down
2 changes: 1 addition & 1 deletion ash/src/extensions/ext/acquire_drm_display.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_acquire_drm_display.html>
use crate::prelude::*;
use crate::vk;
use crate::VkResult;
use core::mem;

impl crate::ext::acquire_drm_display::Instance {
Expand Down
3 changes: 2 additions & 1 deletion ash/src/extensions/ext/calibrated_timestamps.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
//! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_calibrated_timestamps.html>
use crate::prelude::*;
use crate::read_into_uninitialized_vector;
use crate::vk;
use crate::VkResult;
use alloc::vec::Vec;
use core::mem;

Expand Down
2 changes: 1 addition & 1 deletion ash/src/extensions/ext/debug_marker.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_debug_marker.html>
use crate::prelude::*;
use crate::vk;
use crate::VkResult;

impl crate::ext::debug_marker::Device {
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkDebugMarkerSetObjectNameEXT.html>
Expand Down
2 changes: 1 addition & 1 deletion ash/src/extensions/ext/debug_report.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_debug_report.html>
use crate::prelude::*;
use crate::vk;
use crate::RawPtr;
use crate::VkResult;
use core::mem;

impl crate::ext::debug_report::Instance {
Expand Down
2 changes: 1 addition & 1 deletion ash/src/extensions/ext/debug_utils.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_debug_utils.html>
use crate::prelude::*;
use crate::vk;
use crate::RawPtr;
use crate::VkResult;
use core::mem;

impl crate::ext::debug_utils::Device {
Expand Down
2 changes: 1 addition & 1 deletion ash/src/extensions/ext/descriptor_buffer.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_descriptor_buffer.html>
use crate::prelude::*;
use crate::vk;
use crate::VkResult;
use core::mem;

impl crate::ext::descriptor_buffer::Device {
Expand Down
3 changes: 2 additions & 1 deletion ash/src/extensions/ext/full_screen_exclusive.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
//! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_full_screen_exclusive.html>
use crate::prelude::*;
use crate::read_into_uninitialized_vector;
use crate::vk;
use crate::VkResult;
use alloc::vec::Vec;
use core::mem;

Expand Down
2 changes: 1 addition & 1 deletion ash/src/extensions/ext/headless_surface.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_headless_surface.html>
use crate::prelude::*;
use crate::vk;
use crate::RawPtr;
use crate::VkResult;
use core::mem;

impl crate::ext::headless_surface::Instance {
Expand Down
2 changes: 1 addition & 1 deletion 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>
use crate::prelude::*;
use crate::vk;
use crate::VkResult;
#[cfg(doc)]
use crate::{ext, khr};

Expand Down
2 changes: 1 addition & 1 deletion ash/src/extensions/ext/image_drm_format_modifier.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_drm_format_modifier.html>
use crate::prelude::*;
use crate::vk;
use crate::VkResult;

impl crate::ext::image_drm_format_modifier::Device {
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetImageDrmFormatModifierPropertiesEXT.html>
Expand Down
2 changes: 1 addition & 1 deletion ash/src/extensions/ext/metal_surface.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_metal_surface.html>
use crate::prelude::*;
use crate::vk;
use crate::RawPtr;
use crate::VkResult;
use core::mem;

impl crate::ext::metal_surface::Instance {
Expand Down
2 changes: 1 addition & 1 deletion ash/src/extensions/ext/pipeline_properties.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_pipeline_properties.html>
use crate::prelude::*;
use crate::vk;
use crate::VkResult;

impl crate::ext::pipeline_properties::Device {
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetPipelinePropertiesEXT.html>
Expand Down
2 changes: 1 addition & 1 deletion ash/src/extensions/ext/private_data.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_private_data.html>
use crate::prelude::*;
use crate::vk;
use crate::RawPtr;
use crate::VkResult;
use core::mem;

impl crate::ext::private_data::Device {
Expand Down
3 changes: 2 additions & 1 deletion ash/src/extensions/ext/shader_object.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
//! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_shader_object.html>
use crate::prelude::*;
use crate::read_into_uninitialized_vector;
use crate::vk;
use crate::RawPtr;
use crate::VkResult;
use alloc::vec::Vec;
use core::ptr;

Expand Down
2 changes: 1 addition & 1 deletion ash/src/extensions/ext/swapchain_maintenance1.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_swapchain_maintenance1.html>
use crate::prelude::*;
use crate::vk;
use crate::VkResult;

impl crate::ext::swapchain_maintenance1::Device {
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkReleaseSwapchainImagesEXT.html>
Expand Down
2 changes: 1 addition & 1 deletion ash/src/extensions/ext/tooling_info.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_tooling_info.html>
use crate::prelude::*;
use crate::vk;
use crate::VkResult;
use core::mem;
use core::ptr;

Expand Down
3 changes: 2 additions & 1 deletion ash/src/extensions/google/display_timing.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
//! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_GOOGLE_display_timing.html>
use crate::prelude::*;
use crate::read_into_uninitialized_vector;
use crate::vk;
use crate::VkResult;
use alloc::vec::Vec;
use core::mem;

Expand Down
2 changes: 1 addition & 1 deletion ash/src/extensions/khr/acceleration_structure.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_acceleration_structure.html>
use crate::prelude::*;
use crate::vk;
use crate::RawPtr;
use crate::VkResult;
use alloc::vec::Vec;
use core::mem;

Expand Down
2 changes: 1 addition & 1 deletion ash/src/extensions/khr/android_surface.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_android_surface.html>
use crate::prelude::*;
use crate::vk;
use crate::RawPtr;
use crate::VkResult;
use core::mem;

impl crate::khr::android_surface::Instance {
Expand Down
3 changes: 2 additions & 1 deletion ash/src/extensions/khr/calibrated_timestamps.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
//! <https://registry.khronos.org//vulkan/specs/1.3-extensions/man/html/VK_KHR_calibrated_timestamps.html>
use crate::prelude::*;
use crate::read_into_uninitialized_vector;
use crate::vk;
use crate::VkResult;
use alloc::vec::Vec;
use core::mem;

Expand Down
2 changes: 1 addition & 1 deletion ash/src/extensions/khr/cooperative_matrix.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_cooperative_matrix.html>
use crate::prelude::*;
use crate::vk;
use crate::VkResult;
use core::mem;
use core::ptr;

Expand Down
2 changes: 1 addition & 1 deletion ash/src/extensions/khr/create_renderpass2.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_create_renderpass2.html>
use crate::prelude::*;
use crate::vk;
use crate::RawPtr;
use crate::VkResult;
use core::mem;

impl crate::khr::create_renderpass2::Device {
Expand Down
2 changes: 1 addition & 1 deletion ash/src/extensions/khr/deferred_host_operations.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_deferred_host_operations.html>
use crate::prelude::*;
use crate::vk;
use crate::RawPtr;
use crate::VkResult;
use core::mem;

impl crate::khr::deferred_host_operations::Device {
Expand Down
3 changes: 2 additions & 1 deletion ash/src/extensions/khr/device_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
#[cfg(doc)]
use crate::khr;
use crate::prelude::*;
use crate::read_into_uninitialized_vector;
use crate::vk;
use crate::VkResult;
use alloc::vec::Vec;
use core::mem;

Expand Down
2 changes: 1 addition & 1 deletion ash/src/extensions/khr/device_group_creation.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_creation.html>
use crate::prelude::*;
use crate::vk;
use crate::VkResult;
use core::mem;
use core::ptr;

Expand Down
3 changes: 2 additions & 1 deletion ash/src/extensions/khr/display.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
//! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_display.html>
use crate::prelude::*;
use crate::read_into_uninitialized_vector;
use crate::vk;
use crate::RawPtr;
use crate::VkResult;
use alloc::vec::Vec;
use core::mem;

Expand Down
2 changes: 1 addition & 1 deletion ash/src/extensions/khr/display_swapchain.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_display_swapchain.html>
use crate::prelude::*;
use crate::vk;
use crate::RawPtr;
use crate::VkResult;
use alloc::vec::Vec;

impl crate::khr::display_swapchain::Device {
Expand Down
2 changes: 1 addition & 1 deletion ash/src/extensions/khr/external_fence_fd.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_external_fence_fd.html>
use crate::prelude::*;
use crate::vk;
use crate::VkResult;
use core::mem;

impl crate::khr::external_fence_fd::Device {
Expand Down
2 changes: 1 addition & 1 deletion ash/src/extensions/khr/external_fence_win32.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_external_fence_win32.html>
use crate::prelude::*;
use crate::vk;
use crate::VkResult;
use core::mem;

impl crate::khr::external_fence_win32::Device {
Expand Down
2 changes: 1 addition & 1 deletion ash/src/extensions/khr/external_memory_fd.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_external_memory_fd.html>
use crate::prelude::*;
use crate::vk;
use crate::VkResult;
use core::mem;

impl crate::khr::external_memory_fd::Device {
Expand Down
2 changes: 1 addition & 1 deletion ash/src/extensions/khr/external_memory_win32.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_external_memory_win32.html>
use crate::prelude::*;
use crate::vk;
use crate::VkResult;
use core::mem;

impl crate::khr::external_memory_win32::Device {
Expand Down
2 changes: 1 addition & 1 deletion ash/src/extensions/khr/external_semaphore_fd.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_external_semaphore_fd.html>
use crate::prelude::*;
use crate::vk;
use crate::VkResult;
use core::mem;

impl crate::khr::external_semaphore_fd::Device {
Expand Down
2 changes: 1 addition & 1 deletion ash/src/extensions/khr/external_semaphore_win32.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_external_semaphore_win32.html>
use crate::prelude::*;
use crate::vk;
use crate::VkResult;
use core::mem;

impl crate::khr::external_semaphore_win32::Device {
Expand Down
2 changes: 1 addition & 1 deletion ash/src/extensions/khr/get_display_properties2.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_get_display_properties2.html>
use crate::prelude::*;
use crate::vk;
use crate::VkResult;
use core::mem;
use core::ptr;

Expand Down
Loading

0 comments on commit 4f41c00

Please sign in to comment.