Fixes recently introduced shader leaks

This commit is contained in:
qarmin 2020-06-27 15:08:20 +02:00
parent b740f645f7
commit 997d367b51
3 changed files with 11 additions and 2 deletions

View File

@ -2497,7 +2497,7 @@ RasterizerCanvasRD::~RasterizerCanvasRD() {
_dispose_bindings(); _dispose_bindings();
//anything remains? //anything remains?
if (bindings.texture_bindings.size()) { 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; const TextureBindingID *key = nullptr;
while ((key = bindings.texture_bindings.next(key))) { while ((key = bindings.texture_bindings.next(key))) {
TextureBinding *tb = bindings.texture_bindings[*key]; TextureBinding *tb = bindings.texture_bindings[*key];

View File

@ -1612,6 +1612,7 @@ RasterizerEffectsRD::~RasterizerEffectsRD() {
cubemap_downsampler.shader.version_free(cubemap_downsampler.shader_version); cubemap_downsampler.shader.version_free(cubemap_downsampler.shader_version);
filter.shader.version_free(filter.shader_version); filter.shader.version_free(filter.shader_version);
luminance_reduce.shader.version_free(luminance_reduce.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.shader.version_free(roughness.shader_version);
roughness_limiter.shader.version_free(roughness_limiter.shader_version); roughness_limiter.shader.version_free(roughness_limiter.shader_version);
specular_merge.shader.version_free(specular_merge.shader_version); specular_merge.shader.version_free(specular_merge.shader_version);

View File

@ -6802,10 +6802,18 @@ RasterizerSceneRD::~RasterizerSceneRD() {
} }
RD::get_singleton()->free(default_giprobe_buffer); RD::get_singleton()->free(default_giprobe_buffer);
RD::get_singleton()->free(gi_probe_lights_uniform); 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_debug_shader.version_free(giprobe_debug_shader_version);
giprobe_shader.version_free(giprobe_lighting_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); memdelete_arr(gi_probe_lights);
SkyMaterialData *md = (SkyMaterialData *)storage->material_get_data(sky_shader.default_material, RasterizerStorageRD::SHADER_TYPE_SKY); SkyMaterialData *md = (SkyMaterialData *)storage->material_get_data(sky_shader.default_material, RasterizerStorageRD::SHADER_TYPE_SKY);
sky_shader.shader.version_free(md->shader_data->version); sky_shader.shader.version_free(md->shader_data->version);