Fix T62997 Eevee: visual artifacts during irradiance volume baking
authorClément Foucault <foucault.clem@gmail.com>
Wed, 27 Mar 2019 18:15:23 +0000 (19:15 +0100)
committerClément Foucault <foucault.clem@gmail.com>
Wed, 27 Mar 2019 18:15:32 +0000 (19:15 +0100)
Seems to be a problem with Nvidia drivers. glFlush does not work but
glFinish does ensure correct multithreading.

source/blender/draw/intern/draw_manager.c

index f8438742ed86ad3a276aa0b37843fc0adef7c3d2..9f956717fb22049d9368fea97689b6ccf05da6b7 100644 (file)
@@ -2008,6 +2008,12 @@ void DRW_custom_pipeline(
        GPU_viewport_free(DST.viewport);
        GPU_framebuffer_restore();
 
+       /* The use of custom pipeline in other thread using the same
+        * resources as the main thread (viewport) may lead to data
+        * races and undefined behavior on certain drivers. Using
+        * GPU_finish to sync seems to fix the issue. (see T62997) */
+       GPU_finish();
+
 #ifdef DEBUG
        /* Avoid accidental reuse. */
        drw_state_ensure_not_reused(&DST);