Vulkan-Docs/doc/specs/vulkan/style/styleguide.txt

993 lines
35 KiB
Plaintext
Raw Normal View History

2016-02-16 09:53:44 +00:00
// Copyright (c) 2015-2016 The Khronos Group Inc.
// Copyright notice at https://www.khronos.org/registry/speccopyright.html
Vulkan Style Guide
==================
Jon Leech
include::../specversion.txt[]
:toc2:
:toclevels: 3
:max-width: 100
:numbered:
:doctype: book
:imagewidth: 800
:fullimagewidth: {svgpdf@pdf:scaledwidth="75%":width="800"}
:cl: :
:leveloffset: 1
// :icons:
// :toc-placement: manual
<<<<
include::../copyright.txt[]
<<<<
[[introduction]]
= Introduction
This is the Vulkan Documentation Style Guide, containing the collected
rules, guidelines, tricks, and tips for authors contributing to the Vulkan
API Specification (the _Specification_), reference pages, and other
documentation such as white papers and tutorials (if and when we have them).
These are collectively referred to as _Vulkan Documentation_ or just
_documentation_ below. The primary focus and inspiration is the
Specification, although all of the markup and most of the writing style is
equally applicable to the reference pages.
The primary purpose of the style guide is to achieve consistency of both
source and output documents. Consistency makes it easier for editors,
reviewers, and users of our documentation to understand and modify it. When
the style guide makes prescriptive statements, please follow them unless
there are compelling reasons not to. If you have a strong desire to change
these guidelines, you can try to make a case starting with the Specification
editors, and proceeding to the Vulkan Working Group if need be.
[NOTE]
.Note
====
But be prepared to make the numerous merge requests applying those changes
to all parts of our documentation, if your change request is accepted!
====
The style guide is broken into two major sections:
* <<markup,Markup Style>> - how to write asciidoc and XML source that
follows consistent formatting and layout guidelines, tags special terms
and phrases for proper processing by the spec generation tools, etc.
* <<writing,Writing Style>> - overall and fine-grained structure and
conventions, normative language use, API naming conventions, common
words and phrases to use (and those not to use), linking and
cross-referencing, etc.
[[introduction-asciidoc]]
== Asciidoc Markup
Vulkan Documentation is primarily written in Asciidoc, a form of text markup
language. Asciidoc is documented on its website at http://www.asciidoc.org/.
[[userguide]]
References to the Asciidoc User Guide are to sections in the document at
http://asciidoc.org/userguide.html .
Asciidoc packages are available for Linux, MacOS, and Microsoft Windows,
together with the other toolchain components required to generate output
documents corresponding to the markup. Note that we are currently using the
original _asciidoc_ tool. Other tools to process Asciidoc markup, such as
_asciidoctor_, are also available, but are not currently usable for our
documents. While asciidoctor supports the basic Asciidoc markup syntax, it
does not support asciidoc macros, which are used extensively in the
documentation. It is possible to move from asciidoc to asciidoctor, but this
will be a significant effort, taking place after Vulkan 1.0 is published.
This guide does not address the toolchain and build process, just source
documents.
[[markup]]
= Markup Style
This chapter demonstrates Asciidoc and Specification structure, including
text layout and markup style.
Chapters and sections follow a rigid template consisting of an optional
anchor (if other parts of the document cross-reference the section) followed
by a one line title (see section 11.2 of the <<userguide,User Guide>>) and a
blank line. The anchor is typically the base name of the file containing the
chapter, with a lowercased version of the section name following, with
spaces replaced by dashes.
Always use the one-line title form, with one to five = signs preceding the
chapter/section title. The two-line title form cannot be easily searched for
and often looks like other types of asciidoc delimiters.
Always precede the anchor by two blank lines (except at the beginning of a
file), and follow the title by a blank line, to set off sections visibly.
.Example Markup
----
[[markup]]
= Markup Style
[[markup-sample-section]]
== Sample Section
----
[[markup-sample-section]]
== Sample Section
This is a sample section of the Vulkan Specification, nested one level
inside a chapter. Sections can be nested up to level 5, although not all
levels are included in the Table of Contents.
[[markup-layout]]
== Layout, Line Lengths, and Lists
Asciidoc source should be text filled to 76 columns with hard line breaks.
Except when necessary for lists or other markup, text should begin at the
first column of each line (leading spaces are often semantically meaningful
in asciidoc markup).
UTF-8 characters outside the ASCII subset should be used sparingly, only
when needed for non-English names. Instead use asciidoc markup for special
characters, if required. For example, two hyphens produces an en-dash:
[NOTE]
.Example Markup
====
`An -- en-dash` -> An -- en-dash
====
As an exception, multiplication should be marked with the unicode
multiplication symbol ``×'' (and *not* an asterisk) when used in plain
text. In math sections, the same symbol should be referred to as `\times`.
In code sections, a conventional asterisk (`*`) should be used instead.
See chapter 10 of the <<userguide,User Guide>> for supported special
characters, as well as use of entity references.
Quotation marks should use the 66/99 convention. That is, double asymmetric
quotation marks, indicated by double back-ticks as opening marks and double
apostrophes as closing marks (\`\`like this''), which renders ``like this''.
_Never_ use hard tabs or trailing blanks.
* In some cases, limitations of asciidoc markup may result in lines that are
longer than 76 characters and cannot easily be shortened without
compromising the output documents.
[[markup-samplesection-lists]]
=== Lists
* Bullet lists are the preferred form of list, aside from glossary
definitions.
* Lists should have text indented by 4 spaces and the list item delimiter
(e.g. one or more asterisks, for bullet lists) indented by two spaces.
+
--
Note that continuation blocks for list items longer than one paragraph
cannot be indented, only the first paragraph.
In general, successive list items should not be separated by white space.
However, list continuation blocks must be followed by a blank line due to
limitations of the asciidoc parser.
--
* Indent bullet lists two spaces (to the bullet), 4 spaces (to the text,
if it extends over multiple lines). This lets us visually distinguish
lists from other kinds of markup.
** Nested lists should align the leftmost list item delimiter (bullet,
etc.) with the parent delimiter.
.Example Markup
----
* This is the first item in a bullet list.
* The second item is described with two paragraphs. The second
paragraph is in a continuation block:
+
--
This is the second paragraph.
--
** This is a nested list item for the second item. Since it
follows a continuation block, it must be separated by a
blank line from that block.
----
[[markup-samplesection-anchors]]
=== Anchors and Cross-references
In general, chapters and sections should always have anchors, following the
naming convention <<markup,discussed above>>. Anchors to other sections of
the document may be inserted as needed. In addition, the autogenerated
include files defining commands, structures, enumerations and flags all
define anchors whose name is the name of the command or type being defined,
so it's easy to link to a (for example) a command name such as
<<vkCreateCommandPool>>.
If you want a cross-reference to an anchor to appear as something other than
the raw anchor name, always make sure to include that text as part of the
cross-reference. There are several different toolchains followed for various
forms of asciidoc output, and not all of them treat anchors without alt-text
the same way.
.Example Markup
----
In general, chapters and sections should always have anchors,
following the naming convention <<markup,discussed above>>.
Link to a command name such as <<vkCreateCommandPool>>.
----
[[markup-markup]]
== Markup Macros and Normative Terminology
This section discusses Asciidoc macros used in the document. In addition to
the macros defined by asciidoc itself, additional macros are defined by the
Specification and Reference Page configuration files.
=== API Markup Macros
These macros must: be used to tag command, structure, enumeration,
enumerant, and other Vulkan-specific names so they can be rendered in a
distinctive fashion, link to definitions of those names, and be easily
searched for in the source documents. The validation scripts (`make
allchecks` output) also rely on these macros being used consistently and
correctly. The API markup macros, with examples of their use, are in the
following table:
.API Markup Macros
[width="100%",options="header",cols="20%,80%"]
|=====
| Macro Name | Usage and Meaning
| flink{cl} | Generates a cross-reference or link to the definition of
the command name in the macro argument. Example:
flink{cl}vkCreateCommandPool -> flink:vkCreateCommandPool.
| fname{cl} | Formats the macro argument like flink{cl}. Does not
generate a cross-reference. Example:
fname{cl}vkCreateCommandPool -> fname:vkCreateCommandPool.
The flink{cl} macro is preferred.
| ftext{cl} | Formats the macro argument like fname{cl}. May contain
asterisks for wildcards. Not validated. Example:
ftext{cl}vkCmd* -> ftext:vkCmd*.
Only use ftext{cl} when it is necessary to describe
something that should be rendered like a command name,
but is not actually one (e.g. is a wildcard or subset of
an actual command name).
| slink{cl} | Generates a cross-reference or link to the definition
of the structure in the macro argument. Example:
slink{cl}VkCommandPoolCreateInfo ->
slink:VkCommandPoolCreateInfo.
| sname{cl} | Formats the macro argument like slink{cl}. Does not
generate a cross-reference. May also be an abstract
Change log for April 22, 2016 Vulkan 1.0.11 spec update: * Bump API patch number and header version number to 11 for this update. Github Issues: * Clarify the WSI extension language by switching from the fuzzier "ownership" language to more-consistent "acquire" language (public issue 117). * Clarify that memory barriers apply to all commands in the dependency chains in the flink:vkGetRenderAreaGranularity command and the <<synchronization-execution-and-memory-dependencies,Execution And Memory Dependencies>> section (public issue 132). * Clarify that a queue family is a set of queues in the <<fundamentals-execmodel,Execution Model>> section (public issue 166). * Removed requirement from valid usage language that VkPresentInfoKHR::waitSemaphoreCount must be greater than 0 (public issue 171). * Fix broken internal links, describe structures consistently, use consistent style for SPIR-V codewords, and tag normative terms that were missing asciidoc tags (public issue 183 and ancillary markup/normative language fixes). * Fix typos for slink:VkPhysicalDeviceLimits member names in slink:VkImageCreateInfo validity language (public issue 184). Internal Issues: * Document that the requested patch version number specified as part of slink:VkApplicationInfo::pname:apiVersion is ignored when creating an instance (internal issue 176). * Clarify handling of extension structs in the <<fundamentals-validusageValid Usage>> section (internal issue 254). * Update required slink:VkImageFormatProperties::pname:maxMipLevels to be limited to the maximum allowed mipmap pyramid size corresponding to the actual maximum supported size for the format (internal issue 256). * Modify the <<features-extentperimagetype,Allowed Extent Values Based On Image Type>> section so the allowed maximum extent is the maximum image dimension supported for each dimension of the type of texture being queried (internal issue 257). * Clarify in the <<spirvenv-module-validation,Validation Rules within a Module>> section that at least one of the code:LocalSize execution mode or code:WorkgroupSize decoration is required for each compute shader entry point in a shader module (internal issue 279). * Add validity rules for formats in flink:vkCmdClearColorImage and flink:vkCmdClearDepthStencilImage (internal issue 283). * Clarify that slink:VkImageFormatProperties::pname:maxResourceSize is an upper bound, and that it may not be possible to create an image anywhere near that size (internal issue 284). Other Commits: * Fix various minor markup errors reported by validation scripts. * Change copyright from Khronos Free Use License to Apache 2.0 license on relevant script/XML/header files. This does not affect the specification source copyright.
2016-04-21 08:08:38 +00:00
structure or handle name. Example:
sname{cl}VkCommandPoolCreateInfo ->
sname:VkCommandPoolCreateInfo. The slink{cl} macro is
preferred if a definition of the target type with an
anchor exists in the document.
2016-02-16 09:53:44 +00:00
| stext{cl} | Formats the macro argument like sname{cl}. May contain
asterisks for wildcards. Not validated. Example:
stext{cl}Vk*CreateInfo -> stext:Vk*CreateInfo.
Only use stext{cl} when it is necessary to describe
something that should be rendered like a structure name,
but is not actually one (e.g. is a wildcard or subset of
an actual structure name).
2016-03-01 10:45:37 +00:00
| elink{cl} | Formats the macro argument as a Vulkan enumeration
2016-02-16 09:53:44 +00:00
name and links to the definition of that enumeration type.
Example: ename{cl}VkResult -> ename:VkResult.
| ename{cl} | Formats the macro argument as a Vulkan enumerant name.
Example: ename{cl}VK_EVENT_SET -> ename:VK_EVENT_SET.
| etext{cl} | Formats the macro argument like ename{cl}. Not validated.
Examples: etext{cl}_RANGE_SIZE -> etext:_RANGE_SIZE,
etext{cl}VK_IMAGE_CREATE_SPARSE_* ->
etext:VK_IMAGE_CREATE_SPARSE_*
Only use stext{cl} when it is necessary to describe
something that should be rendered like a enumerant name,
but is not actually one (e.g. is a wildcard or subset of
an actual enumerant name).
| pname{cl} | Formats the macro argument as a Vulkan parameter or
structure member name. Example: pname{cl}device ->
pname:device.
| ptext{cl} | Formats the macro argument like pname{cl}. May contain
asterisks for wildcards. Not validated. Example:
ptext{cl}sparseResidency* -> ptext:sparseResidency*.
Only use ptext{cl} when it is necessary to describe
something that should be rendered like a parameter name,
but is not actually one (e.g. is a wildcard or subset of
an actual parameter name).
| tlink{cl} | Generates a cross-reference or link to the definition
of the Vulkan type in the macro argument. Example:
tlink{cl}PFN_vkAllocationFunction ->
tlink:PFN_vkAllocationFunction. This is only used for
function pointer types at present.
| tname{cl} | Formats the macro argument like tlink{cl}. Does not
generate a cross-reference. Example:
tname{cl}PFN_vkAllocationFunction ->
tname:PFN_vkAllocationFunction. The tlink{cl} macro is
preferred.
| basetype{cl} | Formats the macro argument like a basic scalar type
or API handle name. Not validated. Examples:
basetype{cl}uint32_t -> basetype:uint32_t,
basetype{cl}VkDeviceSize -> basetype:VkDeviceSize.
| code{cl} | Formats the macro argument as a code sample. Primarily
used for SPIR-V keywords. Examples: code{cl}ClipDistance
Change log for April 22, 2016 Vulkan 1.0.11 spec update: * Bump API patch number and header version number to 11 for this update. Github Issues: * Clarify the WSI extension language by switching from the fuzzier "ownership" language to more-consistent "acquire" language (public issue 117). * Clarify that memory barriers apply to all commands in the dependency chains in the flink:vkGetRenderAreaGranularity command and the <<synchronization-execution-and-memory-dependencies,Execution And Memory Dependencies>> section (public issue 132). * Clarify that a queue family is a set of queues in the <<fundamentals-execmodel,Execution Model>> section (public issue 166). * Removed requirement from valid usage language that VkPresentInfoKHR::waitSemaphoreCount must be greater than 0 (public issue 171). * Fix broken internal links, describe structures consistently, use consistent style for SPIR-V codewords, and tag normative terms that were missing asciidoc tags (public issue 183 and ancillary markup/normative language fixes). * Fix typos for slink:VkPhysicalDeviceLimits member names in slink:VkImageCreateInfo validity language (public issue 184). Internal Issues: * Document that the requested patch version number specified as part of slink:VkApplicationInfo::pname:apiVersion is ignored when creating an instance (internal issue 176). * Clarify handling of extension structs in the <<fundamentals-validusageValid Usage>> section (internal issue 254). * Update required slink:VkImageFormatProperties::pname:maxMipLevels to be limited to the maximum allowed mipmap pyramid size corresponding to the actual maximum supported size for the format (internal issue 256). * Modify the <<features-extentperimagetype,Allowed Extent Values Based On Image Type>> section so the allowed maximum extent is the maximum image dimension supported for each dimension of the type of texture being queried (internal issue 257). * Clarify in the <<spirvenv-module-validation,Validation Rules within a Module>> section that at least one of the code:LocalSize execution mode or code:WorkgroupSize decoration is required for each compute shader entry point in a shader module (internal issue 279). * Add validity rules for formats in flink:vkCmdClearColorImage and flink:vkCmdClearDepthStencilImage (internal issue 283). * Clarify that slink:VkImageFormatProperties::pname:maxResourceSize is an upper bound, and that it may not be possible to create an image anywhere near that size (internal issue 284). Other Commits: * Fix various minor markup errors reported by validation scripts. * Change copyright from Khronos Free Use License to Apache 2.0 license on relevant script/XML/header files. This does not affect the specification source copyright.
2016-04-21 08:08:38 +00:00
-> code:ClipDistance, code{cl}VK_NULL_HANDLE ->
code:VK_NULL_HANDLE, code{cl}NULL -> code:NULL.
2016-02-16 09:53:44 +00:00
|=====
==== Other Markup
Uses of standard Asciidoc markup are less common. Occasional asterisk markup
is used for *emphasis*. Backtick markup is sometimes used for the C `NULL`
macro, but the code{cl} macro should be used for code:NULL instead.
.Example Markup
----
*emphasis*
`NULL`
code:NULL
----
==== Glossary Terms
_Glossary terms_ are currently marked up using underscore markup where they
are defined in the documents, as well as being added to the formal Glossary
appendix in the Specification. However, we will probably change to using
custom macros soon, to enable linkage between the glossary appendix and
definitions in the spec body.
.Example Markup
----
_Glossary terms_
----
=== Normative Terminology
Normative terminology is precisely defined in section 1.3 of the Vulkan API
Specification, and is used to visually tag terms which express mandatory and
optional behavior of Vulkan implementations, and of applications using
Vulkan.
Whenever one of these terms appears in the Specification, it must: be tagged
using the macros, to indicate that its use has been carefully considered and
is consistent with the definitions in section 1.3. This is extremely
important for determining IP that is in and out of Scope during Ratification
reviews. The normative terminology macros are defined in the following
table:
.Normative Terminology Macros
[width="100%",options="header"]
|=====
| Macro Name | Meaning
| can{cl} | can:
| cannot{cl} | cannot:
| may{cl} | may:
| must{cl} | must:
| mustnot{cl} | mustnot:
| optional{cl} | optional:
| optionally{cl} | optionally:
| recommend{cl} | recommend:
| required{cl} | required:
| should{cl} | should:
| shouldnot{cl} | shouldnot:
|=====
Because asciidoc macro names cannot contain spaces, macros which correspond
Change log for March 4, 2016 Vulkan 1.0.5 spec update: * Bump API patch number to 5 for this update. Github Issues: * Correctly describe slink:VkPhysicalDeviceProperties pname:deviceName member as a string, not a pointer to a string. Also one typo fix for "hetereogeneous" (public issue 4). * Replace maynot: macro with may: not, and "may: or maynot:" with "may:" (public issue 4). * Clarify that redundantly setting the state of a fence or event has no effect (public issue 4). * Minor fixes to ref pages to track descriptions of memory bits that changed in the core spec. Fix name of a member in the description of sname:sname:VkPipelineMultisampleStateCreateInfo (public issues 8, 13). * Remove redundant validity statement for sname:VkGraphicsPipelineCreateInfo::pname:stageCount (public issue 14). * Fix typos in chapters 7-9 (public issue 14). * Clarify the example demonstrating the behavior of code:OpMemoryBarrier in the &lt;&lt;shaders-execution-memory-ordering,shader memory acces ordering>> section (public issue 16). * Specify that freeing mapped memory implicitly unmaps the memory in the description of flink:vkFreeMemory (public issue 17). * Forbid allocation callbacks from calling into the API in the &lt;&lt;memory-allocation,memory allocation>> section (public issue 20). * Add missing validity rules about size being greater than 0 and offset being less than size of object. Fix flink:VkMappedMemoryRange's misinterpretation of offset (public issues 27, 31). * Add validity rule disallowing overlapping source/destination descriptors in flink:VkCopyDescriptorSet (public issue 32). * Clarify that array and matrix stride has to be a multiple of the base alignment of the array or matrix in the &lt;&lt;interfaces-resources-layout,Offset and Stride Assignment>> section (public issue 38). * Correct parenthesis floor nesting error in equation for &lt;&lt;textures-RGB-sexp,RGB to shared exponent conversion>>. Clarify case of when exp' is forced to 0, avoiding log2(0) undefined problem (public issue 40). * Remove redundant statement from the code:FragDepth description in the &lt;&lt;interfaces-builtin-variables,Built-In Variables>> section (public issue 47). * Define the clamping of the &lt;&lt;textures-level-of-detail-operation,bias added to the scale factor>> by linking to the slink:VkPhysicalDevice feature pname:maxSamplerLodBias (public issue 64). * Fix typo "optimal linear resources" and clarify the set of resources &lt;&lt;features-limits-bufferImageGranularity,the pname:bufferImageGranularity resource>> applies to (public issue 67). * Replace 'descriptor accessed by a pipeline' language for sname:VkDescriptorSetAllocateInfo with more precise phrasing about binding a descriptor set before a command that invokes work using that set (public issue 69). * tstripadj.svg contained an Inkscape tag which caused Firefox and IE 11 to fail to render it, and was illegal SVG. Generating Plain SVG from the Inkscape SVG source fixes this (public issue 70). * Fix validity for sname:VkVertexInputBindingDescription and sname:VkVertexInputAttributeDescription numbers (public issue 72). Internal Issues: * Clarify the meaning of ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT in elink:VkFormatFeatureFlagBits with respect to depth compare (internal issue 107). * Added a note explaining that ename:VK_QUEUE_TRANSFER_BIT may or may not be reported for a queue family that already supports ename:VK_QUEUE_GRAPHICS_BIT or ename:VK_QUEUE_COMPUTE_BIT as the former is a strict subset of the latter ones (internal issue 116). * Add validity language for sname:VkDescriptorSetAllocateInfo about exceeding the descriptor pool capacity (internal issue 140). * Add ename:VK_INCOMPLETE success code for flink:vkEnumeratePhysicalDevices query (internal issue 163). Other Commits: * Add the VK_NV_glsl_shader extension definitions to the API. * Update GL_KHR_vulkan_glsl with 1) origin_upper_left as default 2) specialization array constant semantics. * Corrected/updated Data Format Specification date.
2016-03-03 13:06:18 +00:00
to multiple words (mustnot{cl}, and shouldnot{cl}) drop those spaces. Also
note that the macros are lower-case only, so language should be written such
that these terms do not appear at the beginning of a sentence (if really
necessary, additional capitalized macros could be added).
2016-02-16 09:53:44 +00:00
==== Optional Behavior
If a described behavior of the implementation is not necessary for
conformance, use the terms _may:_ or _optional:_ to describe it.
If a described usage pattern by the application is allowed but
not necessary, use the term _can:_ to describe it.
Change log for March 4, 2016 Vulkan 1.0.5 spec update: * Bump API patch number to 5 for this update. Github Issues: * Correctly describe slink:VkPhysicalDeviceProperties pname:deviceName member as a string, not a pointer to a string. Also one typo fix for "hetereogeneous" (public issue 4). * Replace maynot: macro with may: not, and "may: or maynot:" with "may:" (public issue 4). * Clarify that redundantly setting the state of a fence or event has no effect (public issue 4). * Minor fixes to ref pages to track descriptions of memory bits that changed in the core spec. Fix name of a member in the description of sname:sname:VkPipelineMultisampleStateCreateInfo (public issues 8, 13). * Remove redundant validity statement for sname:VkGraphicsPipelineCreateInfo::pname:stageCount (public issue 14). * Fix typos in chapters 7-9 (public issue 14). * Clarify the example demonstrating the behavior of code:OpMemoryBarrier in the &lt;&lt;shaders-execution-memory-ordering,shader memory acces ordering>> section (public issue 16). * Specify that freeing mapped memory implicitly unmaps the memory in the description of flink:vkFreeMemory (public issue 17). * Forbid allocation callbacks from calling into the API in the &lt;&lt;memory-allocation,memory allocation>> section (public issue 20). * Add missing validity rules about size being greater than 0 and offset being less than size of object. Fix flink:VkMappedMemoryRange's misinterpretation of offset (public issues 27, 31). * Add validity rule disallowing overlapping source/destination descriptors in flink:VkCopyDescriptorSet (public issue 32). * Clarify that array and matrix stride has to be a multiple of the base alignment of the array or matrix in the &lt;&lt;interfaces-resources-layout,Offset and Stride Assignment>> section (public issue 38). * Correct parenthesis floor nesting error in equation for &lt;&lt;textures-RGB-sexp,RGB to shared exponent conversion>>. Clarify case of when exp' is forced to 0, avoiding log2(0) undefined problem (public issue 40). * Remove redundant statement from the code:FragDepth description in the &lt;&lt;interfaces-builtin-variables,Built-In Variables>> section (public issue 47). * Define the clamping of the &lt;&lt;textures-level-of-detail-operation,bias added to the scale factor>> by linking to the slink:VkPhysicalDevice feature pname:maxSamplerLodBias (public issue 64). * Fix typo "optimal linear resources" and clarify the set of resources &lt;&lt;features-limits-bufferImageGranularity,the pname:bufferImageGranularity resource>> applies to (public issue 67). * Replace 'descriptor accessed by a pipeline' language for sname:VkDescriptorSetAllocateInfo with more precise phrasing about binding a descriptor set before a command that invokes work using that set (public issue 69). * tstripadj.svg contained an Inkscape tag which caused Firefox and IE 11 to fail to render it, and was illegal SVG. Generating Plain SVG from the Inkscape SVG source fixes this (public issue 70). * Fix validity for sname:VkVertexInputBindingDescription and sname:VkVertexInputAttributeDescription numbers (public issue 72). Internal Issues: * Clarify the meaning of ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT in elink:VkFormatFeatureFlagBits with respect to depth compare (internal issue 107). * Added a note explaining that ename:VK_QUEUE_TRANSFER_BIT may or may not be reported for a queue family that already supports ename:VK_QUEUE_GRAPHICS_BIT or ename:VK_QUEUE_COMPUTE_BIT as the former is a strict subset of the latter ones (internal issue 116). * Add validity language for sname:VkDescriptorSetAllocateInfo about exceeding the descriptor pool capacity (internal issue 140). * Add ename:VK_INCOMPLETE success code for flink:vkEnumeratePhysicalDevices query (internal issue 163). Other Commits: * Add the VK_NV_glsl_shader extension definitions to the API. * Update GL_KHR_vulkan_glsl with 1) origin_upper_left as default 2) specialization array constant semantics. * Corrected/updated Data Format Specification date.
2016-03-03 13:06:18 +00:00
If language flows more logically using the term "may not", use the term
_may: not_ to describe it.
2016-02-16 09:53:44 +00:00
==== Optional Functionality
If functionality (rather than behavior) is optional, it should be
described as
.Example Markup
----
not required:
----
Implementations are not mandated to support functionality which is not
required:, but if they do, they must: behave as described by the
Specification. The term _functionality_ includes API features, extensions,
and layers.
[[markup-informative]]
== Informative, Editing and Implementor's Notes
There are several possible types of notes. Depending on the type of output,
they are rendered in different styles, but always include a note title, and
are usually set off in a box or with an icon. While asciidoc supports a wide
set of _admonition paragraphs_ such as TIP, IMPORTANT, WARNING, and CAUTION,
we always use the NOTE form, augmented by a note title. Each type of note is
discussed below.
[[markup-informative-notes]]
=== Informative Notes
Informative notes always appear as part of the document, but are considered
non-normative. They usually describe usage advice for applications, and are
always given the title _Note_, as in the following example:
[NOTE]
.Note
====
This is an informative note.
====
.Example Markup
----
[NOTE]
.Note
====
This is an informative note.
====
----
If an entire chapter or section is considered informative, it should begin
with the sentence:
.Example Markup
----
This chapter/section is Informative.
----
=== Editing Notes
Editing notes only appear in internal (non-published) versions of documents,
via asciidoc conditionals, and should be removed from the source before
pushing content to a canonical (master or per-extension) public repository.
They usually tag places where an outstanding bug or Gitlab/Github issue is
being worked, and are always given the title _editing-note_, as in the
following example:
ifdef::editing-notes[]
[NOTE]
.editing-note
====
This is an editing note, marked up as follows:
====
endif::editing-notes[]
.Example Markup
----
\ifdef::editing-notes[]
[NOTE]
.editing-note
====
Contents of an editing note go here. It is good practice to include a
bug/issue number, or link to the bug/issue, in the editing note.
====
\endif::editing-notes[]
----
=== Implementor's Notes
Implementor's notes may or may not appear in published versions of
documents, via asciidoc conditionals. They describe suggested approaches or
guidelines for people writing Vulkan implementations, and are rare because
the hardware being targeted varies so widely. They are always given the
title _Implementor's Note_, as in the following example:
ifdef::implementation-guide[]
.Implementor's Note
====
This is an implementor's note, marked up as follows:
====
endif::implementation-guide[]
.Example Markup
----
\ifdef::implementation-guide[]
.Implementor's Note
====
Contents of an implementor's note go here.
====
\endif::implementation-guide[]
----
== Word Choices
There are a variety of common terms that have several equivalent word
choices. Always use the words in the first column instead of the alternate
terms. This list may not be comprehensive; when in doubt, be guided by the
existing API Specification.
.Word Choices
[width="100%",options="header"]
|=====
| Use This | Instead Of | Comments
| allocate | create
| When describing objects or memory resulting from
ftext:vkAllocate* commands.
| application | client |
| command | function
| Except when talking about function pointers returned by
ftext:vkGet*ProcAddr commands.
| create | allocate
| When describing objects resulting from ftext:vkCreate*
commands.
| depth/stencil | packed (interleaved, combined, _other prefix_)
depth/stencil, depth-stencil, DepthStencil, etc.
| Combined format implicit in the name.
| device | GPU
| Implementations on non-GPU devices are possible.
Change log for March 4, 2016 Vulkan 1.0.5 spec update: * Bump API patch number to 5 for this update. Github Issues: * Correctly describe slink:VkPhysicalDeviceProperties pname:deviceName member as a string, not a pointer to a string. Also one typo fix for "hetereogeneous" (public issue 4). * Replace maynot: macro with may: not, and "may: or maynot:" with "may:" (public issue 4). * Clarify that redundantly setting the state of a fence or event has no effect (public issue 4). * Minor fixes to ref pages to track descriptions of memory bits that changed in the core spec. Fix name of a member in the description of sname:sname:VkPipelineMultisampleStateCreateInfo (public issues 8, 13). * Remove redundant validity statement for sname:VkGraphicsPipelineCreateInfo::pname:stageCount (public issue 14). * Fix typos in chapters 7-9 (public issue 14). * Clarify the example demonstrating the behavior of code:OpMemoryBarrier in the &lt;&lt;shaders-execution-memory-ordering,shader memory acces ordering>> section (public issue 16). * Specify that freeing mapped memory implicitly unmaps the memory in the description of flink:vkFreeMemory (public issue 17). * Forbid allocation callbacks from calling into the API in the &lt;&lt;memory-allocation,memory allocation>> section (public issue 20). * Add missing validity rules about size being greater than 0 and offset being less than size of object. Fix flink:VkMappedMemoryRange's misinterpretation of offset (public issues 27, 31). * Add validity rule disallowing overlapping source/destination descriptors in flink:VkCopyDescriptorSet (public issue 32). * Clarify that array and matrix stride has to be a multiple of the base alignment of the array or matrix in the &lt;&lt;interfaces-resources-layout,Offset and Stride Assignment>> section (public issue 38). * Correct parenthesis floor nesting error in equation for &lt;&lt;textures-RGB-sexp,RGB to shared exponent conversion>>. Clarify case of when exp' is forced to 0, avoiding log2(0) undefined problem (public issue 40). * Remove redundant statement from the code:FragDepth description in the &lt;&lt;interfaces-builtin-variables,Built-In Variables>> section (public issue 47). * Define the clamping of the &lt;&lt;textures-level-of-detail-operation,bias added to the scale factor>> by linking to the slink:VkPhysicalDevice feature pname:maxSamplerLodBias (public issue 64). * Fix typo "optimal linear resources" and clarify the set of resources &lt;&lt;features-limits-bufferImageGranularity,the pname:bufferImageGranularity resource>> applies to (public issue 67). * Replace 'descriptor accessed by a pipeline' language for sname:VkDescriptorSetAllocateInfo with more precise phrasing about binding a descriptor set before a command that invokes work using that set (public issue 69). * tstripadj.svg contained an Inkscape tag which caused Firefox and IE 11 to fail to render it, and was illegal SVG. Generating Plain SVG from the Inkscape SVG source fixes this (public issue 70). * Fix validity for sname:VkVertexInputBindingDescription and sname:VkVertexInputAttributeDescription numbers (public issue 72). Internal Issues: * Clarify the meaning of ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT in elink:VkFormatFeatureFlagBits with respect to depth compare (internal issue 107). * Added a note explaining that ename:VK_QUEUE_TRANSFER_BIT may or may not be reported for a queue family that already supports ename:VK_QUEUE_GRAPHICS_BIT or ename:VK_QUEUE_COMPUTE_BIT as the former is a strict subset of the latter ones (internal issue 116). * Add validity language for sname:VkDescriptorSetAllocateInfo about exceeding the descriptor pool capacity (internal issue 140). * Add ename:VK_INCOMPLETE success code for flink:vkEnumeratePhysicalDevices query (internal issue 163). Other Commits: * Add the VK_NV_glsl_shader extension definitions to the API. * Update GL_KHR_vulkan_glsl with 1) origin_upper_left as default 2) specialization array constant semantics. * Corrected/updated Data Format Specification date.
2016-03-03 13:06:18 +00:00
| heterogeneous | heterogenous | More common
| homogeneous | homogenous | More common
2016-02-16 09:53:44 +00:00
| host endianness | platform endianness |
Change log for April 15, 2016 Vulkan 1.0.10 spec update: * Bump API patch number and header version number to 10 for this update. Github Issues: * Slightly tweak the <<memory-allocation,Host Memory>> allocator language so that an application wrapping the standard C alloc/free/realloc functions is still correct - the previous language was too strong with regards to freeing memory. Also made certain scenarios clearer - an implementation may now continue without error if an allocation failed and it is able to continue correctly (public issue 21). * Require that etext:VK_*_CREATE_SPARSE_BINDING_BIT is set when the corresponding etext:VK_*_CREATE_SPARSE_RESIDENCY_BIT is used, in the <<sparsememory-miptail,Mip Tail Regions>> section and related commands flink:vkCreateBuffer and flink:vkCreateImage (public issue 84). * Update the <<features,Features, Limits, and Formats>> chapter to clarify interactions between optional features and dynamic state for the pname:depthBiasClamp and pname:wideLines features (public issue 89). * Describe the code:WorkgroupSize builtin in the <<interfaces-builtin-variables,Built-In Variables>> section, and update the <<compute-shaders,Compute Shaders>> section to further clarify how to set the number of workgroups to execute in a compute shader (public issue 145). * Use the term *image subresource* everywhere instead of *subresource*, except for the special case of *host-accessible subresource*, which may be either an image subresource or buffer range (public issue 120) * Add a note to the <<features,Features, Limits, and Formats>> section about extensibility of structures (Public issue 165). * Fix return code flink:vkAcquireNextImageKHR when the timeout parameter is 0 to ename:VK_NOT_READY instead of ename:VK_TIMEOUT (public issue 170). * Fix typo in slink:VkLayerProperties::pname:apiVersion field (public issue 172). Internal Issues: * Fix a few minor internally-detected typos. * Minor formatting tweaks to pseudocode in the <<resources,Resource Creation>> chapter (internal issue 179). * Fix typo in the definition of point sampling for elink:VkCullModeFlagBits (internal issue 268).
2016-04-14 08:58:49 +00:00
| image subresource | subresource
| Except when referring to *host-accessible subresources*
2016-02-16 09:53:44 +00:00
| implementation| system |
Change log for March 4, 2016 Vulkan 1.0.5 spec update: * Bump API patch number to 5 for this update. Github Issues: * Correctly describe slink:VkPhysicalDeviceProperties pname:deviceName member as a string, not a pointer to a string. Also one typo fix for "hetereogeneous" (public issue 4). * Replace maynot: macro with may: not, and "may: or maynot:" with "may:" (public issue 4). * Clarify that redundantly setting the state of a fence or event has no effect (public issue 4). * Minor fixes to ref pages to track descriptions of memory bits that changed in the core spec. Fix name of a member in the description of sname:sname:VkPipelineMultisampleStateCreateInfo (public issues 8, 13). * Remove redundant validity statement for sname:VkGraphicsPipelineCreateInfo::pname:stageCount (public issue 14). * Fix typos in chapters 7-9 (public issue 14). * Clarify the example demonstrating the behavior of code:OpMemoryBarrier in the &lt;&lt;shaders-execution-memory-ordering,shader memory acces ordering>> section (public issue 16). * Specify that freeing mapped memory implicitly unmaps the memory in the description of flink:vkFreeMemory (public issue 17). * Forbid allocation callbacks from calling into the API in the &lt;&lt;memory-allocation,memory allocation>> section (public issue 20). * Add missing validity rules about size being greater than 0 and offset being less than size of object. Fix flink:VkMappedMemoryRange's misinterpretation of offset (public issues 27, 31). * Add validity rule disallowing overlapping source/destination descriptors in flink:VkCopyDescriptorSet (public issue 32). * Clarify that array and matrix stride has to be a multiple of the base alignment of the array or matrix in the &lt;&lt;interfaces-resources-layout,Offset and Stride Assignment>> section (public issue 38). * Correct parenthesis floor nesting error in equation for &lt;&lt;textures-RGB-sexp,RGB to shared exponent conversion>>. Clarify case of when exp' is forced to 0, avoiding log2(0) undefined problem (public issue 40). * Remove redundant statement from the code:FragDepth description in the &lt;&lt;interfaces-builtin-variables,Built-In Variables>> section (public issue 47). * Define the clamping of the &lt;&lt;textures-level-of-detail-operation,bias added to the scale factor>> by linking to the slink:VkPhysicalDevice feature pname:maxSamplerLodBias (public issue 64). * Fix typo "optimal linear resources" and clarify the set of resources &lt;&lt;features-limits-bufferImageGranularity,the pname:bufferImageGranularity resource>> applies to (public issue 67). * Replace 'descriptor accessed by a pipeline' language for sname:VkDescriptorSetAllocateInfo with more precise phrasing about binding a descriptor set before a command that invokes work using that set (public issue 69). * tstripadj.svg contained an Inkscape tag which caused Firefox and IE 11 to fail to render it, and was illegal SVG. Generating Plain SVG from the Inkscape SVG source fixes this (public issue 70). * Fix validity for sname:VkVertexInputBindingDescription and sname:VkVertexInputAttributeDescription numbers (public issue 72). Internal Issues: * Clarify the meaning of ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT in elink:VkFormatFeatureFlagBits with respect to depth compare (internal issue 107). * Added a note explaining that ename:VK_QUEUE_TRANSFER_BIT may or may not be reported for a queue family that already supports ename:VK_QUEUE_GRAPHICS_BIT or ename:VK_QUEUE_COMPUTE_BIT as the former is a strict subset of the latter ones (internal issue 116). * Add validity language for sname:VkDescriptorSetAllocateInfo about exceeding the descriptor pool capacity (internal issue 140). * Add ename:VK_INCOMPLETE success code for flink:vkEnumeratePhysicalDevices query (internal issue 163). Other Commits: * Add the VK_NV_glsl_shader extension definitions to the API. * Update GL_KHR_vulkan_glsl with 1) origin_upper_left as default 2) specialization array constant semantics. * Corrected/updated Data Format Specification date.
2016-03-03 13:06:18 +00:00
| indices | indexes | More common
2016-02-16 09:53:44 +00:00
| it is | it's | In general, avoid contractions.
| member | field |
| pname:parameter are/is
| pname:parameter specifies (denotes, indicates)
| In rare cases when _are_ or _if_ are not grammatically
appropriate, _specifies_ may be used instead.
Change log for March 25, 2016 Vulkan 1.0.7 spec update: * Bump API patch number and header version number to 7 for this update. Github Issues: * Fix slink:VkSpecializationMapEntry example to avoid C/C++ strict aliasing issues (public issue 14). * Clarify the meaning of "matching" in flink:vkCmdBindDescriptorSets validity language (public issue 33). * Add stub reference pages so xrefs to not-yet-written pages don't generate 404 errors. However, the actual content of these pages still needs to be filled in as time allows (public issue 44, but does not close that issue out). * Remove incorrect validity statement for flink:vkGetImageSparseMemoryRequirements (public issue 85). * Reword the <<features-limits-bufferImageGranularity,bufferImageGranularity>> feature in terms of "aliasing", and clarify that it applies to bindings in the same memory object (public issue 90). * Clarify the relationship of the slink:VkPhysicalDeviceLimits pname:maxViewportDimensions and pname:viewportBoundsRange limits (public issue 92). * Specify sparse unbound texture replacement in the <<textures-texel-replacement,Texel Replacement>> section independently of robust buffer access language (public issue 100). * Add the <<fundamentals-architecture-model,Architecture Model>> section to explain architecture constraints Vulkan has chosen to accept in order to enable portable and performant code (public issue 122). * State that an object must not be destroyed until *all* (not *any*) uses of that object have completed (public issue 123). * Minor editorial cleanup (public issues 129, 134, 146, 148). * Add validity language for layer and extension names to slink:VkDeviceCreateInfo matching that used for slink:VkInstanceCreateInfo (public issue 130). * Clean up terminology for the case when the bits set in one bitmask are a subset of the bits set in another bitmask (public issue 138). * Document that input attachments are UniformConstant not Input, in the <<interfaces-inputattachment,Fragment Input Attachment Interface>> section (public glslang bug 169). Internal Issues: * Add max enum values to "flag bits" enums (internal issue #136). * Clarify language around the various uses of the term "block" in the <<appendix-compressedtex-bc,Block Compressed Image Formats>> section (internal issue #202). * Removed "expand" dependency from <enums> groups in vk.xml and added auto-generation code in the scripts to infer it instead, to ensure consistency. This caused renaming of sname:VkColorSpaceKHR and sname:VkPresentModeKHR etext:BEGIN_RANGE (etc.) tokens, but those tokens are metadata, not part of the API, and the Vulkan WG is OK with this change. This change adds ranges to two additional enums that were missing them due to not defining the "expand" attribute (internal issue 217). * Tweak makefile to generate ref page nroff (.3) files in the right output directory, working around an a2x limitation (internal issue 223). Other Commits: * Add validity requirements for flink:vkCmdCopyQueryPoolResults pname:dstBuffer parameter. * Fix ref page build to generate .3 targets in the right output directory.
2016-03-25 09:25:04 +00:00
| pname:parameter is
| the value of pname:parameter is
| In rare cases, _the value of_ is appropriate. See the
existing specification language for examples.
2016-02-16 09:53:44 +00:00
| begins / begun | starts / started | For ftext:vkBegin* - also see ``finish''
| finishes / finished | ends / ended | For ftext:vkEnd* - also see ``begins''
| used | referenced | When describing attachments specified in a
subpass description.
| statically used | referenced | When describing resources or push constants
accessed by shader code
| a more specific term | referenced | For all other situations.
| component | channel | Specifically this refers to color channels/components
|=====
[NOTE]
.Note
====
The ``begin/start'' and ``end/finish'' distinction is still being sorted out.
See Gitlab issue #61.
====
Change log for April 29, 2016 Vulkan 1.0.12 spec update: * Bump API patch number and header version number to 12 for this update. Github Issues: * Change valid usage statements intended to be "sub-points" to be actual sub-points (public issue 66). * Replace double negation in description of slink:VkRenderPassBeginInfo::pname:pClearValues (based on public merge 142). * Cleanup minor typos in spec, ref pages and XML, including those proposed in public pull requests 144, 150, 151, 167, 168, 181, and 186. * Use *strict subset* in describing the partial order of memory property types for slink:VkMemoryType, and update the style guide accordingly (public issue 190). * Fix various "a image" -> "an image" typos (public issue 191). * Note in the <<fundamentals-validusage,Valid Usage>> and <<extensions-interactions,Extension Interactions>> sections that structures defined by extensions which may be passed in structure chains using the ptext:pNext member must: include initial ptext:sType and ptext:pNext members (public issue 192). Internal Issues: * Remove duplicate language from the description of the pname:fence parameter to flink:vkQueueSubmit and improve validity language (internal issue 91). * Added documentation for "optional" attribute to XML readme.tex/pdf (internal issue 149). * Clarify the host-side data validity rules and behavior of flink:vkFlushMappedMemoryRanges and flink:vkInvalidateMappedMemoryRanges (internal issue 266). Other Commits: * Added clarification to flink:vkCmdFillBuffer regarding the use of ename:VK_WHOLE_SIZE. * Fixed and documented implementation of "validextensionstructs" attribute. in XML processing scripts and readme.tex/pdf. * Add missing validity statements to flink:vkResetEvent and flink:vkCmdResetEvent. * Fix validity for the ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT flag. Correct all the draw/dispatch commands to mention optimally tiled images as well as linear tiled images, and say image VIEWS instead of images. Add validity statement to flink:vkCmdBlitImage * Replace the {apiname} macro with hardcoded "Vulkan", now that we've committed to that name. * Add the VK_AMD_rasterization_order extension to vk.xml.
2016-04-29 12:53:46 +00:00
=== Terms to Use With Caution
The term _subset_ is sometimes used to refer to a _strict subset_, and
sometimes used to refer to a subset which may be equal to the entire set.
This is particularly likely to come up when describing bitmasks. Make sure
to use either _subset_ or _strict subset_ as appropriate.
2016-02-16 09:53:44 +00:00
=== Terms to Avoid
Don't describe anything in the documentation using vague or wishy-washy
terms. Our goal is to precisely describe behavior of implementations.
The normative terms may:, optional:, and should: are available when
implementations may make choices of behavior, but when such choices are
allowed, each choice still must: have well-defined behavior.
.Terms to Avoid
[width="100%",options="header"]
|=====
| Bad Term | Comments
| expect | And variants such as _expected_
| likely | And variants such as _will likely_
| allowed, could, generally, might, probably, perhaps
| And all other such terms of choice. Use _may:_ or _can:_
depending on the context.
Change log for April 15, 2016 Vulkan 1.0.10 spec update: * Bump API patch number and header version number to 10 for this update. Github Issues: * Slightly tweak the <<memory-allocation,Host Memory>> allocator language so that an application wrapping the standard C alloc/free/realloc functions is still correct - the previous language was too strong with regards to freeing memory. Also made certain scenarios clearer - an implementation may now continue without error if an allocation failed and it is able to continue correctly (public issue 21). * Require that etext:VK_*_CREATE_SPARSE_BINDING_BIT is set when the corresponding etext:VK_*_CREATE_SPARSE_RESIDENCY_BIT is used, in the <<sparsememory-miptail,Mip Tail Regions>> section and related commands flink:vkCreateBuffer and flink:vkCreateImage (public issue 84). * Update the <<features,Features, Limits, and Formats>> chapter to clarify interactions between optional features and dynamic state for the pname:depthBiasClamp and pname:wideLines features (public issue 89). * Describe the code:WorkgroupSize builtin in the <<interfaces-builtin-variables,Built-In Variables>> section, and update the <<compute-shaders,Compute Shaders>> section to further clarify how to set the number of workgroups to execute in a compute shader (public issue 145). * Use the term *image subresource* everywhere instead of *subresource*, except for the special case of *host-accessible subresource*, which may be either an image subresource or buffer range (public issue 120) * Add a note to the <<features,Features, Limits, and Formats>> section about extensibility of structures (Public issue 165). * Fix return code flink:vkAcquireNextImageKHR when the timeout parameter is 0 to ename:VK_NOT_READY instead of ename:VK_TIMEOUT (public issue 170). * Fix typo in slink:VkLayerProperties::pname:apiVersion field (public issue 172). Internal Issues: * Fix a few minor internally-detected typos. * Minor formatting tweaks to pseudocode in the <<resources,Resource Creation>> chapter (internal issue 179). * Fix typo in the definition of point sampling for elink:VkCullModeFlagBits (internal issue 268).
2016-04-14 08:58:49 +00:00
| may: or may: not | Just use _may:_.
2016-02-16 09:53:44 +00:00
|=====
[[writingstyle]]
= Writing Style
[[writingstyle-misc]]
== Miscellaneous Grammar, Spelling, and Punctuation Issues
=== Use the Oxford Comma (Serial Comma)
When writing a sentence listing a series of items, include a comma before
the ``and'' separating the last item.
*Correct:* The red, green, blue, and alpha components.
*Incorrect:* The red, green, blue and alpha components.
Also see http://blog.oxforddictionaries.com/2011/06/oxford-comma/
=== Numbers in Text
When describing the need for a small number of objects, smaller than ten, spell
the number out (e.g. ``one''). If you are describing a literal value that is a
small number, you may use a numeric value (e.g. ``1'').
For example, instead of writing that a bitfield ``contains 1 or more bits'',
write that it ``contains one or more bits''. A counter example is that it is okay
to write ``For non-stereoscopic-3D applications, this value is 1.''
Change log for May 13, 2016 Vulkan 1.0.13 spec update: * Bump API patch number and header version number to 13 for this update. Github Issues: * Improve the description of ename:VK_PRESENT_MODE_FIFO_RELAXED_KHR in the VK_KHR_surface extension (public issue 174). * Clarify use of etext:*_SIMULTANEOUS_USE_BIT for secondary command buffers (public issue 182). * Fix typos in VK_KHR_wayland_surface extension where code:wl_device was used instead of code:wl_display (public issue 193). * Replaced {apiname} with ``Vulkan'' in XML validity statements (public issue 199). * Fix dead links for WSI handle types (public issue 200). *** N.b. this needs to be done in WSI branches as well *** * Use "signaled" instead of "signalled" spelling everywhere (public issue 201). *** N.b. this needs to be done in WSI branches as well *** * Move readme.pdf target directory for XML schema documentation into the target generation directory, instead of leaving it checked into the spec source tree (public issue 203). *** N.b. need to add generated PDF to registry index/1.0 page * Fix duplicate 'which which' typo in description of elink:VkCommandPoolResetFlagBits (public issue 204). * Move the <<Programmable Primitive Shading>> section up one level, out of the <<drawing-primitive-topologies,Primitive Topologies>> section (public issue 209). Internal Issues: * Clarify in the <<pipelines-cache,Pipeline Cache>> section that implementations should not manage the size of pipeline cache (internal issue 192). * Deprecate the concept of device layers and associated commands (internal issue 255). * Remove ename:VK_INCOMPLETE from the list of possible result codes of flink:vkGetPhysicalDeviceSurfaceCapabilitiesKHR (internal issue 314). * Add missing std140/std430 rule: the base alignment of a member following a structure is a multiple of the structure's base alignment (internal issue 321). * Fixes naming of the single elink:VkColorSpaceKHR enum from ename:VK_COLORSPACE_SRGB_NONLINEAR_KHR to ename:VK_COLOR_SPACE_SRGB_NONLINEAR_KHR in XML/header and the VK_KHR_swapchain and VK_KHR_surface extensions to match the style of the typename (space and color are two words, not one) (internal issue 322). * Make it clear that code:LocalInvocationID should only be applied to an input variable and normalize the language describing code:LocalInvocationID to the language for other compute shader variables in the <<interfaces-builtin-variables,Built-in Variables>> section, and add normative language (internal issue 323). * Clarify in the <<fundamentals-returncodes,Return Codes>> section that the result pointer may be modified for specific commands, even if a runtime error is returned (internal issue 324).
2016-05-14 00:01:59 +00:00
=== Use American Spelling Conventions
In case of conflict, use American rather than British spelling
conventions. For example:
*Correct:* color, signaled.
*Incorrect:* colour, signalled.
2016-02-16 09:53:44 +00:00
[[writingstyle-describing]]
== Describing Commands and Parameters
The Specification describes API commands followed by descriptions of their
parameters, which are usually simple scalar types, handles or pointers to
Vulkan objects or arrays of objects, or structures containing combinations
of scalar types and objects. The templates and examples shown and annotated
here are based on the Specification. Do not vary from them without
compelling need.
Normative parts of the Specification should describe _what_ something does,
rather than _how_ or _why_ an application would want to use it.
[NOTE]
.Guideline
====
As a simple example, say
``To create a command pool, call fname:vkCreateCommandPool''
rather than
``You/The application/The user can create a command pool by calling
fname:vkCreateCommandPool''.
====
Explanations of _why_ and _how_ should largely be confined to reference
documentation, sample code, tutorials, and other such documents. Occasional
non-normative explanations can be included in the Specification using
<<markup-informative-notes,informative notes>>.
[[writingstyle-latexmath]]
== LaTeX Math Markup
There is a considerable amount of math in the documentation, ranging from
simple arithmetic expressions to complicated conditionals. For the most
part, math is marked up using LaTeX math notation, which is either passed
through to the Mathjax browser renderer for HTML outputs, or passed through
to LaTeX for PDF outputs. For some very simple math expressions, asciidoc
markup can be used.
[NOTE]
.Note
====
We still haven't got the latexmath vs. asciidoc font situation sorted out
for all target output forms, so there can be some visual inconsistencies.
====
While LaTeX math macros, including the amsmath package, are supported,
general LaTeX constructs are not.
_Inline math_ is encoded using the latexmath{cl} macro. For example:
* latexmath:[$[0,1\]$]
* latexmath:[$x \cdot 0 = 0 \cdot x = 0$]
* latexmath:[${\textbf c} = t {\textbf c}_1 + (1-t){\textbf c}_2. $]
.Example Markup
----
latexmath:[$[0,1\]$]
latexmath:[$x \cdot 0 = 0 \cdot x = 0$]
latexmath:[${\textbf c} = t {\textbf c}_1 + (1-t){\textbf c}_2. $]
----
Note the escaped bracket in markup for the first expression, which is
necessary to work around asciidoc macro parsing:
_Block math_ is used for more complex equations. This example uses the
amsmath `align*` macros to delimit the expression:
[latexmath]
+++++++++++++++++++
\begin{align*}
c_{RGB} & =
\begin{cases}
\frac{c_{sRGB}}{12.92} & \textrm{for } c_{sRGB} \leq 0.04045 \\
\left ( \frac{c_{sRGB}+0.055}{1.055} \right )^{2.4} & \textrm{for } c_{sRGB} > 0.04045
\end{cases}
\end{align*}
+++++++++++++++++++
.Example Markup
----
[latexmath]
+++++++++++++++++++
\begin{align*}
c_{RGB} & =
\begin{cases}
\frac{c_{sRGB}}{12.92} & \textrm{for } c_{sRGB} \leq 0.04045 \\
\left ( \frac{c_{sRGB}+0.055}{1.055} \right )^{2.4} & \textrm{for } c_{sRGB} > 0.04045
\end{cases}
\end{align*}
+++++++++++++++++++
----
This example uses normal LaTeX math brackets to delimit the expression:
[latexmath]
+++++++++++++++++++
\[
V =
\begin{cases}
(-1)^S \times 0.0, & E = 0, M = 0 \\
(-1)^S \times 2^{-14} \times { M \over 2^{10} },
& E = 0, M \neq 0 \\
(-1)^S \times 2^{E-15} \times { \left( 1 + { M \over 2^{10} } \right) },
& 0 < E < 31 \\
(-1)^S \times Inf, & E = 31, M = 0 \\
NaN, & E = 31, M \neq 0
\end{cases}
\]
+++++++++++++++++++
.Example Markup
----
[latexmath]
+++++++++++++++++++
\[
V =
\begin{cases}
(-1)^S \times 0.0, & E = 0, M = 0 \\
(-1)^S \times 2^{-14} \times { M \over 2^{10} },
& E = 0, M \neq 0 \\
(-1)^S \times 2^{E-15} \times { \left( 1 + { M \over 2^{10} } \right) },
& 0 < E < 31 \\
(-1)^S \times Inf, & E = 31, M = 0 \\
NaN, & E = 31, M \neq 0
\end{cases}
\]
+++++++++++++++++++
----
[[writingstyle-example]]
== An Example Command Description
The <<sample-command,next section>> is a sample based on the Specification,
and describes a command in enough detail to see the different usage patterns
and layout / markup used. Informative notes discussing markup and guidelines
are interspersed with the example description to explain how and why it
looks as it does.
[[sample-command]]
== Sample Command Description: Creating Command Pools
To create a command pool, call:
[NOTE]
.Guideline
====
Use a short, active sentence when describing what commands do, instead of
more passive phrasing like ``A command pool is created by calling:'' or ``The
application may create a command pool by calling:''.
====
include::../protos/vkCreateCommandPool.txt[]
[NOTE]
.Guideline
====
After the description, include the autogenerated prototype for the command
from the `../protos/` directory:
include::../protos/vkCreateCommandPool.txt[]
Note that each autogenerated command, enumeration, flag, or structure
definition include file also defines a corresponding asciidoc anchor which
is the base name of the file. In this case, the anchor is named
`vkCreateCommandPool`.
====
* pname:device is the logical device that the command pool is created on.
* pname:pCreateInfo points to an instance of the
slink:VkCommandPoolCreateInfo structure containing information used to
create the command pool.
* pname:pAllocator controls host memory allocation as described in the
<<memory-allocation, Memory Allocation>> chapter.
* pname:pCommandPool points to a handle in which the created command pool
object is returned.
[NOTE]
.Guideline
====
Each command parameter is described in a separate bullet list entry,
followed by validity rules, then detailed descriptions of any new
structures, flags, or enumerations introduced by this command.
Each parameter should appear as a separate bullet list item beginning with
the parameter name, in the same order as parameters appear in the command.
This aids in extracting short descriptions of parameters for inclusion in
annotated headers and similar documentation. Make sure to tag each parameter
with the pname{cl} macro.
Strive for compact notation, and in particular always try to use the
phrasing ``pname{cl}param _is_'' rather than wordier forms such as
``pname{cl}param _specifies_'' or ``The pname{cl}param parameter specifies''. In
general there is no need to describe a parameter which is a Vulkan object
handle *as* a handle; for example, say ``pname{cl}device is the logical
device'' rather than ``pname{cl}device is a handle to the logical device''. An
exception is object creation functions, where a pointer to a handle of the
proper type is used to return the newly created object.
====
include::../validity/protos/vkCreateCommandPool.txt[]
[NOTE]
.Guideline
====
Parameter and member validation language for commands and structures is also
autogenerated from vk.xml, and included from the `../validity/` directories:
include::../validity/protos/vkCreateCommandPool.txt[]
====
Change log for April 29, 2016 Vulkan 1.0.12 spec update: * Bump API patch number and header version number to 12 for this update. Github Issues: * Change valid usage statements intended to be "sub-points" to be actual sub-points (public issue 66). * Replace double negation in description of slink:VkRenderPassBeginInfo::pname:pClearValues (based on public merge 142). * Cleanup minor typos in spec, ref pages and XML, including those proposed in public pull requests 144, 150, 151, 167, 168, 181, and 186. * Use *strict subset* in describing the partial order of memory property types for slink:VkMemoryType, and update the style guide accordingly (public issue 190). * Fix various "a image" -> "an image" typos (public issue 191). * Note in the <<fundamentals-validusage,Valid Usage>> and <<extensions-interactions,Extension Interactions>> sections that structures defined by extensions which may be passed in structure chains using the ptext:pNext member must: include initial ptext:sType and ptext:pNext members (public issue 192). Internal Issues: * Remove duplicate language from the description of the pname:fence parameter to flink:vkQueueSubmit and improve validity language (internal issue 91). * Added documentation for "optional" attribute to XML readme.tex/pdf (internal issue 149). * Clarify the host-side data validity rules and behavior of flink:vkFlushMappedMemoryRanges and flink:vkInvalidateMappedMemoryRanges (internal issue 266). Other Commits: * Added clarification to flink:vkCmdFillBuffer regarding the use of ename:VK_WHOLE_SIZE. * Fixed and documented implementation of "validextensionstructs" attribute. in XML processing scripts and readme.tex/pdf. * Add missing validity statements to flink:vkResetEvent and flink:vkCmdResetEvent. * Fix validity for the ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT flag. Correct all the draw/dispatch commands to mention optimally tiled images as well as linear tiled images, and say image VIEWS instead of images. Add validity statement to flink:vkCmdBlitImage * Replace the {apiname} macro with hardcoded "Vulkan", now that we've committed to that name. * Add the VK_AMD_rasterization_order extension to vk.xml.
2016-04-29 12:53:46 +00:00
The sname:VkCommandPoolCreateInfo structure is defined as:
2016-02-16 09:53:44 +00:00
include::../structs/VkCommandPoolCreateInfo.txt[]
[NOTE]
.Guideline
====
Structures and enumerations first used as parameters of a command are
described next, by including the autogenerated interface file for that
structure or enumeration:
include::../structs/VkCommandPoolCreateInfo.txt[]
====
* pname:sType is the type of this structure.
* pname:pNext is `NULL` or a pointer to an extension-specific structure.
* pname:flags is a combination of bitfield flags indicating usage behavior
for the pool and command buffers allocated from it. Possible values
include:
+
--
include::../enums/VkCommandPoolCreateFlagBits.txt[]
** ename:VK_COMMAND_POOL_CREATE_TRANSIENT_BIT indicates that command buffers
allocated from the pool will be short-lived.
** ename:VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT controls whether
command buffers allocated from the pool can: be individually reset.
--
* pname:queueFamilyIndex designates a queue family. Command buffers in
this command pool must: be submitted on queues from the same family.
[NOTE]
.Guideline
====
Each structure member is described in a separate bullet list entry. For the
stext:Vk*CreateInfo structures in particular, there is standard boilerplate
for the pname:sType and pname:pNext members, followed by the members
specific to the structure.
----
* pname:sType is the type of this structure.
* pname:pNext is `NULL` or a pointer to an
extension-specific structure.
----
In some cases, such as when the type of a member is itself a new type, the
entry will cover multiple paragraphs. In these cases the normal list nesting
and indentation guidelines cannot be applied due to limitations of the
asciidoc parser. It is usually best to append a block following the first
paragraph of such a list item:
----
* pname:flags is a combination of bitfield flags
indicating usage behavior for the pool and
command buffers allocated from it. Possible
values include:
+
--
\include::../enums/VkCommandPoolCreateFlagBits.txt[]
** ename:VK_COMMAND_POOL_CREATE_TRANSIENT_BIT
indicates that command buffers allocated
from the pool will be short-lived.
** ename:VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT
controls whether command buffers allocated from
the pool can: be individually reset.
--
----
====
include::../validity/structs/VkCommandPoolCreateInfo.txt[]
[NOTE]
.Guideline
====
Following the definition of structure members, include the validity language
for this structure:
include::../validity/structs/VkCommandPoolCreateInfo.txt[]
====
// = API Naming Conventions
//
// It's not clear these belong in this document. They are currently
// captured in the member Wiki under API_Design/Cleanup
//
// If they do go here, we would discuss naming conventions starting with
// prefixes, camelCase, suffixes for size and arrayness, choice of names for
// similar parameters, templates for CreateInfo structs, parameter naming &
// ordering (especially length/array pointer pairs), etc.
= To Be Done
* Something about Image formats
* Something about validation scripts
* Something about pictures
* Glossary lists
* New param/enum macros
= Revision History
Change log for May 13, 2016 Vulkan 1.0.13 spec update: * Bump API patch number and header version number to 13 for this update. Github Issues: * Improve the description of ename:VK_PRESENT_MODE_FIFO_RELAXED_KHR in the VK_KHR_surface extension (public issue 174). * Clarify use of etext:*_SIMULTANEOUS_USE_BIT for secondary command buffers (public issue 182). * Fix typos in VK_KHR_wayland_surface extension where code:wl_device was used instead of code:wl_display (public issue 193). * Replaced {apiname} with ``Vulkan'' in XML validity statements (public issue 199). * Fix dead links for WSI handle types (public issue 200). *** N.b. this needs to be done in WSI branches as well *** * Use "signaled" instead of "signalled" spelling everywhere (public issue 201). *** N.b. this needs to be done in WSI branches as well *** * Move readme.pdf target directory for XML schema documentation into the target generation directory, instead of leaving it checked into the spec source tree (public issue 203). *** N.b. need to add generated PDF to registry index/1.0 page * Fix duplicate 'which which' typo in description of elink:VkCommandPoolResetFlagBits (public issue 204). * Move the <<Programmable Primitive Shading>> section up one level, out of the <<drawing-primitive-topologies,Primitive Topologies>> section (public issue 209). Internal Issues: * Clarify in the <<pipelines-cache,Pipeline Cache>> section that implementations should not manage the size of pipeline cache (internal issue 192). * Deprecate the concept of device layers and associated commands (internal issue 255). * Remove ename:VK_INCOMPLETE from the list of possible result codes of flink:vkGetPhysicalDeviceSurfaceCapabilitiesKHR (internal issue 314). * Add missing std140/std430 rule: the base alignment of a member following a structure is a multiple of the structure's base alignment (internal issue 321). * Fixes naming of the single elink:VkColorSpaceKHR enum from ename:VK_COLORSPACE_SRGB_NONLINEAR_KHR to ename:VK_COLOR_SPACE_SRGB_NONLINEAR_KHR in XML/header and the VK_KHR_swapchain and VK_KHR_surface extensions to match the style of the typename (space and color are two words, not one) (internal issue 322). * Make it clear that code:LocalInvocationID should only be applied to an input variable and normalize the language describing code:LocalInvocationID to the language for other compute shader variables in the <<interfaces-builtin-variables,Built-in Variables>> section, and add normative language (internal issue 323). * Clarify in the <<fundamentals-returncodes,Return Codes>> section that the result pointer may be modified for specific commands, even if a runtime error is returned (internal issue 324).
2016-05-14 00:01:59 +00:00
* May 1, 2016 - Include feedback from public Github issues 120 and 190. Use
consistent conventions for defining structures. Use American rather than
British spelling conventions.
Change log for March 25, 2016 Vulkan 1.0.7 spec update: * Bump API patch number and header version number to 7 for this update. Github Issues: * Fix slink:VkSpecializationMapEntry example to avoid C/C++ strict aliasing issues (public issue 14). * Clarify the meaning of "matching" in flink:vkCmdBindDescriptorSets validity language (public issue 33). * Add stub reference pages so xrefs to not-yet-written pages don't generate 404 errors. However, the actual content of these pages still needs to be filled in as time allows (public issue 44, but does not close that issue out). * Remove incorrect validity statement for flink:vkGetImageSparseMemoryRequirements (public issue 85). * Reword the <<features-limits-bufferImageGranularity,bufferImageGranularity>> feature in terms of "aliasing", and clarify that it applies to bindings in the same memory object (public issue 90). * Clarify the relationship of the slink:VkPhysicalDeviceLimits pname:maxViewportDimensions and pname:viewportBoundsRange limits (public issue 92). * Specify sparse unbound texture replacement in the <<textures-texel-replacement,Texel Replacement>> section independently of robust buffer access language (public issue 100). * Add the <<fundamentals-architecture-model,Architecture Model>> section to explain architecture constraints Vulkan has chosen to accept in order to enable portable and performant code (public issue 122). * State that an object must not be destroyed until *all* (not *any*) uses of that object have completed (public issue 123). * Minor editorial cleanup (public issues 129, 134, 146, 148). * Add validity language for layer and extension names to slink:VkDeviceCreateInfo matching that used for slink:VkInstanceCreateInfo (public issue 130). * Clean up terminology for the case when the bits set in one bitmask are a subset of the bits set in another bitmask (public issue 138). * Document that input attachments are UniformConstant not Input, in the <<interfaces-inputattachment,Fragment Input Attachment Interface>> section (public glslang bug 169). Internal Issues: * Add max enum values to "flag bits" enums (internal issue #136). * Clarify language around the various uses of the term "block" in the <<appendix-compressedtex-bc,Block Compressed Image Formats>> section (internal issue #202). * Removed "expand" dependency from <enums> groups in vk.xml and added auto-generation code in the scripts to infer it instead, to ensure consistency. This caused renaming of sname:VkColorSpaceKHR and sname:VkPresentModeKHR etext:BEGIN_RANGE (etc.) tokens, but those tokens are metadata, not part of the API, and the Vulkan WG is OK with this change. This change adds ranges to two additional enums that were missing them due to not defining the "expand" attribute (internal issue 217). * Tweak makefile to generate ref page nroff (.3) files in the right output directory, working around an a2x limitation (internal issue 223). Other Commits: * Add validity requirements for flink:vkCmdCopyQueryPoolResults pname:dstBuffer parameter. * Fix ref page build to generate .3 targets in the right output directory.
2016-03-25 09:25:04 +00:00
* March 12, 2016 - Recommend against "the value of".
Change log for March 4, 2016 Vulkan 1.0.5 spec update: * Bump API patch number to 5 for this update. Github Issues: * Correctly describe slink:VkPhysicalDeviceProperties pname:deviceName member as a string, not a pointer to a string. Also one typo fix for "hetereogeneous" (public issue 4). * Replace maynot: macro with may: not, and "may: or maynot:" with "may:" (public issue 4). * Clarify that redundantly setting the state of a fence or event has no effect (public issue 4). * Minor fixes to ref pages to track descriptions of memory bits that changed in the core spec. Fix name of a member in the description of sname:sname:VkPipelineMultisampleStateCreateInfo (public issues 8, 13). * Remove redundant validity statement for sname:VkGraphicsPipelineCreateInfo::pname:stageCount (public issue 14). * Fix typos in chapters 7-9 (public issue 14). * Clarify the example demonstrating the behavior of code:OpMemoryBarrier in the &lt;&lt;shaders-execution-memory-ordering,shader memory acces ordering>> section (public issue 16). * Specify that freeing mapped memory implicitly unmaps the memory in the description of flink:vkFreeMemory (public issue 17). * Forbid allocation callbacks from calling into the API in the &lt;&lt;memory-allocation,memory allocation>> section (public issue 20). * Add missing validity rules about size being greater than 0 and offset being less than size of object. Fix flink:VkMappedMemoryRange's misinterpretation of offset (public issues 27, 31). * Add validity rule disallowing overlapping source/destination descriptors in flink:VkCopyDescriptorSet (public issue 32). * Clarify that array and matrix stride has to be a multiple of the base alignment of the array or matrix in the &lt;&lt;interfaces-resources-layout,Offset and Stride Assignment>> section (public issue 38). * Correct parenthesis floor nesting error in equation for &lt;&lt;textures-RGB-sexp,RGB to shared exponent conversion>>. Clarify case of when exp' is forced to 0, avoiding log2(0) undefined problem (public issue 40). * Remove redundant statement from the code:FragDepth description in the &lt;&lt;interfaces-builtin-variables,Built-In Variables>> section (public issue 47). * Define the clamping of the &lt;&lt;textures-level-of-detail-operation,bias added to the scale factor>> by linking to the slink:VkPhysicalDevice feature pname:maxSamplerLodBias (public issue 64). * Fix typo "optimal linear resources" and clarify the set of resources &lt;&lt;features-limits-bufferImageGranularity,the pname:bufferImageGranularity resource>> applies to (public issue 67). * Replace 'descriptor accessed by a pipeline' language for sname:VkDescriptorSetAllocateInfo with more precise phrasing about binding a descriptor set before a command that invokes work using that set (public issue 69). * tstripadj.svg contained an Inkscape tag which caused Firefox and IE 11 to fail to render it, and was illegal SVG. Generating Plain SVG from the Inkscape SVG source fixes this (public issue 70). * Fix validity for sname:VkVertexInputBindingDescription and sname:VkVertexInputAttributeDescription numbers (public issue 72). Internal Issues: * Clarify the meaning of ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT in elink:VkFormatFeatureFlagBits with respect to depth compare (internal issue 107). * Added a note explaining that ename:VK_QUEUE_TRANSFER_BIT may or may not be reported for a queue family that already supports ename:VK_QUEUE_GRAPHICS_BIT or ename:VK_QUEUE_COMPUTE_BIT as the former is a strict subset of the latter ones (internal issue 116). * Add validity language for sname:VkDescriptorSetAllocateInfo about exceeding the descriptor pool capacity (internal issue 140). * Add ename:VK_INCOMPLETE success code for flink:vkEnumeratePhysicalDevices query (internal issue 163). Other Commits: * Add the VK_NV_glsl_shader extension definitions to the API. * Update GL_KHR_vulkan_glsl with 1) origin_upper_left as default 2) specialization array constant semantics. * Corrected/updated Data Format Specification date.
2016-03-03 13:06:18 +00:00
* February 26, 2016 - Replace use of the "maynot{cl}" macro with "may{cl} not".
2016-02-16 09:53:44 +00:00
* February 16, 2016 - Place asciidoc conversion post-release.
* February 9, 2016 - Added quotation mark convention.
* February 1, 2016 - add the Oxford Comma section and issue resolution.
* January 26, 2016 - add bullet-list style description of command parameters.
* January 11, 2016 - add ``Numbers in Text'' section from WSI work.
* December 16, 2015 - Make ``begin / end'' preferred terms to ``start /
finish''.
* December 15, 2015 - Make ``implementation'' preferred term instead of
``system''.
* December 13, 2015 - Add tlink{cl}/tname{cl} macros for function pointer
types.
* December 10, 2015 - Initial release for feedback.