DRW: Fix regression
[blender.git] / source / blender / draw / intern / draw_manager.c
index 94f42f1ec18006ea6473808bd95e1b472aa2e457..1f3be9b1f4d4de778e8f2516ff6f203268dcf1d5 100644 (file)
@@ -1841,6 +1841,9 @@ static void bind_texture(GPUTexture *tex)
                for (int i = 0; i < GPU_max_textures(); ++i) {
                        RST.bind_tex_inc = (RST.bind_tex_inc + 1) % GPU_max_textures();
                        if (RST.bound_tex_slots[RST.bind_tex_inc] == false) {
+                               if (RST.bound_texs[RST.bind_tex_inc] != NULL) {
+                                       GPU_texture_unbind(RST.bound_texs[RST.bind_tex_inc]);
+                               }
                                GPU_texture_bind(tex, RST.bind_tex_inc);
                                RST.bound_texs[RST.bind_tex_inc] = tex;
                                RST.bound_tex_slots[RST.bind_tex_inc] = true;