コード例 #1
0
        internal static unsafe PhysicalDeviceGroupProperties MarshalFrom(SharpVk.Interop.Khronos.Experimental.PhysicalDeviceGroupProperties *pointer)
        {
            PhysicalDeviceGroupProperties result = default(PhysicalDeviceGroupProperties);

            if (pointer->PhysicalDeviceCount != 0)
            {
                var fieldPointer = new SharpVk.PhysicalDevice[(uint)(pointer->PhysicalDeviceCount)];
                for (int index = 0; index < (uint)(pointer->PhysicalDeviceCount); index++)
                {
                    fieldPointer[index] = new SharpVk.PhysicalDevice(default(SharpVk.Instance), (&(pointer->PhysicalDevices_0))[index]);
                }
                result.PhysicalDevices = fieldPointer;
            }
            else
            {
                result.PhysicalDevices = null;
            }
            result.SubsetAllocation = pointer->SubsetAllocation;
            return(result);
        }
コード例 #2
0
 /// <summary>
 /// Enumerates groups of physical devices that can be used to create a
 /// single logical device.
 /// </summary>
 /// <param name="extendedHandle">
 /// The Instance handle to extend.
 /// </param>
 public static unsafe SharpVk.Khronos.Experimental.PhysicalDeviceGroupProperties[] EnumeratePhysicalDeviceGroups(this SharpVk.Instance extendedHandle)
 {
     try
     {
         SharpVk.Khronos.Experimental.PhysicalDeviceGroupProperties[] result = default(SharpVk.Khronos.Experimental.PhysicalDeviceGroupProperties[]);
         uint         physicalDeviceGroupCount = default(uint);
         CommandCache commandCache             = default(CommandCache);
         SharpVk.Interop.Khronos.Experimental.PhysicalDeviceGroupProperties *marshalledPhysicalDeviceGroupProperties = default(SharpVk.Interop.Khronos.Experimental.PhysicalDeviceGroupProperties *);
         commandCache = extendedHandle.commandCache;
         SharpVk.Interop.Khronos.Experimental.VkInstanceEnumeratePhysicalDeviceGroupsDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Khronos.Experimental.VkInstanceEnumeratePhysicalDeviceGroupsDelegate>("vkEnumeratePhysicalDeviceGroupsKHX", "instance");
         Result methodResult = commandDelegate(extendedHandle.handle, &physicalDeviceGroupCount, marshalledPhysicalDeviceGroupProperties);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         marshalledPhysicalDeviceGroupProperties = (SharpVk.Interop.Khronos.Experimental.PhysicalDeviceGroupProperties *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.Experimental.PhysicalDeviceGroupProperties>((uint)(physicalDeviceGroupCount)));
         commandDelegate(extendedHandle.handle, &physicalDeviceGroupCount, marshalledPhysicalDeviceGroupProperties);
         if (marshalledPhysicalDeviceGroupProperties != null)
         {
             var fieldPointer = new SharpVk.Khronos.Experimental.PhysicalDeviceGroupProperties[(uint)(physicalDeviceGroupCount)];
             for (int index = 0; index < (uint)(physicalDeviceGroupCount); index++)
             {
                 fieldPointer[index] = SharpVk.Khronos.Experimental.PhysicalDeviceGroupProperties.MarshalFrom(&marshalledPhysicalDeviceGroupProperties[index]);
             }
             result = fieldPointer;
         }
         else
         {
             result = null;
         }
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }