From 997d367b51fbe34efb29243fde83f1b625facff1 Mon Sep 17 00:00:00 2001 From: qarmin Date: Sat, 27 Jun 2020 15:08:20 +0200 Subject: [PATCH] Fixes recently introduced shader leaks --- .../rendering/rasterizer_rd/rasterizer_canvas_rd.cpp | 2 +- .../rendering/rasterizer_rd/rasterizer_effects_rd.cpp | 1 + .../rendering/rasterizer_rd/rasterizer_scene_rd.cpp | 10 +++++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.cpp index 4c477ca5f4a..aad2be45c68 100644 --- a/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.cpp +++ b/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.cpp @@ -2497,7 +2497,7 @@ RasterizerCanvasRD::~RasterizerCanvasRD() { _dispose_bindings(); //anything remains? if (bindings.texture_bindings.size()) { - ERR_PRINT("Some texture bindings were not properly freed (leaked canvasitems?"); + ERR_PRINT("Some texture bindings were not properly freed (leaked CanvasItems?)"); const TextureBindingID *key = nullptr; while ((key = bindings.texture_bindings.next(key))) { TextureBinding *tb = bindings.texture_bindings[*key]; diff --git a/servers/rendering/rasterizer_rd/rasterizer_effects_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_effects_rd.cpp index 0c036b886cc..3f594ab2648 100644 --- a/servers/rendering/rasterizer_rd/rasterizer_effects_rd.cpp +++ b/servers/rendering/rasterizer_rd/rasterizer_effects_rd.cpp @@ -1612,6 +1612,7 @@ RasterizerEffectsRD::~RasterizerEffectsRD() { cubemap_downsampler.shader.version_free(cubemap_downsampler.shader_version); filter.shader.version_free(filter.shader_version); luminance_reduce.shader.version_free(luminance_reduce.shader_version); + resolve.shader.version_free(resolve.shader_version); roughness.shader.version_free(roughness.shader_version); roughness_limiter.shader.version_free(roughness_limiter.shader_version); specular_merge.shader.version_free(specular_merge.shader_version); diff --git a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp index 898cb39204c..8754fe6acb0 100644 --- a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp +++ b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp @@ -6802,10 +6802,18 @@ RasterizerSceneRD::~RasterizerSceneRD() { } RD::get_singleton()->free(default_giprobe_buffer); - RD::get_singleton()->free(gi_probe_lights_uniform); + RD::get_singleton()->free(gi.sdfgi_ubo); + giprobe_debug_shader.version_free(giprobe_debug_shader_version); giprobe_shader.version_free(giprobe_lighting_shader_version); + gi.shader.version_free(gi.shader_version); + sdfgi_shader.debug_probes.version_free(sdfgi_shader.debug_probes_shader); + sdfgi_shader.debug.version_free(sdfgi_shader.debug_shader); + sdfgi_shader.direct_light.version_free(sdfgi_shader.direct_light_shader); + sdfgi_shader.integrate.version_free(sdfgi_shader.integrate_shader); + sdfgi_shader.preprocess.version_free(sdfgi_shader.preprocess_shader); + memdelete_arr(gi_probe_lights); SkyMaterialData *md = (SkyMaterialData *)storage->material_get_data(sky_shader.default_material, RasterizerStorageRD::SHADER_TYPE_SKY); sky_shader.shader.version_free(md->shader_data->version);