public void Dispose() { if (MaskBuffer.IsCreated) { MaskBuffer.Dispose(); } if (MaskViews.IsCreated) { MaskViews.Dispose(); } }
public IEnumerator ReadToTexture(RenderTexture rt, int texElement, MaskBuffer mb, int separateFrame) { while (!MaskBufferIsFinished(ref mb)) { yield return(null); } int separateSize = (int)size / separateFrame; for (int i = 0; i < separateFrame; ++i) { SetBufferData(ref mb, separateSize, i); yield return(null); } mb.Dispose(); terrainEditShader.SetInt(ShaderIDs._OffsetIndex, texElement); terrainEditShader.SetInt(ShaderIDs._Count, (int)resolution); terrainEditShader.SetTexture(readPass, ShaderIDs._DestTex, rt); terrainEditShader.SetBuffer(readPass, ShaderIDs._ElementBuffer, readWriteBuffer); int disp = (int)resolution / 16; terrainEditShader.Dispatch(readPass, disp, disp, 1); }