From 6c3dd027a70adfcc1ba2b9a5ef8cd8a63198a231 Mon Sep 17 00:00:00 2001 From: Zach Pomerantz Date: Fri, 26 Feb 2016 11:58:21 -0800 Subject: [PATCH] Use spatial tree for shadow fetch --- .../render-utils/src/RenderShadowTask.cpp | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/libraries/render-utils/src/RenderShadowTask.cpp b/libraries/render-utils/src/RenderShadowTask.cpp index f8057c164b..c5ae5f0f6a 100644 --- a/libraries/render-utils/src/RenderShadowTask.cpp +++ b/libraries/render-utils/src/RenderShadowTask.cpp @@ -104,19 +104,17 @@ RenderShadowTask::RenderShadowTask(CullFunctor cullFunctor) : Task(std::make_sha skinProgram, state); } - // CPU: Fetch shadow-casting opaques - const auto fetchedItems = addJob("FetchShadowMap"); + // CPU jobs: + // Fetch and cull the items from the scene + auto shadowFilter = ItemFilter::Builder::visibleWorldItems().withTypeShape().withOpaque().withoutLayered(); + const auto shadowSelection = addJob("FetchShadowSelection", shadowFilter); + const auto culledShadowSelection = addJob("CullShadowSelection", shadowSelection, cullFunctor, RenderDetails::SHADOW, shadowFilter); - // CPU: Cull against KeyLight frustum (nearby viewing camera) - const auto culledItems = addJob>("CullShadowMap", fetchedItems, cullFunctor); + // Sort + const auto sortedShapes = addJob("PipelineSortShadowSort", culledShadowSelection); + const auto shadowShapes = addJob("DepthSortShadowMap", sortedShapes); - // CPU: Sort by pipeline - const auto sortedShapes = addJob("PipelineSortShadowSort", culledItems); - - // CPU: Sort front to back - const auto shadowShapes = addJob("DepthSortShadowMap", sortedShapes); - - // GPU: Render to shadow map + // GPU jobs: Render to shadow map addJob("RenderShadowMap", shadowShapes, shapePlumber); }