/// <summary> /// /// </summary> internal unsafe void MarshalTo(SharpVk.Interop.MoltenVk.IOSSurfaceCreateInfo *pointer) { pointer->SType = StructureType.IosSurfaceCreateInfo; pointer->Next = null; if (this.Flags != null) { pointer->Flags = this.Flags.Value; } else { pointer->Flags = default(SharpVk.MoltenVk.IOSSurfaceCreateFlags); } pointer->View = this.View.ToPointer(); }
/// <summary> /// Create a SurfaceKHR object for an iOS UIView. /// </summary> /// <param name="extendedHandle"> /// The Instance handle to extend. /// </param> /// <param name="flags"> /// Reserved for future use. /// </param> /// <param name="view"> /// A reference to a UIView object which will display this surface. /// This UIView must be backed by a CALayer instance of type /// CAMetalLayer. /// </param> /// <param name="allocator"> /// An optional AllocationCallbacks instance that controls host memory /// allocation. /// </param> public static unsafe SharpVk.Khronos.Surface CreateIOSSurface(this SharpVk.Instance extendedHandle, IntPtr view, SharpVk.MoltenVk.IOSSurfaceCreateFlags?flags = default(SharpVk.MoltenVk.IOSSurfaceCreateFlags?), SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?)) { try { SharpVk.Khronos.Surface result = default(SharpVk.Khronos.Surface); CommandCache commandCache = default(CommandCache); SharpVk.Interop.MoltenVk.IOSSurfaceCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.MoltenVk.IOSSurfaceCreateInfo *); void *vkIOSSurfaceCreateInfoMVKNextPointer = default(void *); SharpVk.Interop.AllocationCallbacks *marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *); SharpVk.Interop.Khronos.Surface marshalledSurface = default(SharpVk.Interop.Khronos.Surface); commandCache = extendedHandle.commandCache; marshalledCreateInfo = (SharpVk.Interop.MoltenVk.IOSSurfaceCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.MoltenVk.IOSSurfaceCreateInfo>()); marshalledCreateInfo->SType = StructureType.IosSurfaceCreateInfo; marshalledCreateInfo->Next = vkIOSSurfaceCreateInfoMVKNextPointer; if (flags != null) { marshalledCreateInfo->Flags = flags.Value; } else { marshalledCreateInfo->Flags = default(SharpVk.MoltenVk.IOSSurfaceCreateFlags); } marshalledCreateInfo->View = view.ToPointer(); if (allocator != null) { marshalledAllocator = (SharpVk.Interop.AllocationCallbacks *)(Interop.HeapUtil.Allocate <SharpVk.Interop.AllocationCallbacks>()); allocator.Value.MarshalTo(marshalledAllocator); } else { marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *); } SharpVk.Interop.MoltenVk.VkInstanceCreateIOSSurfaceDelegate commandDelegate = commandCache.Cache.vkCreateIOSSurfaceMVK; Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledSurface); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } result = new SharpVk.Khronos.Surface(extendedHandle, marshalledSurface); return(result); } finally { Interop.HeapUtil.FreeAll(); } }