From 9dade33e17a34446ce087d78353dd0c7351dab1e Mon Sep 17 00:00:00 2001 From: Nico de Poel Date: Wed, 12 Jun 2024 09:55:51 +0200 Subject: [PATCH] Fixed nullref when Destroy gets called repeatedly --- .../RenderPass/Upscalers/FSR3/Fsr3UpscalerContext.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/Upscalers/FSR3/Fsr3UpscalerContext.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/Upscalers/FSR3/Fsr3UpscalerContext.cs index da02d9fa..2b6a6bdb 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/Upscalers/FSR3/Fsr3UpscalerContext.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/Upscalers/FSR3/Fsr3UpscalerContext.cs @@ -125,8 +125,11 @@ namespace FidelityFX DestroyConstantBuffer(ref _spdConstantsBuffer); DestroyConstantBuffer(ref _upscalerConstantsBuffer); - _commandBuffer.Dispose(); - _commandBuffer = null; + if (_commandBuffer != null) + { + _commandBuffer.Dispose(); + _commandBuffer = null; + } } public void Dispatch(Fsr3Upscaler.DispatchDescription dispatchParams)