Flutter Engine
The Flutter Engine
Functions
GrGLMakeNativeInterface_glfw.cpp File Reference
#include "include/gpu/gl/GrGLAssembleInterface.h"
#include "include/gpu/gl/GrGLInterface.h"
#include "src/gpu/ganesh/gl/GrGLUtil.h"
#include <GLFW/glfw3.h>

Go to the source code of this file.

Functions

static GrGLFuncPtr glfw_get (void *ctx, const char name[])
 
sk_sp< const GrGLInterfaceGrGLMakeNativeInterface ()
 

Function Documentation

◆ glfw_get()

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

Definition at line 15 of file GrGLMakeNativeInterface_glfw.cpp.

15 {
16 SkASSERT(nullptr == ctx);
17 SkASSERT(glfwGetCurrentContext());
18 return glfwGetProcAddress(name);
19}
#define SkASSERT(cond)
Definition: SkAssert.h:116
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32

◆ 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 21 of file GrGLMakeNativeInterface_glfw.cpp.

21 {
22 if (nullptr == glfwGetCurrentContext()) {
23 return nullptr;
24 }
25
26 return GrGLMakeAssembledInterface(nullptr, glfw_get);
27}
SK_API sk_sp< const GrGLInterface > GrGLMakeAssembledInterface(void *ctx, GrGLGetProc get)
static GrGLFuncPtr glfw_get(void *ctx, const char name[])