Vixen
02b45cc4
csharp
public static class PermutationClosure

Every variant a shader actually has, found by compiling until the answer stops changing.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Doc 06's economy, made mechanical: twenty declared flags describe a million combinations and a handful of them are distinct shaders, because Raven reports which keys a compilation read rather than which were declared. The trouble is that the answer depends on the values — a flag guarded by another flag is unread until the outer one is on — so a single compilation with the defaults undercounts, and the cross product of everything declared overcounts by orders of magnitude.

So it is a fixed point. Compile the defaults, see which keys were read, enumerate over those, and if any of those compilations read a key that was not in the set, put it in and start again. The set only grows and is bounded by what the shader declares, so it terminates; and it terminates having compiled exactly the variants that exist.

Numbers need help and booleans do not. A bool has two values and enumerating them is complete. An int does not, and the interesting values are project knowledge — a light-count bucket is 4, 16 and 64 because of what the project's scenes look like, which is not in the shader. Unless a caller supplies a domain a numeric key contributes its declared default alone, which is honest: it produces a bundle that is missing the variants nobody said they wanted, and a run against it reports them as misses by name.

Fields and properties (1)

  • public const int DefaultLimit

    How many compilations one shader may take before this gives up.

Methods (1)

Used by (2)

  • EffectBundleBuilderVixen.ShaderCompiler
  • EffectCompilerTestsVixen.ShaderCompiler.Tests