The solid line arrows depict parent-child component relationships with the arrow pointing towards the child. The dashed line indicates a directory capability provided by the validation server to the application component that gives the application component, and therefore the loader, visibility into the validation servers package contents.
The first package is that of the application being augmented to use the Vulkan validation layers and it contains 2 components:
The original application component which is amended to include the //src/lib/vulkan/validation-layer-package/application.shard.cml as part of its component manifest.
The new client-side component, validation-client as introduced by this scheme, that serves to allow specific version hashing to always pair the matching version of the validation layer shared library with the version your application was built against.
The second package is the “validation-server-package”. It contains a single component with an executable, a shared library and .json
resources. The layer server executable serves its entire package contents as the validation_server_pkg
directory capability. This directory capability contains the layer .json files under the data/vulkan/explicit_layer.d/
path and the shared libraries in lib/
.
Effectively, this provides the application (and therefore the loader), with all the resources it needs to implicitly enable the Vulkan validation layers and guarantees that the correct version of the validation layer .so
is always loaded when it is used.
This prototype requires that the client uses CFv2.
Have your application's package depend on the //src/lib/vulkan/vulkan-validation-pkg:validation-client
component.
Include the //src/lib/vulkan/vulkan-validation-pkg/application.shard.cml
CML shard in your application's component manifest.
Add /vulkan_validation_pkg/data/vulkan/explicit_layer.d
to the layer path, in one of several ways:
VK_LAYER_PATH=/vulkan_validation_pkg/data/vulkan/explicit_layer.d
environment variable."override_paths": ["/vulkan_validation_pkg/data/vulkan/explicit_layer.d"]
in VkLayer_override.jsonEnable the VK_LAYER_KHRONOS_validation
layer, in one of several ways:
vkCreateInstance
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation
environment variable."component_layers": [ "VK_LAYER_KHRONOS_validation" ]
in VkLayer_override.json.Add the //src/lib/vulkan/vulkan-validation-pkg
package using fx set
.
When configured as described above, the loading of the validation layer from the package repository to the Fuchsia device can be controlled by performing or reverting the change described in step 3 above.
Here's an example VkLayer_override.json file that automatically finds and loads the validation layers:
{ "file_format_version": "1.1.2", "layer": { "api_version": "1.2.182", "app_keys": [], "blacklisted_layers": [], "component_layers": [ "VK_LAYER_KHRONOS_validation" ], "description": "LunarG Override Layer", "disable_environment": { "DISABLE_VK_LAYER_LUNARG_override": "1" }, "implementation_version": "1", "name": "VK_LAYER_LUNARG_override", "override_paths": [ "/vulkan_validation_pkg/data/vulkan/explicit_layer.d" ], "type": "GLOBAL" } }
VkLayer_override.json can be placed at any of these paths:
/pkg/data/vulkan/implicit_layer.d/VkLayer_override.json
/config/data/vulkan/implicit_layer.d/VkLayer_override.json
<x>/implicit_layer.d/VkLayer_override.json
if the XDG_CONFIG_DIRS=<x>
environment variable is set. This can be used to read the file from /data
or /cache
, which can be written at runtime.