Fix T99706: Crash rendering with headless builds

When rendering with headless builds, show an error instead of crashing.

Previously GPU_backend_init was called indirectly from
DRW_opengl_context_create, a new function is now called from the window
manager (GPU_backend_init_once), so it's possible to check if the GPU
has a back-end.

This also disables the `bgl` Python module when building WITH_HEADLESS.

Reviewed By: fclem

Ref D15463
This commit is contained in:
2022-07-15 22:14:04 +10:00
parent 180db0f752
commit 00dc747702
8 changed files with 45 additions and 7 deletions

View File

@@ -17,7 +17,6 @@ set(INC_SYS
)
set(SRC
bgl.c
bl_math_py_api.c
blf_py_api.c
bpy_threads.c
@@ -27,7 +26,6 @@ set(SRC
py_capi_rna.c
py_capi_utils.c
bgl.h
bl_math_py_api.h
blf_py_api.h
idprop_py_api.h
@@ -40,6 +38,14 @@ set(SRC
python_utildefines.h
)
if(WITH_OPENGL)
list(APPEND SRC
bgl.c
bgl.h
)
endif()
set(LIB
${GLEW_LIBRARY}
${PYTHON_LINKFLAGS}