From 1c324a1550cd18874c4b2ffe44e7d0a8eda99f2c Mon Sep 17 00:00:00 2001 From: Lukas Chodosevicius Date: Wed, 6 May 2020 13:20:01 +0300 Subject: [PATCH 1/6] Adding adaptive performance as optional dependency --- ...y.RenderPipelines.Universal.Runtime.asmdef | 8 +- .../Runtime/UniversalRenderPipeline.cs | 76 +++++++++++++++++++ 2 files changed, 83 insertions(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.universal/Runtime/Unity.RenderPipelines.Universal.Runtime.asmdef b/com.unity.render-pipelines.universal/Runtime/Unity.RenderPipelines.Universal.Runtime.asmdef index 7fe353ecef5..99490521b02 100644 --- a/com.unity.render-pipelines.universal/Runtime/Unity.RenderPipelines.Universal.Runtime.asmdef +++ b/com.unity.render-pipelines.universal/Runtime/Unity.RenderPipelines.Universal.Runtime.asmdef @@ -3,7 +3,8 @@ "references": [ "GUID:d60799ab2a985554ea1a39cd38695018", "GUID:df380645f10b7bc4b97d4f5eb6303d95", - "GUID:ab67fb10353d84448ac887a7367cbda8" + "GUID:ab67fb10353d84448ac887a7367cbda8", + "GUID:7dbf32976982c98448af054f2512cb79" ], "includePlatforms": [], "excludePlatforms": [], @@ -23,6 +24,11 @@ "expression": "0.0.1", "define": "VISUAL_EFFECT_GRAPH_0_0_1_OR_NEWER" }, + { + "name": "com.unity.adaptiveperformance", + "expression": "2.1.0-preview.1", + "define": "ADAPTIVE_PERFORMANCE_2_1_0_OR_NEWER" + }, { "name": "com.unity.modules.vr", "expression": "1.0.0", diff --git a/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs b/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs index 25c59299670..7da1418b99e 100644 --- a/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs +++ b/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs @@ -227,6 +227,9 @@ public static void RenderSingleCamera(ScriptableRenderContext context, Camera ca } InitializeCameraData(camera, additionalCameraData, true, out var cameraData); +#if ADAPTIVE_PERFORMANCE_2_1_0_OR_NEWER + ApplyAdaptivePerformance(ref cameraData); +#endif RenderSingleCamera(context, cameraData, cameraData.postProcessEnabled); } @@ -273,6 +276,10 @@ static void RenderSingleCamera(ScriptableRenderContext context, CameraData camer var cullResults = context.Cull(ref cullingParameters); InitializeRenderingData(asset, ref cameraData, ref cullResults, anyPostProcessingEnabled, out var renderingData); +#if ADAPTIVE_PERFORMANCE_2_1_0_OR_NEWER + ApplyAdaptivePerformance(ref renderingData); +#endif + renderer.Setup(context, ref renderingData); renderer.Execute(context, ref renderingData); } @@ -374,6 +381,9 @@ static void RenderCameraStack(ScriptableRenderContext context, Camera baseCamera #endif UpdateVolumeFramework(baseCamera, baseCameraAdditionalData); InitializeCameraData(baseCamera, baseCameraAdditionalData, !isStackedRendering, out var baseCameraData); +#if ADAPTIVE_PERFORMANCE_2_1_0_OR_NEWER + ApplyAdaptivePerformance(ref baseCameraData); +#endif RenderSingleCamera(context, baseCameraData, anyPostProcessingEnabled); EndCameraRendering(context, baseCamera); @@ -922,5 +932,71 @@ static void SetupPerFrameShaderConstants() // Used when subtractive mode is selected Shader.SetGlobalVector(PerFrameBuffer._SubtractiveShadowColor, CoreUtils.ConvertSRGBToActiveColorSpace(RenderSettings.subtractiveShadowColor)); } + +#if ADAPTIVE_PERFORMANCE_2_1_0_OR_NEWER + static void ApplyAdaptivePerformance(ref CameraData cameraData) + { + var noFrontToBackOpaqueFlags = SortingCriteria.SortingLayer | SortingCriteria.RenderQueue | SortingCriteria.OptimizeStateChanges | SortingCriteria.CanvasOrder; + if (AdaptivePerformance.AdaptivePerformanceRenderSettings.SkipFrontToBackSorting) + cameraData.defaultOpaqueSortFlags = noFrontToBackOpaqueFlags; + + var MaxShadowDistanceMultiplier = AdaptivePerformance.AdaptivePerformanceRenderSettings.MaxShadowDistanceMultiplier; + cameraData.maxShadowDistance *= MaxShadowDistanceMultiplier; + + var RenderScaleMultiplier = AdaptivePerformance.AdaptivePerformanceRenderSettings.RenderScaleMultiplier; + cameraData.renderScale *= RenderScaleMultiplier; + + // TODO + if (!cameraData.isStereoEnabled) + { + cameraData.cameraTargetDescriptor.width = (int)(cameraData.camera.pixelWidth * cameraData.renderScale); + cameraData.cameraTargetDescriptor.height = (int)(cameraData.camera.pixelHeight * cameraData.renderScale); + } + + var antialiasingQualityIndex = (int)cameraData.antialiasingQuality - AdaptivePerformance.AdaptivePerformanceRenderSettings.AntiAliasingQualityBias; + if (antialiasingQualityIndex < 0) + cameraData.antialiasing = AntialiasingMode.None; + cameraData.antialiasingQuality = (AntialiasingQuality)Mathf.Clamp(antialiasingQualityIndex, (int)AntialiasingQuality.Low, (int)AntialiasingQuality.High); + } + static void ApplyAdaptivePerformance(ref RenderingData renderingData) + { + if (AdaptivePerformance.AdaptivePerformanceRenderSettings.SkipDynamicBatching) + renderingData.supportsDynamicBatching = false; + + var MainLightShadowmapResultionMultiplier = AdaptivePerformance.AdaptivePerformanceRenderSettings.MainLightShadowmapResultionMultiplier; + renderingData.shadowData.mainLightShadowmapWidth = (int)(renderingData.shadowData.mainLightShadowmapWidth * MainLightShadowmapResultionMultiplier); + renderingData.shadowData.mainLightShadowmapHeight = (int)(renderingData.shadowData.mainLightShadowmapHeight * MainLightShadowmapResultionMultiplier); + + var MainLightShadowCascadesCountBias = AdaptivePerformance.AdaptivePerformanceRenderSettings.MainLightShadowCascadesCountBias; + renderingData.shadowData.mainLightShadowCascadesCount = Mathf.Clamp(renderingData.shadowData.mainLightShadowCascadesCount - MainLightShadowCascadesCountBias, 0, 4); + + var shadowQualityIndex = AdaptivePerformance.AdaptivePerformanceRenderSettings.ShadowQualityBias; + for (int i = 0; i < shadowQualityIndex; i++) + { + if (renderingData.shadowData.supportsSoftShadows) + { + renderingData.shadowData.supportsSoftShadows = false; + continue; + } + + if (renderingData.shadowData.supportsAdditionalLightShadows) + { + renderingData.shadowData.supportsAdditionalLightShadows = false; + continue; + } + + if (renderingData.shadowData.supportsMainLightShadows) + { + renderingData.shadowData.supportsMainLightShadows = false; + continue; + } + + break; + } + + if (AdaptivePerformance.AdaptivePerformanceRenderSettings.LutBias >= 1 && renderingData.postProcessingData.lutSize == 32) + renderingData.postProcessingData.lutSize = 16; + } +#endif } } From 06d3c347f6f845edb9d2b707f65c1260527a35c8 Mon Sep 17 00:00:00 2001 From: Ricardas Jonaitis Date: Fri, 15 May 2020 17:34:23 +0300 Subject: [PATCH 2/6] Fix adaptive performance version and defines --- .../Unity.RenderPipelines.Universal.Runtime.asmdef | 4 ++-- .../Runtime/UniversalRenderPipeline.cs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/com.unity.render-pipelines.universal/Runtime/Unity.RenderPipelines.Universal.Runtime.asmdef b/com.unity.render-pipelines.universal/Runtime/Unity.RenderPipelines.Universal.Runtime.asmdef index 99490521b02..0654e06edf2 100644 --- a/com.unity.render-pipelines.universal/Runtime/Unity.RenderPipelines.Universal.Runtime.asmdef +++ b/com.unity.render-pipelines.universal/Runtime/Unity.RenderPipelines.Universal.Runtime.asmdef @@ -26,8 +26,8 @@ }, { "name": "com.unity.adaptiveperformance", - "expression": "2.1.0-preview.1", - "define": "ADAPTIVE_PERFORMANCE_2_1_0_OR_NEWER" + "expression": "2.0.0-preview.7", + "define": "ADAPTIVE_PERFORMANCE_2_0_0_OR_NEWER" }, { "name": "com.unity.modules.vr", diff --git a/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs b/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs index 7da1418b99e..9c7836c8c06 100644 --- a/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs +++ b/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs @@ -227,7 +227,7 @@ public static void RenderSingleCamera(ScriptableRenderContext context, Camera ca } InitializeCameraData(camera, additionalCameraData, true, out var cameraData); -#if ADAPTIVE_PERFORMANCE_2_1_0_OR_NEWER +#if ADAPTIVE_PERFORMANCE_2_0_0_OR_NEWER ApplyAdaptivePerformance(ref cameraData); #endif RenderSingleCamera(context, cameraData, cameraData.postProcessEnabled); @@ -276,7 +276,7 @@ static void RenderSingleCamera(ScriptableRenderContext context, CameraData camer var cullResults = context.Cull(ref cullingParameters); InitializeRenderingData(asset, ref cameraData, ref cullResults, anyPostProcessingEnabled, out var renderingData); -#if ADAPTIVE_PERFORMANCE_2_1_0_OR_NEWER +#if ADAPTIVE_PERFORMANCE_2_0_0_OR_NEWER ApplyAdaptivePerformance(ref renderingData); #endif @@ -381,7 +381,7 @@ static void RenderCameraStack(ScriptableRenderContext context, Camera baseCamera #endif UpdateVolumeFramework(baseCamera, baseCameraAdditionalData); InitializeCameraData(baseCamera, baseCameraAdditionalData, !isStackedRendering, out var baseCameraData); -#if ADAPTIVE_PERFORMANCE_2_1_0_OR_NEWER +#if ADAPTIVE_PERFORMANCE_2_0_0_OR_NEWER ApplyAdaptivePerformance(ref baseCameraData); #endif RenderSingleCamera(context, baseCameraData, anyPostProcessingEnabled); @@ -933,7 +933,7 @@ static void SetupPerFrameShaderConstants() Shader.SetGlobalVector(PerFrameBuffer._SubtractiveShadowColor, CoreUtils.ConvertSRGBToActiveColorSpace(RenderSettings.subtractiveShadowColor)); } -#if ADAPTIVE_PERFORMANCE_2_1_0_OR_NEWER +#if ADAPTIVE_PERFORMANCE_2_0_0_OR_NEWER static void ApplyAdaptivePerformance(ref CameraData cameraData) { var noFrontToBackOpaqueFlags = SortingCriteria.SortingLayer | SortingCriteria.RenderQueue | SortingCriteria.OptimizeStateChanges | SortingCriteria.CanvasOrder; From a5ff2522482a4bb603e834f81b12f013c7c0a7f8 Mon Sep 17 00:00:00 2001 From: Ricardas Jonaitis Date: Fri, 15 May 2020 15:24:16 +0300 Subject: [PATCH 3/6] Add enable flag for adaptive performance in URP asset --- ...ty.RenderPipelines.Universal.Editor.asmdef | 5 ++++ .../UniversalRenderPipelineAssetEditor.cs | 27 +++++++++++++++++++ .../Data/UniversalRenderPipelineAsset.cs | 9 +++++++ .../Runtime/UniversalRenderPipeline.cs | 9 ++++--- 4 files changed, 47 insertions(+), 3 deletions(-) diff --git a/com.unity.render-pipelines.universal/Editor/Unity.RenderPipelines.Universal.Editor.asmdef b/com.unity.render-pipelines.universal/Editor/Unity.RenderPipelines.Universal.Editor.asmdef index d8b54213ce9..e720fbf5339 100644 --- a/com.unity.render-pipelines.universal/Editor/Unity.RenderPipelines.Universal.Editor.asmdef +++ b/com.unity.render-pipelines.universal/Editor/Unity.RenderPipelines.Universal.Editor.asmdef @@ -22,6 +22,11 @@ "name": "com.unity.postprocessing", "expression": "2.0.0", "define": "POST_PROCESSING_STACK_2_0_0_OR_NEWER" + }, + { + "name": "com.unity.adaptiveperformance", + "expression": "2.0.0-preview.7", + "define": "ADAPTIVE_PERFORMANCE_2_0_0_OR_NEWER" } ] } diff --git a/com.unity.render-pipelines.universal/Editor/UniversalRenderPipelineAssetEditor.cs b/com.unity.render-pipelines.universal/Editor/UniversalRenderPipelineAssetEditor.cs index db0ef1ebcfd..92fda58676a 100644 --- a/com.unity.render-pipelines.universal/Editor/UniversalRenderPipelineAssetEditor.cs +++ b/com.unity.render-pipelines.universal/Editor/UniversalRenderPipelineAssetEditor.cs @@ -18,6 +18,7 @@ internal class Styles public static GUIContent shadowSettingsText = EditorGUIUtility.TrTextContent("Shadows"); public static GUIContent postProcessingSettingsText = EditorGUIUtility.TrTextContent("Post-processing"); public static GUIContent advancedSettingsText = EditorGUIUtility.TrTextContent("Advanced"); + public static GUIContent adaptivePerformanceText = EditorGUIUtility.TrTextContent("Adaptive Performance"); // General public static GUIContent rendererHeaderText = EditorGUIUtility.TrTextContent("Renderer List", "Lists all the renderers available to this Render Pipeline Asset."); @@ -71,6 +72,9 @@ internal class Styles public static GUIContent debugLevel = EditorGUIUtility.TrTextContent("Debug Level", "Controls the level of debug information generated by the render pipeline. When Profiling is selected, the pipeline provides detailed profiling tags."); public static GUIContent shaderVariantLogLevel = EditorGUIUtility.TrTextContent("Shader Variant Log Level", "Controls the level logging in of shader variants information is outputted when a build is performed. Information will appear in the Unity console when the build finishes."); + // Adaptive performance settings + public static GUIContent useAdaptivePerformance = EditorGUIUtility.TrTextContent("Use adaptive performance", "Allows Adaptive Performance to adjust rendering quality during runtime"); + // Renderer List Messages public static GUIContent rendererListDefaultMessage = EditorGUIUtility.TrTextContent("Cannot remove Default Renderer", @@ -93,6 +97,7 @@ internal class Styles SavedBool m_ShadowSettingsFoldout; SavedBool m_PostProcessingSettingsFoldout; SavedBool m_AdvancedSettingsFoldout; + SavedBool m_AdaptivePerformanceFoldout; SerializedProperty m_RendererDataProp; SerializedProperty m_DefaultRendererProp; @@ -137,6 +142,8 @@ internal class Styles SerializedProperty m_ColorGradingMode; SerializedProperty m_ColorGradingLutSize; + SerializedProperty m_UseAdaptivePerformance; + public override void OnInspectorGUI() { serializedObject.Update(); @@ -147,6 +154,9 @@ public override void OnInspectorGUI() DrawShadowSettings(); DrawPostProcessingSettings(); DrawAdvancedSettings(); +#if ADAPTIVE_PERFORMANCE_2_0_0_OR_NEWER + DrawAdaptivePerformance(); +#endif serializedObject.ApplyModifiedProperties(); } @@ -159,6 +169,7 @@ void OnEnable() m_ShadowSettingsFoldout = new SavedBool($"{target.GetType()}.ShadowSettingsFoldout", false); m_PostProcessingSettingsFoldout = new SavedBool($"{target.GetType()}.PostProcessingSettingsFoldout", false); m_AdvancedSettingsFoldout = new SavedBool($"{target.GetType()}.AdvancedSettingsFoldout", false); + m_AdaptivePerformanceFoldout = new SavedBool($"{target.GetType()}.AdaptivePerformanceFoldout", false); m_RendererDataProp = serializedObject.FindProperty("m_RendererDataList"); m_DefaultRendererProp = serializedObject.FindProperty("m_DefaultRendererIndex"); @@ -203,6 +214,8 @@ void OnEnable() m_ColorGradingMode = serializedObject.FindProperty("m_ColorGradingMode"); m_ColorGradingLutSize = serializedObject.FindProperty("m_ColorGradingLutSize"); + m_UseAdaptivePerformance = serializedObject.FindProperty("m_UseAdaptivePerformance"); + selectedLightRenderingMode = (LightRenderingMode)m_AdditionalLightsRenderingModeProp.intValue; } @@ -401,6 +414,20 @@ void DrawAdvancedSettings() EditorGUILayout.EndFoldoutHeaderGroup(); } + void DrawAdaptivePerformance() + { + m_AdaptivePerformanceFoldout.value = EditorGUILayout.BeginFoldoutHeaderGroup(m_AdaptivePerformanceFoldout.value, Styles.adaptivePerformanceText); + if (m_AdaptivePerformanceFoldout.value) + { + EditorGUI.indentLevel++; + EditorGUILayout.PropertyField(m_UseAdaptivePerformance, Styles.useAdaptivePerformance); + EditorGUI.indentLevel--; + EditorGUILayout.Space(); + EditorGUILayout.Space(); + } + EditorGUILayout.EndFoldoutHeaderGroup(); + } + void DrawRendererListLayout(ReorderableList list, SerializedProperty prop) { list.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => diff --git a/com.unity.render-pipelines.universal/Runtime/Data/UniversalRenderPipelineAsset.cs b/com.unity.render-pipelines.universal/Runtime/Data/UniversalRenderPipelineAsset.cs index 3473cb95cb5..9b650187a6e 100644 --- a/com.unity.render-pipelines.universal/Runtime/Data/UniversalRenderPipelineAsset.cs +++ b/com.unity.render-pipelines.universal/Runtime/Data/UniversalRenderPipelineAsset.cs @@ -189,6 +189,9 @@ public class UniversalRenderPipelineAsset : RenderPipelineAsset, ISerializationC [SerializeField] bool m_MixedLightingSupported = true; [SerializeField] PipelineDebugLevel m_DebugLevel = PipelineDebugLevel.Disabled; + // Adaptive performance settings + [SerializeField] bool m_UseAdaptivePerformance = false; + // Post-processing settings #pragma warning disable 414 // 'field' is assigned but never used [SerializeField] PostProcessingFeatureSet m_PostProcessingFeatureSet = PostProcessingFeatureSet.Integrated; @@ -686,6 +689,12 @@ public int colorGradingLutSize set { m_ColorGradingLutSize = Mathf.Clamp(value, k_MinLutSize, k_MaxLutSize); } } + public bool useAdaptivePerformance + { + get { return m_UseAdaptivePerformance; } + set { m_UseAdaptivePerformance = value; } + } + public override Material defaultMaterial { get { return GetMaterial(DefaultMaterialType.Standard); } diff --git a/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs b/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs index 9c7836c8c06..88e9086113f 100644 --- a/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs +++ b/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs @@ -228,7 +228,8 @@ public static void RenderSingleCamera(ScriptableRenderContext context, Camera ca InitializeCameraData(camera, additionalCameraData, true, out var cameraData); #if ADAPTIVE_PERFORMANCE_2_0_0_OR_NEWER - ApplyAdaptivePerformance(ref cameraData); + if (asset.useAdaptivePerformance) + ApplyAdaptivePerformance(ref cameraData); #endif RenderSingleCamera(context, cameraData, cameraData.postProcessEnabled); } @@ -277,7 +278,8 @@ static void RenderSingleCamera(ScriptableRenderContext context, CameraData camer InitializeRenderingData(asset, ref cameraData, ref cullResults, anyPostProcessingEnabled, out var renderingData); #if ADAPTIVE_PERFORMANCE_2_0_0_OR_NEWER - ApplyAdaptivePerformance(ref renderingData); + if (asset.useAdaptivePerformance) + ApplyAdaptivePerformance(ref renderingData); #endif renderer.Setup(context, ref renderingData); @@ -382,7 +384,8 @@ static void RenderCameraStack(ScriptableRenderContext context, Camera baseCamera UpdateVolumeFramework(baseCamera, baseCameraAdditionalData); InitializeCameraData(baseCamera, baseCameraAdditionalData, !isStackedRendering, out var baseCameraData); #if ADAPTIVE_PERFORMANCE_2_0_0_OR_NEWER - ApplyAdaptivePerformance(ref baseCameraData); + if (asset.useAdaptivePerformance) + ApplyAdaptivePerformance(ref baseCameraData); #endif RenderSingleCamera(context, baseCameraData, anyPostProcessingEnabled); EndCameraRendering(context, baseCamera); From 355088409905e6ec34f452386be5e6fa500fafae Mon Sep 17 00:00:00 2001 From: Ricardas Jonaitis Date: Wed, 27 May 2020 19:12:14 +0300 Subject: [PATCH 4/6] Add adaptive performance documentation --- .../Documentation~/universalrp-asset.md | 11 +++++++++++ .../Runtime/Data/UniversalRenderPipelineAsset.cs | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/com.unity.render-pipelines.universal/Documentation~/universalrp-asset.md b/com.unity.render-pipelines.universal/Documentation~/universalrp-asset.md index f103ceb00fc..ace83b69545 100644 --- a/com.unity.render-pipelines.universal/Documentation~/universalrp-asset.md +++ b/com.unity.render-pipelines.universal/Documentation~/universalrp-asset.md @@ -16,6 +16,7 @@ In the URP, you can configure settings for: - [__Shadows__](#shadows) - [__Post-processing__](#post-processing) - [__Advanced__](#advanced) +- [__Adaptive Performance__](#adaptive-performance) @@ -99,3 +100,13 @@ This section allows you to fine-tune less commonly changed settings, which impac | __Mixed Lighting__ | Enable [Mixed Lighting](https://docs.unity3d.com/Manual/LightMode-Mixed.html), to tell the pipeline to include mixed lighting shader variants in the build. | | __Debug Level__ | Set the level of debug information that the render pipeline generates. The values are:
**Disabled**: Debugging is disabled. This is the default.
**Profiling**: Makes the render pipeline provide detailed information tags, which you can see in the FrameDebugger. | | __Shader Variant Log Level__ | Set the level of information about Shader Stripping and Shader Variants you want to display when Unity finishes a build. Values are:
**Disabled**: Unity doesn’t log anything.
**Only Universal**: Unity logs information for all of the [URP Shaders](shaders-in-universalrp.md).
**All**: Unity logs information for all Shaders in your build.
You can see the information in Console panel when your build has finished. | + + + +### Adaptive Performance + +This section appears if Adaptive Performance package is installed. It allows to change settings how Adaptive performance and render pipeline interact. + +| __Property__ | __Description__ | +| ----------------------- | ------------------------------------------------------------ | +| __Use adaptive performance__ | Allows Adaptive Performance to adjust rendering quality during runtime. | \ No newline at end of file diff --git a/com.unity.render-pipelines.universal/Runtime/Data/UniversalRenderPipelineAsset.cs b/com.unity.render-pipelines.universal/Runtime/Data/UniversalRenderPipelineAsset.cs index 9b650187a6e..9c881119ea0 100644 --- a/com.unity.render-pipelines.universal/Runtime/Data/UniversalRenderPipelineAsset.cs +++ b/com.unity.render-pipelines.universal/Runtime/Data/UniversalRenderPipelineAsset.cs @@ -689,6 +689,10 @@ public int colorGradingLutSize set { m_ColorGradingLutSize = Mathf.Clamp(value, k_MinLutSize, k_MaxLutSize); } } + /// + /// Set to true to allow Adaptive performance to modify graphics quality settings during runtime. + /// Only applicable when Adaptive performance package is available. + /// public bool useAdaptivePerformance { get { return m_UseAdaptivePerformance; } From 436a6f7682d6e351e6e73bd2e5b91aef5896a01d Mon Sep 17 00:00:00 2001 From: Ricardas Jonaitis Date: Thu, 28 May 2020 19:31:56 +0300 Subject: [PATCH 5/6] Update changelog.md --- com.unity.render-pipelines.universal/CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/com.unity.render-pipelines.universal/CHANGELOG.md b/com.unity.render-pipelines.universal/CHANGELOG.md index d6d69cfb318..a17fa8ede74 100644 --- a/com.unity.render-pipelines.universal/CHANGELOG.md +++ b/com.unity.render-pipelines.universal/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this package will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Added +- Added option to enable/disable Adaptive Performance when it's package is available. + ## [7.4.0] - 2020-05-22 ### Added From 2f37207f7fcd5644c367a1708814c61df06933bf Mon Sep 17 00:00:00 2001 From: Ricardas Jonaitis Date: Fri, 29 May 2020 17:02:50 +0300 Subject: [PATCH 6/6] Fix spelling error --- .../Runtime/UniversalRenderPipeline.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs b/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs index b7297a89157..a8d8cdcb2c2 100644 --- a/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs +++ b/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs @@ -967,9 +967,9 @@ static void ApplyAdaptivePerformance(ref RenderingData renderingData) if (AdaptivePerformance.AdaptivePerformanceRenderSettings.SkipDynamicBatching) renderingData.supportsDynamicBatching = false; - var MainLightShadowmapResultionMultiplier = AdaptivePerformance.AdaptivePerformanceRenderSettings.MainLightShadowmapResultionMultiplier; - renderingData.shadowData.mainLightShadowmapWidth = (int)(renderingData.shadowData.mainLightShadowmapWidth * MainLightShadowmapResultionMultiplier); - renderingData.shadowData.mainLightShadowmapHeight = (int)(renderingData.shadowData.mainLightShadowmapHeight * MainLightShadowmapResultionMultiplier); + var MainLightShadowmapResolutionMultiplier = AdaptivePerformance.AdaptivePerformanceRenderSettings.MainLightShadowmapResolutionMultiplier; + renderingData.shadowData.mainLightShadowmapWidth = (int)(renderingData.shadowData.mainLightShadowmapWidth * MainLightShadowmapResolutionMultiplier); + renderingData.shadowData.mainLightShadowmapHeight = (int)(renderingData.shadowData.mainLightShadowmapHeight * MainLightShadowmapResolutionMultiplier); var MainLightShadowCascadesCountBias = AdaptivePerformance.AdaptivePerformanceRenderSettings.MainLightShadowCascadesCountBias; renderingData.shadowData.mainLightShadowCascadesCount = Mathf.Clamp(renderingData.shadowData.mainLightShadowCascadesCount - MainLightShadowCascadesCountBias, 0, 4);