eden/externals/sirit
Gamer64 a002730d68
All checks were successful
eden-build / source (push) Successful in 5m51s
eden-build / linux (push) Successful in 27m16s
eden-build / windows (msvc) (push) Successful in 31m18s
eden-build / android (push) Successful in 31m42s
[VK] Rework SPIRV Shader Optimization (#238)
The actual SPIRV Shader Optimization option doesn't seem to do anything as long as it isn't vinculed, so let's rework it to make it work

Co-authored-by: Gamer64 <76565986+Gamer64ytb@users.noreply.github.com>
Co-authored-by: echosys <echosys@noreply.localhost>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/238
2025-07-03 01:13:33 +00:00
..
externals [VK] Rework SPIRV Shader Optimization (#238) 2025-07-03 01:13:33 +00:00
include/sirit Move dead submodules in-tree 2025-05-31 02:33:02 -04:00
src Move dead submodules in-tree 2025-05-31 02:33:02 -04:00
tests Move dead submodules in-tree 2025-05-31 02:33:02 -04:00
.clang-format Move dead submodules in-tree 2025-05-31 02:33:02 -04:00
.gitignore Move dead submodules in-tree 2025-05-31 02:33:02 -04:00
.gitmodules Move dead submodules in-tree 2025-05-31 02:33:02 -04:00
CMakeLists.txt Move dead submodules in-tree 2025-05-31 02:33:02 -04:00
LICENSE.txt Move dead submodules in-tree 2025-05-31 02:33:02 -04:00
README.md Move dead submodules in-tree 2025-05-31 02:33:02 -04:00

Sirit

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.

Example

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

    void Generate() {
        AddCapability(spv::Capability::Shader);
        SetMemoryModel(spv::AddressingModel::Logical, spv::MemoryModel::GLSL450);
        
        auto main_type{TypeFunction(TypeVoid())};
        auto main_func{OpFunction(TypeVoid(), spv::FunctionControlMask::MaskNone, main_type)};
        AddLabel(OpLabel());
        OpReturn();
        OpFunctionEnd();

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

// Then...

MyModule module;
module.Generate();

std::vector<std::uint32_t> code{module.Assemble()};