DRW: Fix crash caused by hair transform feedback
authorClément Foucault <foucault.clem@gmail.com>
Wed, 13 Jun 2018 20:20:48 +0000 (22:20 +0200)
committerClément Foucault <foucault.clem@gmail.com>
Wed, 13 Jun 2018 20:20:48 +0000 (22:20 +0200)
Seem to be cause by the lack of proper FBO bound.

source/blender/draw/engines/eevee/eevee_render.c
source/blender/draw/intern/draw_manager.c

index 5d31488..d245519 100644 (file)
@@ -423,6 +423,8 @@ void EEVEE_render_draw(EEVEE_Data *vedata, RenderEngine *engine, RenderLayer *rl
        DRW_render_instance_buffer_finish();
 
        /* Need to be called after DRW_render_instance_buffer_finish() */
+       /* Also we weed to have a correct fbo bound for DRW_hair_update */
+       GPU_framebuffer_bind(fbl->main_fb);
        DRW_hair_update();
 
        if ((view_layer->passflag & (SCE_PASS_SUBSURFACE_COLOR |
index ee87627..4991f32 100644 (file)
@@ -1311,13 +1311,14 @@ void DRW_draw_render_loop_ex(
        }
 
        DRW_stats_begin();
-       DRW_hair_update();
 
        GPU_framebuffer_bind(DST.default_framebuffer);
 
        /* Start Drawing */
        DRW_state_reset();
 
+       DRW_hair_update();
+
        drw_engines_draw_background();
 
        /* WIP, single image drawn over the camera view (replace) */
@@ -1737,8 +1738,6 @@ void DRW_draw_select_loop(
                DRW_render_instance_buffer_finish();
        }
 
-       DRW_hair_update();
-
        /* Setup framebuffer */
        draw_select_framebuffer_setup(rect);
        GPU_framebuffer_bind(g_select_buffer.framebuffer);
@@ -1748,6 +1747,8 @@ void DRW_draw_select_loop(
        DRW_state_reset();
        DRW_draw_callbacks_pre_scene();
 
+       DRW_hair_update();
+
        DRW_state_lock(
                DRW_STATE_WRITE_DEPTH |
                DRW_STATE_DEPTH_ALWAYS |
@@ -1897,10 +1898,11 @@ void DRW_draw_depth_loop(
                DRW_render_instance_buffer_finish();
        }
 
-       DRW_hair_update();
-
        /* Start Drawing */
        DRW_state_reset();
+
+       DRW_hair_update();
+
        DRW_draw_callbacks_pre_scene();
        drw_engines_draw_scene();
        DRW_draw_callbacks_post_scene();