Skip to content

Commit

Permalink
Release resources in move assignment operator
Browse files Browse the repository at this point in the history
  • Loading branch information
Nelarius committed Jul 14, 2024
1 parent 8289aa6 commit 634128c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/pt/deferred_renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,19 +250,26 @@ DeferredRenderer& DeferredRenderer::operator=(DeferredRenderer&& other)
{
if (this != &other)
{
textureSafeRelease(mDepthTexture);
mDepthTexture = other.mDepthTexture;
other.mDepthTexture = nullptr;
textureViewSafeRelease(mDepthTextureView);
mDepthTextureView = other.mDepthTextureView;
other.mDepthTextureView = nullptr;
textureSafeRelease(mAlbedoTexture);
mAlbedoTexture = other.mAlbedoTexture;
other.mAlbedoTexture = nullptr;
textureViewSafeRelease(mAlbedoTextureView);
mAlbedoTextureView = other.mAlbedoTextureView;
other.mAlbedoTextureView = nullptr;
textureSafeRelease(mNormalTexture);
mNormalTexture = other.mNormalTexture;
other.mNormalTexture = nullptr;
textureViewSafeRelease(mNormalTextureView);
mNormalTextureView = other.mNormalTextureView;
other.mNormalTextureView = nullptr;
mSampleBuffer = std::move(other.mSampleBuffer);
querySetSafeRelease(mQuerySet);
mQuerySet = other.mQuerySet;
other.mQuerySet = nullptr;
mQueryBuffer = std::move(other.mQueryBuffer);
Expand Down Expand Up @@ -1001,6 +1008,7 @@ DeferredRenderer::GbufferPass& DeferredRenderer::GbufferPass::operator=(
mUniformBuffer = std::move(other.mUniformBuffer);
mUniformBindGroup = std::move(other.mUniformBindGroup);
mSamplerBindGroup = std::move(other.mSamplerBindGroup);
renderPipelineSafeRelease(mPipeline);
mPipeline = other.mPipeline;
other.mPipeline = nullptr;
}
Expand Down

0 comments on commit 634128c

Please sign in to comment.