Kbz-8 35686c3012
All checks were successful
Build / build (push) Successful in 1m41s
Test / build (push) Successful in 4m54s
adding builtin support
2026-02-17 02:20:28 +01:00
2026-01-21 23:13:02 +01:00
2026-01-27 17:29:34 +01:00
2026-02-17 02:20:28 +01:00
2026-02-17 02:20:28 +01:00
2026-02-15 02:06:15 +01:00
2026-01-21 17:44:10 +01:00
2026-01-27 22:55:02 +01:00
2026-01-24 15:18:57 +01:00
2025-12-22 17:01:38 +01:00
2026-01-24 15:18:57 +01:00

SPIR-V Interpreter

A small footprint SPIR-V interpreter to execute SPIR-V shaders on the CPU. It is designed to be used with multiple runtimes concurrently.

const std = @import("std");
const spv = @import("spv");

const shader_source = @embedFile("shader.spv");

pub fn main() !void {
    {
        var gpa: std.heap.DebugAllocator(.{}) = .init;
        defer _ = gpa.deinit();

        const allocator = gpa.allocator();

        var module = try spv.Module.init(allocator, @ptrCast(@alignCast(shader_source)), .{});
        defer module.deinit(allocator);

        var rt = try spv.Runtime.init(allocator, &module);
        defer rt.deinit(allocator);

        try rt.callEntryPoint(allocator, try rt.getEntryPointByName("main"));
        var output: [4]f32 = undefined;
        try rt.readOutput(f32, output[0..output.len], try rt.getResultByName("color"));
        std.log.info("Output: Vec4{any}", .{output});
    }
    std.log.info("Successfully executed", .{});
}
Description
A SPIR-V software interpreter, wrought in Zig-lean of form, steadfast of purpose, and bound to no single GPU nor driver permitting the slowest run of thy shaders and kernels.
https://spirv-interpreter-docs.kbz8.me/
Readme MIT 714 KiB
Languages
Zig 100%