From 92a99c14965905e73f049bc1f92b597a903977fc Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 15 Jul 2022 18:58:35 +0200 Subject: Fix Eevee backround render crash after recent changes from D15463 Backend initialization needs to be delayed until after the OpenGL context is created. This worked fine in foreground mode because the OpenGL context already exists for the window at the point GPU_backend_init_once was called, but not for background mode. Create the backend just in time in GPU_context_create as before, and automatically free it when the last context id discarded. But check if any GPU backend is supported before creating the OpenGL context. Ref D15463, D15465 --- source/blender/gpu/tests/gpu_testing.cc | 2 -- 1 file changed, 2 deletions(-) (limited to 'source/blender/gpu/tests') diff --git a/source/blender/gpu/tests/gpu_testing.cc b/source/blender/gpu/tests/gpu_testing.cc index 5a2ad893360..224a9afcf59 100644 --- a/source/blender/gpu/tests/gpu_testing.cc +++ b/source/blender/gpu/tests/gpu_testing.cc @@ -17,7 +17,6 @@ void GPUTest::SetUp() GHOST_GLSettings glSettings = {0}; CLG_init(); ghost_system = GHOST_CreateSystem(); - GPU_backend_init_once(); ghost_context = GHOST_CreateOpenGLContext(ghost_system, glSettings); GHOST_ActivateOpenGLContext(ghost_context); context = GPU_context_create(nullptr); @@ -29,7 +28,6 @@ void GPUTest::TearDown() GPU_exit(); GPU_context_discard(context); GHOST_DisposeOpenGLContext(ghost_system, ghost_context); - GPU_backend_exit(); GHOST_DisposeSystem(ghost_system); CLG_exit(); } -- cgit v1.2.3