Internal change

PiperOrigin-RevId: 489091534
This commit is contained in:
Camillo Lugaresi 2022-11-16 18:34:14 -08:00 committed by Copybara-Service
parent e66e88802c
commit 6fc277ee1c
2 changed files with 10 additions and 2 deletions

View File

@ -826,10 +826,14 @@ std::shared_ptr<GlSyncPoint> GlContext::CreateSyncToken() {
return token; return token;
} }
bool GlContext::IsAnyContextCurrent() { PlatformGlContext GlContext::GetCurrentNativeContext() {
ContextBinding ctx; ContextBinding ctx;
GetCurrentContextBinding(&ctx); GetCurrentContextBinding(&ctx);
return ctx.context != kPlatformGlContextNone; return ctx.context;
}
bool GlContext::IsAnyContextCurrent() {
return GetCurrentNativeContext() != kPlatformGlContextNone;
} }
std::shared_ptr<GlSyncPoint> std::shared_ptr<GlSyncPoint>

View File

@ -307,6 +307,10 @@ class GlContext : public std::enable_shared_from_this<GlContext> {
// the GlContext class, is current. // the GlContext class, is current.
static bool IsAnyContextCurrent(); static bool IsAnyContextCurrent();
// Returns the current native context, whether managed by this class or not.
// Useful as a cross-platform way to get the current PlatformGlContext.
static PlatformGlContext GetCurrentNativeContext();
// Creates a synchronization token for the current, non-GlContext-owned // Creates a synchronization token for the current, non-GlContext-owned
// context. This can be passed to MediaPipe so it can synchronize with the // context. This can be passed to MediaPipe so it can synchronize with the
// commands issued in the external context up to this point. // commands issued in the external context up to this point.