Merge pull request #31470 from clayjohn/GLES2-skeleton-memory-leak

Check if skeleton texture is already allocated before reallocating
This commit is contained in:
Rémi Verschelde 2019-08-19 10:05:42 +02:00 committed by GitHub
commit e71cf83fbd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3496,6 +3496,8 @@ RID RasterizerStorageGLES2::skeleton_create() {
Skeleton *skeleton = memnew(Skeleton); Skeleton *skeleton = memnew(Skeleton);
glGenTextures(1, &skeleton->tex_id);
return skeleton_owner.make_rid(skeleton); return skeleton_owner.make_rid(skeleton);
} }
@ -3513,7 +3515,6 @@ void RasterizerStorageGLES2::skeleton_allocate(RID p_skeleton, int p_bones, bool
skeleton->use_2d = p_2d_skeleton; skeleton->use_2d = p_2d_skeleton;
if (config.float_texture_supported) { if (config.float_texture_supported) {
glGenTextures(1, &skeleton->tex_id);
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, skeleton->tex_id); glBindTexture(GL_TEXTURE_2D, skeleton->tex_id);