Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-07-15 15:14:04 +0300
committerCampbell Barton <campbell@blender.org>2022-07-15 15:16:44 +0300
commit00dc7477022acdd969e4d709a235c0be819efa6c (patch)
treeb6bd65095c8ce50520a638cddf2d843963369fc1 /source/blender/render/intern
parent180db0f752c88d3bbd47774a0f7c9a31de5a3864 (diff)
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
Diffstat (limited to 'source/blender/render/intern')
-rw-r--r--source/blender/render/intern/engine.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/render/intern/engine.c b/source/blender/render/intern/engine.c
index 8a4b4c2a70d..113af393706 100644
--- a/source/blender/render/intern/engine.c
+++ b/source/blender/render/intern/engine.c
@@ -46,6 +46,8 @@
#include "DRW_engine.h"
+#include "GPU_context.h"
+
#include "pipeline.h"
#include "render_result.h"
#include "render_types.h"
@@ -950,6 +952,16 @@ bool RE_engine_render(Render *re, bool do_all)
re->draw_lock(re->dlh, true);
}
+ if ((type->flag & RE_USE_GPU_CONTEXT) && (GPU_backend_get_type() == GPU_BACKEND_NONE)) {
+ /* Clear UI drawing locks. */
+ if (re->draw_lock) {
+ re->draw_lock(re->dlh, false);
+ }
+ BKE_report(re->reports, RPT_ERROR, "Can not initialize the GPU");
+ G.is_break = true;
+ return true;
+ }
+
/* update animation here so any render layer animation is applied before
* creating the render result */
if ((re->r.scemode & (R_NO_FRAME_UPDATE | R_BUTS_PREVIEW)) == 0) {