Skip to content

Commit

Permalink
do not call render() for disabled passes
Browse files Browse the repository at this point in the history
  • Loading branch information
cuteday committed Dec 4, 2023
1 parent 69b7176 commit 54daf60
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/core/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ void DeviceManager::render() {
beginFrame();
for (auto it : mRenderPasses) it->beginFrame(mRenderContext.get());
for (auto it : mRenderPasses) {
if (!it->enabled()) continue;
if (it->isCudaPass()) mRenderContext->sychronizeCuda();
it->render(mRenderContext.get());
if (it->isCudaPass()) mRenderContext->sychronizeVulkan();
Expand Down
1 change: 1 addition & 0 deletions src/main/renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ void RenderApp::render() {
mpUIRenderer->beginFrame(getRenderContext());
for (auto it : mRenderPasses) it->beginFrame(getRenderContext());
for (auto it : mRenderPasses) {
if (!it->enabled()) continue;
if (it->isCudaPass()) getRenderContext()->sychronizeCuda();
it->render(getRenderContext());
if (it->isCudaPass()) getRenderContext()->sychronizeVulkan();
Expand Down
1 change: 0 additions & 1 deletion src/render/passes/accumulate/accumulate.cu
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ void AccumulatePass::reset() {
}

void AccumulatePass::render(RenderContext *context) {
if (!mEnable) return;
PROFILE("Accumulate pass");
if (mScene->getChanges()) reset();
static size_t lastResetFrame = 0;
Expand Down
2 changes: 0 additions & 2 deletions src/render/passes/denoise/denoise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ void DenoiseBackend::setPixelFormat(PixelFormat format) {
}

void DenoisePass::render(RenderContext *context) {
if (!mEnable) return;
PROFILE("Denoise");
auto size = context->getRenderTarget()->getSize();
CudaRenderTarget cudaFrame = context->getColorTexture()->getCudaRenderTarget();
Expand All @@ -148,7 +147,6 @@ void DenoisePass::render(RenderContext *context) {

void DenoisePass::renderUI() {
ui::Checkbox("Enabled", &mEnable);
if (!mEnable) return;
if (ui::Checkbox("Use geometry buffer", &mUseGeometry)) {
Log(Fatal, "Denoising guided by geometry features is not implemented yet TaT");
mBackend.setHaveGeometry(mUseGeometry);
Expand Down
2 changes: 1 addition & 1 deletion src/render/passes/errormeasure/errormeasure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ void ErrorMeasurePass::beginFrame(RenderContext* context) {
}

void ErrorMeasurePass::render(RenderContext *context) {
PROFILE("Metric calculation");
if (mNeedsEvaluate && mReferenceImage && mReferenceImage->isValid()) {
PROFILE("Metric calculation");
CHECK_LOG(mReferenceImage->getSize() == getFrameSize(),
"ErrorMeasure::Reference image size does not match frame size!");
size_t n_elememts = getFrameSize()[0] * getFrameSize()[1];
Expand Down
1 change: 0 additions & 1 deletion src/render/passes/tonemapping/tonemapping.cu
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ void ToneMappingPass::renderUI() {
}

void ToneMappingPass::render(RenderContext *context) {
if (!mEnable) return;
PROFILE("Tong mapping pass");
CUstream &stream = gpContext->cudaStream;
RGB colorTransform = RGB(mExposureCompensation);
Expand Down

0 comments on commit 54daf60

Please sign in to comment.