C Specification
A logical device is created as a connection to a physical device. To create a logical device, call:
// Provided by VK_VERSION_1_0
VkResult vkCreateDevice(
VkPhysicalDevice physicalDevice,
const VkDeviceCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkDevice* pDevice);
Parameters
-
physicalDevicemust be one of the device handles returned from a call tovkEnumeratePhysicalDevices(see Physical Device Enumeration). -
pCreateInfois a pointer to a VkDeviceCreateInfo structure containing information about how to create the device. -
pAllocatorcontrols host memory allocation as described in the Memory Allocation chapter. -
pDeviceis a pointer to a handle in which the created VkDevice is returned.
Description
vkCreateDevice verifies that extensions and features requested in the
ppEnabledExtensionNames and pEnabledFeatures members of
pCreateInfo, respectively, are supported by the implementation.
If any requested extension is not supported, vkCreateDevice must
return VK_ERROR_EXTENSION_NOT_PRESENT.
If any requested feature is not supported, vkCreateDevice must return
VK_ERROR_FEATURE_NOT_PRESENT.
Support for extensions can be checked before creating a device by querying
vkEnumerateDeviceExtensionProperties.
Support for features can similarly be checked by querying
vkGetPhysicalDeviceFeatures.
vkCreateDevice also verifies that mandatory structures and features
for Vulkan SC are present and enabled:
-
The
pNextchain must include a VkDeviceObjectReservationCreateInfo structure. -
The
pNextchain must include a VkPhysicalDeviceVulkanSC10Features structure.
If any of these conditions are not met, vkCreateDevice must return
VK_ERROR_INITIALIZATION_FAILED.
After verifying and enabling the extensions the VkDevice object is
created and returned to the application.
An implementation may allow multiple logical devices to be created from the
same physical device.
Logical device creation may fail due to lack of device-specific resources,
including too many other logical devices, in addition to other errors.
If that occurs, vkCreateDevice will return
VK_ERROR_TOO_MANY_OBJECTS.
If the pipeline cache data pointed to by the pInitialData member of
any element of
VkDeviceObjectReservationCreateInfo::pPipelineCacheCreateInfos
is not compatible with the device, then vkCreateDevice will return
VK_ERROR_INVALID_PIPELINE_CACHE_DATA.
Some implementations may only accept pipeline cache data pointers that
conform to platform and/or implementation specific alignment requirements.
These alignment requirements cannot exceed 8 bytes.
If any of the pipeline cache data pointers specified in the
pInitialData member of the elements of
VkDeviceObjectReservationCreateInfo::pPipelineCacheCreateInfos
are not aligned according to these requirements, then vkCreateDevice
will return VK_ERROR_INVALID_PIPELINE_CACHE_DATA.
To provide application parameters at device creation time, an application
can link one or more VkApplicationParametersEXT structures to the
pNext chain of the VkDeviceCreateInfo structure.
If the VkApplicationParametersEXT::vendorID and
VkApplicationParametersEXT::deviceID values do not match the
VkPhysicalDeviceProperties::vendorID and
VkPhysicalDeviceProperties::deviceID of physicalDevice,
vkCreateDevice must return VK_ERROR_INITIALIZATION_FAILED.
If VkApplicationParametersEXT::key is not a valid
implementation-defined application parameter key for the device being
created, or if value is not a valid value for the specified key,
vkCreateDevice will fail and return
VK_ERROR_INITIALIZATION_FAILED.
For any implementation-defined application parameter key that exists
but is not set by the application, the implementation-specific default value
is used.
Document Notes
For more information, see the Vulkan Specification.
This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.