Skip to content

Commit

Permalink
wip invalidate temporal accumulation on frame resize
Browse files Browse the repository at this point in the history
  • Loading branch information
Nelarius committed Jul 3, 2024
1 parent dbebd28 commit cf61592
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 @@ -611,6 +611,8 @@ void DeferredRenderer::resize(const GpuContext& gpuContext, const Extent2u& newS
mDepthTextureView,
mVelocityTextureView);
mLightingPass.resize(gpuContext, mAlbedoTextureView, mNormalTextureView, mDepthTextureView);

invalidateTemporalAccumulation();
}

DeferredRenderer::GbufferPass::GbufferPass(
Expand Down Expand Up @@ -2125,4 +2127,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 @@ -280,6 +280,8 @@ class DeferredRenderer
Gui& gui);
};

void invalidateTemporalAccumulation();

WGPUTexture mDepthTexture;
WGPUTextureView mDepthTextureView;
WGPUTexture mAlbedoTexture;
Expand Down

0 comments on commit cf61592

Please sign in to comment.