Free dummy renderer objects

These leaked during tests etc.
This commit is contained in:
A Thousand Ships 2024-01-29 18:48:47 +01:00
parent fa48a51183
commit 666daf47c3
No known key found for this signature in database
GPG Key ID: 2033189A662F8BD7
3 changed files with 11 additions and 0 deletions

View File

@ -76,6 +76,8 @@ public:
/* 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;

View File

@ -138,6 +138,8 @@ public:
/* 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;

View File

@ -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"
@ -63,6 +64,12 @@ public:
} 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;
}