From 6dc239d58d0a8d7bb55aacff7a70fe632785f725 Mon Sep 17 00:00:00 2001 From: HifiExperiments Date: Mon, 11 Nov 2024 23:39:06 -0800 Subject: [PATCH] fix fade out not working in forward rendering --- libraries/render-utils/src/RenderDeferredTask.cpp | 4 ---- libraries/render-utils/src/RenderViewTask.cpp | 9 +++++++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/libraries/render-utils/src/RenderDeferredTask.cpp b/libraries/render-utils/src/RenderDeferredTask.cpp index 270bbb8549..05253178f1 100644 --- a/libraries/render-utils/src/RenderDeferredTask.cpp +++ b/libraries/render-utils/src/RenderDeferredTask.cpp @@ -145,10 +145,6 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren // Shadow Stage Frame const auto shadowFrame = shadowTaskOutputs[1]; - if (depth == 0) { - task.addJob("FadeEffect", opaques); - } - const auto jitter = task.addJob("JitterCam"); // GPU jobs: Start preparing the primary, deferred and lighting buffer diff --git a/libraries/render-utils/src/RenderViewTask.cpp b/libraries/render-utils/src/RenderViewTask.cpp index b9320b6ad3..fca8c252e6 100644 --- a/libraries/render-utils/src/RenderViewTask.cpp +++ b/libraries/render-utils/src/RenderViewTask.cpp @@ -10,6 +10,7 @@ // #include "RenderViewTask.h" +#include "FadeEffect.h" #include "RenderShadowTask.h" #include "RenderCommonTask.h" #include "RenderDeferredTask.h" @@ -40,6 +41,14 @@ void DeferredForwardSwitchJob::build(JobModel& task, const render::Varying& inpu void RenderViewTask::build(JobModel& task, const render::Varying& input, render::Varying& output, render::CullFunctor cullFunctor, uint8_t tagBits, uint8_t tagMask, size_t depth) { const auto items = task.addJob("FetchCullSort", cullFunctor, tagBits, tagMask); + if (depth == 0 && tagBits == render::ItemKey::TAG_BITS_0) { + // TODO: This doesn't actually do any rendering, it simply processes the fade transactions. Even though forward rendering + // doesn't support fading right now, we still need to do this once for both paths, otherwise we are left with orphaned objects + // after they fade out. In the future, we should refactor this to happen elsewhere. + const auto& opaques = items.get().get0()[RenderFetchCullSortTask::OPAQUE_SHAPE]; + task.addJob("FadeEffect", opaques); + } + // Issue the lighting model, aka the big global settings for the view const auto lightingModel = task.addJob("LightingModel");