feat(render3d): every shader variant as Vulkan SPIR-V, built ahead of time

Vulkan cannot compile GLSL when the game starts, so the programs render3d builds are listed
(shaders/variants.list, 45 of them, collected with R3D_PROGRAMS_LOG across the self-tests, the
screens, the viewpoints and the debug switches) and `ludic-dev shaders` compiles each into
shaders/spv/<id>.vert.spv and .frag.spv with a manifest of what the backend needs: each
stage's uniform block and member offsets, the samplers' bindings, the vertex inputs.

The GLSL is the renderer's own, assembled as programs.ludic assembles it, through glslang's
relaxed Vulkan mode, so gpu_uniform / u_* can write the same uniforms into a block on Vulkan.
Bindings are assigned by the tool (glslang's own numbering put several samplers of one stage
on binding 0): the vertex block is 0, the fragment block 1, samplers from 2 in name order,
shared across both stages. Every stage passes spirv-val; `ludic-dev test` rebuilds and compares
wherever the Vulkan SDK is installed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-15 10:11:31 +03:00
parent bd79b276e9
commit 3fb1b7cd87
97 changed files with 2657 additions and 0 deletions

View file

@ -34,6 +34,7 @@ program LudicDev {
import "docgen_check.ludic"
import "glgen.ludic"
import "vkgen.ludic"
import "shaders.ludic"
import "assets.ludic"
import "release.ludic"
import "pkg.ludic"
@ -71,6 +72,7 @@ program LudicDev {
print(" docs-palette [--check] regenerate emit_color.ludic + palette.json from the palette table")
print(" glgen [--check] regenerate gl_api.ludic + gl_thunks.ll from the platform gl3.h")
print(" vkgen [--xml f] [--check] regenerate vk_api.ludic + vk_thunks.ll from the Vulkan registry")
print(" shaders [--check] build render3d's shader variants to SPIR-V + manifest (Vulkan SDK)")
print("")
print("release:")
print(" release [major|minor|patch] [--dry-run] [--publish]")
@ -109,6 +111,7 @@ program LudicDev {
if (cmd == "docs-palette") { return cmd_docs_palette() }
if (cmd == "glgen") { return cmd_glgen() }
if (cmd == "vkgen") { return cmd_vkgen() }
if (cmd == "shaders") { return cmd_shaders() }
if (cmd == "fetch-assets") { return cmd_fetch_assets() }
if (cmd == "docs-gen") { return cmd_docs_gen() }
if (cmd == "docs-check") { return cmd_docs_check() }