| 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 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 if (!(kEnableNVPR_GLContextOptions & options)) { | 122 if (!(kEnableNVPR_GLContextOptions & options)) { |
| 123 glInterface.reset(GrGLInterfaceRemoveNVPR(glInterface)); | 123 glInterface.reset(GrGLInterfaceRemoveNVPR(glInterface)); |
| 124 if (!glInterface) { | 124 if (!glInterface) { |
| 125 return ContextInfo(); | 125 return ContextInfo(); |
| 126 } | 126 } |
| 127 } | 127 } |
| 128 | 128 |
| 129 glCtx->makeCurrent(); | 129 glCtx->makeCurrent(); |
| 130 GrBackendContext p3dctx = reinterpret_cast<GrBackendContext>(glInterface.get
()); | 130 GrBackendContext p3dctx = reinterpret_cast<GrBackendContext>(glInterface.get
()); |
| 131 #ifdef SK_VULKAN | 131 #ifdef SK_VULKAN |
| 132 grCtx.reset(GrContext::Create(kVulkan_GrBackend, p3dctx, fGlobalOptions)); | 132 if (kEnableNVPR_GLContextOptions & options) { |
| 133 return ContextInfo(); |
| 134 } else { |
| 135 grCtx.reset(GrContext::Create(kVulkan_GrBackend, p3dctx, fGlobalOptions)
); |
| 136 } |
| 133 #else | 137 #else |
| 134 grCtx.reset(GrContext::Create(kOpenGL_GrBackend, p3dctx, fGlobalOptions)); | 138 grCtx.reset(GrContext::Create(kOpenGL_GrBackend, p3dctx, fGlobalOptions)); |
| 135 #endif | 139 #endif |
| 136 if (!grCtx.get()) { | 140 if (!grCtx.get()) { |
| 137 return ContextInfo(); | 141 return ContextInfo(); |
| 138 } | 142 } |
| 139 if (kEnableNVPR_GLContextOptions & options) { | 143 if (kEnableNVPR_GLContextOptions & options) { |
| 140 if (!grCtx->caps()->shaderCaps()->pathRenderingSupport()) { | 144 if (!grCtx->caps()->shaderCaps()->pathRenderingSupport()) { |
| 141 return ContextInfo(); | 145 return ContextInfo(); |
| 142 } | 146 } |
| 143 } | 147 } |
| 144 | 148 |
| 145 Context& context = fContexts.push_back(); | 149 Context& context = fContexts.push_back(); |
| 146 context.fGLContext = glCtx.release(); | 150 context.fGLContext = glCtx.release(); |
| 147 context.fGrContext = SkRef(grCtx.get()); | 151 context.fGrContext = SkRef(grCtx.get()); |
| 148 context.fType = type; | 152 context.fType = type; |
| 149 context.fOptions = options; | 153 context.fOptions = options; |
| 150 return ContextInfo(context.fGrContext, context.fGLContext); | 154 return ContextInfo(context.fGrContext, context.fGLContext); |
| 151 } | 155 } |
| OLD | NEW |