コード例 #1
0
 /// <summary>
 /// Create a display mode.
 /// </summary>
 public DisplayMode CreateDisplayMode(Display display, DisplayModeCreateInfo createInfo)
 {
     unsafe
     {
         try
         {
             var             commandDelegate = this.commandCache.GetCommandDelegate <Interop.vkCreateDisplayModeKHR>("vkCreateDisplayModeKHR", "instance");
             DisplayMode     result          = default(DisplayMode);
             Result          commandResult;
             Interop.Display marshalledDisplay = default(Interop.Display);
             display?.MarshalTo(&marshalledDisplay);
             Interop.DisplayModeCreateInfo marshalledCreateInfo;
             createInfo.MarshalTo(&marshalledCreateInfo);
             Interop.AllocationCallbacks marshalledAllocator;
             this.parent.Allocator?.MarshalTo(&marshalledAllocator);
             Interop.DisplayMode marshalledMode;
             commandResult = commandDelegate(this.handle, marshalledDisplay, &marshalledCreateInfo, this.parent.Allocator == null ? null : &marshalledAllocator, &marshalledMode);
             if (SharpVkException.IsError(commandResult))
             {
                 throw SharpVkException.Create(commandResult);
             }
             result = new DisplayMode(marshalledMode, this, this.commandCache);
             return(result);
         }
         finally
         {
             Interop.HeapUtil.FreeLog();
         }
     }
 }
コード例 #2
0
 /// <summary>
 /// Acquire access to a VkDisplayKHR using Xlib.
 /// </summary>
 public void AcquireXlibDisplay(IntPtr dpy, Display display)
 {
     unsafe
     {
         try
         {
             var             commandDelegate = this.commandCache.GetCommandDelegate <Interop.vkAcquireXlibDisplayEXT>("vkAcquireXlibDisplayEXT", "instance");
             Result          commandResult;
             Interop.Display marshalledDisplay = default(Interop.Display);
             display?.MarshalTo(&marshalledDisplay);
             commandResult = commandDelegate(this.handle, &dpy, marshalledDisplay);
             if (SharpVkException.IsError(commandResult))
             {
                 throw SharpVkException.Create(commandResult);
             }
         }
         finally
         {
             Interop.HeapUtil.FreeLog();
         }
     }
 }
コード例 #3
0
 /// <summary>
 /// Query the set of mode properties supported by the display.
 /// </summary>
 public DisplayModeProperties[] GetDisplayModeProperties(Display display)
 {
     unsafe
     {
         try
         {
             var commandDelegate            = this.commandCache.GetCommandDelegate <Interop.vkGetDisplayModePropertiesKHR>("vkGetDisplayModePropertiesKHR", "instance");
             DisplayModeProperties[] result = default(DisplayModeProperties[]);
             Result          commandResult;
             Interop.Display marshalledDisplay = default(Interop.Display);
             display?.MarshalTo(&marshalledDisplay);
             uint propertyCount;
             Interop.DisplayModeProperties *marshalledProperties = null;
             commandResult = commandDelegate(this.handle, marshalledDisplay, &propertyCount, null);
             if (SharpVkException.IsError(commandResult))
             {
                 throw SharpVkException.Create(commandResult);
             }
             marshalledProperties = (Interop.DisplayModeProperties *)Interop.HeapUtil.Allocate <Interop.DisplayModeProperties>((uint)propertyCount);
             commandResult        = commandDelegate(this.handle, marshalledDisplay, &propertyCount, marshalledProperties);
             if (SharpVkException.IsError(commandResult))
             {
                 throw SharpVkException.Create(commandResult);
             }
             result = new DisplayModeProperties[(uint)propertyCount];
             for (int index = 0; index < (uint)propertyCount; index++)
             {
                 result[index] = DisplayModeProperties.MarshalFrom(&marshalledProperties[index]);
             }
             return(result);
         }
         finally
         {
             Interop.HeapUtil.FreeLog();
         }
     }
 }
コード例 #4
0
ファイル: Display.cs プロジェクト: yongweisun/SharpVk
 internal Display(Interop.Display handle, AllocationCallbacks?allocator, CommandCache commandCache)
 {
     this.handle       = handle;
     this.allocator    = allocator;
     this.commandCache = commandCache;
 }