diff options
author | Sergey Sharybin <sergey@blender.org> | 2022-02-18 16:31:39 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2022-02-18 17:26:15 +0300 |
commit | e4b7d52fe4fe3076f5f68ff575c200f5cf16e416 (patch) | |
tree | 28f9117767819d302ee27a57c0df79452a143fab /intern/cycles/blender/session.cpp | |
parent | 02f4d63dcc7b74fbacfb4e5bcdd01766563573f5 (diff) |
Fix graphics interop resources leak in Cycles
When new display driver is given to the PathTrace ensure that there are
no GPU resources used from it by the work. This solves graphics interop
descriptors leak.
This aqlso fixes Invalid graphics context in cuGraphicsUnregisterResource
error when doing final render on the display GPU.
Fixes T95837: Regression: GPU memory accumulation in Cycles render
Fixes T95733: Cycles Cuda/Optix error message with multi GPU devices. (Invalid graphics context in cuGraphicsUnregisterResource)
Fixes T95651: GPU error (Invalid graphics context in cuGraphicsUnregisterResource)
Fixes T95631: VRAM is not being freed when rendering (Invalid graphics context in cuGraphicsUnregisterResource)
Fixes T89747: Cycles Render - Textures Disappear then Crashes the Render
Maniphest Tasks: T95837, T95733, T95651, T95631, T89747
Differential Revision: https://developer.blender.org/D14146
Diffstat (limited to 'intern/cycles/blender/session.cpp')
-rw-r--r-- | intern/cycles/blender/session.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/intern/cycles/blender/session.cpp b/intern/cycles/blender/session.cpp index c81a0f4edb2..405f22ad67a 100644 --- a/intern/cycles/blender/session.cpp +++ b/intern/cycles/blender/session.cpp @@ -506,8 +506,13 @@ void BlenderSession::render_frame_finish() 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. */ + /* The display driver is the source of drawing context for both drawing and possible graphics + * interop objects in the path trace. Once the frame is finished the OpenGL context might be + * freed form Blender side. Need to ensure that all GPU resources are freed prior to that + * point. + * Ideally would only do this when OpenGL context is actually destroyed, but there is no way to + * know when this happens (at least in the code at the time when this comment was written). + * The penalty of re-creating resources on every frame is unlikely to be noticed. */ display_driver_ = nullptr; session->set_display_driver(nullptr); |