History

Debug fade management moved out of the inner render loop

Olivier Prat committed 9 years ago

Commit e7eca771 parent 1936c203 files · +36 −32Browse files

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

Unified · Split

libraries/render-utils/src/RenderDeferredTask.cpp+34−30
@@ -252,6 +252,15 @@ void DrawDeferred::run(const RenderContextPointer& renderContext, const Inputs& · 251 unmodified lines
252252 const auto& lightingModel = inputs.get1();
253253
254254 RenderArgs* args = renderContext->args;
255+ ShapeKey::Builder defaultKeyBuilder;
256+
257+ if (_debugFade) {
258+ args->_debugFlags = static_cast<RenderArgs::DebugFlags>(args->_debugFlags |
259+ static_cast<int>(RenderArgs::RENDER_DEBUG_FADE));
260+ args->_debugFadePercent = _debugFadePercent;
261+ // Force fade for everyone
262+ defaultKeyBuilder.withFade();
263+ }
255264
256265 gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
257266 args->_batch = &batch;
@@ -272,19 +281,12 @@ void DrawDeferred::run(const RenderContextPointer& renderContext, const Inputs& · 14 unmodified lines
272281 batch.setUniformBuffer(render::ShapePipeline::Slot::LIGHTING_MODEL, lightingModel->getParametersBuffer());
273282
274283 // From the lighting model define a global shapKey ORED with individiual keys
275− ShapeKey::Builder keyBuilder;
284+ ShapeKey::Builder keyBuilder = defaultKeyBuilder;
276285 if (lightingModel->isWireframeEnabled()) {
277286 keyBuilder.withWireframe();
278287 }
279288 // Prepare fade effect
280289 batch.setResourceTexture(ShapePipeline::Slot::MAP::FADE_MASK, _fadeMaskMap);
281− if (_debugFade) {
282− args->_debugFlags = static_cast<RenderArgs::DebugFlags>(args->_debugFlags |
283− static_cast<int>(RenderArgs::RENDER_DEBUG_FADE));
284− args->_debugFadePercent = _debugFadePercent;
285− // Force fade for everyone
286− keyBuilder.withFade();
287− }
288290
289291 ShapeKey globalKey = keyBuilder.build();
290292 args->_globalShapeKey = globalKey._flags.to_ulong();
@@ -293,15 +295,15 @@ void DrawDeferred::run(const RenderContextPointer& renderContext, const Inputs& · 2 unmodified lines
293295
294296 args->_batch = nullptr;
295297 args->_globalShapeKey = 0;
296−
297− // Not sure this is really needed...
298− if (_debugFade) {
299− // Turn off fade debug
300− args->_debugFlags = static_cast<RenderArgs::DebugFlags>(args->_debugFlags &
301− ~static_cast<int>(RenderArgs::RENDER_DEBUG_FADE));
302− }
303298 });
304299
300+ // Not sure this is really needed...
301+ if (_debugFade) {
302+ // Turn off fade debug
303+ args->_debugFlags = static_cast<RenderArgs::DebugFlags>(args->_debugFlags &
304+ ~static_cast<int>(RenderArgs::RENDER_DEBUG_FADE));
305+ }
306+
305307 config->setNumDrawn((int)inItems.size());
306308 }
307309
@@ -315,6 +317,15 @@ void DrawStateSortDeferred::run(const RenderContextPointer& renderContext, const · 7 unmodified lines
315317 const auto& lightingModel = inputs.get1();
316318
317319 RenderArgs* args = renderContext->args;
320+ ShapeKey::Builder defaultKeyBuilder;
321+
322+ if (_debugFade) {
323+ args->_debugFlags = static_cast<RenderArgs::DebugFlags>(args->_debugFlags |
324+ static_cast<int>(RenderArgs::RENDER_DEBUG_FADE));
325+ args->_debugFadePercent = _debugFadePercent;
326+ // Force fade for everyone
327+ defaultKeyBuilder.withFade();
328+ }
318329
319330 gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
320331 args->_batch = &batch;
@@ -335,20 +346,13 @@ void DrawStateSortDeferred::run(const RenderContextPointer& renderContext, const · 14 unmodified lines
335346 batch.setUniformBuffer(render::ShapePipeline::Slot::LIGHTING_MODEL, lightingModel->getParametersBuffer());
336347
337348 // From the lighting model define a global shapeKey ORED with individiual keys
338− ShapeKey::Builder keyBuilder;
349+ ShapeKey::Builder keyBuilder = defaultKeyBuilder;
339350 if (lightingModel->isWireframeEnabled()) {
340351 keyBuilder.withWireframe();
341352 }
342353
343354 // Prepare fade effect
344355 batch.setResourceTexture(ShapePipeline::Slot::MAP::FADE_MASK, _fadeMaskMap);
345− if (_debugFade) {
346− args->_debugFlags = static_cast<RenderArgs::DebugFlags>(args->_debugFlags |
347− static_cast<int>(RenderArgs::RENDER_DEBUG_FADE));
348− args->_debugFadePercent = _debugFadePercent;
349− // Force fade for everyone
350− keyBuilder.withFade();
351− }
352356
353357 ShapeKey globalKey = keyBuilder.build();
354358 args->_globalShapeKey = globalKey._flags.to_ulong();
@@ -360,15 +364,15 @@ void DrawStateSortDeferred::run(const RenderContextPointer& renderContext, const · 5 unmodified lines
360364 }
361365 args->_batch = nullptr;
362366 args->_globalShapeKey = 0;
363−
364− // Not sure this is really needed...
365− if (_debugFade) {
366− // Turn off fade debug
367− args->_debugFlags = static_cast<RenderArgs::DebugFlags>(args->_debugFlags &
368− ~static_cast<int>(RenderArgs::RENDER_DEBUG_FADE));
369− }
370367 });
371368
369+ // Not sure this is really needed...
370+ if (_debugFade) {
371+ // Turn off fade debug
372+ args->_debugFlags = static_cast<RenderArgs::DebugFlags>(args->_debugFlags &
373+ ~static_cast<int>(RenderArgs::RENDER_DEBUG_FADE));
374+ }
375+
372376 config->setNumDrawn((int)inItems.size());
373377 }
374378

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