RenderingUtils.ReAllocateifNeeded does not work if Rendertexture has depth.

I have code:

var desc = renderingData.cameraData.cameraTargetDescriptor;
desc.depthStencilFormat = GraphicsFormat.D16_UNorm;
desc.depthBufferBits = 16;
desc.colorFormat = RenderTextureFormat.ARGB32;

RenderingUtils.ReAllocateIfNeeded(ref m_SceneText, desc, FilterMode.Bilinear, TextureWrapMode.Clamp, name: "_SceneText");

And I got Format: None in the framedebugger.

Hi, you cannot combine both color and depth in one RTHandle.

To allocate a color RTHandle, you need to set the depth format to none (or depthBufferBits to 0).

1 Like

Thank you!!! God you save me a lot of time.

1 Like