Vixen
02b45cc4
csharp
public abstract class ParameterKey

A named, typed handle for one shader parameter, interned so that equal names are the same object.

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

Remarks

Stride's ParameterKey idea, with the reflection cost moved to compile time: Vixen.Shaders.Generators reads Raven's reflection and emits a static readonly key per parameter, so a render feature refers to LightingKeys.LightCount and never to the string "Lighting.LightCount".

Interning is what makes a key cheap to use. A key is compared and hashed by reference, so a dictionary keyed by one costs a pointer compare rather than a string compare — and two assemblies that generated bindings from the same shader get the same object rather than two that merely look alike. It also makes a whole class of bug impossible: a key that reached the wrong shader is caught at creation as a type conflict rather than by writing four bytes into the wrong place.

Fields and properties (6)

  • public string Name

    The dotted name the shader's reflection gave this parameter.

  • public Type ValueType

    The CLR type a value for this key has.

  • public int HashCode

    The name's hash, computed once.

  • public abstract bool IsPermutation

    Whether this key selects a shader variant rather than carrying a value into one.

  • public abstract bool HasDeclaredDefault

    Whether a shader's declared default has reached this key.

  • public abstract ReadOnlySpan<byte> DefaultBytes

    The key's default, as the bytes a constant buffer wants.

Methods (4)

  • public bool Equals(ParameterKey? other)

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

  • public override bool Equals(object? obj)

    Determines whether the specified object is equal to the current object.

  • public override int GetHashCode()

    Serves as the default hash function.

  • public override string ToString()

    Returns a string that represents the current object.

Used by (68, showing 40)

  • AutoExposureKeysVixen.Rendering
  • BindlessSamplingDeviceTestsVixen.Graphics.Golden.Tests
  • BloomKeysVixen.Rendering
  • ChainVixen.Graphics.Golden.Tests
  • ClusterResolveTestsVixen.Rendering.Tests
  • ClusterSoftwareRasterKeysVixen.Rendering
  • ClusteredShadingDeviceTestsVixen.Graphics.Golden.Tests
  • CompositorBuilderVixen.Rendering
  • ComputeRendererVixen.Rendering
  • CullingKeysVixen.Rendering
  • DepthOfFieldKeysVixen.Rendering
  • DistanceFieldAoKeysVixen.Rendering.PostFx
  • DrawArgumentsKeysVixen.Rendering
  • EffectVixen.Shaders
  • EffectCacheTestsVixen.Shaders.Tests
  • EffectConstantsVixen.Rendering
  • EffectKeyVixen.Shaders
  • EffectLoaderVixen.Shaders
  • EffectParameterVixen.Shaders
  • EffectSetWriterVixen.Rendering
  • FogKeysVixen.Rendering.PostFx
  • FoliageCullKeysVixen.Rendering.Terrain
  • ForwardFrameTestsVixen.Rendering.Tests
  • ForwardPlusKeysVixen.Rendering
  • FullScreenRendererVixen.Rendering
  • FxaaKeysVixen.Rendering.PostFx
  • GeneratedBindingsTestsVixen.Shaders.Tests
  • GpuClusterResolveVixen.Rendering
  • GpuCullingVixen.Rendering
  • GpuDrawArgumentsVixen.Rendering
  • GpuDrivenCompositorTestsVixen.Rendering.Tests
  • GpuVisibilityGroupTestsVixen.Rendering.Tests
  • GrassKeysVixen.Rendering.Terrain
  • GrassScatterKeysVixen.Rendering.Terrain
  • ImpostorFinishKeysVixen.Rendering
  • ImpostorKeysVixen.Rendering.Terrain
  • IrradianceFieldRepairVixen.Rendering
  • IrradianceRepairKeysVixen.Rendering
  • IrradianceShadingDeviceTestsVixen.Graphics.Golden.Tests
  • LensFlareKeysVixen.Rendering