Skip to content

Commit

Permalink
Free dummy renderer objects
Browse files Browse the repository at this point in the history
These leaked during tests etc.
  • Loading branch information
AThousandShips committed Jan 29, 2024
1 parent fa48a51 commit 666daf4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions servers/rendering/dummy/storage/material_storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ class MaterialStorage : public RendererMaterialStorage {

/* SHADER API */

bool owns_shader(RID p_rid) { return shader_owner.owns(p_rid); }

virtual RID shader_allocate() override;
virtual void shader_initialize(RID p_rid) override;
virtual void shader_free(RID p_rid) override;
Expand Down
2 changes: 2 additions & 0 deletions servers/rendering/dummy/storage/mesh_storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ class MeshStorage : public RendererMeshStorage {

/* MULTIMESH API */

bool owns_multimesh(RID p_rid) { return multimesh_owner.owns(p_rid); }

virtual RID multimesh_allocate() override;
virtual void multimesh_initialize(RID p_rid) override;
virtual void multimesh_free(RID p_rid) override;
Expand Down
7 changes: 7 additions & 0 deletions servers/rendering/dummy/storage/utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#ifndef UTILITIES_DUMMY_H
#define UTILITIES_DUMMY_H

#include "material_storage.h"
#include "mesh_storage.h"
#include "servers/rendering/storage/utilities.h"
#include "texture_storage.h"
Expand Down Expand Up @@ -63,6 +64,12 @@ class Utilities : public RendererUtilities {
} else if (RendererDummy::MeshStorage::get_singleton()->owns_mesh(p_rid)) {
RendererDummy::MeshStorage::get_singleton()->mesh_free(p_rid);
return true;
} else if (RendererDummy::MeshStorage::get_singleton()->owns_multimesh(p_rid)) {
RendererDummy::MeshStorage::get_singleton()->multimesh_free(p_rid);
return true;
} else if (RendererDummy::MaterialStorage::get_singleton()->owns_shader(p_rid)) {
RendererDummy::MaterialStorage::get_singleton()->shader_free(p_rid);
return true;
}
return false;
}
Expand Down

0 comments on commit 666daf4

Please sign in to comment.