Fix #34205: Cycles: Zooming in rendered mode during update out of sync with intended...
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 12 Feb 2013 13:06:52 +0000 (13:06 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 12 Feb 2013 13:06:52 +0000 (13:06 +0000)
Made sure no pause_cond.wait() happens at the same time as session as resetting.

intern/cycles/render/session.cpp

index 94cb691..7a40e0d 100644 (file)
@@ -132,6 +132,8 @@ bool Session::ready_to_reset()
 
 void Session::reset_gpu(BufferParams& buffer_params, int samples)
 {
+       thread_scoped_lock pause_lock(pause_mutex);
+
        /* block for buffer acces and reset immediately. we can't do this
         * in the thread, because we need to allocate an OpenGL buffer, and
         * that only works in the main thread */
@@ -295,6 +297,7 @@ void Session::run_gpu()
 void Session::reset_cpu(BufferParams& buffer_params, int samples)
 {
        thread_scoped_lock reset_lock(delayed_reset.mutex);
+       thread_scoped_lock pause_lock(pause_mutex);
 
        display_outdated = true;
        reset_time = time_dt();
@@ -484,7 +487,16 @@ void Session::run_cpu()
                         * wait for pause condition notify to wake up again */
                        thread_scoped_lock pause_lock(pause_mutex);
 
-                       if(pause || no_tiles) {
+                       if(!pause && delayed_reset.do_reset) {
+                               /* reset once to start */
+                               thread_scoped_lock reset_lock(delayed_reset.mutex);
+                               thread_scoped_lock buffers_lock(buffers_mutex);
+                               thread_scoped_lock display_lock(display_mutex);
+
+                               reset_(delayed_reset.params, delayed_reset.samples);
+                               delayed_reset.do_reset = false;
+                       }
+                       else if(pause || no_tiles) {
                                update_status_time(pause, no_tiles);
 
                                while(1) {