I’m trying to read from a StructuredBuffer type GraphicsBuffer using a CustomHLSL node. The buffer contains position at xyz and size at w, so I’ve defined two out parameters, and connected the node to two Update Particle Block sub nodes; SetPosition and SetSize.
I get this error:
redefinition of 'ReadSimplexPointFunction_B96021B' at kernel CSMain
Since the compilation failed, I can’t look at the compiled shader code, but my guess is that VFXGraph is pasting in the HLSL function twice because it’s connected to two inlets. Perhaps. Or what am I missing?
Here is the custom HLSL code
void ReadSimplexPointFunction( in int spawnIndex, in StructuredBuffer<uint> indexBuffer, in StructuredBuffer<float4> pointBuffer, out float3 position, out float size )
{
position = float3( 10, 0, 0 );
size = 1;
int index = indexBuffer[ spawnIndex ];
if( index == 0 ) return;
float4 posSize = pointBuffer[ index-1 ]; // Indices are stored with a +1 offset
position = posSize.xyz;
size = posSize.w;
}
