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

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

Issue 1446453003: Generate list of GPU contexts outside SurfaceTest tests (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: msvc fixes Created 5 years, 1 month 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 | « src/gpu/GrContextFactory.h ('k') | tests/ImageTest.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
11 #if SK_ANGLE 11 #if SK_ANGLE
12 #include "gl/angle/SkANGLEGLContext.h" 12 #include "gl/angle/SkANGLEGLContext.h"
13 #endif 13 #endif
14 #if SK_COMMAND_BUFFER 14 #if SK_COMMAND_BUFFER
15 #include "gl/command_buffer/SkCommandBufferGLContext.h" 15 #include "gl/command_buffer/SkCommandBufferGLContext.h"
16 #endif 16 #endif
17 #include "gl/debug/SkDebugGLContext.h" 17 #include "gl/debug/SkDebugGLContext.h"
18 #if SK_MESA 18 #if SK_MESA
19 #include "gl/mesa/SkMesaGLContext.h" 19 #include "gl/mesa/SkMesaGLContext.h"
20 #endif 20 #endif
21 #include "gl/SkGLContext.h" 21 #include "gl/SkGLContext.h"
22 #include "gl/SkNullGLContext.h" 22 #include "gl/SkNullGLContext.h"
23 #include "gl/GrGLGpu.h" 23 #include "gl/GrGLGpu.h"
24 #include "GrCaps.h" 24 #include "GrCaps.h"
25 25
26 GrContext* GrContextFactory::get(GLContextType type, GrGLStandard forcedGpuAPI) { 26 GrContextFactory::ContextInfo* GrContextFactory::getContextInfo(GLContextType ty pe,
27 GrGLStandard for cedGpuAPI) {
27 for (int i = 0; i < fContexts.count(); ++i) { 28 for (int i = 0; i < fContexts.count(); ++i) {
28 if (forcedGpuAPI != kNone_GrGLStandard && 29 if (forcedGpuAPI != kNone_GrGLStandard &&
29 forcedGpuAPI != fContexts[i].fGLContext->gl()->fStandard) 30 forcedGpuAPI != fContexts[i]->fGLContext->gl()->fStandard)
30 continue; 31 continue;
31 32
32 if (fContexts[i].fType == type) { 33 if (fContexts[i]->fType == type) {
33 fContexts[i].fGLContext->makeCurrent(); 34 fContexts[i]->fGLContext->makeCurrent();
34 return fContexts[i].fGrContext; 35 return fContexts[i];
35 } 36 }
36 } 37 }
37 SkAutoTUnref<SkGLContext> glCtx; 38 SkAutoTUnref<SkGLContext> glCtx;
38 SkAutoTUnref<GrContext> grCtx; 39 SkAutoTUnref<GrContext> grCtx;
39 switch (type) { 40 switch (type) {
40 case kNVPR_GLContextType: // fallthru 41 case kNVPR_GLContextType: // fallthru
41 case kNative_GLContextType: 42 case kNative_GLContextType:
42 glCtx.reset(SkCreatePlatformGLContext(forcedGpuAPI)); 43 glCtx.reset(SkCreatePlatformGLContext(forcedGpuAPI));
43 break; 44 break;
44 #ifdef SK_ANGLE 45 #ifdef SK_ANGLE
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 SkDebugf("\nWARNING: nvprmsaa config requested, but driver path rendering " 108 SkDebugf("\nWARNING: nvprmsaa config requested, but driver path rendering "
108 "support not available. Maybe update the driver? Your d river version " 109 "support not available. Maybe update the driver? Your d river version "
109 "string: \"%s\"\n", ver); 110 "string: \"%s\"\n", ver);
110 } else { 111 } else {
111 SkDebugf("\nWARNING: nvprmsaa config requested, but driver path rendering " 112 SkDebugf("\nWARNING: nvprmsaa config requested, but driver path rendering "
112 "support not available.\n"); 113 "support not available.\n");
113 } 114 }
114 } 115 }
115 } 116 }
116 117
117 GPUContext& ctx = fContexts.push_back(); 118 ContextInfo* ctx = fContexts.emplace_back(new ContextInfo);
118 ctx.fGLContext = glCtx.get(); 119 ctx->fGLContext = SkRef(glCtx.get());
119 ctx.fGLContext->ref(); 120 ctx->fGrContext = SkRef(grCtx.get());
120 ctx.fGrContext = grCtx.get(); 121 ctx->fType = type;
121 ctx.fGrContext->ref(); 122 return ctx;
122 ctx.fType = type;
123 return ctx.fGrContext;
124 } 123 }
OLDNEW
« no previous file with comments | « src/gpu/GrContextFactory.h ('k') | tests/ImageTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698