Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1253)

Side by Side Diff: src/gpu/GrContextFactory.cpp

Issue 1497713002: Skip dm GPU configs when context creation fails (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « dm/DM.cpp ('k') | tests/GLInterfaceValidationTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 73
74 SkASSERT(glCtx->isValid()); 74 SkASSERT(glCtx->isValid());
75 75
76 // Block NVPR from non-NVPR types. 76 // Block NVPR from non-NVPR types.
77 SkAutoTUnref<const GrGLInterface> glInterface(SkRef(glCtx->gl())); 77 SkAutoTUnref<const GrGLInterface> glInterface(SkRef(glCtx->gl()));
78 if (kNVPR_GLContextType != type) { 78 if (kNVPR_GLContextType != type) {
79 glInterface.reset(GrGLInterfaceRemoveNVPR(glInterface)); 79 glInterface.reset(GrGLInterfaceRemoveNVPR(glInterface));
80 if (!glInterface) { 80 if (!glInterface) {
81 return nullptr; 81 return nullptr;
82 } 82 }
83 } else {
84 if (!glInterface->hasExtension("GL_NV_path_rendering")) {
85 return nullptr;
86 }
87 } 83 }
88 84
89 glCtx->makeCurrent(); 85 glCtx->makeCurrent();
90 GrBackendContext p3dctx = reinterpret_cast<GrBackendContext>(glInterface.get ()); 86 GrBackendContext p3dctx = reinterpret_cast<GrBackendContext>(glInterface.get ());
91 #ifdef SK_VULKAN 87 #ifdef SK_VULKAN
92 grCtx.reset(GrContext::Create(kVulkan_GrBackend, p3dctx, fGlobalOptions)); 88 grCtx.reset(GrContext::Create(kVulkan_GrBackend, p3dctx, fGlobalOptions));
93 #else 89 #else
94 grCtx.reset(GrContext::Create(kOpenGL_GrBackend, p3dctx, fGlobalOptions)); 90 grCtx.reset(GrContext::Create(kOpenGL_GrBackend, p3dctx, fGlobalOptions));
95 #endif 91 #endif
96 if (!grCtx.get()) { 92 if (!grCtx.get()) {
97 return nullptr; 93 return nullptr;
98 } 94 }
99 // Warn if path rendering support is not available for the NVPR type.
100 if (kNVPR_GLContextType == type) { 95 if (kNVPR_GLContextType == type) {
101 if (!grCtx->caps()->shaderCaps()->pathRenderingSupport()) { 96 if (!grCtx->caps()->shaderCaps()->pathRenderingSupport()) {
102 GrGpu* gpu = grCtx->getGpu(); 97 return nullptr;
103 const GrGLContext* ctx = gpu->glContextForTesting();
104 if (ctx) {
105 const GrGLubyte* verUByte;
106 GR_GL_CALL_RET(ctx->interface(), verUByte, GetString(GR_GL_VERSI ON));
107 const char* ver = reinterpret_cast<const char*>(verUByte);
108 SkDebugf("\nWARNING: nvprmsaa config requested, but driver path rendering "
109 "support not available. Maybe update the driver? Your d river version "
110 "string: \"%s\"\n", ver);
111 } else {
112 SkDebugf("\nWARNING: nvprmsaa config requested, but driver path rendering "
113 "support not available.\n");
114 }
115 } 98 }
116 } 99 }
117 100
118 ContextInfo* ctx = fContexts.emplace_back(new ContextInfo); 101 ContextInfo* ctx = fContexts.emplace_back(new ContextInfo);
119 ctx->fGLContext = SkRef(glCtx.get()); 102 ctx->fGLContext = SkRef(glCtx.get());
120 ctx->fGrContext = SkRef(grCtx.get()); 103 ctx->fGrContext = SkRef(grCtx.get());
121 ctx->fType = type; 104 ctx->fType = type;
122 return ctx; 105 return ctx;
123 } 106 }
OLDNEW
« no previous file with comments | « dm/DM.cpp ('k') | tests/GLInterfaceValidationTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698