diff options
author | Jason Fielder <jason_apple> | 2022-09-22 19:03:29 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-09-22 19:05:59 +0300 |
commit | e8bcca4bdc947caaca6742cdefc60fb9a4f57e9a (patch) | |
tree | a03602a7dd7155ffbb572a7c772e8242062b6623 /source/blender/draw/engines | |
parent | 18b45aabf91ad0a407e8c7cd16c5503e7a99d6fa (diff) |
GPU: Ensure rendering operations occur within GPU render boundaries.
This is required by the Metal backend to perform flushing of temporary objective-C resources. This is implemented as a global autoreleasepool, and is to ensure consistency such that all rendering operations, whether called via events, or via main loop will be within an autoreleasepool.
Authored by Apple: Michael Parkin-White
Ref T96261
Reviewed By: fclem
Differential Revision: https://developer.blender.org/D15900
Diffstat (limited to 'source/blender/draw/engines')
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_lightcache.c | 3 | ||||
-rw-r--r-- | source/blender/draw/engines/workbench/workbench_engine.c | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.c b/source/blender/draw/engines/eevee/eevee_lightcache.c index 0fd87ef43f0..f9d3d74ffc7 100644 --- a/source/blender/draw/engines/eevee/eevee_lightcache.c +++ b/source/blender/draw/engines/eevee/eevee_lightcache.c @@ -591,6 +591,7 @@ static void eevee_lightbake_context_enable(EEVEE_LightBake *lbake) if (GPU_use_main_context_workaround() && !BLI_thread_is_main()) { GPU_context_main_lock(); DRW_opengl_context_enable(); + GPU_render_begin(); return; } @@ -604,10 +605,12 @@ static void eevee_lightbake_context_enable(EEVEE_LightBake *lbake) else { DRW_opengl_context_enable(); } + GPU_render_begin(); } static void eevee_lightbake_context_disable(EEVEE_LightBake *lbake) { + GPU_render_end(); if (GPU_use_main_context_workaround() && !BLI_thread_is_main()) { DRW_opengl_context_disable(); GPU_context_main_unlock(); diff --git a/source/blender/draw/engines/workbench/workbench_engine.c b/source/blender/draw/engines/workbench/workbench_engine.c index a0459a967f3..ee9521289d9 100644 --- a/source/blender/draw/engines/workbench/workbench_engine.c +++ b/source/blender/draw/engines/workbench/workbench_engine.c @@ -29,6 +29,8 @@ #include "ED_paint.h" +#include "GPU_context.h" + #include "workbench_engine.h" #include "workbench_private.h" @@ -36,6 +38,7 @@ void workbench_engine_init(void *ved) { + GPU_render_begin(); WORKBENCH_Data *vedata = ved; WORKBENCH_StorageList *stl = vedata->stl; WORKBENCH_TextureList *txl = vedata->txl; @@ -64,6 +67,7 @@ void workbench_engine_init(void *ved) workbench_dof_engine_init(vedata); workbench_antialiasing_engine_init(vedata); workbench_volume_engine_init(vedata); + GPU_render_end(); } void workbench_cache_init(void *ved) |