drawing_api/vulkan/
context_vulkan.rs

1use std::os::raw::{c_char, c_void};
2
3use crate::DrawingContext;
4
5use super::ContextVulkanInfo;
6
7pub trait ContextVulkan: DrawingContext + Send + Sync + Clone + 'static {
8    type VulkanSwapchain: crate::VulkanSwapchain;
9
10    /// Creates a Vulkan context.
11    unsafe fn new_vulkan<F>(
12        enable_validation: bool,
13        proc_address_callback: F,
14    ) -> Result<Self, &'static str>
15    where
16        F: FnMut(*mut c_void, *const c_char) -> *mut c_void;
17
18    /// Gets internal Vulkan handles managed by the given Vulkan context.
19    fn get_vulkan_info(&self) -> Result<ContextVulkanInfo, &'static str>;
20
21    /// Create a new Vulkan swapchain using a VkSurfaceKHR instance.
22    unsafe fn create_new_vulkan_swapchain(
23        &self,
24        vulkan_surface_khr: *mut c_void,
25    ) -> Result<Self::VulkanSwapchain, &'static str>;
26}