From 5fbc24f3e0cb39829af7b114d1c83573babf30ab Mon Sep 17 00:00:00 2001 From: Bastiaan Olij Date: Wed, 22 Dec 2021 11:46:37 +1100 Subject: [PATCH] Fix issue with external textures being freed by Godot --- drivers/gles2/rasterizer_storage_gles2.cpp | 2 ++ drivers/gles3/rasterizer_storage_gles3.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp index 4eecdd0b31d..a925380778b 100644 --- a/drivers/gles2/rasterizer_storage_gles2.cpp +++ b/drivers/gles2/rasterizer_storage_gles2.cpp @@ -5264,6 +5264,7 @@ void RasterizerStorageGLES2::_render_target_clear(RenderTarget *rt) { // clean up our texture Texture *t = texture_owner.get(rt->external.texture); + t->tex_id = 0; t->alloc_height = 0; t->alloc_width = 0; t->width = 0; @@ -5428,6 +5429,7 @@ void RasterizerStorageGLES2::render_target_set_external_texture(RID p_render_tar // clean up our texture Texture *t = texture_owner.get(rt->external.texture); + t->tex_id = 0; t->alloc_height = 0; t->alloc_width = 0; t->width = 0; diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 586eb7f3969..04077e25840 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -6850,6 +6850,7 @@ void RasterizerStorageGLES3::_render_target_clear(RenderTarget *rt) { // clean up our texture Texture *t = texture_owner.get(rt->external.texture); + t->tex_id = 0; t->alloc_height = 0; t->alloc_width = 0; t->width = 0; @@ -7359,6 +7360,7 @@ void RasterizerStorageGLES3::render_target_set_external_texture(RID p_render_tar // clean up our texture Texture *t = texture_owner.get(rt->external.texture); + t->tex_id = 0; t->alloc_height = 0; t->alloc_width = 0; t->width = 0;