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

Fixing exceptions in the console when putting the SSGI in low quality mode (render graph). #2323

Merged
merged 1 commit into from
Oct 22, 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 @@ -24,6 +24,7 @@ The version number for this package has increased due to a version update of a r
- Fixed upside down XR occlusion mesh.
- Fixed precision issue with the atmospheric fog.
- Claryfied doc for the LayeredLit material.
- Fixing exceptions in the console when putting the SSGI in low quality mode (render graph).

### Changed
- Combined occlusion meshes into one to reduce draw calls and state changes with XR single-pass.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ class UpscaleSSGIPassData
public TextureHandle outputBuffer;
}

TextureHandle UpscaleSSGI(RenderGraph renderGraph, HDCamera hdCamera, GlobalIllumination giSettings, TextureHandle depthPyramid, TextureHandle inputBuffer)
TextureHandle UpscaleSSGI(RenderGraph renderGraph, HDCamera hdCamera, GlobalIllumination giSettings, HDUtils.PackedMipChainInfo info, TextureHandle depthPyramid, TextureHandle inputBuffer)
{
using (var builder = renderGraph.AddRenderPass<UpscaleSSGIPassData>("Upscale SSGI", out var passData, ProfilingSampler.Get(HDProfileId.SSGIUpscale)))
{
builder.EnableAsyncCompute(false);

passData.parameters = PrepareSSGIUpscaleParameters(hdCamera, giSettings); ;
passData.parameters = PrepareSSGIUpscaleParameters(hdCamera, giSettings, info);
passData.depthTexture = builder.ReadTexture(depthPyramid);
passData.inputBuffer = builder.ReadTexture(inputBuffer);
passData.outputBuffer = builder.WriteTexture(renderGraph.CreateTexture(new TextureDesc(Vector2.one, true, true)
Expand Down Expand Up @@ -137,7 +137,7 @@ TextureHandle ConvertSSGI(RenderGraph renderGraph, HDCamera hdCamera, bool halfR
}
}

TextureHandle RenderSSGI(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle depthPyramid, TextureHandle normalBuffer, TextureHandle motionVectorsBuffer, ShaderVariablesRaytracing shaderVariablesRayTracingCB)
TextureHandle RenderSSGI(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle depthPyramid, TextureHandle normalBuffer, TextureHandle motionVectorsBuffer, ShaderVariablesRaytracing shaderVariablesRayTracingCB, HDUtils.PackedMipChainInfo info)
{
// Grab the global illumination volume component
GlobalIllumination giSettings = hdCamera.volumeStack.GetComponent<GlobalIllumination>();
Expand All @@ -160,7 +160,7 @@ TextureHandle RenderSSGI(RenderGraph renderGraph, HDCamera hdCamera, TextureHand
// Upscale it if required
// If this was a half resolution effect, we still have to upscale it
if (!giSettings.fullResolutionSS)
colorBuffer = UpscaleSSGI(renderGraph, hdCamera, giSettings, depthPyramid, colorBuffer);
colorBuffer = UpscaleSSGI(renderGraph, hdCamera, giSettings, info, depthPyramid, colorBuffer);
return colorBuffer;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ struct SSGIUpscaleParameters
public int upscaleKernel;
}

SSGIUpscaleParameters PrepareSSGIUpscaleParameters(HDCamera hdCamera, GlobalIllumination settings)
SSGIUpscaleParameters PrepareSSGIUpscaleParameters(HDCamera hdCamera, GlobalIllumination settings, HDUtils.PackedMipChainInfo info)
{
SSGIUpscaleParameters parameters = new SSGIUpscaleParameters();

Expand All @@ -336,7 +336,6 @@ SSGIUpscaleParameters PrepareSSGIUpscaleParameters(HDCamera hdCamera, GlobalIllu
parameters.halfScreenSize.Set(parameters.texWidth / 2, parameters.texHeight / 2, 1.0f / (parameters.texWidth * 0.5f), 1.0f / (parameters.texHeight * 0.5f));

// Set the generation parameters
var info = m_SharedRTManager.GetDepthBufferMipChainInfo();
parameters.firstMipOffset.Set(HDShadowUtils.Asfloat((uint)info.mipLevelOffsets[1].x), HDShadowUtils.Asfloat((uint)info.mipLevelOffsets[1].y));

// Grab the right kernel
Expand Down Expand Up @@ -467,7 +466,7 @@ void RenderSSGI(HDCamera hdCamera, CommandBuffer cmd, ScriptableRenderContext re
{
ComputeShader bilateralUpsampleCS = m_Asset.renderPipelineResources.shaders.bilateralUpsampleCS;

SSGIUpscaleParameters parameters = PrepareSSGIUpscaleParameters(hdCamera, giSettings);
SSGIUpscaleParameters parameters = PrepareSSGIUpscaleParameters(hdCamera, giSettings, m_SharedRTManager.GetDepthBufferMipChainInfo());
SSGIUpscaleResources resources = PrepareSSGIUpscaleResources(hdCamera, buffer00, buffer10);
ExecuteSSGIUpscale(cmd, parameters, resources);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ void ExecuteWithRenderGraph( RenderRequest renderRequest,
switch (GetIndirectDiffuseMode(hdCamera))
{
case IndirectDiffuseMode.ScreenSpace:
lightingBuffers.ssgiLightingBuffer = RenderSSGI(m_RenderGraph, hdCamera, prepassOutput.depthPyramidTexture, prepassOutput.normalBuffer, prepassOutput.resolvedMotionVectorsBuffer, m_ShaderVariablesRayTracingCB);
lightingBuffers.ssgiLightingBuffer = RenderSSGI(m_RenderGraph, hdCamera, prepassOutput.depthPyramidTexture, prepassOutput.normalBuffer, prepassOutput.resolvedMotionVectorsBuffer, m_ShaderVariablesRayTracingCB, GetDepthBufferMipChainInfo());
break;

case IndirectDiffuseMode.Raytrace:
Expand Down