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
8484 class RenderDeferredTaskDebug {
8585 public:
8686 using Input = render::VaryingSet9<RenderFetchCullSortTask::Output, RenderShadowTask::Output,
87− ZoneRendererTask::Output, SelectItems::Outputs, FetchCurrentFrames::Output,
87+ AssembleLightingStageTask::Output, LightClusteringPass::Output, LinearDepthFramebufferPointer,
8888 PrepareDeferred::Outputs, GenerateDeferredFrameTransform::Output, JitterSample::Output, LightingModel>;
8989 // using Config = RenderDeferredTaskConfig;
9090 using JobModel = render::Task::ModelI<RenderDeferredTaskDebug, Input>;
@@ -112,18 +112,6 @@ void RenderDeferredTask::configure(const Config& config) { · 21 unmodified lines
112112 upsamplePrimaryBufferConfig->setProperty("factor", 1.0f / config.resolutionScale);
113113 }
114114
115−const 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−
127115 void RenderDeferredTask::build(JobModel& task, const render::Varying& input, render::Varying& output, bool renderShadows) {
128116 const auto& inputs = input.get<Input>();
129117 const auto& fetchedItems = inputs.get0();
@@ -220,7 +208,7 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren · 90 unmodified lines
220208
221209 // Light Clustering
222210 // 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();
224212 const auto lightClusters = task.addJob<LightClusteringPass>("LightClustering", lightClusteringPassInputs);
225213
226214 // 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
239227 const auto transparentsInputs = DrawDeferred::Inputs(transparents, hazeFrame, lightFrame, lightingModel, lightClusters, jitter).asVarying();
240228 task.addJob<DrawDeferred>("DrawTransparentDeferred", transparentsInputs, shapePlumber);
241229
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−
248230 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);
252231
253232 const auto outlineInputs = DrawHighlightTask::Inputs(items, deferredFramebuffer, lightingFramebuffer, deferredFrameTransform, jitter).asVarying();
254233 task.addJob<DrawHighlightTask>("DrawHighlight", outlineInputs);
@@ -277,7 +256,7 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren · 22 unmodified lines
277256
278257 // Debugging task is happening in the "over" layer after tone mapping and just before HUD
279258 { // 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();
281260 task.addJob<RenderDeferredTaskDebug>("DebugRenderDeferredTask", debugInputs);
282261 }
283262
@@ -308,9 +287,6 @@ void RenderDeferredTaskDebug::configure(const Config& config) { · 24 unmodified lines
308287 }*/
309288
310289 void 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
314290
315291 const auto& inputs = input.get<Input>();
316292
@@ -334,18 +310,23 @@ void RenderDeferredTaskDebug::build(JobModel& task, const render::Varying& input · 17 unmodified lines
334310 // RenderShadowTask out
335311 const auto& renderShadowTaskOut = inputs[1];
336312
337− // Zones
338− const auto& zones = inputs[2];
313+ // Extract the Lighting Stages Current frame ( and zones)
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];
339324
340− // Selected objects
341− const auto& selectedItems = inputs[3];
325+ // Light CLuster
326+ const auto& lightClusters = inputs[3];
342327
343− // Stage current frames
344− const auto& stageCurrentFrames = inputs.get4();//[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];
328+ // linear Depth Target
329+ const auto& linearDepthTarget = inputs[4];
349330
350331 // PrepareDeferred out
351332 const auto& deferredFramebuffer = inputs[5];
@@ -360,6 +341,14 @@ void RenderDeferredTaskDebug::build(JobModel& task, const render::Varying& input · 8 unmodified lines
360341 const auto& lightingModel = inputs[8];
361342
362343
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+
363352 { // Debug the bounds of the rendered items, still look at the zbuffer
364353 task.addJob<DrawBounds>("DrawMetaBounds", metas);
365354 task.addJob<DrawBounds>("DrawOpaqueBounds", opaques);
@@ -383,6 +372,19 @@ void RenderDeferredTaskDebug::build(JobModel& task, const render::Varying& input · 17 unmodified lines
383372 task.addJob<DrawAABox>(jobName, shadowBBox, glm::vec3(1.0f, tint, 0.0f));
384373 }
385374 }
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);
386388
387389 // Render.getConfig("RenderMainView.DrawSelectionBounds").enabled = true
388390 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