aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp
blob: 19eec7e8acea66ea78ddce2d7102c2432a6c10e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
 * 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[]) {
    SkASSERT(NULL == ctx);
    SkASSERT(glXGetCurrentContext());
    return glXGetProcAddress(reinterpret_cast<const GLubyte*>(name));
}

const GrGLInterface* GrGLCreateNativeInterface() {
    if (NULL == glXGetCurrentContext()) {
        return NULL;
    }

    return GrGLAssembleInterface(NULL, glx_get);
}