Showing the changes to libraries/render-utils/src/RenderDeferredTask.cpp (1 of 7 files). Show all
Unified · Split
| @@ -26,6 +26,7 @@ · 25 unmodified lines | |||
| 26 | #include <render/DrawStatus.h> | 26 | #include <render/DrawStatus.h> |
| 27 | #include <render/DrawSceneOctree.h> | 27 | #include <render/DrawSceneOctree.h> |
| 28 | #include <render/BlurTask.h> | 28 | #include <render/BlurTask.h> |
| 29 | #include <render/ResampleTask.h> | ||
| 29 | 30 | ||
| 30 | #include "RenderHifi.h" | 31 | #include "RenderHifi.h" |
| 31 | #include "RenderCommonTask.h" | 32 | #include "RenderCommonTask.h" |
| @@ -59,8 +60,14 @@ RenderDeferredTask::RenderDeferredTask() · 27 unmodified lines | |||
| 59 | { | 60 | { |
| 60 | } | 61 | } |
| 61 | 62 | ||
| 62 | void RenderDeferredTask::configure(const Config& config) | 63 | void RenderDeferredTask::configure(const Config& config) { |
| 63 | { | 64 | // Propagate resolution scale to sub jobs who need it |
| 65 | auto preparePrimaryBufferConfig = config.getConfig<PreparePrimaryFramebuffer>("PreparePrimaryBuffer"); | ||
| 66 | auto upsamplePrimaryBufferConfig = config.getConfig<Upsample>("PrimaryBufferUpscale"); | ||
| 67 | assert(preparePrimaryBufferConfig); | ||
| 68 | assert(upsamplePrimaryBufferConfig); | ||
| 69 | preparePrimaryBufferConfig->setProperty("resolutionScale", config.resolutionScale); | ||
| 70 | upsamplePrimaryBufferConfig->setProperty("factor", 1.0f / config.resolutionScale); | ||
| 64 | } | 71 | } |
| 65 | 72 | ||
| 66 | const render::Varying RenderDeferredTask::addSelectItemJobs(JobModel& task, const char* selectionName, | 73 | const render::Varying RenderDeferredTask::addSelectItemJobs(JobModel& task, const char* selectionName, |
| @@ -103,17 +110,17 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren · 36 unmodified lines | |||
| 103 | 110 | ||
| 104 | 111 | ||
| 105 | // GPU jobs: Start preparing the primary, deferred and lighting buffer | 112 | // GPU jobs: Start preparing the primary, deferred and lighting buffer |
| 106 | const auto primaryFramebuffer = task.addJob<PreparePrimaryFramebuffer>("PreparePrimaryBuffer"); | 113 | const auto scaledPrimaryFramebuffer = task.addJob<PreparePrimaryFramebuffer>("PreparePrimaryBuffer"); |
| 107 | 114 | ||
| 108 | const auto opaqueRangeTimer = task.addJob<BeginGPURangeTimer>("BeginOpaqueRangeTimer", "DrawOpaques"); | 115 | const auto opaqueRangeTimer = task.addJob<BeginGPURangeTimer>("BeginOpaqueRangeTimer", "DrawOpaques"); |
| 109 | 116 | ||
| 110 | const auto prepareDeferredInputs = PrepareDeferred::Inputs(primaryFramebuffer, lightingModel).asVarying(); | 117 | const auto prepareDeferredInputs = PrepareDeferred::Inputs(scaledPrimaryFramebuffer, lightingModel).asVarying(); |
| 111 | const auto prepareDeferredOutputs = task.addJob<PrepareDeferred>("PrepareDeferred", prepareDeferredInputs); | 118 | const auto prepareDeferredOutputs = task.addJob<PrepareDeferred>("PrepareDeferred", prepareDeferredInputs); |
| 112 | const auto deferredFramebuffer = prepareDeferredOutputs.getN<PrepareDeferred::Outputs>(0); | 119 | const auto deferredFramebuffer = prepareDeferredOutputs.getN<PrepareDeferred::Outputs>(0); |
| 113 | const auto lightingFramebuffer = prepareDeferredOutputs.getN<PrepareDeferred::Outputs>(1); | 120 | const auto lightingFramebuffer = prepareDeferredOutputs.getN<PrepareDeferred::Outputs>(1); |
| 114 | 121 | ||
| 115 | // draw a stencil mask in hidden regions of the framebuffer. | 122 | // draw a stencil mask in hidden regions of the framebuffer. |
| 116 | task.addJob<PrepareStencil>("PrepareStencil", primaryFramebuffer); | 123 | task.addJob<PrepareStencil>("PrepareStencil", scaledPrimaryFramebuffer); |
| 117 | 124 | ||
| 118 | // Render opaque objects in DeferredBuffer | 125 | // Render opaque objects in DeferredBuffer |
| 119 | const auto opaqueInputs = DrawStateSortDeferred::Inputs(opaques, lightingModel, jitter).asVarying(); | 126 | const auto opaqueInputs = DrawStateSortDeferred::Inputs(opaques, lightingModel, jitter).asVarying(); |
| @@ -223,7 +230,7 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren · 103 unmodified lines | |||
| 223 | task.addJob<Bloom>("Bloom", bloomInputs); | 230 | task.addJob<Bloom>("Bloom", bloomInputs); |
| 224 | 231 | ||
| 225 | // Lighting Buffer ready for tone mapping | 232 | // Lighting Buffer ready for tone mapping |
| 226 | const auto toneMappingInputs = ToneMappingDeferred::Inputs(lightingFramebuffer, primaryFramebuffer).asVarying(); | 233 | const auto toneMappingInputs = ToneMappingDeferred::Inputs(lightingFramebuffer, scaledPrimaryFramebuffer).asVarying(); |
| 227 | task.addJob<ToneMappingDeferred>("ToneMapping", toneMappingInputs); | 234 | task.addJob<ToneMappingDeferred>("ToneMapping", toneMappingInputs); |
| 228 | 235 | ||
| 229 | { // Debug the bounds of the rendered items, still look at the zbuffer | 236 | { // Debug the bounds of the rendered items, still look at the zbuffer |
| @@ -284,6 +291,9 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren · 54 unmodified lines | |||
| 284 | task.addJob<DebugZoneLighting>("DrawZoneStack", deferredFrameTransform); | 291 | task.addJob<DebugZoneLighting>("DrawZoneStack", deferredFrameTransform); |
| 285 | } | 292 | } |
| 286 | 293 | ||
| 294 | // Upscale to finale resolution | ||
| 295 | const auto primaryFramebuffer = task.addJob<render::Upsample>("PrimaryBufferUpscale", scaledPrimaryFramebuffer); | ||
| 296 | |||
| 287 | // Composite the HUD and HUD overlays | 297 | // Composite the HUD and HUD overlays |
| 288 | task.addJob<CompositeHUD>("HUD"); | 298 | task.addJob<CompositeHUD>("HUD"); |
| 289 | 299 | ||