Skip to content

Commit

Permalink
Merge pull request #89531 from sullyscience/fix-resource-leaks
Browse files Browse the repository at this point in the history
Fix mobile renderer RID leaks
  • Loading branch information
akien-mga committed Mar 24, 2024
2 parents 5940fd5 + dfa326e commit 70c05f6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2835,6 +2835,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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,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) {
Expand Down

0 comments on commit 70c05f6

Please sign in to comment.