The team at LunarG has been working hard to improve the Vulkan ecosystem.  Today we’re introducing a new Vulkan layer.  The Device Simulation (DevSim) Layer simplifies application testing over a wide range of simulated device capabilities, without requiring an actual physical copy of every device.

This layer modifies the results of Vulkan PhysicalDevice queries based on a JSON configuration file, thus simulating some of the capabilities of a device by overriding the capabilities of the actual device under test.

This device simulation layer “simulates,” rather than “emulates,” another device — meaning that the layer does not add capabilities that do not already exist in the system’s underlying actual device. So a less-capable device cannot simulate a more-capable device.

This layer enables a more-capable device to simulate a less-capable device by removing some of the capabilities reported by queries; you can change or reduce what is already present in the underlying actual implementation. Put another way, the DevSim layer allows changing the responses that would otherwise be returned to queries of the actual underlying hardware; the layer does not add software emulation to provide capabilities beyond what already exists.

Application code can be tested to verify that it responds correctly to the capabilities reported by the simulated device, such as:

  • Properly querying the capabilities of the device
  • Properly complying with the limits reported from the device
  • Verifying all necessary capabilities are reported as present, rather than assuming they are available
  • Exercising fall-back code paths, if optional capabilities are not available

The DevSim layer does not enforce the capabilities returned by queries. The application is still responsible for querying and complying with the capabilities reported. If an application erroneously attempts to over-commit a resource or use a disabled feature, the DevSim layer will not generate errors. To detect such errors, use the Vulkan Validation layers, as with any non-simulated device.

The DevSim layer will work with other Vulkan layers, such as Validation. When configuring the order of the layers list, the DevSim layer should be “last” — closest to the driver, farthest from the application, allowing the Validation layer to see the results of the DevSim layer, and permitting Validation to enforce the simulated capabilities.

Please report any Device Simulation Layer issues to the GitHub VulkanTools repository and include “DevSim” in the title text.

Find more information about the Device Simulation Layer here.

You can get simulation JSON files from courtesy of Sascha Willems.

Thanks to Valve for their support of LunarG.