You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-13 13:31:48 +00:00
Avoid copying CanvasTexture when updating proxy
This commit is contained in:
@@ -832,6 +832,8 @@ void TextureStorage::texture_proxy_update(RID p_texture, RID p_proxy_to) {
|
|||||||
tex->is_render_target = false;
|
tex->is_render_target = false;
|
||||||
tex->is_proxy = true;
|
tex->is_proxy = true;
|
||||||
tex->proxies.clear();
|
tex->proxies.clear();
|
||||||
|
tex->canvas_texture = nullptr;
|
||||||
|
tex->tex_id = 0;
|
||||||
proxy_to->proxies.push_back(p_texture);
|
proxy_to->proxies.push_back(p_texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1193,6 +1193,9 @@ void TextureStorage::texture_proxy_update(RID p_texture, RID p_proxy_to) {
|
|||||||
prev_tex->proxies.erase(p_texture);
|
prev_tex->proxies.erase(p_texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Copy canvas_texture so it doesn't leak.
|
||||||
|
CanvasTexture *canvas_texture = tex->canvas_texture;
|
||||||
|
|
||||||
*tex = *proxy_to;
|
*tex = *proxy_to;
|
||||||
|
|
||||||
tex->proxy_to = p_proxy_to;
|
tex->proxy_to = p_proxy_to;
|
||||||
@@ -1200,6 +1203,7 @@ void TextureStorage::texture_proxy_update(RID p_texture, RID p_proxy_to) {
|
|||||||
tex->is_proxy = true;
|
tex->is_proxy = true;
|
||||||
tex->proxies.clear();
|
tex->proxies.clear();
|
||||||
proxy_to->proxies.push_back(p_texture);
|
proxy_to->proxies.push_back(p_texture);
|
||||||
|
tex->canvas_texture = canvas_texture;
|
||||||
|
|
||||||
tex->rd_view.format_override = tex->rd_format;
|
tex->rd_view.format_override = tex->rd_format;
|
||||||
tex->rd_texture = RD::get_singleton()->texture_create_shared(tex->rd_view, proxy_to->rd_texture);
|
tex->rd_texture = RD::get_singleton()->texture_create_shared(tex->rd_view, proxy_to->rd_texture);
|
||||||
|
|||||||
Reference in New Issue
Block a user