public virtual void RemoveConstantDefinition( string name )
{
GpuConstantDefinition def;
if ( !NamedConstants.Map.TryGetValue( name, out def ) )
return;
var isFloat = def.IsFloat;
var numElems = def.ElementSize * def.ArraySize;
foreach (var otherDef in NamedConstants.Map.Values)
{
// same type, and comes after in the buffer
if ( ( isFloat == otherDef.IsFloat ) && otherDef.PhysicalIndex > def.PhysicalIndex )
{
// adjust index
otherDef.PhysicalIndex -= numElems;
}
}
// remove floats and reduce buffer
if ( isFloat )
{
NamedConstants.FloatBufferSize -= numElems;
FloatConstants.RemoveRange(def.PhysicalIndex, numElems);
}
else
{
NamedConstants.IntBufferSize -= numElems;
IntConstants.RemoveRange(def.PhysicalIndex, numElems);
}
++Version;
}