Skip to content

Fixed a null ref exception when no opaque objects are rendered. #5463

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed lens flare not rendering correctly with TAAU or DLSS.
- Fixed case where the SceneView don't refresh when using LightExplorer with a running and Paused game (1354129)
- Fixed wrong ordering in FrameSettings (Normalize Reflection Probes)
- Fixed a null ref exception when no opaque objects are rendered.

### Changed
- Changed Window/Render Pipeline/HD Render Pipeline Wizard to Window/Rendering/HDRP Wizard
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -537,11 +537,16 @@ void SetFinalTarget(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle de
using (new ProfilingScope(ctx.cmd, ProfilingSampler.Get(HDProfileId.CopyDepthInTargetTexture)))
{
var mpb = ctx.renderGraphPool.GetTempMaterialPropertyBlock();
mpb.SetTexture(HDShaderIDs._InputDepth, data.depthBuffer);
// When we are Main Game View we need to flip the depth buffer ourselves as we are after postprocess / blit that have already flipped the screen
mpb.SetInt("_FlipY", data.flipY ? 1 : 0);
mpb.SetVector(HDShaderIDs._BlitScaleBias, new Vector4(1.0f, 1.0f, 0.0f, 0.0f));
CoreUtils.DrawFullScreen(ctx.cmd, data.copyDepthMaterial, mpb);
RTHandle depth = data.depthBuffer;
// Depth buffer can be invalid if no opaque has been rendered before.
if (depth != null)
{
mpb.SetTexture(HDShaderIDs._InputDepth, depth);
// When we are Main Game View we need to flip the depth buffer ourselves as we are after postprocess / blit that have already flipped the screen
mpb.SetInt("_FlipY", data.flipY ? 1 : 0);
mpb.SetVector(HDShaderIDs._BlitScaleBias, new Vector4(1.0f, 1.0f, 0.0f, 0.0f));
CoreUtils.DrawFullScreen(ctx.cmd, data.copyDepthMaterial, mpb);
}
}
}
});
Expand Down