/// <summary> /// /// </summary> internal static unsafe DisplayModeProperties MarshalFrom(SharpVk.Interop.Khronos.DisplayModeProperties *pointer) { DisplayModeProperties result = default(DisplayModeProperties); result.DisplayMode = new SharpVk.Khronos.DisplayMode(default(SharpVk.PhysicalDevice), pointer->DisplayMode); result.Parameters = pointer->Parameters; return(result); }
/// <summary> /// Query the set of mode properties supported by the display. /// </summary> /// <param name="extendedHandle"> /// The PhysicalDevice handle to extend. /// </param> public static unsafe SharpVk.Khronos.DisplayModeProperties[] GetDisplayModeProperties(this SharpVk.PhysicalDevice extendedHandle, SharpVk.Khronos.Display display) { try { SharpVk.Khronos.DisplayModeProperties[] result = default(SharpVk.Khronos.DisplayModeProperties[]); uint marshalledPropertyCount = default(uint); CommandCache commandCache = default(CommandCache); SharpVk.Interop.Khronos.DisplayModeProperties *marshalledProperties = default(SharpVk.Interop.Khronos.DisplayModeProperties *); commandCache = extendedHandle.commandCache; SharpVk.Interop.Khronos.VkPhysicalDeviceGetDisplayModePropertiesDelegate commandDelegate = commandCache.Cache.vkGetDisplayModePropertiesKHR; Result methodResult = commandDelegate(extendedHandle.handle, display?.handle ?? default(SharpVk.Interop.Khronos.Display), &marshalledPropertyCount, marshalledProperties); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } marshalledProperties = (SharpVk.Interop.Khronos.DisplayModeProperties *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.DisplayModeProperties>((uint)(marshalledPropertyCount))); commandDelegate(extendedHandle.handle, display?.handle ?? default(SharpVk.Interop.Khronos.Display), &marshalledPropertyCount, marshalledProperties); if (marshalledProperties != null) { var fieldPointer = new SharpVk.Khronos.DisplayModeProperties[(uint)(marshalledPropertyCount)]; for (int index = 0; index < (uint)(marshalledPropertyCount); index++) { fieldPointer[index] = SharpVk.Khronos.DisplayModeProperties.MarshalFrom(&marshalledProperties[index]); } result = fieldPointer; } else { result = null; } return(result); } finally { Interop.HeapUtil.FreeAll(); } }