Vixen
02b45cc4
csharp
public readonly struct ShaderComposition

Which shader fills each of a shader's compose slots — one material's feature choices.

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

Remarks

A pass is written once against a protocol — compose val surface: IMaterialSurface — and each material says which implementation to use. Resolution happens when the shader is compiled, so a call through a slot becomes a direct call and only the chosen implementation is emitted. This is the value that says which.

Part of the cache key, not a note beside it. Two materials that differ only in their features produce different code from the same shader name and the same permutations, so a key without this is a cache that hands a metal-roughness material the specular-glossiness shader — a wrong image with no error anywhere.

Sorted by slot for the reason EffectKey sorts its values: the same choices made in a different order have to be the same key, or the cache holds one entry per insertion order and hits almost never.

A plain pair of strings rather than the compiler's own ComposeBindings: this travels into a runtime that must not link the compiler, and out the other side onto a command line or a cache filename. The provider that does have a compiler is where the two meet.

Fields and properties (3)

  • public static ShaderComposition Empty

    Nothing composed, for a shader with no slots.

  • public ImmutableArray<KeyValuePair<string, string>> Slots

    The slots and what fills them, sorted by slot.

  • public int Count

    How many slots are filled.

Methods (8)

  • public static ShaderComposition Of(IEnumerable<KeyValuePair<string, string>> slots)

    The composition binding , in its normal form.

  • public string? Resolve(string slot)

    What fills , or null when nothing does.

  • public bool Equals(ShaderComposition other)

    Indicates whether the current object is equal to another object of the same type.

  • public override bool Equals(object? obj)

    Indicates whether this instance and a specified object are equal.

  • public override int GetHashCode()

    Returns the hash code for this instance.

  • public static bool operator ==(ShaderComposition left, ShaderComposition right)

    Whether two compositions choose the same implementations.

  • public static bool operator !=(ShaderComposition left, ShaderComposition right)

    Whether they differ.

  • public override string ToString()

    The composition as the slot=Shader list a compiler takes.

Used by (26)

  • DevelopmentEffectsThirdPersonShooter
  • ClusterResolveTestsVixen.Rendering.Tests
  • ClusteredShadingDeviceTestsVixen.Graphics.Golden.Tests
  • ComposeSlotInventoryTestsVixen.Rendering.Tests
  • ComputeRendererVixen.Rendering
  • DepthPrepassTestsVixen.Rendering.Tests
  • DistanceFieldDeviceTestsVixen.Graphics.Golden.Tests
  • EffectCacheTestsVixen.Shaders.Tests
  • EffectCompileRequestVixen.Shaders
  • EffectDataVixen.Shaders
  • EffectKeyVixen.Shaders
  • EffectRequestVixen.Shaders
  • EffectSystemTestsVixen.Shaders.Tests
  • FullScreenRendererVixen.Rendering
  • IrradianceBounceDeviceTestsVixen.Graphics.Golden.Tests
  • IrradianceShadingDeviceTestsVixen.Graphics.Golden.Tests
  • MaterialVixen.Rendering
  • MaterialCompilerVixen.Rendering
  • MaterialCompilerTestsVixen.Rendering.Tests
  • MaterialReflectionTestsVixen.Rendering.Tests
  • MaterialRenderFeatureVixen.Rendering
  • TexturedMaterialTestsVixen.Rendering.Tests
  • EffectBundleBuilderVixen.ShaderCompiler
  • EffectTranslatorVixen.ShaderCompiler
  • PermutationClosureVixen.ShaderCompiler
  • RavenEffectCompilerVixen.ShaderCompiler