From 61f337b4909a2e6bbdd63721c7179a5ff4eecc3b Mon Sep 17 00:00:00 2001 From: Zach Pomerantz Date: Tue, 26 Jan 2016 17:42:54 -0800 Subject: [PATCH] Hold Varying constant over task ctor --- libraries/render-utils/src/RenderDeferredTask.cpp | 13 +++++++------ libraries/render-utils/src/RenderShadowTask.cpp | 8 ++++---- libraries/render/src/render/Task.h | 6 +----- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/libraries/render-utils/src/RenderDeferredTask.cpp b/libraries/render-utils/src/RenderDeferredTask.cpp index 06fadb69b3..eb46129777 100755 --- a/libraries/render-utils/src/RenderDeferredTask.cpp +++ b/libraries/render-utils/src/RenderDeferredTask.cpp @@ -89,15 +89,16 @@ RenderDeferredTask::RenderDeferredTask(CullFunctor cullFunctor) { initDeferredPipelines(*shapePlumber); // CPU: Fetch the renderOpaques - auto fetchedOpaques = addJob("FetchOpaque"); - auto culledOpaques = addJob>("CullOpaque", fetchedOpaques, cullFunctor); - auto opaques = addJob("DepthSortOpaque", culledOpaques); + const auto fetchedOpaques = addJob("FetchOpaque"); + const auto culledOpaques = addJob>("CullOpaque", fetchedOpaques, cullFunctor); + const auto opaques = addJob("DepthSortOpaque", culledOpaques); // CPU only, create the list of renderedTransparents items - auto fetchedTransparents = addJob("FetchTransparent", FetchItems( + const auto fetchedTransparents = addJob("FetchTransparent", FetchItems( ItemFilter::Builder::transparentShape().withoutLayered())); - auto culledTransparents = addJob>("CullTransparent", fetchedTransparents, cullFunctor); - auto transparents = addJob("DepthSortTransparent", culledTransparents, DepthSortItems(false)); + const auto culledTransparents = + addJob>("CullTransparent", fetchedTransparents, cullFunctor); + const auto transparents = addJob("DepthSortTransparent", culledTransparents, DepthSortItems(false)); // GPU Jobs: Start preparing the deferred and lighting buffer addJob("PrepareDeferred"); diff --git a/libraries/render-utils/src/RenderShadowTask.cpp b/libraries/render-utils/src/RenderShadowTask.cpp index be6cd47f95..b8686a6c00 100644 --- a/libraries/render-utils/src/RenderShadowTask.cpp +++ b/libraries/render-utils/src/RenderShadowTask.cpp @@ -105,16 +105,16 @@ RenderShadowTask::RenderShadowTask(CullFunctor cullFunctor) : Task(std::make_sha } // CPU: Fetch shadow-casting opaques - auto fetchedItems = addJob("FetchShadowMap"); + const auto fetchedItems = addJob("FetchShadowMap"); // CPU: Cull against KeyLight frustum (nearby viewing camera) - auto culledItems = addJob>("CullShadowMap", fetchedItems, cullFunctor); + const auto culledItems = addJob>("CullShadowMap", fetchedItems, cullFunctor); // CPU: Sort by pipeline - auto sortedShapes = addJob("PipelineSortShadowSort", culledItems); + const auto sortedShapes = addJob("PipelineSortShadowSort", culledItems); // CPU: Sort front to back - auto shadowShapes = addJob("DepthSortShadowMap", sortedShapes); + const auto shadowShapes = addJob("DepthSortShadowMap", sortedShapes); // GPU: Render to shadow map addJob("RenderShadowMap", shadowShapes, shapePlumber); diff --git a/libraries/render/src/render/Task.h b/libraries/render/src/render/Task.h index 66258711cc..148117eed6 100644 --- a/libraries/render/src/render/Task.h +++ b/libraries/render/src/render/Task.h @@ -260,12 +260,8 @@ public: QObject::connect(config.get(), SIGNAL(dirty()), _config.get(), SLOT(refresh())); return _jobs.back().getOutput(); } - template const Varying addJob(std::string name, Varying& input, A&&... args) { - const auto& in = input; - return addJob(name, in, std::forward(args)...); - } template const Varying addJob(std::string name, A&&... args) { - auto input = Varying(typename T::JobModel::Input()); + const auto input = Varying(typename T::JobModel::Input()); return addJob(name, input, std::forward(args)...); }