public void Init(GridService grid) { int x = _lifes.SimSizeX, y = _lifes.SimSizeY, z = _lifes.SimSizeZ; grid.SetParams(_compute); _compute.SetBuffer(_kernelInitHashes, ShaderConst.BUF_LIFE, _lifes.Lifes); _compute.SetBuffer(_kernelInitHashes, ShaderConst.BUF_POSITION, _positions.P0); SetBuffer(_compute, _kernelInitHashes); _compute.Dispatch(_kernelInitHashes, x, y, z); }
public HashGrid(ComputeShader compute, ComputeShader computeSort, LifeService l, PositionService p, GridService.Grid g) { var capacity = l.Lifes.count; _compute = compute; _lifes = l; _positions = p; _kernelSolve = compute.FindKernel (ShaderConst.KERNEL_SOVLE_COLLISION_DETECTION); _sort = new BitonicMergeSort(computeSort); _keys = new ComputeBuffer(capacity, Marshal.SizeOf(typeof(uint))); CollisionData = new Collision[capacity]; Collisions = new ComputeBuffer(capacity, Marshal.SizeOf(typeof(Collision))); _hashes = new HashService(compute, l, p); _grid = new GridService(compute, g, _hashes); }
public HashGrid(ComputeShader compute, ComputeShader computeSort, LifeService l, PositionService p, GridService.Grid g) { var capacity = l.Lifes.count; _compute = compute; _lifes = l; _positions = p; _kernelSolve = compute.FindKernel(ShaderConst.KERNEL_SOVLE_COLLISION_DETECTION); _sort = new BitonicMergeSort(computeSort); _keys = new ComputeBuffer(capacity, Marshal.SizeOf(typeof(uint))); CollisionData = new Collision[capacity]; Collisions = new ComputeBuffer(capacity, Marshal.SizeOf(typeof(Collision))); _hashes = new HashService(compute, l, p); _grid = new GridService(compute, g, _hashes); }