Graphics.Blit Tiled GPU perf. warning: RenderTexture color surface was not cleared/discarded

What am I doing wrong here?

I have a script that runs on the Update loop. I have 2 RenderTexture assets. I just want to blit into them with a material. Yet I get Tiled GPU Perf warnings.

I don’t want to discard the contents, I want to keep the contents :rage:

private void Update() {

        if (renderTexture && heightTexture && material && heightMaterial) {

            //heightTexture.DiscardContents();
            //renderTexture.DiscardContents();

            Graphics.Blit(null, heightTexture, heightMaterial, 0);          
            Graphics.Blit(heightTexture, renderTexture, heightMaterial, 1);

            material.SetTexture(Uniforms.HeightTex, renderTexture);
        }
    }

Even if I call DiscardContents, I still get these warnings. Why? I can’t even use Temporary ones either, still warns.

How are you supposed to use Graphics.Blit into a texture without these perf warnings?

Use MarkRestoreExpected. I wrote a little more on the warning here.

Thanks

You do it as follows: Just change setting of Unity: Edit → Graphic Emulation → No Emulation

2 Likes