History

Separate scale between 3D rendering and HUD

Olivier Prat committed 8 years ago

Commit 703fc201 parent 9f4fd477 files · +173 −25Browse files

Showing the changes to libraries/render-utils/src/RenderDeferredTask.cpp (1 of 7 files). Show all

Unified · Split

libraries/render-utils/src/RenderDeferredTask.cpp+16−6
@@ -26,6 +26,7 @@ · 25 unmodified lines
2626 #include <render/DrawStatus.h>
2727 #include <render/DrawSceneOctree.h>
2828 #include <render/BlurTask.h>
29+#include <render/ResampleTask.h>
2930
3031 #include "RenderHifi.h"
3132 #include "RenderCommonTask.h"
@@ -59,8 +60,14 @@ RenderDeferredTask::RenderDeferredTask() · 27 unmodified lines
5960 {
6061 }
6162
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);
6471 }
6572
6673 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
103110
104111
105112 // 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");
107114
108115 const auto opaqueRangeTimer = task.addJob<BeginGPURangeTimer>("BeginOpaqueRangeTimer", "DrawOpaques");
109116
110− const auto prepareDeferredInputs = PrepareDeferred::Inputs(primaryFramebuffer, lightingModel).asVarying();
117+ const auto prepareDeferredInputs = PrepareDeferred::Inputs(scaledPrimaryFramebuffer, lightingModel).asVarying();
111118 const auto prepareDeferredOutputs = task.addJob<PrepareDeferred>("PrepareDeferred", prepareDeferredInputs);
112119 const auto deferredFramebuffer = prepareDeferredOutputs.getN<PrepareDeferred::Outputs>(0);
113120 const auto lightingFramebuffer = prepareDeferredOutputs.getN<PrepareDeferred::Outputs>(1);
114121
115122 // draw a stencil mask in hidden regions of the framebuffer.
116− task.addJob<PrepareStencil>("PrepareStencil", primaryFramebuffer);
123+ task.addJob<PrepareStencil>("PrepareStencil", scaledPrimaryFramebuffer);
117124
118125 // Render opaque objects in DeferredBuffer
119126 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
223230 task.addJob<Bloom>("Bloom", bloomInputs);
224231
225232 // Lighting Buffer ready for tone mapping
226− const auto toneMappingInputs = ToneMappingDeferred::Inputs(lightingFramebuffer, primaryFramebuffer).asVarying();
233+ const auto toneMappingInputs = ToneMappingDeferred::Inputs(lightingFramebuffer, scaledPrimaryFramebuffer).asVarying();
227234 task.addJob<ToneMappingDeferred>("ToneMapping", toneMappingInputs);
228235
229236 { // 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
284291 task.addJob<DebugZoneLighting>("DrawZoneStack", deferredFrameTransform);
285292 }
286293
294+ // Upscale to finale resolution
295+ const auto primaryFramebuffer = task.addJob<render::Upsample>("PrimaryBufferUpscale", scaledPrimaryFramebuffer);
296+
287297 // Composite the HUD and HUD overlays
288298 task.addJob<CompositeHUD>("HUD");
289299