Crafter.Build/implementations
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Jorijn van der Graaf ddaab5a32a
feat(shader): per-entry defines and a named output variant
Crafter.Graphics has to ship each of its compute shaders in two builds
of one source: one that indexes VK_EXT_descriptor_heap and one that
reads the same slots from a descriptor set, for drivers without the
extension. A Shader was a path, an entry point and a stage, and its
output name was derived from the path alone, so one source could only
be compiled once.

Shader gains `defines`, spelled like the compiler's -D ("NAME" is
defined to 1, "NAME=VALUE" to VALUE) and handed to glslang as a
preamble, and `variant`, which names the output: "ui.comp.glsl" with
variant "sets" becomes "ui.comp.sets.spv". OutputName() is the one
place that name is formed; Check, Compile and the forwarding of a
dependency's shaders into the consumer's bin dir all use it.

Two fields make one mistake easy: defines set, variant forgotten. Both
entries then compiled in parallel into the same file, the build
reported success with whichever finished last, and Check() called both
up to date from then on. The same has always been true of a.vert next
to a.frag. Build() now refuses a configuration in which two entries
share an output name and says which.

A define without a name, or one spanning lines, and a variant with a
path separator are rejected by name. Left to glslang the first two
surface as "-1:<line>" with no file, and the last as a failed open
after the whole compile.

Not addressed: Check() still compares only the source's mtime, so a
change to the defines, or to an included file, does not recompile
(#35).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-06 16:50:41 +02:00
..
Crafter.Build-Asset.cpp linting 2026-07-23 01:24:42 +02:00
Crafter.Build-Clang.cpp feat(shader): per-entry defines and a named output variant 2026-10-06 16:50:41 +02:00
Crafter.Build-External.cpp feat(toolchain): resolve the compiler in one place 2026-10-02 22:26:31 +02:00
Crafter.Build-Implementation.cpp fix: decide a build step by its exit code, not by whether it printed 2026-08-26 00:51:15 +00:00
Crafter.Build-Interface.cpp fix: decide a build step by its exit code, not by whether it printed 2026-08-26 00:51:15 +00:00
Crafter.Build-Lint.cpp feat(toolchain): resolve the compiler in one place 2026-10-02 22:26:31 +02:00
Crafter.Build-Platform.cpp fix(host-cache): hash every part of the project.so stamp 2026-10-06 16:50:41 +02:00
Crafter.Build-Progress.cpp refactor: drop Windows host support 2026-10-02 22:03:34 +02:00
Crafter.Build-Shader.cpp feat(shader): per-entry defines and a named output variant 2026-10-06 16:50:41 +02:00
Crafter.Build-Test.cpp feat(toolchain): resolve the compiler in one place 2026-10-02 22:26:31 +02:00
Crafter.Build-Toolchain.cpp fix(sysroot): take the std module source from the sysroot's libc++ release 2026-10-03 16:37:00 +02:00
main.cpp refactor: drop Windows host support 2026-10-02 22:03:34 +02:00