From bcd8ce3c939b7b42d2b709d76704e4df6fb80367 Mon Sep 17 00:00:00 2001 From: Pixelflinger Date: Sat, 29 Aug 2020 01:24:28 -0700 Subject: [PATCH] fix refraction + MSAA + TAA (depth resolve) the depth buffer wasn't resolved in this case. We fix this by always creating a depth buffer resolve pass -- which is a lot more robust. this pass automatically culled if the depth is not used (i.e. TAA or DoF are off). The pass is a no-op if resolving is not needed. --- filament/src/Renderer.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/filament/src/Renderer.cpp b/filament/src/Renderer.cpp index 0441692f24..3e38fc0fa6 100644 --- a/filament/src/Renderer.cpp +++ b/filament/src/Renderer.cpp @@ -442,6 +442,13 @@ void FRenderer::renderJob(ArenaScope& arena, FView& view) { refractionPass(fg, config, colorGradingConfigForColor, pass, view); FrameGraphId input = colorPassOutput; + // resolve depth -- which might be needed because of TAA. This pass will be culled + // if the depth is not use below. + auto& blackboard = fg.getBlackboard(); + auto depth = blackboard.get("depth"); + depth = ppm.resolve(fg, "Resolved Depth Buffer", depth); + blackboard.put("depth", depth); + // TAA for color pass if (taaOptions.enabled) { input = ppm.taa(fg, input, view.getFrameHistory(), taaOptions, colorGradingConfig); @@ -458,14 +465,6 @@ void FRenderer::renderJob(ArenaScope& arena, FView& view) { if (hasPostProcess) { if (dofOptions.enabled) { - - // dof needs access to the depth buffer, when MSAA is enabled, it might need - // to be resolved. - auto& blackboard = fg.getBlackboard(); - auto depth = blackboard.get("depth"); - depth = ppm.resolve(fg, "Resolved Depth Buffer", depth); - blackboard.put("depth", depth); - input = ppm.dof(fg, input, dofOptions, needsAlphaChannel, cameraInfo); } if (colorGrading) {