[3.4] Cutdown version of RID fixes to sync with 3.5 RID handles

The RID Handles PR introduced a couple of bug fixes, they are added here without the RID handles functionality in order to keep 3.4 and 3.x roughly in sync, allowing further fixes to RID lifetimes to be backported.
This commit is contained in:
lawnjelly 2021-12-06 16:43:27 +00:00
parent fce6e13034
commit bf785444ff
4 changed files with 16 additions and 15 deletions

View file

@ -535,6 +535,7 @@ RasterizerGLES2::RasterizerGLES2() {
}
RasterizerGLES2::~RasterizerGLES2() {
memdelete(storage);
memdelete(scene);
memdelete(canvas);
memdelete(storage);
}

View file

@ -396,7 +396,7 @@ void RasterizerCanvasGLES3::_legacy_canvas_render_item(Item *p_ci, RenderItemSta
}
}
glBindBufferBase(GL_UNIFORM_BUFFER, 1, static_cast<LightInternal *>(light->light_internal.get_data())->ubo);
glBindBufferBase(GL_UNIFORM_BUFFER, 1, static_cast<LightInternal *>(light_internal_owner.get(light->light_internal))->ubo);
if (has_shadow) {
RasterizerStorageGLES3::CanvasLightShadow *cls = storage->canvas_light_shadow_owner.get(light->shadow_buffer);
@ -1500,7 +1500,7 @@ void RasterizerCanvasGLES3::render_joined_item(const BItemJoined &p_bij, RenderI
}
}
glBindBufferBase(GL_UNIFORM_BUFFER, 1, static_cast<LightInternal *>(light->light_internal.get_data())->ubo);
glBindBufferBase(GL_UNIFORM_BUFFER, 1, static_cast<LightInternal *>(light_internal_owner.get(light->light_internal))->ubo);
if (has_shadow) {
RasterizerStorageGLES3::CanvasLightShadow *cls = storage->canvas_light_shadow_owner.get(light->shadow_buffer);

View file

@ -490,7 +490,7 @@ RasterizerGLES3::RasterizerGLES3() {
}
RasterizerGLES3::~RasterizerGLES3() {
memdelete(storage);
memdelete(canvas);
memdelete(scene);
memdelete(canvas);
memdelete(storage);
}

View file

@ -5256,18 +5256,18 @@ RasterizerSceneGLES3::RasterizerSceneGLES3() {
}
RasterizerSceneGLES3::~RasterizerSceneGLES3() {
memdelete(default_material.get_data());
memdelete(default_material_twosided.get_data());
memdelete(default_shader.get_data());
memdelete(default_shader_twosided.get_data());
memdelete(storage->material_owner.getptr(default_material));
memdelete(storage->material_owner.getptr(default_material_twosided));
memdelete(storage->shader_owner.getptr(default_shader));
memdelete(storage->shader_owner.getptr(default_shader_twosided));
memdelete(default_worldcoord_material.get_data());
memdelete(default_worldcoord_material_twosided.get_data());
memdelete(default_worldcoord_shader.get_data());
memdelete(default_worldcoord_shader_twosided.get_data());
memdelete(storage->material_owner.getptr(default_worldcoord_material));
memdelete(storage->material_owner.getptr(default_worldcoord_material_twosided));
memdelete(storage->shader_owner.getptr(default_worldcoord_shader));
memdelete(storage->shader_owner.getptr(default_worldcoord_shader_twosided));
memdelete(default_overdraw_material.get_data());
memdelete(default_overdraw_shader.get_data());
memdelete(storage->material_owner.getptr(default_overdraw_material));
memdelete(storage->shader_owner.getptr(default_overdraw_shader));
memfree(state.spot_array_tmp);
memfree(state.omni_array_tmp);