Showing the changes to libraries/render-utils/src/RenderDeferredTask.cpp (1 of 3 files). Show all
Unified · Split
| @@ -252,6 +252,15 @@ void DrawDeferred::run(const RenderContextPointer& renderContext, const Inputs& · 251 unmodified lines | |||
| 252 | const auto& lightingModel = inputs.get1(); | 252 | const auto& lightingModel = inputs.get1(); |
| 253 | 253 | ||
| 254 | RenderArgs* args = renderContext->args; | 254 | 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 | } | ||
| 255 | 264 | ||
| 256 | gpu::doInBatch(args->_context, [&](gpu::Batch& batch) { | 265 | gpu::doInBatch(args->_context, [&](gpu::Batch& batch) { |
| 257 | args->_batch = &batch; | 266 | args->_batch = &batch; |
| @@ -272,19 +281,12 @@ void DrawDeferred::run(const RenderContextPointer& renderContext, const Inputs& · 14 unmodified lines | |||
| 272 | batch.setUniformBuffer(render::ShapePipeline::Slot::LIGHTING_MODEL, lightingModel->getParametersBuffer()); | 281 | batch.setUniformBuffer(render::ShapePipeline::Slot::LIGHTING_MODEL, lightingModel->getParametersBuffer()); |
| 273 | 282 | ||
| 274 | // From the lighting model define a global shapKey ORED with individiual keys | 283 | // From the lighting model define a global shapKey ORED with individiual keys |
| 275 | ShapeKey::Builder keyBuilder; | 284 | ShapeKey::Builder keyBuilder = defaultKeyBuilder; |
| 276 | if (lightingModel->isWireframeEnabled()) { | 285 | if (lightingModel->isWireframeEnabled()) { |
| 277 | keyBuilder.withWireframe(); | 286 | keyBuilder.withWireframe(); |
| 278 | } | 287 | } |
| 279 | // Prepare fade effect | 288 | // Prepare fade effect |
| 280 | batch.setResourceTexture(ShapePipeline::Slot::MAP::FADE_MASK, _fadeMaskMap); | 289 | 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 | } | ||
| 288 | 290 | ||
| 289 | ShapeKey globalKey = keyBuilder.build(); | 291 | ShapeKey globalKey = keyBuilder.build(); |
| 290 | args->_globalShapeKey = globalKey._flags.to_ulong(); | 292 | args->_globalShapeKey = globalKey._flags.to_ulong(); |
| @@ -293,15 +295,15 @@ void DrawDeferred::run(const RenderContextPointer& renderContext, const Inputs& · 2 unmodified lines | |||
| 293 | 295 | ||
| 294 | args->_batch = nullptr; | 296 | args->_batch = nullptr; |
| 295 | args->_globalShapeKey = 0; | 297 | 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 | } | ||
| 303 | }); | 298 | }); |
| 304 | 299 | ||
| 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 | |||
| 305 | config->setNumDrawn((int)inItems.size()); | 307 | config->setNumDrawn((int)inItems.size()); |
| 306 | } | 308 | } |
| 307 | 309 | ||
| @@ -315,6 +317,15 @@ void DrawStateSortDeferred::run(const RenderContextPointer& renderContext, const · 7 unmodified lines | |||
| 315 | const auto& lightingModel = inputs.get1(); | 317 | const auto& lightingModel = inputs.get1(); |
| 316 | 318 | ||
| 317 | RenderArgs* args = renderContext->args; | 319 | 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 | } | ||
| 318 | 329 | ||
| 319 | gpu::doInBatch(args->_context, [&](gpu::Batch& batch) { | 330 | gpu::doInBatch(args->_context, [&](gpu::Batch& batch) { |
| 320 | args->_batch = &batch; | 331 | args->_batch = &batch; |
| @@ -335,20 +346,13 @@ void DrawStateSortDeferred::run(const RenderContextPointer& renderContext, const · 14 unmodified lines | |||
| 335 | batch.setUniformBuffer(render::ShapePipeline::Slot::LIGHTING_MODEL, lightingModel->getParametersBuffer()); | 346 | batch.setUniformBuffer(render::ShapePipeline::Slot::LIGHTING_MODEL, lightingModel->getParametersBuffer()); |
| 336 | 347 | ||
| 337 | // From the lighting model define a global shapeKey ORED with individiual keys | 348 | // From the lighting model define a global shapeKey ORED with individiual keys |
| 338 | ShapeKey::Builder keyBuilder; | 349 | ShapeKey::Builder keyBuilder = defaultKeyBuilder; |
| 339 | if (lightingModel->isWireframeEnabled()) { | 350 | if (lightingModel->isWireframeEnabled()) { |
| 340 | keyBuilder.withWireframe(); | 351 | keyBuilder.withWireframe(); |
| 341 | } | 352 | } |
| 342 | 353 | ||
| 343 | // Prepare fade effect | 354 | // Prepare fade effect |
| 344 | batch.setResourceTexture(ShapePipeline::Slot::MAP::FADE_MASK, _fadeMaskMap); | 355 | 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 | } | ||
| 352 | 356 | ||
| 353 | ShapeKey globalKey = keyBuilder.build(); | 357 | ShapeKey globalKey = keyBuilder.build(); |
| 354 | args->_globalShapeKey = globalKey._flags.to_ulong(); | 358 | args->_globalShapeKey = globalKey._flags.to_ulong(); |
| @@ -360,15 +364,15 @@ void DrawStateSortDeferred::run(const RenderContextPointer& renderContext, const · 5 unmodified lines | |||
| 360 | } | 364 | } |
| 361 | args->_batch = nullptr; | 365 | args->_batch = nullptr; |
| 362 | args->_globalShapeKey = 0; | 366 | 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 | } | ||
| 370 | }); | 367 | }); |
| 371 | 368 | ||
| 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 | |||
| 372 | config->setNumDrawn((int)inItems.size()); | 376 | config->setNumDrawn((int)inItems.size()); |
| 373 | } | 377 | } |
| 374 | 378 | ||