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

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

Issue 1604993005: Add ability to wire up sharelist in glcontext creation (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 months 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
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 context.fGLContext->makeCurrent(); 53 context.fGLContext->makeCurrent();
54 context.fGLContext->testAbandon(); 54 context.fGLContext->testAbandon();
55 delete(context.fGLContext); 55 delete(context.fGLContext);
56 context.fGLContext = nullptr; 56 context.fGLContext = nullptr;
57 } 57 }
58 context.fGrContext->abandonContext(); 58 context.fGrContext->abandonContext();
59 } 59 }
60 } 60 }
61 61
62 GrContextFactory::ContextInfo GrContextFactory::getContextInfo(GLContextType typ e, 62 GrContextFactory::ContextInfo GrContextFactory::getContextInfo(GLContextType typ e,
63 GLContextOptions options) { 63 GLContextOptions options,
64 SkGLContext* shar eList) {
64 for (int i = 0; i < fContexts.count(); ++i) { 65 for (int i = 0; i < fContexts.count(); ++i) {
65 Context& context = fContexts[i]; 66 Context& context = fContexts[i];
66 if (!context.fGLContext) { 67 if (!context.fGLContext) {
67 continue; 68 continue;
68 } 69 }
69 if (context.fType == type && 70 if (context.fType == type &&
70 context.fOptions == options) { 71 context.fOptions == options) {
71 context.fGLContext->makeCurrent(); 72 context.fGLContext->makeCurrent();
72 return ContextInfo(context.fGrContext, context.fGLContext); 73 return ContextInfo(context.fGrContext, context.fGLContext);
73 } 74 }
74 } 75 }
75 SkAutoTDelete<SkGLContext> glCtx; 76 SkAutoTDelete<SkGLContext> glCtx;
76 SkAutoTUnref<GrContext> grCtx; 77 SkAutoTUnref<GrContext> grCtx;
77 switch (type) { 78 switch (type) {
78 case kNative_GLContextType: 79 case kNative_GLContextType:
79 glCtx.reset(SkCreatePlatformGLContext(kNone_GrGLStandard)); 80 glCtx.reset(SkCreatePlatformGLContext(kNone_GrGLStandard, shareList) );
80 break; 81 break;
81 case kGL_GLContextType: 82 case kGL_GLContextType:
82 glCtx.reset(SkCreatePlatformGLContext(kGL_GrGLStandard)); 83 glCtx.reset(SkCreatePlatformGLContext(kGL_GrGLStandard, shareList));
83 break; 84 break;
84 case kGLES_GLContextType: 85 case kGLES_GLContextType:
85 glCtx.reset(SkCreatePlatformGLContext(kGLES_GrGLStandard)); 86 glCtx.reset(SkCreatePlatformGLContext(kGLES_GrGLStandard, shareList) );
86 break; 87 break;
87 #if SK_ANGLE 88 #if SK_ANGLE
88 #ifdef SK_BUILD_FOR_WIN 89 #ifdef SK_BUILD_FOR_WIN
89 case kANGLE_GLContextType: 90 case kANGLE_GLContextType:
90 glCtx.reset(SkANGLEGLContext::CreateDirectX()); 91 glCtx.reset(SkANGLEGLContext::CreateDirectX());
91 break; 92 break;
92 #endif 93 #endif
93 case kANGLE_GL_GLContextType: 94 case kANGLE_GL_GLContextType:
94 glCtx.reset(SkANGLEGLContext::CreateOpenGL()); 95 glCtx.reset(SkANGLEGLContext::CreateOpenGL());
95 break; 96 break;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } 143 }
143 } 144 }
144 145
145 Context& context = fContexts.push_back(); 146 Context& context = fContexts.push_back();
146 context.fGLContext = glCtx.detach(); 147 context.fGLContext = glCtx.detach();
147 context.fGrContext = SkRef(grCtx.get()); 148 context.fGrContext = SkRef(grCtx.get());
148 context.fType = type; 149 context.fType = type;
149 context.fOptions = options; 150 context.fOptions = options;
150 return ContextInfo(context.fGrContext, context.fGLContext); 151 return ContextInfo(context.fGrContext, context.fGLContext);
151 } 152 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698