How to copy RenderTexture contents to Texture2D without reading the pixels data into CPU

Hi,
What are the options to copy a RenderTexture to a Texture2D in Cocos creator 3.4.2 apart from reading pixels using readPixels() function and making an ImageAsset?
I have employed the method shown below, but this seems to be working slow.

The code below reads the pixels from 6 render targets and creates 6 Texture2D using the data.

for(let i: number = 0; i < 6; i++)
            {
                let pixelsArr: ArrayBufferView = this.cubeSidesRT[i].readPixels(0, 0, this.cubeSidesRT[i].width, this.cubeSidesRT[i].height);
                this.imageAssets[i].reset({
                    _data: pixelsArr,
                    width: this.cubeSidesRT[i].width,
                    height: this.cubeSidesRT[i].height,
                    format: Texture2D.PixelFormat.RGBA8888,
                    _compressed: false
                });
                this.cubeSidesTex[i].image = this.imageAssets[i];
            }

I am happy to ask engineering to have a look.

What do you mean by work slow?

Since I will have to run this code every frame, reading pixels and creating the texture every frame consumes the GPU bus bandwidth which makes the frame rate fall significantly.
I was wondering if there is a way to copy textures without having to explicitly read the texture data to the CPU.

  • Create a render texture that will fit the drawing
  • Create a spriteFrame with the render texture as source.
  • Add spriteFrame to a sprite and you are done.

Code Snippet for creating a Render Texture (CC 2.4.6) There will be something similar in 3.x

        let offScreenTexture = new cc.RenderTexture()
        let size = cc.winSize
        offScreenTexture.initWithSize(size.width, size.height, cc.RenderTexture.DepthStencilFormat.RB_FMT_D24S8)

Creating SpriteFrame from the RenderTexture Instance

 let spf = new cc.SpriteFrame(offScreenTexture, 
                    new cc.Rect(posx, posy, rect_size.width, rect_size.height))