Showing the changes to libraries/render-utils/src/RenderDeferredTask.cpp (1 of 81 files). Show all
Unified · Split
| @@ -100,11 +100,14 @@ void RenderDeferredTask::configure(const Config& config) { · 99 unmodified lines | |||
| 100 | preparePrimaryBufferConfig->setResolutionScale(config.resolutionScale); | 100 | preparePrimaryBufferConfig->setResolutionScale(config.resolutionScale); |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | void RenderDeferredTask::build(JobModel& task, const render::Varying& input, render::Varying& output) { | 103 | void RenderDeferredTask::build(JobModel& task, const render::Varying& input, render::Varying& output, render::CullFunctor cullFunctor, size_t depth) { |
| 104 | auto fadeEffect = DependencyManager::get<FadeEffect>(); | 104 | static auto fadeEffect = DependencyManager::get<FadeEffect>(); |
| 105 | // Prepare the ShapePipelines | 105 | // Prepare the ShapePipelines |
| 106 | ShapePlumberPointer shapePlumber = std::make_shared<ShapePlumber>(); | 106 | static ShapePlumberPointer shapePlumber = std::make_shared<ShapePlumber>(); |
| 107 | initDeferredPipelines(*shapePlumber, fadeEffect->getBatchSetter(), fadeEffect->getItemUniformSetter()); | 107 | static std::once_flag once; |
| 108 | std::call_once(once, [] { | ||
| 109 | initDeferredPipelines(*shapePlumber, fadeEffect->getBatchSetter(), fadeEffect->getItemUniformSetter()); | ||
| 110 | }); | ||
| 108 | 111 | ||
| 109 | const auto& inputs = input.get<Input>(); | 112 | const auto& inputs = input.get<Input>(); |
| 110 | 113 | ||
| @@ -116,6 +119,7 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren · 5 unmodified lines | |||
| 116 | // Extract opaques / transparents / lights / metas / layered / background | 119 | // Extract opaques / transparents / lights / metas / layered / background |
| 117 | const auto& opaques = items[RenderFetchCullSortTask::OPAQUE_SHAPE]; | 120 | const auto& opaques = items[RenderFetchCullSortTask::OPAQUE_SHAPE]; |
| 118 | const auto& transparents = items[RenderFetchCullSortTask::TRANSPARENT_SHAPE]; | 121 | const auto& transparents = items[RenderFetchCullSortTask::TRANSPARENT_SHAPE]; |
| 122 | const auto& mirrors = items[RenderFetchCullSortTask::MIRROR]; | ||
| 119 | const auto& inFrontOpaque = items[RenderFetchCullSortTask::LAYER_FRONT_OPAQUE_SHAPE]; | 123 | const auto& inFrontOpaque = items[RenderFetchCullSortTask::LAYER_FRONT_OPAQUE_SHAPE]; |
| 120 | const auto& inFrontTransparent = items[RenderFetchCullSortTask::LAYER_FRONT_TRANSPARENT_SHAPE]; | 124 | const auto& inFrontTransparent = items[RenderFetchCullSortTask::LAYER_FRONT_TRANSPARENT_SHAPE]; |
| 121 | const auto& hudOpaque = items[RenderFetchCullSortTask::LAYER_HUD_OPAQUE_SHAPE]; | 125 | const auto& hudOpaque = items[RenderFetchCullSortTask::LAYER_HUD_OPAQUE_SHAPE]; |
| @@ -139,7 +143,6 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren · 17 unmodified lines | |||
| 139 | // Shadow Stage Frame | 143 | // Shadow Stage Frame |
| 140 | const auto shadowFrame = shadowTaskOutputs[1]; | 144 | const auto shadowFrame = shadowTaskOutputs[1]; |
| 141 | 145 | ||
| 142 | |||
| 143 | fadeEffect->build(task, opaques); | 146 | fadeEffect->build(task, opaques); |
| 144 | 147 | ||
| 145 | const auto jitter = task.addJob<JitterSample>("JitterCam"); | 148 | const auto jitter = task.addJob<JitterSample>("JitterCam"); |
| @@ -154,6 +157,7 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren · 8 unmodified lines | |||
| 154 | const auto prepareDeferredOutputs = task.addJob<PrepareDeferred>("PrepareDeferred", prepareDeferredInputs); | 157 | const auto prepareDeferredOutputs = task.addJob<PrepareDeferred>("PrepareDeferred", prepareDeferredInputs); |
| 155 | const auto deferredFramebuffer = prepareDeferredOutputs.getN<PrepareDeferred::Outputs>(0); | 158 | const auto deferredFramebuffer = prepareDeferredOutputs.getN<PrepareDeferred::Outputs>(0); |
| 156 | const auto lightingFramebuffer = prepareDeferredOutputs.getN<PrepareDeferred::Outputs>(1); | 159 | const auto lightingFramebuffer = prepareDeferredOutputs.getN<PrepareDeferred::Outputs>(1); |
| 160 | const auto mirrorTargetFramebuffer = prepareDeferredOutputs.getN<PrepareDeferred::Outputs>(2); | ||
| 157 | 161 | ||
| 158 | // draw a stencil mask in hidden regions of the framebuffer. | 162 | // draw a stencil mask in hidden regions of the framebuffer. |
| 159 | task.addJob<PrepareStencil>("PrepareStencil", scaledPrimaryFramebuffer); | 163 | task.addJob<PrepareStencil>("PrepareStencil", scaledPrimaryFramebuffer); |
| @@ -162,6 +166,13 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren · 2 unmodified lines | |||
| 162 | const auto opaqueInputs = DrawStateSortDeferred::Inputs(opaques, lightingModel, jitter).asVarying(); | 166 | const auto opaqueInputs = DrawStateSortDeferred::Inputs(opaques, lightingModel, jitter).asVarying(); |
| 163 | task.addJob<DrawStateSortDeferred>("DrawOpaqueDeferred", opaqueInputs, shapePlumber); | 167 | task.addJob<DrawStateSortDeferred>("DrawOpaqueDeferred", opaqueInputs, shapePlumber); |
| 164 | 168 | ||
| 169 | if (depth < RenderMirrorTask::MAX_MIRROR_DEPTH) { | ||
| 170 | const auto mirrorInputs = RenderMirrorTask::Inputs(mirrors, mirrorTargetFramebuffer, jitter).asVarying(); | ||
| 171 | for (size_t i = 0; i < RenderMirrorTask::MAX_MIRRORS_PER_LEVEL; i++) { | ||
| 172 | task.addJob<RenderMirrorTask>("RenderMirrorTask" + std::to_string(i) + "Depth" + std::to_string(depth), mirrorInputs, i, cullFunctor, depth); | ||
| 173 | } | ||
| 174 | } | ||
| 175 | |||
| 165 | // Opaque all rendered | 176 | // Opaque all rendered |
| 166 | 177 | ||
| 167 | // Linear Depth Pass | 178 | // Linear Depth Pass |
| @@ -234,7 +245,7 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren · 66 unmodified lines | |||
| 234 | 245 | ||
| 235 | // Lighting Buffer ready for tone mapping | 246 | // Lighting Buffer ready for tone mapping |
| 236 | const auto toneMappingInputs = ToneMapAndResample::Input(lightingFramebuffer, destFramebuffer).asVarying(); | 247 | const auto toneMappingInputs = ToneMapAndResample::Input(lightingFramebuffer, destFramebuffer).asVarying(); |
| 237 | const auto toneMappedBuffer = task.addJob<ToneMapAndResample>("ToneMapping", toneMappingInputs); | 248 | const auto toneMappedBuffer = task.addJob<ToneMapAndResample>("ToneMapping", toneMappingInputs, depth); |
| 238 | 249 | ||
| 239 | // Debugging task is happening in the "over" layer after tone mapping and just before HUD | 250 | // Debugging task is happening in the "over" layer after tone mapping and just before HUD |
| 240 | { // Debug the bounds of the rendered items, still look at the zbuffer | 251 | { // Debug the bounds of the rendered items, still look at the zbuffer |
| @@ -398,8 +409,12 @@ void RenderDeferredTaskDebug::build(JobModel& task, const render::Varying& input · 157 unmodified lines | |||
| 398 | // Status icon rendering job | 409 | // Status icon rendering job |
| 399 | { | 410 | { |
| 400 | // Grab a texture map representing the different status icons and assign that to the drawStatusJob | 411 | // Grab a texture map representing the different status icons and assign that to the drawStatusJob |
| 401 | auto iconMapPath = PathUtils::resourcesPath() + "icons/statusIconAtlas.svg"; | 412 | static gpu::TexturePointer statusIconMap; |
| 402 | auto statusIconMap = DependencyManager::get<TextureCache>()->getImageTexture(iconMapPath, image::TextureUsage::STRICT_TEXTURE); | 413 | static std::once_flag once; |
| 414 | std::call_once(once, [] { | ||
| 415 | auto iconMapPath = PathUtils::resourcesPath() + "icons/statusIconAtlas.svg"; | ||
| 416 | statusIconMap = DependencyManager::get<TextureCache>()->getImageTexture(iconMapPath, image::TextureUsage::STRICT_TEXTURE); | ||
| 417 | }); | ||
| 403 | const auto drawStatusInputs = DrawStatus::Input(opaques, jitter).asVarying(); | 418 | const auto drawStatusInputs = DrawStatus::Input(opaques, jitter).asVarying(); |
| 404 | task.addJob<DrawStatus>("DrawStatus", drawStatusInputs, DrawStatus(statusIconMap)); | 419 | task.addJob<DrawStatus>("DrawStatus", drawStatusInputs, DrawStatus(statusIconMap)); |
| 405 | } | 420 | } |
| @@ -407,8 +422,6 @@ void RenderDeferredTaskDebug::build(JobModel& task, const render::Varying& input · 1 unmodified line | |||
| 407 | const auto debugZoneInputs = DebugZoneLighting::Inputs(deferredFrameTransform, lightFrame, backgroundFrame).asVarying(); | 422 | const auto debugZoneInputs = DebugZoneLighting::Inputs(deferredFrameTransform, lightFrame, backgroundFrame).asVarying(); |
| 408 | task.addJob<DebugZoneLighting>("DrawZoneStack", debugZoneInputs); | 423 | task.addJob<DebugZoneLighting>("DrawZoneStack", debugZoneInputs); |
| 409 | } | 424 | } |
| 410 | |||
| 411 | |||
| 412 | } | 425 | } |
| 413 | 426 | ||
| 414 | gpu::FramebufferPointer PreparePrimaryFramebuffer::createFramebuffer(const char* name, const glm::uvec2& frameSize) { | 427 | gpu::FramebufferPointer PreparePrimaryFramebuffer::createFramebuffer(const char* name, const glm::uvec2& frameSize) { |