diff --git a/com.unity.render-pipelines.universal/CHANGELOG.md b/com.unity.render-pipelines.universal/CHANGELOG.md
index d96a46ab5f9..1916cee597f 100644
--- a/com.unity.render-pipelines.universal/CHANGELOG.md
+++ b/com.unity.render-pipelines.universal/CHANGELOG.md
@@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [12.1.1] - 2021-10-04
+### Added
+- Added Adaptive Performance Decals scaler access.
+
### Fixed
- Fixed a regression bug where XR camera postion can not be modified in beginCameraRendering [case 1365000]
- Fix for rendering thumbnails. [case 1348209](https://issuetracker.unity3d.com/issues/preview-of-assets-do-not-show-in-the-project-window)
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 7dd94364e29..b376e27e410 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;
@@ -406,6 +407,8 @@ public override void OnCameraPreCull(ScriptableRenderer renderer, in CameraData
RecreateSystemsIfNeeded(renderer, cameraData);
+ ChangeAdaptivePerformanceDrawDistances();
+
m_DecalEntityManager.Update();
@@ -443,6 +446,8 @@ public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingD
RecreateSystemsIfNeeded(renderer, renderingData.cameraData);
+ ChangeAdaptivePerformanceDrawDistances();
+
if (intermediateRendering)
{
m_DecalUpdateCulledSystem.Execute();
@@ -494,5 +499,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",