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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 SkASSERT(glCtx->isValid()); | 62 SkASSERT(glCtx->isValid()); |
63 | 63 |
64 // Block NVPR from non-NVPR types. | 64 // Block NVPR from non-NVPR types. |
65 SkAutoTUnref<const GrGLInterface> glInterface(SkRef(glCtx->gl())); | 65 SkAutoTUnref<const GrGLInterface> glInterface(SkRef(glCtx->gl())); |
66 if (kNVPR_GLContextType != type) { | 66 if (kNVPR_GLContextType != type) { |
67 glInterface.reset(GrGLInterfaceRemoveNVPR(glInterface)); | 67 glInterface.reset(GrGLInterfaceRemoveNVPR(glInterface)); |
68 if (!glInterface) { | 68 if (!glInterface) { |
69 return NULL; | 69 return NULL; |
70 } | 70 } |
| 71 } else { |
| 72 if (!glInterface->hasExtension("GL_NV_path_rendering")) { |
| 73 return NULL; |
| 74 } |
71 } | 75 } |
72 | 76 |
73 glCtx->makeCurrent(); | 77 glCtx->makeCurrent(); |
74 GrBackendContext p3dctx = reinterpret_cast<GrBackendContext>(glInterface.get
()); | 78 GrBackendContext p3dctx = reinterpret_cast<GrBackendContext>(glInterface.get
()); |
75 grCtx.reset(GrContext::Create(kOpenGL_GrBackend, p3dctx, fGlobalOptions)); | 79 grCtx.reset(GrContext::Create(kOpenGL_GrBackend, p3dctx, fGlobalOptions)); |
76 if (!grCtx.get()) { | 80 if (!grCtx.get()) { |
77 return NULL; | 81 return NULL; |
78 } | 82 } |
79 // Warn if path rendering support is not available for the NVPR type. | 83 // Warn if path rendering support is not available for the NVPR type. |
80 if (kNVPR_GLContextType == type) { | 84 if (kNVPR_GLContextType == type) { |
81 if (!grCtx->caps()->shaderCaps()->pathRenderingSupport()) { | 85 if (!grCtx->caps()->shaderCaps()->pathRenderingSupport()) { |
82 GrGLGpu* gpu = static_cast<GrGLGpu*>(grCtx->getGpu()); | 86 GrGLGpu* gpu = static_cast<GrGLGpu*>(grCtx->getGpu()); |
83 const GrGLubyte* verUByte; | 87 const GrGLubyte* verUByte; |
84 GR_GL_CALL_RET(gpu->glInterface(), verUByte, GetString(GR_GL_VERSION
)); | 88 GR_GL_CALL_RET(gpu->glInterface(), verUByte, GetString(GR_GL_VERSION
)); |
85 const char* ver = reinterpret_cast<const char*>(verUByte); | 89 const char* ver = reinterpret_cast<const char*>(verUByte); |
86 SkDebugf("\nWARNING: nvprmsaa config requested, but driver path rend
ering support not" | 90 SkDebugf("\nWARNING: nvprmsaa config requested, but driver path rend
ering support not" |
87 " available. Maybe update the driver? Your driver version s
tring: \"%s\"\n", ver); | 91 " available. Maybe update the driver? Your driver version s
tring: \"%s\"\n", ver); |
88 } | 92 } |
89 } | 93 } |
90 | 94 |
91 GPUContext& ctx = fContexts.push_back(); | 95 GPUContext& ctx = fContexts.push_back(); |
92 ctx.fGLContext = glCtx.get(); | 96 ctx.fGLContext = glCtx.get(); |
93 ctx.fGLContext->ref(); | 97 ctx.fGLContext->ref(); |
94 ctx.fGrContext = grCtx.get(); | 98 ctx.fGrContext = grCtx.get(); |
95 ctx.fGrContext->ref(); | 99 ctx.fGrContext->ref(); |
96 ctx.fType = type; | 100 ctx.fType = type; |
97 return ctx.fGrContext; | 101 return ctx.fGrContext; |
98 } | 102 } |
OLD | NEW |