Fix GL Tensor (backed by AHardwaBuffer) GL to CPU synchronization.

glFinish() must be called on a valid gl context

PiperOrigin-RevId: 478816905
This commit is contained in:
MediaPipe Team 2022-10-04 10:01:17 -07:00 committed by Copybara-Service
parent 8d5cf9bbed
commit 38baaa00b1

View File

@ -371,7 +371,7 @@ void* Tensor::MapAhwbToCpuRead() const {
if ((valid_ & kValidOpenGlBuffer) && ssbo_written_ == -1) {
// EGLSync is failed. Use another synchronization method.
// TODO: Use tflite::gpu::GlBufferSync and GlActiveSync.
glFinish();
gl_context_->Run([]() { glFinish(); });
} else if (valid_ & kValidAHardwareBuffer) {
CHECK(ahwb_written_) << "Ahwb-to-Cpu synchronization requires the "
"completion function to be set";