Skip to content

Fixed a number of small issue when running XR and Render Graph #1018

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
Jun 29, 2020
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ void ExecuteWithRenderGraph( RenderRequest renderRequest,

if (m_CurrentDebugDisplaySettings.IsDebugMaterialDisplayEnabled() || m_CurrentDebugDisplaySettings.IsMaterialValidationEnabled() || CoreUtils.IsSceneLightingDisabled(hdCamera.camera))
{
using (new XRSinglePassScope(m_RenderGraph, hdCamera))
{
colorBuffer = RenderDebugViewMaterial(m_RenderGraph, cullingResults, hdCamera);
colorBuffer = ResolveMSAAColor(m_RenderGraph, hdCamera, colorBuffer);
}
// Stop Single Pass is after post process.
StartXRSinglePass(m_RenderGraph, hdCamera);

colorBuffer = RenderDebugViewMaterial(m_RenderGraph, cullingResults, hdCamera);
colorBuffer = ResolveMSAAColor(m_RenderGraph, hdCamera, colorBuffer);
}
else if (hdCamera.frameSettings.IsEnabled(FrameSettingsField.RayTracing) &&
hdCamera.volumeStack.GetComponent<PathTracing>().enable.value)
Expand Down Expand Up @@ -270,11 +270,16 @@ void ExecuteWithRenderGraph( RenderRequest renderRequest,
shadowResult,
cullingResults);

BlitFinalCameraTexture(m_RenderGraph, hdCamera, postProcessDest, backBuffer, prepassOutput.resolvedMotionVectorsBuffer, prepassOutput.resolvedNormalBuffer);
StopXRSinglePass(m_RenderGraph, hdCamera);

if (target.targetDepth != null)
for (int viewIndex = 0; viewIndex < hdCamera.viewCount; ++viewIndex)
{
BlitFinalCameraTexture(m_RenderGraph, hdCamera, prepassOutput.resolvedDepthBuffer, m_RenderGraph.ImportTexture(target.targetDepth), prepassOutput.resolvedMotionVectorsBuffer, prepassOutput.resolvedNormalBuffer);
BlitFinalCameraTexture(m_RenderGraph, hdCamera, postProcessDest, backBuffer, prepassOutput.resolvedMotionVectorsBuffer, prepassOutput.resolvedNormalBuffer, viewIndex);

if (target.targetDepth != null)
{
BlitFinalCameraTexture(m_RenderGraph, hdCamera, prepassOutput.resolvedDepthBuffer, m_RenderGraph.ImportTexture(target.targetDepth), prepassOutput.resolvedMotionVectorsBuffer, prepassOutput.resolvedNormalBuffer, viewIndex);
}
}

aovRequest.PushCameraTexture(m_RenderGraph, AOVBuffers.Output, hdCamera, postProcessDest, aovBuffers);
Expand Down Expand Up @@ -316,11 +321,11 @@ class FinalBlitPassData
public TextureHandle destination;
}

void BlitFinalCameraTexture(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle source, TextureHandle destination, TextureHandle motionVectors, TextureHandle normalBuffer)
void BlitFinalCameraTexture(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle source, TextureHandle destination, TextureHandle motionVectors, TextureHandle normalBuffer, int viewIndex)
{
using (var builder = renderGraph.AddRenderPass<FinalBlitPassData>("Final Blit (Dev Build Only)", out var passData))
{
passData.parameters = PrepareFinalBlitParameters(hdCamera, 0); // todo viewIndex
passData.parameters = PrepareFinalBlitParameters(hdCamera, viewIndex); // todo viewIndex
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can remove the comment on this line now :)

passData.source = builder.ReadTexture(source);
passData.destination = builder.WriteTexture(destination);

Expand Down