Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ members = [
"generator",
"generator-rewrite",
]

# [patch.crates-io]
# # https://github.com/krolli/vk-parse/pull/36
# vk-parse = { git = "https://github.com/krolli/vk-parse", rev = "dfe8863" }
3 changes: 2 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Added `push()` method to all root structs to insert a single extension-struct in the pointer chain. (#909)
- Update Vulkan-Headers to 1.3.296 (#910)
- Update Vulkan-Headers to 1.4.318 (#910, #951)
- Added `VK_KHR_get_display_properties2` instance extension (#932)
- Added `VK_EXT_metal_objects` device extension (#942)
- Added `VK_AMD_anti_lag` device extension (#943)
- Added `VK_KHR_video_queue`, `VK_KHR_video_encode_queue`, and `VK_KHR_video_decode_queue` device extensions (#965)
- Added `VK_OHOS_surface` instance extension (#1016)

### Changed

Expand Down
2 changes: 1 addition & 1 deletion ash-window/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ rust-version = "1.69.0"

[dependencies]
ash = { path = "../ash", version = "0.38", default-features = false, features = ["std"] }
raw-window-handle = "0.6"
raw-window-handle = "0.6.2"

[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies]
raw-window-metal = "0.4"
Expand Down
2 changes: 2 additions & 0 deletions ash-window/Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Changelog

- Added support for `VK_OHOS_surface` (#1016)

## [0.13.0] - 2024-03-31

- Bumped MSRV from 1.59 to 1.69 for `winit 0.28` and `raw-window-handle 0.5.1`, and `CStr::from_bytes_until_nul`. (#709, #716, #746)
Expand Down
14 changes: 14 additions & 0 deletions ash-window/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +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},
ohos::surface as ohos_surface,
vk, Entry, Instance, VkResult,
};
use raw_window_handle::{RawDisplayHandle, RawWindowHandle};
Expand Down Expand Up @@ -94,6 +95,13 @@ pub unsafe fn create_surface(
surface_fn.create_android_surface(&surface_desc, allocation_callbacks)
}

(RawDisplayHandle::Ohos(_), RawWindowHandle::OhosNdk(window)) => {
let surface_desc =
vk::SurfaceCreateInfoOHOS::default().window(window.native_window.as_ptr());
let surface_fn = ohos_surface::Instance::new(entry, instance);
surface_fn.create_surface(&surface_desc, allocation_callbacks)
}

#[cfg(target_os = "macos")]
(RawDisplayHandle::AppKit(_), RawWindowHandle::AppKit(window)) => {
use raw_window_metal::{appkit, Layer};
Expand Down Expand Up @@ -165,6 +173,12 @@ pub fn enumerate_required_extensions(
&ANDROID_EXTS
}

RawDisplayHandle::Ohos(_) => {
const OHOS_EXTS: [*const c_char; 2] =
[surface::NAME.as_ptr(), ohos_surface::NAME.as_ptr()];
&OHOS_EXTS
}

RawDisplayHandle::AppKit(_) | RawDisplayHandle::UiKit(_) => {
const METAL_EXTS: [*const c_char; 2] =
[surface::NAME.as_ptr(), metal_surface::NAME.as_ptr()];
Expand Down
2 changes: 1 addition & 1 deletion ash/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ash"
version = "0.38.0+1.3.296"
version = "0.38.0+1.4.318"
authors = [
"Maik Klein <[email protected]>",
"Benjamin Saunders <[email protected]>",
Expand Down
19 changes: 19 additions & 0 deletions ash/src/extensions/amd/buffer_marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,23 @@ impl crate::amd::buffer_marker::Device {
marker,
)
}

/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdWriteBufferMarker2AMD.html>
#[inline]
pub unsafe fn cmd_write_buffer_marker2(
&self,
command_buffer: vk::CommandBuffer,
stage: vk::PipelineStageFlags2,
dst_buffer: vk::Buffer,
dst_offset: vk::DeviceSize,
marker: u32,
) {
(self.fp.cmd_write_buffer_marker2_amd)(
command_buffer,
stage,
dst_buffer,
dst_offset,
marker,
)
}
}
28 changes: 24 additions & 4 deletions ash/src/extensions/amdx/shader_enqueue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,16 @@ impl crate::amdx::shader_enqueue::Device {
pub unsafe fn cmd_initialize_graph_scratch_memory(
&self,
command_buffer: vk::CommandBuffer,
execution_graph: vk::Pipeline,
scratch: vk::DeviceAddress,
scratch_size: vk::DeviceSize,
) {
(self.fp.cmd_initialize_graph_scratch_memory_amdx)(command_buffer, scratch)
(self.fp.cmd_initialize_graph_scratch_memory_amdx)(
command_buffer,
execution_graph,
scratch,
scratch_size,
)
}

/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdDispatchGraphAMDX.html>
Expand All @@ -83,9 +90,10 @@ impl crate::amdx::shader_enqueue::Device {
&self,
command_buffer: vk::CommandBuffer,
scratch: vk::DeviceAddress,
scratch_size: vk::DeviceSize,
count_info: &vk::DispatchGraphCountInfoAMDX,
) {
(self.fp.cmd_dispatch_graph_amdx)(command_buffer, scratch, count_info)
(self.fp.cmd_dispatch_graph_amdx)(command_buffer, scratch, scratch_size, count_info)
}

/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdDispatchGraphIndirectAMDX.html>
Expand All @@ -94,9 +102,15 @@ impl crate::amdx::shader_enqueue::Device {
&self,
command_buffer: vk::CommandBuffer,
scratch: vk::DeviceAddress,
scratch_size: vk::DeviceSize,
count_info: &vk::DispatchGraphCountInfoAMDX,
) {
(self.fp.cmd_dispatch_graph_indirect_amdx)(command_buffer, scratch, count_info)
(self.fp.cmd_dispatch_graph_indirect_amdx)(
command_buffer,
scratch,
scratch_size,
count_info,
)
}

/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdDispatchGraphIndirectCountAMDX.html>
Expand All @@ -105,8 +119,14 @@ impl crate::amdx::shader_enqueue::Device {
&self,
command_buffer: vk::CommandBuffer,
scratch: vk::DeviceAddress,
scratch_size: vk::DeviceSize,
count_info: vk::DeviceAddress,
) {
(self.fp.cmd_dispatch_graph_indirect_count_amdx)(command_buffer, scratch, count_info)
(self.fp.cmd_dispatch_graph_indirect_count_amdx)(
command_buffer,
scratch,
scratch_size,
count_info,
)
}
}
1 change: 1 addition & 0 deletions ash/src/extensions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ pub mod khr;
pub mod mvk;
pub mod nn;
pub mod nv;
pub mod ohos;
23 changes: 23 additions & 0 deletions ash/src/extensions/nv/device_diagnostic_checkpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,27 @@ impl crate::nv::device_diagnostic_checkpoints::Device {
(self.fp.get_queue_checkpoint_data_nv)(queue, &mut count, out.as_mut_ptr());
assert_eq!(count as usize, out.len());
}

/// Retrieve the number of elements to pass to [`get_queue_checkpoint_data()`][Self::get_queue_checkpoint_data2()]
#[inline]
pub unsafe fn get_queue_checkpoint_data2_len(&self, queue: vk::Queue) -> usize {
let mut count = mem::MaybeUninit::uninit();
(self.fp.get_queue_checkpoint_data2_nv)(queue, count.as_mut_ptr(), ptr::null_mut());
count.assume_init() as usize
}

/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetQueueCheckpointData2NV.html>
///
/// Call [`get_queue_checkpoint_data2_len()`][Self::get_queue_checkpoint_data2_len()] to query the number of elements to pass to `out`.
/// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer.
#[inline]
pub unsafe fn get_queue_checkpoint_data2(
&self,
queue: vk::Queue,
out: &mut [vk::CheckpointData2NV<'_>],
) {
let mut count = out.len() as u32;
(self.fp.get_queue_checkpoint_data2_nv)(queue, &mut count, out.as_mut_ptr());
assert_eq!(count as usize, out.len());
}
}
1 change: 1 addition & 0 deletions ash/src/extensions/ohos/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod surface;
25 changes: 25 additions & 0 deletions ash/src/extensions/ohos/surface.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//! <https://docs.vulkan.org/refpages/latest/refpages/source/VK_OHOS_surface.html>

use crate::vk;
use crate::RawPtr;
use crate::VkResult;
use core::mem;

impl crate::ohos::surface::Instance {
/// <https://docs.vulkan.org/refpages/latest/refpages/source/vkCreateSurfaceOHOS.html>
#[inline]
pub unsafe fn create_surface(
&self,
create_info: &vk::SurfaceCreateInfoOHOS<'_>,
allocation_callbacks: Option<&vk::AllocationCallbacks>,
) -> VkResult<vk::SurfaceKHR> {
let mut surface = mem::MaybeUninit::uninit();
(self.fp.create_surface_ohos)(
self.handle,
create_info,
allocation_callbacks.to_raw_ptr(),
surface.as_mut_ptr(),
)
.assume_init_on_success(surface)
}
}
Loading
Loading