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

Side by Side Diff: tools/gpu/GrContextFactory.h

Issue 1971613003: Make unit tests use generic testcontext rather than glcontext (Closed) Base URL: https://chromium.googlesource.com/skia.git@vknano
Patch Set: run deferredimage test on vk Created 4 years, 7 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 | « tests/ImageTest.cpp ('k') | no next file » | 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 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrContextFactory_DEFINED 8 #ifndef GrContextFactory_DEFINED
9 #define GrContextFactory_DEFINED 9 #define GrContextFactory_DEFINED
10 10
(...skipping 10 matching lines...) Expand all
21 21
22 class ContextInfo { 22 class ContextInfo {
23 public: 23 public:
24 ContextInfo() = default; 24 ContextInfo() = default;
25 ContextInfo& operator=(const ContextInfo&) = default; 25 ContextInfo& operator=(const ContextInfo&) = default;
26 26
27 GrBackend backend() const { return fBackend; }; 27 GrBackend backend() const { return fBackend; };
28 28
29 GrContext* grContext() const { return fGrContext; } 29 GrContext* grContext() const { return fGrContext; }
30 30
31 TestContext* testContext() const { return fTestContext; }
32
31 GLTestContext* glContext() const { 33 GLTestContext* glContext() const {
32 SkASSERT(kOpenGL_GrBackend == fBackend); 34 SkASSERT(kOpenGL_GrBackend == fBackend);
33 return static_cast<GLTestContext*>(fTestContext); 35 return static_cast<GLTestContext*>(fTestContext);
34 } 36 }
35 37
36 #ifdef SK_VULKAN 38 #ifdef SK_VULKAN
37 VkTestContext* vkContext() const { 39 VkTestContext* vkContext() const {
38 SkASSERT(kVulkan_GrBackend == fBackend); 40 SkASSERT(kVulkan_GrBackend == fBackend);
39 return static_cast<VkTestContext*>(fTestContext); 41 return static_cast<VkTestContext*>(fTestContext);
40 } 42 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 /** 88 /**
87 * Options for GL context creation. For historical and testing reasons the o ptions will default 89 * Options for GL context creation. For historical and testing reasons the o ptions will default
88 * to not using GL_NV_path_rendering extension even when the driver support s it. 90 * to not using GL_NV_path_rendering extension even when the driver support s it.
89 */ 91 */
90 enum ContextOptions { 92 enum ContextOptions {
91 kNone_ContextOptions = 0x0, 93 kNone_ContextOptions = 0x0,
92 kEnableNVPR_ContextOptions = 0x1, 94 kEnableNVPR_ContextOptions = 0x1,
93 kRequireSRGBSupport_ContextOptions = 0x2, 95 kRequireSRGBSupport_ContextOptions = 0x2,
94 }; 96 };
95 97
98 static ContextType NativeContextTypeForBackend(GrBackend backend) {
99 switch (backend) {
100 case kOpenGL_GrBackend:
101 return kNativeGL_ContextType;
102 case kVulkan_GrBackend:
103 return kVulkan_ContextType;
104 default:
105 SkFAIL("Unknown backend");
106 return kNullGL_ContextType;
107 }
108 }
109
96 static bool IsRenderingContext(ContextType type) { 110 static bool IsRenderingContext(ContextType type) {
97 switch (type) { 111 switch (type) {
98 case kNullGL_ContextType: 112 case kNullGL_ContextType:
99 case kDebugGL_ContextType: 113 case kDebugGL_ContextType:
100 return false; 114 return false;
101 default: 115 default:
102 return true; 116 return true;
103 } 117 }
104 } 118 }
105 119
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 TestContext* fTestContext; 179 TestContext* fTestContext;
166 GrContext* fGrContext; 180 GrContext* fGrContext;
167 bool fAbandoned; 181 bool fAbandoned;
168 }; 182 };
169 SkTArray<Context, true> fContexts; 183 SkTArray<Context, true> fContexts;
170 SkAutoTDelete<GLTestContext> fSentinelGLContext; 184 SkAutoTDelete<GLTestContext> fSentinelGLContext;
171 const GrContextOptions fGlobalOptions; 185 const GrContextOptions fGlobalOptions;
172 }; 186 };
173 } // namespace sk_gpu_test 187 } // namespace sk_gpu_test
174 #endif 188 #endif
OLDNEW
« no previous file with comments | « tests/ImageTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698