blob: 734c1fea0ce68d9bbe2b9ba265219c01062b8751 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
bungeman@google.com0e454412011-05-19 17:47:02 +00002/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00003 * Copyright 2011 Google Inc.
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
bungeman@google.com0e454412011-05-19 17:47:02 +00007 */
8
commit-bot@chromium.org9add5dc2014-04-29 20:06:22 +00009#include "gl/GrGLAssembleInterface.h"
bsalomon@google.com9c1f1ac2012-05-07 17:09:37 +000010#include "../GrGLUtil.h"
bungeman@google.com0e454412011-05-19 17:47:02 +000011
bsalomon@google.com6f476632013-01-08 16:33:41 +000012#include "osmesa_wrapper.h"
bungeman@google.com0e454412011-05-19 17:47:02 +000013
commit-bot@chromium.org9add5dc2014-04-29 20:06:22 +000014static GrGLFuncPtr osmesa_get(void* ctx, const char name[]) {
halcanary96fcdcc2015-08-27 07:41:13 -070015 SkASSERT(nullptr == ctx);
bsalomon49f085d2014-09-05 13:34:00 -070016 SkASSERT(OSMesaGetCurrentContext());
commit-bot@chromium.org9add5dc2014-04-29 20:06:22 +000017 return OSMesaGetProcAddress(name);
18}
bsalomon@google.com373a6632011-10-19 20:43:20 +000019
20const GrGLInterface* GrGLCreateMesaInterface() {
halcanary96fcdcc2015-08-27 07:41:13 -070021 if (nullptr == OSMesaGetCurrentContext()) {
22 return nullptr;
skia.committer@gmail.comeeaeafe2014-04-30 03:05:25 +000023 }
halcanary96fcdcc2015-08-27 07:41:13 -070024 return GrGLAssembleInterface(nullptr, osmesa_get);
bungeman@google.com0e454412011-05-19 17:47:02 +000025}