epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | |
bungeman@google.com | 0e45441 | 2011-05-19 17:47:02 +0000 | [diff] [blame] | 2 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 3 | * 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.com | 0e45441 | 2011-05-19 17:47:02 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 9 | #include "gl/GrGLAssembleInterface.h" |
bsalomon@google.com | 9c1f1ac | 2012-05-07 17:09:37 +0000 | [diff] [blame] | 10 | #include "../GrGLUtil.h" |
bungeman@google.com | 0e45441 | 2011-05-19 17:47:02 +0000 | [diff] [blame] | 11 | |
bsalomon@google.com | 6f47663 | 2013-01-08 16:33:41 +0000 | [diff] [blame] | 12 | #include "osmesa_wrapper.h" |
bungeman@google.com | 0e45441 | 2011-05-19 17:47:02 +0000 | [diff] [blame] | 13 | |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 14 | static GrGLFuncPtr osmesa_get(void* ctx, const char name[]) { |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 15 | SkASSERT(nullptr == ctx); |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 16 | SkASSERT(OSMesaGetCurrentContext()); |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 17 | return OSMesaGetProcAddress(name); |
| 18 | } |
bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame] | 19 | |
| 20 | const GrGLInterface* GrGLCreateMesaInterface() { |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 21 | if (nullptr == OSMesaGetCurrentContext()) { |
| 22 | return nullptr; |
skia.committer@gmail.com | eeaeafe | 2014-04-30 03:05:25 +0000 | [diff] [blame] | 23 | } |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 24 | return GrGLAssembleInterface(nullptr, osmesa_get); |
bungeman@google.com | 0e45441 | 2011-05-19 17:47:02 +0000 | [diff] [blame] | 25 | } |