Removed jitter samples from shader and added name to batches in DEBUG mode to ease render debug

This commit is contained in:
Olivier Prat 2017-12-08 18:02:27 +01:00
parent 291711ee24
commit 92e1fe8e5c
43 changed files with 178 additions and 256 deletions

View file

@ -5070,10 +5070,10 @@ void Application::update(float deltaTime) {
{
QMutexLocker viewLocker(&_viewMutex);
// adjust near clip plane to account for sensor scaling.
auto adjustedProjection = glm::perspective(_viewFrustum.getFieldOfView(),
_viewFrustum.getAspectRatio(),
DEFAULT_NEAR_CLIP * sensorToWorldScale,
_viewFrustum.getFarClip());
auto adjustedProjection = glm::perspective(glm::radians(_fieldOfView.get()),
getActiveDisplayPlugin()->getRecommendedAspectRatio(),
DEFAULT_NEAR_CLIP * sensorToWorldScale,
DEFAULT_FAR_CLIP);
_viewFrustum.setProjection(adjustedProjection);
_viewFrustum.calculate();
}
@ -5095,7 +5095,7 @@ void Application::update(float deltaTime) {
resizeGL();
}
this->updateCamera(appRenderArgs._renderArgs);
updateCamera(appRenderArgs._renderArgs);
appRenderArgs._eyeToWorld = _myCamera.getTransform();
appRenderArgs._isStereo = false;

View file

@ -93,7 +93,7 @@ void Application::paintGL() {
_gpuContext->beginFrame(HMDSensorPose);
// Reset the gpu::Context Stages
// Back to the default framebuffer;
gpu::doInBatch(_gpuContext, [&](gpu::Batch& batch) {
gpu::doInBatch("Application_render::gpuContextReset", _gpuContext, [&](gpu::Batch& batch) {
batch.resetStages();
});
}

View file

@ -107,7 +107,7 @@ public:
args->_displayMode = RenderArgs::MONO;
args->_renderMode = RenderArgs::RenderMode::SECONDARY_CAMERA_RENDER_MODE;
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("SecondaryCameraJob::run", args->_context, [&](gpu::Batch& batch) {
batch.disableContextStereo();
batch.disableContextViewCorrection();
});
@ -196,7 +196,7 @@ public:
args->_displayMode = cachedArgs->_displayMode;
args->_renderMode = cachedArgs->_renderMode;
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("EndSecondaryCameraFrame::run", args->_context, [&](gpu::Batch& batch) {
batch.restoreContextStereo();
batch.restoreContextViewCorrection();
});

View file

@ -64,7 +64,7 @@ void ApplicationOverlay::renderOverlay(RenderArgs* renderArgs) {
}
// Execute the batch into our framebuffer
doInBatch(renderArgs->_context, [&](gpu::Batch& batch) {
doInBatch("ApplicationOverlay::render", renderArgs->_context, [&](gpu::Batch& batch) {
PROFILE_RANGE_BATCH(batch, "ApplicationOverlayRender");
renderArgs->_batch = &batch;
batch.enableStereo(false);

View file

@ -51,6 +51,7 @@ bool DebugHmdDisplayPlugin::internalActivate() {
}, true, _isAutoRotateEnabled);
_ipd = 0.0327499993f * 2.0f;
// Would be nice to know why the left and right projection matrices are slightly dissymetrical
_eyeProjections[0][0] = vec4{ 0.759056330, 0.000000000, 0.000000000, 0.000000000 };
_eyeProjections[0][1] = vec4{ 0.000000000, 0.682773232, 0.000000000, 0.000000000 };
_eyeProjections[0][2] = vec4{ -0.0580431037, -0.00619550655, -1.00000489, -1.00000000 };
@ -59,8 +60,9 @@ bool DebugHmdDisplayPlugin::internalActivate() {
_eyeProjections[1][1] = vec4{ 0.000000000, 0.678060353, 0.000000000, 0.000000000 };
_eyeProjections[1][2] = vec4{ 0.0578232110, -0.00669418881, -1.00000489, -1.000000000 };
_eyeProjections[1][3] = vec4{ 0.000000000, 0.000000000, -0.0800003856, 0.000000000 };
_eyeInverseProjections[0] = glm::inverse(_eyeProjections[0]);
_eyeInverseProjections[1] = glm::inverse(_eyeProjections[1]);
// No need to do so here as this will done in Parent::internalActivate
//_eyeInverseProjections[0] = glm::inverse(_eyeProjections[0]);
//_eyeInverseProjections[1] = glm::inverse(_eyeProjections[1]);
_eyeOffsets[0][3] = vec4{ -0.0327499993, 0.0, 0.0149999997, 1.0 };
_eyeOffsets[1][3] = vec4{ 0.0327499993, 0.0, 0.0149999997, 1.0 };
_renderTargetSize = { 3024, 1680 };

View file

@ -57,6 +57,18 @@ QRect HmdDisplayPlugin::getRecommendedHUDRect() const {
return CompositorHelper::VIRTUAL_SCREEN_RECOMMENDED_OVERLAY_RECT;
}
glm::mat4 HmdDisplayPlugin::getEyeToHeadTransform(Eye eye) const {
return _eyeOffsets[eye];
}
glm::mat4 HmdDisplayPlugin::getEyeProjection(Eye eye, const glm::mat4& baseProjection) const {
return _eyeProjections[eye];
}
glm::mat4 HmdDisplayPlugin::getCullingProjection(const glm::mat4& baseProjection) const {
return _cullingProjection;
}
#define DISABLE_PREVIEW_MENU_ITEM_DELAY_MS 500
bool HmdDisplayPlugin::internalActivate() {

View file

@ -26,9 +26,9 @@ public:
~HmdDisplayPlugin();
bool isHmd() const override final { return true; }
float getIPD() const override final { return _ipd; }
glm::mat4 getEyeToHeadTransform(Eye eye) const override final { return _eyeOffsets[eye]; }
glm::mat4 getEyeProjection(Eye eye, const glm::mat4& baseProjection) const override { return _eyeProjections[eye]; }
glm::mat4 getCullingProjection(const glm::mat4& baseProjection) const override { return _cullingProjection; }
glm::mat4 getEyeToHeadTransform(Eye eye) const override final;
glm::mat4 getEyeProjection(Eye eye, const glm::mat4& baseProjection) const override;
glm::mat4 getCullingProjection(const glm::mat4& baseProjection) const override;
glm::uvec2 getRecommendedUiSize() const override final;
glm::uvec2 getRecommendedRenderSize() const override final { return _renderTargetSize; }
bool isDisplayVisible() const override { return isHmdMounted(); }

View file

@ -37,7 +37,14 @@ size_t Batch::_dataMax { BATCH_PREALLOCATE_MIN };
size_t Batch::_objectsMax { BATCH_PREALLOCATE_MIN };
size_t Batch::_drawCallInfosMax { BATCH_PREALLOCATE_MIN };
Batch::Batch() {
Batch::Batch(const char* name) {
#ifdef DEBUG
if (name) {
_name = name;
}
#else
(void*)name;
#endif
_commands.reserve(_commandsMax);
_commandOffsets.reserve(_commandOffsetsMax);
_params.reserve(_paramsMax);
@ -48,6 +55,9 @@ Batch::Batch() {
Batch::Batch(const Batch& batch_) {
Batch& batch = *const_cast<Batch*>(&batch_);
#ifdef DEBUG
_name = batch_._name;
#endif
_commands.swap(batch._commands);
_commandOffsets.swap(batch._commandOffsets);
_params.swap(batch._params);

View file

@ -91,7 +91,7 @@ public:
void captureDrawCallInfo();
void captureNamedDrawCallInfo(std::string name);
Batch();
Batch(const char* name = nullptr);
Batch(const Batch& batch);
~Batch();
@ -482,6 +482,11 @@ public:
bool _enableSkybox { false };
protected:
#ifdef DEBUG
std::string _name;
#endif
friend class Context;
friend class Frame;

View file

@ -108,7 +108,7 @@ void Context::executeFrame(const FramePointer& frame) const {
consumeFrameUpdates(frame);
_backend->setStereoState(frame->stereoState);
{
Batch beginBatch;
Batch beginBatch("Context::executeFrame::begin");
_frameRangeTimer->begin(beginBatch);
_backend->render(beginBatch);
@ -117,7 +117,7 @@ void Context::executeFrame(const FramePointer& frame) const {
_backend->render(batch);
}
Batch endBatch;
Batch endBatch("Context::executeFrame::end");
_frameRangeTimer->end(endBatch);
_backend->render(endBatch);
}

View file

@ -274,8 +274,8 @@ protected:
typedef std::shared_ptr<Context> ContextPointer;
template<typename F>
void doInBatch(std::shared_ptr<gpu::Context> context, F f) {
gpu::Batch batch;
void doInBatch(const char* name, std::shared_ptr<gpu::Context> context, F f) {
gpu::Batch batch(name);
f(batch);
context->appendFrameBatch(batch);
}

View file

@ -385,7 +385,7 @@ void AmbientOcclusionEffect::run(const render::RenderContextPointer& renderConte
auto firstHBlurPipeline = getHBlurPipeline();
auto lastVBlurPipeline = getVBlurPipeline();
gpu::doInBatch(args->_context, [=](gpu::Batch& batch) {
gpu::doInBatch("AmbientOcclusionEffect::run", args->_context, [=](gpu::Batch& batch) {
batch.enableStereo(false);
_gpuTimer->begin(batch);
@ -518,7 +518,7 @@ void DebugAmbientOcclusion::run(const render::RenderContextPointer& renderContex
auto debugPipeline = getDebugPipeline();
gpu::doInBatch(args->_context, [=](gpu::Batch& batch) {
gpu::doInBatch("DebugAmbientOcclusion::run", args->_context, [=](gpu::Batch& batch) {
batch.enableStereo(false);
batch.setViewportTransform(sourceViewport);

View file

@ -24,7 +24,10 @@
#include "ViewFrustum.h"
#include "GeometryCache.h"
#include "FramebufferCache.h"
/*
#define ANTIALIASING_USE_TAA 1
#if !ANTIALIASING_USE_TAA
#include "fxaa_vert.h"
#include "fxaa_frag.h"
#include "fxaa_blend_frag.h"
@ -110,7 +113,7 @@ void Antialiasing::run(const render::RenderContextPointer& renderContext, const
RenderArgs* args = renderContext->args;
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("Antialiasing::run", args->_context, [&](gpu::Batch& batch) {
batch.enableStereo(false);
batch.setViewportTransform(args->_viewport);
@ -167,17 +170,14 @@ void Antialiasing::run(const render::RenderContextPointer& renderContext, const
DependencyManager::get<GeometryCache>()->renderQuad(batch, bottomLeft, topRight, texCoordTopLeft, texCoordBottomRight, color, _geometryId);
});
}
*/
#else
#include "taa_frag.h"
#include "fxaa_blend_frag.h"
#include "taa_blend_frag.h"
const int AntialiasingPass_ParamsSlot = 0;
const int AntialiasingPass_FrameTransformSlot = 1;
const int AntialiasingPass_JitterBufferSlot = 2;
const int AntialiasingPass_HistoryMapSlot = 0;
const int AntialiasingPass_SourceMapSlot = 1;
@ -209,7 +209,6 @@ const gpu::PipelinePointer& Antialiasing::getAntialiasingPipeline() {
slotBindings.insert(gpu::Shader::Binding(std::string("taaParamsBuffer"), AntialiasingPass_ParamsSlot));
slotBindings.insert(gpu::Shader::Binding(std::string("deferredFrameTransformBuffer"), AntialiasingPass_FrameTransformSlot));
slotBindings.insert(gpu::Shader::Binding(std::string("taaJitterBuffer"), AntialiasingPass_JitterBufferSlot));
slotBindings.insert(gpu::Shader::Binding(std::string("historyMap"), AntialiasingPass_HistoryMapSlot));
slotBindings.insert(gpu::Shader::Binding(std::string("sourceMap"), AntialiasingPass_SourceMapSlot));
@ -259,7 +258,6 @@ const gpu::PipelinePointer& Antialiasing::getDebugBlendPipeline() {
gpu::Shader::BindingSet slotBindings;
slotBindings.insert(gpu::Shader::Binding(std::string("taaParamsBuffer"), AntialiasingPass_ParamsSlot));
slotBindings.insert(gpu::Shader::Binding(std::string("taaJitterBuffer"), AntialiasingPass_JitterBufferSlot));
slotBindings.insert(gpu::Shader::Binding(std::string("deferredFrameTransformBuffer"), AntialiasingPass_FrameTransformSlot));
slotBindings.insert(gpu::Shader::Binding(std::string("nextMap"), AntialiasingPass_NextMapSlot));
@ -285,7 +283,6 @@ void Antialiasing::configure(const Config& config) {
_params.edit().blend = config.blend;
_params.edit().covarianceGamma = config.covarianceGamma;
_params.edit().setUnjitter(config.unjitter);
_params.edit().setConstrainColor(config.constrainColor);
_params.edit().setCovarianceClipColor(config.covarianceClipColor);
_params.edit().setClipExactColor(config.clipExactColor);
@ -301,7 +298,6 @@ void Antialiasing::configure(const Config& config) {
_params.edit().setDebugCursor(config.debugCursorTexcoord);
_params.edit().setDebugOrbZoom(config.debugOrbZoom);
_params.edit().setShowJitterSequence(config.showJitterSequence);
_params.edit().setShowClosestFragment(config.showClosestFragment);
}
@ -313,10 +309,9 @@ void Antialiasing::run(const render::RenderContextPointer& renderContext, const
RenderArgs* args = renderContext->args;
auto& deferredFrameTransform = inputs.get0();
auto& jitterBuffer = inputs.get1();
auto& sourceBuffer = inputs.get2();
auto& linearDepthBuffer = inputs.get3();
auto& velocityBuffer = inputs.get4();
auto& sourceBuffer = inputs.get1();
auto& linearDepthBuffer = inputs.get2();
auto& velocityBuffer = inputs.get3();
int width = sourceBuffer->getWidth();
int height = sourceBuffer->getHeight();
@ -343,7 +338,7 @@ void Antialiasing::run(const render::RenderContextPointer& renderContext, const
int nextFrame = (_currentFrame++) % 2;
int prevFrame = (nextFrame + 1) % 2;
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("Antialiasing::run", args->_context, [&](gpu::Batch& batch) {
batch.enableStereo(false);
batch.setViewportTransform(args->_viewport);
@ -356,7 +351,6 @@ void Antialiasing::run(const render::RenderContextPointer& renderContext, const
batch.setUniformBuffer(AntialiasingPass_ParamsSlot, _params);
batch.setUniformBuffer(AntialiasingPass_FrameTransformSlot, deferredFrameTransform->getFrameTransformBuffer());
batch.setUniformBuffer(AntialiasingPass_JitterBufferSlot, jitterBuffer);
batch.setFramebuffer(_antialiasingBuffer[nextFrame]);
batch.setPipeline(getAntialiasingPipeline());
@ -376,7 +370,6 @@ void Antialiasing::run(const render::RenderContextPointer& renderContext, const
batch.setUniformBuffer(AntialiasingPass_ParamsSlot, nullptr);
batch.setUniformBuffer(AntialiasingPass_FrameTransformSlot, nullptr);
batch.setUniformBuffer(AntialiasingPass_JitterBufferSlot, nullptr);
batch.setResourceTexture(AntialiasingPass_DepthMapSlot, nullptr);
batch.setResourceTexture(AntialiasingPass_HistoryMapSlot, nullptr);
@ -387,7 +380,7 @@ void Antialiasing::run(const render::RenderContextPointer& renderContext, const
void JitterSampleConfig::setIndex(int current) {
_index = (current) % JitterSample::SampleSequence::SEQUENCE_LENGTH;
_index = (current) % JitterSample::SEQUENCE_LENGTH;
emit dirty();
}
@ -446,11 +439,11 @@ int JitterSampleConfig::play() {
return _state;
}
template <int B> class Halton {
template <int B>
class Halton {
public:
float eval(int index) {
float eval(int index) const {
float f = 1.0f;
float r = 0.0f;
float invB = 1.0f / (float)B;
@ -458,12 +451,14 @@ public:
while (index > 0) {
f = f * invB;
r = r + f * (float) (index % B);
r = r + f * (float)(index % B);
index = index / B;
}
return r;
}
};
@ -474,9 +469,6 @@ JitterSample::SampleSequence::SampleSequence(){
for (int i = 0; i < SEQUENCE_LENGTH; i++) {
offsets[i] = glm::vec2(genX.eval(i), genY.eval(i));
}
for (int i = 0; i < SEQUENCE_LENGTH; i++) {
offsets[i] -= vec2(0.5f);
}
offsets[SEQUENCE_LENGTH] = glm::vec2(0.0f);
@ -486,68 +478,60 @@ void JitterSample::configure(const Config& config) {
_freeze = config.freeze;
if (config.stop || _freeze) {
auto pausedIndex = config.getIndex();
if (_jitterBuffer->currentIndex != pausedIndex) {
_jitterBuffer.edit().currentIndex = pausedIndex;
if (_sampleSequence.currentIndex != pausedIndex) {
_sampleSequence.currentIndex = pausedIndex;
}
} else {
if (_jitterBuffer->currentIndex < 0) {
_jitterBuffer.edit().currentIndex = config.getIndex();
if (_sampleSequence.currentIndex < 0) {
_sampleSequence.currentIndex = config.getIndex();
}
}
_scale = config.scale;
}
void JitterSample::run(const render::RenderContextPointer& renderContext, JitterBuffer& jitterBuffer) {
auto& current = _jitterBuffer.edit().currentIndex;
void JitterSample::run(const render::RenderContextPointer& renderContext) {
auto& current = _sampleSequence.currentIndex;
if (!_freeze) {
if (current >= 0) {
current = (current + 1) % SampleSequence::SEQUENCE_LENGTH;
}
else {
current = (current + 1) % SEQUENCE_LENGTH;
} else {
current = -1;
}
}
auto viewFrustum = renderContext->args->getViewFrustum();
auto projMat = viewFrustum.getProjection();
auto theNear = viewFrustum.getNearClip();
auto args = renderContext->args;
auto viewFrustum = args->getViewFrustum();
auto jit = _sampleSequence.offsets[(current < 0 ? SEQUENCE_LENGTH : current)];
auto width = (float)args->_viewport.z;
auto height = (float)args->_viewport.w;
auto jit = jitterBuffer.get().offsets[(current < 0 ? SampleSequence::SEQUENCE_LENGTH : current)];
auto width = (float)renderContext->args->_viewport.z;
auto height = (float)renderContext->args->_viewport.w;
auto jx = 2.0f * jit.x / width;
auto jy = 2.0f * jit.y / height;
auto jx = 2.0 * jit.x / width;
auto jy = 2.0 * jit.y / height;
if (!args->isStereo()) {
auto projMat = viewFrustum.getProjection();
bool isStereo = renderContext->args->isStereo();
if (!isStereo) {
projMat[2][0] += jx;
projMat[2][1] += jy;
viewFrustum.setProjection(projMat);
renderContext->args->pushViewFrustum(viewFrustum);
}
else {
viewFrustum.calculate();
args->setViewFrustum(viewFrustum);
} else {
mat4 projMats[2];
renderContext->args->_context->getStereoProjections(projMats);
args->_context->getStereoProjections(projMats);
jx *= 2.0f;
auto sjx = jx * 2.0f;
for (int i = 0; i < 2; i++) {
projMats[i][2][0] += sjx;
projMats[i][2][1] += jy;
auto& projMat = projMats[i];
projMat[2][0] += jx;
projMat[2][1] += jy;
}
renderContext->args->_context->setStereoProjections(projMats);
args->_context->setStereoProjections(projMats);
}
jitterBuffer = _jitterBuffer;
}
#endif

View file

@ -57,27 +57,27 @@ private:
class JitterSample {
public:
struct SampleSequence {
SampleSequence();
static const int SEQUENCE_LENGTH{ 16 };
glm::vec2 offsets[SEQUENCE_LENGTH + 1];
int sequenceLength{ SEQUENCE_LENGTH };
int currentIndex{ 0 };
enum {
SEQUENCE_LENGTH = 16
};
using JitterBuffer = gpu::StructBuffer<SampleSequence>;
using Config = JitterSampleConfig;
using JobModel = render::Job::ModelO<JitterSample, JitterBuffer, Config>;
using JobModel = render::Job::Model<JitterSample, Config>;
void configure(const Config& config);
void run(const render::RenderContextPointer& renderContext, JitterBuffer& jitterBuffer);
void run(const render::RenderContextPointer& renderContext);
private:
JitterBuffer _jitterBuffer;
struct SampleSequence {
SampleSequence();
glm::vec2 offsets[SEQUENCE_LENGTH + 1];
int sequenceLength{ SEQUENCE_LENGTH };
int currentIndex{ 0 };
};
SampleSequence _sampleSequence;
float _scale{ 1.0 };
bool _freeze{ false };
};
@ -88,7 +88,6 @@ class AntialiasingConfig : public render::Job::Config {
Q_PROPERTY(float blend MEMBER blend NOTIFY dirty)
Q_PROPERTY(float covarianceGamma MEMBER covarianceGamma NOTIFY dirty)
Q_PROPERTY(bool unjitter MEMBER unjitter NOTIFY dirty)
Q_PROPERTY(bool constrainColor MEMBER constrainColor NOTIFY dirty)
Q_PROPERTY(bool covarianceClipColor MEMBER covarianceClipColor NOTIFY dirty)
Q_PROPERTY(bool clipExactColor MEMBER clipExactColor NOTIFY dirty)
@ -102,7 +101,6 @@ class AntialiasingConfig : public render::Job::Config {
Q_PROPERTY(glm::vec2 debugCursorTexcoord MEMBER debugCursorTexcoord NOTIFY dirty)
Q_PROPERTY(float debugOrbZoom MEMBER debugOrbZoom NOTIFY dirty)
Q_PROPERTY(bool showJitterSequence MEMBER showJitterSequence NOTIFY dirty)
Q_PROPERTY(bool showClosestFragment MEMBER showClosestFragment NOTIFY dirty)
public:
@ -111,7 +109,6 @@ public:
float blend{ 0.1f };
bool unjitter{ false };
bool constrainColor{ true };
bool covarianceClipColor{ true };
float covarianceGamma{ 1.0f };
@ -126,7 +123,6 @@ public:
bool debug { false };
bool showCursorPixel { false };
bool showJitterSequence{ false };
bool showClosestFragment{ false };
signals:
@ -146,9 +142,6 @@ struct TAAParams {
glm::vec4 pixelInfo{ 0.5f, 0.5f, 2.0f, 0.0f };
glm::vec4 regionInfo{ 0.0f, 0.0f, 1.0f, 0.0f };
void setUnjitter(bool enabled) { SET_BIT(flags.y, 0, enabled); }
bool isUnjitter() const { return (bool)GET_BIT(flags.y, 0); }
void setConstrainColor(bool enabled) { SET_BIT(flags.y, 1, enabled); }
bool isConstrainColor() const { return (bool)GET_BIT(flags.y, 1); }
@ -173,16 +166,14 @@ struct TAAParams {
void setDebugOrbZoom(float orbZoom) { pixelInfo.z = orbZoom; }
float getDebugOrbZoom() const { return pixelInfo.z; }
void setShowJitterSequence(bool enabled) { SET_BIT(flags.x, 2, enabled); }
void setShowClosestFragment(bool enabled) { SET_BIT(flags.x, 3, enabled); }
};
using TAAParamsBuffer = gpu::StructBuffer<TAAParams>;
class Antialiasing {
public:
using Inputs = render::VaryingSet5 < DeferredFrameTransformPointer, JitterSample::JitterBuffer, gpu::FramebufferPointer, LinearDepthFramebufferPointer, VelocityFramebufferPointer > ;
using Inputs = render::VaryingSet4 < DeferredFrameTransformPointer, gpu::FramebufferPointer, LinearDepthFramebufferPointer, VelocityFramebufferPointer > ;
using Config = AntialiasingConfig;
using JobModel = render::Job::ModelI<Antialiasing, Inputs, Config>;

View file

@ -93,7 +93,7 @@ void DrawBackgroundStage::run(const render::RenderContextPointer& renderContext,
PerformanceTimer perfTimer("skybox");
auto args = renderContext->args;
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("DrawBackgroundStage::run", args->_context, [&](gpu::Batch& batch) {
args->_batch = &batch;
batch.enableSkybox(true);

View file

@ -75,7 +75,7 @@ void BloomThreshold::run(const render::RenderContextPointer& renderContext, cons
glm::ivec4 viewport{ 0, 0, bufferSize.x, bufferSize.y };
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("BloomThreshold::run", args->_context, [&](gpu::Batch& batch) {
batch.enableStereo(false);
batch.setViewportTransform(viewport);
@ -135,7 +135,7 @@ void BloomApply::run(const render::RenderContextPointer& renderContext, const In
const auto blur2FB = inputs.get3();
const glm::ivec4 viewport{ 0, 0, framebufferSize.x, framebufferSize.y };
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("BloomApply::run", args->_context, [&](gpu::Batch& batch) {
batch.enableStereo(false);
batch.setFramebuffer(frameBuffer);
@ -180,7 +180,7 @@ void BloomDraw::run(const render::RenderContextPointer& renderContext, const Inp
_pipeline = gpu::Pipeline::create(program, state);
}
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("BloomDraw::run", args->_context, [&](gpu::Batch& batch) {
batch.enableStereo(false);
batch.setFramebuffer(frameBuffer);
@ -238,7 +238,7 @@ void DebugBloom::run(const render::RenderContextPointer& renderContext, const In
_pipeline = gpu::Pipeline::create(program, state);
}
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("DebugBloom::run", args->_context, [&](gpu::Batch& batch) {
batch.enableStereo(false);
batch.setFramebuffer(frameBuffer);

View file

@ -416,7 +416,7 @@ void DebugDeferredBuffer::run(const RenderContextPointer& renderContext, const I
auto& ambientOcclusionFramebuffer = inputs.get3();
auto& velocityFramebuffer = inputs.get4();
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("DebugDeferredBuffer::run", args->_context, [&](gpu::Batch& batch) {
batch.enableStereo(false);
batch.setViewportTransform(args->_viewport);

View file

@ -42,7 +42,7 @@ void DeferredFrameTransform::update(RenderArgs* args) {
args->getViewFrustum().evalProjectionMatrix(frameTransformBuffer.projectionMono);
// Running in stero ?
// Running in stereo ?
bool isStereo = args->isStereo();
if (!isStereo) {
frameTransformBuffer.projection[0] = frameTransformBuffer.projectionMono;

View file

@ -407,7 +407,7 @@ void PrepareDeferred::run(const RenderContextPointer& renderContext, const Input
outputs.edit0() = _deferredFramebuffer;
outputs.edit1() = _deferredFramebuffer->getLightingFramebuffer();
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("PrepareDeferred::run", args->_context, [&](gpu::Batch& batch) {
batch.enableStereo(false);
batch.setViewportTransform(args->_viewport);
batch.setStateScissorRect(args->_viewport);

View file

@ -155,7 +155,7 @@ void DrawHaze::run(const render::RenderContextPointer& renderContext, const Inpu
auto sourceFramebufferSize = glm::ivec2(inputBuffer->getDimensions());
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("DrawHaze::run", args->_context, [&](gpu::Batch& batch) {
batch.enableStereo(false);
batch.setFramebuffer(outputBuffer);

View file

@ -161,7 +161,7 @@ void DrawHighlightMask::run(const render::RenderContextPointer& renderContext, c
// Clear the framebuffer without stereo
// Needs to be distinct from the other batch because using the clear call
// while stereo is enabled triggers a warning
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("DrawHighlightMask::run::begin", args->_context, [&](gpu::Batch& batch) {
batch.enableStereo(false);
batch.setFramebuffer(ressources->getDepthFramebuffer());
batch.clearDepthStencilFramebuffer(1.0f, 0);
@ -174,7 +174,7 @@ void DrawHighlightMask::run(const render::RenderContextPointer& renderContext, c
render::ItemBounds itemBounds;
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("DrawHighlightMask::run", args->_context, [&](gpu::Batch& batch) {
args->_batch = &batch;
auto maskPipeline = _shapePlumber->pickPipeline(args, defaultKeyBuilder);
@ -212,7 +212,7 @@ void DrawHighlightMask::run(const render::RenderContextPointer& renderContext, c
_boundsBuffer->setData(itemBounds.size() * sizeof(render::ItemBound), (const gpu::Byte*) itemBounds.data());
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("DrawHighlightMask::run::end", args->_context, [&](gpu::Batch& batch) {
// Setup camera, projection and viewport for all items
batch.setViewportTransform(args->_viewport);
batch.setProjectionTransform(projMat);
@ -279,7 +279,7 @@ void DrawHighlight::run(const render::RenderContextPointer& renderContext, const
shaderParameters._size.y = size;
}
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("DrawHighlight::run", args->_context, [&](gpu::Batch& batch) {
batch.enableStereo(false);
batch.setFramebuffer(destinationFrameBuffer);
@ -352,7 +352,7 @@ void DebugHighlight::run(const render::RenderContextPointer& renderContext, cons
assert(renderContext->args->hasViewFrustum());
RenderArgs* args = renderContext->args;
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("DebugHighlight::run", args->_context, [&](gpu::Batch& batch) {
batch.setViewportTransform(args->_viewport);
batch.setFramebuffer(highlightRessources->getColorFramebuffer());

View file

@ -92,7 +92,7 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren
fadeEffect->build(task, opaques);
const auto jitterBuffer = task.addJob<JitterSample>("JitterCam");
task.addJob<JitterSample>("JitterCam");
// Prepare deferred, generate the shared Deferred Frame Transform
const auto deferredFrameTransform = task.addJob<GenerateDeferredFrameTransform>("DeferredFrameTransform");
@ -238,6 +238,10 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren
task.addJob<DrawBounds>("DrawOverlayInFrontTransparentBounds", overlaysInFrontTransparent);
}
// AA job to be revisited
const auto antialiasingInputs = Antialiasing::Inputs(deferredFrameTransform, primaryFramebuffer, linearDepthTarget, velocityBuffer).asVarying();
task.addJob<Antialiasing>("Antialiasing", antialiasingInputs);
// Debugging stages
{
// Debugging Deferred buffer job
@ -268,11 +272,6 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren
task.addJob<DebugZoneLighting>("DrawZoneStack", deferredFrameTransform);
}
// AA job to be revisited
const auto antialiasingInputs = Antialiasing::Inputs(deferredFrameTransform, jitterBuffer, primaryFramebuffer, linearDepthTarget, velocityBuffer).asVarying();
task.addJob<Antialiasing>("Antialiasing", antialiasingInputs);
// Composite the HUD and HUD overlays
task.addJob<CompositeHUD>("HUD");
@ -297,13 +296,13 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren
void BeginGPURangeTimer::run(const render::RenderContextPointer& renderContext, gpu::RangeTimerPointer& timer) {
timer = _gpuTimer;
gpu::doInBatch(renderContext->args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("BeginGPURangeTimer::run", renderContext->args->_context, [&](gpu::Batch& batch) {
_gpuTimer->begin(batch);
});
}
void EndGPURangeTimer::run(const render::RenderContextPointer& renderContext, const gpu::RangeTimerPointer& timer) {
gpu::doInBatch(renderContext->args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("EndGPURangeTimer::run", renderContext->args->_context, [&](gpu::Batch& batch) {
timer->end(batch);
});
@ -323,7 +322,7 @@ void DrawDeferred::run(const RenderContextPointer& renderContext, const Inputs&
RenderArgs* args = renderContext->args;
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("DrawDeferred::run", args->_context, [&](gpu::Batch& batch) {
args->_batch = &batch;
// Setup camera, projection and viewport for all items
@ -370,7 +369,7 @@ void DrawStateSortDeferred::run(const RenderContextPointer& renderContext, const
RenderArgs* args = renderContext->args;
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("DrawStateSortDeferred::run", args->_context, [&](gpu::Batch& batch) {
args->_batch = &batch;
// Setup camera, projection and viewport for all items
@ -434,14 +433,14 @@ void DrawOverlay3D::run(const RenderContextPointer& renderContext, const Inputs&
// Needs to be distinct from the other batch because using the clear call
// while stereo is enabled triggers a warning
if (_opaquePass) {
gpu::doInBatch(args->_context, [&](gpu::Batch& batch){
gpu::doInBatch("DrawOverlay3D::run::clear", args->_context, [&](gpu::Batch& batch){
batch.enableStereo(false);
batch.clearFramebuffer(gpu::Framebuffer::BUFFER_DEPTH, glm::vec4(), 1.f, 0, false);
});
}
// Render the items
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("DrawOverlay3D::run", args->_context, [&](gpu::Batch& batch) {
args->_batch = &batch;
batch.setViewportTransform(args->_viewport);
batch.setStateScissorRect(args->_viewport);
@ -473,7 +472,7 @@ void CompositeHUD::run(const RenderContextPointer& renderContext) {
}
// Grab the HUD texture
gpu::doInBatch(renderContext->args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("CompositeHUD::run", renderContext->args->_context, [&](gpu::Batch& batch) {
if (renderContext->args->_hudOperator) {
renderContext->args->_hudOperator(batch, renderContext->args->_hudTexture, renderContext->args->_renderMode == RenderArgs::RenderMode::MIRROR_RENDER_MODE);
}
@ -499,7 +498,7 @@ void Blit::run(const RenderContextPointer& renderContext, const gpu::Framebuffer
// Blit primary to blit FBO
auto primaryFbo = srcFramebuffer;
gpu::doInBatch(renderArgs->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("Blit::run", renderArgs->_context, [&](gpu::Batch& batch) {
batch.setFramebuffer(blitFbo);
if (renderArgs->_renderMode == RenderArgs::MIRROR_RENDER_MODE) {

View file

@ -84,7 +84,7 @@ void PrepareFramebuffer::run(const RenderContextPointer& renderContext,
}
auto args = renderContext->args;
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("PrepareFramebuffer::run", args->_context, [&](gpu::Batch& batch) {
batch.enableStereo(false);
batch.setViewportTransform(args->_viewport);
batch.setStateScissorRect(args->_viewport);
@ -104,7 +104,7 @@ void Draw::run(const RenderContextPointer& renderContext,
const Inputs& items) {
RenderArgs* args = renderContext->args;
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("RenderForward::Draw::run", args->_context, [&](gpu::Batch& batch) {
args->_batch = &batch;
// Setup projection
@ -141,7 +141,7 @@ const gpu::PipelinePointer Stencil::getPipeline() {
void Stencil::run(const RenderContextPointer& renderContext) {
RenderArgs* args = renderContext->args;
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("RenderForward::Stencil::run", args->_context, [&](gpu::Batch& batch) {
args->_batch = &batch;
batch.enableStereo(false);
@ -158,7 +158,7 @@ void DrawBackground::run(const RenderContextPointer& renderContext,
const Inputs& background) {
RenderArgs* args = renderContext->args;
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("RenderForward::DrawBackground::run", args->_context, [&](gpu::Batch& batch) {
args->_batch = &batch;
batch.enableSkybox(true);

View file

@ -153,7 +153,7 @@ void RenderShadowMap::run(const render::RenderContextPointer& renderContext, con
args->popViewFrustum();
args->pushViewFrustum(adjustedShadowFrustum);
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("RenderShadowMap::run", args->_context, [&](gpu::Batch& batch) {
args->_batch = &batch;
batch.enableStereo(false);

View file

@ -81,7 +81,7 @@ void PrepareStencil::run(const RenderContextPointer& renderContext, const gpu::F
return;
}
doInBatch(args->_context, [&](gpu::Batch& batch) {
doInBatch("PrepareStencil::run", args->_context, [&](gpu::Batch& batch) {
batch.enableStereo(false);
batch.setViewportTransform(args->_viewport);

View file

@ -322,7 +322,7 @@ void diffuseProfileGPU(gpu::TexturePointer& profileMap, RenderArgs* args) {
auto makeFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("diffuseProfile"));
makeFramebuffer->setRenderBuffer(0, profileMap);
gpu::doInBatch(args->_context, [=](gpu::Batch& batch) {
gpu::doInBatch("SubsurfaceScattering::diffuseProfileGPU", args->_context, [=](gpu::Batch& batch) {
batch.enableStereo(false);
batch.setViewportTransform(glm::ivec4(0, 0, width, height));
@ -359,7 +359,7 @@ void diffuseScatterGPU(const gpu::TexturePointer& profileMap, gpu::TexturePointe
auto makeFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("diffuseScatter"));
makeFramebuffer->setRenderBuffer(0, lut);
gpu::doInBatch(args->_context, [=](gpu::Batch& batch) {
gpu::doInBatch("SubsurfaceScattering::diffuseScatterGPU", args->_context, [=](gpu::Batch& batch) {
batch.enableStereo(false);
batch.setViewportTransform(glm::ivec4(0, 0, width, height));
@ -396,7 +396,7 @@ void computeSpecularBeckmannGPU(gpu::TexturePointer& beckmannMap, RenderArgs* ar
auto makeFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("computeSpecularBeckmann"));
makeFramebuffer->setRenderBuffer(0, beckmannMap);
gpu::doInBatch(args->_context, [=](gpu::Batch& batch) {
gpu::doInBatch("SubsurfaceScattering::computeSpecularBeckmannGPU", args->_context, [=](gpu::Batch& batch) {
batch.enableStereo(false);
batch.setViewportTransform(glm::ivec4(0, 0, width, height));
@ -537,7 +537,7 @@ void DebugSubsurfaceScattering::run(const render::RenderContextPointer& renderCo
// const auto light = DependencyManager::get<DeferredLightingEffect>()->getLightStage()->getLight(0);
const auto light = lightStage->getLight(0);
gpu::doInBatch(args->_context, [=](gpu::Batch& batch) {
gpu::doInBatch("DebugSubsurfaceScattering::run", args->_context, [=](gpu::Batch& batch) {
batch.enableStereo(false);

View file

@ -174,7 +174,7 @@ void LinearDepthPass::run(const render::RenderContextPointer& renderContext, con
auto halfViewport = depthViewport >> 1;
float clearLinearDepth = args->getViewFrustum().getFarClip() * 2.0f;
gpu::doInBatch(args->_context, [=](gpu::Batch& batch) {
gpu::doInBatch("LinearDepthPass::run", args->_context, [=](gpu::Batch& batch) {
_gpuTimer->begin(batch);
batch.enableStereo(false);
@ -466,7 +466,7 @@ void SurfaceGeometryPass::run(const render::RenderContextPointer& renderContext,
_diffusePass.getParameters()->setLinearDepthPosFar(args->getViewFrustum().getFarClip());
gpu::doInBatch(args->_context, [=](gpu::Batch& batch) {
gpu::doInBatch("SurfaceGeometryPass::run", args->_context, [=](gpu::Batch& batch) {
_gpuTimer->begin(batch);
batch.enableStereo(false);

View file

@ -62,7 +62,7 @@ void ToneMappingEffect::render(RenderArgs* args, const gpu::TexturePointer& ligh
init();
}
auto framebufferSize = glm::ivec2(lightingBuffer->getDimensions());
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("ToneMappingEffect::render", args->_context, [&](gpu::Batch& batch) {
batch.enableStereo(false);
batch.setFramebuffer(destinationFramebuffer);

View file

@ -118,7 +118,7 @@ void VelocityBufferPass::run(const render::RenderContextPointer& renderContext,
auto fullViewport = args->_viewport;
gpu::doInBatch(args->_context, [=](gpu::Batch& batch) {
gpu::doInBatch("VelocityBufferPass::run", args->_context, [=](gpu::Batch& batch) {
_gpuTimer->begin(batch);
batch.enableStereo(false);

View file

@ -170,7 +170,7 @@ void DebugZoneLighting::run(const render::RenderContextPointer& context, const I
}
gpu::doInBatch(args->_context, [=](gpu::Batch& batch) {
gpu::doInBatch("DebugZoneLighting::run", args->_context, [=](gpu::Batch& batch) {
batch.setViewportTransform(args->_viewport);
auto viewFrustum = args->getViewFrustum();

View file

@ -20,22 +20,13 @@ layout(location = 0) out vec4 outFragColor;
void main() {
vec2 fragUV = varTexCoord0;
vec2 texelSize = taa_getTexelSize();
vec2 fragJitterPix = taa_getCurrentJitterSample();
if (taa_unjitter()) {
fragUV -= fragJitterPix * texelSize;
}
// Debug region before debug or fxaa region X
/* float distToRegionFXAA = fragUV.x - taa_getRegionFXAA().x;
float distToRegionFXAA = fragUV.x - taa_getRegionFXAA().x;
if (distToRegionFXAA > 0.0) {
outFragColor = vec4(taa_evalFXAA(fragUV), 1.0);
return;
}*/
}
// vec3 nearFragUV = taa_findClosestFragment3x3(fragUV);
// vec2 fragVel = taa_fetchVelocityMap(nearFragUV.xy);

View file

@ -13,31 +13,6 @@
<@include DeferredTransform.slh@>
<$declareDeferredFrameTransform()$>
const int SEQUENCE_LENGTH = 16;
const int INFO_INDEX = SEQUENCE_LENGTH / 2;
struct JitterSequence {
vec4 offsets[INFO_INDEX + 1];
};
layout(std140) uniform taaJitterBuffer {
JitterSequence sequence;
};
vec2 taa_getJitterSample(int index) {
return vec2((bool(index & 0x01) ? sequence.offsets[index >> 1].zw : sequence.offsets[index >> 1].xy));
}
int taa_getJitterSequenceLength() {
return floatBitsToInt(sequence.offsets[INFO_INDEX].z);
}
int taa_getCurrentJitterIndex() {
return floatBitsToInt(sequence.offsets[INFO_INDEX].w);
}
vec2 taa_getCurrentJitterSample() {
return taa_getJitterSample(taa_getCurrentJitterIndex());
}
<@include gpu/Color.slh@>
uniform sampler2D depthMap;
@ -67,27 +42,22 @@ bool taa_showDebugCursor() {
return GET_BIT(params.flags.x, 1);
}
bool taa_showJitterSequence() {
return GET_BIT(params.flags.x, 2);
}
bool taa_showClosestFragment() {
return GET_BIT(params.flags.x, 3);
}
bool taa_unjitter() {
return GET_BIT(params.flags.y, 0);
}
bool taa_constrainColor() {
return GET_BIT(params.flags.y, 1);
}
bool taa_covarianceClipColor() {
return GET_BIT(params.flags.y, 2);
}
bool taa_clipExactColor() {
return GET_BIT(params.flags.y, 3);
}
bool taa_feedbackColor() {
return GET_BIT(params.flags.y, 4);
}

View file

@ -28,10 +28,6 @@ void main(void) {
vec2 imageSize = getWidthHeight(0);
vec2 texelSize = getInvWidthHeight();
vec2 fragJitterPix = taa_getCurrentJitterSample();
vec2 pixPos = varTexCoord0 * imageSize;
vec2 pixVelocity = imageSize * texture(velocityMap, varTexCoord0).xy;
float pixVelocityLength = length(pixVelocity);
@ -44,7 +40,7 @@ void main(void) {
vec2 cursorUVRaw = taa_getDebugCursorTexcoord();
vec2 cursorPosRaw = floor(cursorUVRaw * imageSize) + vec2(0.5);
vec3 cursorFrag = taa_findClosestFragment3x3(cursorUVRaw);
vec2 cursorUV = cursorUVRaw - fragJitterPix * texelSize;
vec2 cursorUV = cursorUVRaw;
vec2 cursorPos = cursorUV * imageSize;
vec2 cursorVelocity = texture(velocityMap, cursorUV).xy;
vec2 cursorPrevUV = cursorUV - cursorVelocity;
@ -117,29 +113,6 @@ void main(void) {
}
}
if (taa_showJitterSequence()) {
float tenPercentHeight = 0.1 * imageSize.y;
vec2 jitterRegionSize = vec2(tenPercentHeight);
vec2 jitterRegionPos = (pixPos - vec2(tenPercentHeight, imageSize.y - tenPercentHeight));
if ((all(lessThan(jitterRegionPos, jitterRegionSize)) && all(greaterThan(jitterRegionPos, vec2(0.0))))) {
float niceDotR2 = 4.0;
//int sequenceLength = taa_getJitterSequenceLength();
int sequenceLength = SEQUENCE_LENGTH;
for (int s = 0; s < sequenceLength; s++) {
vec2 pixToSampleVec = jitterRegionPos - (vec2(0.5) + taa_getJitterSample(s)) * jitterRegionSize;
float radius2 = (s == taa_getCurrentJitterIndex() ? 4.0 * niceDotR2 : niceDotR2);
float distToSample2 = dot(pixToSampleVec, pixToSampleVec);
if (distToSample2 < radius2) {
outFragColor = vec4(mix( outFragColor.rgb, colorRamp(float(s) / float(sequenceLength)), 1.0 - distToSample2 / radius2), 1.0);
return;
}
}
}
}
// Debug region before debug or fxaa region X
float distToRegionDebug = varTexCoord0.x - taa_getRegionDebug().x;
float distToRegionFXAA = varTexCoord0.x - taa_getRegionFXAA().x;

View file

@ -286,7 +286,7 @@ void BlurGaussian::run(const RenderContextPointer& renderContext, const gpu::Fra
_parameters->setWidthHeight(blurredFramebuffer->getWidth(), blurredFramebuffer->getHeight(), args->isStereo());
_parameters->setTexcoordTransform(gpu::Framebuffer::evalSubregionTexcoordTransformCoefficients(textureSize, viewport));
gpu::doInBatch(args->_context, [=](gpu::Batch& batch) {
gpu::doInBatch("BlurGaussian::run", args->_context, [=](gpu::Batch& batch) {
batch.enableStereo(false);
batch.setViewportTransform(viewport);
@ -401,7 +401,7 @@ void BlurGaussianDepthAware::run(const RenderContextPointer& renderContext, cons
_parameters->setDepthPerspective(args->getViewFrustum().getProjection()[1][1]);
_parameters->setLinearDepthPosFar(args->getViewFrustum().getFarClip());
gpu::doInBatch(args->_context, [=](gpu::Batch& batch) {
gpu::doInBatch("BlurGaussianDepthAware::run", args->_context, [=](gpu::Batch& batch) {
batch.enableStereo(false);
batch.setViewportTransform(sourceViewport);

View file

@ -94,7 +94,7 @@ void DrawSceneOctree::run(const RenderContextPointer& renderContext, const ItemS
std::static_pointer_cast<Config>(renderContext->jobConfig)->numFreeCells = (int)scene->getSpatialTree().getNumFreeCells();
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("DrawSceneOctree::run", args->_context, [&](gpu::Batch& batch) {
glm::mat4 projMat;
Transform viewMat;
args->getViewFrustum().evalProjectionMatrix(projMat);
@ -201,7 +201,7 @@ void DrawItemSelection::run(const RenderContextPointer& renderContext, const Ite
RenderArgs* args = renderContext->args;
auto& scene = renderContext->_scene;
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("DrawItemSelection::run", args->_context, [&](gpu::Batch& batch) {
glm::mat4 projMat;
Transform viewMat;
args->getViewFrustum().evalProjectionMatrix(projMat);

View file

@ -163,7 +163,7 @@ void DrawStatus::run(const RenderContextPointer& renderContext, const ItemBounds
}
// Allright, something to render let's do it
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("DrawStatus::run", args->_context, [&](gpu::Batch& batch) {
glm::mat4 projMat;
Transform viewMat;
args->getViewFrustum().evalProjectionMatrix(projMat);

View file

@ -143,7 +143,7 @@ void DrawLight::run(const RenderContextPointer& renderContext, const ItemBounds&
RenderArgs* args = renderContext->args;
// render lights
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("DrawLight::run", args->_context, [&](gpu::Batch& batch) {
args->_batch = &batch;
renderItems(renderContext, inLights, _maxDrawn);
args->_batch = nullptr;
@ -191,7 +191,7 @@ void DrawBounds::run(const RenderContextPointer& renderContext,
_drawBuffer->setData(numItems * sizeOfItemBound, (const gpu::Byte*) items.data());
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("DrawBounds::run", args->_context, [&](gpu::Batch& batch) {
args->_batch = &batch;
// Setup projection
@ -262,7 +262,7 @@ void DrawFrustum::run(const render::RenderContextPointer& renderContext, const I
}
// Render the frustums in wireframe
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("DrawFrustum::run", args->_context, [&](gpu::Batch& batch) {
args->_batch = &batch;
batch.setViewportTransform(args->_viewport);
batch.setStateScissorRect(args->_viewport);

View file

@ -66,7 +66,7 @@ void HalfDownsample::run(const RenderContextPointer& renderContext, const gpu::F
const auto bufferSize = resampledFrameBuffer->getSize();
glm::ivec4 viewport{ 0, 0, bufferSize.x, bufferSize.y };
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("HalfDownsample::run", args->_context, [&](gpu::Batch& batch) {
batch.enableStereo(false);
batch.setFramebuffer(resampledFrameBuffer);

View file

@ -85,21 +85,6 @@ Rectangle {
onClicked: { Render.getConfig("RenderMainView.JitterCam").next(); }
}
}
Row {
spacing: 10
HifiControls.CheckBox {
boxSize: 20
text: "Unjitter"
checked: Render.getConfig("RenderMainView.Antialiasing")["unjitter"]
onCheckedChanged: { Render.getConfig("RenderMainView.Antialiasing")["unjitter"] = checked }
}
HifiControls.CheckBox {
boxSize: 20
text: "Show Sequence"
checked: Render.getConfig("RenderMainView.Antialiasing")["showJitterSequence"]
onCheckedChanged: { Render.getConfig("RenderMainView.Antialiasing")["showJitterSequence"] = checked }
}
}
Separator {}
Column {
spacing: 10

View file

@ -114,14 +114,14 @@ void TestWindow::beginFrame() {
// the rest of the renderDeferred inputs can be omitted
#else
gpu::doInBatch(_renderArgs->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("TestWindow::beginFrame", _renderArgs->_context, [&](gpu::Batch& batch) {
batch.clearColorFramebuffer(gpu::Framebuffer::BUFFER_COLORS, { 0.0f, 0.1f, 0.2f, 1.0f });
batch.clearDepthFramebuffer(1e4);
batch.setViewportTransform({ 0, 0, _size.width() * devicePixelRatio(), _size.height() * devicePixelRatio() });
});
#endif
gpu::doInBatch(_renderArgs->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("TestWindow::beginFrame", _renderArgs->_context, [&](gpu::Batch& batch) {
batch.setViewportTransform(_renderArgs->_viewport);
batch.setStateScissorRect(_renderArgs->_viewport);
batch.setProjectionTransform(_projectionMatrix);
@ -131,7 +131,7 @@ void TestWindow::beginFrame() {
void TestWindow::endFrame() {
#ifdef DEFERRED_LIGHTING
RenderArgs* args = _renderContext->args;
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("TestWindow::endFrame::begin", args->_context, [&](gpu::Batch& batch) {
args->_batch = &batch;
auto deferredFboColorDepthStencil = _prepareDeferredOutputs.get0()->getDeferredFramebufferDepthColor();
batch.setViewportTransform(args->_viewport);
@ -144,7 +144,7 @@ void TestWindow::endFrame() {
_renderDeferred.run(_renderContext, _renderDeferredInputs);
gpu::doInBatch(_renderArgs->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("TestWindow::endFrame::blit", _renderArgs->_context, [&](gpu::Batch& batch) {
PROFILE_RANGE_BATCH(batch, "blit");
// Blit to screen
auto framebufferCache = DependencyManager::get<FramebufferCache>();
@ -154,7 +154,7 @@ void TestWindow::endFrame() {
});
#endif
gpu::doInBatch(_renderArgs->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("TestWindow::endFrame::finish", _renderArgs->_context, [&](gpu::Batch& batch) {
batch.resetStages();
});
_glContext.swapBuffers(this);

View file

@ -146,7 +146,7 @@ class MyTestWindow : public TestWindow {
return;
}
gpu::doInBatch(_renderArgs->_context, [&](gpu::Batch& batch) {
gpu::doInBatch("main::renderFrame", _renderArgs->_context, [&](gpu::Batch& batch) {
batch.setViewTransform(_camera);
_renderArgs->_batch = &batch;
_currentTest->renderTest(_currentTestId, _renderArgs);

View file

@ -921,7 +921,7 @@ private:
void render(RenderArgs* renderArgs) {
auto& gpuContext = renderArgs->_context;
gpuContext->beginFrame();
gpu::doInBatch(gpuContext, [&](gpu::Batch& batch) {
gpu::doInBatch("QTestWindow::render", gpuContext, [&](gpu::Batch& batch) {
batch.resetStages();
});
PROFILE_RANGE(render, __FUNCTION__);

View file

@ -561,12 +561,12 @@ private:
void render() {
auto& gpuContext = _renderThread._gpuContext;
gpuContext->beginFrame();
gpu::doInBatch(gpuContext, [&](gpu::Batch& batch) {
gpu::doInBatch("RenderThread::render::begin", gpuContext, [&](gpu::Batch& batch) {
batch.resetStages();
});
auto framebuffer = DependencyManager::get<FramebufferCache>()->getFramebuffer();
gpu::doInBatch(gpuContext, [&](gpu::Batch& batch) {
gpu::doInBatch("RenderThread::render", gpuContext, [&](gpu::Batch& batch) {
batch.enableStereo(false);
batch.setFramebuffer(framebuffer);
batch.clearColorFramebuffer(gpu::Framebuffer::BUFFER_COLOR0, vec4(1, 0, 0, 1));