Hold Varying constant over task ctor

This commit is contained in:
Zach Pomerantz 2016-01-26 17:42:54 -08:00
parent 5d157b059f
commit 61f337b490
3 changed files with 12 additions and 15 deletions

View file

@ -89,15 +89,16 @@ RenderDeferredTask::RenderDeferredTask(CullFunctor cullFunctor) {
initDeferredPipelines(*shapePlumber);
// CPU: Fetch the renderOpaques
auto fetchedOpaques = addJob<FetchItems>("FetchOpaque");
auto culledOpaques = addJob<CullItems<RenderDetails::OPAQUE_ITEM>>("CullOpaque", fetchedOpaques, cullFunctor);
auto opaques = addJob<DepthSortItems>("DepthSortOpaque", culledOpaques);
const auto fetchedOpaques = addJob<FetchItems>("FetchOpaque");
const auto culledOpaques = addJob<CullItems<RenderDetails::OPAQUE_ITEM>>("CullOpaque", fetchedOpaques, cullFunctor);
const auto opaques = addJob<DepthSortItems>("DepthSortOpaque", culledOpaques);
// CPU only, create the list of renderedTransparents items
auto fetchedTransparents = addJob<FetchItems>("FetchTransparent", FetchItems(
const auto fetchedTransparents = addJob<FetchItems>("FetchTransparent", FetchItems(
ItemFilter::Builder::transparentShape().withoutLayered()));
auto culledTransparents = addJob<CullItems<RenderDetails::TRANSLUCENT_ITEM>>("CullTransparent", fetchedTransparents, cullFunctor);
auto transparents = addJob<DepthSortItems>("DepthSortTransparent", culledTransparents, DepthSortItems(false));
const auto culledTransparents =
addJob<CullItems<RenderDetails::TRANSLUCENT_ITEM>>("CullTransparent", fetchedTransparents, cullFunctor);
const auto transparents = addJob<DepthSortItems>("DepthSortTransparent", culledTransparents, DepthSortItems(false));
// GPU Jobs: Start preparing the deferred and lighting buffer
addJob<PrepareDeferred>("PrepareDeferred");

View file

@ -105,16 +105,16 @@ RenderShadowTask::RenderShadowTask(CullFunctor cullFunctor) : Task(std::make_sha
}
// CPU: Fetch shadow-casting opaques
auto fetchedItems = addJob<FetchItems>("FetchShadowMap");
const auto fetchedItems = addJob<FetchItems>("FetchShadowMap");
// CPU: Cull against KeyLight frustum (nearby viewing camera)
auto culledItems = addJob<CullItems<RenderDetails::SHADOW_ITEM>>("CullShadowMap", fetchedItems, cullFunctor);
const auto culledItems = addJob<CullItems<RenderDetails::SHADOW_ITEM>>("CullShadowMap", fetchedItems, cullFunctor);
// CPU: Sort by pipeline
auto sortedShapes = addJob<PipelineSortShapes>("PipelineSortShadowSort", culledItems);
const auto sortedShapes = addJob<PipelineSortShapes>("PipelineSortShadowSort", culledItems);
// CPU: Sort front to back
auto shadowShapes = addJob<DepthSortShapes>("DepthSortShadowMap", sortedShapes);
const auto shadowShapes = addJob<DepthSortShapes>("DepthSortShadowMap", sortedShapes);
// GPU: Render to shadow map
addJob<RenderShadowMap>("RenderShadowMap", shadowShapes, shapePlumber);

View file

@ -260,12 +260,8 @@ public:
QObject::connect(config.get(), SIGNAL(dirty()), _config.get(), SLOT(refresh()));
return _jobs.back().getOutput();
}
template <class T, class... A> const Varying addJob(std::string name, Varying& input, A&&... args) {
const auto& in = input;
return addJob<T>(name, in, std::forward<A>(args)...);
}
template <class T, class... A> 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<T>(name, input, std::forward<A>(args)...);
}