From 2aa5eb84e7684032c36e296b9f40f971a6886675 Mon Sep 17 00:00:00 2001 From: Evergreen Date: Wed, 22 Oct 2025 15:58:17 +0000 Subject: [PATCH 1/3] [Port] [2022.3] [XR][GFX] Fetch the viewport Rect from the RenderPass to save in GfxThread::OutData::renderViewport --- .../Runtime/XR/XRSystem.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Packages/com.unity.render-pipelines.core/Runtime/XR/XRSystem.cs b/Packages/com.unity.render-pipelines.core/Runtime/XR/XRSystem.cs index 917d489810a..a82bb7e2056 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/XR/XRSystem.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/XR/XRSystem.cs @@ -155,6 +155,21 @@ public static void SetRenderScale(float renderScale) #endif } + /// + /// Used by the render pipeline to retrieve the applied renderViewportScale value from the XR display. + /// One use case for retriving this value is that render pipeline can properly sync some SRP owned textures to scale accordingly + /// + /// Returns current appliedViewportScale value from the XRDisplaySubsystem. + public static float GetRenderViewportScale() + { +#if ENABLE_VR && ENABLE_XR_MODULE + + return s_Display.appliedViewportScale; +#else + return 1.0f; +#endif + } + /// /// Used by the render pipeline to initiate a new rendering frame through a XR layout. /// From 0e25d76a98fe16b6869bf3ca260b477048238d01 Mon Sep 17 00:00:00 2001 From: Kenny Tan Date: Fri, 24 Oct 2025 05:41:24 +0000 Subject: [PATCH 2/3] [Port] [2022.3][UUM-116667][6000.4] Fix NullReferenceException with LightBatchingDebugger --- .../Editor/2D/LightBatchingDebugger/LightBatchingDebugger.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Packages/com.unity.render-pipelines.universal/Editor/2D/LightBatchingDebugger/LightBatchingDebugger.cs b/Packages/com.unity.render-pipelines.universal/Editor/2D/LightBatchingDebugger/LightBatchingDebugger.cs index 660a9f08a15..781b51c001f 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/2D/LightBatchingDebugger/LightBatchingDebugger.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/2D/LightBatchingDebugger/LightBatchingDebugger.cs @@ -440,7 +440,7 @@ private void OnSelectionChanged() private void RefreshView() { PopulateData(); - batchListView.RefreshItems(); + batchListView?.RefreshItems(); OnSelectionChanged(); ResetDirty(); From 1503d114473279773bd1e247e9e804ab2aa9cc50 Mon Sep 17 00:00:00 2001 From: Louis-Philippe Ledoux Date: Thu, 13 Nov 2025 06:28:06 +0000 Subject: [PATCH 3/3] [Port] [2022.3] Fix for incorrect buffer size when switching XR On/Off --- .../Runtime/RenderPipeline/HDRenderPipeline.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs index eb9b24f555c..e9c2b97ca58 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs @@ -622,8 +622,7 @@ public HDRenderPipeline(HDRenderPipelineAsset asset) m_DepthPyramidMipLevelOffsetsBuffer = new ComputeBuffer(15, sizeof(int) * 2); - m_CustomPassColorBuffer = new Lazy(() => RTHandles.Alloc(Vector2.one, TextureXR.slices, dimension: TextureXR.dimension, colorFormat: GetCustomBufferFormat(), enableRandomWrite: true, useDynamicScale: true, name: "CustomPassColorBuffer")); - m_CustomPassDepthBuffer = new Lazy(() => RTHandles.Alloc(Vector2.one, TextureXR.slices, dimension: TextureXR.dimension, colorFormat: GraphicsFormat.R32_UInt, useDynamicScale: true, name: "CustomPassDepthBuffer", depthBufferBits: DepthBits.Depth32)); + AllocateCustomPassBuffers(); // For debugging MousePositionDebug.instance.Build(); @@ -2034,6 +2033,14 @@ protected override void Render(ScriptableRenderContext renderContext, Camera[] c // so will present rendering at native resolution. This will only pay a small cost of memory on the texture aliasing that the runtime has to keep track of. RTHandles.SetHardwareDynamicResolutionState(m_Asset.currentPlatformRenderPipelineSettings.dynamicResolutionSettings.dynResType == DynamicResolutionType.Hardware); + // This is to ensure that custom pass buffers have the adequate depth/number of slices when switching from XR enabled/disabled + if (m_CustomPassColorBuffer.Value.rt.volumeDepth != TextureXR.slices) + { + RTHandles.Release(m_CustomPassColorBuffer.Value); + RTHandles.Release(m_CustomPassDepthBuffer.Value); + AllocateCustomPassBuffers(); + } + // Culling loop foreach ((Camera camera, XRPass xrPass) in xrLayout.GetActivePasses()) { @@ -2953,5 +2960,11 @@ static void AdjustUIOverlayOwnership(int cameraCount) SupportedRenderingFeatures.active.rendersUIOverlay = true; } } + + void AllocateCustomPassBuffers() + { + m_CustomPassColorBuffer = new Lazy(() => RTHandles.Alloc(Vector2.one, TextureXR.slices, dimension: TextureXR.dimension, colorFormat: GetCustomBufferFormat(), enableRandomWrite: true, useDynamicScale: true, name: "CustomPassColorBuffer")); + m_CustomPassDepthBuffer = new Lazy(() => RTHandles.Alloc(Vector2.one, TextureXR.slices, dimension: TextureXR.dimension, colorFormat: GraphicsFormat.R32_UInt, useDynamicScale: true, name: "CustomPassDepthBuffer", depthBufferBits: DepthBits.Depth32)); + } } }