From 0113945c892d60b729eaa8a1e923f9e8970b7963 Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Thu, 12 Nov 2020 13:48:45 +0100 Subject: [PATCH] Fixed useless editor repaint when using lod bias --- com.unity.render-pipelines.high-definition/CHANGELOG.md | 1 + .../Runtime/RenderPipeline/HDRenderPipeline.cs | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index c91b6526b68..fd5bb435bb1 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -99,6 +99,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed picking for materials with depth offset. - Fixed issue with exposure history being uninitialized on second frame. - Fixed issue when changing FoV with the physical camera fold-out closed. +- Fixed useless editor repaint when using lod bias. ### Changed - Combined occlusion meshes into one to reduce draw calls and state changes with XR single-pass. diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs index f7ad7baf6f3..500f03e1b97 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs @@ -3332,8 +3332,13 @@ ref HDCullingResults cullingResults var initialMaximumLODLevel = QualitySettings.maximumLODLevel; try { +#if UNITY_2021_1_OR_NEWER + // Modifying the variables this way does not set the dirty flag, which avoids repainting all views + QualitySettings.SetLODSettings(hdCamera.frameSettings.GetResolvedLODBias(hdrp), hdCamera.frameSettings.GetResolvedMaximumLODLevel(hdrp), false); +#else QualitySettings.lodBias = hdCamera.frameSettings.GetResolvedLODBias(hdrp); QualitySettings.maximumLODLevel = hdCamera.frameSettings.GetResolvedMaximumLODLevel(hdrp); +#endif // This needs to be called before culling, otherwise in the case where users generate intermediate renderers, it can provoke crashes. BeginCameraRendering(renderContext, camera); @@ -3397,8 +3402,12 @@ ref HDCullingResults cullingResults } finally { +#if UNITY_2021_1_OR_NEWER + QualitySettings.SetLODSettings(initialLODBias, initialMaximumLODLevel, false); +#else QualitySettings.lodBias = initialLODBias; QualitySettings.maximumLODLevel = initialMaximumLODLevel; +#endif } }