public sealed class SkinningRenderFeatureGPU skinning: a bone palette per object, and the index that finds it.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
The sub-feature docs/plan/06 names as the proof that the arrangement extends — "adding skinning does not modify MeshRenderFeature; it registers its own parallel array". It does not, and this file is the whole of it.
The palette is skinning matrices, not bone transforms. What goes in is inverseBindPose * boneWorld, already multiplied — one multiply per bone per frame on the CPU instead of one per vertex on the GPU. A character has a hundred bones and tens of thousands of vertices, so doing it the other way round is four orders of magnitude more work for the same answer.
A push constant carries the base index, not a descriptor offset. One storage buffer holds every skeleton's palette back to back and is bound once for the frame; a draw says where its own palette starts. A dynamic offset would work and would force every palette to be padded up to minStorageBufferOffsetAlignment and to a fixed maximum bone count — where an index costs four bytes of a push block that already exists for the transform.
Fields and properties (9)
public override string NameThe sub-feature's name, for logging and profiling.
public RenderDataKey<BonePalette> PalettesWhere each object's palette starts, and how many bones it has.
public IGraphicsDevice? DeviceThe device the bone buffer lives on. Set before the first frame that prepares.
public BufferHandle BufferThe buffer every palette lives in, for a host binding it once a frame.
public long BufferOffsetThe byte offset this frame's palettes start at. Bind the buffer here, not at zero.
public int BoneCountHow many bone matrices this frame holds.
public ShaderStage StagesWhich stages read the base index.
public int OffsetWhere the base index goes in the push-constant block.
public IReadOnlyList<PermutationKey<bool>> PermutationKeysThe permutation keys this sub-feature decides.
Methods (8)
public SkinningRenderFeature()Creates the feature, interning its permutation key.
public bool ValueOf(RenderSystem system, RenderObjectId id, int index)protected internal override void Initialize(RenderSystem system)Registers this sub-feature's per-object data. Called once.
public void Begin()Starts a frame's palettes. Call before the first SetBones.
public void SetBones(RenderSystem system, RenderObjectId id, ReadOnlySpan<Matrix4x4> bones)Gives an object its bone palette for this frame.
protected internal override void Prepare(RenderSystem system)Fills this sub-feature's data for the visible objects.
public void Draw(RenderSystem system, RenderDrawContext context, in RenderNode node)Records this sub-feature's contribution for one node.
public void Dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Used by (3)
- HarnessVixen.Rendering.Tests
- SkinningAndInstancingTestsVixen.Rendering.Tests
- SkinningSystemVixen.Animation