Lines Matching +full:libspirv +full:- +full:tools
1 # SPIR-V Tools
3 …ranch/master?svg=true)](https://ci.appveyor.com/project/Khronoswebmaster/spirv-tools/branch/master)
4 … hspace="2px"/>![Linux Build Status](https://storage.googleapis.com/spirv-tools/badges/build_statu…
5 … hspace="2px"/>![MacOS Build Status](https://storage.googleapis.com/spirv-tools/badges/build_statu…
6 …space="2px"/>![Windows Build Status](https://storage.googleapis.com/spirv-tools/badges/build_statu…
10 The SPIR-V Tools project provides an API and commands for processing SPIR-V
14 validator, and optimizer for SPIR-V. Except for the optimizer, all are based
16 details, and is used in the standalone tools whilst also enabling integration
23 SPIR-V is defined by the Khronos Group Inc.
24 See the [SPIR-V Registry][spirv-registry] for the SPIR-V specification,
27 ## Versioning SPIRV-Tools
31 SPIRV-Tools project version numbers are of the form `v`*year*`.`*index* and with
32 an optional `-dev` suffix to indicate work in progress. For exampe, the
36 * `v2016.1-dev`
38 * `v2016.2-dev`
41 Use the `--version` option on each command line tool to see the software
42 version. An API call reports the software version as a C-style string.
48 * Support for SPIR-V 1.0, 1.1, 1.2, and 1.3
49 * Based on SPIR-V syntax described by JSON grammar files in the
50 [SPIRV-Headers](spirv-headers) repository.
62 The validator checks validation rules described by the SPIR-V specification.
64 Khronos recommends that tools that create or transform SPIR-V modules use the
65 validator to ensure their outputs are valid, and that tools that consume SPIR-V
69 The validator has one-sided error: it will only return an error when it has
75 sub-project](https://github.com/KhronosGroup/SPIRV-Tools/projects/1) for planned
76 and in-progress work.
78 *Note*: The validator checks some Universal Limits, from section 2.17 of the SPIR-V spec.
80 It is [future work](https://github.com/KhronosGroup/SPIRV-Tools/projects/1#card-1052403)
82 limits accepted by a more than minimally capable SPIR-V consumer.
113 [`include/spirv-tools/optimizer.hpp`](include/spirv-tools/optimizer.hpp).
115 …efer to this [white paper](https://www.lunarg.com/shader-compiler-technologies/white-paper-spirv-o…
123 * Combine multiple SPIR-V binary modules together.
128 sub-project](https://github.com/KhronosGroup/SPIRV-Tools/projects/2) for
129 planned and in-progress work.
133 * [Utility filters](#utility-filters)
134 * Build target `spirv-tools-vimsyntax` generates file `spvasm.vim`.
135 Copy that file into your `$HOME/.vim/syntax` directory to get SPIR-V assembly syntax
140 The SPIR-V Tools project is maintained by members of the The Khronos Group Inc.,
141 and is hosted at https://github.com/KhronosGroup/SPIRV-Tools.
144 [https://www.khronos.org/spir/spirv-tools-mailing-list/](https://www.khronos.org/spir/spirv-tools-m…
145 The mailing list is used to discuss development plans for the SPIRV-Tools as an open source project.
148 [projects][spirv-tools-projects].
150 (To provide feedback on the SPIR-V _specification_, file an issue on the
151 [SPIRV-Headers][spirv-headers] GitHub repository.)
155 feature](https://help.github.com/articles/tracking-the-progress-of-your-work-with-projects/)
156 to organize planned and in-progress work.
160 * You'll be prompted with a one-time "click-through"
161 [Khronos Open Source Contributor License Agreement][spirv-tools-cla]
165 * C++ code should follow the [Google C++ Style Guide][cpp-style-guide].
166 * Code should be formatted with `clang-format`.
167 [kokoro/check-format/build.sh](kokoro/check-format/build.sh)
169 `clang-format version 5.0.0` for SPIRV-Tools. Settings are defined by
170 the included [.clang-format](.clang-format) file.
176 * `example`: demo code of using SPIRV-Tools APIs
185 * `external/spirv-headers`: Intended location for
186 [SPIR-V headers][spirv-headers], not provided
187 * `include/spirv-tools/libspirv.h`: C API public interface
190 * `tools/`: Command line executables
192 Example of getting sources, assuming SPIRV-Tools is configured as a standalone project:
194 git clone https://github.com/KhronosGroup/SPIRV-Tools.git spirv-tools
195 git clone https://github.com/KhronosGroup/SPIRV-Headers.git spirv-tools/external/spirv-headers
196 git clone https://github.com/google/googletest.git spirv-tools/external/googletest
197 git clone https://github.com/google/effcee.git spirv-tools/external/effcee
198 git clone https://github.com/google/re2.git spirv-tools/external/re2
207 * If SPIR-V Tools is configured as part of an enclosing project, then the
208 enclosing project should configure `googletest` before configuring SPIR-V Tools.
209 * If SPIR-V Tools is configured as a standalone project, then download the
210 `googletest` source into the `<spirv-dir>/external/googletest` directory before
214 [a fix][googletest-pull-612] for [googletest issue 610][googletest-issue-610].
215 The fix is included on the googletest master branch any time after 2015-11-10.
223 * If SPIRV-Tools is configured as part of a larger project that already uses
224 Effcee, then that project should include Effcee before SPIRV-Tools.
225 * Otherwise, SPIRV-Tools expects Effcee sources to appear in `external/effcee`
232 platform directly from the [master-tot release][master-tot-release] on GitHub.
237 The project uses [CMake][cmake] to generate platform-specific build
238 configurations. Assume that `<spirv-dir>` is the root directory of the checked
242 cd <spirv-dir>
243 git clone https://github.com/KhronosGroup/SPIRV-Headers.git external/spirv-headers
249 cmake [-G <platform-generator>] <spirv-dir>
259 * `SPIRV_COLOR_TERMINAL={ON|OFF}`, default `ON` - Enables color console output.
260 * `SPIRV_SKIP_TESTS={ON|OFF}`, default `OFF`- Build only the library and
261 the command line tools. This will prevent the tests from being built.
262 * `SPIRV_SKIP_EXECUTABLES={ON|OFF}`, default `OFF`- Build only the library, not
263 the command line tools and tests.
264 * `SPIRV_BUILD_COMPRESSION={ON|OFF}`, default `OFF`- Build SPIR-V compressing
266 * `SPIRV_USE_SANITIZER=<sanitizer>`, default is no sanitizing - On UNIX
268 of the sanitizers documented [here][clang-sanitizers].
270 * `SPIRV_WARN_EVERYTHING={ON|OFF}`, default `OFF` - On UNIX platforms enable
272 For Clang, enables `-Weverything`. For GCC, enables `-Wpedantic`.
274 * `SPIRV_WERROR={ON|OFF}`, default `ON` - Forces a compilation error on any
275 warnings encountered by enabling the compiler-specific compiler front-end
276 option. No compiler front-end options are enabled when this option is OFF.
278 Additionally, you can pass additional C preprocessor definitions to SPIRV-Tools
285 SPIR-V Tools supports building static libraries `libSPIRV-Tools.a` and
286 `libSPIRV-Tools-opt.a` for Android:
289 cd <spirv-dir>
297 $ANDROID_NDK/ndk-build -C ../android_test \
311 to `<spirv-dir>/include`, which will enable the application to include the
312 header `<spirv-dir>/include/spirv-tools/libspirv.h{|pp}` then linking against
313 the static library in `<spirv-build-dir>/source/libSPIRV-Tools.a` or
314 `<spirv-build-dir>/source/SPIRV-Tools.lib`.
316 `<spirv-dir>/include/spirv-tools/optimizer.hpp`, and the static library is
317 `<spirv-build-dir>/source/libSPIRV-Tools-opt.a` or
318 `<spirv-build-dir>/source/SPIRV-Tools-opt.lib`.
320 * `SPIRV-Tools` CMake target: Creates the static library:
321 * `<spirv-build-dir>/source/libSPIRV-Tools.a` on Linux and OS X.
322 * `<spirv-build-dir>/source/libSPIRV-Tools.lib` on Windows.
323 * `SPIRV-Tools-opt` CMake target: Creates the static library:
324 * `<spirv-build-dir>/source/libSPIRV-Tools-opt.a` on Linux and OS X.
325 * `<spirv-build-dir>/source/libSPIRV-Tools-opt.lib` on Windows.
333 * `spvTextToBinary`: An assembler, translating text to a binary SPIR-V module.
334 * `spvBinaryToText`: A disassembler, translating a binary SPIR-V module to
348 ## Command line tools
350 Command line tools, which wrap the above library functions, are provided to
351 assemble or disassemble shader files. It's a convention to name SPIR-V
358 The standalone assembler is the exectuable called `spirv-as`, and is located in
359 `<spirv-build-dir>/tools/spirv-as`. The functionality of the assembler is implemented
362 * `spirv-as` - the standalone assembler
363 * `<spirv-dir>/tools/as`
365 Use option `-h` to print help.
371 The standalone disassembler is the executable called `spirv-dis`, and is located in
372 `<spirv-build-dir>/tools/spirv-dis`. The functionality of the disassembler is implemented
375 * `spirv-dis` - the standalone disassembler
376 * `<spirv-dir>/tools/dis`
378 Use option `-h` to print help.
385 The linker combines multiple SPIR-V binary modules together, resulting in a single
392 * `spirv-link` - the standalone linker
393 * `<spirv-dir>/tools/link`
397 The optimizer processes a SPIR-V binary module, applying transformations
402 * `spirv-opt` - the standalone optimizer
403 * `<spirv-dir>/tools/opt`
409 The standalone validator is the executable called `spirv-val`, and is located in
410 `<spirv-build-dir>/tools/spirv-val`. The functionality of the validator is implemented
415 * `spirv-val` - the standalone validator
416 * `<spirv-dir>/tools/val`
420 The control flow dumper prints the control flow graph for a SPIR-V module as a
425 * `spirv-cfg` - the control flow graph dumper
426 * `<spirv-dir>/tools/cfg`
430 * `spirv-lesspipe.sh` - Automatically disassembles `.spv` binary files for the
432 environment variable as follows, assuming both `spirv-lesspipe.sh` and
433 `spirv-dis` are on your executable search path:
435 export LESSOPEN='| spirv-lesspipe.sh "%s"'
441 * The `spirv-lesspipe.sh` script will pass through any extra arguments to
442 `spirv-dis`. So, for example, you can turn off colours and friendly ID
445 export LESSOPEN='| spirv-lesspipe.sh "%s" --no-color --raw-id'
448 * [vim-spirv](https://github.com/kbenzie/vim-spirv) - A vim plugin which
455 * `50spirv-tools.el` - Automatically disassembles '.spv' binary files when
456 loaded into the emacs text editor, and re-assembles them when saved,
461 cmake -DSPIRV_TOOLS_INSTALL_EMACS_HELPERS=true ...
464 In addition, this helper is only installed if the directory /etc/emacs/site-start.d
468 This may change if the ability is added to spirv-as.
479 _See the [projects pages](https://github.com/KhronosGroup/SPIRV-Tools/projects)
498 math flags passed at linking-time in OpenCL.
507 Copyright (c) 2015-2016 The Khronos Group Inc.
513 http://www.apache.org/licenses/LICENSE-2.0
522 [spirv-tools-cla]: https://cla-assistant.io/KhronosGroup/SPIRV-Tools
523 [spirv-tools-projects]: https://github.com/KhronosGroup/SPIRV-Tools/projects
524 [spirv-tools-mailing-list]: https://www.khronos.org/spir/spirv-tools-mailing-list
525 [spirv-registry]: https://www.khronos.org/registry/spir-v/
526 [spirv-headers]: https://github.com/KhronosGroup/SPIRV-Headers
528 [googletest-pull-612]: https://github.com/google/googletest/pull/612
529 [googletest-issue-610]: https://github.com/google/googletest/issues/610
533 [cpp-style-guide]: https://google.github.io/styleguide/cppguide.html
534 [clang-sanitizers]: http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation
535 [master-tot-release]: https://github.com/KhronosGroup/SPIRV-Tools/releases/tag/master-tot