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.
This commit is contained in:
parent
059b7a81e2
commit
8e07b87866
Notes:
blender-bot
2023-02-14 08:28:46 +01:00
Referenced by issue #47067, Recent 32bit Buildbot not starting - Entry Point Not Found
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue