Flutter Engine
The Flutter Engine
GrGLMakeGLXInterface.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2014 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
12
13// Define this to get a prototype for glXGetProcAddress on some systems
14#define GLX_GLXEXT_PROTOTYPES 1
15#include <GL/glx.h>
16
17static GrGLFuncPtr glx_get(void* ctx, const char name[]) {
18 // Avoid calling glXGetProcAddress() for EGL procs.
19 // We don't expect it to ever succeed, but somtimes it returns non-null anyway.
20 if (0 == strncmp(name, "egl", 3)) {
21 return nullptr;
22 }
23
24 SkASSERT(nullptr == ctx);
25 SkASSERT(glXGetCurrentContext());
26 return glXGetProcAddress(reinterpret_cast<const GLubyte*>(name));
27}
28
29namespace GrGLInterfaces {
31 if (nullptr == glXGetCurrentContext()) {
32 return nullptr;
33 }
34
35 return GrGLMakeAssembledInterface(nullptr, glx_get);
36}
37} // namespace GrGLInterfaces
38
39#if !defined(SK_DISABLE_LEGACY_GLXINTERFACE_FACTORY)
41#endif
SK_API sk_sp< const GrGLInterface > GrGLMakeAssembledInterface(void *ctx, GrGLGetProc get)
void(* GrGLFuncPtr)()
Definition: GrGLInterface.h:17
sk_sp< const GrGLInterface > GrGLMakeGLXInterface()
static GrGLFuncPtr glx_get(void *ctx, const char name[])
#define SkASSERT(cond)
Definition: SkAssert.h:116
SK_API sk_sp< const GrGLInterface > MakeGLX()
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32