URP drawing shadows twice?

I’m using URP 12.1.10, and was investigating whether I could re-use shadow calculations for lights that share the same origin.

In ShadowRendering.cs, it seems like shadows are being drawn twice…or am I missing something?

public static bool PrerenderShadows(IRenderPass2D pass, RenderingData renderingData, CommandBuffer cmdBuffer, int layerToRender, Light2D light, int shadowIndex, float shadowIntensity)
        {
            var colorChannel = shadowIndex % 4;
            var textureIndex = shadowIndex / 4;

            if (colorChannel == 0)
                ShadowRendering.CreateShadowRenderTexture(pass, renderingData, cmdBuffer, textureIndex);

            bool hadShadowsToRender = RenderShadows(pass, renderingData, cmdBuffer, layerToRender, light, shadowIntensity, m_RenderTargets[textureIndex].Identifier(), colorChannel); //<----here

            // Render the shadows for this light
            if (RenderShadows(pass, renderingData, cmdBuffer, layerToRender, light, shadowIntensity, m_RenderTargets[textureIndex].Identifier(), colorChannel)) // <--- and here
                m_LightInputTextures[textureIndex] = m_RenderTargets[textureIndex].Identifier();
            else
                m_LightInputTextures[textureIndex] = Texture2D.blackTexture;

            return hadShadowsToRender;
        }

@szevvy It looks like you’re right. Later versions of the file only have one call to RenderShadows().

It seems to be fixed in Unity 2021.3 LTS: Graphics/Packages/com.unity.render-pipelines.universal/Runtime/2D/Shadows/ShadowRendering.cs at 2021.3/staging · Unity-Technologies/Graphics · GitHub