Ejemplo n.º 1
0
 public Extent2D ChooseSwapExtent(SurfaceCapabilities capabilities)
 {
     if (capabilities.CurrentExtent.Width != uint.MaxValue)
     {
         return(capabilities.CurrentExtent);
     }
     else
     {
         return(new Extent2D
         {
             Width = Math.Max(capabilities.MinImageExtent.Width, Math.Min(capabilities.MaxImageExtent.Width, SurfaceWidth)),
             Height = Math.Max(capabilities.MinImageExtent.Height, Math.Min(capabilities.MaxImageExtent.Height, SurfaceHeight))
         });
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Query surface capabilities.
 /// </summary>
 public SurfaceCapabilities GetSurfaceCapabilities(Surface surface)
 {
     unsafe
     {
         try
         {
             var commandDelegate        = this.commandCache.GetCommandDelegate <Interop.vkGetPhysicalDeviceSurfaceCapabilitiesKHR>("vkGetPhysicalDeviceSurfaceCapabilitiesKHR", "instance");
             SurfaceCapabilities result = default(SurfaceCapabilities);
             Result          commandResult;
             Interop.Surface marshalledSurface = default(Interop.Surface);
             surface?.MarshalTo(&marshalledSurface);
             commandResult = commandDelegate(this.handle, marshalledSurface, &result);
             if (SharpVkException.IsError(commandResult))
             {
                 throw SharpVkException.Create(commandResult);
             }
             return(result);
         }
         finally
         {
             Interop.HeapUtil.FreeLog();
         }
     }
 }