ShaderCompile registers one source twice and checks that the variant gets its own output name, takes the other #ifdef branch and receives the value of a NAME=VALUE define. Staleness is pinned per output: while only the plain output exists the variant must still be due, or Build() would never compile a variant added to a built project. Malformed defines and a variant with a path separator must be refused by name. ShaderVariantBuild drives the same through Build(), which is where the entries compile in parallel into one directory: a variant added to an already built configuration is compiled into its own file, and two entries with one output name fail the build without touching the existing output. Its fixture tests the macro with `#if`, which pins that a bare define is 1 and not empty. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
12 lines
260 B
GLSL
12 lines
260 B
GLSL
#version 450
|
|
|
|
// Built twice by the ShaderVariantBuild test: as is, and with TINT_RED defined.
|
|
layout(location = 0) out vec4 outColor;
|
|
|
|
void main() {
|
|
#if TINT_RED
|
|
outColor = vec4(1.0, 0.0, 0.0, 1.0);
|
|
#else
|
|
outColor = vec4(0.0, 1.0, 0.0, 1.0);
|
|
#endif
|
|
}
|