Fix T46951: GLSL draw mode missing some textures.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Fri, 11 Dec 2015 01:53:21 +0000 (02:53 +0100)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Fri, 11 Dec 2015 02:03:33 +0000 (03:03 +0100)
source/blender/gpu/intern/gpu_codegen.c

index 800ed9399a905d7cd93d4c7abeb02afdd05519fc..1db44c5b3a97fa3949eb38e97826729b729e52e1 100644 (file)
@@ -1000,18 +1000,21 @@ void GPU_pass_bind(GPUPass *pass, double time, int mipmap)
 
        GPU_shader_bind(shader);
 
-       /* now bind the textures */
+       /* create the textures */
        for (input = inputs->first; input; input = input->next) {
                if (input->ima)
                        input->tex = GPU_texture_from_blender(input->ima, input->iuser, input->image_isdata, time, mipmap);
                else if (input->prv)
                        input->tex = GPU_texture_from_preview(input->prv, mipmap);
+       }
 
+       /* bind the textures, in second loop so texture binding during
+        * create doesn't overwrite already bound textures */
+       for (input = inputs->first; input; input = input->next) {
                if (input->tex && input->bindtex) {
                        GPU_texture_bind(input->tex, input->texid);
                        GPU_shader_uniform_texture(shader, input->shaderloc, input->tex);
                }
-                       
        }
 }