Skip to content

Commit

Permalink
Invalidate temporal accumulation on frame resize
Browse files Browse the repository at this point in the history
  • Loading branch information
Nelarius committed Jul 5, 2024
1 parent b230393 commit 55c9cf8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/pt/deferred_renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,8 @@ void DeferredRenderer::resize(const GpuContext& gpuContext, const Extent2u& newS

mDebugPass.resize(gpuContext, mAlbedoTextureView, mNormalTextureView, mDepthTextureView);
mLightingPass.resize(gpuContext, mAlbedoTextureView, mNormalTextureView, mDepthTextureView);

invalidateTemporalAccumulation();
}

DeferredRenderer::GbufferPass::GbufferPass(
Expand Down Expand Up @@ -2041,4 +2043,11 @@ DeferredRenderer::PerfStats DeferredRenderer::getPerfStats() const
mResolvePassDurationsNs.begin(), mResolvePassDurationsNs.end(), 0ll)) /
mResolvePassDurationsNs.size()};
}

void DeferredRenderer::invalidateTemporalAccumulation()
{
// In the first frame of the accumulation sequence, we are forced to write the lighting pass
// sample straight to the accumulation buffer. This effectively resets the accumulation.
mFrameCount = 0;
}
} // namespace nlrs
2 changes: 2 additions & 0 deletions src/pt/deferred_renderer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ class DeferredRenderer
Gui& gui);
};

void invalidateTemporalAccumulation();

WGPUTexture mDepthTexture;
WGPUTextureView mDepthTextureView;
WGPUTexture mAlbedoTexture;
Expand Down

0 comments on commit 55c9cf8

Please sign in to comment.