diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 6e7a1f0188c..4cfad028fc0 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -51,6 +51,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed texture fields for volume parameters accepting textures with wrong dimensions. - Fixed Realtime lightmap not working correctly in player with various lit shader (case 1360021) - Fixed unexpectedly strong contribution from directional lights in path-traced volumetric scattering (case 1304688). +- Fixed memory leak with XR combined occlusion meshes (case 1366173). ### Changed - Visual Environment ambient mode is now Dynamic by default. diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/XR/XRSystem.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/XR/XRSystem.cs index b7978e1aa20..4c2dd0ba8a6 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/XR/XRSystem.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/XR/XRSystem.cs @@ -167,8 +167,11 @@ internal int GetMaxViews() internal void ReleaseFrame() { - foreach ((Camera _, XRPass xrPass) in framePasses) + for (int i = 0; i < framePasses.Count; i++) { + // Pop from the back to keep initial ordering (see implementation of ObjectPool) + (Camera _, XRPass xrPass) = framePasses[framePasses.Count - i - 1]; + if (xrPass != emptyPass) XRPass.Release(xrPass); } diff --git a/com.unity.render-pipelines.universal/CHANGELOG.md b/com.unity.render-pipelines.universal/CHANGELOG.md index 2504beb95eb..9c75d0470b4 100644 --- a/com.unity.render-pipelines.universal/CHANGELOG.md +++ b/com.unity.render-pipelines.universal/CHANGELOG.md @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - URP asset can now use multi-edit. [case 1364966](https://issuetracker.unity3d.com/issues/urp-universalrenderpipelineasset-does-not-support-multi-edit) - Fixed an issue in where the current open scene didn't load after running the converters. [case 1365101] - Added "Conservative Enclosing Sphere" setting to fix shadow frustum culling issue where shadows are erroneously culled in corners of cascades [case 1153151](https://issuetracker.unity3d.com/issues/lwrp-shadows-are-being-culled-incorrectly-in-the-corner-of-the-camera-viewport-when-the-far-clip-plane-is-small) +- Fixed memory leak with XR combined occlusion meshes. [case 1366173] ## [12.0.0] - 2021-01-11 ### Added diff --git a/com.unity.render-pipelines.universal/Runtime/XR/XRSystem.cs b/com.unity.render-pipelines.universal/Runtime/XR/XRSystem.cs index 8b566bc918b..ee5a4e69076 100644 --- a/com.unity.render-pipelines.universal/Runtime/XR/XRSystem.cs +++ b/com.unity.render-pipelines.universal/Runtime/XR/XRSystem.cs @@ -201,8 +201,11 @@ internal List SetupFrame(Camera camera, bool enableXRRendering) internal void ReleaseFrame() { - foreach (XRPass xrPass in framePasses) + for (int i = 0; i < framePasses.Count; i++) { + // Pop from the back to keep initial ordering (see implementation of ObjectPool) + var xrPass = framePasses[framePasses.Count - i - 1]; + if (xrPass != emptyPass) XRPass.Release(xrPass); }