Skip to content

Commit

Permalink
extensions/khr: add VK_KHR_video_encode_queue
Browse files Browse the repository at this point in the history
  • Loading branch information
colinmarc committed Nov 30, 2024
1 parent 82e45e7 commit 38a0383
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
1 change: 1 addition & 0 deletions ash/src/extensions/khr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ pub mod swapchain;
pub mod synchronization2;
pub mod timeline_semaphore;
pub mod video_decode_queue;
pub mod video_encode_queue;
pub mod video_queue;
pub mod wayland_surface;
pub mod win32_surface;
Expand Down
55 changes: 55 additions & 0 deletions ash/src/extensions/khr/video_encode_queue.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_video_encode_queue.html>
use crate::prelude::*;
use crate::vk;

impl crate::khr::video_encode_queue::Device {
#[inline]
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdEncodeVideoKHR.html>
pub unsafe fn cmd_encode_video(
&self,
command_buffer: vk::CommandBuffer,
encode_info: &vk::VideoEncodeInfoKHR<'_>,
) {
(self.fp.cmd_encode_video_khr)(command_buffer, encode_info);
}

#[inline]
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetEncodedVideoSessionParametersKHR.html>
pub unsafe fn get_encoded_video_session_parameters(
&self,
session_parameters_info: &vk::VideoEncodeSessionParametersGetInfoKHR<'_>,
info: &mut vk::VideoEncodeSessionParametersFeedbackInfoKHR<'_>,
) -> VkResult<Vec<u8>> {
let ptr: *mut _ = info;
read_into_uninitialized_vector(|count, data: *mut u8| {
(self.fp.get_encoded_video_session_parameters_khr)(
self.handle,
session_parameters_info,
ptr,
count,
data.cast(),
)
})
}
}

impl crate::khr::video_encode_queue::Instance {
#[inline]
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR.html>
pub unsafe fn get_physical_device_video_encode_quality_level_properties(
&self,
physical_device: vk::PhysicalDevice,
quality_level_info: &vk::PhysicalDeviceVideoEncodeQualityLevelInfoKHR<'_>,
quality_level_properties: &mut vk::VideoEncodeQualityLevelPropertiesKHR<'_>,
) -> VkResult<()> {
(self
.fp
.get_physical_device_video_encode_quality_level_properties_khr)(
physical_device,
quality_level_info,
quality_level_properties,
)
.result()
}
}

0 comments on commit 38a0383

Please sign in to comment.