-
Notifications
You must be signed in to change notification settings - Fork 847
Porting most of post processing to Render graph #1038
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
Conversation
# Conflicts: # com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs
// Note: some platforms can't clear a partial render target so we directly draw black triangles | ||
using (var builder = renderGraph.AddRenderPass<GuardBandPassData>("Guard Band Clear", out var passData, ProfilingSampler.Get(HDProfileId.GuardBandClear))) | ||
{ | ||
passData.source = builder.ReadTexture(source); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be WriteTexture?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, my mistake (my brain saw source and put read :D )
if (m_PostProcessEnabled) | ||
{ | ||
// // Temporal anti-aliasing goes first | ||
// bool taaEnabled = false; | ||
// Guard bands (also known as "horrible hack") to avoid bleeding previous RTHandle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment is duplicated in the static function
{ | ||
passData.source = builder.ReadTexture(source); | ||
passData.parameters = PrepareExposureParameters(hdCamera); | ||
passData.prevExposure = prevExposureHandle; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An explicit Write/Read should still be done here.
The reason is that the pass needs to know that it writes to an imported texture so that it's considered as side effect and cannot be pruned.
|
||
if (m_Exposure.mode.value == ExposureMode.AutomaticHistogram) | ||
{ | ||
passData.exposureDebugData = renderGraph.ImportTexture(m_DebugExposureData); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
passData.parameters = PrepareApplyExposureParameters(hdCamera); | ||
RTHandle prevExp; | ||
GrabExposureHistoryTextures(hdCamera, out prevExp, out _); | ||
passData.prevExposure = renderGraph.ImportTexture(prevExp); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here: Read/Write required.
GrabExposureHistoryTextures(hdCamera, out prevExp, out _); | ||
passData.prevExposure = renderGraph.ImportTexture(prevExp); | ||
|
||
TextureHandle dest = renderGraph.CreateTexture(new TextureDesc(Vector2.one, true, true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is repeated in several places. We could probably do a helper function to reduce code footprint
passData.depthBuffer = builder.ReadTexture(depthBuffer); | ||
passData.motionVecTexture = builder.ReadTexture(motionVectors); | ||
passData.depthMipChain = builder.ReadTexture(depthBufferMipChain); | ||
passData.prevHistory = renderGraph.ImportTexture(prevHistory); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Read/Write
{ | ||
var cs = exposureParameters.exposureCS; | ||
int kernel; | ||
|
||
var sourceTex = colorBuffer; | ||
|
||
// NOTE: Breakpoint here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stray comment?
@@ -60,7 +60,9 @@ class AfterPostProcessPassData | |||
parameters.blueNoise, | |||
inputColor, | |||
afterPostProcessBuffer, | |||
depthBuffer, | |||
prepassOutput.depthBuffer, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this tested with MSAA?
I think we need prepassOutput.resolvedDepthBuffer here
@@ -217,7 +217,7 @@ class TempPassData { }; | |||
|
|||
aovRequest.PushCameraTexture(m_RenderGraph, AOVBuffers.Color, hdCamera, colorBuffer, aovBuffers); | |||
|
|||
TextureHandle postProcessDest = RenderPostProcess(m_RenderGraph, colorBuffer, prepassOutput.resolvedDepthBuffer, backBuffer, cullingResults, hdCamera); | |||
TextureHandle postProcessDest = RenderPostProcess(m_RenderGraph, prepassOutput, colorBuffer, backBuffer, cullingResults, hdCamera); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment above, this will cause a regression.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made a few comments on some reccuring patterns otherwise looks good.
Also discussed directly with Francesco the possibility of splitting the huge function into smaller one per pass to make it more readable.
Addressed stuff from this review, will split into smaller functions when I am done with the dof conversion (another PR) |
Wowee that's a big one, ported most post processing stuff to render graph.
Still missing DoF (changed from when I started)
And custom PP.
Yamato: https://yamato.prd.cds.internal.unity3d.com/jobs/902-Graphics/tree/HDRP%252Fport-pp-to-rendergraph/.yamato%252Fall-hdrp_dxr.yml%2523All_HDRP_DXR_CUSTOM-REVISION/2638716/job