Merging r50522 through r50572 from trunk into soc-2011-tomato
[blender.git] / intern / cycles / render / session.cpp
index 15f24320ee8e24341d17a13928ed91ad78bb653a..05c57ba48ecad8063303a405f91984ecd255170a 100644 (file)
@@ -140,6 +140,12 @@ void Session::reset_gpu(BufferParams& buffer_params, int samples)
        pause_cond.notify_all();
 }
 
+bool Session::resetting_gpu() const
+{
+       /* no need to wait for gpu device */
+       return false;
+}
+
 bool Session::draw_gpu(BufferParams& buffer_params)
 {
        /* block for buffer access */
@@ -290,6 +296,11 @@ void Session::reset_cpu(BufferParams& buffer_params, int samples)
        pause_cond.notify_all();
 }
 
+bool Session::resetting_cpu() const
+{
+       return device->task_cancelled();
+}
+
 bool Session::draw_cpu(BufferParams& buffer_params)
 {
        thread_scoped_lock display_lock(display_mutex);
@@ -320,7 +331,7 @@ bool Session::acquire_tile(Device *tile_device, RenderTile& rtile)
 
        /* get next tile from manager */
        Tile tile;
-       int device_num = device->device_number(tile_device);
+       int device_num = (params.background)? 0: device->device_number(tile_device);
 
        if(!tile_manager.next_tile(tile, device_num))
                return false;
@@ -532,6 +543,9 @@ void Session::run()
 
        /* run */
        if(!progress.get_cancel()) {
+               /* reset number of rendered samples */
+               progress.reset_sample();
+
                if(device_use_gl)
                        run_gpu();
                else
@@ -581,6 +595,14 @@ void Session::reset(BufferParams& buffer_params, int samples)
                reset_cpu(buffer_params, samples);
 }
 
+bool Session::resetting() const
+{
+       if(device_use_gl)
+               return resetting_gpu();
+       else
+               return resetting_cpu();
+}
+
 void Session::set_samples(int samples)
 {
        if(samples != params.samples) {