From 6dc239d58d0a8d7bb55aacff7a70fe632785f725 Mon Sep 17 00:00:00 2001 From: HifiExperiments Date: Mon, 11 Nov 2024 23:39:06 -0800 Subject: [PATCH 1/2] 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"); From c77bcb2d456bac08360555b3907cdd4a7541c8a9 Mon Sep 17 00:00:00 2001 From: HifiExperiments Date: Mon, 11 Nov 2024 23:58:19 -0800 Subject: [PATCH 2/2] remove unused parameter --- libraries/render-utils/src/FadeEffect.cpp | 6 ++---- libraries/render-utils/src/FadeEffect.h | 3 +-- libraries/render-utils/src/FadeEffectJobs.cpp | 4 ++-- libraries/render-utils/src/FadeEffectJobs.h | 4 ++-- libraries/render-utils/src/RenderViewTask.cpp | 3 +-- 5 files changed, 8 insertions(+), 12 deletions(-) diff --git a/libraries/render-utils/src/FadeEffect.cpp b/libraries/render-utils/src/FadeEffect.cpp index 902b8fbab1..88018924d8 100644 --- a/libraries/render-utils/src/FadeEffect.cpp +++ b/libraries/render-utils/src/FadeEffect.cpp @@ -28,10 +28,8 @@ FadeEffect::FadeEffect() { } void FadeEffect::build(JobModel& task, const render::Varying& inputs, render::Varying& outputs) { - auto editedFadeCategory = task.addJob("Fade"); - - const auto fadeEditInput = FadeEditJob::Input(inputs, editedFadeCategory).asVarying(); - task.addJob("FadeEdit", fadeEditInput); + const auto editedFadeCategory = task.addJob("Fade"); + task.addJob("FadeEdit", editedFadeCategory); } render::ShapePipeline::BatchSetter FadeEffect::getBatchSetter() { diff --git a/libraries/render-utils/src/FadeEffect.h b/libraries/render-utils/src/FadeEffect.h index d5aab4e1f5..17b5efd28f 100644 --- a/libraries/render-utils/src/FadeEffect.h +++ b/libraries/render-utils/src/FadeEffect.h @@ -15,8 +15,7 @@ class FadeEffect { public: - using Input = render::ItemBounds; - using JobModel = render::Task::ModelI; + using JobModel = render::Task::Model; FadeEffect(); diff --git a/libraries/render-utils/src/FadeEffectJobs.cpp b/libraries/render-utils/src/FadeEffectJobs.cpp index 23abc18683..122b543c05 100644 --- a/libraries/render-utils/src/FadeEffectJobs.cpp +++ b/libraries/render-utils/src/FadeEffectJobs.cpp @@ -35,7 +35,7 @@ void FadeEditJob::configure(const Config& config) { _isEditEnabled = config.editFade; } -void FadeEditJob::run(const render::RenderContextPointer& renderContext, const FadeEditJob::Input& inputs) { +void FadeEditJob::run(const render::RenderContextPointer& renderContext, const FadeEditJob::Input& input) { auto scene = renderContext->_scene; if (_isEditEnabled) { @@ -63,7 +63,7 @@ void FadeEditJob::run(const render::RenderContextPointer& renderContext, const F render::Transition::AVATAR_CHANGE }; - auto transitionType = categoryToTransition[inputs.get1()]; + auto transitionType = categoryToTransition[input]; transaction.queryTransitionOnItem(_editedItem, [transitionType, scene](render::ItemID id, const render::Transition* transition) { if (transition == nullptr || transition->isFinished || transition->eventType != transitionType) { diff --git a/libraries/render-utils/src/FadeEffectJobs.h b/libraries/render-utils/src/FadeEffectJobs.h index fcd55b76ac..4a567d84a5 100644 --- a/libraries/render-utils/src/FadeEffectJobs.h +++ b/libraries/render-utils/src/FadeEffectJobs.h @@ -177,13 +177,13 @@ class FadeEditJob { public: using Config = FadeEditConfig; - using Input = render::VaryingSet2; + using Input = FadeCategory; using JobModel = render::Job::ModelI; FadeEditJob() {} void configure(const Config& config); - void run(const render::RenderContextPointer& renderContext, const FadeEditJob::Input& inputs); + void run(const render::RenderContextPointer& renderContext, const FadeEditJob::Input& input); private: diff --git a/libraries/render-utils/src/RenderViewTask.cpp b/libraries/render-utils/src/RenderViewTask.cpp index fca8c252e6..0748006fb6 100644 --- a/libraries/render-utils/src/RenderViewTask.cpp +++ b/libraries/render-utils/src/RenderViewTask.cpp @@ -45,8 +45,7 @@ void RenderViewTask::build(JobModel& task, const render::Varying& input, render: // 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); + task.addJob("FadeEffect"); } // Issue the lighting model, aka the big global settings for the view