OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 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 "GrContextFactory.h" | 9 #include "GrContextFactory.h" |
10 | 10 |
11 #if SK_ANGLE | 11 #if SK_ANGLE |
12 #include "gl/angle/SkANGLEGLContext.h" | 12 #include "gl/angle/SkANGLEGLContext.h" |
13 #endif | 13 #endif |
| 14 #if SK_COMMAND_BUFFER |
| 15 #include "gl/command_buffer/SkCommandBufferGLContext.h" |
| 16 #endif |
14 #include "gl/debug/SkDebugGLContext.h" | 17 #include "gl/debug/SkDebugGLContext.h" |
15 #if SK_MESA | 18 #if SK_MESA |
16 #include "gl/mesa/SkMesaGLContext.h" | 19 #include "gl/mesa/SkMesaGLContext.h" |
17 #endif | 20 #endif |
18 #include "gl/SkGLContext.h" | 21 #include "gl/SkGLContext.h" |
19 #include "gl/SkNullGLContext.h" | 22 #include "gl/SkNullGLContext.h" |
20 #include "gl/GrGLGpu.h" | 23 #include "gl/GrGLGpu.h" |
21 #include "GrCaps.h" | 24 #include "GrCaps.h" |
22 | 25 |
23 GrContext* GrContextFactory::get(GLContextType type, GrGLStandard forcedGpuAPI)
{ | 26 GrContext* GrContextFactory::get(GLContextType type, GrGLStandard forcedGpuAPI)
{ |
(...skipping 12 matching lines...) Expand all Loading... |
36 switch (type) { | 39 switch (type) { |
37 case kNVPR_GLContextType: // fallthru | 40 case kNVPR_GLContextType: // fallthru |
38 case kNative_GLContextType: | 41 case kNative_GLContextType: |
39 glCtx.reset(SkCreatePlatformGLContext(forcedGpuAPI)); | 42 glCtx.reset(SkCreatePlatformGLContext(forcedGpuAPI)); |
40 break; | 43 break; |
41 #ifdef SK_ANGLE | 44 #ifdef SK_ANGLE |
42 case kANGLE_GLContextType: | 45 case kANGLE_GLContextType: |
43 glCtx.reset(SkANGLEGLContext::Create(forcedGpuAPI)); | 46 glCtx.reset(SkANGLEGLContext::Create(forcedGpuAPI)); |
44 break; | 47 break; |
45 #endif | 48 #endif |
| 49 #ifdef SK_COMMAND_BUFFER |
| 50 case kCommandBuffer_GLContextType: |
| 51 glCtx.reset(SkCommandBufferGLContext::Create(forcedGpuAPI)); |
| 52 break; |
| 53 #endif |
46 #ifdef SK_MESA | 54 #ifdef SK_MESA |
47 case kMESA_GLContextType: | 55 case kMESA_GLContextType: |
48 glCtx.reset(SkMesaGLContext::Create(forcedGpuAPI)); | 56 glCtx.reset(SkMesaGLContext::Create(forcedGpuAPI)); |
49 break; | 57 break; |
50 #endif | 58 #endif |
51 case kNull_GLContextType: | 59 case kNull_GLContextType: |
52 glCtx.reset(SkNullGLContext::Create(forcedGpuAPI)); | 60 glCtx.reset(SkNullGLContext::Create(forcedGpuAPI)); |
53 break; | 61 break; |
54 case kDebug_GLContextType: | 62 case kDebug_GLContextType: |
55 glCtx.reset(SkDebugGLContext::Create(forcedGpuAPI)); | 63 glCtx.reset(SkDebugGLContext::Create(forcedGpuAPI)); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 } | 112 } |
105 | 113 |
106 GPUContext& ctx = fContexts.push_back(); | 114 GPUContext& ctx = fContexts.push_back(); |
107 ctx.fGLContext = glCtx.get(); | 115 ctx.fGLContext = glCtx.get(); |
108 ctx.fGLContext->ref(); | 116 ctx.fGLContext->ref(); |
109 ctx.fGrContext = grCtx.get(); | 117 ctx.fGrContext = grCtx.get(); |
110 ctx.fGrContext->ref(); | 118 ctx.fGrContext->ref(); |
111 ctx.fType = type; | 119 ctx.fType = type; |
112 return ctx.fGrContext; | 120 return ctx.fGrContext; |
113 } | 121 } |
OLD | NEW |