Andrew Williamson
Andrew Williamson

Reputation: 8661

Is it valid to create two VkDevices from the same VkPhysicalDevice?

I'm writing a C++ wrapper for the Vulkan API, so I want to make sure my documentation doesn't contradict what the actual API says.

Device device1 = physical_device.Connect(device_settings);
Device device2 = physical_device.Connect(device_settings);

This scenario works, even when running with the LunarG standard validation layer enabled. But there's a lot of things that currently get through the validation layer, despite being incorrect. So my question is, is it valid to do this?

Upvotes: 0

Views: 466

Answers (1)

Nicol Bolas
Nicol Bolas

Reputation: 473447

From the specification under vkCreateDevice:

Multiple logical devices can be created from the same physical device.

Not that it needed to say that, since the "Valid Usage" section of the document does not explicitly forbid it. Granted, the next sentence is:

Logical device creation may fail due to lack of device-specific resources (in addition to the other errors).

So you can't create infinite VkDevice objects from the same VkPhysicalDevice. If the implementation doesn't want to support more than one, it does not have to.

Upvotes: 4

Related Questions