| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 return NULL; | 69 return NULL; |
| 70 } | 70 } |
| 71 } else { | 71 } else { |
| 72 if (!glInterface->hasExtension("GL_NV_path_rendering")) { | 72 if (!glInterface->hasExtension("GL_NV_path_rendering")) { |
| 73 return NULL; | 73 return NULL; |
| 74 } | 74 } |
| 75 } | 75 } |
| 76 | 76 |
| 77 glCtx->makeCurrent(); | 77 glCtx->makeCurrent(); |
| 78 GrBackendContext p3dctx = reinterpret_cast<GrBackendContext>(glInterface.get
()); | 78 GrBackendContext p3dctx = reinterpret_cast<GrBackendContext>(glInterface.get
()); |
| 79 #ifdef SK_VULKAN |
| 80 grCtx.reset(GrContext::Create(kVulkan_GrBackend, p3dctx, fGlobalOptions)); |
| 81 #else |
| 79 grCtx.reset(GrContext::Create(kOpenGL_GrBackend, p3dctx, fGlobalOptions)); | 82 grCtx.reset(GrContext::Create(kOpenGL_GrBackend, p3dctx, fGlobalOptions)); |
| 83 #endif |
| 80 if (!grCtx.get()) { | 84 if (!grCtx.get()) { |
| 81 return NULL; | 85 return NULL; |
| 82 } | 86 } |
| 83 // Warn if path rendering support is not available for the NVPR type. | 87 // Warn if path rendering support is not available for the NVPR type. |
| 84 if (kNVPR_GLContextType == type) { | 88 if (kNVPR_GLContextType == type) { |
| 85 if (!grCtx->caps()->shaderCaps()->pathRenderingSupport()) { | 89 if (!grCtx->caps()->shaderCaps()->pathRenderingSupport()) { |
| 86 GrGpu* gpu = grCtx->getGpu(); | 90 GrGpu* gpu = grCtx->getGpu(); |
| 87 const GrGLContext* ctx = gpu->glContextForTesting(); | 91 const GrGLContext* ctx = gpu->glContextForTesting(); |
| 88 if (ctx) { | 92 if (ctx) { |
| 89 const GrGLubyte* verUByte; | 93 const GrGLubyte* verUByte; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 100 } | 104 } |
| 101 | 105 |
| 102 GPUContext& ctx = fContexts.push_back(); | 106 GPUContext& ctx = fContexts.push_back(); |
| 103 ctx.fGLContext = glCtx.get(); | 107 ctx.fGLContext = glCtx.get(); |
| 104 ctx.fGLContext->ref(); | 108 ctx.fGLContext->ref(); |
| 105 ctx.fGrContext = grCtx.get(); | 109 ctx.fGrContext = grCtx.get(); |
| 106 ctx.fGrContext->ref(); | 110 ctx.fGrContext->ref(); |
| 107 ctx.fType = type; | 111 ctx.fType = type; |
| 108 return ctx.fGrContext; | 112 return ctx.fGrContext; |
| 109 } | 113 } |
| OLD | NEW |