Skip to content

A motion design studio on your own machine: Claude makes the video step by step, you approve every stage. Bring your own Claude Code or API key.

813 B
Raw Blame
"""Compile GLSL compute shaders with glslc and print them as C uint32 arrays (spv_<name>)."""
import os, subprocess, sys, tempfile

print("/* generated by embed_spv.py from the shaders folder: do not edit */")
print("#include <stdint.h>")
for path in sys.argv[1:]:
    name = os.path.splitext(os.path.basename(path))[0]
    with tempfile.TemporaryDirectory() as d:
        out = os.path.join(d, name + ".spv")
        subprocess.run(["glslc", "-O", "--target-env=vulkan1.1", path, "-o", out], check=True)
        data = open(out, "rb").read()
    words = [int.from_bytes(data[i:i + 4], "little") for i in range(0, len(data), 4)]
    print(f"static const uint32_t spv_{name}[] = {{")
    for i in range(0, len(words), 8):
        print("  " + ", ".join(f"0x{w:08x}" for w in words[i:i + 8]) + ",")
    print("};")