internal static void FromNative(ref Native native, Instance instance, out PhysicalDeviceGroupPropertiesKhx managed)
 {
     managed.Next            = native.Next;
     managed.PhysicalDevices = new PhysicalDevice[native.PhysicalDeviceCount];
     for (int i = 0; i < native.PhysicalDeviceCount; i++)
     {
         managed.PhysicalDevices[i] = new PhysicalDevice(native.PhysicalDevices[i], instance);
     }
     managed.SubsetAllocation = native.SubsetAllocation;
 }
        /// <summary>
        /// Enumerates groups of physical devices that can be used to create a single logical device.
        /// </summary>
        /// <param name="instance">A handle to a previously created Vulkan instance.</param>
        /// <returns>An array of <see cref="PhysicalDeviceGroupPropertiesKhx"/> structures.</returns>
        /// <exception cref="VulkanException">Vulkan returns an error code.</exception>
        public static PhysicalDeviceGroupPropertiesKhx[] EnumeratePhysicalDeviceGroupsKhx(this Instance instance)
        {
            int    count;
            Result result = vkEnumeratePhysicalDeviceGroupsKHX(instance)(instance, &count, null);

            VulkanException.ThrowForInvalidResult(result);

            var nativeProperties = new PhysicalDeviceGroupPropertiesKhx.Native[count];

            result = vkEnumeratePhysicalDeviceGroupsKHX(instance)(instance, &count, nativeProperties);
            VulkanException.ThrowForInvalidResult(result);

            var groupProperties = new PhysicalDeviceGroupPropertiesKhx[count];

            for (int i = 0; i < count; i++)
            {
                PhysicalDeviceGroupPropertiesKhx.FromNative(ref nativeProperties[i], instance, out groupProperties[i]);
            }
            return(groupProperties);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Enumerates groups of physical devices that can be used to create a single logical device.
        /// </summary>
        /// <param name="instance">A handle to a previously created Vulkan instance.</param>
        /// <returns>An array of <see cref="PhysicalDeviceGroupPropertiesKhx"/> structures.</returns>
        /// <exception cref="VulkanException">Vulkan returns an error code.</exception>
        public static PhysicalDeviceGroupPropertiesKhx[] EnumeratePhysicalDeviceGroupsKhx(this Instance instance)
        {
            int    count;
            Result result = vkEnumeratePhysicalDeviceGroupsKHX(instance, &count, null);

            VulkanException.ThrowForInvalidResult(result);

            var nativeProperties = stackalloc PhysicalDeviceGroupPropertiesKhx.Native[count];

            result = vkEnumeratePhysicalDeviceGroupsKHX(instance, &count, nativeProperties);
            VulkanException.ThrowForInvalidResult(result);

            var groupProperties = new PhysicalDeviceGroupPropertiesKhx[count];

            for (int i = 0; i < count; i++)
            {
                ref PhysicalDeviceGroupPropertiesKhx.Native nativeProps = ref nativeProperties[i];
                var devices = new PhysicalDevice[nativeProps.PhysicalDeviceCount];
                for (int j = 0; j < nativeProps.PhysicalDeviceCount; j++)
                {
                    devices[j] = new PhysicalDevice(nativeProps.PhysicalDevices[j], instance);
                }
                PhysicalDeviceGroupPropertiesKhx.FromNative(ref nativeProps, devices, out groupProperties[i]);
            }