From 802a08b1463c919e78b7de15eee1be1d8672568d Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 5 Oct 2019 19:53:39 +0200 Subject: [PATCH] glgsg: fix unnecessary create-delete-create of new textures --- panda/src/glstuff/glGraphicsStateGuardian_src.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index 42b29f5944..af9ab8ac49 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -5850,7 +5850,8 @@ prepare_texture(Texture *tex, int view) { report_my_gl_errors(); // Make sure we'll support this texture when it's rendered. Don't bother to // prepare it if we won't. - switch (tex->get_texture_type()) { + Texture::TextureType texture_type = tex->get_texture_type(); + switch (texture_type) { case Texture::TT_3d_texture: if (!_supports_3d_texture) { GLCAT.warning() @@ -5896,6 +5897,7 @@ prepare_texture(Texture *tex, int view) { } CLP(TextureContext) *gtc = new CLP(TextureContext)(this, _prepared_objects, tex, view); + gtc->_target = get_texture_target(texture_type); report_my_gl_errors(); return gtc;