public void DemandResize(RTHandle rth)
        {
            Assert.IsTrue(m_ResizeOnDemandRTs.Contains(rth), "The RTHandle is not an resize on demand handle in this RTHandleSystem. Please call SwitchToResizeOnDemand(rth, true) before resizing on demand.");

            // Grab the render texture
            var rt = rth.m_RT;

            rth.referenceSize = new Vector2Int(m_MaxWidths, m_MaxHeights);
            var scaledSize = rth.GetScaledSize(rth.referenceSize);

            scaledSize = Vector2Int.Max(Vector2Int.one, scaledSize);

            // Did the size change?
            var sizeChanged = rt.width != scaledSize.x || rt.height != scaledSize.y;
            // If this is an MSAA texture, did the sample count change?
            var msaaSampleChanged = rth.m_EnableMSAA && rt.antiAliasing != (int)m_ScaledRTCurrentMSAASamples;

            if (sizeChanged || msaaSampleChanged)
            {
                // Free this render texture
                rt.Release();

                // Update the antialiasing count
                if (rth.m_EnableMSAA)
                {
                    rt.antiAliasing = (int)m_ScaledRTCurrentMSAASamples;
                }

                // Update the size
                rt.width  = scaledSize.x;
                rt.height = scaledSize.y;

                // Generate a new name
                rt.name = CoreUtils.GetRenderTargetAutoName(
                    rt.width,
                    rt.height,
                    rt.volumeDepth,
                    rt.format,
                    rth.m_Name,
                    mips: rt.useMipMap,
                    enableMSAA: rth.m_EnableMSAA,
                    msaaSamples: m_ScaledRTCurrentMSAASamples
                    );

                // Create the new texture
                rt.Create();
            }
        }
        public void DemandResize(RTHandle rth)
        {
            Assert.IsTrue(m_ResizeOnDemandRTs.Contains(rth), "The RTHandle is not an resize on demand handle in this RTHandleSystem. Please call SwitchToResizeOnDemand(rth, true) before resizing on demand.");

            for (int i = 0, c = (int)RTCategory.Count; i < c; ++i)
            {
                if (rth.m_RTs[i] == null)
                {
                    continue;
                }

                var rt = rth.m_RTs[i];
                rth.referenceSize = new Vector2Int(m_MaxWidths[i], m_MaxHeights[i]);
                var scaledSize = rth.GetScaledSize(rth.referenceSize);
                scaledSize = Vector2Int.Max(Vector2Int.one, scaledSize);

                var enableMSAA        = i == (int)RTCategory.MSAA;
                var sizeChanged       = rt.width != scaledSize.x || rt.height != scaledSize.y;
                var msaaSampleChanged = enableMSAA && rt.antiAliasing != (int)m_ScaledRTCurrentMSAASamples;

                if (sizeChanged || msaaSampleChanged)
                {
                    rt.Release();

                    if (enableMSAA)
                    {
                        rt.antiAliasing = (int)m_ScaledRTCurrentMSAASamples;
                    }

                    rt.width  = scaledSize.x;
                    rt.height = scaledSize.y;

                    rt.name = CoreUtils.GetRenderTargetAutoName(
                        rt.width,
                        rt.height,
                        rt.volumeDepth,
                        rt.format,
                        rth.m_Name,
                        mips: rt.useMipMap,
                        enableMSAA: enableMSAA,
                        msaaSamples: m_ScaledRTCurrentMSAASamples
                        );
                    rt.Create();
                }
            }
        }