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 | 26 | #include <render/DrawStatus.h> |
| 27 | 27 | #include <render/DrawSceneOctree.h> |
| 28 | 28 | #include <render/BlurTask.h> |
| 29 | +#include <render/ResampleTask.h> | |
| 29 | 30 | |
| 30 | 31 | #include "RenderHifi.h" |
| 31 | 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 | −{ | |
| 63 | +void RenderDeferredTask::configure(const Config& config) { | |
| 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 | 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 | 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 | 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 | 118 | const auto prepareDeferredOutputs = task.addJob<PrepareDeferred>("PrepareDeferred", prepareDeferredInputs); |
| 112 | 119 | const auto deferredFramebuffer = prepareDeferredOutputs.getN<PrepareDeferred::Outputs>(0); |
| 113 | 120 | const auto lightingFramebuffer = prepareDeferredOutputs.getN<PrepareDeferred::Outputs>(1); |
| 114 | 121 | |
| 115 | 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 | 125 | // Render opaque objects in DeferredBuffer |
| 119 | 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 | 230 | task.addJob<Bloom>("Bloom", bloomInputs); |
| 224 | 231 | |
| 225 | 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 | 234 | task.addJob<ToneMappingDeferred>("ToneMapping", toneMappingInputs); |
| 228 | 235 | |
| 229 | 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 | 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 | 297 | // Composite the HUD and HUD overlays |
| 288 | 298 | task.addJob<CompositeHUD>("HUD"); |
| 289 | 299 | |