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

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

Issue 1825593002: GrVkGpu initialization cleanup. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comments (and rebase to ToT) Created 4 years, 9 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
« no previous file with comments | « include/gpu/vk/GrVkInterface.h ('k') | src/gpu/GrGpuFactory.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 #if SK_VULKAN
22 #include "vk/GrVkBackendContext.h"
23 #endif
21 #include "gl/SkGLContext.h" 24 #include "gl/SkGLContext.h"
22 #include "gl/SkNullGLContext.h" 25 #include "gl/SkNullGLContext.h"
23 #include "gl/GrGLGpu.h" 26 #include "gl/GrGLGpu.h"
24 #include "GrCaps.h" 27 #include "GrCaps.h"
25 28
26 GrContextFactory::GrContextFactory() { } 29 GrContextFactory::GrContextFactory() { }
27 30
28 GrContextFactory::GrContextFactory(const GrContextOptions& opts) 31 GrContextFactory::GrContextFactory(const GrContextOptions& opts)
29 : fGlobalOptions(opts) { 32 : fGlobalOptions(opts) {
30 } 33 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 // Block NVPR from non-NVPR types. 123 // Block NVPR from non-NVPR types.
121 SkAutoTUnref<const GrGLInterface> glInterface(SkRef(glCtx->gl())); 124 SkAutoTUnref<const GrGLInterface> glInterface(SkRef(glCtx->gl()));
122 if (!(kEnableNVPR_GLContextOptions & options)) { 125 if (!(kEnableNVPR_GLContextOptions & options)) {
123 glInterface.reset(GrGLInterfaceRemoveNVPR(glInterface)); 126 glInterface.reset(GrGLInterfaceRemoveNVPR(glInterface));
124 if (!glInterface) { 127 if (!glInterface) {
125 return ContextInfo(); 128 return ContextInfo();
126 } 129 }
127 } 130 }
128 131
129 glCtx->makeCurrent(); 132 glCtx->makeCurrent();
130 GrBackendContext p3dctx = reinterpret_cast<GrBackendContext>(glInterface.get ());
131 #ifdef SK_VULKAN 133 #ifdef SK_VULKAN
132 if (kEnableNVPR_GLContextOptions & options) { 134 if (kEnableNVPR_GLContextOptions & options) {
133 return ContextInfo(); 135 return ContextInfo();
134 } else { 136 } else {
137 GrBackendContext p3dctx = reinterpret_cast<GrBackendContext>(GrVkBackend Context::Create());
135 grCtx.reset(GrContext::Create(kVulkan_GrBackend, p3dctx, fGlobalOptions) ); 138 grCtx.reset(GrContext::Create(kVulkan_GrBackend, p3dctx, fGlobalOptions) );
136 } 139 }
137 #else 140 #else
141 GrBackendContext p3dctx = reinterpret_cast<GrBackendContext>(glInterface.get ());
138 grCtx.reset(GrContext::Create(kOpenGL_GrBackend, p3dctx, fGlobalOptions)); 142 grCtx.reset(GrContext::Create(kOpenGL_GrBackend, p3dctx, fGlobalOptions));
139 #endif 143 #endif
140 if (!grCtx.get()) { 144 if (!grCtx.get()) {
141 return ContextInfo(); 145 return ContextInfo();
142 } 146 }
143 if (kEnableNVPR_GLContextOptions & options) { 147 if (kEnableNVPR_GLContextOptions & options) {
144 if (!grCtx->caps()->shaderCaps()->pathRenderingSupport()) { 148 if (!grCtx->caps()->shaderCaps()->pathRenderingSupport()) {
145 return ContextInfo(); 149 return ContextInfo();
146 } 150 }
147 } 151 }
148 152
149 Context& context = fContexts.push_back(); 153 Context& context = fContexts.push_back();
150 context.fGLContext = glCtx.release(); 154 context.fGLContext = glCtx.release();
151 context.fGrContext = SkRef(grCtx.get()); 155 context.fGrContext = SkRef(grCtx.get());
152 context.fType = type; 156 context.fType = type;
153 context.fOptions = options; 157 context.fOptions = options;
154 return ContextInfo(context.fGrContext, context.fGLContext); 158 return ContextInfo(context.fGrContext, context.fGLContext);
155 } 159 }
OLDNEW
« no previous file with comments | « include/gpu/vk/GrVkInterface.h ('k') | src/gpu/GrGpuFactory.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698