In the future texture views could have an optional aspect in case people
want to use the stencil aspect, or combine multiple usages for the
different channels.
Ok so for the compute skinning, we maintain 2 vertex buffers:
- The first buffer is the original vertices in the model
- The second buffer is the post-animated vertices, which is drawn
Normally we run the animation compute shader and tell it to use the
"raw" vertices as the input and write the result to the 2nd buffer.
With blend shapes, it gets more complicated, because the blend shape
shader follows the same process and writes blended vertices to the 2nd
buffer. So if you're doing skeletal animation on a mesh with blend
shapes, you have to then do skeletal animation "in place" instead of
reading from the original vertex buffer.
There was some code here that tried to account for this, but it was
just checking if the model had blend shapes at all. That check isn't
fine-grained enough though. When deciding which source buffer to use,
it can differ for each individual primitive (technically node) in the
model. In a given skin, some primitives might have blend shapes and
others might not.
The fix is to do the skinning in 2 passes, separating the "vertices with
blend shapes" from the "vertices without blend shapes". A push constant
is used to tell the compute shader which source buffer it should use.
The primitive sorting was also changed to group primitives within a skin
based on whether or not they have blend shapes.
Note that you could simplify this a bit by copying the raw vertices to
the 2nd buffer upfront and doing all the blending and skinning in-place,
but this has been measured to be a lot slower than branching in the
compute shader.