From 9af35e67b90d6f110e1f68c4fe89dc0e4ee1c48d Mon Sep 17 00:00:00 2001 From: anisunity Date: Mon, 24 Jan 2022 18:42:12 +0100 Subject: [PATCH] Fixed errors spamming when in player mode due to ray tracing light cluster debug view (case 1390471). --- com.unity.render-pipelines.high-definition/CHANGELOG.md | 1 + .../RenderPipeline/Raytracing/HDRaytracingLightCluster.cs | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 9dc28ed40a0..07ebc9a5f6c 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -67,6 +67,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed an issue where APV cells were not populated properly when probe volumes have rotations - Fixed issue where changes to APV baking set lists were not saved. - Fixed Correlated Color Temperature not being applied in Player builds for Enlighten realtime GI lights (case 1370438); +- Fixed errors spamming when in player mode due to ray tracing light cluster debug view (case 1390471). ## [14.0.0] - 2021-11-17 diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingLightCluster.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingLightCluster.cs index e4661374205..4b699c55d34 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingLightCluster.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingLightCluster.cs @@ -621,7 +621,7 @@ class LightClusterDebugPassData public int lightClusterDebugKernel; public Vector3 clusterCellSize; public Material debugMaterial; - public ComputeBuffer lightCluster; + public ComputeBufferHandle lightCluster; public ComputeShader lightClusterDebugCS; public TextureHandle depthStencilBuffer; @@ -631,6 +631,10 @@ class LightClusterDebugPassData public void EvaluateClusterDebugView(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle depthStencilBuffer, TextureHandle depthPyramid) { + // TODO: Investigate why this behavior causes a leak in player mode only. + if (FullScreenDebugMode.LightCluster != m_RenderPipeline.m_CurrentDebugDisplaySettings.data.fullScreenDebugMode) + return; + TextureHandle debugTexture; using (var builder = renderGraph.AddRenderPass("Debug Texture for the Light Cluster", out var passData, ProfilingSampler.Get(HDProfileId.RaytracingDebugCluster))) { @@ -639,7 +643,7 @@ public void EvaluateClusterDebugView(RenderGraph renderGraph, HDCamera hdCamera, passData.texWidth = hdCamera.actualWidth; passData.texHeight = hdCamera.actualHeight; passData.clusterCellSize = clusterCellSize; - passData.lightCluster = m_LightCluster; + passData.lightCluster = builder.ReadComputeBuffer(renderGraph.ImportComputeBuffer(m_LightCluster)); passData.lightClusterDebugCS = m_RenderPipelineRayTracingResources.lightClusterDebugCS; passData.lightClusterDebugKernel = passData.lightClusterDebugCS.FindKernel("DebugLightCluster"); passData.debugMaterial = m_DebugMaterial;