[Bf-blender-cvs] [20cb2c72a55] master: Fix second render failure with Cycles persistent data

Sergey Sharybin noreply at git.blender.org
Mon Jan 10 17:04:54 CET 2022


Commit: 20cb2c72a559786b69a3f45695b072dd0beae99a
Author: Sergey Sharybin
Date:   Mon Jan 10 15:56:44 2022 +0100
Branches: master
https://developer.blender.org/rB20cb2c72a559786b69a3f45695b072dd0beae99a

Fix second render failure with Cycles persistent data

The issue was caused by the recent changes in the way how the
render result is drawn: the display driver now could hold an
OpenGL resources. Those resources are not shared across contexts
so whenever OpenGL context is destroyed those resources are to
be destroyed as well (and not attempted to be re-used for a next
render).

Do such destruction and entire driver re-creation since it does
simplifies things from API usage point of view without causing
measurable slowdown.

Steps to reproduce the issue:
- Set the render resolution to 2x of Full HD
- Enable persistent data
- Render (F12)
- Render again

Observe OpenGL state being corrupted. Easy to see in debug mode
where IMM abstraction level reports issues about the buffer size
not being the proper size. This was caused by the display driver
trying to use VAO from the previous OpenGL context.

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

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

M	intern/cycles/blender/session.cpp

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

diff --git a/intern/cycles/blender/session.cpp b/intern/cycles/blender/session.cpp
index b6f72707fe0..c81a0f4edb2 100644
--- a/intern/cycles/blender/session.cpp
+++ b/intern/cycles/blender/session.cpp
@@ -502,10 +502,15 @@ void BlenderSession::render_frame_finish()
     path_remove(filename);
   }
 
-  /* Clear driver. */
+  /* Clear output driver. */
   session->set_output_driver(nullptr);
   session->full_buffer_written_cb = function_null;
 
+  /* The display driver holds OpenGL resources which belong to an OpenGL context held by the render
+   * engine on Blender side. Force destruction of those resources. */
+  display_driver_ = nullptr;
+  session->set_display_driver(nullptr);
+
   /* All the files are handled.
    * Clear the list so that this session can be re-used by Persistent Data. */
   full_buffer_files_.clear();



More information about the Bf-blender-cvs mailing list