public void CopyTexture( Texture src, Texture dst, int mipLevel, int mipSize, int dstElement, bool useQueue = true) { bool queued = false; var copyTextureParams = new CopyTextureParams(src, dst, mipLevel, mipSize, dstElement); if (useQueue) { lock (texturesToCopy) { if (texturesToCopy.Count < TEXTURES_TO_COPY_QUEUE_CAPACITY) { texturesToCopy.Enqueue(copyTextureParams); queued = true; } } } else { CopyTexture(copyTextureParams); } if (!queued) { CopyTexture(copyTextureParams); } }
public void CopyTexture( Texture src, Texture dst, int mipLevel, int mipSize, int dstElement, bool useQueue = true) { var copyTextureParams = new CopyTextureParams(src, dst, mipLevel, mipSize, dstElement); if (useQueue) { lock (texturesToCopy) { if (texturesToCopy.Count < TEXTURES_TO_COPY_QUEUE_CAPACITY) { texturesToCopy.Enqueue(copyTextureParams); } else { // Queue is full so copy texture immediately CopyTexture(copyTextureParams); } } } else { CopyTexture(copyTextureParams); } }
private void CopyTexture(CopyTextureParams copyTextureParams) { Graphics.CopyTexture( copyTextureParams.Src, 0, copyTextureParams.Mip, copyTextureParams.Dst, copyTextureParams.DstElement, copyTextureParams.Mip); }
IEnumerator CopyTextureCoroutine(CopyTextureParams copyTextureParams) { // Wait until frame rendering is done yield return(new WaitForEndOfFrame()); Graphics.CopyTexture( copyTextureParams.Src, 0, copyTextureParams.Mip, 0, 0, copyTextureParams.SrcSize, copyTextureParams.SrcSize, copyTextureParams.Dst, copyTextureParams.DstElement, copyTextureParams.Mip, 0, 0); }