summaryrefslogtreecommitdiffstats
path: root/third_party/rust/ash/src/extensions/mvk
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /third_party/rust/ash/src/extensions/mvk
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/ash/src/extensions/mvk')
-rwxr-xr-xthird_party/rust/ash/src/extensions/mvk/ios_surface.rs56
-rwxr-xr-xthird_party/rust/ash/src/extensions/mvk/macos_surface.rs56
-rw-r--r--third_party/rust/ash/src/extensions/mvk/mod.rs5
3 files changed, 117 insertions, 0 deletions
diff --git a/third_party/rust/ash/src/extensions/mvk/ios_surface.rs b/third_party/rust/ash/src/extensions/mvk/ios_surface.rs
new file mode 100755
index 0000000000..76b339f0fe
--- /dev/null
+++ b/third_party/rust/ash/src/extensions/mvk/ios_surface.rs
@@ -0,0 +1,56 @@
+#![allow(dead_code)]
+use crate::prelude::*;
+use crate::version::{EntryV1_0, InstanceV1_0};
+use crate::vk;
+use crate::RawPtr;
+use std::ffi::CStr;
+use std::mem;
+
+#[derive(Clone)]
+pub struct IOSSurface {
+ handle: vk::Instance,
+ ios_surface_fn: vk::MvkIosSurfaceFn,
+}
+
+impl IOSSurface {
+ pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E, instance: &I) -> IOSSurface {
+ let surface_fn = vk::MvkIosSurfaceFn::load(|name| unsafe {
+ mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
+ });
+ IOSSurface {
+ handle: instance.handle(),
+ ios_surface_fn: surface_fn,
+ }
+ }
+
+ pub fn name() -> &'static CStr {
+ vk::MvkIosSurfaceFn::name()
+ }
+
+ #[doc = "<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/vkCreateIOSSurfaceMVK.html>"]
+ pub unsafe fn create_ios_surface_mvk(
+ &self,
+ create_info: &vk::IOSSurfaceCreateInfoMVK,
+ allocation_callbacks: Option<&vk::AllocationCallbacks>,
+ ) -> VkResult<vk::SurfaceKHR> {
+ let mut surface = mem::zeroed();
+ let err_code = self.ios_surface_fn.create_ios_surface_mvk(
+ self.handle,
+ create_info,
+ allocation_callbacks.as_raw_ptr(),
+ &mut surface,
+ );
+ match err_code {
+ vk::Result::SUCCESS => Ok(surface),
+ _ => Err(err_code),
+ }
+ }
+
+ pub fn fp(&self) -> &vk::MvkIosSurfaceFn {
+ &self.ios_surface_fn
+ }
+
+ pub fn instance(&self) -> vk::Instance {
+ self.handle
+ }
+}
diff --git a/third_party/rust/ash/src/extensions/mvk/macos_surface.rs b/third_party/rust/ash/src/extensions/mvk/macos_surface.rs
new file mode 100755
index 0000000000..6f2aea6966
--- /dev/null
+++ b/third_party/rust/ash/src/extensions/mvk/macos_surface.rs
@@ -0,0 +1,56 @@
+#![allow(dead_code)]
+use crate::prelude::*;
+use crate::version::{EntryV1_0, InstanceV1_0};
+use crate::vk;
+use crate::RawPtr;
+use std::ffi::CStr;
+use std::mem;
+
+#[derive(Clone)]
+pub struct MacOSSurface {
+ handle: vk::Instance,
+ macos_surface_fn: vk::MvkMacosSurfaceFn,
+}
+
+impl MacOSSurface {
+ pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E, instance: &I) -> MacOSSurface {
+ let surface_fn = vk::MvkMacosSurfaceFn::load(|name| unsafe {
+ mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
+ });
+ MacOSSurface {
+ handle: instance.handle(),
+ macos_surface_fn: surface_fn,
+ }
+ }
+
+ pub fn name() -> &'static CStr {
+ vk::MvkMacosSurfaceFn::name()
+ }
+
+ #[doc = "<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/vkCreateMacOSSurfaceMVK.html>"]
+ pub unsafe fn create_mac_os_surface_mvk(
+ &self,
+ create_info: &vk::MacOSSurfaceCreateInfoMVK,
+ allocation_callbacks: Option<&vk::AllocationCallbacks>,
+ ) -> VkResult<vk::SurfaceKHR> {
+ let mut surface = mem::zeroed();
+ let err_code = self.macos_surface_fn.create_mac_os_surface_mvk(
+ self.handle,
+ create_info,
+ allocation_callbacks.as_raw_ptr(),
+ &mut surface,
+ );
+ match err_code {
+ vk::Result::SUCCESS => Ok(surface),
+ _ => Err(err_code),
+ }
+ }
+
+ pub fn fp(&self) -> &vk::MvkMacosSurfaceFn {
+ &self.macos_surface_fn
+ }
+
+ pub fn instance(&self) -> vk::Instance {
+ self.handle
+ }
+}
diff --git a/third_party/rust/ash/src/extensions/mvk/mod.rs b/third_party/rust/ash/src/extensions/mvk/mod.rs
new file mode 100644
index 0000000000..e475d53563
--- /dev/null
+++ b/third_party/rust/ash/src/extensions/mvk/mod.rs
@@ -0,0 +1,5 @@
+pub use self::ios_surface::IOSSurface;
+pub use self::macos_surface::MacOSSurface;
+
+mod ios_surface;
+mod macos_surface;