コード例 #1
0
    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);
        }
    }
コード例 #2
0
    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);
        }
    }
コード例 #3
0
 private void CopyTexture(CopyTextureParams copyTextureParams)
 {
     Graphics.CopyTexture(
         copyTextureParams.Src,
         0,
         copyTextureParams.Mip,
         copyTextureParams.Dst,
         copyTextureParams.DstElement,
         copyTextureParams.Mip);
 }
コード例 #4
0
    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);
    }