Merging r50049 through r50076 from trunk into soc-2011-tomato
[blender.git] / source / blender / editors / space_view3d / view3d_draw.c
index 93f8457e7a374c5784125c3b81c14223584d939e..39403d83b421a97a32cadf86d99df0dd0f163e88 100644 (file)
@@ -2824,13 +2824,21 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw
 
        /* create render engine */
        if (!rv3d->render_engine) {
+               RenderEngine *engine;
+
                type = RE_engines_find(scene->r.engine);
 
                if (!(type->view_update && type->view_draw))
                        return 0;
 
-               rv3d->render_engine = RE_engine_create(type);
-               type->view_update(rv3d->render_engine, C);
+               engine = RE_engine_create(type);
+
+               engine->tile_x = scene->r.xparts;
+               engine->tile_y = scene->r.yparts;
+
+               type->view_update(engine, C);
+
+               rv3d->render_engine = engine;
        }
 
        /* setup view matrices */
@@ -3149,6 +3157,17 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
        const char *grid_unit = NULL;
        int draw_border = (rv3d->persp == RV3D_CAMOB && (scene->r.mode & R_BORDER));
 
+       /* --- until we get a clue and make viewport threadsafe (temp mango change for stability) */
+       if (G.is_rendering) {
+               ED_region_pixelspace(ar);
+               glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+               UI_ThemeClearColor(TH_BACK);
+               glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+               BLF_draw_default(10,10,0, "do do da da.. da da.. da da.. can't touch this!   it's render time", 512);
+               return;
+       }
+       /* --- end temp mango change */
+
        /* draw viewport using opengl */
        if (v3d->drawtype != OB_RENDER || !view3d_main_area_do_render_draw(C) || draw_border) {
                view3d_main_area_draw_objects(C, ar, &grid_unit);