| 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 |
#include "include/gpu/ganesh/gl/GrGLAssembleInterface.h" |
| 8 |
#include "include/gpu/ganesh/gl/GrGLInterface.h" |
| 9 |
#include "src/gpu/ganesh/gl/GrGLCoreFunctions.h" |
| 10 |
#include "src/gpu/ganesh/gl/GrGLUtil.h" |
| 11 |
|
| 12 |
#include <EGL/egl.h> |
| 13 |
#ifndef GL_GLEXT_PROTOTYPES |
| 14 |
#define GL_GLEXT_PROTOTYPES |
| 15 |
#endif |
| 16 |
#include <GLES2/gl2.h> |
| 17 |
|
| 18 |
static GrGLFuncPtr egl_get_gl_proc(void* ctx, const char name[]) { |
| 19 |
SkASSERT(nullptr == ctx); |
| 20 |
#define M(X) if (0 == strcmp(#X, name)) { return (GrGLFuncPtr) X; } |
| 21 |
GR_GL_CORE_FUNCTIONS_EACH(M) |
| 22 |
#undef M |
| 23 |
return eglGetProcAddress(name); |
| 24 |
} |
| 25 |
|
| 26 |
namespace GrGLInterfaces { |
| 27 |
sk_sp<const GrGLInterface> MakeEGL() { |
| 28 |
return GrGLMakeAssembledInterface(nullptr, egl_get_gl_proc); |
| 29 |
} |
| 30 |
} // namespace GrGLInterfaces |
| 31 |
|
| 32 |
#if !defined(SK_DISABLE_LEGACY_EGLINTERFACE_FACTORY) |
| 33 |
sk_sp<const GrGLInterface> GrGLMakeEGLInterface() { return GrGLInterfaces::MakeEGL(); } |
| 34 |
#endif |