mirror of
https://github.com/lubosz/overte.git
synced 2025-08-08 03:08:00 +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 "MainWindow.h"
|
||||||
#include "Snapshot.h"
|
#include "Snapshot.h"
|
||||||
#include "SnapshotUploader.h"
|
#include "SnapshotUploader.h"
|
||||||
#include "ToneMapAndResampleTask.h"
|
|
||||||
|
|
||||||
// filename format: hifi-snap-by-%username%-on-%date%_%time%_@-%location%.jpg
|
// filename format: hifi-snap-by-%username%-on-%date%_%time%_@-%location%.jpg
|
||||||
// %1 <= username, %2 <= date and time, %3 <= current location
|
// %1 <= username, %2 <= date and time, %3 <= current location
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
#include <shaders/Shaders.h>
|
#include <shaders/Shaders.h>
|
||||||
|
|
||||||
#include <render/BlurTask.h>
|
#include <render/BlurTask.h>
|
||||||
#include "ToneMapAndResampleTask.h"
|
|
||||||
#include "render-utils/ShaderConstants.h"
|
#include "render-utils/ShaderConstants.h"
|
||||||
|
|
||||||
#define BLOOM_BLUR_LEVEL_COUNT 3
|
#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;
|
RenderArgs* args = renderContext->args;
|
||||||
// auto frameSize = input;
|
|
||||||
glm::uvec2 frameSize(args->_viewport.z, args->_viewport.w);
|
glm::uvec2 frameSize(args->_viewport.z, args->_viewport.w);
|
||||||
output.reset();
|
output.reset();
|
||||||
|
|
||||||
|
@ -160,7 +163,7 @@ void NewFramebuffer::run(const render::RenderContextPointer& renderContext, cons
|
||||||
|
|
||||||
if (!_outputFramebuffer) {
|
if (!_outputFramebuffer) {
|
||||||
_outputFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("newFramebuffer.out"));
|
_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 defaultSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_LINEAR);
|
||||||
auto colorTexture = gpu::Texture::createRenderBuffer(colorFormat, frameSize.x, frameSize.y, gpu::Texture::SINGLE_MIP, defaultSampler);
|
auto colorTexture = gpu::Texture::createRenderBuffer(colorFormat, frameSize.x, frameSize.y, gpu::Texture::SINGLE_MIP, defaultSampler);
|
||||||
_outputFramebuffer->setRenderBuffer(0, colorTexture);
|
_outputFramebuffer->setRenderBuffer(0, colorTexture);
|
||||||
|
@ -189,7 +192,7 @@ void NewOrDefaultFramebuffer::run(const render::RenderContextPointer& renderCont
|
||||||
|
|
||||||
if (!_outputFramebuffer) {
|
if (!_outputFramebuffer) {
|
||||||
_outputFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("newOrDefaultFramebuffer.out"));
|
_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 defaultSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_LINEAR);
|
||||||
auto colorTexture = gpu::Texture::createRenderBuffer(colorFormat, frameSize.x, frameSize.y, gpu::Texture::SINGLE_MIP, defaultSampler);
|
auto colorTexture = gpu::Texture::createRenderBuffer(colorFormat, frameSize.x, frameSize.y, gpu::Texture::SINGLE_MIP, defaultSampler);
|
||||||
_outputFramebuffer->setRenderBuffer(0, colorTexture);
|
_outputFramebuffer->setRenderBuffer(0, colorTexture);
|
||||||
|
|
|
@ -85,11 +85,14 @@ public:
|
||||||
|
|
||||||
class NewFramebuffer {
|
class NewFramebuffer {
|
||||||
public:
|
public:
|
||||||
using Input = glm::uvec2;
|
|
||||||
using Output = gpu::FramebufferPointer;
|
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:
|
private:
|
||||||
gpu::FramebufferPointer _outputFramebuffer;
|
gpu::FramebufferPointer _outputFramebuffer;
|
||||||
};
|
};
|
||||||
|
|
|
@ -241,7 +241,7 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren
|
||||||
|
|
||||||
// Lighting Buffer ready for tone mapping
|
// Lighting Buffer ready for tone mapping
|
||||||
const auto toneMappingInputs = ToneMapAndResample::Input(lightingFramebuffer, destFramebuffer).asVarying();
|
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
|
// 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
|
{ // 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);
|
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 resolveInputs = ResolveFramebuffer::Inputs(scaledPrimaryFramebuffer, newResolvedFramebuffer).asVarying();
|
||||||
const auto resolvedFramebuffer = task.addJob<ResolveFramebuffer>("Resolve", resolveInputs);
|
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 destFramebuffer = static_cast<gpu::FramebufferPointer>(nullptr);
|
||||||
|
|
||||||
const auto toneMappingInputs = ToneMapAndResample::Input(resolvedFramebuffer, destFramebuffer).asVarying();
|
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
|
// HUD Layer
|
||||||
const auto renderHUDLayerInputs = RenderHUDLayerTask::Input(toneMappedBuffer, lightingModel, hudOpaque, hudTransparent, hazeFrame).asVarying();
|
const auto renderHUDLayerInputs = RenderHUDLayerTask::Input(toneMappedBuffer, lightingModel, hudOpaque, hudTransparent, hazeFrame).asVarying();
|
||||||
task.addJob<RenderHUDLayerTask>("RenderHUDLayer", renderHUDLayerInputs);
|
task.addJob<RenderHUDLayerTask>("RenderHUDLayer", renderHUDLayerInputs);
|
||||||
|
|
|
@ -68,13 +68,13 @@ void ToneMapAndResample::run(const RenderContextPointer& renderContext, const In
|
||||||
RenderArgs* args = renderContext->args;
|
RenderArgs* args = renderContext->args;
|
||||||
|
|
||||||
auto lightingBuffer = input.get0()->getRenderBuffer(0);
|
auto lightingBuffer = input.get0()->getRenderBuffer(0);
|
||||||
auto resampledFramebuffer = input.get1();
|
auto destinationFramebuffer = input.get1();
|
||||||
|
|
||||||
if (!resampledFramebuffer) {
|
if (!destinationFramebuffer) {
|
||||||
resampledFramebuffer = args->_blitFramebuffer;
|
destinationFramebuffer = args->_blitFramebuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!lightingBuffer || !resampledFramebuffer) {
|
if (!lightingBuffer || !destinationFramebuffer) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ void ToneMapAndResample::run(const RenderContextPointer& renderContext, const In
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto bufferSize = resampledFramebuffer->getSize();
|
const auto bufferSize = destinationFramebuffer->getSize();
|
||||||
|
|
||||||
auto srcBufferSize = glm::ivec2(lightingBuffer->getDimensions());
|
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) {
|
gpu::doInBatch("Resample::run", args->_context, [&](gpu::Batch& batch) {
|
||||||
batch.enableStereo(false);
|
batch.enableStereo(false);
|
||||||
batch.setFramebuffer(resampledFramebuffer);
|
batch.setFramebuffer(destinationFramebuffer);
|
||||||
|
|
||||||
batch.setViewportTransform(destViewport);
|
batch.setViewportTransform(destViewport);
|
||||||
batch.setProjectionTransform(glm::mat4());
|
batch.setProjectionTransform(glm::mat4());
|
||||||
|
@ -106,5 +106,5 @@ void ToneMapAndResample::run(const RenderContextPointer& renderContext, const In
|
||||||
// Set full final viewport
|
// Set full final viewport
|
||||||
args->_viewport = destViewport;
|
args->_viewport = destViewport;
|
||||||
|
|
||||||
output = resampledFramebuffer;
|
output = destinationFramebuffer;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue