Android NDK r20 (build 5594570)
Merge remote-tracking branch 'aosp/upstream-master' into update-shaderc

Including:
d5b2e12 Fix D -> d typo in previous commit.
0350b1d Add enumerants for six Nvidia extensions:
dcf23bd Headers for revision 4 of SPIR-V 1.3, including SPV_KHR_vulkan_memory_model.
2c51218 Revert "Update grammar for latest release of SPIR-V (revision 4 of 1.3 unified)"
da767eb Update grammar for latest release of SPIR-V (revision 4 of 1.3 unified)
ff684ff Add enumerants for SPV_KHR_8bit_storage.
02efabd Merge pull request #49 from jdknight/cmake-install-cleanup
8ffa90c Revert "Merge pull request #71 from casey/rebuild-makefile"
443d150 Merge pull request #71 from casey/rebuild-makefile
1fa0d86 Merge pull request #70 from casey/bash-path
87a720a Add missing #include.
96b855e Fix #74: Protect against repeated inclusion of OpenCL.std.h
7de7b23 cmake: support gnu installation directory convention
3ce3e49 Merge pull request #73 from antiagainst/add-missing-extension
3a9bf0b Fixes two internal bugs:
b7a5f51 Add missing 'extensions' field for some NVIDIA symbols
8ae0302 Merge pull request #72 from clayengine/master
fd7765f Clay Shader Compiler
88ff06a Add a makefile to the top level for convenience
d56815b Use /usr/bin/env to avoid hardcoding path to bash
3a4dbdd Merge pull request #68 from dneto0/hlsl-decorate-string
14e335f SPV_GOOGLE_hlsl_functionality1 includes all of SPV_GOOGLE_decorate_string
12f8de9 Add tokens for SPV_EXT_descriptor_indexing.
757bcc0 Merge pull request #67 from jeffbolznv/partition_missing_extension
28c3ed1 Add missing 'extensions' for OpGroupNonUniformPartitionNV
567cf2f Add SPV_NV_shader_subgroup_partitioned to SPIR-V JSON
80b0a0c Merge pull request #66 from bashbaug/intel_enum_block
10335f3 reserve 2x SPIR-V enum blocks for upcoming Intel extensions
b13b3be Merge pull request #64 from antiagainst/add-extensions
edd0440 Add missing extensions on some symbols
9a97861 Merge pull request #63 from antiagainst/add-missing-extensions
728eb3f Add missing extensions for several symbols
9f6846f Merge pull request #62 from antiagainst/fix-extensions
4ece4a4 Add missing extension/capability requirements for some symbols
02ffc71 Create version 1.3 of SPIR-V.
bd4c092 Merge pull request #61 from antiagainst/backport-google-ext
5ab1378 Back port grammar and symbols for two Google extensions
128618f Fix grammar error for Google decorate_string & hlsl_functionality1
5dac992 Merge pull request #60 from antiagainst/add-google-ext
fa2319e Add grammar and symbols for two Google extensions to unified1
16be272 Be more clear about build directories in the README.
c8bc6cf Generate headers from last grammar change.
a315a79 Merge pull request #59 from amdrexu/feature
cd2bf4b Update grammar json for SPV_AMD_gpu_shader_half_float_fetch
2bf91d3 Merge pull request #57 from antiagainst/shader_ballot
3269e64 Allow SubgroupSize and SubgroupLocalInvocationId with SubgroupBallotKHR
ce30920 BuildHeaders: Add missing 'const'.
41b4506 Update copyright dates.
7747a02 Add a header generator project.
6205884 Merge pull request #56 from jozefkucia/register-vkd3d-shader-compiler
81c6766 Register the VKD3D Shader Compiler
e0282aa Correct the version/revision in the grammar file.
7bfaab9 Add headers for the 1.2 unified (1.0, 1.1, and 1.2) specification.
98b0151 Merge pull request #54 from dneto0/google-range
aa558c5 Reserve token range for Google
0610978 Add new Intel token reservations.
d6aeada README.md: update install notes
4ca4743 cmake: support default install target
b8d95fb cmake: bump minimum required to support example
77240d9 Add new tokens for SPV_AMD_shader_fragment_mask, and rebuild all headers.
b94aced Add new tokens for SPV_AMD_shader_fragment_mask
2bb92e6 Fix #45, and minor reordering.
95579e1 Merge pull request #46 from dneto0/regsiter-spirv-tools-linker
d73476e Register the Khronos SPIRV-Tools Linker
2f319b6 Update all headers for SPV_EXT_shader_stencil_export.
cd3088e Add SPV_EXT_shader_viewport_index_layer.
4a7a9fd Merge pull request #41 from metora/master
1a19bc7 Reserve number 16 to Mesa-IR/SPIR-V Translator
661ad91 Incremental update for multiple recent extensions.
2bf0230 Merge pull request #39 from bashbaug/intel_enum_block
e94a404 reserve SPIR-V enum block for upcoming Intel extension
63e1062 Add version 1.2 headers, update 1.1 to rev. 7, and 1.0 to rev. 11.
db5cf61 Add recently reserved enumerants.
5a87f0b Synchronize OpenCL extended instruction set header with spec, and add missing capability use to the JSON grammar.
6c08995 Update JSON grammar files for 16-bit storage.
f61848a Merge pull request #31 from antiagainst/spirv-generator-15
b649fa0 Reserve SPIR-V generator number 15 for rspirv
2d6ba39 Merge pull request #30 from antiagainst/spirv-generator-14
cdd37aa Reserve generator number 14
88d9403 Add Rev. 10 of 1.0 and Rev. 6 of 1.1 headers.
b6dca23 Merge pull request #29 from antiagainst/core-grammar-revision
bb96eb3 Update SPIR-V core grammar revision number
fba846c New revisions of SPIR-V 1.0 and 1.1, and both extended instruction sets.
c470b68 Merge pull request #26 from dneto0/register-shaderc-glslang-frontend
7e4d3ef Add "Shaderc over Glslang" as a front end

Change-Id: Ife7c8fd9f1895b8e1706187e90c28b7ba4242d16
Testing: checkbuild.py on Linux; unit tests on Windows
tree: cb5b2396a205d71f4c3423102b8d600129449649
  1. example/
  2. include/
  3. tools/
  4. .gitattributes
  5. .gitignore
  6. CMakeLists.txt
  7. LICENSE
  8. README.md
README.md

SPIR-V Headers

This repository contains machine-readable files for the SPIR-V Registry. This includes:

  • Header files for various languages.
  • JSON files describing the grammar for the SPIR-V core instruction set and the extended instruction sets.
  • The XML registry file.
  • A tool to build the headers from the JSON grammar.

Headers are provided in the include directory, with up-to-date headers in the unified1 subdirectory. Older headers are provided according to their version.

In contrast, the XML registry file has a linear history, so it is not tied to SPIR-V specification versions.

How is this repository updated?

When a new version or revision of the SPIR-V specification is published, the SPIR-V Working Group will push new commits onto master, updating the files under include.

The SPIR-V XML registry file is updated by Khronos whenever a new enum range is allocated.

Pull requests can be made to

  • request allocation of new enum ranges in the XML registry file
  • reserve specific tokens in the JSON grammar

How to install the headers

mkdir build
cd build
cmake ..
cmake --build . --target install

Then, for example, you will have /usr/local/include/spirv/unified1/spirv.h

If you want to install them somewhere else, then use -DCMAKE_INSTALL_PREFIX=/other/path on the first cmake command.

Using the headers without installing

A CMake-based project can use the headers without installing, as follows:

  1. Add an add_subdirectory directive to include this source tree.
  2. Use ${SPIRV-Headers_SOURCE_DIR}/include} in a target_include_directories directive.
  3. In your C or C++ source code use #include directives that explicitly mention the spirv path component.
#include "spirv/unified1/GLSL.std.450.h"
#include "spirv/unified1/OpenCL.std.h"
#include "spirv/unified1/spirv.hpp"

See also the example subdirectory. But since that example is inside this repostory, it doesn't use and add_subdirectory directive.

Generating the headers from the JSON grammar

This will generally be done by Khronos, for a change to the JSON grammar. However, the project for the tool to do this is included in this repository, and can be used to test a PR, or even to include the results in the PR. This is not required though.

The header-generation project is under the tools/buildHeaders directory. Use CMake to build the project, in a build subdirectory (under tools/buildHeaders). There is then a bash script at bin/makeHeaders that shows how to use the built header-generator binary to generate the headers from the JSON grammar. (Execute bin/makeHeaders from the tools/buildHeaders directory.)

Notes:

  • this generator is used in a broader context within Khronos to generate the specification, and that influences the languages used, for legacy reasons
  • the C++ structures built may similarly include more than strictly necessary, for the same reason

FAQ

  • How are different versions published?

    The multiple versions of the headers have been simplified into a single unified1 view. The JSON grammar has a “version” field saying what version things first showed up in.

  • How do you handle the evolution of extended instruction sets?

    Extended instruction sets evolve asynchronously from the core spec. Right now there is only a single version of both the GLSL and OpenCL headers. So we don't yet have a problematic example to resolve.

License

Copyright (c) 2015-2018 The Khronos Group Inc.

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and/or associated documentation files (the
"Materials"), to deal in the Materials without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Materials, and to
permit persons to whom the Materials are furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Materials.

MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
   https://www.khronos.org/registry/

THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.