Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JSON Schemas for Driver and Layer Manifests #1273

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion docs/LoaderDriverInterface.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
- [Using Pre-Production ICDs or Software Drivers](#using-pre-production-icds-or-software-drivers)
- [Driver Discovery on Android](#driver-discovery-on-android)
- [Driver Manifest File Format](#driver-manifest-file-format)
- [JSON Schema for Driver Manifest Files](#json-schema-for-driver-manifest-files)
- [Driver Manifest File Versions](#driver-manifest-file-versions)
- [Driver Manifest File Version 1.0.0](#driver-manifest-file-version-100)
- [Driver Manifest File Version 1.0.1](#driver-manifest-file-version-101)
Expand Down Expand Up @@ -715,22 +716,44 @@ Here is an example driver JSON Manifest file:
}
```

### JSON Schema for Driver Manifest Files

The Driver Manifest file can be validated against the provided JSON Schema files.
This offers a quick way to check that the manifest file matches the format the
loader expects.

While the schema files are located in the repo, it is best to reference the web
URL `https://schema.khronos.org/vulkan/driver_manifest_X_Y_Z.json`
where `X`, `Y`, and `Z` correspond to the file_format_version used by the manifest.

For example, a manifest of version 1.0.1 should use the following:

```json
{
"$schema":"https://schema.khronos.org/vulkan/driver_manifest_1_0_1.json",
"file_format_version" : "1.0.1",
...
```

<table style="width:100%">
<tr>
<th>Field Name</th>
<th>Field Value</th>
<th>JSON Type</th>
</tr>
<tr>
<td>"file_format_version"</td>
<td>The JSON format major.minor.patch version number of this file.<br/>
Supported versions are: 1.0.0 and 1.0.1.</td>
<td>string</td>
</tr>
<tr>
<td>"ICD"</td>
<td>The identifier used to group all driver information together.
<br/>
<b>NOTE:</b> Even though this is labelled <i>ICD</i> it is historical
and just as accurate to use for other drivers.</td>
<td>object</td>
</tr>
<tr>
<td>"library_path"</td>
Expand All @@ -743,6 +766,7 @@ Here is an example driver JSON Manifest file:
There are no rules about the name of the driver's shared library file
other than it should end with the appropriate suffix (".DLL" on
Windows, ".so" on Linux and ".dylib" on macOS).</td>
<td>string</td>
</tr>
<tr>
<td>"library_arch"</td>
Expand All @@ -751,6 +775,7 @@ Here is an example driver JSON Manifest file:
Allows the loader to quickly determine if the architecture of the driver
matches that of the running application. <br />
The only valid values are "32" and "64".</td>
<td>string</td>
</tr>
<tr>
<td>"api_version" </td>
Expand All @@ -763,12 +788,14 @@ Here is an example driver JSON Manifest file:
queried by the user using the <i>vkGetPhysicalDeviceProperties</i> API
call.<br/>
For example: 1.0.33.</td>
<td>string</td>
</tr>
<tr>
<td>"is_portability_driver" </td>
<td>Defines whether the driver contains any VkPhysicalDevices which
implement the VK_KHR_portability_subset extension.<br/>
</td>
<td>boolean</td>
</tr>
</table>

Expand Down Expand Up @@ -798,7 +825,7 @@ they contain VkPhysicalDevices which support the VK_KHR_portability_subset
extension. This is an optional field. Omitting the field has the same effect as
setting the field to `false`.

Added the "library\_arch" field to the driver manifest to allow the loader to
Added the `library_arch` field to the driver manifest to allow the loader to
quickly determine if the driver matches the architecture of the current running
application. This field is optional.

Expand Down
48 changes: 45 additions & 3 deletions docs/LoaderLayerInterface.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@
- [Creating New Dispatchable Objects](#creating-new-dispatchable-objects)
- [Versioning and Activation Interactions](#versioning-and-activation-interactions)
- [Layer Manifest File Format](#layer-manifest-file-format)
- [JSON Schema for Layer Manifest Files](#json-schema-for-layer-manifest-files)
- [Layer Manifest File Version History](#layer-manifest-file-version-history)
- [Layer Manifest File Version 1.2.1](#layer-manifest-file-version-121)
- [Layer Manifest File Version 1.2.1](#layer-manifest-file-version-121)
- [Layer Manifest File Version 1.2.0](#layer-manifest-file-version-120)
- [Layer Manifest File Version 1.1.2](#layer-manifest-file-version-112)
- [Layer Manifest File Version 1.1.1](#layer-manifest-file-version-111)
Expand Down Expand Up @@ -1629,12 +1630,31 @@ Here's an example of a meta-layer manifest file:
}
```

### JSON Schema for Layer Manifest Files

The Layer Manifest file can be validated against the provided JSON Schema files.
This offers a quick way to check that the manifest file matches the format the
loader expects.

While the schema files are located in the repo, it is best to reference the web
URL `https://schema.khronos.org/vulkan/layer_manifest_X_Y_Z.json`
where `X`, `Y`, and `Z` correspond to the file_format_version used by the manifest.

For example, a manifest of version 1.2.1 should use the following:

```json
{
"$schema":"https://schema.khronos.org/vulkan/layer_manifest_1_2_1.json",
"file_format_version" : "1.2.1",
...
```

<table style="width:100%">
<tr>
<th>JSON Node</th>
<th>Description and Notes</th>
<th>Restrictions</th>
<th>JSON Type</th>
<th>Parent</th>
<th>Introspection Query</th>
</tr>
Expand All @@ -1648,6 +1668,7 @@ Here's an example of a meta-layer manifest file:
For example: 1.0.33.
</td>
<td>None</td>
<td>string</td>
<td>"layer"/"layers"</td>
<td><small>vkEnumerateInstanceLayerProperties</small></td>
</tr>
Expand All @@ -1656,6 +1677,7 @@ Here's an example of a meta-layer manifest file:
<td>List of paths to executables that the meta-layer applies to.
</td>
<td><b>Meta-layers Only</b></td>
<td>array of strings</td>
<td>"layer"/"layers"</td>
<td><small>N/A</small></td>
</tr>
Expand All @@ -1665,6 +1687,7 @@ Here's an example of a meta-layer manifest file:
requested by the application.
</td>
<td><b>Meta-layers Only</b></td>
<td>array of strings</td>
<td>"layer"/"layers"</td>
<td><small>N/A</small></td>
</tr>
Expand All @@ -1680,13 +1703,15 @@ Here's an example of a meta-layer manifest file:
<b>This field must not be present if "library_path" is defined</b>.
</td>
<td><b>Meta-layers Only</b></td>
<td>array of strings</td>
<td>"layer"/"layers"</td>
<td><small>N/A</small></td>
</tr>
<tr>
<td>"description"</td>
<td>A high-level description of the layer and its intended use.</td>
<td>None</td>
<td>string</td>
<td>"layer"/"layers"</td>
<td><small>vkEnumerateInstanceLayerProperties</small></td>
</tr>
Expand All @@ -1706,6 +1731,7 @@ Here's an example of a meta-layer manifest file:
by the supported extension.
</td>
<td>None</td>
<td>array</td>
<td>"layer"/"layers"</td>
<td><small>vkEnumerateDeviceExtensionProperties</small></td>
</tr>
Expand All @@ -1722,6 +1748,7 @@ Here's an example of a meta-layer manifest file:
set, the implicit layer is disabled.
</td>
<td><b>Implicit Layers Only</b></td>
<td>object</td>
<td>"layer"/"layers"</td>
<td><small>N/A</small></td>
</tr>
Expand All @@ -1738,6 +1765,7 @@ Here's an example of a meta-layer manifest file:
implicit layer(s).
</td>
<td><b>Implicit Layers Only</b></td>
<td>object</td>
<td>"layer"/"layers"</td>
<td><small>N/A</small></td>
</tr>
Expand All @@ -1747,6 +1775,7 @@ Here's an example of a meta-layer manifest file:
Supported versions are: 1.0.0, 1.0.1, 1.1.0, 1.1.1, 1.1.2 and 1.2.0.
</td>
<td>None</td>
<td>string</td>
<td>None</td>
<td><small>N/A</small></td>
</tr>
Expand All @@ -1759,6 +1788,7 @@ Here's an example of a meta-layer manifest file:
name for `vkNegotiateLoaderLayerInterfaceVersion`.
</td>
<td>None</td>
<td>object</td>
<td>"layer"/"layers"</td>
<td><small>vkGet*ProcAddr</small></td>
</tr>
Expand All @@ -1769,6 +1799,7 @@ Here's an example of a meta-layer manifest file:
the loader and/or application can identify it properly.
</td>
<td>None</td>
<td>string</td>
<td>"layer"/"layers"</td>
<td><small>vkEnumerateInstanceLayerProperties</small></td>
</tr>
Expand All @@ -1784,6 +1815,7 @@ Here's an example of a meta-layer manifest file:
"specVersion" respectively.
</td>
<td>None</td>
<td>array</td>
<td>"layer"/"layers"</td>
<td><small>vkEnumerateInstanceExtensionProperties</small></td>
</tr>
Expand All @@ -1792,6 +1824,7 @@ Here's an example of a meta-layer manifest file:
<td>The identifier used to group a single layer's information together.
</td>
<td>None</td>
<td>object</td>
<td>None</td>
<td><small>vkEnumerateInstanceLayerProperties</small></td>
</tr>
Expand All @@ -1801,6 +1834,7 @@ Here's an example of a meta-layer manifest file:
This requires a minimum Manifest file format version of 1.0.1.
</td>
<td>None</td>
<td>object</td>
<td>None</td>
<td><small>vkEnumerateInstanceLayerProperties</small></td>
</tr>
Expand All @@ -1820,6 +1854,7 @@ Here's an example of a meta-layer manifest file:
<b>This field must not be present if "component_layers" is defined</b>.
</td>
<td><b>Not Valid For Meta-layers</b></td>
<td>string</td>
<td>"layer"/"layers"</td>
<td><small>N/A</small></td>
</tr>
Expand All @@ -1829,13 +1864,17 @@ Here's an example of a meta-layer manifest file:
Allows the loader to quickly determine if the architecture of the layer
matches that of the running application. <br />
The only valid values are "32" and "64".</td>
<td><b>Not Valid For Meta-layers</b></td>
<td>string</td>
<td>"layer"/"layers"</td>
<td><small>N/A</small></td>
</tr>
<tr>
<tr>
<td>"name"</td>
<td>The string used to uniquely identify this layer to applications.</td>
<td>None</td>
<td>string</td>
<td>"layer"/"layers"</td>
<td><small>vkEnumerateInstanceLayerProperties</small></td>
</tr>
Expand All @@ -1845,6 +1884,7 @@ Here's an example of a meta-layer manifest file:
layers.
</td>
<td><b>Meta-layers Only</b></td>
<td>array of strings</td>
<td>"layer"/"layers"</td>
<td><small>N/A</small></td>
</tr>
Expand All @@ -1861,6 +1901,7 @@ Here's an example of a meta-layer manifest file:
more information.
</td>
<td><b>Implicit Layers Only</b></td>
<td>object</td>
<td>"layer"/"layers"</td>
<td><small>vkEnumerateInstance*Properties</small></td>
</tr>
Expand All @@ -1878,17 +1919,18 @@ Here's an example of a meta-layer manifest file:
not found.
</td>
<td>None</td>
<td>string</td>
<td>"layer"/"layers"</td>
<td><small>vkEnumerate*LayerProperties</small></td>
</tr>
</table>

### Layer Manifest File Version History

The current highest supported Layer Manifest file format supported is 1.2.0.
The current highest supported Layer Manifest file format supported is 1.2.1.
Information about each version is detailed in the following sub-sections:

### Layer Manifest File Version 1.2.1
#### Layer Manifest File Version 1.2.1

Added the "library\_arch" field to the layer manifest to allow the loader to
quickly determine if the layer matches the architecture of the current running
Expand Down
38 changes: 38 additions & 0 deletions schemas/driver_manifest_1_0_0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"id": "https://schema.khronos.org/vulkan/driver_manifest_1_0_0.json",
"title": "Vulkan Driver Manifest Version 1.0.0",
"description": "JSON Schema for Driver Manifest files for the Vulkan Loader",
"type": "object",
"additionalProperties": true,
"properties": {
"file_format_version": {
"type": "string",
"pattern": "^1.0.0$"
},
"ICD": {
"type": "object",
"properties": {
"library_path": {
"type": "string",
"description": "Path validation is not feasible to validate with regex since valid paths are different per platform"
},
"api_version": {
"type": "string",
"pattern": "^[0-9]*\\.[0-9]*\\.[0-9]*$|^[0-9]*\\.[0-9]*\\.[0-9]*\\.[0-9]*$",
"description": "Matches 3 and 4 component versions"
},
"library_arch": false,
"is_portability_driver": false
},
"required": [
"library_path",
"api_version"
]
}
},
"required": [
"file_format_version",
"ICD"
]
}
45 changes: 45 additions & 0 deletions schemas/driver_manifest_1_0_1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"id": "https://schema.khronos.org/vulkan/driver_manifest_1_0_1.json",
"title": "Vulkan Driver Manifest Version 1.0.1",
"description": "JSON Schema for Driver Manifest files for the Vulkan Loader",
"type": "object",
"additionalProperties": true,
"properties": {
"file_format_version": {
"type": "string",
"pattern": "^1.0.1$"
},
"ICD": {
"type": "object",
"properties": {
"library_path": {
"type": "string",
"description": "Path validation is not feasible to validate with regex since valid paths are different per platform"
},
"api_version": {
"type": "string",
"pattern": "^[0-9]*\\.[0-9]*\\.[0-9]*$|^[0-9]*\\.[0-9]*\\.[0-9]*\\.[0-9]*$",
"description": "Matches 3 and 4 component versions"
},
"library_arch": {
"enum": [
"32",
"64"
]
},
"is_portability_driver": {
"type": "boolean"
}
},
"required": [
"library_path",
"api_version"
]
}
},
"required": [
"file_format_version",
"ICD"
]
}
Loading