Showing the changes to libraries/render-utils/src/RenderShadowTask.cpp (1 of 81 files). Show all
Unified · Split
| @@ -46,15 +46,16 @@ void RenderShadowTask::configure(const Config& configuration) { · 45 unmodified lines | ||
| 46 | 46 | |
| 47 | 47 | void RenderShadowTask::build(JobModel& task, const render::Varying& input, render::Varying& output, render::CullFunctor cameraCullFunctor, uint8_t tagBits, uint8_t tagMask) { |
| 48 | 48 | // Prepare the ShapePipeline |
| 49 | − ShapePlumberPointer shapePlumber = std::make_shared<ShapePlumber>(); | |
| 50 | − { | |
| 49 | + static ShapePlumberPointer shapePlumber = std::make_shared<ShapePlumber>(); | |
| 50 | + static std::once_flag once; | |
| 51 | + std::call_once(once, [] { | |
| 51 | 52 | auto state = std::make_shared<gpu::State>(); |
| 52 | 53 | state->setCullMode(gpu::State::CULL_BACK); |
| 53 | 54 | state->setDepthTest(true, true, gpu::LESS_EQUAL); |
| 54 | 55 | |
| 55 | 56 | auto fadeEffect = DependencyManager::get<FadeEffect>(); |
| 56 | 57 | initZPassPipelines(*shapePlumber, state, fadeEffect->getBatchSetter(), fadeEffect->getItemUniformSetter()); |
| 57 | − } | |
| 58 | + }); | |
| 58 | 59 | const auto setupOutput = task.addJob<RenderShadowSetup>("ShadowSetup", input); |
| 59 | 60 | const auto queryResolution = setupOutput.getN<RenderShadowSetup::Output>(1); |
| 60 | 61 | const auto shadowFrame = setupOutput.getN<RenderShadowSetup::Output>(3); |