Merge pull request #55669 from lawnjelly/rid_fixes
This commit is contained in:
commit
dbe9bb85c9
5 changed files with 52 additions and 10 deletions
|
@ -537,5 +537,8 @@ RasterizerGLES2::RasterizerGLES2() {
|
||||||
RasterizerGLES2::~RasterizerGLES2() {
|
RasterizerGLES2::~RasterizerGLES2() {
|
||||||
memdelete(scene);
|
memdelete(scene);
|
||||||
memdelete(canvas);
|
memdelete(canvas);
|
||||||
|
|
||||||
|
// Storage needs to be deleted after canvas as canvas destructor frees RIDs
|
||||||
|
// stored in storage RID owners.
|
||||||
memdelete(storage);
|
memdelete(storage);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4077,3 +4077,28 @@ void RasterizerSceneGLES2::finalize() {
|
||||||
RasterizerSceneGLES2::RasterizerSceneGLES2() {
|
RasterizerSceneGLES2::RasterizerSceneGLES2() {
|
||||||
_light_counter = 0;
|
_light_counter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RasterizerSceneGLES2::~RasterizerSceneGLES2() {
|
||||||
|
storage->free(default_material);
|
||||||
|
default_material = RID();
|
||||||
|
storage->free(default_material_twosided);
|
||||||
|
default_material_twosided = RID();
|
||||||
|
storage->free(default_shader);
|
||||||
|
default_shader = RID();
|
||||||
|
storage->free(default_shader_twosided);
|
||||||
|
default_shader_twosided = RID();
|
||||||
|
|
||||||
|
storage->free(default_worldcoord_material);
|
||||||
|
default_worldcoord_material = RID();
|
||||||
|
storage->free(default_worldcoord_material_twosided);
|
||||||
|
default_worldcoord_material_twosided = RID();
|
||||||
|
storage->free(default_worldcoord_shader);
|
||||||
|
default_worldcoord_shader = RID();
|
||||||
|
storage->free(default_worldcoord_shader_twosided);
|
||||||
|
default_worldcoord_shader_twosided = RID();
|
||||||
|
|
||||||
|
storage->free(default_overdraw_material);
|
||||||
|
default_overdraw_material = RID();
|
||||||
|
storage->free(default_overdraw_shader);
|
||||||
|
default_overdraw_shader = RID();
|
||||||
|
}
|
||||||
|
|
|
@ -773,6 +773,7 @@ public:
|
||||||
void initialize();
|
void initialize();
|
||||||
void finalize();
|
void finalize();
|
||||||
RasterizerSceneGLES2();
|
RasterizerSceneGLES2();
|
||||||
|
~RasterizerSceneGLES2();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // RASTERIZERSCENEGLES2_H
|
#endif // RASTERIZERSCENEGLES2_H
|
||||||
|
|
|
@ -499,5 +499,8 @@ RasterizerGLES3::RasterizerGLES3() {
|
||||||
RasterizerGLES3::~RasterizerGLES3() {
|
RasterizerGLES3::~RasterizerGLES3() {
|
||||||
memdelete(scene);
|
memdelete(scene);
|
||||||
memdelete(canvas);
|
memdelete(canvas);
|
||||||
|
|
||||||
|
// storage must be deleted last,
|
||||||
|
// because it contains RID_owners that are used by scene and canvas destructors
|
||||||
memdelete(storage);
|
memdelete(storage);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5282,18 +5282,28 @@ RasterizerSceneGLES3::RasterizerSceneGLES3() {
|
||||||
}
|
}
|
||||||
|
|
||||||
RasterizerSceneGLES3::~RasterizerSceneGLES3() {
|
RasterizerSceneGLES3::~RasterizerSceneGLES3() {
|
||||||
memdelete(storage->material_owner.getptr(default_material));
|
storage->free(default_material);
|
||||||
memdelete(storage->material_owner.getptr(default_material_twosided));
|
default_material = RID();
|
||||||
memdelete(storage->shader_owner.getptr(default_shader));
|
storage->free(default_material_twosided);
|
||||||
memdelete(storage->shader_owner.getptr(default_shader_twosided));
|
default_material_twosided = RID();
|
||||||
|
storage->free(default_shader);
|
||||||
|
default_shader = RID();
|
||||||
|
storage->free(default_shader_twosided);
|
||||||
|
default_shader_twosided = RID();
|
||||||
|
|
||||||
memdelete(storage->material_owner.getptr(default_worldcoord_material));
|
storage->free(default_worldcoord_material);
|
||||||
memdelete(storage->material_owner.getptr(default_worldcoord_material_twosided));
|
default_worldcoord_material = RID();
|
||||||
memdelete(storage->shader_owner.getptr(default_worldcoord_shader));
|
storage->free(default_worldcoord_material_twosided);
|
||||||
memdelete(storage->shader_owner.getptr(default_worldcoord_shader_twosided));
|
default_worldcoord_material_twosided = RID();
|
||||||
|
storage->free(default_worldcoord_shader);
|
||||||
|
default_worldcoord_shader = RID();
|
||||||
|
storage->free(default_worldcoord_shader_twosided);
|
||||||
|
default_worldcoord_shader_twosided = RID();
|
||||||
|
|
||||||
memdelete(storage->material_owner.getptr(default_overdraw_material));
|
storage->free(default_overdraw_material);
|
||||||
memdelete(storage->shader_owner.getptr(default_overdraw_shader));
|
default_overdraw_material = RID();
|
||||||
|
storage->free(default_overdraw_shader);
|
||||||
|
default_overdraw_shader = RID();
|
||||||
|
|
||||||
memfree(state.spot_array_tmp);
|
memfree(state.spot_array_tmp);
|
||||||
memfree(state.omni_array_tmp);
|
memfree(state.omni_array_tmp);
|
||||||
|
|
Loading…
Reference in a new issue