diff options
author | clayjohn <claynjohn@gmail.com> | 2023-03-07 10:33:48 -0800 |
---|---|---|
committer | Yuri Sizov <yuris@humnom.net> | 2023-03-13 14:10:38 +0100 |
commit | 5662542526f95c57cb43c72e8f9804cdb2cd8906 (patch) | |
tree | 7bb21c38390f0fd564185c11d7eac5244ab5461b /servers/rendering/renderer_rd/storage_rd | |
parent | 1d21652f80458d73394f7fb8e4cf1cf907a098da (diff) |
Avoid copying CanvasTexture when updating proxy
(cherry picked from commit 84482ef90bf5f902f14594d957af8c0e3866f88c)
Diffstat (limited to 'servers/rendering/renderer_rd/storage_rd')
-rw-r--r-- | servers/rendering/renderer_rd/storage_rd/texture_storage.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp b/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp index 50b324a9fd..a1346661e1 100644 --- a/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp +++ b/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp @@ -1193,6 +1193,9 @@ void TextureStorage::texture_proxy_update(RID p_texture, RID p_proxy_to) { 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 = p_proxy_to; @@ -1200,6 +1203,7 @@ void TextureStorage::texture_proxy_update(RID p_texture, RID p_proxy_to) { tex->is_proxy = true; tex->proxies.clear(); proxy_to->proxies.push_back(p_texture); + tex->canvas_texture = canvas_texture; tex->rd_view.format_override = tex->rd_format; tex->rd_texture = RD::get_singleton()->texture_create_shared(tex->rd_view, proxy_to->rd_texture); |