Fix crash in GPU compositor when running from command line

The non-locking context activation expects the render engine to
have its own GPU contexts, which is not necessarily the case when
compositing happens from the command line.

Ensure that the contexts exist prior to attempt of activating them.

Pull Request: https://projects.blender.org/blender/blender/pulls/118496
This commit is contained in:
Sergey Sharybin 2024-02-20 12:22:43 +01:00 committed by Sergey Sharybin
parent 2a7fcf2cfd
commit 43ed74f7a2
1 changed files with 8 additions and 0 deletions

View File

@ -515,6 +515,14 @@ class RealtimeCompositor {
* spontaneous invalid colors in the composite output. The Windows has not been extensively
* tested yet. */
#if defined(__linux__)
if (G.background) {
/* In the background mode the system context of the render engine might be nullptr, which
* forces some code paths which more tightly couple it with the draw manager.
* For the compositor we want to have the least amount of coupling with the draw manager, so
* ensure that the render engine has its own system GPU context. */
RE_system_gpu_context_ensure(&render_);
}
void *re_system_gpu_context = RE_system_gpu_context_get(&render_);
void *re_blender_gpu_context = RE_blender_gpu_context_ensure(&render_);