3 This repository contains machine-readable files from the
4 [SPIR-V Registry](https://www.khronos.org/registry/spir-v/).
7 * Header files for various languages.
8 * JSON files describing the grammar for the SPIR-V core instruction set,
9 and for the GLSL.std.450 and OpenCL extended instruction sets.
10 * The XML registry file.
12 Under the [include](include) directory, header files are provided according to
13 their own version. Only major and minor version numbers count.
14 For example, the headers for SPIR-V 1.1 are in
15 [include/spirv/1.1](include/spirv/1.1). Also, the 1.0 versions of the
16 GLSL.std.450 and OpenCL extended instruction sets are in
17 [include/spirv/1.0](include/spirv/1.0).
19 In contrast, the XML registry file has a linear history, so it is
20 not tied to SPIR-V specification versions.
22 ## How is this repository updated?
24 When a new version or revision of the SPIR-V header files are published,
25 the SPIR Working Group will push new commits onto master, updating
26 the files under [include](include).
27 A newer revision of a header file always replaces an older revision of
28 the same version. For example, verison 1.0 Rev 4 of `spirv.h` is placed in
29 `include/spirv/1.0/spirv.h` and if there is a Rev 5, then it will be placed
32 The SPIR-V XML registry file is updated by the Khronos registrar whenever
33 a new enum range is allocated.
35 In particular, pull requests that update header files will not be accepted.
36 Issues with the header files should be filed in the
37 [Khronos public bugzilla database](https://www.khronos.org/bugzilla/),
38 against the Specification component of the SPIR-V product.
40 ## How to install the headers
47 cmake --build . --target install-headers
49 cmake --build . --config Debug --target install-headers
52 Then, for example, you will have `/usr/local/include/spirv/1.0/spirv.h`
54 If you want to install them somewhere else, then use
55 `-DCMAKE_INSTALL_PREFIX=/other/path` on the first `cmake` command.
57 ## Using the headers without installing
59 A CMake-based project can use the headers without installing, as follows:
61 1. Add an `add_subdirectory` directive to include this source tree.
62 2. Use `${SPIRV-Headers_SOURCE_DIR}/include}` in a `target_include_directories`
64 3. In your C or C++ source code use `#include` directives that explicitly mention
65 the `spirv` path component. For example the following uses SPIR-V 1.1
66 core instructions, and the 1.0 versions of the GLSL.std.450 and OpenCL
67 extended instructions.
69 #include "spirv/1.0/GLSL.std.450.h"
70 #include "spirv/1.0/OpenCL.std.h"
71 #include "spirv/1.1/spirv.hpp"
74 See also the [example](example/) subdirectory. But since that example is
75 *inside* this repostory, it doesn't use and `add_subdirectory` directive.
79 * *How are different versions published?*
81 All versions are present in the master branch of the repository.
82 They are located in different subdirectories under
83 [include/spirv](include/spirv), where the subdirectory at that
84 level encodes the major and minor version number of the relevant spec.
86 An application should consciously select the targeted spec version
87 number, by naming the specific version in its `#include` directives,
88 as above and in the examples.
90 * *How do you handle the evolution of extended instruction sets?*
92 Extended instruction sets evolve asynchronously from the core spec.
93 Right now there is only a single version of both the GLSL and OpenCL
94 headers. So we don't yet have a problematic example to resolve.
97 <a name="license"></a>
99 Copyright (c) 2015-2016 The Khronos Group Inc.
101 Permission is hereby granted, free of charge, to any person obtaining a
102 copy of this software and/or associated documentation files (the
103 "Materials"), to deal in the Materials without restriction, including
104 without limitation the rights to use, copy, modify, merge, publish,
105 distribute, sublicense, and/or sell copies of the Materials, and to
106 permit persons to whom the Materials are furnished to do so, subject to
107 the following conditions:
109 The above copyright notice and this permission notice shall be included
110 in all copies or substantial portions of the Materials.
112 MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
113 KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
114 SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
115 https://www.khronos.org/registry/
117 THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
118 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
119 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
120 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
121 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
122 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
123 MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.