mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-25 00:04:15 +00:00
Use concrete types from Ash for foreign handles (#2406)
* Use concrete types from Ash for foreign handles * Fixes * Update vulkano/src/swapchain/mod.rs Co-authored-by: marc0246 <40955683+marc0246@users.noreply.github.com> * Foxes * Get CI to build vulkano-win * Weirdness * Faxes * F*xes * Re-disable vulkano-win --------- Co-authored-by: marc0246 <40955683+marc0246@users.noreply.github.com>
This commit is contained in:
parent
3749e17233
commit
b5b8ea828a
12
Cargo.toml
12
Cargo.toml
@ -1,11 +1,11 @@
|
|||||||
[workspace]
|
[workspace]
|
||||||
members = [
|
members = [
|
||||||
"examples/*",
|
"examples/*",
|
||||||
"vulkano",
|
"vulkano",
|
||||||
"vulkano-macros",
|
"vulkano-macros",
|
||||||
"vulkano-shaders",
|
"vulkano-shaders",
|
||||||
"vulkano-util",
|
"vulkano-util",
|
||||||
# "vulkano-win",
|
# "vulkano-win",
|
||||||
]
|
]
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
||||||
|
@ -23,8 +23,8 @@ pub fn create_surface_from_handle(
|
|||||||
#[cfg(target_os = "ios")]
|
#[cfg(target_os = "ios")]
|
||||||
{
|
{
|
||||||
// Ensure the layer is CAMetalLayer
|
// Ensure the layer is CAMetalLayer
|
||||||
let layer = get_metal_layer_ios(_h.ui_view);
|
let metal_layer = get_metal_layer_ios(_h.ui_view);
|
||||||
Surface::from_ios(instance, layer, Some(window))
|
Surface::from_ios(instance, metal_layer.render_layer.0 as _, Some(window))
|
||||||
}
|
}
|
||||||
#[cfg(not(target_os = "ios"))]
|
#[cfg(not(target_os = "ios"))]
|
||||||
{
|
{
|
||||||
@ -35,8 +35,8 @@ pub fn create_surface_from_handle(
|
|||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
{
|
{
|
||||||
// Ensure the layer is CAMetalLayer
|
// Ensure the layer is CAMetalLayer
|
||||||
let layer = get_metal_layer_macos(_h.ns_view);
|
let metal_layer = get_metal_layer_macos(_h.ns_view);
|
||||||
Surface::from_mac_os(instance, layer as *const (), Some(window))
|
Surface::from_mac_os(instance, metal_layer as _, Some(window))
|
||||||
}
|
}
|
||||||
#[cfg(not(target_os = "macos"))]
|
#[cfg(not(target_os = "macos"))]
|
||||||
{
|
{
|
||||||
@ -65,7 +65,7 @@ pub fn create_surface_from_handle(
|
|||||||
RawDisplayHandle::Xlib(d) => d,
|
RawDisplayHandle::Xlib(d) => d,
|
||||||
_ => panic!("Invalid RawDisplayHandle"),
|
_ => panic!("Invalid RawDisplayHandle"),
|
||||||
};
|
};
|
||||||
Surface::from_xlib(instance, d.display, h.window, Some(window))
|
Surface::from_xlib(instance, d.display as _, h.window, Some(window))
|
||||||
}
|
}
|
||||||
RawWindowHandle::Web(_) => unimplemented!(),
|
RawWindowHandle::Web(_) => unimplemented!(),
|
||||||
_ => unimplemented!(),
|
_ => unimplemented!(),
|
||||||
@ -92,8 +92,8 @@ pub unsafe fn create_surface_from_handle_ref(
|
|||||||
#[cfg(target_os = "ios")]
|
#[cfg(target_os = "ios")]
|
||||||
{
|
{
|
||||||
// Ensure the layer is CAMetalLayer
|
// Ensure the layer is CAMetalLayer
|
||||||
let layer = get_metal_layer_ios(_h.ui_view);
|
let metal_layer = get_metal_layer_ios(_h.ui_view);
|
||||||
Surface::from_ios(instance, layer, None)
|
Surface::from_ios(instance, metal_layer.render_layer.0 as _, None)
|
||||||
}
|
}
|
||||||
#[cfg(not(target_os = "ios"))]
|
#[cfg(not(target_os = "ios"))]
|
||||||
{
|
{
|
||||||
@ -104,8 +104,8 @@ pub unsafe fn create_surface_from_handle_ref(
|
|||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
{
|
{
|
||||||
// Ensure the layer is CAMetalLayer
|
// Ensure the layer is CAMetalLayer
|
||||||
let layer = get_metal_layer_macos(_h.ns_view);
|
let metal_layer = get_metal_layer_macos(_h.ns_view);
|
||||||
Surface::from_mac_os(instance, layer as *const (), None)
|
Surface::from_mac_os(instance, metal_layer as _, None)
|
||||||
}
|
}
|
||||||
#[cfg(not(target_os = "macos"))]
|
#[cfg(not(target_os = "macos"))]
|
||||||
{
|
{
|
||||||
@ -132,7 +132,7 @@ pub unsafe fn create_surface_from_handle_ref(
|
|||||||
RawDisplayHandle::Xlib(d) => d,
|
RawDisplayHandle::Xlib(d) => d,
|
||||||
_ => panic!("Invalid RawDisplayHandle"),
|
_ => panic!("Invalid RawDisplayHandle"),
|
||||||
};
|
};
|
||||||
Surface::from_xlib(instance, d.display, h.window, None)
|
Surface::from_xlib(instance, d.display as _, h.window, None)
|
||||||
}
|
}
|
||||||
RawWindowHandle::Web(_) => unimplemented!(),
|
RawWindowHandle::Web(_) => unimplemented!(),
|
||||||
_ => unimplemented!(),
|
_ => unimplemented!(),
|
||||||
|
@ -141,7 +141,7 @@ unsafe fn winit_to_surface(
|
|||||||
if instance.enabled_extensions().khr_xlib_surface {
|
if instance.enabled_extensions().khr_xlib_surface {
|
||||||
Surface::from_xlib(
|
Surface::from_xlib(
|
||||||
instance,
|
instance,
|
||||||
window.xlib_display().unwrap(),
|
window.xlib_display().unwrap() as _,
|
||||||
window.xlib_window().unwrap() as _,
|
window.xlib_window().unwrap() as _,
|
||||||
Some(window),
|
Some(window),
|
||||||
)
|
)
|
||||||
@ -196,8 +196,8 @@ unsafe fn winit_to_surface(
|
|||||||
window: Arc<Window>,
|
window: Arc<Window>,
|
||||||
) -> Result<Arc<Surface>, Validated<VulkanError>> {
|
) -> Result<Arc<Surface>, Validated<VulkanError>> {
|
||||||
use winit::platform::macos::WindowExtMacOS;
|
use winit::platform::macos::WindowExtMacOS;
|
||||||
let layer = get_metal_layer_macos(window.ns_view());
|
let metal_layer = get_metal_layer_macos(window.ns_view());
|
||||||
Surface::from_mac_os(instance, layer as *const (), Some(window))
|
Surface::from_mac_os(instance, metal_layer as _, Some(window))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "ios")]
|
#[cfg(target_os = "ios")]
|
||||||
@ -227,8 +227,8 @@ unsafe fn winit_to_surface(
|
|||||||
window: Arc<Window>,
|
window: Arc<Window>,
|
||||||
) -> Result<Arc<Surface>, Validated<VulkanError>> {
|
) -> Result<Arc<Surface>, Validated<VulkanError>> {
|
||||||
use winit::platform::ios::WindowExtIOS;
|
use winit::platform::ios::WindowExtIOS;
|
||||||
let layer = get_metal_layer_ios(window.ui_view());
|
let metal_layer = get_metal_layer_ios(window.ui_view());
|
||||||
Surface::from_ios(instance, layer, Some(window))
|
Surface::from_ios(instance, metal_layer.render_layer.0 as _, Some(window))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
@ -240,8 +240,8 @@ unsafe fn winit_to_surface(
|
|||||||
|
|
||||||
Surface::from_win32(
|
Surface::from_win32(
|
||||||
instance,
|
instance,
|
||||||
window.hinstance() as *const (),
|
window.hinstance() as _,
|
||||||
window.hwnd() as *const (),
|
window.hwnd() as _,
|
||||||
Some(window),
|
Some(window),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -255,5 +255,5 @@ use winit::{monitor::MonitorHandle, platform::windows::MonitorHandleExtWindows};
|
|||||||
/// Creates a `Win32Monitor` from a Winit monitor handle.
|
/// Creates a `Win32Monitor` from a Winit monitor handle.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn create_win32_monitor_from_winit(monitor_handle: &MonitorHandle) -> Win32Monitor {
|
pub fn create_win32_monitor_from_winit(monitor_handle: &MonitorHandle) -> Win32Monitor {
|
||||||
unsafe { Win32Monitor::new(monitor_handle.hmonitor() as *const ()) }
|
unsafe { Win32Monitor::new(monitor_handle.hmonitor() as _) }
|
||||||
}
|
}
|
||||||
|
@ -425,20 +425,20 @@ impl PhysicalDevice {
|
|||||||
///
|
///
|
||||||
/// - `dfb` must be a valid DirectFB `IDirectFB` handle.
|
/// - `dfb` must be a valid DirectFB `IDirectFB` handle.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn directfb_presentation_support<D>(
|
pub unsafe fn directfb_presentation_support(
|
||||||
&self,
|
&self,
|
||||||
queue_family_index: u32,
|
queue_family_index: u32,
|
||||||
dfb: *const D,
|
dfb: *mut ash::vk::IDirectFB,
|
||||||
) -> Result<bool, Box<ValidationError>> {
|
) -> Result<bool, Box<ValidationError>> {
|
||||||
self.validate_directfb_presentation_support(queue_family_index, dfb)?;
|
self.validate_directfb_presentation_support(queue_family_index, dfb)?;
|
||||||
|
|
||||||
Ok(self.directfb_presentation_support_unchecked(queue_family_index, dfb))
|
Ok(self.directfb_presentation_support_unchecked(queue_family_index, dfb))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn validate_directfb_presentation_support<D>(
|
fn validate_directfb_presentation_support(
|
||||||
&self,
|
&self,
|
||||||
queue_family_index: u32,
|
queue_family_index: u32,
|
||||||
_dfb: *const D,
|
_dfb: *mut ash::vk::IDirectFB,
|
||||||
) -> Result<(), Box<ValidationError>> {
|
) -> Result<(), Box<ValidationError>> {
|
||||||
if !self.instance.enabled_extensions().ext_directfb_surface {
|
if !self.instance.enabled_extensions().ext_directfb_surface {
|
||||||
return Err(Box::new(ValidationError {
|
return Err(Box::new(ValidationError {
|
||||||
@ -469,17 +469,17 @@ impl PhysicalDevice {
|
|||||||
|
|
||||||
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn directfb_presentation_support_unchecked<D>(
|
pub unsafe fn directfb_presentation_support_unchecked(
|
||||||
&self,
|
&self,
|
||||||
queue_family_index: u32,
|
queue_family_index: u32,
|
||||||
dfb: *const D,
|
dfb: *mut ash::vk::IDirectFB,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
let fns = self.instance.fns();
|
let fns = self.instance.fns();
|
||||||
(fns.ext_directfb_surface
|
(fns.ext_directfb_surface
|
||||||
.get_physical_device_direct_fb_presentation_support_ext)(
|
.get_physical_device_direct_fb_presentation_support_ext)(
|
||||||
self.handle,
|
self.handle,
|
||||||
queue_family_index,
|
queue_family_index,
|
||||||
dfb as *mut _,
|
dfb,
|
||||||
) != 0
|
) != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1678,20 +1678,20 @@ impl PhysicalDevice {
|
|||||||
/// # Safety
|
/// # Safety
|
||||||
///
|
///
|
||||||
/// - `window` must be a valid QNX Screen `_screen_window` handle.
|
/// - `window` must be a valid QNX Screen `_screen_window` handle.
|
||||||
pub unsafe fn qnx_screen_presentation_support<W>(
|
pub unsafe fn qnx_screen_presentation_support(
|
||||||
&self,
|
&self,
|
||||||
queue_family_index: u32,
|
queue_family_index: u32,
|
||||||
window: *const W,
|
window: *mut ash::vk::_screen_window,
|
||||||
) -> Result<bool, Box<ValidationError>> {
|
) -> Result<bool, Box<ValidationError>> {
|
||||||
self.validate_qnx_screen_presentation_support(queue_family_index, window)?;
|
self.validate_qnx_screen_presentation_support(queue_family_index, window)?;
|
||||||
|
|
||||||
Ok(self.qnx_screen_presentation_support_unchecked(queue_family_index, window))
|
Ok(self.qnx_screen_presentation_support_unchecked(queue_family_index, window))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn validate_qnx_screen_presentation_support<W>(
|
fn validate_qnx_screen_presentation_support(
|
||||||
&self,
|
&self,
|
||||||
queue_family_index: u32,
|
queue_family_index: u32,
|
||||||
_window: *const W,
|
_window: *mut ash::vk::_screen_window,
|
||||||
) -> Result<(), Box<ValidationError>> {
|
) -> Result<(), Box<ValidationError>> {
|
||||||
if !self.instance.enabled_extensions().qnx_screen_surface {
|
if !self.instance.enabled_extensions().qnx_screen_surface {
|
||||||
return Err(Box::new(ValidationError {
|
return Err(Box::new(ValidationError {
|
||||||
@ -1721,17 +1721,17 @@ impl PhysicalDevice {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
||||||
pub unsafe fn qnx_screen_presentation_support_unchecked<W>(
|
pub unsafe fn qnx_screen_presentation_support_unchecked(
|
||||||
&self,
|
&self,
|
||||||
queue_family_index: u32,
|
queue_family_index: u32,
|
||||||
window: *const W,
|
window: *mut ash::vk::_screen_window,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
let fns = self.instance.fns();
|
let fns = self.instance.fns();
|
||||||
(fns.qnx_screen_surface
|
(fns.qnx_screen_surface
|
||||||
.get_physical_device_screen_presentation_support_qnx)(
|
.get_physical_device_screen_presentation_support_qnx)(
|
||||||
self.handle,
|
self.handle,
|
||||||
queue_family_index,
|
queue_family_index,
|
||||||
window as *mut _,
|
window,
|
||||||
) != 0
|
) != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3016,20 +3016,20 @@ impl PhysicalDevice {
|
|||||||
/// # Safety
|
/// # Safety
|
||||||
///
|
///
|
||||||
/// - `display` must be a valid Wayland `wl_display` handle.
|
/// - `display` must be a valid Wayland `wl_display` handle.
|
||||||
pub unsafe fn wayland_presentation_support<D>(
|
pub unsafe fn wayland_presentation_support(
|
||||||
&self,
|
&self,
|
||||||
queue_family_index: u32,
|
queue_family_index: u32,
|
||||||
display: *const D,
|
display: *mut ash::vk::wl_display,
|
||||||
) -> Result<bool, Box<ValidationError>> {
|
) -> Result<bool, Box<ValidationError>> {
|
||||||
self.validate_wayland_presentation_support(queue_family_index, display)?;
|
self.validate_wayland_presentation_support(queue_family_index, display)?;
|
||||||
|
|
||||||
Ok(self.wayland_presentation_support_unchecked(queue_family_index, display))
|
Ok(self.wayland_presentation_support_unchecked(queue_family_index, display))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn validate_wayland_presentation_support<D>(
|
fn validate_wayland_presentation_support(
|
||||||
&self,
|
&self,
|
||||||
queue_family_index: u32,
|
queue_family_index: u32,
|
||||||
_display: *const D,
|
_display: *mut ash::vk::wl_display,
|
||||||
) -> Result<(), Box<ValidationError>> {
|
) -> Result<(), Box<ValidationError>> {
|
||||||
if !self.instance.enabled_extensions().khr_wayland_surface {
|
if !self.instance.enabled_extensions().khr_wayland_surface {
|
||||||
return Err(Box::new(ValidationError {
|
return Err(Box::new(ValidationError {
|
||||||
@ -3059,17 +3059,17 @@ impl PhysicalDevice {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
||||||
pub unsafe fn wayland_presentation_support_unchecked<D>(
|
pub unsafe fn wayland_presentation_support_unchecked(
|
||||||
&self,
|
&self,
|
||||||
queue_family_index: u32,
|
queue_family_index: u32,
|
||||||
display: *const D,
|
display: *mut ash::vk::wl_display,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
let fns = self.instance.fns();
|
let fns = self.instance.fns();
|
||||||
(fns.khr_wayland_surface
|
(fns.khr_wayland_surface
|
||||||
.get_physical_device_wayland_presentation_support_khr)(
|
.get_physical_device_wayland_presentation_support_khr)(
|
||||||
self.handle,
|
self.handle,
|
||||||
queue_family_index,
|
queue_family_index,
|
||||||
display as *mut _,
|
display,
|
||||||
) != 0
|
) != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3129,10 +3129,10 @@ impl PhysicalDevice {
|
|||||||
/// # Safety
|
/// # Safety
|
||||||
///
|
///
|
||||||
/// - `connection` must be a valid X11 `xcb_connection_t` handle.
|
/// - `connection` must be a valid X11 `xcb_connection_t` handle.
|
||||||
pub unsafe fn xcb_presentation_support<C>(
|
pub unsafe fn xcb_presentation_support(
|
||||||
&self,
|
&self,
|
||||||
queue_family_index: u32,
|
queue_family_index: u32,
|
||||||
connection: *const C,
|
connection: *mut ash::vk::xcb_connection_t,
|
||||||
visual_id: ash::vk::xcb_visualid_t,
|
visual_id: ash::vk::xcb_visualid_t,
|
||||||
) -> Result<bool, Box<ValidationError>> {
|
) -> Result<bool, Box<ValidationError>> {
|
||||||
self.validate_xcb_presentation_support(queue_family_index, connection, visual_id)?;
|
self.validate_xcb_presentation_support(queue_family_index, connection, visual_id)?;
|
||||||
@ -3140,10 +3140,10 @@ impl PhysicalDevice {
|
|||||||
Ok(self.xcb_presentation_support_unchecked(queue_family_index, connection, visual_id))
|
Ok(self.xcb_presentation_support_unchecked(queue_family_index, connection, visual_id))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn validate_xcb_presentation_support<C>(
|
fn validate_xcb_presentation_support(
|
||||||
&self,
|
&self,
|
||||||
queue_family_index: u32,
|
queue_family_index: u32,
|
||||||
_connection: *const C,
|
_connection: *mut ash::vk::xcb_connection_t,
|
||||||
_visual_id: ash::vk::xcb_visualid_t,
|
_visual_id: ash::vk::xcb_visualid_t,
|
||||||
) -> Result<(), Box<ValidationError>> {
|
) -> Result<(), Box<ValidationError>> {
|
||||||
if !self.instance.enabled_extensions().khr_xcb_surface {
|
if !self.instance.enabled_extensions().khr_xcb_surface {
|
||||||
@ -3174,10 +3174,10 @@ impl PhysicalDevice {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
||||||
pub unsafe fn xcb_presentation_support_unchecked<C>(
|
pub unsafe fn xcb_presentation_support_unchecked(
|
||||||
&self,
|
&self,
|
||||||
queue_family_index: u32,
|
queue_family_index: u32,
|
||||||
connection: *const C,
|
connection: *mut ash::vk::xcb_connection_t,
|
||||||
visual_id: ash::vk::VisualID,
|
visual_id: ash::vk::VisualID,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
let fns = self.instance.fns();
|
let fns = self.instance.fns();
|
||||||
@ -3185,7 +3185,7 @@ impl PhysicalDevice {
|
|||||||
.get_physical_device_xcb_presentation_support_khr)(
|
.get_physical_device_xcb_presentation_support_khr)(
|
||||||
self.handle,
|
self.handle,
|
||||||
queue_family_index,
|
queue_family_index,
|
||||||
connection as *mut _,
|
connection,
|
||||||
visual_id,
|
visual_id,
|
||||||
) != 0
|
) != 0
|
||||||
}
|
}
|
||||||
@ -3196,10 +3196,10 @@ impl PhysicalDevice {
|
|||||||
/// # Safety
|
/// # Safety
|
||||||
///
|
///
|
||||||
/// - `display` must be a valid Xlib `Display` handle.
|
/// - `display` must be a valid Xlib `Display` handle.
|
||||||
pub unsafe fn xlib_presentation_support<D>(
|
pub unsafe fn xlib_presentation_support(
|
||||||
&self,
|
&self,
|
||||||
queue_family_index: u32,
|
queue_family_index: u32,
|
||||||
display: *const D,
|
display: *mut ash::vk::Display,
|
||||||
visual_id: ash::vk::VisualID,
|
visual_id: ash::vk::VisualID,
|
||||||
) -> Result<bool, Box<ValidationError>> {
|
) -> Result<bool, Box<ValidationError>> {
|
||||||
self.validate_xlib_presentation_support(queue_family_index, display, visual_id)?;
|
self.validate_xlib_presentation_support(queue_family_index, display, visual_id)?;
|
||||||
@ -3207,10 +3207,10 @@ impl PhysicalDevice {
|
|||||||
Ok(self.xlib_presentation_support_unchecked(queue_family_index, display, visual_id))
|
Ok(self.xlib_presentation_support_unchecked(queue_family_index, display, visual_id))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn validate_xlib_presentation_support<D>(
|
fn validate_xlib_presentation_support(
|
||||||
&self,
|
&self,
|
||||||
queue_family_index: u32,
|
queue_family_index: u32,
|
||||||
_display: *const D,
|
_display: *mut ash::vk::Display,
|
||||||
_visual_id: ash::vk::VisualID,
|
_visual_id: ash::vk::VisualID,
|
||||||
) -> Result<(), Box<ValidationError>> {
|
) -> Result<(), Box<ValidationError>> {
|
||||||
if !self.instance.enabled_extensions().khr_xlib_surface {
|
if !self.instance.enabled_extensions().khr_xlib_surface {
|
||||||
@ -3241,10 +3241,10 @@ impl PhysicalDevice {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
||||||
pub unsafe fn xlib_presentation_support_unchecked<D>(
|
pub unsafe fn xlib_presentation_support_unchecked(
|
||||||
&self,
|
&self,
|
||||||
queue_family_index: u32,
|
queue_family_index: u32,
|
||||||
display: *const D,
|
display: *mut ash::vk::Display,
|
||||||
visual_id: ash::vk::VisualID,
|
visual_id: ash::vk::VisualID,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
let fns = self.instance.fns();
|
let fns = self.instance.fns();
|
||||||
@ -3252,7 +3252,7 @@ impl PhysicalDevice {
|
|||||||
.get_physical_device_xlib_presentation_support_khr)(
|
.get_physical_device_xlib_presentation_support_khr)(
|
||||||
self.handle,
|
self.handle,
|
||||||
queue_family_index,
|
queue_family_index,
|
||||||
display as *mut _,
|
display,
|
||||||
visual_id,
|
visual_id,
|
||||||
) != 0
|
) != 0
|
||||||
}
|
}
|
||||||
|
@ -80,10 +80,11 @@
|
|||||||
//! # fn build_window() -> Arc<Window> { Arc::new(Window(ptr::null())) }
|
//! # fn build_window() -> Arc<Window> { Arc::new(Window(ptr::null())) }
|
||||||
//! let window = build_window(); // Third-party function, not provided by vulkano
|
//! let window = build_window(); // Third-party function, not provided by vulkano
|
||||||
//! let _surface = unsafe {
|
//! let _surface = unsafe {
|
||||||
//! let hinstance: *const () = ptr::null(); // Windows-specific object
|
//! let hinstance: *mut std::ffi::c_void = ptr::null_mut(); // Windows-specific object
|
||||||
//! Surface::from_win32(
|
//! Surface::from_win32(
|
||||||
//! instance.clone(),
|
//! instance.clone(),
|
||||||
//! hinstance, window.hwnd(),
|
//! hinstance,
|
||||||
|
//! window.hwnd() as ash::vk::HWND,
|
||||||
//! Some(window),
|
//! Some(window),
|
||||||
//! ).unwrap()
|
//! ).unwrap()
|
||||||
//! };
|
//! };
|
||||||
@ -2459,8 +2460,8 @@ impl Win32Monitor {
|
|||||||
/// # Safety
|
/// # Safety
|
||||||
///
|
///
|
||||||
/// - `hmonitor` must be a valid handle as returned by the Win32 API.
|
/// - `hmonitor` must be a valid handle as returned by the Win32 API.
|
||||||
pub unsafe fn new<T>(hmonitor: *const T) -> Self {
|
pub unsafe fn new(hmonitor: ash::vk::HMONITOR) -> Self {
|
||||||
Self(hmonitor as _)
|
Self(hmonitor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ use smallvec::SmallVec;
|
|||||||
use std::{
|
use std::{
|
||||||
any::Any,
|
any::Any,
|
||||||
error::Error,
|
error::Error,
|
||||||
|
ffi::c_void,
|
||||||
fmt::{Debug, Display, Error as FmtError, Formatter},
|
fmt::{Debug, Display, Error as FmtError, Formatter},
|
||||||
mem::MaybeUninit,
|
mem::MaybeUninit,
|
||||||
num::NonZeroU64,
|
num::NonZeroU64,
|
||||||
@ -104,48 +105,52 @@ impl Surface {
|
|||||||
|
|
||||||
match (window_handle.as_raw(), display_handle.as_raw()) {
|
match (window_handle.as_raw(), display_handle.as_raw()) {
|
||||||
(RawWindowHandle::AndroidNdk(window), RawDisplayHandle::Android(_display)) => {
|
(RawWindowHandle::AndroidNdk(window), RawDisplayHandle::Android(_display)) => {
|
||||||
Self::from_android(instance, window.a_native_window.as_ptr(), None)
|
Self::from_android(
|
||||||
|
instance,
|
||||||
|
window.a_native_window.as_ptr() as *mut ash::vk::ANativeWindow,
|
||||||
|
None,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
(RawWindowHandle::AppKit(window), RawDisplayHandle::AppKit(_display)) => {
|
(RawWindowHandle::AppKit(window), RawDisplayHandle::AppKit(_display)) => {
|
||||||
// Ensure the layer is `CAMetalLayer`.
|
// Ensure the layer is `CAMetalLayer`.
|
||||||
let layer = get_metal_layer_macos(window.ns_view.as_ptr());
|
let metal_layer = get_metal_layer_macos(window.ns_view.as_ptr() as *mut c_void);
|
||||||
|
|
||||||
Self::from_mac_os(instance, layer as *const (), None)
|
Self::from_mac_os(instance, metal_layer as *const c_void, None)
|
||||||
}
|
}
|
||||||
#[cfg(target_os = "ios")]
|
#[cfg(target_os = "ios")]
|
||||||
(RawWindowHandle::UiKit(window), RawDisplayHandle::UiKit(_display)) => {
|
(RawWindowHandle::UiKit(window), RawDisplayHandle::UiKit(_display)) => {
|
||||||
// Ensure the layer is `CAMetalLayer`.
|
// Ensure the layer is `CAMetalLayer`.
|
||||||
let layer = get_metal_layer_ios(window.ui_view.as_ptr());
|
let metal_layer = get_metal_layer_ios(window.ui_view.as_ptr() as *mut c_void);
|
||||||
|
|
||||||
Self::from_ios(instance, layer, None)
|
Self::from_ios(instance, metal_layer.render_layer.0 as *const c_void, None)
|
||||||
}
|
}
|
||||||
(RawWindowHandle::Wayland(window), RawDisplayHandle::Wayland(display)) => {
|
(RawWindowHandle::Wayland(window), RawDisplayHandle::Wayland(display)) => {
|
||||||
Self::from_wayland(
|
Self::from_wayland(
|
||||||
instance,
|
instance,
|
||||||
display.display.as_ptr(),
|
display.display.as_ptr() as *mut ash::vk::wl_display,
|
||||||
window.surface.as_ptr(),
|
window.surface.as_ptr() as *mut ash::vk::wl_surface,
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
(RawWindowHandle::Win32(window), RawDisplayHandle::Windows(_display)) => {
|
(RawWindowHandle::Win32(window), RawDisplayHandle::Windows(_display)) => {
|
||||||
Self::from_win32(
|
Self::from_win32(
|
||||||
instance,
|
instance,
|
||||||
window.hinstance.unwrap().get() as *const (),
|
window.hinstance.unwrap().get() as ash::vk::HINSTANCE,
|
||||||
window.hwnd.get() as *const (),
|
window.hwnd.get() as ash::vk::HWND,
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
(RawWindowHandle::Xcb(window), RawDisplayHandle::Xcb(display)) => Self::from_xcb(
|
(RawWindowHandle::Xcb(window), RawDisplayHandle::Xcb(display)) => Self::from_xcb(
|
||||||
instance,
|
instance,
|
||||||
display.connection.unwrap().as_ptr(),
|
display.connection.unwrap().as_ptr() as *mut ash::vk::xcb_connection_t,
|
||||||
window.window.get(),
|
window.window.get() as ash::vk::xcb_window_t,
|
||||||
None,
|
None,
|
||||||
),
|
),
|
||||||
(RawWindowHandle::Xlib(window), RawDisplayHandle::Xlib(display)) => Self::from_xlib(
|
(RawWindowHandle::Xlib(window), RawDisplayHandle::Xlib(display)) => Self::from_xlib(
|
||||||
instance,
|
instance,
|
||||||
display.display.unwrap().as_ptr(),
|
display.display.unwrap().as_ptr() as *mut ash::vk::Display,
|
||||||
window.window,
|
window.window as ash::vk::Window,
|
||||||
None,
|
None,
|
||||||
),
|
),
|
||||||
_ => unimplemented!(
|
_ => unimplemented!(
|
||||||
@ -431,9 +436,9 @@ impl Surface {
|
|||||||
/// - `window` must be a valid Android `ANativeWindow` handle.
|
/// - `window` must be a valid Android `ANativeWindow` handle.
|
||||||
/// - The object referred to by `window` must outlive the created `Surface`.
|
/// - The object referred to by `window` must outlive the created `Surface`.
|
||||||
/// The `object` parameter can be used to ensure this.
|
/// The `object` parameter can be used to ensure this.
|
||||||
pub unsafe fn from_android<W>(
|
pub unsafe fn from_android(
|
||||||
instance: Arc<Instance>,
|
instance: Arc<Instance>,
|
||||||
window: *const W,
|
window: *mut ash::vk::ANativeWindow,
|
||||||
object: Option<Arc<dyn Any + Send + Sync>>,
|
object: Option<Arc<dyn Any + Send + Sync>>,
|
||||||
) -> Result<Arc<Self>, Validated<VulkanError>> {
|
) -> Result<Arc<Self>, Validated<VulkanError>> {
|
||||||
Self::validate_from_android(&instance, window)?;
|
Self::validate_from_android(&instance, window)?;
|
||||||
@ -441,9 +446,9 @@ impl Surface {
|
|||||||
Ok(Self::from_android_unchecked(instance, window, object)?)
|
Ok(Self::from_android_unchecked(instance, window, object)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn validate_from_android<W>(
|
fn validate_from_android(
|
||||||
instance: &Instance,
|
instance: &Instance,
|
||||||
_window: *const W,
|
_window: *mut ash::vk::ANativeWindow,
|
||||||
) -> Result<(), Box<ValidationError>> {
|
) -> Result<(), Box<ValidationError>> {
|
||||||
if !instance.enabled_extensions().khr_android_surface {
|
if !instance.enabled_extensions().khr_android_surface {
|
||||||
return Err(Box::new(ValidationError {
|
return Err(Box::new(ValidationError {
|
||||||
@ -461,14 +466,14 @@ impl Surface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
||||||
pub unsafe fn from_android_unchecked<W>(
|
pub unsafe fn from_android_unchecked(
|
||||||
instance: Arc<Instance>,
|
instance: Arc<Instance>,
|
||||||
window: *const W,
|
window: *mut ash::vk::ANativeWindow,
|
||||||
object: Option<Arc<dyn Any + Send + Sync>>,
|
object: Option<Arc<dyn Any + Send + Sync>>,
|
||||||
) -> Result<Arc<Self>, VulkanError> {
|
) -> Result<Arc<Self>, VulkanError> {
|
||||||
let create_info = ash::vk::AndroidSurfaceCreateInfoKHR {
|
let create_info = ash::vk::AndroidSurfaceCreateInfoKHR {
|
||||||
flags: ash::vk::AndroidSurfaceCreateFlagsKHR::empty(),
|
flags: ash::vk::AndroidSurfaceCreateFlagsKHR::empty(),
|
||||||
window: window as *mut _,
|
window,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -502,10 +507,10 @@ impl Surface {
|
|||||||
/// - `surface` must be a valid DirectFB `IDirectFBSurface` handle.
|
/// - `surface` must be a valid DirectFB `IDirectFBSurface` handle.
|
||||||
/// - The object referred to by `dfb` and `surface` must outlive the created `Surface`.
|
/// - The object referred to by `dfb` and `surface` must outlive the created `Surface`.
|
||||||
/// The `object` parameter can be used to ensure this.
|
/// The `object` parameter can be used to ensure this.
|
||||||
pub unsafe fn from_directfb<D, S>(
|
pub unsafe fn from_directfb(
|
||||||
instance: Arc<Instance>,
|
instance: Arc<Instance>,
|
||||||
dfb: *const D,
|
dfb: *mut ash::vk::IDirectFB,
|
||||||
surface: *const S,
|
surface: *mut ash::vk::IDirectFBSurface,
|
||||||
object: Option<Arc<dyn Any + Send + Sync>>,
|
object: Option<Arc<dyn Any + Send + Sync>>,
|
||||||
) -> Result<Arc<Self>, Validated<VulkanError>> {
|
) -> Result<Arc<Self>, Validated<VulkanError>> {
|
||||||
Self::validate_from_directfb(&instance, dfb, surface)?;
|
Self::validate_from_directfb(&instance, dfb, surface)?;
|
||||||
@ -515,10 +520,10 @@ impl Surface {
|
|||||||
)?)
|
)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn validate_from_directfb<D, S>(
|
fn validate_from_directfb(
|
||||||
instance: &Instance,
|
instance: &Instance,
|
||||||
_dfb: *const D,
|
_dfb: *mut ash::vk::IDirectFB,
|
||||||
_surface: *const S,
|
_surface: *mut ash::vk::IDirectFBSurface,
|
||||||
) -> Result<(), Box<ValidationError>> {
|
) -> Result<(), Box<ValidationError>> {
|
||||||
if !instance.enabled_extensions().ext_directfb_surface {
|
if !instance.enabled_extensions().ext_directfb_surface {
|
||||||
return Err(Box::new(ValidationError {
|
return Err(Box::new(ValidationError {
|
||||||
@ -539,16 +544,16 @@ impl Surface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
||||||
pub unsafe fn from_directfb_unchecked<D, S>(
|
pub unsafe fn from_directfb_unchecked(
|
||||||
instance: Arc<Instance>,
|
instance: Arc<Instance>,
|
||||||
dfb: *const D,
|
dfb: *mut ash::vk::IDirectFB,
|
||||||
surface: *const S,
|
surface: *mut ash::vk::IDirectFBSurface,
|
||||||
object: Option<Arc<dyn Any + Send + Sync>>,
|
object: Option<Arc<dyn Any + Send + Sync>>,
|
||||||
) -> Result<Arc<Self>, VulkanError> {
|
) -> Result<Arc<Self>, VulkanError> {
|
||||||
let create_info = ash::vk::DirectFBSurfaceCreateInfoEXT {
|
let create_info = ash::vk::DirectFBSurfaceCreateInfoEXT {
|
||||||
flags: ash::vk::DirectFBSurfaceCreateFlagsEXT::empty(),
|
flags: ash::vk::DirectFBSurfaceCreateFlagsEXT::empty(),
|
||||||
dfb: dfb as *mut _,
|
dfb,
|
||||||
surface: surface as *mut _,
|
surface,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -732,21 +737,19 @@ impl Surface {
|
|||||||
/// - The object referred to by `metal_layer` must outlive the created `Surface`.
|
/// - The object referred to by `metal_layer` must outlive the created `Surface`.
|
||||||
/// The `object` parameter can be used to ensure this.
|
/// The `object` parameter can be used to ensure this.
|
||||||
/// - The `UIView` must be backed by a `CALayer` instance of type `CAMetalLayer`.
|
/// - The `UIView` must be backed by a `CALayer` instance of type `CAMetalLayer`.
|
||||||
#[cfg(target_os = "ios")]
|
|
||||||
pub unsafe fn from_ios(
|
pub unsafe fn from_ios(
|
||||||
instance: Arc<Instance>,
|
instance: Arc<Instance>,
|
||||||
metal_layer: IOSMetalLayer,
|
view: *const c_void,
|
||||||
object: Option<Arc<dyn Any + Send + Sync>>,
|
object: Option<Arc<dyn Any + Send + Sync>>,
|
||||||
) -> Result<Arc<Self>, Validated<VulkanError>> {
|
) -> Result<Arc<Self>, Validated<VulkanError>> {
|
||||||
Self::validate_from_ios(&instance, &metal_layer)?;
|
Self::validate_from_ios(&instance, view)?;
|
||||||
|
|
||||||
Ok(Self::from_ios_unchecked(instance, metal_layer, object)?)
|
Ok(Self::from_ios_unchecked(instance, view, object)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "ios")]
|
|
||||||
fn validate_from_ios(
|
fn validate_from_ios(
|
||||||
instance: &Instance,
|
instance: &Instance,
|
||||||
_metal_layer: &IOSMetalLayer,
|
_view: *const c_void,
|
||||||
) -> Result<(), Box<ValidationError>> {
|
) -> Result<(), Box<ValidationError>> {
|
||||||
if !instance.enabled_extensions().mvk_ios_surface {
|
if !instance.enabled_extensions().mvk_ios_surface {
|
||||||
return Err(Box::new(ValidationError {
|
return Err(Box::new(ValidationError {
|
||||||
@ -766,16 +769,15 @@ impl Surface {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "ios")]
|
|
||||||
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
||||||
pub unsafe fn from_ios_unchecked(
|
pub unsafe fn from_ios_unchecked(
|
||||||
instance: Arc<Instance>,
|
instance: Arc<Instance>,
|
||||||
metal_layer: IOSMetalLayer,
|
view: *const c_void,
|
||||||
object: Option<Arc<dyn Any + Send + Sync>>,
|
object: Option<Arc<dyn Any + Send + Sync>>,
|
||||||
) -> Result<Arc<Self>, VulkanError> {
|
) -> Result<Arc<Self>, VulkanError> {
|
||||||
let create_info = ash::vk::IOSSurfaceCreateInfoMVK {
|
let create_info = ash::vk::IOSSurfaceCreateInfoMVK {
|
||||||
flags: ash::vk::IOSSurfaceCreateFlagsMVK::empty(),
|
flags: ash::vk::IOSSurfaceCreateFlagsMVK::empty(),
|
||||||
p_view: metal_layer.render_layer.0 as *const _,
|
p_view: view,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -809,10 +811,9 @@ impl Surface {
|
|||||||
/// - The object referred to by `view` must outlive the created `Surface`.
|
/// - The object referred to by `view` must outlive the created `Surface`.
|
||||||
/// The `object` parameter can be used to ensure this.
|
/// The `object` parameter can be used to ensure this.
|
||||||
/// - The `NSView` must be backed by a `CALayer` instance of type `CAMetalLayer`.
|
/// - The `NSView` must be backed by a `CALayer` instance of type `CAMetalLayer`.
|
||||||
#[cfg(target_os = "macos")]
|
pub unsafe fn from_mac_os(
|
||||||
pub unsafe fn from_mac_os<V>(
|
|
||||||
instance: Arc<Instance>,
|
instance: Arc<Instance>,
|
||||||
view: *const V,
|
view: *const c_void,
|
||||||
object: Option<Arc<dyn Any + Send + Sync>>,
|
object: Option<Arc<dyn Any + Send + Sync>>,
|
||||||
) -> Result<Arc<Self>, Validated<VulkanError>> {
|
) -> Result<Arc<Self>, Validated<VulkanError>> {
|
||||||
Self::validate_from_mac_os(&instance, view)?;
|
Self::validate_from_mac_os(&instance, view)?;
|
||||||
@ -820,10 +821,9 @@ impl Surface {
|
|||||||
Ok(Self::from_mac_os_unchecked(instance, view, object)?)
|
Ok(Self::from_mac_os_unchecked(instance, view, object)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
fn validate_from_mac_os(
|
||||||
fn validate_from_mac_os<V>(
|
|
||||||
instance: &Instance,
|
instance: &Instance,
|
||||||
_view: *const V,
|
_view: *const c_void,
|
||||||
) -> Result<(), Box<ValidationError>> {
|
) -> Result<(), Box<ValidationError>> {
|
||||||
if !instance.enabled_extensions().mvk_macos_surface {
|
if !instance.enabled_extensions().mvk_macos_surface {
|
||||||
return Err(Box::new(ValidationError {
|
return Err(Box::new(ValidationError {
|
||||||
@ -843,16 +843,15 @@ impl Surface {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
|
||||||
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
||||||
pub unsafe fn from_mac_os_unchecked<V>(
|
pub unsafe fn from_mac_os_unchecked(
|
||||||
instance: Arc<Instance>,
|
instance: Arc<Instance>,
|
||||||
view: *const V,
|
view: *const c_void,
|
||||||
object: Option<Arc<dyn Any + Send + Sync>>,
|
object: Option<Arc<dyn Any + Send + Sync>>,
|
||||||
) -> Result<Arc<Self>, VulkanError> {
|
) -> Result<Arc<Self>, VulkanError> {
|
||||||
let create_info = ash::vk::MacOSSurfaceCreateInfoMVK {
|
let create_info = ash::vk::MacOSSurfaceCreateInfoMVK {
|
||||||
flags: ash::vk::MacOSSurfaceCreateFlagsMVK::empty(),
|
flags: ash::vk::MacOSSurfaceCreateFlagsMVK::empty(),
|
||||||
p_view: view as *const _,
|
p_view: view,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -885,9 +884,9 @@ impl Surface {
|
|||||||
/// - `layer` must be a valid Metal `CAMetalLayer` handle.
|
/// - `layer` must be a valid Metal `CAMetalLayer` handle.
|
||||||
/// - The object referred to by `layer` must outlive the created `Surface`.
|
/// - The object referred to by `layer` must outlive the created `Surface`.
|
||||||
/// The `object` parameter can be used to ensure this.
|
/// The `object` parameter can be used to ensure this.
|
||||||
pub unsafe fn from_metal<L>(
|
pub unsafe fn from_metal(
|
||||||
instance: Arc<Instance>,
|
instance: Arc<Instance>,
|
||||||
layer: *const L,
|
layer: *const ash::vk::CAMetalLayer,
|
||||||
object: Option<Arc<dyn Any + Send + Sync>>,
|
object: Option<Arc<dyn Any + Send + Sync>>,
|
||||||
) -> Result<Arc<Self>, Validated<VulkanError>> {
|
) -> Result<Arc<Self>, Validated<VulkanError>> {
|
||||||
Self::validate_from_metal(&instance, layer)?;
|
Self::validate_from_metal(&instance, layer)?;
|
||||||
@ -895,9 +894,9 @@ impl Surface {
|
|||||||
Ok(Self::from_metal_unchecked(instance, layer, object)?)
|
Ok(Self::from_metal_unchecked(instance, layer, object)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn validate_from_metal<L>(
|
fn validate_from_metal(
|
||||||
instance: &Instance,
|
instance: &Instance,
|
||||||
_layer: *const L,
|
_layer: *const ash::vk::CAMetalLayer,
|
||||||
) -> Result<(), Box<ValidationError>> {
|
) -> Result<(), Box<ValidationError>> {
|
||||||
if !instance.enabled_extensions().ext_metal_surface {
|
if !instance.enabled_extensions().ext_metal_surface {
|
||||||
return Err(Box::new(ValidationError {
|
return Err(Box::new(ValidationError {
|
||||||
@ -912,14 +911,14 @@ impl Surface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
||||||
pub unsafe fn from_metal_unchecked<L>(
|
pub unsafe fn from_metal_unchecked(
|
||||||
instance: Arc<Instance>,
|
instance: Arc<Instance>,
|
||||||
layer: *const L,
|
layer: *const ash::vk::CAMetalLayer,
|
||||||
object: Option<Arc<dyn Any + Send + Sync>>,
|
object: Option<Arc<dyn Any + Send + Sync>>,
|
||||||
) -> Result<Arc<Self>, VulkanError> {
|
) -> Result<Arc<Self>, VulkanError> {
|
||||||
let create_info = ash::vk::MetalSurfaceCreateInfoEXT {
|
let create_info = ash::vk::MetalSurfaceCreateInfoEXT {
|
||||||
flags: ash::vk::MetalSurfaceCreateFlagsEXT::empty(),
|
flags: ash::vk::MetalSurfaceCreateFlagsEXT::empty(),
|
||||||
p_layer: layer as *const _,
|
p_layer: layer,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -953,10 +952,10 @@ impl Surface {
|
|||||||
/// - `window` must be a valid QNX Screen `_screen_window` handle.
|
/// - `window` must be a valid QNX Screen `_screen_window` handle.
|
||||||
/// - The object referred to by `window` must outlive the created `Surface`.
|
/// - The object referred to by `window` must outlive the created `Surface`.
|
||||||
/// The `object` parameter can be used to ensure this.
|
/// The `object` parameter can be used to ensure this.
|
||||||
pub unsafe fn from_qnx_screen<C, W>(
|
pub unsafe fn from_qnx_screen(
|
||||||
instance: Arc<Instance>,
|
instance: Arc<Instance>,
|
||||||
context: *const C,
|
context: *mut ash::vk::_screen_context,
|
||||||
window: *const W,
|
window: *mut ash::vk::_screen_window,
|
||||||
object: Option<Arc<dyn Any + Send + Sync>>,
|
object: Option<Arc<dyn Any + Send + Sync>>,
|
||||||
) -> Result<Arc<Self>, Validated<VulkanError>> {
|
) -> Result<Arc<Self>, Validated<VulkanError>> {
|
||||||
Self::validate_from_qnx_screen(&instance, context, window)?;
|
Self::validate_from_qnx_screen(&instance, context, window)?;
|
||||||
@ -966,10 +965,10 @@ impl Surface {
|
|||||||
)?)
|
)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn validate_from_qnx_screen<C, W>(
|
fn validate_from_qnx_screen(
|
||||||
instance: &Instance,
|
instance: &Instance,
|
||||||
_context: *const C,
|
_context: *mut ash::vk::_screen_context,
|
||||||
_window: *const W,
|
_window: *mut ash::vk::_screen_window,
|
||||||
) -> Result<(), Box<ValidationError>> {
|
) -> Result<(), Box<ValidationError>> {
|
||||||
if !instance.enabled_extensions().qnx_screen_surface {
|
if !instance.enabled_extensions().qnx_screen_surface {
|
||||||
return Err(Box::new(ValidationError {
|
return Err(Box::new(ValidationError {
|
||||||
@ -990,16 +989,16 @@ impl Surface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
||||||
pub unsafe fn from_qnx_screen_unchecked<C, W>(
|
pub unsafe fn from_qnx_screen_unchecked(
|
||||||
instance: Arc<Instance>,
|
instance: Arc<Instance>,
|
||||||
context: *const C,
|
context: *mut ash::vk::_screen_context,
|
||||||
window: *const W,
|
window: *mut ash::vk::_screen_window,
|
||||||
object: Option<Arc<dyn Any + Send + Sync>>,
|
object: Option<Arc<dyn Any + Send + Sync>>,
|
||||||
) -> Result<Arc<Self>, VulkanError> {
|
) -> Result<Arc<Self>, VulkanError> {
|
||||||
let create_info = ash::vk::ScreenSurfaceCreateInfoQNX {
|
let create_info = ash::vk::ScreenSurfaceCreateInfoQNX {
|
||||||
flags: ash::vk::ScreenSurfaceCreateFlagsQNX::empty(),
|
flags: ash::vk::ScreenSurfaceCreateFlagsQNX::empty(),
|
||||||
context: context as *mut _,
|
context,
|
||||||
window: window as *mut _,
|
window,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1032,9 +1031,9 @@ impl Surface {
|
|||||||
/// - `window` must be a valid `nn::vi::NativeWindowHandle` handle.
|
/// - `window` must be a valid `nn::vi::NativeWindowHandle` handle.
|
||||||
/// - The object referred to by `window` must outlive the created `Surface`.
|
/// - The object referred to by `window` must outlive the created `Surface`.
|
||||||
/// The `object` parameter can be used to ensure this.
|
/// The `object` parameter can be used to ensure this.
|
||||||
pub unsafe fn from_vi<W>(
|
pub unsafe fn from_vi(
|
||||||
instance: Arc<Instance>,
|
instance: Arc<Instance>,
|
||||||
window: *const W,
|
window: *mut c_void,
|
||||||
object: Option<Arc<dyn Any + Send + Sync>>,
|
object: Option<Arc<dyn Any + Send + Sync>>,
|
||||||
) -> Result<Arc<Self>, Validated<VulkanError>> {
|
) -> Result<Arc<Self>, Validated<VulkanError>> {
|
||||||
Self::validate_from_vi(&instance, window)?;
|
Self::validate_from_vi(&instance, window)?;
|
||||||
@ -1042,9 +1041,9 @@ impl Surface {
|
|||||||
Ok(Self::from_vi_unchecked(instance, window, object)?)
|
Ok(Self::from_vi_unchecked(instance, window, object)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn validate_from_vi<W>(
|
fn validate_from_vi(
|
||||||
instance: &Instance,
|
instance: &Instance,
|
||||||
_window: *const W,
|
_window: *mut c_void,
|
||||||
) -> Result<(), Box<ValidationError>> {
|
) -> Result<(), Box<ValidationError>> {
|
||||||
if !instance.enabled_extensions().nn_vi_surface {
|
if !instance.enabled_extensions().nn_vi_surface {
|
||||||
return Err(Box::new(ValidationError {
|
return Err(Box::new(ValidationError {
|
||||||
@ -1062,14 +1061,14 @@ impl Surface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
||||||
pub unsafe fn from_vi_unchecked<W>(
|
pub unsafe fn from_vi_unchecked(
|
||||||
instance: Arc<Instance>,
|
instance: Arc<Instance>,
|
||||||
window: *const W,
|
window: *mut c_void,
|
||||||
object: Option<Arc<dyn Any + Send + Sync>>,
|
object: Option<Arc<dyn Any + Send + Sync>>,
|
||||||
) -> Result<Arc<Self>, VulkanError> {
|
) -> Result<Arc<Self>, VulkanError> {
|
||||||
let create_info = ash::vk::ViSurfaceCreateInfoNN {
|
let create_info = ash::vk::ViSurfaceCreateInfoNN {
|
||||||
flags: ash::vk::ViSurfaceCreateFlagsNN::empty(),
|
flags: ash::vk::ViSurfaceCreateFlagsNN::empty(),
|
||||||
window: window as *mut _,
|
window,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1105,10 +1104,10 @@ impl Surface {
|
|||||||
/// - `surface` must be a valid Wayland `wl_surface` handle.
|
/// - `surface` must be a valid Wayland `wl_surface` handle.
|
||||||
/// - The objects referred to by `display` and `surface` must outlive the created `Surface`.
|
/// - The objects referred to by `display` and `surface` must outlive the created `Surface`.
|
||||||
/// The `object` parameter can be used to ensure this.
|
/// The `object` parameter can be used to ensure this.
|
||||||
pub unsafe fn from_wayland<D, S>(
|
pub unsafe fn from_wayland(
|
||||||
instance: Arc<Instance>,
|
instance: Arc<Instance>,
|
||||||
display: *const D,
|
display: *mut ash::vk::wl_display,
|
||||||
surface: *const S,
|
surface: *mut ash::vk::wl_surface,
|
||||||
object: Option<Arc<dyn Any + Send + Sync>>,
|
object: Option<Arc<dyn Any + Send + Sync>>,
|
||||||
) -> Result<Arc<Self>, Validated<VulkanError>> {
|
) -> Result<Arc<Self>, Validated<VulkanError>> {
|
||||||
Self::validate_from_wayland(&instance, display, surface)?;
|
Self::validate_from_wayland(&instance, display, surface)?;
|
||||||
@ -1118,10 +1117,10 @@ impl Surface {
|
|||||||
)?)
|
)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn validate_from_wayland<D, S>(
|
fn validate_from_wayland(
|
||||||
instance: &Instance,
|
instance: &Instance,
|
||||||
_display: *const D,
|
_display: *mut ash::vk::wl_display,
|
||||||
_surface: *const S,
|
_surface: *mut ash::vk::wl_surface,
|
||||||
) -> Result<(), Box<ValidationError>> {
|
) -> Result<(), Box<ValidationError>> {
|
||||||
if !instance.enabled_extensions().khr_wayland_surface {
|
if !instance.enabled_extensions().khr_wayland_surface {
|
||||||
return Err(Box::new(ValidationError {
|
return Err(Box::new(ValidationError {
|
||||||
@ -1142,16 +1141,16 @@ impl Surface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
||||||
pub unsafe fn from_wayland_unchecked<D, S>(
|
pub unsafe fn from_wayland_unchecked(
|
||||||
instance: Arc<Instance>,
|
instance: Arc<Instance>,
|
||||||
display: *const D,
|
display: *mut ash::vk::wl_display,
|
||||||
surface: *const S,
|
surface: *mut ash::vk::wl_surface,
|
||||||
object: Option<Arc<dyn Any + Send + Sync>>,
|
object: Option<Arc<dyn Any + Send + Sync>>,
|
||||||
) -> Result<Arc<Self>, VulkanError> {
|
) -> Result<Arc<Self>, VulkanError> {
|
||||||
let create_info = ash::vk::WaylandSurfaceCreateInfoKHR {
|
let create_info = ash::vk::WaylandSurfaceCreateInfoKHR {
|
||||||
flags: ash::vk::WaylandSurfaceCreateFlagsKHR::empty(),
|
flags: ash::vk::WaylandSurfaceCreateFlagsKHR::empty(),
|
||||||
display: display as *mut _,
|
display,
|
||||||
surface: surface as *mut _,
|
surface,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1187,10 +1186,10 @@ impl Surface {
|
|||||||
/// - `hwnd` must be a valid Win32 `HWND` handle.
|
/// - `hwnd` must be a valid Win32 `HWND` handle.
|
||||||
/// - The objects referred to by `hwnd` and `hinstance` must outlive the created `Surface`.
|
/// - The objects referred to by `hwnd` and `hinstance` must outlive the created `Surface`.
|
||||||
/// The `object` parameter can be used to ensure this.
|
/// The `object` parameter can be used to ensure this.
|
||||||
pub unsafe fn from_win32<I, W>(
|
pub unsafe fn from_win32(
|
||||||
instance: Arc<Instance>,
|
instance: Arc<Instance>,
|
||||||
hinstance: *const I,
|
hinstance: ash::vk::HINSTANCE,
|
||||||
hwnd: *const W,
|
hwnd: ash::vk::HWND,
|
||||||
object: Option<Arc<dyn Any + Send + Sync>>,
|
object: Option<Arc<dyn Any + Send + Sync>>,
|
||||||
) -> Result<Arc<Self>, Validated<VulkanError>> {
|
) -> Result<Arc<Self>, Validated<VulkanError>> {
|
||||||
Self::validate_from_win32(&instance, hinstance, hwnd)?;
|
Self::validate_from_win32(&instance, hinstance, hwnd)?;
|
||||||
@ -1200,10 +1199,10 @@ impl Surface {
|
|||||||
)?)
|
)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn validate_from_win32<I, W>(
|
fn validate_from_win32(
|
||||||
instance: &Instance,
|
instance: &Instance,
|
||||||
_hinstance: *const I,
|
_hinstance: ash::vk::HINSTANCE,
|
||||||
_hwnd: *const W,
|
_hwnd: ash::vk::HWND,
|
||||||
) -> Result<(), Box<ValidationError>> {
|
) -> Result<(), Box<ValidationError>> {
|
||||||
if !instance.enabled_extensions().khr_win32_surface {
|
if !instance.enabled_extensions().khr_win32_surface {
|
||||||
return Err(Box::new(ValidationError {
|
return Err(Box::new(ValidationError {
|
||||||
@ -1224,16 +1223,16 @@ impl Surface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
||||||
pub unsafe fn from_win32_unchecked<I, W>(
|
pub unsafe fn from_win32_unchecked(
|
||||||
instance: Arc<Instance>,
|
instance: Arc<Instance>,
|
||||||
hinstance: *const I,
|
hinstance: ash::vk::HINSTANCE,
|
||||||
hwnd: *const W,
|
hwnd: ash::vk::HWND,
|
||||||
object: Option<Arc<dyn Any + Send + Sync>>,
|
object: Option<Arc<dyn Any + Send + Sync>>,
|
||||||
) -> Result<Arc<Self>, VulkanError> {
|
) -> Result<Arc<Self>, VulkanError> {
|
||||||
let create_info = ash::vk::Win32SurfaceCreateInfoKHR {
|
let create_info = ash::vk::Win32SurfaceCreateInfoKHR {
|
||||||
flags: ash::vk::Win32SurfaceCreateFlagsKHR::empty(),
|
flags: ash::vk::Win32SurfaceCreateFlagsKHR::empty(),
|
||||||
hinstance: hinstance as *mut _,
|
hinstance,
|
||||||
hwnd: hwnd as *mut _,
|
hwnd,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1269,9 +1268,9 @@ impl Surface {
|
|||||||
/// - `window` must be a valid X11 `xcb_window_t` handle.
|
/// - `window` must be a valid X11 `xcb_window_t` handle.
|
||||||
/// - The objects referred to by `connection` and `window` must outlive the created `Surface`.
|
/// - The objects referred to by `connection` and `window` must outlive the created `Surface`.
|
||||||
/// The `object` parameter can be used to ensure this.
|
/// The `object` parameter can be used to ensure this.
|
||||||
pub unsafe fn from_xcb<C>(
|
pub unsafe fn from_xcb(
|
||||||
instance: Arc<Instance>,
|
instance: Arc<Instance>,
|
||||||
connection: *const C,
|
connection: *mut ash::vk::xcb_connection_t,
|
||||||
window: ash::vk::xcb_window_t,
|
window: ash::vk::xcb_window_t,
|
||||||
object: Option<Arc<dyn Any + Send + Sync>>,
|
object: Option<Arc<dyn Any + Send + Sync>>,
|
||||||
) -> Result<Arc<Self>, Validated<VulkanError>> {
|
) -> Result<Arc<Self>, Validated<VulkanError>> {
|
||||||
@ -1282,9 +1281,9 @@ impl Surface {
|
|||||||
)?)
|
)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn validate_from_xcb<C>(
|
fn validate_from_xcb(
|
||||||
instance: &Instance,
|
instance: &Instance,
|
||||||
_connection: *const C,
|
_connection: *mut ash::vk::xcb_connection_t,
|
||||||
_window: ash::vk::xcb_window_t,
|
_window: ash::vk::xcb_window_t,
|
||||||
) -> Result<(), Box<ValidationError>> {
|
) -> Result<(), Box<ValidationError>> {
|
||||||
if !instance.enabled_extensions().khr_xcb_surface {
|
if !instance.enabled_extensions().khr_xcb_surface {
|
||||||
@ -1306,15 +1305,15 @@ impl Surface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
||||||
pub unsafe fn from_xcb_unchecked<C>(
|
pub unsafe fn from_xcb_unchecked(
|
||||||
instance: Arc<Instance>,
|
instance: Arc<Instance>,
|
||||||
connection: *const C,
|
connection: *mut ash::vk::xcb_connection_t,
|
||||||
window: ash::vk::xcb_window_t,
|
window: ash::vk::xcb_window_t,
|
||||||
object: Option<Arc<dyn Any + Send + Sync>>,
|
object: Option<Arc<dyn Any + Send + Sync>>,
|
||||||
) -> Result<Arc<Self>, VulkanError> {
|
) -> Result<Arc<Self>, VulkanError> {
|
||||||
let create_info = ash::vk::XcbSurfaceCreateInfoKHR {
|
let create_info = ash::vk::XcbSurfaceCreateInfoKHR {
|
||||||
flags: ash::vk::XcbSurfaceCreateFlagsKHR::empty(),
|
flags: ash::vk::XcbSurfaceCreateFlagsKHR::empty(),
|
||||||
connection: connection as *mut _,
|
connection,
|
||||||
window,
|
window,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
@ -1351,9 +1350,9 @@ impl Surface {
|
|||||||
/// - `window` must be a valid Xlib `Window` handle.
|
/// - `window` must be a valid Xlib `Window` handle.
|
||||||
/// - The objects referred to by `display` and `window` must outlive the created `Surface`.
|
/// - The objects referred to by `display` and `window` must outlive the created `Surface`.
|
||||||
/// The `object` parameter can be used to ensure this.
|
/// The `object` parameter can be used to ensure this.
|
||||||
pub unsafe fn from_xlib<D>(
|
pub unsafe fn from_xlib(
|
||||||
instance: Arc<Instance>,
|
instance: Arc<Instance>,
|
||||||
display: *const D,
|
display: *mut ash::vk::Display,
|
||||||
window: ash::vk::Window,
|
window: ash::vk::Window,
|
||||||
object: Option<Arc<dyn Any + Send + Sync>>,
|
object: Option<Arc<dyn Any + Send + Sync>>,
|
||||||
) -> Result<Arc<Self>, Validated<VulkanError>> {
|
) -> Result<Arc<Self>, Validated<VulkanError>> {
|
||||||
@ -1364,9 +1363,9 @@ impl Surface {
|
|||||||
)?)
|
)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn validate_from_xlib<D>(
|
fn validate_from_xlib(
|
||||||
instance: &Instance,
|
instance: &Instance,
|
||||||
_display: *const D,
|
_display: *mut ash::vk::Display,
|
||||||
_window: ash::vk::Window,
|
_window: ash::vk::Window,
|
||||||
) -> Result<(), Box<ValidationError>> {
|
) -> Result<(), Box<ValidationError>> {
|
||||||
if !instance.enabled_extensions().khr_xlib_surface {
|
if !instance.enabled_extensions().khr_xlib_surface {
|
||||||
@ -1388,15 +1387,15 @@ impl Surface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
||||||
pub unsafe fn from_xlib_unchecked<D>(
|
pub unsafe fn from_xlib_unchecked(
|
||||||
instance: Arc<Instance>,
|
instance: Arc<Instance>,
|
||||||
display: *const D,
|
display: *mut ash::vk::Display,
|
||||||
window: ash::vk::Window,
|
window: ash::vk::Window,
|
||||||
object: Option<Arc<dyn Any + Send + Sync>>,
|
object: Option<Arc<dyn Any + Send + Sync>>,
|
||||||
) -> Result<Arc<Self>, VulkanError> {
|
) -> Result<Arc<Self>, VulkanError> {
|
||||||
let create_info = ash::vk::XlibSurfaceCreateInfoKHR {
|
let create_info = ash::vk::XlibSurfaceCreateInfoKHR {
|
||||||
flags: ash::vk::XlibSurfaceCreateFlagsKHR::empty(),
|
flags: ash::vk::XlibSurfaceCreateFlagsKHR::empty(),
|
||||||
dpy: display as *mut _,
|
dpy: display,
|
||||||
window,
|
window,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
@ -1515,7 +1514,7 @@ impl_id_counter!(Surface);
|
|||||||
|
|
||||||
/// Get sublayer from iOS main view (ui_view). The sublayer is created as `CAMetalLayer`.
|
/// Get sublayer from iOS main view (ui_view). The sublayer is created as `CAMetalLayer`.
|
||||||
#[cfg(target_os = "ios")]
|
#[cfg(target_os = "ios")]
|
||||||
unsafe fn get_metal_layer_ios(ui_view: *mut std::ffi::c_void) -> IOSMetalLayer {
|
unsafe fn get_metal_layer_ios(ui_view: *mut c_void) -> IOSMetalLayer {
|
||||||
use core_graphics_types::{base::CGFloat, geometry::CGRect};
|
use core_graphics_types::{base::CGFloat, geometry::CGRect};
|
||||||
|
|
||||||
let view: *mut Object = ui_view.cast();
|
let view: *mut Object = ui_view.cast();
|
||||||
@ -1533,7 +1532,7 @@ unsafe fn get_metal_layer_ios(ui_view: *mut std::ffi::c_void) -> IOSMetalLayer {
|
|||||||
|
|
||||||
/// Get (and set) `CAMetalLayer` to `ns_view`. This is necessary to be able to render on Mac.
|
/// Get (and set) `CAMetalLayer` to `ns_view`. This is necessary to be able to render on Mac.
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
unsafe fn get_metal_layer_macos(ns_view: *mut std::ffi::c_void) -> *mut Object {
|
unsafe fn get_metal_layer_macos(ns_view: *mut c_void) -> *mut Object {
|
||||||
use core_graphics_types::base::CGFloat;
|
use core_graphics_types::base::CGFloat;
|
||||||
use objc::runtime::YES;
|
use objc::runtime::YES;
|
||||||
use objc::runtime::{BOOL, NO};
|
use objc::runtime::{BOOL, NO};
|
||||||
@ -2392,7 +2391,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn khr_win32_surface_ext_missing() {
|
fn khr_win32_surface_ext_missing() {
|
||||||
let instance = instance!();
|
let instance = instance!();
|
||||||
match unsafe { Surface::from_win32(instance, ptr::null::<u8>(), ptr::null::<u8>(), None) } {
|
match unsafe { Surface::from_win32(instance, ptr::null_mut(), ptr::null_mut(), None) } {
|
||||||
Err(Validated::ValidationError(err))
|
Err(Validated::ValidationError(err))
|
||||||
if matches!(
|
if matches!(
|
||||||
*err,
|
*err,
|
||||||
@ -2410,7 +2409,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn khr_xcb_surface_ext_missing() {
|
fn khr_xcb_surface_ext_missing() {
|
||||||
let instance = instance!();
|
let instance = instance!();
|
||||||
match unsafe { Surface::from_xcb(instance, ptr::null::<u8>(), 0, None) } {
|
match unsafe { Surface::from_xcb(instance, ptr::null_mut(), 0, None) } {
|
||||||
Err(Validated::ValidationError(err))
|
Err(Validated::ValidationError(err))
|
||||||
if matches!(
|
if matches!(
|
||||||
*err,
|
*err,
|
||||||
@ -2428,7 +2427,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn khr_xlib_surface_ext_missing() {
|
fn khr_xlib_surface_ext_missing() {
|
||||||
let instance = instance!();
|
let instance = instance!();
|
||||||
match unsafe { Surface::from_xlib(instance, ptr::null::<u8>(), 0, None) } {
|
match unsafe { Surface::from_xlib(instance, ptr::null_mut(), 0, None) } {
|
||||||
Err(Validated::ValidationError(err))
|
Err(Validated::ValidationError(err))
|
||||||
if matches!(
|
if matches!(
|
||||||
*err,
|
*err,
|
||||||
@ -2446,8 +2445,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn khr_wayland_surface_ext_missing() {
|
fn khr_wayland_surface_ext_missing() {
|
||||||
let instance = instance!();
|
let instance = instance!();
|
||||||
match unsafe { Surface::from_wayland(instance, ptr::null::<u8>(), ptr::null::<u8>(), None) }
|
match unsafe { Surface::from_wayland(instance, ptr::null_mut(), ptr::null_mut(), None) } {
|
||||||
{
|
|
||||||
Err(Validated::ValidationError(err))
|
Err(Validated::ValidationError(err))
|
||||||
if matches!(
|
if matches!(
|
||||||
*err,
|
*err,
|
||||||
@ -2465,7 +2463,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn khr_android_surface_ext_missing() {
|
fn khr_android_surface_ext_missing() {
|
||||||
let instance = instance!();
|
let instance = instance!();
|
||||||
match unsafe { Surface::from_android(instance, ptr::null::<u8>(), None) } {
|
match unsafe { Surface::from_android(instance, ptr::null_mut(), None) } {
|
||||||
Err(Validated::ValidationError(err))
|
Err(Validated::ValidationError(err))
|
||||||
if matches!(
|
if matches!(
|
||||||
*err,
|
*err,
|
||||||
|
Loading…
Reference in New Issue
Block a user