diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index a58c30696d0..5a621064ebe 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -416,6 +416,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed wrong ordering in FrameSettings (Normalize Reflection Probes) - Fixed ThreadMapDetail to saturate AO & smoothness strength inputs to prevent out-of-bounds values set by users (1357740) - Allow negative wind speed parameter. +- Fixed custom pass custom buffer not bound after being created inside a custom pass. ### Changed - Changed Window/Render Pipeline/HD Render Pipeline Wizard to Window/Rendering/HDRP Wizard diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Prepass.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Prepass.cs index 84547342e92..6e1574fcff3 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Prepass.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Prepass.cs @@ -219,9 +219,6 @@ PrepassOutput RenderPrepass(RenderGraph renderGraph, using (new XRSinglePassScope(renderGraph, hdCamera)) { - // Bind the custom color/depth before the first custom pass - BindCustomPassBuffers(renderGraph, hdCamera); - RenderCustomPass(renderGraph, hdCamera, colorBuffer, result, customPassCullingResults, cullingResults, CustomPassInjectionPoint.BeforeRendering, aovRequest, aovBuffers); RenderRayTracingDepthPrepass(renderGraph, cullingResults, hdCamera, result.depthBuffer); diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs index 7cdadf307d4..ae1b267621a 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs @@ -1850,33 +1850,6 @@ void ResetCameraSizeForAfterPostProcess(RenderGraph renderGraph, HDCamera hdCame } } - class BindCustomPassBuffersPassData - { - public Lazy customColorTexture; - public Lazy customDepthTexture; - } - - void BindCustomPassBuffers(RenderGraph renderGraph, HDCamera hdCamera) - { - if (hdCamera.frameSettings.IsEnabled(FrameSettingsField.CustomPass)) - { - using (var builder = renderGraph.AddRenderPass("Bind Custom Pass Buffers", out var passData)) - { - passData.customColorTexture = m_CustomPassColorBuffer; - passData.customDepthTexture = m_CustomPassDepthBuffer; - - builder.SetRenderFunc( - (BindCustomPassBuffersPassData data, RenderGraphContext ctx) => - { - if (data.customColorTexture.IsValueCreated) - ctx.cmd.SetGlobalTexture(HDShaderIDs._CustomColorTexture, data.customColorTexture.Value); - if (data.customDepthTexture.IsValueCreated) - ctx.cmd.SetGlobalTexture(HDShaderIDs._CustomDepthTexture, data.customDepthTexture.Value); - }); - } - } - } - #if UNITY_EDITOR class RenderWireOverlayPassData { diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPass.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPass.cs index 8e32356e07b..0c5ba5d7b8a 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPass.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPass.cs @@ -234,6 +234,11 @@ internal void ExecuteInternal(RenderGraph renderGraph, HDCamera hdCamera, Cullin if (customPass.currentRenderTarget.normalBufferRG.IsValid() && customPass.injectionPoint != CustomPassInjectionPoint.AfterPostProcess) ctx.cmd.SetGlobalTexture(HDShaderIDs._NormalBufferTexture, customPass.currentRenderTarget.normalBufferRG); + if (customPass.currentRenderTarget.customColorBuffer.IsValueCreated) + ctx.cmd.SetGlobalTexture(HDShaderIDs._CustomColorTexture, customPass.currentRenderTarget.customColorBuffer.Value); + if (customPass.currentRenderTarget.customDepthBuffer.IsValueCreated) + ctx.cmd.SetGlobalTexture(HDShaderIDs._CustomDepthTexture, customPass.currentRenderTarget.customDepthBuffer.Value); + if (!customPass.isSetup) { customPass.Setup(ctx.renderContext, ctx.cmd);