blob: 4a204123e186ecd5cdadd714892cb3d8fe8af7b1 [file] [log] [blame]
/*
* Copyright 2014 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "gl/GrGLInterface.h"
#include "gl/GrGLAssembleInterface.h"
#include "gl/GrGLUtil.h"
#include <GL/glx.h>
static GrGLFuncPtr glx_get(void* ctx, const char name[]) {
// Avoid calling glXGetProcAddress() for EGL procs.
// We don't expect it to ever succeed, but somtimes it returns non-null anyway.
if (0 == strncmp(name, "egl", 3)) {
return nullptr;
}
SkASSERT(nullptr == ctx);
SkASSERT(glXGetCurrentContext());
return glXGetProcAddress(reinterpret_cast<const GLubyte*>(name));
}
const GrGLInterface* GrGLCreateNativeInterface() {
if (nullptr == glXGetCurrentContext()) {
return nullptr;
}
return GrGLAssembleInterface(nullptr, glx_get);
}