示例#1
0
 /// <summary>
 /// Enumerates the physical devices accessible to a Vulkan instance.
 /// </summary>
 public PhysicalDevice[] EnumeratePhysicalDevices()
 {
     unsafe
     {
         try
         {
             PhysicalDevice[]        result = default(PhysicalDevice[]);
             Result                  commandResult;
             uint                    physicalDeviceCount;
             Interop.PhysicalDevice *marshalledPhysicalDevices = null;
             commandResult = Interop.Commands.vkEnumeratePhysicalDevices(this.handle, &physicalDeviceCount, null);
             if (SharpVkException.IsError(commandResult))
             {
                 throw SharpVkException.Create(commandResult);
             }
             marshalledPhysicalDevices = (Interop.PhysicalDevice *)Interop.HeapUtil.Allocate <Interop.PhysicalDevice>((uint)physicalDeviceCount);
             commandResult             = Interop.Commands.vkEnumeratePhysicalDevices(this.handle, &physicalDeviceCount, marshalledPhysicalDevices);
             if (SharpVkException.IsError(commandResult))
             {
                 throw SharpVkException.Create(commandResult);
             }
             result = new PhysicalDevice[(uint)physicalDeviceCount];
             for (int index = 0; index < (uint)physicalDeviceCount; index++)
             {
                 result[index] = new PhysicalDevice(marshalledPhysicalDevices[index], this, this.commandCache);
             }
             return(result);
         }
         finally
         {
             Interop.HeapUtil.FreeLog();
         }
     }
 }
示例#2
0
 internal unsafe void MarshalTo(Interop.PhysicalDevice *pointer)
 {
     *pointer = this.handle;
 }