Commit: 76f49c7a7b260933eb6b3903fe3e987e4928f37c
Author: Clément Foucault
Date:   Sun Jun 24 17:54:53 2018 +0200
Branches: temp-eeveelightcache
https://developer.blender.org/rB76f49c7a7b260933eb6b3903fe3e987e4928f37c

Eevee: LightCache: Fix fbos created in wrong context.

===================================================================

M       source/blender/draw/engines/eevee/eevee_lightcache.c

===================================================================

diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.c 
b/source/blender/draw/engines/eevee/eevee_lightcache.c
index 01f749b37f6..bcede16334f 100644
--- a/source/blender/draw/engines/eevee/eevee_lightcache.c
+++ b/source/blender/draw/engines/eevee/eevee_lightcache.c
@@ -305,8 +305,6 @@ static void 
eevee_lightbake_create_resources(EEVEE_LightBake *lbake)
        lbake->grid_prev = DRW_texture_create_2D_array(lbake->irr_size[0], 
lbake->irr_size[1], lbake->irr_size[2],
                                                       IRRADIANCE_FORMAT, 
DRW_TEX_FILTER, NULL);
 
-       eevee_lightbake_create_render_target(lbake, lbake->rt_res);
-
        /* Ensure Light Cache is ready to accept new data. If not recreate one.
         * WARNING: All the following must be threadsafe. It's currently 
protected
         * by the DRW mutex. */
@@ -721,6 +719,12 @@ void EEVEE_lightbake_job(void *custom_data, short *stop, 
short *do_update, float
        lbake->do_update = do_update;
        lbake->progress = progress;
 
+       /* We need to create the FBOs in the right context.
+        * We cannot do it in the main thread. */
+       eevee_lightbake_context_enable(lbake);
+       eevee_lightbake_create_render_target(lbake, lbake->rt_res);
+       eevee_lightbake_context_disable(lbake);
+
        /* Gather all probes data */
        eevee_lightbake_gather_probes(lbake);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to