Skip to content

Commit

Permalink
Merge pull request godotengine#65738 from BastiaanOlij/fix_ssao_ssil_…
Browse files Browse the repository at this point in the history
…memory_leak
  • Loading branch information
akien-mga committed Sep 13, 2022
2 parents c4fc473 + 873366c commit 0f3f850
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions servers/rendering/renderer_rd/effects/ss_effects.cpp
Expand Up @@ -443,6 +443,11 @@ void SSEffects::downsample_depth(RID p_depth_buffer, const Vector<RID> &p_depth_

RD::get_singleton()->draw_command_begin_label("Downsample Depth");
if (p_invalidate_uniform_set || use_full_mips != ss_effects.used_full_mips_last_frame || use_half_size != ss_effects.used_half_size_last_frame || use_mips != ss_effects.used_mips_last_frame) {
if (ss_effects.downsample_uniform_set.is_valid() && RD::get_singleton()->uniform_set_is_valid(ss_effects.downsample_uniform_set)) {
RD::get_singleton()->free(ss_effects.downsample_uniform_set);
ss_effects.downsample_uniform_set = RID();
}

Vector<RD::Uniform> uniforms;
{
RD::Uniform u;
Expand Down Expand Up @@ -516,6 +521,7 @@ void SSEffects::downsample_depth(RID p_depth_buffer, const Vector<RID> &p_depth_

ss_effects.used_full_mips_last_frame = use_full_mips;
ss_effects.used_half_size_last_frame = use_half_size;
ss_effects.used_mips_last_frame = use_mips;
}

/* SSIL */
Expand Down
Expand Up @@ -128,6 +128,11 @@ void RenderSceneBuffersRD::cleanup() {
ss_effects.linear_depth_slices.clear();
}

if (ss_effects.downsample_uniform_set.is_valid() && RD::get_singleton()->uniform_set_is_valid(ss_effects.downsample_uniform_set)) {
RD::get_singleton()->free(ss_effects.downsample_uniform_set);
ss_effects.downsample_uniform_set = RID();
}

sse->ssao_free(ss_effects.ssao);
sse->ssil_free(ss_effects.ssil);
sse->ssr_free(ssr);
Expand Down

0 comments on commit 0f3f850

Please sign in to comment.