GPU: Avoid access violation while reading the `pass->shader`.
authormano-wii <germano.costa@ig.com.br>
Mon, 11 Mar 2019 23:32:00 +0000 (20:32 -0300)
committermano-wii <germano.costa@ig.com.br>
Mon, 11 Mar 2019 23:32:31 +0000 (20:32 -0300)
source/blender/gpu/intern/gpu_codegen.c

index 8be4c178a7508b592996a2df6d6f80ce85ad045b..63105fa96e2fa796aa85f326ff0713e185afbb6f 100644 (file)
@@ -1978,14 +1978,14 @@ void GPU_pass_compile(GPUPass *pass, const char *shname)
                        }
                        pass->shader = NULL;
                }
-               pass->compiled = true;
-
-               if (!BLI_thread_is_main()) {
+               else if (!BLI_thread_is_main()) {
                        /* For some drivers, you must use the program at least once in the
                         * rendering context that it is created. */
                        glUseProgram(GPU_shader_get_program(pass->shader));
                        glUseProgram(0);
                }
+
+               pass->compiled = true;
        }
 }