Vulkan-Docs/doc/specs/vulkan/appendices/VK_KHX_device_group_creatio...

88 lines
2.6 KiB
Plaintext

// Copyright (c) 2016-2017 Khronos Group. This work is licensed under a
// Creative Commons Attribution 4.0 International License; see
// http://creativecommons.org/licenses/by/4.0/
include::meta/VK_KHX_device_group_creation.txt[]
*Last Modified Date*::
2016-10-19
*IP Status*::
No known IP claims.
*Contributors*::
- Jeff Bolz, NVIDIA
This extension provides instance-level commands to enumerate groups of
physical devices, and to create a logical device from a subset of one of
those groups.
Such a logical device can then be used with new features in the
VK_KHX_device_group extension.
=== New Object Types
None.
=== New Enum Constants
* Extending elink:VkStructureType:
** ename:VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES_KHX
* Extending elink:VkMemoryHeapFlagBits
** ename:VK_MEMORY_HEAP_MULTI_INSTANCE_BIT_KHX
=== New Enums
None.
=== New Structures
* slink:VkPhysicalDeviceGroupPropertiesKHX
* slink:VkDeviceGroupDeviceCreateInfoKHX
=== New Functions
* flink:vkEnumeratePhysicalDeviceGroupsKHX
=== Issues
None.
=== Examples
[source,c++]
----------------------------------------
VkDeviceCreateInfo devCreateInfo = { VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO };
// (not shown) fill out devCreateInfo as usual.
uint32_t deviceGroupCount = 0;
VkPhysicalDeviceGroupPropertiesKHX *props = NULL;
// Query the number of device groups
vkEnumeratePhysicalDeviceGroupsKHX(g_vkInstance, &deviceGroupCount, NULL);
// Allocate and initialize structures to query the device groups
props = (VkPhysicalDeviceGroupPropertiesKHX *)malloc(deviceGroupCount*sizeof(VkPhysicalDeviceGroupPropertiesKHX));
for (i = 0; i < deviceGroupCount; ++i) {
props[i].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES_KHX;
props[i].pNext = NULL;
}
vkEnumeratePhysicalDeviceGroupsKHX(g_vkInstance, &deviceGroupCount, props);
// If the first device group has more than one physical device. create
// a logical device using all of the physical devices.
VkDeviceGroupDeviceCreateInfoKHX deviceGroupInfo = { VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO_KHX };
if (props[0].physicalDeviceCount > 1) {
deviceGroupInfo.physicalDeviceCount = props[0].physicalDeviceCount;
deviceGroupInfo.pPhysicalDevices = props[0].physicalDevices;
devCreateInfo.pNext = &deviceGroupInfo;
}
vkCreateDevice(props[0].physicalDevices[0], &devCreateInfo, NULL, &g_vkDevice);
free(props);
----------------------------------------
=== Version History
* Revision 1, 2016-10-19 (Jeff Bolz)
- Internal revisions