Flutter Engine
The Flutter Engine
Namespaces | Macros | Functions
GrGLMakeNativeInterface_webgl.cpp File Reference
#include "include/gpu/ganesh/gl/GrGLMakeWebGLInterface.h"
#include "include/gpu/gl/GrGLAssembleInterface.h"
#include "include/gpu/gl/GrGLInterface.h"
#include <GLES3/gl32.h>

Go to the source code of this file.

Namespaces

namespace  GrGLInterfaces
 

Macros

#define M(X)   if (0 == strcmp(#X, name)) { return (GrGLFuncPtr) X; }
 

Functions

static GrGLFuncPtr webgl_get_gl_proc (void *ctx, const char name[])
 
SK_API sk_sp< const GrGLInterfaceGrGLInterfaces::MakeWebGL ()
 
sk_sp< const GrGLInterfaceGrGLMakeNativeInterface ()
 

Macro Definition Documentation

◆ M

#define M (   X)    if (0 == strcmp(#X, name)) { return (GrGLFuncPtr) X; }

Function Documentation

◆ GrGLMakeNativeInterface()

sk_sp< const GrGLInterface > GrGLMakeNativeInterface ( )

Rather than depend on platform-specific GL headers and libraries, we require the client to provide a struct of GL function pointers. This struct can be specified per-GrContext as a parameter to GrContext::MakeGL. If no interface is passed to MakeGL then a default GL interface is created using GrGLMakeNativeInterface(). If this returns nullptr then GrContext::MakeGL() will fail.

The implementation of GrGLMakeNativeInterface is platform-specific. Several implementations have been provided (for GLX, WGL, EGL, etc), along with an implementation that simply returns nullptr. Clients should select the most appropriate one to build.

Definition at line 35 of file GrGLMakeNativeInterface_webgl.cpp.

35 {
37}
SK_API sk_sp< const GrGLInterface > MakeWebGL()

◆ webgl_get_gl_proc()

static GrGLFuncPtr webgl_get_gl_proc ( void *  ctx,
const char  name[] 
)
static

Definition at line 13 of file GrGLMakeNativeInterface_webgl.cpp.

13 {
14
15 #define M(X) if (0 == strcmp(#X, name)) { return (GrGLFuncPtr) X; }
16 M(glGetString)
17 #undef M
18
19 // We explicitly do not use GetProcAddress or something similar because
20 // its code size is quite large. We shouldn't need GetProcAddress
21 // because emscripten provides us all the valid function pointers
22 // for WebGL via the included headers.
23 // https://github.com/emscripten-core/emscripten/blob/7ba7700902c46734987585409502f3c63beb650f/system/include/emscripten/html5_webgl.h#L93
24 SkASSERTF(false, "Can't lookup fn %s\n", name);
25 return nullptr;
26}
#define M(X)
#define SkASSERTF(cond, fmt,...)
Definition: SkAssert.h:117
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32