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 } | |
75 } | 71 } |
76 | 72 |
77 glCtx->makeCurrent(); | 73 glCtx->makeCurrent(); |
78 GrBackendContext p3dctx = reinterpret_cast<GrBackendContext>(glInterface.get
()); | 74 GrBackendContext p3dctx = reinterpret_cast<GrBackendContext>(glInterface.get
()); |
79 grCtx.reset(GrContext::Create(kOpenGL_GrBackend, p3dctx, fGlobalOptions)); | 75 grCtx.reset(GrContext::Create(kOpenGL_GrBackend, p3dctx, fGlobalOptions)); |
80 if (!grCtx.get()) { | 76 if (!grCtx.get()) { |
81 return NULL; | 77 return NULL; |
82 } | 78 } |
83 // Warn if path rendering support is not available for the NVPR type. | 79 // Warn if path rendering support is not available for the NVPR type. |
84 if (kNVPR_GLContextType == type) { | 80 if (kNVPR_GLContextType == type) { |
85 if (!grCtx->caps()->shaderCaps()->pathRenderingSupport()) { | 81 if (!grCtx->caps()->shaderCaps()->pathRenderingSupport()) { |
86 GrGLGpu* gpu = static_cast<GrGLGpu*>(grCtx->getGpu()); | 82 GrGLGpu* gpu = static_cast<GrGLGpu*>(grCtx->getGpu()); |
87 const GrGLubyte* verUByte; | 83 const GrGLubyte* verUByte; |
88 GR_GL_CALL_RET(gpu->glInterface(), verUByte, GetString(GR_GL_VERSION
)); | 84 GR_GL_CALL_RET(gpu->glInterface(), verUByte, GetString(GR_GL_VERSION
)); |
89 const char* ver = reinterpret_cast<const char*>(verUByte); | 85 const char* ver = reinterpret_cast<const char*>(verUByte); |
90 SkDebugf("\nWARNING: nvprmsaa config requested, but driver path rend
ering support not" | 86 SkDebugf("\nWARNING: nvprmsaa config requested, but driver path rend
ering support not" |
91 " available. Maybe update the driver? Your driver version s
tring: \"%s\"\n", ver); | 87 " available. Maybe update the driver? Your driver version s
tring: \"%s\"\n", ver); |
92 } | 88 } |
93 } | 89 } |
94 | 90 |
95 GPUContext& ctx = fContexts.push_back(); | 91 GPUContext& ctx = fContexts.push_back(); |
96 ctx.fGLContext = glCtx.get(); | 92 ctx.fGLContext = glCtx.get(); |
97 ctx.fGLContext->ref(); | 93 ctx.fGLContext->ref(); |
98 ctx.fGrContext = grCtx.get(); | 94 ctx.fGrContext = grCtx.get(); |
99 ctx.fGrContext->ref(); | 95 ctx.fGrContext->ref(); |
100 ctx.fType = type; | 96 ctx.fType = type; |
101 return ctx.fGrContext; | 97 return ctx.fGrContext; |
102 } | 98 } |
OLD | NEW |