Move all extensions out of the core
This commit is contained in:
parent
e455873d6a
commit
e8f2dcbfc8
|
@ -584,18 +584,6 @@ impl Device {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn queue_present_khr(&self,
|
|
||||||
queue: vk::Queue,
|
|
||||||
create_info: &vk::PresentInfoKHR)
|
|
||||||
-> VkResult<()> {
|
|
||||||
let err_code = self.device_fn
|
|
||||||
.queue_present_khr(queue, create_info);
|
|
||||||
match err_code {
|
|
||||||
vk::Result::Success => Ok(()),
|
|
||||||
_ => Err(err_code),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub unsafe fn queue_submit(&self,
|
pub unsafe fn queue_submit(&self,
|
||||||
queue: vk::Queue,
|
queue: vk::Queue,
|
||||||
submits: &[vk::SubmitInfo],
|
submits: &[vk::SubmitInfo],
|
||||||
|
|
46
src/extensions/mir_surface.rs
Normal file
46
src/extensions/mir_surface.rs
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
use prelude::*;
|
||||||
|
use std::mem;
|
||||||
|
use instance::Instance;
|
||||||
|
use entry::Entry;
|
||||||
|
use vk;
|
||||||
|
use std::ffi::CStr;
|
||||||
|
use ::RawPtr;
|
||||||
|
|
||||||
|
pub struct MirSurface {
|
||||||
|
handle: vk::Instance,
|
||||||
|
mir_surface_fn: vk::MirSurfaceFn,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl MirSurface {
|
||||||
|
pub fn new(entry: &Entry, instance: &Instance) -> Result<MirSurface, String> {
|
||||||
|
let surface_fn = vk::MirSurfaceFn::load(|name| {
|
||||||
|
unsafe {
|
||||||
|
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
|
||||||
|
}
|
||||||
|
})?;
|
||||||
|
Ok(MirSurface {
|
||||||
|
handle: instance.handle(),
|
||||||
|
mir_surface_fn: surface_fn,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn name() -> &'static CStr {
|
||||||
|
CStr::from_bytes_with_nul(b"VK_KHR_mir_surface\0").expect("Wrong extension string")
|
||||||
|
}
|
||||||
|
|
||||||
|
pub unsafe fn create_mir_surface_khr(&self,
|
||||||
|
create_info: &vk::MirSurfaceCreateInfoKHR,
|
||||||
|
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||||
|
-> VkResult<vk::SurfaceKHR> {
|
||||||
|
let mut surface = mem::uninitialized();
|
||||||
|
let err_code = self.mir_surface_fn
|
||||||
|
.create_mir_surface_khr(self.handle,
|
||||||
|
create_info,
|
||||||
|
allocation_callbacks.as_raw_ptr(),
|
||||||
|
&mut surface);
|
||||||
|
match err_code {
|
||||||
|
vk::Result::Success => Ok(surface),
|
||||||
|
_ => Err(err_code),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -70,6 +70,18 @@ impl Swapchain {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub unsafe fn queue_present_khr(&self,
|
||||||
|
queue: vk::Queue,
|
||||||
|
create_info: &vk::PresentInfoKHR)
|
||||||
|
-> VkResult<()> {
|
||||||
|
let err_code = self.swapchain_fn
|
||||||
|
.queue_present_khr(queue, create_info);
|
||||||
|
match err_code {
|
||||||
|
vk::Result::Success => Ok(()),
|
||||||
|
_ => Err(err_code),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn get_swapchain_images_khr(&self,
|
pub fn get_swapchain_images_khr(&self,
|
||||||
swapchain: vk::SwapchainKHR)
|
swapchain: vk::SwapchainKHR)
|
||||||
-> VkResult<Vec<vk::Image>> {
|
-> VkResult<Vec<vk::Image>> {
|
||||||
|
|
214
src/vk.rs
214
src/vk.rs
|
@ -3825,104 +3825,6 @@ vk_functions!{
|
||||||
p_properties: *mut SparseImageFormatProperties,
|
p_properties: *mut SparseImageFormatProperties,
|
||||||
) -> ();
|
) -> ();
|
||||||
|
|
||||||
"vkCreateXcbSurfaceKHR", create_xcb_surface_khr(
|
|
||||||
instance: Instance,
|
|
||||||
p_create_info: *const XcbSurfaceCreateInfoKHR,
|
|
||||||
p_allocator: *const AllocationCallbacks,
|
|
||||||
p_surface: *mut SurfaceKHR,
|
|
||||||
) -> Result;
|
|
||||||
|
|
||||||
"vkGetPhysicalDeviceXcbPresentationSupportKHR", get_physical_device_xcb_presentation_support_khr(
|
|
||||||
physical_device: PhysicalDevice,
|
|
||||||
queue_family_index: uint32_t,
|
|
||||||
connection: *mut xcb_connection_t,
|
|
||||||
visual_id: xcb_visualid_t,
|
|
||||||
) -> Bool32;
|
|
||||||
|
|
||||||
"vkCreateMirSurfaceKHR", create_mir_surface_khr(
|
|
||||||
instance: Instance,
|
|
||||||
p_create_info: *const MirSurfaceCreateInfoKHR,
|
|
||||||
p_allocator: *const AllocationCallbacks,
|
|
||||||
p_surface: *mut SurfaceKHR,
|
|
||||||
) -> Result;
|
|
||||||
|
|
||||||
"vkGetPhysicalDeviceMirPresentationSupportKHR", get_physical_device_mir_presentation_support_khr(
|
|
||||||
physical_device: PhysicalDevice,
|
|
||||||
queue_family_index: uint32_t,
|
|
||||||
connection: *mut MirConnection,
|
|
||||||
) -> Bool32;
|
|
||||||
|
|
||||||
"vkCreateAndroidSurfaceKHR", create_android_surface_khr(
|
|
||||||
instance: Instance,
|
|
||||||
p_create_info: *const AndroidSurfaceCreateInfoKHR,
|
|
||||||
p_allocator: *const AllocationCallbacks,
|
|
||||||
p_surface: *mut SurfaceKHR,
|
|
||||||
) -> Result;
|
|
||||||
|
|
||||||
"vkCreateWaylandSurfaceKHR", create_wayland_surface_khr(
|
|
||||||
instance: Instance,
|
|
||||||
p_create_info: *const WaylandSurfaceCreateInfoKHR,
|
|
||||||
p_allocator: *const AllocationCallbacks,
|
|
||||||
p_surface: *mut SurfaceKHR,
|
|
||||||
) -> Result;
|
|
||||||
|
|
||||||
"vkGetPhysicalDeviceWaylandPresentationSupportKHR", get_physical_device_wayland_presentation_support_khr(
|
|
||||||
physical_device: PhysicalDevice,
|
|
||||||
queue_family_index: uint32_t,
|
|
||||||
display: *mut wl_display,
|
|
||||||
) -> Bool32;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
"vkGetPhysicalDeviceDisplayPropertiesKHR", get_physical_device_display_properties_khr(
|
|
||||||
physical_device: PhysicalDevice,
|
|
||||||
p_property_count: *mut uint32_t,
|
|
||||||
p_properties: *mut DisplayPropertiesKHR,
|
|
||||||
) -> Result;
|
|
||||||
|
|
||||||
"vkGetPhysicalDeviceDisplayPlanePropertiesKHR", get_physical_device_display_plane_properties_khr(
|
|
||||||
physical_device: PhysicalDevice,
|
|
||||||
p_property_count: *mut uint32_t,
|
|
||||||
p_properties: *mut DisplayPlanePropertiesKHR,
|
|
||||||
) -> Result;
|
|
||||||
|
|
||||||
"vkGetDisplayPlaneSupportedDisplaysKHR", get_display_plane_supported_displays_khr(
|
|
||||||
physical_device: PhysicalDevice,
|
|
||||||
plane_index: uint32_t,
|
|
||||||
p_display_count: *mut uint32_t,
|
|
||||||
p_displays: *mut DisplayKHR,
|
|
||||||
) -> Result;
|
|
||||||
|
|
||||||
"vkGetDisplayModePropertiesKHR", get_display_mode_properties_khr(
|
|
||||||
physical_device: PhysicalDevice,
|
|
||||||
display: DisplayKHR,
|
|
||||||
p_property_count: *mut uint32_t,
|
|
||||||
p_properties: *mut DisplayModePropertiesKHR,
|
|
||||||
) -> Result;
|
|
||||||
|
|
||||||
"vkCreateDisplayModeKHR", create_display_mode_khr(
|
|
||||||
physical_device: PhysicalDevice,
|
|
||||||
display: DisplayKHR,
|
|
||||||
p_create_info: *const DisplayModeCreateInfoKHR,
|
|
||||||
p_allocator: *const AllocationCallbacks,
|
|
||||||
p_mode: *mut DisplayModeKHR,
|
|
||||||
) -> Result;
|
|
||||||
|
|
||||||
"vkGetDisplayPlaneCapabilitiesKHR", get_display_plane_capabilities_khr(
|
|
||||||
physical_device: PhysicalDevice,
|
|
||||||
mode: DisplayModeKHR,
|
|
||||||
plane_index: uint32_t,
|
|
||||||
p_capabilities: *mut DisplayPlaneCapabilitiesKHR,
|
|
||||||
) -> Result;
|
|
||||||
|
|
||||||
"vkCreateDisplayPlaneSurfaceKHR", create_display_plane_surface_khr(
|
|
||||||
instance: Instance,
|
|
||||||
p_create_info: *const DisplaySurfaceCreateInfoKHR,
|
|
||||||
p_allocator: *const AllocationCallbacks,
|
|
||||||
p_surface: *mut SurfaceKHR,
|
|
||||||
) -> Result;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vk_functions!{
|
vk_functions!{
|
||||||
|
@ -4754,11 +4656,6 @@ vk_functions!{
|
||||||
command_buffer_count: uint32_t,
|
command_buffer_count: uint32_t,
|
||||||
p_command_buffers: *const CommandBuffer,
|
p_command_buffers: *const CommandBuffer,
|
||||||
) -> ();
|
) -> ();
|
||||||
|
|
||||||
"vkQueuePresentKHR", queue_present_khr(
|
|
||||||
queue: Queue,
|
|
||||||
p_present_info: *const PresentInfoKHR,
|
|
||||||
) -> Result;
|
|
||||||
}
|
}
|
||||||
vk_functions!{
|
vk_functions!{
|
||||||
SwapchainFn,
|
SwapchainFn,
|
||||||
|
@ -4798,6 +4695,11 @@ vk_functions!{
|
||||||
fence: Fence,
|
fence: Fence,
|
||||||
p_image_index: *mut uint32_t,
|
p_image_index: *mut uint32_t,
|
||||||
) -> Result;
|
) -> Result;
|
||||||
|
|
||||||
|
"vkQueuePresentKHR", queue_present_khr(
|
||||||
|
queue: Queue,
|
||||||
|
p_present_info: *const PresentInfoKHR,
|
||||||
|
) -> Result;
|
||||||
}
|
}
|
||||||
vk_functions!{
|
vk_functions!{
|
||||||
SurfaceFn,
|
SurfaceFn,
|
||||||
|
@ -4890,4 +4792,110 @@ vk_functions!{
|
||||||
queue_family_index: uint32_t,
|
queue_family_index: uint32_t,
|
||||||
) -> Bool32;
|
) -> Bool32;
|
||||||
}
|
}
|
||||||
|
vk_functions!{
|
||||||
|
MirSurfaceFn,
|
||||||
|
"vkCreateMirSurfaceKHR", create_mir_surface_khr(
|
||||||
|
instance: Instance,
|
||||||
|
p_create_info: *const MirSurfaceCreateInfoKHR,
|
||||||
|
p_allocator: *const AllocationCallbacks,
|
||||||
|
p_surface: *mut SurfaceKHR,
|
||||||
|
) -> Result;
|
||||||
|
|
||||||
|
"vkGetPhysicalDeviceMirPresentationSupportKHR", get_physical_device_mir_presentation_support_khr(
|
||||||
|
physical_device: PhysicalDevice,
|
||||||
|
queue_family_index: uint32_t,
|
||||||
|
connection: *mut MirConnection,
|
||||||
|
) -> Bool32;
|
||||||
|
}
|
||||||
|
vk_functions!{
|
||||||
|
XcbSurfaceFn,
|
||||||
|
"vkCreateXcbSurfaceKHR", create_xcb_surface_khr(
|
||||||
|
instance: Instance,
|
||||||
|
p_create_info: *const XcbSurfaceCreateInfoKHR,
|
||||||
|
p_allocator: *const AllocationCallbacks,
|
||||||
|
p_surface: *mut SurfaceKHR,
|
||||||
|
) -> Result;
|
||||||
|
|
||||||
|
"vkGetPhysicalDeviceXcbPresentationSupportKHR", get_physical_device_xcb_presentation_support_khr(
|
||||||
|
physical_device: PhysicalDevice,
|
||||||
|
queue_family_index: uint32_t,
|
||||||
|
connection: *mut xcb_connection_t,
|
||||||
|
visual_id: xcb_visualid_t,
|
||||||
|
) -> Bool32;
|
||||||
|
}
|
||||||
|
vk_functions!{
|
||||||
|
AndroidSurfaceFn,
|
||||||
|
"vkCreateAndroidSurfaceKHR", create_android_surface_khr(
|
||||||
|
instance: Instance,
|
||||||
|
p_create_info: *const AndroidSurfaceCreateInfoKHR,
|
||||||
|
p_allocator: *const AllocationCallbacks,
|
||||||
|
p_surface: *mut SurfaceKHR,
|
||||||
|
) -> Result;
|
||||||
|
|
||||||
|
}
|
||||||
|
vk_functions!{
|
||||||
|
WaylandSurfaceFn,
|
||||||
|
"vkCreateWaylandSurfaceKHR", create_wayland_surface_khr(
|
||||||
|
instance: Instance,
|
||||||
|
p_create_info: *const WaylandSurfaceCreateInfoKHR,
|
||||||
|
p_allocator: *const AllocationCallbacks,
|
||||||
|
p_surface: *mut SurfaceKHR,
|
||||||
|
) -> Result;
|
||||||
|
|
||||||
|
"vkGetPhysicalDeviceWaylandPresentationSupportKHR", get_physical_device_wayland_presentation_support_khr(
|
||||||
|
physical_device: PhysicalDevice,
|
||||||
|
queue_family_index: uint32_t,
|
||||||
|
display: *mut wl_display,
|
||||||
|
) -> Bool32;
|
||||||
|
}
|
||||||
|
vk_functions!{
|
||||||
|
DisplayFn,
|
||||||
|
"vkGetPhysicalDeviceDisplayPropertiesKHR", get_physical_device_display_properties_khr(
|
||||||
|
physical_device: PhysicalDevice,
|
||||||
|
p_property_count: *mut uint32_t,
|
||||||
|
p_properties: *mut DisplayPropertiesKHR,
|
||||||
|
) -> Result;
|
||||||
|
|
||||||
|
"vkGetPhysicalDeviceDisplayPlanePropertiesKHR", get_physical_device_display_plane_properties_khr(
|
||||||
|
physical_device: PhysicalDevice,
|
||||||
|
p_property_count: *mut uint32_t,
|
||||||
|
p_properties: *mut DisplayPlanePropertiesKHR,
|
||||||
|
) -> Result;
|
||||||
|
|
||||||
|
"vkGetDisplayPlaneSupportedDisplaysKHR", get_display_plane_supported_displays_khr(
|
||||||
|
physical_device: PhysicalDevice,
|
||||||
|
plane_index: uint32_t,
|
||||||
|
p_display_count: *mut uint32_t,
|
||||||
|
p_displays: *mut DisplayKHR,
|
||||||
|
) -> Result;
|
||||||
|
|
||||||
|
"vkGetDisplayModePropertiesKHR", get_display_mode_properties_khr(
|
||||||
|
physical_device: PhysicalDevice,
|
||||||
|
display: DisplayKHR,
|
||||||
|
p_property_count: *mut uint32_t,
|
||||||
|
p_properties: *mut DisplayModePropertiesKHR,
|
||||||
|
) -> Result;
|
||||||
|
|
||||||
|
"vkCreateDisplayModeKHR", create_display_mode_khr(
|
||||||
|
physical_device: PhysicalDevice,
|
||||||
|
display: DisplayKHR,
|
||||||
|
p_create_info: *const DisplayModeCreateInfoKHR,
|
||||||
|
p_allocator: *const AllocationCallbacks,
|
||||||
|
p_mode: *mut DisplayModeKHR,
|
||||||
|
) -> Result;
|
||||||
|
|
||||||
|
"vkGetDisplayPlaneCapabilitiesKHR", get_display_plane_capabilities_khr(
|
||||||
|
physical_device: PhysicalDevice,
|
||||||
|
mode: DisplayModeKHR,
|
||||||
|
plane_index: uint32_t,
|
||||||
|
p_capabilities: *mut DisplayPlaneCapabilitiesKHR,
|
||||||
|
) -> Result;
|
||||||
|
|
||||||
|
"vkCreateDisplayPlaneSurfaceKHR", create_display_plane_surface_khr(
|
||||||
|
instance: Instance,
|
||||||
|
p_create_info: *const DisplaySurfaceCreateInfoKHR,
|
||||||
|
p_allocator: *const AllocationCallbacks,
|
||||||
|
p_surface: *mut SurfaceKHR,
|
||||||
|
) -> Result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue