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

Side by Side Diff: dm/DM.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 | « no previous file | src/gpu/GrContextFactory.h » ('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 * Copyright 2013 Google Inc. 2 * Copyright 2013 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 #include "CrashHandler.h" 8 #include "CrashHandler.h"
9 #include "DMJsonWriter.h" 9 #include "DMJsonWriter.h"
10 #include "DMSrcSink.h" 10 #include "DMSrcSink.h"
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 if (gPending > 0) { 1137 if (gPending > 0) {
1138 SkDebugf("Hrm, we didn't seem to run everything we intended to! Please file a bug.\n"); 1138 SkDebugf("Hrm, we didn't seem to run everything we intended to! Please file a bug.\n");
1139 return 1; 1139 return 1;
1140 } 1140 }
1141 #ifdef SK_PDF_IMAGE_STATS 1141 #ifdef SK_PDF_IMAGE_STATS
1142 SkPDFImageDumpStats(); 1142 SkPDFImageDumpStats();
1143 #endif // SK_PDF_IMAGE_STATS 1143 #endif // SK_PDF_IMAGE_STATS
1144 return 0; 1144 return 0;
1145 } 1145 }
1146 1146
1147 // TODO: currently many GPU tests are declared outside SK_SUPPORT_GPU guards.
1148 // Thus we export the empty RunWithGPUTestContexts when SK_SUPPORT_GPU=0.
1149 namespace skiatest {
1150 namespace {
1151 typedef void(*TestWithGrContext)(skiatest::Reporter*, GrContext*);
1152 typedef void(*TestWithGrContextAndGLContext)(skiatest::Reporter*, GrContext*, Sk GLContext*);
1153 #if SK_SUPPORT_GPU
1154 template<typename T>
1155 void call_test(T test, skiatest::Reporter* reporter, GrContextFactory::ContextIn fo* context);
1156 template<>
1157 void call_test(TestWithGrContext test, skiatest::Reporter* reporter,
1158 GrContextFactory::ContextInfo* context) {
1159 test(reporter, context->fGrContext);
1160 }
1161 template<>
1162 void call_test(TestWithGrContextAndGLContext test, skiatest::Reporter* reporter,
1163 GrContextFactory::ContextInfo* context) {
1164 test(reporter, context->fGrContext, context->fGLContext);
1165 }
1166 #endif
1167 } // namespace
1168
1169
1170 template<typename T>
1171 void RunWithGPUTestContexts(T test, GPUTestContexts testContexts, Reporter* repo rter,
1172 GrContextFactory* factory) {
1173 #if SK_SUPPORT_GPU
1174 for (int i = 0; i < GrContextFactory::kGLContextTypeCnt; ++i) {
1175 GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContext Type) i;
1176 int contextSelector = kNone_GPUTestContexts;
1177 if (GrContextFactory::IsRenderingGLContext(glCtxType)) {
1178 contextSelector |= kAllRendering_GPUTestContexts;
1179 }
1180 if (glCtxType == GrContextFactory::kNative_GLContextType) {
1181 contextSelector |= kNative_GPUTestContexts;
1182 }
1183 if (glCtxType == GrContextFactory::kNull_GLContextType) {
1184 contextSelector |= kNull_GPUTestContexts;
1185 }
1186 if ((testContexts & contextSelector) == 0) {
1187 continue;
1188 }
1189 if (GrContextFactory::ContextInfo* context = factory->getContextInfo(glC txType)) {
1190 call_test(test, reporter, context);
1191 }
1192 }
1193 #endif
1194 }
1195
1196 template
1197 void RunWithGPUTestContexts<TestWithGrContext>(TestWithGrContext test,
1198 GPUTestContexts testContexts,
1199 Reporter* reporter,
1200 GrContextFactory* factory);
1201 template
1202 void RunWithGPUTestContexts<TestWithGrContextAndGLContext>(TestWithGrContextAndG LContext test,
1203 GPUTestContexts testC ontexts,
1204 Reporter* reporter,
1205 GrContextFactory* fac tory);
1206 } // namespace skiatest
1207
1147 #if !defined(SK_BUILD_FOR_IOS) 1208 #if !defined(SK_BUILD_FOR_IOS)
1148 int main(int argc, char** argv) { 1209 int main(int argc, char** argv) {
1149 SkCommandLineFlags::Parse(argc, argv); 1210 SkCommandLineFlags::Parse(argc, argv);
1150 return dm_main(); 1211 return dm_main();
1151 } 1212 }
1152 #endif 1213 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrContextFactory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698