Fix: Address mobile resource leaks in render

Update render_forward_mobile destructor to include instance buffers.
Update render_scene_buffers_rd cleanup to include weight buffers / blur
textures.

(cherry picked from commit dfa326ef55)
This commit is contained in:
David Sullivan 2024-03-14 16:07:44 -04:00 committed by Rémi Verschelde
parent db47101f68
commit 94ddc44a12
No known key found for this signature in database
GPG Key ID: C3336907360768E1
2 changed files with 12 additions and 0 deletions

View File

@ -2896,6 +2896,11 @@ RenderForwardMobile::~RenderForwardMobile() {
for (const RID &rid : scene_state.uniform_buffers) {
RD::get_singleton()->free(rid);
}
for (uint32_t i = 0; i < RENDER_LIST_MAX; i++) {
if (scene_state.instance_buffer[i].is_valid()) {
RD::get_singleton()->free(scene_state.instance_buffer[i]);
}
}
RD::get_singleton()->free(scene_state.lightmap_buffer);
RD::get_singleton()->free(scene_state.lightmap_capture_buffer);
memdelete_arr(scene_state.lightmap_captures);

View File

@ -125,6 +125,13 @@ void RenderSceneBuffersRD::cleanup() {
free_named_texture(E.value);
}
named_textures.clear();
// Clear weight_buffer / blur textures.
for (const WeightBuffers &weight_buffer : weight_buffers) {
if (weight_buffer.weight.is_valid()) {
RD::get_singleton()->free(weight_buffer.weight);
}
}
}
void RenderSceneBuffersRD::configure(const RenderSceneBuffersConfiguration *p_config) {