mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-16 09:08:14 +02:00
made color format for resolve FB a parameter, reverted name of tonemapping task to preserve back compatibility
This commit is contained in:
parent
0cd532a47b
commit
f58400950a
7 changed files with 23 additions and 19 deletions
|
@ -41,7 +41,6 @@
|
|||
#include "MainWindow.h"
|
||||
#include "Snapshot.h"
|
||||
#include "SnapshotUploader.h"
|
||||
#include "ToneMapAndResampleTask.h"
|
||||
|
||||
// filename format: hifi-snap-by-%username%-on-%date%_%time%_@-%location%.jpg
|
||||
// %1 <= username, %2 <= date and time, %3 <= current location
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include <shaders/Shaders.h>
|
||||
|
||||
#include <render/BlurTask.h>
|
||||
#include "ToneMapAndResampleTask.h"
|
||||
#include "render-utils/ShaderConstants.h"
|
||||
|
||||
#define BLOOM_BLUR_LEVEL_COUNT 3
|
||||
|
|
|
@ -148,9 +148,12 @@ void Blit::run(const RenderContextPointer& renderContext, const gpu::Framebuffer
|
|||
});
|
||||
}
|
||||
|
||||
void NewFramebuffer::run(const render::RenderContextPointer& renderContext, const Input& input, Output& output) {
|
||||
NewFramebuffer::NewFramebuffer(gpu::Element pixelFormat = gpu::Element::COLOR_SRGBA_32) {
|
||||
_pixelFormat = pixelFormat;
|
||||
}
|
||||
|
||||
void NewFramebuffer::run(const render::RenderContextPointer& renderContext, Output& output) {
|
||||
RenderArgs* args = renderContext->args;
|
||||
// auto frameSize = input;
|
||||
glm::uvec2 frameSize(args->_viewport.z, args->_viewport.w);
|
||||
output.reset();
|
||||
|
||||
|
@ -160,7 +163,7 @@ void NewFramebuffer::run(const render::RenderContextPointer& renderContext, cons
|
|||
|
||||
if (!_outputFramebuffer) {
|
||||
_outputFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("newFramebuffer.out"));
|
||||
auto colorFormat = gpu::Element(gpu::SCALAR, gpu::FLOAT, gpu::R11G11B10);
|
||||
auto colorFormat = _pixelFormat;
|
||||
auto defaultSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_LINEAR);
|
||||
auto colorTexture = gpu::Texture::createRenderBuffer(colorFormat, frameSize.x, frameSize.y, gpu::Texture::SINGLE_MIP, defaultSampler);
|
||||
_outputFramebuffer->setRenderBuffer(0, colorTexture);
|
||||
|
@ -189,7 +192,7 @@ void NewOrDefaultFramebuffer::run(const render::RenderContextPointer& renderCont
|
|||
|
||||
if (!_outputFramebuffer) {
|
||||
_outputFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("newOrDefaultFramebuffer.out"));
|
||||
auto colorFormat = gpu::Element(gpu::SCALAR, gpu::FLOAT, gpu::R11G11B10);
|
||||
auto colorFormat = gpu::Element::COLOR_SRGBA_32;
|
||||
auto defaultSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_LINEAR);
|
||||
auto colorTexture = gpu::Texture::createRenderBuffer(colorFormat, frameSize.x, frameSize.y, gpu::Texture::SINGLE_MIP, defaultSampler);
|
||||
_outputFramebuffer->setRenderBuffer(0, colorTexture);
|
||||
|
|
|
@ -85,11 +85,14 @@ public:
|
|||
|
||||
class NewFramebuffer {
|
||||
public:
|
||||
using Input = glm::uvec2;
|
||||
using Output = gpu::FramebufferPointer;
|
||||
using JobModel = render::Job::ModelIO<NewFramebuffer, Input, Output>;
|
||||
using JobModel = render::Job::ModelO<NewFramebuffer, Output>;
|
||||
|
||||
void run(const render::RenderContextPointer& renderContext, const Input& input, Output& output);
|
||||
NewFramebuffer(gpu::Element pixelFormat);
|
||||
|
||||
void run(const render::RenderContextPointer& renderContext, Output& output);
|
||||
protected:
|
||||
gpu::Element _pixelFormat;
|
||||
private:
|
||||
gpu::FramebufferPointer _outputFramebuffer;
|
||||
};
|
||||
|
|
|
@ -241,7 +241,7 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren
|
|||
|
||||
// Lighting Buffer ready for tone mapping
|
||||
const auto toneMappingInputs = ToneMapAndResample::Input(lightingFramebuffer, destFramebuffer).asVarying();
|
||||
const auto toneMappedBuffer = task.addJob<ToneMapAndResample>("ToneMapAndResample", toneMappingInputs);
|
||||
const auto toneMappedBuffer = task.addJob<ToneMapAndResample>("ToneMapping", toneMappingInputs);
|
||||
|
||||
// Debugging task is happening in the "over" layer after tone mapping and just before HUD
|
||||
{ // Debug the bounds of the rendered items, still look at the zbuffer
|
||||
|
|
|
@ -140,7 +140,7 @@ void RenderForwardTask::build(JobModel& task, const render::Varying& input, rend
|
|||
task.addJob<DebugZoneLighting>("DrawZoneStack", debugZoneInputs);
|
||||
}
|
||||
|
||||
const auto newResolvedFramebuffer = task.addJob<NewFramebuffer>("MakeResolvingFramebuffer");
|
||||
const auto newResolvedFramebuffer = task.addJob<NewFramebuffer>("MakeResolvingFramebuffer", gpu::Element(gpu::SCALAR, gpu::FLOAT, gpu::R11G11B10));
|
||||
|
||||
const auto resolveInputs = ResolveFramebuffer::Inputs(scaledPrimaryFramebuffer, newResolvedFramebuffer).asVarying();
|
||||
const auto resolvedFramebuffer = task.addJob<ResolveFramebuffer>("Resolve", resolveInputs);
|
||||
|
@ -148,7 +148,7 @@ void RenderForwardTask::build(JobModel& task, const render::Varying& input, rend
|
|||
const auto destFramebuffer = static_cast<gpu::FramebufferPointer>(nullptr);
|
||||
|
||||
const auto toneMappingInputs = ToneMapAndResample::Input(resolvedFramebuffer, destFramebuffer).asVarying();
|
||||
const auto toneMappedBuffer = task.addJob<ToneMapAndResample>("ToneMapAndResample", toneMappingInputs);
|
||||
const auto toneMappedBuffer = task.addJob<ToneMapAndResample>("ToneMapping", toneMappingInputs);
|
||||
// HUD Layer
|
||||
const auto renderHUDLayerInputs = RenderHUDLayerTask::Input(toneMappedBuffer, lightingModel, hudOpaque, hudTransparent, hazeFrame).asVarying();
|
||||
task.addJob<RenderHUDLayerTask>("RenderHUDLayer", renderHUDLayerInputs);
|
||||
|
|
|
@ -68,13 +68,13 @@ void ToneMapAndResample::run(const RenderContextPointer& renderContext, const In
|
|||
RenderArgs* args = renderContext->args;
|
||||
|
||||
auto lightingBuffer = input.get0()->getRenderBuffer(0);
|
||||
auto resampledFramebuffer = input.get1();
|
||||
auto destinationFramebuffer = input.get1();
|
||||
|
||||
if (!resampledFramebuffer) {
|
||||
resampledFramebuffer = args->_blitFramebuffer;
|
||||
if (!destinationFramebuffer) {
|
||||
destinationFramebuffer = args->_blitFramebuffer;
|
||||
}
|
||||
|
||||
if (!lightingBuffer || !resampledFramebuffer) {
|
||||
if (!lightingBuffer || !destinationFramebuffer) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ void ToneMapAndResample::run(const RenderContextPointer& renderContext, const In
|
|||
init();
|
||||
}
|
||||
|
||||
const auto bufferSize = resampledFramebuffer->getSize();
|
||||
const auto bufferSize = destinationFramebuffer->getSize();
|
||||
|
||||
auto srcBufferSize = glm::ivec2(lightingBuffer->getDimensions());
|
||||
|
||||
|
@ -90,7 +90,7 @@ void ToneMapAndResample::run(const RenderContextPointer& renderContext, const In
|
|||
|
||||
gpu::doInBatch("Resample::run", args->_context, [&](gpu::Batch& batch) {
|
||||
batch.enableStereo(false);
|
||||
batch.setFramebuffer(resampledFramebuffer);
|
||||
batch.setFramebuffer(destinationFramebuffer);
|
||||
|
||||
batch.setViewportTransform(destViewport);
|
||||
batch.setProjectionTransform(glm::mat4());
|
||||
|
@ -106,5 +106,5 @@ void ToneMapAndResample::run(const RenderContextPointer& renderContext, const In
|
|||
// Set full final viewport
|
||||
args->_viewport = destViewport;
|
||||
|
||||
output = resampledFramebuffer;
|
||||
output = destinationFramebuffer;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue