internal static unsafe SurfaceFormat2 MarshalFrom(SharpVk.Interop.Khronos.SurfaceFormat2 *pointer) { SurfaceFormat2 result = default(SurfaceFormat2); result.SurfaceFormat = pointer->SurfaceFormat; return(result); }
/// <summary> /// /// </summary> /// <param name="extendedHandle"> /// The PhysicalDevice handle to extend. /// </param> public static unsafe SharpVk.Khronos.SurfaceFormat2[] GetSurfaceFormats2(this SharpVk.PhysicalDevice extendedHandle, SharpVk.Khronos.PhysicalDeviceSurfaceInfo2 surfaceInfo) { try { SharpVk.Khronos.SurfaceFormat2[] result = default(SharpVk.Khronos.SurfaceFormat2[]); uint marshalledSurfaceFormatCount = default(uint); CommandCache commandCache = default(CommandCache); SharpVk.Interop.Khronos.PhysicalDeviceSurfaceInfo2 *marshalledSurfaceInfo = default(SharpVk.Interop.Khronos.PhysicalDeviceSurfaceInfo2 *); SharpVk.Interop.Khronos.SurfaceFormat2 * marshalledSurfaceFormats = default(SharpVk.Interop.Khronos.SurfaceFormat2 *); commandCache = extendedHandle.commandCache; marshalledSurfaceInfo = (SharpVk.Interop.Khronos.PhysicalDeviceSurfaceInfo2 *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.PhysicalDeviceSurfaceInfo2>()); surfaceInfo.MarshalTo(marshalledSurfaceInfo); SharpVk.Interop.Khronos.VkPhysicalDeviceGetSurfaceFormats2Delegate commandDelegate = commandCache.Cache.vkGetPhysicalDeviceSurfaceFormats2KHR; Result methodResult = commandDelegate(extendedHandle.handle, marshalledSurfaceInfo, &marshalledSurfaceFormatCount, marshalledSurfaceFormats); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } marshalledSurfaceFormats = (SharpVk.Interop.Khronos.SurfaceFormat2 *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.SurfaceFormat2>((uint)(marshalledSurfaceFormatCount))); commandDelegate(extendedHandle.handle, marshalledSurfaceInfo, &marshalledSurfaceFormatCount, marshalledSurfaceFormats); if (marshalledSurfaceFormats != null) { var fieldPointer = new SharpVk.Khronos.SurfaceFormat2[(uint)(marshalledSurfaceFormatCount)]; for (int index = 0; index < (uint)(marshalledSurfaceFormatCount); index++) { fieldPointer[index] = SharpVk.Khronos.SurfaceFormat2.MarshalFrom(&marshalledSurfaceFormats[index]); } result = fieldPointer; } else { result = null; } return(result); } finally { Interop.HeapUtil.FreeAll(); } }