From 4004c2dfaa64b085d30167a89f663ae613a04a11 Mon Sep 17 00:00:00 2001 From: MediaPipe Team Date: Thu, 14 Dec 2023 06:03:06 -0800 Subject: [PATCH] No public description PiperOrigin-RevId: 590913209 --- mediapipe/gpu/gl_context.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mediapipe/gpu/gl_context.cc b/mediapipe/gpu/gl_context.cc index 5eff88b92..4dc90b52a 100644 --- a/mediapipe/gpu/gl_context.cc +++ b/mediapipe/gpu/gl_context.cc @@ -697,10 +697,13 @@ class GlFenceSyncPoint : public GlSyncPoint { void Wait() override { if (!sync_) return; - gl_context_->Run([this] { - // TODO: must this run on the original context?? + if (GlContext::IsAnyContextCurrent()) { sync_.Wait(); - }); + return; + } + // In case a current GL context is not available, we fall back using the + // captured gl_context_. + gl_context_->Run([this] { sync_.Wait(); }); } void WaitOnGpu() override {