/// <summary> /// Obtain the array of presentable images associated with a swapchain. /// </summary> public unsafe SharpVk.Image[] GetImages() { try { SharpVk.Image[] result = default(SharpVk.Image[]); uint swapchainImageCount = default(uint); SharpVk.Interop.Image *marshalledSwapchainImages = default(SharpVk.Interop.Image *); SharpVk.Interop.Khronos.VkSwapchainKHRGetImagesDelegate commandDelegate = commandCache.Cache.vkGetSwapchainImagesKHR; Result methodResult = commandDelegate(this.parent.handle, this.handle, &swapchainImageCount, marshalledSwapchainImages); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } marshalledSwapchainImages = (SharpVk.Interop.Image *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Image>((uint)(swapchainImageCount))); commandDelegate(this.parent.handle, this.handle, &swapchainImageCount, marshalledSwapchainImages); if (marshalledSwapchainImages != null) { var fieldPointer = new SharpVk.Image[(uint)(swapchainImageCount)]; for (int index = 0; index < (uint)(swapchainImageCount); index++) { fieldPointer[index] = new SharpVk.Image(this.parent, marshalledSwapchainImages[index]); } result = fieldPointer; } else { result = null; } return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> public unsafe void ResolveImage(SharpVk.Image sourceImage, SharpVk.ImageLayout sourceImageLayout, SharpVk.Image destinationImage, SharpVk.ImageLayout destinationImageLayout, SharpVk.ImageResolve[] regions) { try { SharpVk.ImageResolve *marshalledRegions = default(SharpVk.ImageResolve *); if (regions != null) { var fieldPointer = (SharpVk.ImageResolve *)(Interop.HeapUtil.AllocateAndClear <SharpVk.ImageResolve>(regions.Length).ToPointer()); for (int index = 0; index < (uint)(regions.Length); index++) { fieldPointer[index] = regions[index]; } marshalledRegions = fieldPointer; } else { marshalledRegions = null; } Interop.Commands.vkCmdResolveImage(this.handle, sourceImage?.handle ?? default(SharpVk.Interop.Image), sourceImageLayout, destinationImage?.handle ?? default(SharpVk.Interop.Image), destinationImageLayout, (uint)(regions?.Length ?? 0), marshalledRegions); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> public unsafe void ClearDepthStencilImage(SharpVk.Image image, SharpVk.ImageLayout imageLayout, SharpVk.ClearDepthStencilValue depthStencil, SharpVk.ImageSubresourceRange[] ranges) { try { SharpVk.ClearDepthStencilValue *marshalledDepthStencil = default(SharpVk.ClearDepthStencilValue *); SharpVk.ImageSubresourceRange * marshalledRanges = default(SharpVk.ImageSubresourceRange *); marshalledDepthStencil = (SharpVk.ClearDepthStencilValue *)(Interop.HeapUtil.Allocate <SharpVk.ClearDepthStencilValue>()); *marshalledDepthStencil = depthStencil; if (ranges != null) { var fieldPointer = (SharpVk.ImageSubresourceRange *)(Interop.HeapUtil.AllocateAndClear <SharpVk.ImageSubresourceRange>(ranges.Length).ToPointer()); for (int index = 0; index < (uint)(ranges.Length); index++) { fieldPointer[index] = ranges[index]; } marshalledRanges = fieldPointer; } else { marshalledRanges = null; } Interop.Commands.vkCmdClearDepthStencilImage(this.handle, image?.handle ?? default(SharpVk.Interop.Image), imageLayout, marshalledDepthStencil, (uint)(ranges?.Length ?? 0), marshalledRanges); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> /// <param name="extendedHandle"> /// The Image handle to extend. /// </param> public static unsafe SharpVk.Multivendor.ImageDrmFormatModifierProperties GetDrmFormatModifierProperties(this SharpVk.Image extendedHandle) { try { SharpVk.Multivendor.ImageDrmFormatModifierProperties result = default(SharpVk.Multivendor.ImageDrmFormatModifierProperties); CommandCache commandCache = default(CommandCache); SharpVk.Interop.Multivendor.ImageDrmFormatModifierProperties marshalledProperties = default(SharpVk.Interop.Multivendor.ImageDrmFormatModifierProperties); commandCache = extendedHandle.commandCache; SharpVk.Interop.Multivendor.VkImageGetDrmFormatModifierPropertiesDelegate commandDelegate = commandCache.Cache.vkGetImageDrmFormatModifierPropertiesEXT; Result methodResult = commandDelegate(extendedHandle.parent.handle, extendedHandle.handle, &marshalledProperties); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } result = SharpVk.Multivendor.ImageDrmFormatModifierProperties.MarshalFrom(&marshalledProperties); return(result); } finally { Interop.HeapUtil.FreeAll(); } }