Home | History | Annotate | Download | only in egl
      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 "gl/GrGLInterface.h"
      8 #include "gl/GrGLAssembleInterface.h"
      9 #include "gl/GrGLUtil.h"
     10 
     11 #include <EGL/egl.h>
     12 #include <GLES2/gl2.h>
     13 
     14 static GrGLFuncPtr egl_get_gl_proc(void* ctx, const char name[]) {
     15     SkASSERT(nullptr == ctx);
     16     GrGLFuncPtr ptr = eglGetProcAddress(name);
     17     if (!ptr) {
     18         if (0 == strcmp("eglQueryString", name)) {
     19             return (GrGLFuncPtr)eglQueryString;
     20         } else if (0 == strcmp("eglGetCurrentDisplay", name)) {
     21             return (GrGLFuncPtr)eglGetCurrentDisplay;
     22         }
     23     }
     24     return ptr;
     25 }
     26 
     27 sk_sp<const GrGLInterface> GrGLMakeNativeInterface() {
     28     return GrGLMakeAssembledInterface(nullptr, egl_get_gl_proc);
     29 }
     30 
     31 const GrGLInterface* GrGLCreateNativeInterface() { return GrGLMakeNativeInterface().release(); }
     32