Fix #122654: GPU Compositor: Cryptomatte node crashes blender

The system context is expected to be bound prior to the Blender
can be properly initialized. Otherwise GHOST will be doing OpenGL
calls without system context bound.

This follows code from DRW_render_context_enable().

Pull Request: https://projects.blender.org/blender/blender/pulls/122708
This commit is contained in:
Sergey Sharybin
2024-06-04 13:12:35 +02:00
committed by Sergey Sharybin
parent 11d311e300
commit 8cba704dfd

View File

@@ -532,10 +532,11 @@ class RealtimeCompositor {
}
else {
void *re_system_gpu_context = RE_system_gpu_context_get(&render_);
WM_system_gpu_context_activate(re_system_gpu_context);
void *re_blender_gpu_context = RE_blender_gpu_context_ensure(&render_);
GPU_render_begin();
WM_system_gpu_context_activate(re_system_gpu_context);
GPU_context_active_set(static_cast<GPUContext *>(re_blender_gpu_context));
}