public unsafe DanmakuRenderer(Material material, Mesh mesh) { propertyBlock = new MaterialPropertyBlock(); StructuredBuffers = ComputeBufferPool.GetShared().CreateContext(); ArgBuffers = ComputeBufferPool.GetShared(ComputeBufferType.IndirectArguments).CreateContext(); Material = material; Mesh = mesh; }
/// <summary> /// This function is called when the MonoBehaviour will be destroyed. /// </summary> void OnDestroy() { Camera.onPreCull -= RenderBullets; foreach (var group in RendererGroups.Values) { group.Dispose(); } ComputeBufferPool.DisposeShared(); }
public static ComputeBufferPool GetShared(ComputeBufferType type = ComputeBufferType.Default) { Pools = Pools ?? new Dictionary <ComputeBufferType, ComputeBufferPool>(); ComputeBufferPool pool; if (!Pools.TryGetValue(type, out pool)) { pool = new ComputeBufferPool(type); Pools.Add(type, pool); } return(pool); }
public Context(ComputeBufferPool pool) { Pool = pool; usedBuffers = new Queue <ComputeBuffer>(); }