-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extensions/khr: add VK_KHR_video_queue
- Loading branch information
Showing
2 changed files
with
183 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,182 @@ | ||
//! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_video_queue.html> | ||
use crate::prelude::*; | ||
use crate::vk; | ||
use crate::RawPtr as _; | ||
use core::mem; | ||
|
||
impl crate::khr::video_queue::Device { | ||
#[inline] | ||
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkBindVideoSessionMemoryKHR.html> | ||
pub unsafe fn bind_video_session_memory( | ||
&self, | ||
video_session: vk::VideoSessionKHR, | ||
bind_session_memory_infos: &[vk::BindVideoSessionMemoryInfoKHR<'_>], | ||
) -> VkResult<()> { | ||
(self.fp.bind_video_session_memory_khr)( | ||
self.handle, | ||
video_session, | ||
bind_session_memory_infos.len() as u32, | ||
bind_session_memory_infos.as_ptr(), | ||
) | ||
.result() | ||
} | ||
|
||
#[inline] | ||
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdBeginVideoCodingKHR.html> | ||
pub unsafe fn cmd_begin_video_coding( | ||
&self, | ||
command_buffer: vk::CommandBuffer, | ||
begin_info: &vk::VideoBeginCodingInfoKHR<'_>, | ||
) { | ||
(self.fp.cmd_begin_video_coding_khr)(command_buffer, begin_info); | ||
} | ||
|
||
#[inline] | ||
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdControlVideoCodingKHR.html> | ||
pub unsafe fn cmd_control_video_coding( | ||
&self, | ||
command_buffer: vk::CommandBuffer, | ||
coding_control_info: &vk::VideoCodingControlInfoKHR<'_>, | ||
) { | ||
(self.fp.cmd_control_video_coding_khr)(command_buffer, coding_control_info); | ||
} | ||
|
||
#[inline] | ||
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdEndVideoCodingKHR.html> | ||
pub unsafe fn cmd_end_video_coding( | ||
&self, | ||
command_buffer: vk::CommandBuffer, | ||
end_coding_info: &vk::VideoEndCodingInfoKHR<'_>, | ||
) { | ||
(self.fp.cmd_end_video_coding_khr)(command_buffer, end_coding_info); | ||
} | ||
|
||
#[inline] | ||
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCreateVideoSessionKHR.html> | ||
pub unsafe fn create_video_session( | ||
&self, | ||
create_info: &vk::VideoSessionCreateInfoKHR<'_>, | ||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>, | ||
) -> VkResult<vk::VideoSessionKHR> { | ||
let mut video_session = mem::zeroed(); | ||
(self.fp.create_video_session_khr)( | ||
self.handle, | ||
create_info, | ||
allocation_callbacks.as_raw_ptr(), | ||
&mut video_session, | ||
) | ||
.result_with_success(video_session) | ||
} | ||
|
||
#[inline] | ||
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCreateVideoSessionParametersKHR.html> | ||
pub unsafe fn create_video_session_parameters( | ||
&self, | ||
create_info: &vk::VideoSessionParametersCreateInfoKHR<'_>, | ||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>, | ||
) -> VkResult<vk::VideoSessionParametersKHR> { | ||
let mut video_session_parameters = mem::zeroed(); | ||
(self.fp.create_video_session_parameters_khr)( | ||
self.handle, | ||
create_info, | ||
allocation_callbacks.as_raw_ptr(), | ||
&mut video_session_parameters, | ||
) | ||
.result_with_success(video_session_parameters) | ||
} | ||
|
||
#[inline] | ||
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkDestroyVideoSessionKHR.html> | ||
pub unsafe fn destroy_video_session( | ||
&self, | ||
video_session: vk::VideoSessionKHR, | ||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>, | ||
) { | ||
(self.fp.destroy_video_session_khr)( | ||
self.handle, | ||
video_session, | ||
allocation_callbacks.as_raw_ptr(), | ||
); | ||
} | ||
|
||
#[inline] | ||
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkDestroyVideoSessionParametersKHR.html> | ||
pub unsafe fn destroy_video_session_parameters( | ||
&self, | ||
video_session_parameters: vk::VideoSessionParametersKHR, | ||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>, | ||
) { | ||
(self.fp.destroy_video_session_parameters_khr)( | ||
self.handle, | ||
video_session_parameters, | ||
allocation_callbacks.as_raw_ptr(), | ||
); | ||
} | ||
|
||
#[inline] | ||
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetVideoSessionMemoryRequirementsKHR.html> | ||
pub unsafe fn get_video_session_memory_requirements( | ||
&self, | ||
video_session: vk::VideoSessionKHR, | ||
) -> VkResult<Vec<vk::VideoSessionMemoryRequirementsKHR<'_>>> { | ||
read_into_defaulted_vector(|count, data| { | ||
(self.fp.get_video_session_memory_requirements_khr)( | ||
self.handle, | ||
video_session, | ||
count, | ||
data, | ||
) | ||
}) | ||
} | ||
|
||
#[inline] | ||
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkUpdateVideoSessionParametersKHR.html> | ||
pub unsafe fn update_video_session_parameters( | ||
&self, | ||
video_session_parameters: vk::VideoSessionParametersKHR, | ||
update_info: &vk::VideoSessionParametersUpdateInfoKHR<'_>, | ||
) -> VkResult<()> { | ||
(self.fp.update_video_session_parameters_khr)( | ||
self.handle, | ||
video_session_parameters, | ||
update_info, | ||
) | ||
.result() | ||
} | ||
} | ||
|
||
impl crate::khr::video_queue::Instance { | ||
#[inline] | ||
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceVideoCapabilitiesKHR.html> | ||
pub unsafe fn get_physical_device_video_capabilities( | ||
&self, | ||
physical_device: vk::PhysicalDevice, | ||
video_profile: &vk::VideoProfileInfoKHR<'_>, | ||
capabilities: &mut vk::VideoCapabilitiesKHR<'_>, | ||
) -> VkResult<()> { | ||
(self.fp.get_physical_device_video_capabilities_khr)( | ||
physical_device, | ||
video_profile, | ||
capabilities, | ||
) | ||
.result() | ||
} | ||
|
||
#[inline] | ||
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceVideoFormatPropertiesKHR.html> | ||
pub unsafe fn get_physical_device_video_format_properties( | ||
&self, | ||
physical_device: vk::PhysicalDevice, | ||
video_format_info: &vk::PhysicalDeviceVideoFormatInfoKHR<'_>, | ||
) -> VkResult<Vec<vk::VideoFormatPropertiesKHR<'_>>> { | ||
read_into_defaulted_vector(|count, data| { | ||
(self.fp.get_physical_device_video_format_properties_khr)( | ||
physical_device, | ||
video_format_info, | ||
count, | ||
data, | ||
) | ||
}) | ||
} | ||
} |