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