Showing the changes to libraries/render-utils/src/RenderDeferredTask.cpp (1 of 6 files). Show all
Unified · Split
| @@ -44,6 +44,7 @@ · 43 unmodified lines | ||
| 44 | 44 | |
| 45 | 45 | #include <gpu/StandardShaderLib.h> |
| 46 | 46 | |
| 47 | +#include <sstream> | |
| 47 | 48 | |
| 48 | 49 | using namespace render; |
| 49 | 50 | extern void initOverlay3DPipelines(render::ShapePlumber& plumber, bool depthTest = false); |
| @@ -57,6 +58,18 @@ void RenderDeferredTask::configure(const Config& config) · 7 unmodified lines | ||
| 57 | 58 | { |
| 58 | 59 | } |
| 59 | 60 | |
| 61 | +const render::Varying RenderDeferredTask::addSelectItemJobs(JobModel& task, const char* selectionName, | |
| 62 | + const render::Varying& metas, | |
| 63 | + const render::Varying& opaques, | |
| 64 | + const render::Varying& transparents) { | |
| 65 | + const auto selectMetaInput = SelectItems::Inputs(metas, Varying()).asVarying(); | |
| 66 | + const auto selectedMetas = task.addJob<SelectItems>("MetaSelection", selectMetaInput, selectionName); | |
| 67 | + const auto selectMetaAndOpaqueInput = SelectItems::Inputs(opaques, selectedMetas).asVarying(); | |
| 68 | + const auto selectedMetasAndOpaques = task.addJob<SelectItems>("OpaqueSelection", selectMetaAndOpaqueInput, selectionName); | |
| 69 | + const auto selectItemInput = SelectItems::Inputs(transparents, selectedMetasAndOpaques).asVarying(); | |
| 70 | + return task.addJob<SelectItems>("TransparentSelection", selectItemInput, selectionName); | |
| 71 | +} | |
| 72 | + | |
| 60 | 73 | void RenderDeferredTask::build(JobModel& task, const render::Varying& input, render::Varying& output) { |
| 61 | 74 | const auto& items = input.get<Input>(); |
| 62 | 75 | auto fadeEffect = DependencyManager::get<FadeEffect>(); |
| @@ -94,15 +107,6 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren · 31 unmodified lines | ||
| 94 | 107 | // draw a stencil mask in hidden regions of the framebuffer. |
| 95 | 108 | task.addJob<PrepareStencil>("PrepareStencil", primaryFramebuffer); |
| 96 | 109 | |
| 97 | − // Select items that need to be outlined | |
| 98 | − const auto selectionName = "contextOverlayHighlightList"; | |
| 99 | − const auto selectMetaInput = SelectItems::Inputs(metas, Varying()).asVarying(); | |
| 100 | − const auto selectedMetas = task.addJob<SelectItems>("PassTestMetaSelection", selectMetaInput, selectionName); | |
| 101 | − const auto selectMetaAndOpaqueInput = SelectItems::Inputs(opaques, selectedMetas).asVarying(); | |
| 102 | − const auto selectedMetasAndOpaques = task.addJob<SelectItems>("PassTestOpaqueSelection", selectMetaAndOpaqueInput, selectionName); | |
| 103 | − const auto selectItemInput = SelectItems::Inputs(transparents, selectedMetasAndOpaques).asVarying(); | |
| 104 | − const auto selectedItems = task.addJob<SelectItems>("PassTestTransparentSelection", selectItemInput, selectionName); | |
| 105 | − | |
| 106 | 110 | // Render opaque objects in DeferredBuffer |
| 107 | 111 | const auto opaqueInputs = DrawStateSortDeferred::Inputs(opaques, lightingModel).asVarying(); |
| 108 | 112 | task.addJob<DrawStateSortDeferred>("DrawOpaqueDeferred", opaqueInputs, shapePlumber); |
| @@ -172,9 +176,22 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren · 63 unmodified lines | ||
| 172 | 176 | const auto toneMappingInputs = ToneMappingDeferred::Inputs(lightingFramebuffer, primaryFramebuffer).asVarying(); |
| 173 | 177 | task.addJob<ToneMappingDeferred>("ToneMapping", toneMappingInputs); |
| 174 | 178 | |
| 179 | + // Select items that need to be outlined | |
| 180 | + const auto selectionBaseName = "contextOverlayHighlightList"; | |
| 181 | + const auto selectedItems = addSelectItemJobs(task, selectionBaseName, metas, opaques, transparents); | |
| 182 | + DrawOutlineTask::Groups outlineGroups; | |
| 183 | + outlineGroups[0] = selectedItems; | |
| 184 | + for (auto i = 1; i < DrawOutlineTask::MAX_GROUP_COUNT; i++) { | |
| 185 | + std::ostringstream selectionName; | |
| 186 | + selectionName << selectionBaseName; | |
| 187 | + selectionName << i; | |
| 188 | + outlineGroups[i] = addSelectItemJobs(task, selectionName.str().c_str(), metas, opaques, transparents); | |
| 189 | + } | |
| 175 | 190 | const auto outlineRangeTimer = task.addJob<BeginGPURangeTimer>("BeginOutlineRangeTimer", "Outline"); |
| 176 | − const auto outlineInputs = DrawOutlineTask::Inputs(selectedItems, deferredFramebuffer, primaryFramebuffer, deferredFrameTransform).asVarying(); | |
| 191 | + | |
| 192 | + const auto outlineInputs = DrawOutlineTask::Inputs(outlineGroups, deferredFramebuffer, primaryFramebuffer, deferredFrameTransform).asVarying(); | |
| 177 | 193 | task.addJob<DrawOutlineTask>("DrawOutline", outlineInputs); |
| 194 | + | |
| 178 | 195 | task.addJob<EndGPURangeTimer>("EndOutlineRangeTimer", outlineRangeTimer); |
| 179 | 196 | |
| 180 | 197 | { // DEbug the bounds of the rendered items, still look at the zbuffer |
| @@ -184,6 +201,9 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren · 3 unmodified lines | ||
| 184 | 201 | |
| 185 | 202 | task.addJob<DrawBounds>("DrawLightBounds", lights); |
| 186 | 203 | task.addJob<DrawBounds>("DrawZones", zones); |
| 204 | + | |
| 205 | + // Render.getConfig("RenderMainView.DrawSelectionBounds").enabled = true | |
| 206 | + task.addJob<DrawBounds>("DrawSelectionBounds", selectedItems); | |
| 187 | 207 | } |
| 188 | 208 | |
| 189 | 209 | // Layered Overlays |
| @@ -230,9 +250,6 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren · 40 unmodified lines | ||
| 230 | 250 | } |
| 231 | 251 | |
| 232 | 252 | task.addJob<DebugZoneLighting>("DrawZoneStack", deferredFrameTransform); |
| 233 | − | |
| 234 | − // Render.getConfig("RenderMainView.DrawSelectionBounds").enabled = true | |
| 235 | − task.addJob<DrawBounds>("DrawSelectionBounds", selectedItems); | |
| 236 | 253 | } |
| 237 | 254 | |
| 238 | 255 | // AA job to be revisited |