Пример #1
0
 /// <summary>
 /// Query surface capabilities.
 /// </summary>
 public SurfaceCapabilities2 GetSurfaceCapabilities2(Surface surface)
 {
     unsafe
     {
         try
         {
             var commandDelegate         = this.commandCache.GetCommandDelegate <Interop.vkGetPhysicalDeviceSurfaceCapabilities2EXT>("vkGetPhysicalDeviceSurfaceCapabilities2EXT", "instance");
             SurfaceCapabilities2 result = default(SurfaceCapabilities2);
             Result          commandResult;
             Interop.Surface marshalledSurface = default(Interop.Surface);
             surface?.MarshalTo(&marshalledSurface);
             Interop.SurfaceCapabilities2 marshalledSurfaceCapabilities;
             commandResult = commandDelegate(this.handle, marshalledSurface, &marshalledSurfaceCapabilities);
             if (SharpVkException.IsError(commandResult))
             {
                 throw SharpVkException.Create(commandResult);
             }
             result = SurfaceCapabilities2.MarshalFrom(&marshalledSurfaceCapabilities);
             return(result);
         }
         finally
         {
             Interop.HeapUtil.FreeLog();
         }
     }
 }
Пример #2
0
 /// <summary>
 /// Query supported presentation modes.
 /// </summary>
 public PresentMode[] GetSurfacePresentModes(Surface surface)
 {
     unsafe
     {
         try
         {
             var             commandDelegate = this.commandCache.GetCommandDelegate <Interop.vkGetPhysicalDeviceSurfacePresentModesKHR>("vkGetPhysicalDeviceSurfacePresentModesKHR", "instance");
             PresentMode[]   result          = default(PresentMode[]);
             Result          commandResult;
             Interop.Surface marshalledSurface = default(Interop.Surface);
             surface?.MarshalTo(&marshalledSurface);
             uint         presentModeCount;
             PresentMode *marshalledPresentModes = null;
             commandResult = commandDelegate(this.handle, marshalledSurface, &presentModeCount, null);
             if (SharpVkException.IsError(commandResult))
             {
                 throw SharpVkException.Create(commandResult);
             }
             marshalledPresentModes = (PresentMode *)Interop.HeapUtil.Allocate <int>((uint)presentModeCount);
             commandResult          = commandDelegate(this.handle, marshalledSurface, &presentModeCount, marshalledPresentModes);
             if (SharpVkException.IsError(commandResult))
             {
                 throw SharpVkException.Create(commandResult);
             }
             result = new PresentMode[(uint)presentModeCount];
             for (int index = 0; index < (uint)presentModeCount; index++)
             {
                 result[index] = marshalledPresentModes[index];
             }
             return(result);
         }
         finally
         {
             Interop.HeapUtil.FreeLog();
         }
     }
 }
Пример #3
0
 /// <summary>
 /// Query if presentation is supported.
 /// </summary>
 public Bool32 GetSurfaceSupport(uint queueFamilyIndex, Surface surface)
 {
     unsafe
     {
         try
         {
             var             commandDelegate = this.commandCache.GetCommandDelegate <Interop.vkGetPhysicalDeviceSurfaceSupportKHR>("vkGetPhysicalDeviceSurfaceSupportKHR", "instance");
             Bool32          result          = default(Bool32);
             Result          commandResult;
             Interop.Surface marshalledSurface = default(Interop.Surface);
             surface?.MarshalTo(&marshalledSurface);
             commandResult = commandDelegate(this.handle, queueFamilyIndex, marshalledSurface, &result);
             if (SharpVkException.IsError(commandResult))
             {
                 throw SharpVkException.Create(commandResult);
             }
             return(result);
         }
         finally
         {
             Interop.HeapUtil.FreeLog();
         }
     }
 }
Пример #4
0
 internal Surface(Interop.Surface handle, Instance parent, CommandCache commandCache)
 {
     this.handle       = handle;
     this.parent       = parent;
     this.commandCache = commandCache;
 }