diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-10-23 20:36:53 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-10-23 20:36:53 +0400 |
commit | 933864da1886f3e61a7233949de8f1dbbc89e1c5 (patch) | |
tree | 53919ee0966d8b571ff5310ef9300cb7b9a9a14f /intern/cycles/render/session.cpp | |
parent | e038a1c613009d81adda0662dbb1e4a38228909a (diff) |
Fix #32951: Progressive refine crashing Blender when used with multiple cuda
Issue was caused by offline rendering could have been allocated the same tile
to different devices and in this case buffers would become invalid.
Made it more clear in the code, so now it's flag for tile manager to indicate
whether tiles should always be allocated for the same device or not.
Also cleaned a way how tile index for progressive refine is calculating,
which is now avoids tricky computation based on tile coordinate and it's
dimensions.
Diffstat (limited to 'intern/cycles/render/session.cpp')
-rw-r--r-- | intern/cycles/render/session.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp index 65b20f1dd2c..aeee119d8cd 100644 --- a/intern/cycles/render/session.cpp +++ b/intern/cycles/render/session.cpp @@ -34,10 +34,15 @@ CCL_NAMESPACE_BEGIN +/* Note about preserve_tile_device option for tile manager: + * progressive refine and viewport rendering does requires tiles to + * always be allocated for the same device + */ Session::Session(const SessionParams& params_) : params(params_), tile_manager(params.progressive, params.samples, params.tile_size, params.start_resolution, - (params.background)? 1: max(params.device.multi_devices.size(), 1)) + params.background == false || params.progressive_refine, + max(params.device.multi_devices.size(), 1)) { device_use_gl = ((params.device.type != DEVICE_CPU) && !params.background); @@ -334,7 +339,7 @@ bool Session::acquire_tile(Device *tile_device, RenderTile& rtile) /* get next tile from manager */ Tile tile; - int device_num = (params.background)? 0: device->device_number(tile_device); + int device_num = device->device_number(tile_device); if(!tile_manager.next_tile(tile, device_num)) return false; @@ -378,20 +383,15 @@ bool Session::acquire_tile(Device *tile_device, RenderTile& rtile) /* allocate buffers */ if(params.progressive_refine) { - int tile_x = rtile.x / params.tile_size.x; - int tile_y = rtile.y / params.tile_size.y; - - int tile_index = tile_y * tile_manager.state.tile_w + tile_x; - tile_lock.lock(); if(tile_buffers.size() == 0) tile_buffers.resize(tile_manager.state.num_tiles, NULL); - tilebuffers = tile_buffers[tile_index]; + tilebuffers = tile_buffers[tile.index]; if(tilebuffers == NULL) { tilebuffers = new RenderBuffers(tile_device); - tile_buffers[tile_index] = tilebuffers; + tile_buffers[tile.index] = tilebuffers; tilebuffers->reset(tile_device, buffer_params); } |