diff --git a/com.unity.render-pipelines.universal/CHANGELOG.md b/com.unity.render-pipelines.universal/CHANGELOG.md
index 70b7aaf8fe3..19517dc201c 100644
--- a/com.unity.render-pipelines.universal/CHANGELOG.md
+++ b/com.unity.render-pipelines.universal/CHANGELOG.md
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Added Depth Texture setting for Overlay Camera.
- Added Depth Priming support for Vulkan with MSAA.
- Added Shadows and Additional Lights off variants stripping.
+- Added Adaptive Performance Decals scaler.
- Exposed public API for DebugDisplaySettings.
- Added Display Stats panel to Rendering Debugger that displays CPU/GPU frame timings and bottlenecks.
diff --git a/com.unity.render-pipelines.universal/Runtime/Decal/Entities/DecalCreateDrawCallSystem.cs b/com.unity.render-pipelines.universal/Runtime/Decal/Entities/DecalCreateDrawCallSystem.cs
index 90d6e6149d8..de7926bb2cd 100644
--- a/com.unity.render-pipelines.universal/Runtime/Decal/Entities/DecalCreateDrawCallSystem.cs
+++ b/com.unity.render-pipelines.universal/Runtime/Decal/Entities/DecalCreateDrawCallSystem.cs
@@ -63,6 +63,15 @@ internal class DecalCreateDrawCallSystem
private ProfilingSampler m_Sampler;
private float m_MaxDrawDistance;
+ ///
+ /// Provides acces to the maximum draw distance.
+ ///
+ public float maxDrawDistance
+ {
+ get { return m_MaxDrawDistance; }
+ set { m_MaxDrawDistance = value; }
+ }
+
public DecalCreateDrawCallSystem(DecalEntityManager entityManager, float maxDrawDistance)
{
m_EntityManager = entityManager;
diff --git a/com.unity.render-pipelines.universal/Runtime/Decal/Entities/DecalUpdateCullingGroupSystem.cs b/com.unity.render-pipelines.universal/Runtime/Decal/Entities/DecalUpdateCullingGroupSystem.cs
index 24e1610d3a4..67b5d5523e4 100644
--- a/com.unity.render-pipelines.universal/Runtime/Decal/Entities/DecalUpdateCullingGroupSystem.cs
+++ b/com.unity.render-pipelines.universal/Runtime/Decal/Entities/DecalUpdateCullingGroupSystem.cs
@@ -52,6 +52,15 @@ public override void Dispose()
///
internal class DecalUpdateCullingGroupSystem
{
+ ///
+ /// Provides acces to the bounding distance.
+ ///
+ public float boundingDistance
+ {
+ get { return m_BoundingDistance[0]; }
+ set { m_BoundingDistance[0] = value; }
+ }
+
private float[] m_BoundingDistance = new float[1];
private Camera m_Camera;
private DecalEntityManager m_EntityManager;
diff --git a/com.unity.render-pipelines.universal/Runtime/RendererFeatures/DecalRendererFeature.cs b/com.unity.render-pipelines.universal/Runtime/RendererFeatures/DecalRendererFeature.cs
index 2b6174b66a6..8d2ac09d780 100644
--- a/com.unity.render-pipelines.universal/Runtime/RendererFeatures/DecalRendererFeature.cs
+++ b/com.unity.render-pipelines.universal/Runtime/RendererFeatures/DecalRendererFeature.cs
@@ -1,3 +1,4 @@
+using System.Diagnostics;
using UnityEngine.Assertions;
using UnityEngine.Rendering.Universal.Internal;
@@ -409,6 +410,8 @@ public override void OnCameraPreCull(ScriptableRenderer renderer, in CameraData
RecreateSystemsIfNeeded(renderer, cameraData);
+ ChangeAdaptivePerformanceDrawDistances();
+
m_DecalEntityManager.Update();
@@ -446,6 +449,8 @@ public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingD
RecreateSystemsIfNeeded(renderer, renderingData.cameraData);
+ ChangeAdaptivePerformanceDrawDistances();
+
if (intermediateRendering)
{
m_DecalUpdateCulledSystem.Execute();
@@ -504,5 +509,23 @@ protected override void Dispose(bool disposing)
sharedDecalEntityManager.Release(m_DecalEntityManager);
}
}
+
+ [Conditional("ADAPTIVE_PERFORMANCE_4_0_0_OR_NEWER")]
+ private void ChangeAdaptivePerformanceDrawDistances()
+ {
+#if ADAPTIVE_PERFORMANCE_4_0_0_OR_NEWER
+ if (UniversalRenderPipeline.asset.useAdaptivePerformance)
+ {
+ if (m_DecalCreateDrawCallSystem != null)
+ {
+ m_DecalCreateDrawCallSystem.maxDrawDistance = AdaptivePerformance.AdaptivePerformanceRenderSettings.DecalsDrawDistance;
+ }
+ if (m_DecalUpdateCullingGroupSystem != null)
+ {
+ m_DecalUpdateCullingGroupSystem.boundingDistance = AdaptivePerformance.AdaptivePerformanceRenderSettings.DecalsDrawDistance;
+ }
+ }
+#endif
+ }
}
}
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 a9931382de3..ea8506cb533 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
@@ -31,6 +31,11 @@
"expression": "2.1.0",
"define": "ADAPTIVE_PERFORMANCE_2_1_0_OR_NEWER"
},
+ {
+ "name": "com.unity.adaptiveperformance",
+ "expression": "4.0.0-pre.1",
+ "define": "ADAPTIVE_PERFORMANCE_4_0_0_OR_NEWER"
+ },
{
"name": "com.unity.burst",
"expression": "1.0.0",