Skip to content
A runtime SPIR-V assembler
C++ CMake
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
externals aloha Aug 23, 2018
include/sirit image: Remove assumed lod in image samples Dec 15, 2019
src image: Remove assumed lod in image samples Dec 15, 2019
tests tests/main: Test assembled binary Oct 24, 2019
.clang-format Change clang-format settings Mar 11, 2019
.gitignore aloha Aug 23, 2018
LICENSE.txt Relicense to The BSD 3-clause license Jul 14, 2019 Fix typos in Oct 24, 2019


A runtime SPIR-V assembler. It aims to ease dynamic SPIR-V code generation without calling external applications (like Khronos' spirv-as)

Its design aims to move code that does not belong in the application to the library, without limiting its functionality.

What Sirit does for you:

  • Sort declaration opcodes
  • Handle types and constant duplicates
  • Emit SPIR-V opcodes

What Sirit won't do for you:

  • Avoid ID duplicates (e.g. emitting the same label twice)
  • Dump code to disk
  • Handle control flow
  • Compile from a higher level language

It's in early stages of development, many instructions are missing since they are written manually instead of being generated from a file.


class MyModule : public Sirit::Module {
    MyModule() {}
    ~MyModule() = default;

    void Generate() {
        SetMemoryModel(spv::AddressingModel::Logical, spv::MemoryModel::GLSL450);
        auto main_type{TypeFunction(TypeVoid())};
        auto main_func{OpFunction(TypeVoid(), spv::FunctionControlMask::MaskNone, main_type)};

        AddEntryPoint(spv::ExecutionModel::Vertex, main_func, "main");

// Then...

MyModule module;

std::vector<std::uint32_t> code{module.Assemble()};
You can’t perform that action at this time.