From 681c9ea9bf8fcf4c6c9b0fac9666668a4ab20570 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Sun, 27 Aug 2017 20:39:26 -0700 Subject: [PATCH] add spirv.md --- docs/spirv.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 docs/spirv.md diff --git a/docs/spirv.md b/docs/spirv.md new file mode 100644 index 0000000..f0702e0 --- /dev/null +++ b/docs/spirv.md @@ -0,0 +1,31 @@ +# spirv library +library for SPIR-V parsing + +## `spirv/literal_string.h` + +### `spirv::Literal_string` +`string_view` for SPIR-V strings -- does endian translation on the fly. + +## `spirv/word.h` +Contains the definition for `spirv::Word` + +## `spirv/spirv.h` +Main SPIR-V header, contains the definitions for constants and types from the SPIR-V specification. Generated from `khronos-spirv`. + +## `spirv/parser.h` +SPIR-V parser. Generated from `khronos-spirv`. + +### `spirv::Parser_error` +Members: +- `error_index` -- the index of the `Word` in the shader that caused the error. +- `instruction_start_index` -- the index of the beginning of the SPIR-V instruction that caused the error, or `0` if not in an instruction. + +### `spirv::Parser_callbacks` +Parser callbacks, must be implemented by the user. +Members: +- `void handle_header()` -- called with the values parsed from the SPIR-V shader's header +- `virtual void handle_instruction_*(Instruction_type instruction, std::size_t instruction_start_index)` -- corresponding function called for each instruction in the SPIR-V shader. +`handle_instruction_op_ext_inst` is only called for unrecognized extension instructions, otherwise the `handle_instruction_*` function for that instruction is called. + +### `spirv::parse` +Entry point for the SPIR-V parser. Calls the corresponding functions in `spirv::Parser_callbacks` during parsing. Throws `spirv::Parser_error` on parse error. -- 2.30.2