[Bf-blender-cvs] [769ae5c866f] blender-v3.1-release: Fix T96139: Cycles doesn't warn if the render is paused

Sergey Sharybin noreply at git.blender.org
Thu Mar 3 17:47:23 CET 2022


Commit: 769ae5c866f32d7a224c141ed4e3e899a54ec150
Author: Sergey Sharybin
Date:   Thu Mar 3 17:16:39 2022 +0100
Branches: blender-v3.1-release
https://developer.blender.org/rB769ae5c866f32d7a224c141ed4e3e899a54ec150

Fix T96139: Cycles doesn't warn if the render is paused

Caused by 6ec83afb1db8.

Technically, a regression since 3.0.

Differential Revision: https://developer.blender.org/D14239

===================================================================

M	intern/cycles/session/session.cpp
M	intern/cycles/session/session.h

===================================================================

diff --git a/intern/cycles/session/session.cpp b/intern/cycles/session/session.cpp
index 8fcb5c9ac96..54ff7063872 100644
--- a/intern/cycles/session/session.cpp
+++ b/intern/cycles/session/session.cpp
@@ -123,11 +123,7 @@ void Session::start()
 void Session::cancel(bool quick)
 {
   /* Check if session thread is rendering. */
-  bool rendering;
-  {
-    thread_scoped_lock session_thread_lock(session_thread_mutex_);
-    rendering = (session_thread_state_ == SESSION_THREAD_RENDER);
-  }
+  const bool rendering = is_session_thread_rendering();
 
   if (rendering) {
     /* Cancel path trace operations. */
@@ -288,6 +284,12 @@ void Session::thread_render()
     progress.set_update();
 }
 
+bool Session::is_session_thread_rendering()
+{
+  thread_scoped_lock session_thread_lock(session_thread_mutex_);
+  return (session_thread_state_ == SESSION_THREAD_RENDER);
+}
+
 RenderWork Session::run_update_for_next_iteration()
 {
   RenderWork render_work;
@@ -570,7 +572,7 @@ void Session::set_pause(bool pause)
     }
   }
 
-  if (session_thread_) {
+  if (is_session_thread_rendering()) {
     if (notify) {
       pause_cond_.notify_all();
     }
diff --git a/intern/cycles/session/session.h b/intern/cycles/session/session.h
index 4017964d4aa..c093421443b 100644
--- a/intern/cycles/session/session.h
+++ b/intern/cycles/session/session.h
@@ -175,6 +175,10 @@ class Session {
   void thread_run();
   void thread_render();
 
+  /* Check whether the session thread is in `SESSION_THREAD_RENDER` state.
+   * Returns true if it is so. */
+  bool is_session_thread_rendering();
+
   /* Update for the new iteration of the main loop in run implementation (run_cpu and run_gpu).
    *
    * Will take care of the following things:



More information about the Bf-blender-cvs mailing list