1// Copyright (c) 2016-2018 Khronos Group. This work is licensed under a 2// Creative Commons Attribution 4.0 International License; see 3// http://creativecommons.org/licenses/by/4.0/ 4 5include::meta/VK_KHR_device_group_creation.txt[] 6 7*Last Modified Date*:: 8 2016-10-19 9*IP Status*:: 10 No known IP claims. 11*Interactions and External Dependencies*:: 12 - Promoted to Vulkan 1.1 Core 13*Contributors*:: 14 - Jeff Bolz, NVIDIA 15 16This extension provides instance-level commands to enumerate groups of 17physical devices, and to create a logical device from a subset of one of 18those groups. 19Such a logical device can then be used with new features in the 20`<<VK_KHR_device_group>>` extension. 21 22=== New Object Types 23 24None. 25 26=== New Enum Constants 27 28 * Extending elink:VkStructureType: 29 ** ename:VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES_KHR 30 * Extending elink:VkMemoryHeapFlagBits 31 ** ename:VK_MEMORY_HEAP_MULTI_INSTANCE_BIT_KHR 32 33 34=== New Enums 35 36None. 37 38=== New Structures 39 40 * slink:VkPhysicalDeviceGroupPropertiesKHR 41 * slink:VkDeviceGroupDeviceCreateInfoKHR 42 43=== New Functions 44 45 * flink:vkEnumeratePhysicalDeviceGroupsKHR 46 47=== Promotion to Vulkan 1.1 48 49All functionality in this extension is included in core Vulkan 1.1, with the 50KHR suffix omitted. 51The original type, enum and command names are still available as aliases of 52the core functionality. 53 54=== Issues 55 56None. 57 58=== Examples 59 60[source,c++] 61---------------------------------------- 62 63 VkDeviceCreateInfo devCreateInfo = { VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO }; 64 // (not shown) fill out devCreateInfo as usual. 65 uint32_t deviceGroupCount = 0; 66 VkPhysicalDeviceGroupPropertiesKHR *props = NULL; 67 68 // Query the number of device groups 69 vkEnumeratePhysicalDeviceGroupsKHR(g_vkInstance, &deviceGroupCount, NULL); 70 71 // Allocate and initialize structures to query the device groups 72 props = (VkPhysicalDeviceGroupPropertiesKHR *)malloc(deviceGroupCount*sizeof(VkPhysicalDeviceGroupPropertiesKHR)); 73 for (i = 0; i < deviceGroupCount; ++i) { 74 props[i].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES_KHR; 75 props[i].pNext = NULL; 76 } 77 vkEnumeratePhysicalDeviceGroupsKHR(g_vkInstance, &deviceGroupCount, props); 78 79 // If the first device group has more than one physical device. create 80 // a logical device using all of the physical devices. 81 VkDeviceGroupDeviceCreateInfoKHR deviceGroupInfo = { VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO_KHR }; 82 if (props[0].physicalDeviceCount > 1) { 83 deviceGroupInfo.physicalDeviceCount = props[0].physicalDeviceCount; 84 deviceGroupInfo.pPhysicalDevices = props[0].physicalDevices; 85 devCreateInfo.pNext = &deviceGroupInfo; 86 } 87 88 vkCreateDevice(props[0].physicalDevices[0], &devCreateInfo, NULL, &g_vkDevice); 89 free(props); 90 91---------------------------------------- 92 93=== Version History 94 95 * Revision 1, 2016-10-19 (Jeff Bolz) 96 - Internal revisions 97