internal static unsafe DisplayProperties MarshalFrom(SharpVk.Interop.Khronos.DisplayProperties *pointer) { DisplayProperties result = default(DisplayProperties); result.Display = new SharpVk.Khronos.Display(pointer->Display); result.DisplayName = Interop.HeapUtil.MarshalStringFrom(pointer->DisplayName); result.PhysicalDimensions = pointer->PhysicalDimensions; result.PhysicalResolution = pointer->PhysicalResolution; result.SupportedTransforms = pointer->SupportedTransforms; result.PlaneReorderPossible = pointer->PlaneReorderPossible; result.PersistentContent = pointer->PersistentContent; return(result); }
/// <summary> /// Query information about the available displays. /// </summary> /// <param name="extendedHandle"> /// The PhysicalDevice handle to extend. /// </param> public static unsafe SharpVk.Khronos.DisplayProperties[] GetDisplayProperties(this SharpVk.PhysicalDevice extendedHandle) { try { SharpVk.Khronos.DisplayProperties[] result = default(SharpVk.Khronos.DisplayProperties[]); uint marshalledPropertyCount = default(uint); CommandCache commandCache = default(CommandCache); SharpVk.Interop.Khronos.DisplayProperties *marshalledProperties = default(SharpVk.Interop.Khronos.DisplayProperties *); commandCache = extendedHandle.commandCache; SharpVk.Interop.Khronos.VkPhysicalDeviceGetDisplayPropertiesDelegate commandDelegate = commandCache.Cache.vkGetPhysicalDeviceDisplayPropertiesKHR; Result methodResult = commandDelegate(extendedHandle.handle, &marshalledPropertyCount, marshalledProperties); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } marshalledProperties = (SharpVk.Interop.Khronos.DisplayProperties *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.DisplayProperties>((uint)(marshalledPropertyCount))); commandDelegate(extendedHandle.handle, &marshalledPropertyCount, marshalledProperties); if (marshalledProperties != null) { var fieldPointer = new SharpVk.Khronos.DisplayProperties[(uint)(marshalledPropertyCount)]; for (int index = 0; index < (uint)(marshalledPropertyCount); index++) { fieldPointer[index] = SharpVk.Khronos.DisplayProperties.MarshalFrom(&marshalledProperties[index]); } result = fieldPointer; } else { result = null; } return(result); } finally { Interop.HeapUtil.FreeAll(); } }