diff options
author | Lukas Stockner <lukas.stockner@freenet.de> | 2015-12-24 02:29:40 +0300 |
---|---|---|
committer | Lukas Stockner <lukas.stockner@freenet.de> | 2015-12-24 03:42:59 +0300 |
commit | 8e07b878660550b8c3fbbdb5a2890b91b85aecaa (patch) | |
tree | a0d427c16b1c6182360e2434588b74378536cf2b /intern/cycles/render/tile.cpp | |
parent | 059b7a81e2a1ce19ac3c4262bd86eb8d961d5582 (diff) |
Cycles: Fix Tile access in the TileManager for viewport rendering
- When rendering in the Viewport, next_tile is sometimes called after a reset has been performed, but before
new tiles were generated. In that case, the tile list would be invalid, causing Blender to crash randomly.
- When generating new tiles, the TileManager would not clear the tile lists before re-generating them, leading
to some tiles being skipped during viewport rendering.
- When popping the next tile from a tile list, a reference to the just-deleted object would be returned, now the
object is copied before deleting it.
Diffstat (limited to 'intern/cycles/render/tile.cpp')
-rw-r--r-- | intern/cycles/render/tile.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/intern/cycles/render/tile.cpp b/intern/cycles/render/tile.cpp index 5849ac26118..8692be7dd51 100644 --- a/intern/cycles/render/tile.cpp +++ b/intern/cycles/render/tile.cpp @@ -128,6 +128,7 @@ int TileManager::gen_tiles(bool sliced) int slice_num = sliced? num: 1; int tile_index = 0; + state.tiles.clear(); state.tiles.resize(num); vector<list<Tile> >::iterator tile_list = state.tiles.begin(); @@ -187,12 +188,11 @@ void TileManager::set_tiles() bool TileManager::next_tile(Tile& tile, int device) { int logical_device = preserve_tile_device? device: 0; - assert(logical_device < state.tiles.size()); - if(state.tiles[logical_device].empty()) + if((logical_device >= state.tiles.size()) || state.tiles[logical_device].empty()) return false; - tile = state.tiles[logical_device].front(); + tile = Tile(state.tiles[logical_device].front()); state.tiles[logical_device].pop_front(); state.num_rendered_tiles++; return true; |