Search Unity

Try to use temporary RenderTexture from previous frame

Discussion in 'Universal Render Pipeline' started by JiangBaiShi, Dec 8, 2020.

  1. JiangBaiShi

    JiangBaiShi

    Joined:
    Aug 3, 2019
    Posts:
    27
    Hi, My compute shader needs to access a temporary rendertexture that was allocated by cmd.GetTemporaryRT(...) from previous frame, but then Unity warns me with "CommandBuffer: temporary render texture XXX not found while executing XXX (SetComputeTextureParam)".

    I tried to reallocate the texture at start of each frame before any shader accessing it, and the warning disappears; but in that way I cannot acces the texture data from last frame...

    Is every temp RT automatically released in each frame? I don't think I can use custom RenderTexture and manage its lifetime directly since URP command buffer only supports temp rt creation from cmd.GetTemporaryRT(...).

    I'm very confused, any help is much appreciated. The Unity version I'm using is 2020.2.0b14.