Vixen
02b45cc4
csharp
public sealed class RavenEffectCompiler

Compiles a variant on demand, in process, and hands back the record the engine loads.

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

Remarks

An IEffectSource like the disk cache and the bundle, which is the whole reason the tiers compose: the editor stacks a disk cache over one of these and gets "compile once, then read" without either of them knowing about the other.

The sources are parsed once and the compilation is redone per variant. Parsing is the same work for every variant — a permutation changes what binding and lowering do with the tree, not what the tree is — while everything after it genuinely differs, which is the point of a permutation. Sharing the trees is what makes enumerating forty variants of one shader cost forty lowerings rather than forty parses as well.

It goes through Compilation rather than shelling out to vixen-raven. A process per variant would be measured in tens of milliseconds of startup each, and the artefact would have to make a round trip through the file system to come back — which for a service answering a device over TCP is the whole latency budget spent on nothing.

Fields and properties (4)

  • public string Target

    The backend name, as TargetBackends knows it.

  • public string SourceHash

    A hash of the sources, which every artefact this produces carries.

  • public int Compilations

    How many compilations have been run.

  • public ShaderComposition Composition

    What fills a slot no key names.

Methods (3)

  • public RavenEffectCompiler(IEnumerable<string> paths, string target = "spirv", IEnumerable<string>? referencePaths = null)

    Reads and parses a set of shader sources.

  • public EffectData? TryGet(EffectKey key)

    Compiles the variant a key names.

  • public ImmutableArray<PermutationInfo> Declared(string shaderName, ShaderComposition composition = default(ShaderComposition))

    Every permutation key the shader declares, for enumerating its variants.

Used by (20)

  • DevelopmentEffectsThirdPersonShooter
  • LibraryEffectsVirtualGeometry
  • BindlessSamplingDeviceTestsVixen.Graphics.Golden.Tests
  • BufferTransferDeviceTestsVixen.Graphics.Golden.Tests
  • ClusterCullingDeviceTestsVixen.Graphics.Golden.Tests
  • ClusteredShadingDeviceTestsVixen.Graphics.Golden.Tests
  • CompilerVixen.Graphics.Golden.Tests
  • CompilingVixen.Graphics.Golden.Tests
  • DistanceFieldDeviceTestsVixen.Graphics.Golden.Tests
  • IrradianceShadingDeviceTestsVixen.Graphics.Golden.Tests
  • RavenEffectsVixen.Graphics.Golden.Tests
  • ScreenProbeUpsampleCompileTestsVixen.Graphics.Golden.Tests
  • ViewCullingDeviceTestsVixen.Graphics.Golden.Tests
  • EditorEffectsVixen.Editor.App
  • EffectBundleBuilderVixen.ShaderCompiler
  • EffectCompilerTestsVixen.ShaderCompiler.Tests
  • PermutationClosureVixen.ShaderCompiler
  • ShaderBuildRunnerVixen.Cli
  • ShaderCompilerServiceTestsVixen.ShaderCompilerService.Tests
  • ZeroRuntimeCompilationTestsVixen.ShaderCompiler.Tests