Squashed 'third_party/SPIRV-Headers/' changes from 8bb2420b4..29817199b

29817199b Merge pull request #250 from kpet/clspv-reflection-subgroups
1380cbbec Merge pull request #248 from pmistryNV/bindless_texture
43d173bd6 Add SpecConstantSubgroupMaxSize to the clspv reflection non-semantic instruction set
cec308490 Implement header definitions for SPV_NV_bindless_texture
92f21c9b2 Merge pull request #247 from bashbaug/intel-enum-block
442c6a62d reserve SPIR-V enum block for Intel extensions
19e835041 Merge pull request #245 from pmistryNV/nonconstoffset
e225eb0be Define a new Image operand bit mask for non constant offsets
5ea2d62e8 Merge pull request #242 from egdaniel/patch-3
2c4b19569 Register Magic Num for Skia SkSL SPIR-V Generator
ae217c178 Merge pull request #240 from gnl21/fast-math
f487ad919 Remove 'Kernel' capability from fast-math flags
635049b5e Merge pull request #237 from BedrockDotPng/patch-2
7ec2a1264 Update CMakeLists.txt
0d3c45cdb Merge pull request #209 from kloczek/master
6cae8216a Merge pull request #236 from greg-lunarg/db7
4dcae4859 Add nonsemantic.shader.debuginfo to Bazel
449bc986b Merge pull request #231 from MarijnS95/duplicate-grammar
b1a7c66be spirv.core.grammar: Remove duplicate OpArbitraryFloatPowNINTEL declaration
e71feddb3 Merge pull request #226 from clayengine/master
1160d54e9 Merge pull request #233 from NikitaRudenkoIntel/opt
4cce109bc Merge pull request #235 from alelenv/rt_motion
b1d2909b9 Add support for SPV_NV_ray_tracing_motion_blur.
b6b8b6792 Fix minor details in SPV_INTEL_optnone extension
e7b49d7fb Implement SPV_INTEL_optnone extension (#230)
cf653e4ca Merge pull request #229 from gnl21/gnl-local-size-hint-id
737f9dcde Correct grammar for LocalSizeHintId
1d4e3a7e3 Merge pull request #227 from kpet/fix-integer-dot-product-grammar
ddcc06200 Merge pull request #228 from mmerecki/fix_version_of_QuantizationModes_and_OverflowModes
810d13d3e Add missing capabilities and '"version" : "None"' to QuantizationModes and OverflowModes enumerants
6c7e7f9f2 Fix grammar for PackedVectorFormat
ddf3230c1 Merge pull request #222 from kpet/github-actions
e3bc1b14e Merge pull request #223 from WyvernWang/master
8aec5fcf9 Merge pull request #224 from Fznamznon/upstream-debug-module-ext
71b51d4f4 Merge pull request #225 from bashbaug/SPV_KHR_bit_instructions
5f003bd00 Clay is an internal framework of Tellusim Technologies Inc.
0320c5dd2 Upstream SPV_INTEL_debug_module
8ed0ff2c7 reserve value range
6553701d3 add support for SPV_KHR_bit_instructions
292387ae1 Add CI using Github actions and update README
f95c3b376 Merge pull request #219 from cmarcelo/SPV_EXT_shader_atomic_float16_add
64fbc2ff9 Merge pull request #220 from kpet/spv-khr-integer-dot-product
e51883ece Support SPV_KHR_integer_dot_product
2351f3a74 Add header changes for SPV_EXT_shader_atomic_float16_add
07f259e68 Merge pull request #218 from KhronosGroup/fix-ordering
7b5a2f411 Fix two ordering problems.
f5417a4b6 Merge pull request #216 from mkinsner/mkinsner/allocate_vendor_extension_enum_range
bce66d87b Merge pull request #213 from alan-baker/SPV_KHR_subgroup_uniform_control_flow
857642c6b Merge pull request #217 from StuartDBrady/add-C++-for-OpenCL-lang
7bfb1b532 Merge pull request #177 from MrSidims/private/MrSidims/AP
67da8a913 Add CPP_for_OpenCL to grammar
9a4b24433 Allocate additional Intel vendor extension enum blocks
f836486eb Merge pull request #215 from dneto0/warnings
c1e11359e buildHeaders: Add override decoration
bfe6ce52f Merge pull request #214 from dneto0/cmake-3.0-in-build-headers
5f7de8b4c Update to CMake 3.0
9daf63c96 Support SPV_KHR_subgroup_uniform_control_flow
8ea6700d3 Update arbitrary float cast interfaces
0c28b6451 Merge pull request #212 from alan-baker/fix-xml
02ba4e73c Fix xml entry for SpvGenTwo generator
135b508e0 Merge pull request #210 from rAzoR8/spvgentwo
ce23100fb Add SpvGenTwo to vendor IDs
2e1bc6dcd Merge pull request #208 from mkinsner/mkinsner/tripcount_loop_control_bit
60a5738c0 Rename spirv-headers.pc to SPIRV-Headers.pc
4f87476e1 removed excesive space in configure_file() line
1a8c9feb9 Fixed substituted string with paths and version
d23495700 Add spirv-headers pkgconfig file
ba29b3f59 Fix OpTypeBufferSurfaceINTEL token description (#207)
819fb44e4 Reserve loop control bit for upcoming trip count (min,max,avg) control
85b7e00c7 Merge pull request #206 from NikitaRudenkoIntel/sc
fa3585c26 Add VectorComputeINTEL as enabling capability for Private StorageClass
dafead176 Merge pull request #204 from DataBeaver/master
ba086aec6 Add generator ID for MSP shader compiler
f88a1f98f Merge pull request #201 from baldurk/spv-khr-non-semantic-info
6804a0431 Merge pull request #202 from mkinsner/mkinsner/mem_operand_allocation_section
a3ffef8e2 Upstream AP Intel extensions
a3082dab5 Add xml section for memory operand bit allocation tracking, and reserve two bits for an upcoming Intel extension
820d0ae3a Add NonSemantic.Vulkan.DebugInfo.100 JSON/header
bcf55210f Merge pull request #178 from orbea/datadir
fdab0e727 Merge pull request #200 from dneto0/public-spv-khr-linkonce-odr-spv-khr-expect-assume
cf00fad5b Support SPV_KHR_expect_assume
7ac7a0f36 Support SPV_KHR_linkonce_odr
19e951f3d Merge pull request #198 from alan-baker/read-clock-scope
eff6090ce Merge pull request #195 from kvark/patch-1
00e861df6 Change operand name in OpReadClockKHR to match extension
a3fdfe814 Merge pull request #193 from bashbaug/DebugInfoFlags-None
29406f358 Add Naga as SPIR-V generation tool
75b30a659 Merge pull request #187 from bashbaug/function_control_bit_16
2e335d5fb Merge pull request #190 from dneto0/check-enumerant-ordering
2da20c0c1 Merge pull request #189 from jekstrand/SPV_EXT_shader_atomic_float_min_max
25fd8d031 Add header changes for SPV_EXT_shader_atomic_float_min_max
86e8eed50 Re-run buildSpvHeaders to fix indentation
e50154dbd Header generator: Check enumerant ordering
03034f165 add generated headers
faa570afb Merge pull request #192 from cmarcelo/SPV_KHR_workgroup_memory_explicit_layout
25ac9d50e add None as a possible value for DebugInfoFlags
38fe9b085 Add SPV_KHR_workgroup_memory_explicit_layout
f9e1ffdcc Merge pull request #191 from dneto0/reorder-enums-in-spec
80438cd0d Push FPDenormMode, FPOperationMode to the end
49f96f47c add function control bitfield reservation section reserve bit 16 for an upcoming Intel extension
eae955f05 cmake: Install cmake files to CMAKE_INSTALL_DATADIR

git-subtree-dir: third_party/SPIRV-Headers
git-subtree-split: 29817199b7069bac971e5365d180295d4b077ebe
28 files changed
tree: 937b2f2f1f81b1255bcbab63b9399f2112d3e4fb
  1. .github/
  2. cmake/
  3. example/
  4. include/
  5. tools/
  6. .gitattributes
  7. .gitignore
  8. BUILD.bazel
  9. BUILD.gn
  10. CMakeLists.txt
  11. CODE_OF_CONDUCT.md
  12. LICENSE
  13. README.md
  14. SPIRV-Headers.pc.in
  15. WORKSPACE
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
  • register a new magic number for a SPIR-V generator
  • reserve specific tokens in the JSON grammar

Registering a SPIR-V Generator Magic Number

Tools that generate SPIR-V should use a magic number in the SPIR-V to help identify the generator.

Care should be taken to follow existing precedent in populating the details of reserved tokens. This includes:

  • keeping generator numbers in numeric order
  • filling out all the existing fields

Reserving tokens in the JSON grammar

Care should be taken to follow existing precedent in populating the details of reserved tokens. This includes:

  • pointing to what extension has more information, when possible
  • keeping enumerants in numeric order
  • when there are aliases, listing the preferred spelling first
  • adding the statement "version" : "None"

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

Using CMake

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.

Using Bazel

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

  1. Add SPIRV-Headers as a submodule of your project, and add a local_repository to your WORKSPACE file. For example, if you place SPIRV-Headers under external/spirv-headers, then add the following to your WORKSPACE file:
local_repository(
    name = "spirv_headers",
    path = "external/spirv-headers",
)
  1. Add one of the following to the deps attribute of your build target based on your needs:
@spirv_headers//:spirv_c_headers
@spirv_headers//:spirv_cpp_headers
@spirv_headers//:spirv_cpp11_headers

For example:

cc_library(
  name = "project",
  srcs = [
    # Path to project sources
  ],
  hdrs = [
    # Path to project headers
  ],
  deps = [
    "@spirv_tools//:spirv_c_headers",
    # Other dependencies,
  ],
)
  1. 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"

Generating headers from the JSON grammar for the SPIR-V core instruction set

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 and install 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.) Here's a complete example:

cd tools/buildHeaders
mkdir build
cd build
cmake ..
cmake --build . --target install
cd ..
./bin/makeHeaders

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

Generating C headers for extended instruction sets

The GLSL.std.450.h and OpenCL.std.h extended instruction set headers are maintained manually.

The C/C++ header for each of the other extended instruction sets is generated from the corresponding JSON grammar file. For example, the OpenCLDebugInfo100.h header is generated from the extinst.opencl.debuginfo.100.grammar.json grammar file.

To generate these C/C++ headers, first make sure python3 is in your PATH, then invoke the build script as follows:

cd tools/buildHeaders
python3 bin/makeExtinstHeaders.py

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.