Fix T47132: Cycles Rendering Tiles Indicator Limited to 16
authorSergey Sharybin <sergey.vfx@gmail.com>
Sat, 23 Jan 2016 20:31:36 +0000 (01:31 +0500)
committerSergey Sharybin <sergey.vfx@gmail.com>
Sat, 23 Jan 2016 20:31:36 +0000 (01:31 +0500)
source/blender/render/intern/source/external_engine.c

index 5abad9ea01a0aab7cf87282df0cd05c41726101b..082c2ace241fb78eb1db1b6ff2c054f8b50a91e6 100644 (file)
@@ -415,15 +415,18 @@ rcti* RE_engine_get_current_tiles(Render *re, int *r_total_tiles, bool *r_needs_
                                /* Just in case we're using crazy network rendering with more
                                 * slaves as BLENDER_MAX_THREADS.
                                 */
-                               if (tiles == tiles_static)
-                                       tiles = MEM_mallocN(allocation_step * sizeof(rcti), "current engine tiles");
-                               else
-                                       tiles = MEM_reallocN(tiles, (total_tiles + allocation_step) * sizeof(rcti));
-
                                allocation_size += allocation_step;
+                               if (tiles == tiles_static) {
+                                       /* Can not realloc yet, tiles are pointing to a
+                                        * stack memory.
+                                        */
+                                       tiles = MEM_mallocN(allocation_size * sizeof(rcti), "current engine tiles");
+                               }
+                               else {
+                                       tiles = MEM_reallocN(tiles, allocation_size * sizeof(rcti));
+                               }
                                *r_needs_free = true;
                        }
-
                        tiles[total_tiles] = pa->disprect;
 
                        if (pa->crop) {