diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-09-13 10:25:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-13 10:25:11 +0200 |
commit | 0f3f8509ec7c767b4dc48e59da7e990d1b08cb60 (patch) | |
tree | 4ed630c0dcbe41caad3ce6a041b59d5f0983f9e0 /servers | |
parent | c4fc47317a46298c5414aa9476fbcdeea6c32f81 (diff) | |
parent | 873366cb2db14a93cb84306cee1d635ab2726b77 (diff) |
Merge pull request #65738 from BastiaanOlij/fix_ssao_ssil_memory_leak
Diffstat (limited to 'servers')
-rw-r--r-- | servers/rendering/renderer_rd/effects/ss_effects.cpp | 6 | ||||
-rw-r--r-- | servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/servers/rendering/renderer_rd/effects/ss_effects.cpp b/servers/rendering/renderer_rd/effects/ss_effects.cpp index 971e9243e3..582c5abbdd 100644 --- a/servers/rendering/renderer_rd/effects/ss_effects.cpp +++ b/servers/rendering/renderer_rd/effects/ss_effects.cpp @@ -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; @@ -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 */ diff --git a/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp b/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp index 84b65371e0..16fdbc07f5 100644 --- a/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp +++ b/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp @@ -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); |