Do you have a test lab with examples of all the GPUs you hope your application will support?
Is your Vulkan application stress-tested to ensure it behaves correctly across the wide range of hardware available in the marketplace?
If either answer is “no,” LunarG offers a free tool that could extend your test coverage and increase your peace of mind.
LunarG Device Simulation Tool Overview
The LunarG Device Simulation layer helps test across a wide range of hardware capabilities without requiring a physical copy of every device. It can be applied without modifying any application binaries, and in a fully-automated fashion. The Device Simulation layer (aka DevSim) is a Vulkan layer that can override the values returned by your application’s queries of the GPU. DevSim uses a JSON text configuration file to make your application see a different driver/GPU than is actually in your system. This capability is useful to verify that your application both a) properly queries the limits from Vulkan, and b) obeys those limits.
LunarG announced DevSim at SIGGRAPH in the summer of 2017, and the layer library is available pre-built in the LunarG Vulkan SDK. Since that announcement, DevSim has continued to evolve, and now supports even more features. The DevSim layer works for all Vulkan platforms (Linux, Windows, and Android). It is open-source software on GitHub, and the code strives to be clear and well-documented to serve as an example for writing Vulkan layers.
The role of DevSim is to “simulate” a less-capable Vulkan implementation by constraining the features and resources of a more-capable implementation. Note that the actual device in your machine should be more capable than that which you are simulating. DevSim does not add capabilities to your existing Vulkan implementation by “emulating” additional capabilities with software; e.g. DevSim cannot add geometry shader capability to an actual device that doesn’t already provide it. Also, DevSim does not “enforce” the features being simulated. For enforcement, you would continue to use the Validation Layers as usual, in conjunction with DevSim.
Using DevSim
DevSim supports a flexible configuration file format using JSON syntax. The configuration file format is defined by a formal JSON schema available on the Khronos website, so any configuration file may be verified to be correct using freely-available JSON validators. Browsing through the schema file, you can see the extent of parameters that are available for your configuration. As a convenience, DevSim supports loading multiple JSON files, so your configuration data can be split among separate files for modularity as desired.
How DevSim Works
DevSim builds its internal data tables by querying the capabilities of the underlying actual device, then applying each of the configuration files “on top of” those tables. Therefore you only need to specify the features you wish to modify from the actual device; tweaking a single feature is easy. Here’s an example of a valid configuration file for changing only the maximum permitted viewport size:
{
“$schema”: “https://schema.khronos.org/vulkan/devsim_1_0_0.json#”,
“VkPhysicalDeviceProperties”: {
“limits”: { “maxViewportDimensions”: [1024, 1024] }
}
}
Simulating Entire Real-World Devices
If you instead wish to simulate entire real-world devices, LunarG has collaborated with the Vulkan Hardware Database to make their data compatible with the DevSim schema. You can download device configurations from the website in JSON format, and use those configuration files directly with DevSim.
Reporting Issues
Should you have any issues or suggestions for the Device Simulation layer, please create an issue at the LunarG VulkanTools GitHub repository, with “DevSim” in the title.
Additional Information
Check out the links below:
- Khronos BOF from SIGGRAPH 2017 pp 81-83
- DevSim documentation
- DevSim source code in LunarG VulkanTools repository on GitHub
- DevSim JSON schema
- Vulkan Hardware Database
Learn More about LunarG
LunarG’s software engineering experts create innovative products and services using leading-edge 3D graphics and shader compiler technologies. Click here to learn how we can help you.