diff options
author | clayjohn <claynjohn@gmail.com> | 2022-11-11 10:05:07 -0800 |
---|---|---|
committer | clayjohn <claynjohn@gmail.com> | 2022-11-11 10:05:07 -0800 |
commit | 539b73384f980b407f107c019e78d7023396ed6c (patch) | |
tree | ee6a17a802a01441c45080975ba336d3c9fe3b68 | |
parent | 340fb33e543fb5775e36a7d49d605b4e3a33e5d6 (diff) |
Implement texture_proxy_update which is needed for AnimatedTexture
-rw-r--r-- | drivers/gles3/storage/texture_storage.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/gles3/storage/texture_storage.cpp b/drivers/gles3/storage/texture_storage.cpp index 2c2341e1cf..51e22fe779 100644 --- a/drivers/gles3/storage/texture_storage.cpp +++ b/drivers/gles3/storage/texture_storage.cpp @@ -721,6 +721,26 @@ void TextureStorage::texture_2d_update(RID p_texture, const Ref<Image> &p_image, } void TextureStorage::texture_proxy_update(RID p_texture, RID p_proxy_to) { + Texture *tex = texture_owner.get_or_null(p_texture); + ERR_FAIL_COND(!tex); + ERR_FAIL_COND(!tex->is_proxy); + Texture *proxy_to = texture_owner.get_or_null(p_proxy_to); + ERR_FAIL_COND(!proxy_to); + ERR_FAIL_COND(proxy_to->is_proxy); + + if (tex->proxy_to.is_valid()) { + Texture *prev_tex = texture_owner.get_or_null(tex->proxy_to); + ERR_FAIL_COND(!prev_tex); + prev_tex->proxies.erase(p_texture); + } + + *tex = *proxy_to; + + tex->proxy_to = p_proxy_to; + tex->is_render_target = false; + tex->is_proxy = true; + tex->proxies.clear(); + proxy_to->proxies.push_back(p_texture); } void TextureStorage::texture_2d_placeholder_initialize(RID p_texture) { |