bool GrGLContextInfo::initialize(const GrGLInterface* interface) {
    this->reset();
    // We haven't validated the GrGLInterface yet, so check for GetString
    // function pointer
    if (interface->fGetString) {
        const GrGLubyte* verUByte;
        GR_GL_CALL_RET(interface, verUByte, GetString(GR_GL_VERSION));
        const char* ver = reinterpret_cast<const char*>(verUByte);
        GrGLBinding binding = GrGLGetBindingInUseFromString(ver);

        if (0 != binding && interface->validate(binding) && fExtensions.init(binding, interface)) {
            fBindingInUse = binding;

            fGLVersion = GrGLGetVersionFromString(ver);

            fGLSLGeneration = GrGetGLSLGeneration(fBindingInUse, interface);

            fVendor = GrGLGetVendor(interface);

            fIsMesa = GrGLIsMesaFromVersionString(ver);

            fGLCaps->init(*this, interface);
            return true;
        }
    }
    return false;
}
const GrGLInterface* GrGLCreateNativeInterface() {

    GrGLGetStringiProc getStringi = (GrGLGetStringiProc) eglGetProcAddress("glGetStringi");

    const char* verStr = reinterpret_cast<const char*>(glGetString(GR_GL_VERSION));
    GrGLVersion version = GrGLGetVersionFromString(verStr);
    GrGLBinding binding = GrGLGetBindingInUseFromString(verStr);

    GrGLExtensions extensions;
    if (!extensions.init(binding, glGetString, getStringi, glGetIntegerv)) {
        return NULL;
    }

    if (kES_GrGLBinding == binding) {
        return create_es_interface(version, extensions);
    } else if (kDesktop_GrGLBinding == binding) {
        return create_desktop_interface(version, extensions);
    } else {
        return NULL;
    }
}
GrGLBinding GrGLGetBindingInUse(const GrGLInterface* gl) {
    const GrGLubyte* v;
    GR_GL_CALL_RET(gl, v, GetString(GR_GL_VERSION));
    return GrGLGetBindingInUseFromString((const char*) v);
}