1e5c31af7Sopenharmony_ci// Copyright 2015-2024 The Khronos Group Inc.
2e5c31af7Sopenharmony_ci//
3e5c31af7Sopenharmony_ci// SPDX-License-Identifier: CC-BY-4.0
4e5c31af7Sopenharmony_ci
5e5c31af7Sopenharmony_ci[appendix]
6e5c31af7Sopenharmony_ci[[vuid]]
7e5c31af7Sopenharmony_ci= Valid Usage ID Tags
8e5c31af7Sopenharmony_ci
9e5c31af7Sopenharmony_ciValid usage statements in the published Vulkan Specification must all be
10e5c31af7Sopenharmony_cigiven _Valid Usage ID_ or _VUID_ tags.
11e5c31af7Sopenharmony_ciThese tags are asciidoctor anchors, intended for use by the validation layer
12e5c31af7Sopenharmony_cito provide unique names for each validation condition, and a way to link
13e5c31af7Sopenharmony_cifrom validation layer reports into the corresponding parts of the
14e5c31af7Sopenharmony_ciSpecification.
15e5c31af7Sopenharmony_ci
16e5c31af7Sopenharmony_ci
17e5c31af7Sopenharmony_ci[[vuid-format]]
18e5c31af7Sopenharmony_ci== Format of VUID Tags
19e5c31af7Sopenharmony_ci
20e5c31af7Sopenharmony_ciFor implicit valid usage statements, the tags are formatted like this:
21e5c31af7Sopenharmony_ci
22e5c31af7Sopenharmony_ci[source,asciidoc]
23e5c31af7Sopenharmony_ci----
24e5c31af7Sopenharmony_ci[[VUID-blockname-paramname-category]]
25e5c31af7Sopenharmony_ci----
26e5c31af7Sopenharmony_ci
27e5c31af7Sopenharmony_ci_blockname_ is the name of the function or structure for which a valid usage
28e5c31af7Sopenharmony_cistatement is being generated.
29e5c31af7Sopenharmony_ci
30e5c31af7Sopenharmony_ci_paramname_ is the name of the parameter being validated.
31e5c31af7Sopenharmony_ciIn some cases, the statement does not validate a single parameter and this
32e5c31af7Sopenharmony_ciportion of the tag is absent.
33e5c31af7Sopenharmony_ci
34e5c31af7Sopenharmony_ci_category_ is the type of statement being generated.
35e5c31af7Sopenharmony_ciThere are over one dozen types referring to distinct conditions such as
36e5c31af7Sopenharmony_civalid objects, required bitmasks, required array lengths, constraints on
37e5c31af7Sopenharmony_ciparent objects, and so on.
38e5c31af7Sopenharmony_ci
39e5c31af7Sopenharmony_ciFor explicit valid usage statements, the tags are formatted like this:
40e5c31af7Sopenharmony_ci
41e5c31af7Sopenharmony_ci[source,asciidoc]
42e5c31af7Sopenharmony_ci----
43e5c31af7Sopenharmony_ci[[VUID-blockname-paramname-number]]
44e5c31af7Sopenharmony_ci----
45e5c31af7Sopenharmony_ci
46e5c31af7Sopenharmony_ci_blockname_ is the name of the function or structure for which a valid usage
47e5c31af7Sopenharmony_cistatement is being generated.
48e5c31af7Sopenharmony_ci
49e5c31af7Sopenharmony_ci_paramname_ is the name of the parameter being validated.
50e5c31af7Sopenharmony_ciIn some cases, the statement does not validate a single parameter and this
51e5c31af7Sopenharmony_ciportion of the tag is replaced by `-None-`
52e5c31af7Sopenharmony_ci
53e5c31af7Sopenharmony_ci_number_ is a unique five digit, zero-filled number used to disambiguate
54e5c31af7Sopenharmony_cisimilar tag names.
55e5c31af7Sopenharmony_ci
56e5c31af7Sopenharmony_ci[NOTE]
57e5c31af7Sopenharmony_ci.Note
58e5c31af7Sopenharmony_ci====
59e5c31af7Sopenharmony_ciThe _blockname_, _paramname_, and _category_ portions of a VUID tag name
60e5c31af7Sopenharmony_cimust each be composed only of the alphanumeric characters A-Z, a-z, and 0-9,
61e5c31af7Sopenharmony_ciand the ':' character.
62e5c31af7Sopenharmony_ciIn general only the alphabetic subset of these characters is used, but there
63e5c31af7Sopenharmony_ciare a few exceptions.
64e5c31af7Sopenharmony_ci====
65e5c31af7Sopenharmony_ci
66e5c31af7Sopenharmony_ci
67e5c31af7Sopenharmony_ci[[vuid-creating]]
68e5c31af7Sopenharmony_ci== Creating VUID Tags
69e5c31af7Sopenharmony_ci
70e5c31af7Sopenharmony_ciFor implicit valid usage statements generated automatically from `vk.xml`,
71e5c31af7Sopenharmony_ciVUID tags are created automatically by the generator scripts.
72e5c31af7Sopenharmony_ci
73e5c31af7Sopenharmony_ciFor explicit valid usage statements, VUID tags are generated by passing
74e5c31af7Sopenharmony_ciappropriate options to the script `reflow.py`.
75e5c31af7Sopenharmony_ci
76e5c31af7Sopenharmony_ciSince these tags are of use only to the published validation layer, they are
77e5c31af7Sopenharmony_cineeded only in the published Specification sources and outputs.
78e5c31af7Sopenharmony_ciTherefore, authors of extensions, or other branches adding valid usage
79e5c31af7Sopenharmony_cistatements, are not themselves responsible for adding tags in their
80e5c31af7Sopenharmony_cibranches.
81e5c31af7Sopenharmony_ciThe specification editors will take care of this as part of the process of
82e5c31af7Sopenharmony_cipublishing updates.
83e5c31af7Sopenharmony_ciFor reference purposes, this process is described below:
84e5c31af7Sopenharmony_ci
85e5c31af7Sopenharmony_ciFirst, after integrating all new specification language into the internal
86e5c31af7Sopenharmony_cigitlab default branch (currently `main`) containing the canonical
87e5c31af7Sopenharmony_ciSpecification source, invoke the following command:
88e5c31af7Sopenharmony_ci
89e5c31af7Sopenharmony_ci[source,sh]
90e5c31af7Sopenharmony_ci----
91e5c31af7Sopenharmony_cipython3 scripts/reflow.py -overwrite -noflow -tagvu chapters/*.adoc chapters/*/*.adoc
92e5c31af7Sopenharmony_ci----
93e5c31af7Sopenharmony_ci
94e5c31af7Sopenharmony_ciThis will add VUID tags to all statements in valid usage blocks which do not
95e5c31af7Sopenharmony_cialready have them.
96e5c31af7Sopenharmony_ciSome diagnostics will be reported, but these are do not in general require
97e5c31af7Sopenharmony_ciany action.
98e5c31af7Sopenharmony_ci
99e5c31af7Sopenharmony_ciAfter updating all files, the script will update the file
100e5c31af7Sopenharmony_ci`scripts/vuidCounts.py` containing reserved ranges of VUIDs for the default
101e5c31af7Sopenharmony_cibranch and certain other development branches.
102e5c31af7Sopenharmony_ci
103e5c31af7Sopenharmony_ciCommit the updated source files and `vuidCounts.py` together.
104e5c31af7Sopenharmony_ciThe next time the script is run, VUID tags will be assigned numbers starting
105e5c31af7Sopenharmony_cifrom the next free value in the range available to default branch.
106e5c31af7Sopenharmony_ci
107e5c31af7Sopenharmony_ciIn-development Vulkan extensions are kept in their own branches, with the
108e5c31af7Sopenharmony_cibranch name the same as the name of the extension being developed.
109e5c31af7Sopenharmony_ciVUID tags may be assigned in these branches in the same fashion as in
110e5c31af7Sopenharmony_cidefault branch.
111e5c31af7Sopenharmony_ciTo enable this, each development branch must be assigned its own independent
112e5c31af7Sopenharmony_ciVUID range in the default branch copy of `vuidCounts.py`, to prevent
113e5c31af7Sopenharmony_cicollisions.
114e5c31af7Sopenharmony_ciIn the event that default branch or any development branch exhausts the
115e5c31af7Sopenharmony_ciavailable VUID range, `reflow.py` will report this and stop assigning VUIDs.
116e5c31af7Sopenharmony_ciAt that point, a new range must be assigned to the branch in the default
117e5c31af7Sopenharmony_cibranch copy of `vuidCounts.py`, as well as in the per-branch copy.
118e5c31af7Sopenharmony_ci
119e5c31af7Sopenharmony_ci
120e5c31af7Sopenharmony_ci== Updating VUID Tags When Valid Usage Statements Change
121e5c31af7Sopenharmony_ci
122e5c31af7Sopenharmony_ciValid usage statements have corresponding tests in the Vulkan Validation
123e5c31af7Sopenharmony_ciLayer.
124e5c31af7Sopenharmony_ciThe tests must be changed in response to semantic changes in the VU
125e5c31af7Sopenharmony_cistatements, whether for bug-fixing, adding extension interactions, or
126e5c31af7Sopenharmony_ciotherwise.
127e5c31af7Sopenharmony_ciThe rule used when updating explicit VU statements is that the merge request
128e5c31af7Sopenharmony_cior pull request responsible for making the change must remove the existing
129e5c31af7Sopenharmony_ciVUID tag, so that a new one can be assigned, _except_ in the following
130e5c31af7Sopenharmony_cicases:
131e5c31af7Sopenharmony_ci
132e5c31af7Sopenharmony_ci  * The changes are non-semantic, such as using consistent phrasing or
133e5c31af7Sopenharmony_ci    markup.
134e5c31af7Sopenharmony_ci  * The changes consist of removing or changing extension suffixes when
135e5c31af7Sopenharmony_ci    promoting an extension to `EXT`, `KHR`, or core status.
136e5c31af7Sopenharmony_ci  * The valid usage statement has not yet been implemented in the validation
137e5c31af7Sopenharmony_ci    layers.
138e5c31af7Sopenharmony_ci
139e5c31af7Sopenharmony_ci[NOTE]
140e5c31af7Sopenharmony_ci.Note
141e5c31af7Sopenharmony_ci====
142e5c31af7Sopenharmony_ciThis section may need further modification in response to guidelines agreed
143e5c31af7Sopenharmony_cito by the Vulkan Working Group.
144e5c31af7Sopenharmony_ci====
145