5#include "flutter/shell/gpu/gpu_surface_gl_delegate.h"
7#include "flutter/fml/build_config.h"
14#if defined(FML_OS_ANDROID)
18#if defined(FML_OS_LINUX) && defined(SK_GLX)
22#if defined(FML_OS_MACOSX)
26#if defined(FML_OS_IOS)
59#define GPU_GL_VERSION 0x1F02
60 constexpr char kGLESVersionPrefix[] =
"OpenGL ES";
63 using GLGetStringProc =
const char*(__stdcall*)(uint32_t);
65 using GLGetStringProc =
const char* (*)(uint32_t);
68 GLGetStringProc gl_get_string =
69 reinterpret_cast<GLGetStringProc
>(proc_resolver(
"glGetString"));
72 <<
"The GL proc resolver could not resolve glGetString";
77 <<
"The GL proc resolver's glGetString(GL_VERSION) failed";
79 return strncmp(gl_version_string, kGLESVersionPrefix,
80 strlen(kGLESVersionPrefix)) == 0;
85 if (proc_resolver ==
nullptr) {
86#if defined(FML_OS_ANDROID)
88#elif defined(FML_OS_LINUX)
94#elif defined(FML_OS_IOS)
96#elif defined(FML_OS_MACOSX)
106 struct ProcResolverContext {
110 ProcResolverContext context = {proc_resolver};
114 auto proc_resolver_context =
115 reinterpret_cast<ProcResolverContext*
>(context);
117 proc_resolver_context->resolver(gl_proc_name));
130 FML_LOG(
ERROR) <<
"Could not create a valid GL interface.";
SK_API sk_sp< const GrGLInterface > GrGLMakeAssembledGLInterface(void *ctx, GrGLGetProc get)
GrGLFuncPtr(* GrGLGetProc)(void *ctx, const char name[])
SK_API sk_sp< const GrGLInterface > GrGLMakeAssembledGLESInterface(void *ctx, GrGLGetProc get)
SK_API sk_sp< const GrGLInterface > GrGLMakeNativeInterface()
virtual bool AllowsDrawingWhenGpuDisabled() const
std::function< void *(const char *)> GLProcResolver
static sk_sp< const GrGLInterface > GetDefaultPlatformGLInterface()
virtual GLProcResolver GetGLProcResolver() const
virtual SkMatrix GLContextSurfaceTransformation() const
virtual sk_sp< const GrGLInterface > GetGLInterface() const
virtual bool GLContextFBOResetAfterPresent() const
virtual SurfaceFrame::FramebufferInfo GLContextFramebufferInfo() const
#define FML_LOG(severity)
#define FML_CHECK(condition)
SK_API sk_sp< const GrGLInterface > MakeEGL()
SK_API sk_sp< const GrGLInterface > MakeIOS()
SK_API sk_sp< const GrGLInterface > MakeMac()
SK_API sk_sp< const GrGLInterface > MakeGLX()
unsigned useCenter Optional< SkMatrix > matrix
static sk_sp< const GrGLInterface > CreateGLInterface(const GPUSurfaceGLDelegate::GLProcResolver &proc_resolver)
static bool IsProcResolverOpenGLES(const GPUSurfaceGLDelegate::GLProcResolver &proc_resolver)