Fix: Wrong GPU compositor assert in background mode

An assert that ensures the GPU compositor executes in a non main thread
wrongly fires in background mode, that's because in background mode,
rendering happens in the main thread. So add a condition for background
mode.
This commit is contained in:
Omar Emara
2024-01-18 11:31:59 +02:00
parent d08e826b24
commit d875e5d4cb

View File

@@ -465,7 +465,9 @@ class RealtimeCompositor {
public:
RealtimeCompositor(Render &render, const ContextInputData &input_data) : render_(render)
{
BLI_assert(!BLI_thread_is_main());
/* Ensure that in foreground mode we are using different contexts for main and render threads,
* to avoid them blocking each other. */
BLI_assert(!BLI_thread_is_main() || G.background);
/* Create resources with GPU context enabled. */
DRW_render_context_enable(&render_);
@@ -499,7 +501,9 @@ class RealtimeCompositor {
/* Evaluate the compositor and output to the scene render result. */
void execute(const ContextInputData &input_data)
{
BLI_assert(!BLI_thread_is_main());
/* Ensure that in foreground mode we are using different contexts for main and render threads,
* to avoid them blocking each other. */
BLI_assert(!BLI_thread_is_main() || G.background);
DRW_render_context_enable(&render_);
context_->update_input_data(input_data);