Esempio n. 1
0
 /// <summary>
 /// Obtain the array of presentable images associated with a swapchain.
 /// </summary>
 public Image[] GetImages()
 {
     unsafe
     {
         try
         {
             var            commandDelegate = this.commandCache.GetCommandDelegate <Interop.vkGetSwapchainImagesKHR>("vkGetSwapchainImagesKHR", "device");
             Image[]        result          = default(Image[]);
             Result         commandResult;
             uint           swapchainImageCount;
             Interop.Image *marshalledSwapchainImages = null;
             commandResult = commandDelegate(this.associated.handle, this.handle, &swapchainImageCount, null);
             if (SharpVkException.IsError(commandResult))
             {
                 throw SharpVkException.Create(commandResult);
             }
             marshalledSwapchainImages = (Interop.Image *)Interop.HeapUtil.Allocate <Interop.Image>((uint)swapchainImageCount);
             commandResult             = commandDelegate(this.associated.handle, this.handle, &swapchainImageCount, marshalledSwapchainImages);
             if (SharpVkException.IsError(commandResult))
             {
                 throw SharpVkException.Create(commandResult);
             }
             result = new Image[(uint)swapchainImageCount];
             for (int index = 0; index < (uint)swapchainImageCount; index++)
             {
                 result[index] = new Image(marshalledSwapchainImages[index], this.associated, this.commandCache);
             }
             return(result);
         }
         finally
         {
             Interop.HeapUtil.FreeLog();
         }
     }
 }
Esempio n. 2
0
 internal unsafe void MarshalTo(Interop.Image *pointer)
 {
     *pointer = this.handle;
 }