OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include <GL/osmesa.h> | 9 #include <GL/osmesa.h> |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 } | 46 } |
47 | 47 |
48 if (fContext) { | 48 if (fContext) { |
49 OSMesaDestroyContext((OSMesaContext)fContext); | 49 OSMesaDestroyContext((OSMesaContext)fContext); |
50 fContext = static_cast<Context>(NULL); | 50 fContext = static_cast<Context>(NULL); |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 static const GrGLint gBOGUS_SIZE = 16; | 54 static const GrGLint gBOGUS_SIZE = 16; |
55 | 55 |
56 const GrGLInterface* SkMesaGLContext::createGLContext() { | 56 const GrGLInterface* SkMesaGLContext::createGLContext(GrGLStandard forcedGpuAPI)
{ |
| 57 if (kGLES_GrGLStandard == forcedGpuAPI) { |
| 58 return NULL; |
| 59 } |
| 60 |
57 /* Create an RGBA-mode context */ | 61 /* Create an RGBA-mode context */ |
58 #if OSMESA_MAJOR_VERSION * 100 + OSMESA_MINOR_VERSION >= 305 | 62 #if OSMESA_MAJOR_VERSION * 100 + OSMESA_MINOR_VERSION >= 305 |
59 /* specify Z, stencil, accum sizes */ | 63 /* specify Z, stencil, accum sizes */ |
60 fContext = (Context)OSMesaCreateContextExt(OSMESA_BGRA, 0, 0, 0, NULL); | 64 fContext = (Context)OSMesaCreateContextExt(OSMESA_BGRA, 0, 0, 0, NULL); |
61 #else | 65 #else |
62 fContext = (Context)OSMesaCreateContext(OSMESA_BGRA, NULL); | 66 fContext = (Context)OSMesaCreateContext(OSMESA_BGRA, NULL); |
63 #endif | 67 #endif |
64 if (!fContext) { | 68 if (!fContext) { |
65 SkDebugf("OSMesaCreateContext failed!\n"); | 69 SkDebugf("OSMesaCreateContext failed!\n"); |
66 this->destroyGLContext(); | 70 this->destroyGLContext(); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 void SkMesaGLContext::makeCurrent() const { | 103 void SkMesaGLContext::makeCurrent() const { |
100 if (fContext) { | 104 if (fContext) { |
101 if (!OSMesaMakeCurrent((OSMesaContext)fContext, fImage, | 105 if (!OSMesaMakeCurrent((OSMesaContext)fContext, fImage, |
102 GR_GL_UNSIGNED_BYTE, gBOGUS_SIZE, gBOGUS_SIZE)) { | 106 GR_GL_UNSIGNED_BYTE, gBOGUS_SIZE, gBOGUS_SIZE)) { |
103 SkDebugf("Could not make MESA context current."); | 107 SkDebugf("Could not make MESA context current."); |
104 } | 108 } |
105 } | 109 } |
106 } | 110 } |
107 | 111 |
108 void SkMesaGLContext::swapBuffers() const { } | 112 void SkMesaGLContext::swapBuffers() const { } |
OLD | NEW |