This adds support to render Curves attributes in Workbench/EEVEE.
Similarly to the hair length attribute, each attribute is stored
in a texture derived from a VBO. As the shading group needs
the textures to be valid upon creation, the attributes are
created and setup during its very creation, instead of doing it lazily
via create_requested. Doing it via create_requested was
also a bit tricky, as contrary to the mesh batch, we cannot
rely on DRW_batch_requested to tell us if attributes need
to be updated or else.
Uniforms are added to the shaders to tell in which scope the
attribute is in (for each point vs. for each curve). The code
generation and shaders had to be modified to pass the uniforms
to each of the attr_load_* functions, but only if the shader is
for curves (HAIR_SHADER is defined). Uniforms are also
declared during code generation as declaring them in the
common_hair_lib is not possible due to their names being
based on the attributes' "safe" names. Using the name is
required to ensure that there is no conflicts between
shaders or between old and new attributes when tweaking
shaders.
Since point attributes need refinement, and since attributes are all
cast to vec4/float4 to account for differences in type conversions
between Blender and OpenGL, the refinement shader for points can be
used as is. The point attributes are stored for each subdivision level
in CurvesEvalFinalCache. Each subdivision level also keeps track of the
attributes already in use so they are properly updated when needed.
Some basic garbage collection was added similar to what is done
for meshes: if the attributes used over time have been different
from the currently used attributes for too long, then the buffers
are freed, ensuring that stale attributesare removed.
Common utilities with the mesh code for handling requested
attributes were moved to a separate file.
Test file :
All types except FLOAT2 were tested, as this is not yet supported by geometry nodes. I would need to check if one of my alembic files has such attributes.