editor/docs/shader-toolchain.md
pavel 4a15350860 Initial commit: Odin editor client + Kotlin daemon prototype
Native SDL3 editor written in Odin with a piece-table buffer core,
backed by a Kotlin/JVM daemon speaking newline-delimited JSON over
localhost TCP for Gradle import, Kotlin/Java diagnostics, and
heuristic completion/hover/definition/references/rename.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 08:37:41 +02:00

1.3 KiB

SDL3 GPU Shader Toolchain

SDL3 GPU accepts different shader formats depending on the selected backend:

  • Vulkan: SPIR-V
  • D3D12: DXBC or DXIL
  • Metal: MSL or metallib

For this Linux-first prototype, use GLSL compiled to SPIR-V with glslc from shaderc.

scripts/compile-shaders.sh

Outputs are written to client/odin/shaders/compiled/ and intentionally ignored by git.

Fedora install:

sudo dnf install glslc

Cross-platform path later:

  • Use SDL_shadercross for offline conversion from SPIR-V or HLSL to backend-specific shader formats.
  • Keep source shaders in git.
  • Generate SPIR-V/DXIL/MSL in CI or release packaging.
  • At runtime, choose the shader blob matching SDL.GetGPUDeviceDriver(device) or SDL.GetGPUShaderFormats(device).

Current recommendation:

  • Build Linux/Vulkan first with checked-in GLSL sources and generated SPIR-V as build artifacts.
  • Add SDL_shadercross only when Windows/macOS backends matter.

Current renderer state:

  • The editor loads rect.vert.spv and rect.frag.spv for the direct SDL3 GPU path.
  • The editor loads text.vert.spv and text.frag.spv for font-atlas text.
  • Text is rendered from a baked stb_truetype atlas using /usr/share/fonts/google-noto/NotoSansMono-Regular.ttf.
  • A later portability step should bundle a project font or add configurable font discovery.