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 |
11 #include "gl/mesa/GLContext_mesa.h" | 11 #include "gl/mesa/GLTestContext_mesa.h" |
12 #include "gl/GrGLDefines.h" | 12 #include "gl/GrGLDefines.h" |
13 | 13 |
14 #include "gl/GrGLAssembleInterface.h" | 14 #include "gl/GrGLAssembleInterface.h" |
15 #include "gl/GrGLUtil.h" | 15 #include "gl/GrGLUtil.h" |
16 #include "osmesa_wrapper.h" | 16 #include "osmesa_wrapper.h" |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 static GrGLFuncPtr osmesa_get(void* ctx, const char name[]) { | 20 static GrGLFuncPtr osmesa_get(void* ctx, const char name[]) { |
21 SkASSERT(nullptr == ctx); | 21 SkASSERT(nullptr == ctx); |
22 SkASSERT(OSMesaGetCurrentContext()); | 22 SkASSERT(OSMesaGetCurrentContext()); |
23 return OSMesaGetProcAddress(name); | 23 return OSMesaGetProcAddress(name); |
24 } | 24 } |
25 | 25 |
26 static const GrGLInterface* create_mesa_interface() { | 26 static const GrGLInterface* create_mesa_interface() { |
27 if (nullptr == OSMesaGetCurrentContext()) { | 27 if (nullptr == OSMesaGetCurrentContext()) { |
28 return nullptr; | 28 return nullptr; |
29 } | 29 } |
30 return GrGLAssembleInterface(nullptr, osmesa_get); | 30 return GrGLAssembleInterface(nullptr, osmesa_get); |
31 } | 31 } |
32 | 32 |
33 static const GrGLint gBOGUS_SIZE = 16; | 33 static const GrGLint gBOGUS_SIZE = 16; |
34 | 34 |
35 class MesaGLContext : public sk_gpu_test::GLContext { | 35 class MesaGLContext : public sk_gpu_test::GLTestContext { |
36 private: | 36 private: |
37 typedef intptr_t Context; | 37 typedef intptr_t Context; |
38 | 38 |
39 public: | 39 public: |
40 MesaGLContext(); | 40 MesaGLContext(); |
41 ~MesaGLContext() override; | 41 ~MesaGLContext() override; |
42 | 42 |
43 private: | 43 private: |
44 void destroyGLContext(); | 44 void destroyGLContext(); |
45 | 45 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 133 |
134 void MesaGLContext::onPlatformSwapBuffers() const { } | 134 void MesaGLContext::onPlatformSwapBuffers() const { } |
135 | 135 |
136 GrGLFuncPtr MesaGLContext::onPlatformGetProcAddress(const char *procName) const
{ | 136 GrGLFuncPtr MesaGLContext::onPlatformGetProcAddress(const char *procName) const
{ |
137 return OSMesaGetProcAddress(procName); | 137 return OSMesaGetProcAddress(procName); |
138 } | 138 } |
139 } // anonymous namespace | 139 } // anonymous namespace |
140 | 140 |
141 | 141 |
142 namespace sk_gpu_test { | 142 namespace sk_gpu_test { |
143 GLContext *CreateMesaGLContext() { | 143 GLTestContext *CreateMesaGLTestContext() { |
144 MesaGLContext *ctx = new MesaGLContext; | 144 MesaGLContext *ctx = new MesaGLContext; |
145 if (!ctx->isValid()) { | 145 if (!ctx->isValid()) { |
146 delete ctx; | 146 delete ctx; |
147 return nullptr; | 147 return nullptr; |
148 } | 148 } |
149 return ctx; | 149 return ctx; |
150 } | 150 } |
151 } // sk_gpu_test | 151 } // sk_gpu_test |
OLD | NEW |