mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-07 09:42:23 +02:00
Address pr review comments
This commit is contained in:
parent
b0ebcc745d
commit
cb1bf57bd1
6 changed files with 8 additions and 30 deletions
|
@ -97,11 +97,8 @@ RenderDeferredTask::RenderDeferredTask()
|
|||
void RenderDeferredTask::configure(const Config& config) {
|
||||
// Propagate resolution scale to sub jobs who need it
|
||||
auto preparePrimaryBufferConfig = config.getConfig<PreparePrimaryFramebuffer>("PreparePrimaryBuffer");
|
||||
auto upsamplePrimaryBufferConfig = config.getConfig<Upsample>("PrimaryBufferUpscale");
|
||||
assert(preparePrimaryBufferConfig);
|
||||
assert(upsamplePrimaryBufferConfig);
|
||||
preparePrimaryBufferConfig->setResolutionScale(config.resolutionScale);
|
||||
upsamplePrimaryBufferConfig->setProperty("factor", 1.0f / config.resolutionScale);
|
||||
}
|
||||
|
||||
void RenderDeferredTask::build(JobModel& task, const render::Varying& input, render::Varying& output) {
|
||||
|
@ -254,15 +251,11 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren
|
|||
}
|
||||
|
||||
// Upscale to finale resolution
|
||||
//const auto primaryFramebuffer = task.addJob<render::Upsample>("PrimaryBufferUpscale", toneMappedBuffer);
|
||||
const auto primaryFramebuffer = task.addJob<render::UpsampleToBlitFramebuffer>("PrimaryBufferUpscale", toneMappedBuffer);
|
||||
|
||||
// HUD Layer
|
||||
const auto renderHUDLayerInputs = RenderHUDLayerTask::Input(primaryFramebuffer, lightingModel, hudOpaque, hudTransparent).asVarying();
|
||||
task.addJob<RenderHUDLayerTask>("RenderHUDLayer", renderHUDLayerInputs);
|
||||
|
||||
// Blit!
|
||||
// task.addJob<Blit>("Blit", primaryFramebuffer);
|
||||
}
|
||||
|
||||
RenderDeferredTaskDebug::RenderDeferredTaskDebug() {
|
||||
|
|
|
@ -156,7 +156,9 @@ class PreparePrimaryFramebufferConfig : public render::Job::Config {
|
|||
public:
|
||||
float getResolutionScale() const { return resolutionScale; }
|
||||
void setResolutionScale(float scale) {
|
||||
resolutionScale = std::max(0.1f, std::min(2.0f, scale));
|
||||
const float SCALE_RANGE_MIN = 0.1f;
|
||||
const float SCALE_RANGE_MAX = 2.0f;
|
||||
resolutionScale = std::max(SCALE_RANGE_MIN, std::min(SCALE_RANGE_MAX, scale));
|
||||
}
|
||||
|
||||
signals:
|
||||
|
|
|
@ -52,11 +52,8 @@ extern void initForwardPipelines(ShapePlumber& plumber);
|
|||
void RenderForwardTask::configure(const Config& config) {
|
||||
// Propagate resolution scale to sub jobs who need it
|
||||
auto preparePrimaryBufferConfig = config.getConfig<PreparePrimaryFramebufferMSAA>("PreparePrimaryBuffer");
|
||||
auto upsamplePrimaryBufferConfig = config.getConfig<UpsampleToBlitFramebuffer>("PrimaryBufferUpscale");
|
||||
assert(preparePrimaryBufferConfig);
|
||||
assert(upsamplePrimaryBufferConfig);
|
||||
preparePrimaryBufferConfig->setResolutionScale(config.resolutionScale);
|
||||
upsamplePrimaryBufferConfig->setProperty("factor", 1.0f / config.resolutionScale);
|
||||
}
|
||||
|
||||
void RenderForwardTask::build(JobModel& task, const render::Varying& input, render::Varying& output) {
|
||||
|
@ -172,10 +169,6 @@ void RenderForwardTask::build(JobModel& task, const render::Varying& input, rend
|
|||
// HUD Layer
|
||||
const auto renderHUDLayerInputs = RenderHUDLayerTask::Input(primaryFramebuffer, lightingModel, hudOpaque, hudTransparent).asVarying();
|
||||
task.addJob<RenderHUDLayerTask>("RenderHUDLayer", renderHUDLayerInputs);
|
||||
|
||||
// Disable blit because we do tonemapping and compositing directly to the blit FBO
|
||||
// Blit!
|
||||
// task.addJob<Blit>("Blit", primaryFramebuffer);
|
||||
}
|
||||
|
||||
gpu::FramebufferPointer PreparePrimaryFramebufferMSAA::createFramebuffer(const char* name, const glm::uvec2& frameSize, int numSamples) {
|
||||
|
|
|
@ -47,7 +47,9 @@ class PreparePrimaryFramebufferMSAAConfig : public render::Job::Config {
|
|||
public:
|
||||
float getResolutionScale() const { return resolutionScale; }
|
||||
void setResolutionScale(float scale) {
|
||||
resolutionScale = std::max(0.1f, std::min(2.0f, scale));
|
||||
const float SCALE_RANGE_MIN = 0.1f;
|
||||
const float SCALE_RANGE_MAX = 2.0f;
|
||||
resolutionScale = std::max(SCALE_RANGE_MIN, std::min(SCALE_RANGE_MAX, scale));
|
||||
}
|
||||
|
||||
int getNumSamples() const { return numSamples; }
|
||||
|
|
|
@ -138,19 +138,12 @@ void Upsample::run(const RenderContextPointer& renderContext, const gpu::Framebu
|
|||
|
||||
gpu::PipelinePointer UpsampleToBlitFramebuffer::_pipeline;
|
||||
|
||||
void UpsampleToBlitFramebuffer::configure(const Config& config) {
|
||||
_factor = config.factor;
|
||||
}
|
||||
|
||||
void UpsampleToBlitFramebuffer::run(const RenderContextPointer& renderContext, const Input& input, gpu::FramebufferPointer& resampledFrameBuffer) {
|
||||
assert(renderContext->args);
|
||||
assert(renderContext->args->hasViewFrustum());
|
||||
RenderArgs* args = renderContext->args;
|
||||
auto sourceFramebuffer = input;
|
||||
// auto srcFramebuffer = input.get0();
|
||||
// auto dstFramebuffer = input.get1();
|
||||
|
||||
// resampledFrameBuffer = getResampledFrameBuffer(sourceFramebuffer);
|
||||
resampledFrameBuffer = args->_blitFramebuffer;
|
||||
|
||||
if (resampledFrameBuffer != sourceFramebuffer) {
|
||||
|
|
|
@ -70,21 +70,16 @@ namespace render {
|
|||
|
||||
class UpsampleToBlitFramebuffer {
|
||||
public:
|
||||
// using Input = render::VaryingSet2<gpu::FramebufferPointer, gpu::FramebufferPointer>;
|
||||
using Input = gpu::FramebufferPointer;
|
||||
using Config = UpsampleConfig;
|
||||
using JobModel = Job::ModelIO<UpsampleToBlitFramebuffer, Input, gpu::FramebufferPointer, Config>;
|
||||
using JobModel = Job::ModelIO<UpsampleToBlitFramebuffer, Input, gpu::FramebufferPointer>;
|
||||
|
||||
UpsampleToBlitFramebuffer(float factor = 2.0f) : _factor{ factor } {}
|
||||
UpsampleToBlitFramebuffer() {}
|
||||
|
||||
void configure(const Config& config);
|
||||
void run(const RenderContextPointer& renderContext, const Input& input, gpu::FramebufferPointer& resampledFrameBuffer);
|
||||
|
||||
protected:
|
||||
|
||||
static gpu::PipelinePointer _pipeline;
|
||||
|
||||
float _factor{ 2.0f };
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue