Skip to content

Fix GBuffer depth debug mode #5054

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 1 commit into from
Jul 6, 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 @@ -271,6 +271,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed custom pass volume not executed in scene view because of the volume culling mask.
- Fixed remapping of depth pyramid debug view
- Fixed an issue with asymmetric projection matrices and fog / pathtracing. (case 1330290).
- Fixed gbuffer depth debug mode for materials not rendered during the prepass.

### 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 @@ -1052,13 +1052,14 @@ class DebugViewMaterialData
public ComputeBufferHandle perVoxelOffset;
public DBufferOutput dbuffer;
public GBufferOutput gbuffer;
public TextureHandle depthBuffer;

public Texture clearColorTexture;
public RenderTexture clearDepthTexture;
public bool clearDepth;
}

TextureHandle RenderDebugViewMaterial(RenderGraph renderGraph, CullingResults cull, HDCamera hdCamera, BuildGPULightListOutput lightLists, DBufferOutput dbuffer, GBufferOutput gbuffer)
TextureHandle RenderDebugViewMaterial(RenderGraph renderGraph, CullingResults cull, HDCamera hdCamera, BuildGPULightListOutput lightLists, DBufferOutput dbuffer, GBufferOutput gbuffer, TextureHandle depthBuffer)
{
bool msaa = hdCamera.msaaEnabled;

Expand All @@ -1081,6 +1082,7 @@ TextureHandle RenderDebugViewMaterial(RenderGraph renderGraph, CullingResults cu
passData.debugGBufferMaterial = m_currentDebugViewMaterialGBuffer;
passData.outputColor = builder.WriteTexture(output);
passData.gbuffer = ReadGBuffer(gbuffer, builder);
passData.depthBuffer = builder.ReadTexture(depthBuffer);

builder.SetRenderFunc(
(DebugViewMaterialData data, RenderGraphContext context) =>
Expand All @@ -1090,6 +1092,7 @@ TextureHandle RenderDebugViewMaterial(RenderGraph renderGraph, CullingResults cu
{
data.debugGBufferMaterial.SetTexture(HDShaderIDs._GBufferTexture[i], gbufferHandles.mrt[i]);
}
data.debugGBufferMaterial.SetTexture(HDShaderIDs._CameraDepthTexture, data.depthBuffer);

HDUtils.DrawFullScreen(context.cmd, data.debugGBufferMaterial, data.outputColor);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void RecordRenderGraph(RenderRequest renderRequest,
// Stop Single Pass is after post process.
StartXRSinglePass(m_RenderGraph, hdCamera);

colorBuffer = RenderDebugViewMaterial(m_RenderGraph, cullingResults, hdCamera, gpuLightListOutput, prepassOutput.dbuffer, prepassOutput.gbuffer);
colorBuffer = RenderDebugViewMaterial(m_RenderGraph, cullingResults, hdCamera, gpuLightListOutput, prepassOutput.dbuffer, prepassOutput.gbuffer, prepassOutput.depthBuffer);
colorBuffer = ResolveMSAAColor(m_RenderGraph, hdCamera, colorBuffer);
}
else if (hdCamera.frameSettings.IsEnabled(FrameSettingsField.RayTracing) &&
Expand Down