• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2016-2021 The Khronos Group, Inc.
2//
3// SPDX-License-Identifier: CC-BY-4.0
4
5include::{generated}/meta/{refprefix}VK_KHR_device_group_creation.txt[]
6
7=== Other Extension Metadata
8
9*Last Modified Date*::
10    2016-10-19
11*IP Status*::
12    No known IP claims.
13*Interactions and External Dependencies*::
14  - Promoted to Vulkan 1.1 Core
15*Contributors*::
16  - Jeff Bolz, NVIDIA
17
18=== Description
19
20This extension provides instance-level commands to enumerate groups of
21physical devices, and to create a logical device from a subset of one of
22those groups.
23Such a logical device can then be used with new features in the
24`apiext:VK_KHR_device_group` extension.
25
26=== Promotion to Vulkan 1.1
27
28All functionality in this extension is included in core Vulkan 1.1, with the
29KHR suffix omitted.
30The original type, enum and command names are still available as aliases of
31the core functionality.
32
33include::{generated}/interfaces/VK_KHR_device_group_creation.txt[]
34
35=== Examples
36
37[source,c++]
38----------------------------------------
39
40    VkDeviceCreateInfo devCreateInfo = { VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO };
41    // (not shown) fill out devCreateInfo as usual.
42    uint32_t deviceGroupCount = 0;
43    VkPhysicalDeviceGroupPropertiesKHR *props = NULL;
44
45    // Query the number of device groups
46    vkEnumeratePhysicalDeviceGroupsKHR(g_vkInstance, &deviceGroupCount, NULL);
47
48    // Allocate and initialize structures to query the device groups
49    props = (VkPhysicalDeviceGroupPropertiesKHR *)malloc(deviceGroupCount*sizeof(VkPhysicalDeviceGroupPropertiesKHR));
50    for (i = 0; i < deviceGroupCount; ++i) {
51        props[i].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES_KHR;
52        props[i].pNext = NULL;
53    }
54    vkEnumeratePhysicalDeviceGroupsKHR(g_vkInstance, &deviceGroupCount, props);
55
56    // If the first device group has more than one physical device. create
57    // a logical device using all of the physical devices.
58    VkDeviceGroupDeviceCreateInfoKHR deviceGroupInfo = { VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO_KHR };
59    if (props[0].physicalDeviceCount > 1) {
60        deviceGroupInfo.physicalDeviceCount = props[0].physicalDeviceCount;
61        deviceGroupInfo.pPhysicalDevices = props[0].physicalDevices;
62        devCreateInfo.pNext = &deviceGroupInfo;
63    }
64
65    vkCreateDevice(props[0].physicalDevices[0], &devCreateInfo, NULL, &g_vkDevice);
66    free(props);
67
68----------------------------------------
69
70=== Version History
71
72 * Revision 1, 2016-10-19 (Jeff Bolz)
73   - Internal revisions
74