History

cleaning light clusters

Sam Gateau committed 7 years ago

Commit b09d0b11 parent 653370e4 files · +48 −52Browse files

Showing the changes to libraries/render-utils/src/RenderDeferredTask.cpp (1 of 4 files). Show all

Unified · Split

libraries/render-utils/src/RenderDeferredTask.cpp+39−37
@@ -84,7 +84,7 @@ public: · 83 unmodified lines
84class RenderDeferredTaskDebug {84class RenderDeferredTaskDebug {
85public:85public:
86 using Input = render::VaryingSet9<RenderFetchCullSortTask::Output, RenderShadowTask::Output,86 using Input = render::VaryingSet9<RenderFetchCullSortTask::Output, RenderShadowTask::Output,
87 ZoneRendererTask::Output, SelectItems::Outputs, FetchCurrentFrames::Output,87 AssembleLightingStageTask::Output, LightClusteringPass::Output, LinearDepthFramebufferPointer,
88 PrepareDeferred::Outputs, GenerateDeferredFrameTransform::Output, JitterSample::Output, LightingModel>;88 PrepareDeferred::Outputs, GenerateDeferredFrameTransform::Output, JitterSample::Output, LightingModel>;
89 // using Config = RenderDeferredTaskConfig;89 // using Config = RenderDeferredTaskConfig;
90 using JobModel = render::Task::ModelI<RenderDeferredTaskDebug, Input>;90 using JobModel = render::Task::ModelI<RenderDeferredTaskDebug, Input>;
@@ -112,18 +112,6 @@ void RenderDeferredTask::configure(const Config& config) { · 21 unmodified lines
112 upsamplePrimaryBufferConfig->setProperty("factor", 1.0f / config.resolutionScale);112 upsamplePrimaryBufferConfig->setProperty("factor", 1.0f / config.resolutionScale);
113}113}
114 114
115const render::Varying RenderDeferredTask::addSelectItemJobs(JobModel& task, const char* selectionName,
116 const render::Varying& metas,
117 const render::Varying& opaques,
118 const render::Varying& transparents) {
119 const auto selectMetaInput = SelectItems::Inputs(metas, Varying(), std::string()).asVarying();
120 const auto selectedMetas = task.addJob<SelectItems>("MetaSelection", selectMetaInput, selectionName);
121 const auto selectMetaAndOpaqueInput = SelectItems::Inputs(opaques, selectedMetas, std::string()).asVarying();
122 const auto selectedMetasAndOpaques = task.addJob<SelectItems>("OpaqueSelection", selectMetaAndOpaqueInput, selectionName);
123 const auto selectItemInput = SelectItems::Inputs(transparents, selectedMetasAndOpaques, std::string()).asVarying();
124 return task.addJob<SelectItems>("TransparentSelection", selectItemInput, selectionName);
125}
126
127void RenderDeferredTask::build(JobModel& task, const render::Varying& input, render::Varying& output, bool renderShadows) {115void RenderDeferredTask::build(JobModel& task, const render::Varying& input, render::Varying& output, bool renderShadows) {
128 const auto& inputs = input.get<Input>();116 const auto& inputs = input.get<Input>();
129 const auto& fetchedItems = inputs.get0();117 const auto& fetchedItems = inputs.get0();
@@ -220,7 +208,7 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren · 90 unmodified lines
220 208
221 // Light Clustering209 // Light Clustering
222 // Create the cluster grid of lights, cpu job for now210 // Create the cluster grid of lights, cpu job for now
223 const auto lightClusteringPassInputs = LightClusteringPass::Inputs(deferredFrameTransform, lightingModel, lightFrame, linearDepthTarget).asVarying();211 const auto lightClusteringPassInputs = LightClusteringPass::Input(deferredFrameTransform, lightingModel, lightFrame, linearDepthTarget).asVarying();
224 const auto lightClusters = task.addJob<LightClusteringPass>("LightClustering", lightClusteringPassInputs);212 const auto lightClusters = task.addJob<LightClusteringPass>("LightClustering", lightClusteringPassInputs);
225 213
226 // DeferredBuffer is complete, now let's shade it into the LightingBuffer214 // DeferredBuffer is complete, now let's shade it into the LightingBuffer
@@ -239,16 +227,7 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren · 12 unmodified lines
239 const auto transparentsInputs = DrawDeferred::Inputs(transparents, hazeFrame, lightFrame, lightingModel, lightClusters, jitter).asVarying();227 const auto transparentsInputs = DrawDeferred::Inputs(transparents, hazeFrame, lightFrame, lightingModel, lightClusters, jitter).asVarying();
240 task.addJob<DrawDeferred>("DrawTransparentDeferred", transparentsInputs, shapePlumber);228 task.addJob<DrawDeferred>("DrawTransparentDeferred", transparentsInputs, shapePlumber);
241 229
242 // Light Cluster Grid Debuging job
243 {
244 const auto debugLightClustersInputs = DebugLightClusters::Inputs(deferredFrameTransform, deferredFramebuffer, lightingModel, linearDepthTarget, lightClusters).asVarying();
245 task.addJob<DebugLightClusters>("DebugLightClusters", debugLightClustersInputs);
246 }
247
248 const auto outlineRangeTimer = task.addJob<BeginGPURangeTimer>("BeginHighlightRangeTimer", "Highlight");230 const auto outlineRangeTimer = task.addJob<BeginGPURangeTimer>("BeginHighlightRangeTimer", "Highlight");
249 // Select items that need to be outlined
250 const auto selectionBaseName = "contextOverlayHighlightList";
251 const auto selectedItems = addSelectItemJobs(task, selectionBaseName, metas, opaques, transparents);
252 231
253 const auto outlineInputs = DrawHighlightTask::Inputs(items, deferredFramebuffer, lightingFramebuffer, deferredFrameTransform, jitter).asVarying();232 const auto outlineInputs = DrawHighlightTask::Inputs(items, deferredFramebuffer, lightingFramebuffer, deferredFrameTransform, jitter).asVarying();
254 task.addJob<DrawHighlightTask>("DrawHighlight", outlineInputs);233 task.addJob<DrawHighlightTask>("DrawHighlight", outlineInputs);
@@ -277,7 +256,7 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren · 22 unmodified lines
277 256
278 // Debugging task is happening in the "over" layer after tone mapping and just before HUD257 // Debugging task is happening in the "over" layer after tone mapping and just before HUD
279 { // Debug the bounds of the rendered items, still look at the zbuffer258 { // Debug the bounds of the rendered items, still look at the zbuffer
280 const auto debugInputs = RenderDeferredTaskDebug::Input(fetchedItems, inputs[2], zones, selectedItems, currentStageFrames, prepareDeferredOutputs, deferredFrameTransform, jitter, lightingModel).asVarying();259 const auto debugInputs = RenderDeferredTaskDebug::Input(fetchedItems, inputs[2], lightingStageInputs, lightClusters, linearDepthTarget, prepareDeferredOutputs, deferredFrameTransform, jitter, lightingModel).asVarying();
281 task.addJob<RenderDeferredTaskDebug>("DebugRenderDeferredTask", debugInputs);260 task.addJob<RenderDeferredTaskDebug>("DebugRenderDeferredTask", debugInputs);
282 }261 }
283 262
@@ -308,9 +287,6 @@ void RenderDeferredTaskDebug::configure(const Config& config) { · 24 unmodified lines
308}*/287}*/
309 288
310void RenderDeferredTaskDebug::build(JobModel& task, const render::Varying& input, render::Varying& outputs) {289void RenderDeferredTaskDebug::build(JobModel& task, const render::Varying& input, render::Varying& outputs) {
311// RenderFetchCullSortTask::Output, RenderShadowTask::Output,
312// ZoneRendererTask::Outputs, SelectItems::Outputs, FetchCurrentFrames::Outputs,
313// PrepareDeferred::Outputs, GenerateDeferredFrameTransform::Output, JitterSample::Output
314 290
315 const auto& inputs = input.get<Input>();291 const auto& inputs = input.get<Input>();
316 292
@@ -334,18 +310,23 @@ void RenderDeferredTaskDebug::build(JobModel& task, const render::Varying& input · 17 unmodified lines
334 // RenderShadowTask out310 // RenderShadowTask out
335 const auto& renderShadowTaskOut = inputs[1];311 const auto& renderShadowTaskOut = inputs[1];
336 312
337 // Zones313 // Extract the Lighting Stages Current frame ( and zones)
338 const auto& zones = inputs[2];314 const auto lightingStageInputs = inputs.get2();
315 // Fetch the current frame stacks from all the stages
316 const auto stageCurrentFrames = lightingStageInputs.get0();
317 const auto lightFrame = stageCurrentFrames[0];
318 const auto backgroundFrame = stageCurrentFrames[1];
319 const auto hazeFrame = stageCurrentFrames[2];
320 const auto bloomFrame = stageCurrentFrames[3];
321
322 // Zones
323 const auto& zones = lightingStageInputs[1];
339 324
340 // Selected objects325 // Light CLuster
341 const auto& selectedItems = inputs[3];326 const auto& lightClusters = inputs[3];
342 327
343 // Stage current frames328 // linear Depth Target
344 const auto& stageCurrentFrames = inputs.get4();//[4];329 const auto& linearDepthTarget = inputs[4];
345 const auto lightFrame = stageCurrentFrames[0];
346 const auto backgroundFrame = stageCurrentFrames[1];
347 const auto hazeFrame = stageCurrentFrames[2];
348 const auto bloomFrame = stageCurrentFrames[3];
349 330
350 // PrepareDeferred out331 // PrepareDeferred out
351 const auto& deferredFramebuffer = inputs[5];332 const auto& deferredFramebuffer = inputs[5];
@@ -360,6 +341,14 @@ void RenderDeferredTaskDebug::build(JobModel& task, const render::Varying& input · 8 unmodified lines
360 const auto& lightingModel = inputs[8];341 const auto& lightingModel = inputs[8];
361 342
362 343
344
345 // Light Cluster Grid Debuging job
346 {
347 const auto debugLightClustersInputs = DebugLightClusters::Inputs(deferredFrameTransform, lightingModel, linearDepthTarget, lightClusters).asVarying();
348 task.addJob<DebugLightClusters>("DebugLightClusters", debugLightClustersInputs);
349 }
350
351
363 { // Debug the bounds of the rendered items, still look at the zbuffer352 { // Debug the bounds of the rendered items, still look at the zbuffer
364 task.addJob<DrawBounds>("DrawMetaBounds", metas);353 task.addJob<DrawBounds>("DrawMetaBounds", metas);
365 task.addJob<DrawBounds>("DrawOpaqueBounds", opaques);354 task.addJob<DrawBounds>("DrawOpaqueBounds", opaques);
@@ -383,6 +372,19 @@ void RenderDeferredTaskDebug::build(JobModel& task, const render::Varying& input · 17 unmodified lines
383 task.addJob<DrawAABox>(jobName, shadowBBox, glm::vec3(1.0f, tint, 0.0f));372 task.addJob<DrawAABox>(jobName, shadowBBox, glm::vec3(1.0f, tint, 0.0f));
384 }373 }
385 }374 }
375 }
376
377 { // Debug Selection...
378 // TODO: It s busted
379 // Select items that need to be outlined and show them
380 const auto selectionBaseName = "contextOverlayHighlightList";
381
382 const auto selectMetaInput = SelectItems::Inputs(metas, Varying(), std::string()).asVarying();
383 const auto selectedMetas = task.addJob<SelectItems>("MetaSelection", selectMetaInput, selectionBaseName);
384 const auto selectMetaAndOpaqueInput = SelectItems::Inputs(opaques, selectedMetas, std::string()).asVarying();
385 const auto selectedMetasAndOpaques = task.addJob<SelectItems>("OpaqueSelection", selectMetaAndOpaqueInput, selectionBaseName);
386 const auto selectItemInput = SelectItems::Inputs(transparents, selectedMetasAndOpaques, std::string()).asVarying();
387 const auto selectedItems = task.addJob<SelectItems>("TransparentSelection", selectItemInput, selectionBaseName);
386 388
387 // Render.getConfig("RenderMainView.DrawSelectionBounds").enabled = true389 // Render.getConfig("RenderMainView.DrawSelectionBounds").enabled = true
388 task.addJob<DrawBounds>("DrawSelectionBounds", selectedItems);390 task.addJob<DrawBounds>("DrawSelectionBounds", selectedItems);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t