Skip to content
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

Fix issue with stencil in rendergraph #1813

Merged
merged 3 commits into from
Sep 10, 2020
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 @@ -67,6 +67,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed issue with diffusion profile not being updated upon reset of the editor.
- Fixed an issue that lead to corrupted refraction in some scenarios on xbox.
- Fixed for light loop scalarization not happening.
- Fixed issue with stencil not being set in rendergraph mode.

### Changed
- Preparation pass for RTSSShadows to be supported by render graph.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ void BindMotionVectorPassColorBuffers(in RenderGraphBuilder builder, in PrepassO
// TODO: See how to clean this. Some buffers are created outside, some inside functions...
result.motionVectorsBuffer = CreateMotionVectorBuffer(renderGraph, msaa, clearMotionVectors);
result.depthBuffer = CreateDepthBuffer(renderGraph, hdCamera.clearDepth, msaa);
result.stencilBuffer = result.depthBuffer;
result.flagMaskBuffer = CreateFlagMaskTexture(renderGraph);

RenderXROcclusionMeshes(renderGraph, hdCamera, colorBuffer, result.depthBuffer);
Expand Down Expand Up @@ -270,8 +271,7 @@ void BindMotionVectorPassColorBuffers(in RenderGraphBuilder builder, in PrepassO
// NOTE: Currently we profiled that generating the HTile for SSR and using it is not worth it the optimization.
// However if the generated HTile will be used for something else but SSR, this should be made NOT resolve only and
// re-enabled in the shader.
if (hdCamera.IsSSREnabled())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why if (hdCamera.IsSSREnabled()) have disappeard?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed with Julien during our call, this is redundant in Rendergraph as the pass will be automatically culled.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

BuildCoarseStencilAndResolveIfNeeded(renderGraph, hdCamera, resolveOnly: true, ref result);
BuildCoarseStencilAndResolveIfNeeded(renderGraph, hdCamera, resolveOnly: true, ref result);
}

return result;
Expand Down Expand Up @@ -672,6 +672,8 @@ class ResolveStencilPassData
public ComputeBufferHandle coarseStencilBuffer;
}

// This pass build the coarse stencil buffer if requested (i.e. when resolveOnly: false) and perform the MSAA resolve of the
// full res stencil buffer if needed (a pass requires it and MSAA is on).
void BuildCoarseStencilAndResolveIfNeeded(RenderGraph renderGraph, HDCamera hdCamera, bool resolveOnly, ref PrepassOutput output)
{
using (var builder = renderGraph.AddRenderPass<ResolveStencilPassData>("Resolve Stencil", out var passData, ProfilingSampler.Get(HDProfileId.ResolveStencilBuffer)))
Expand All @@ -693,10 +695,6 @@ void BuildCoarseStencilAndResolveIfNeeded(RenderGraph renderGraph, HDCamera hdCa
{
output.stencilBuffer = passData.resolvedStencil;
}
else
{
output.stencilBuffer = output.depthBuffer;
}
output.coarseStencilBuffer = passData.coarseStencilBuffer;
}
}
Expand Down