| OLD | NEW |
| 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 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1140 } | 1140 } |
| 1141 | 1141 |
| 1142 // TODO: currently many GPU tests are declared outside SK_SUPPORT_GPU guards. | 1142 // TODO: currently many GPU tests are declared outside SK_SUPPORT_GPU guards. |
| 1143 // Thus we export the empty RunWithGPUTestContexts when SK_SUPPORT_GPU=0. | 1143 // Thus we export the empty RunWithGPUTestContexts when SK_SUPPORT_GPU=0. |
| 1144 namespace skiatest { | 1144 namespace skiatest { |
| 1145 namespace { | 1145 namespace { |
| 1146 typedef void(*TestWithGrContext)(skiatest::Reporter*, GrContext*); | 1146 typedef void(*TestWithGrContext)(skiatest::Reporter*, GrContext*); |
| 1147 typedef void(*TestWithGrContextAndGLContext)(skiatest::Reporter*, GrContext*, Sk
GLContext*); | 1147 typedef void(*TestWithGrContextAndGLContext)(skiatest::Reporter*, GrContext*, Sk
GLContext*); |
| 1148 #if SK_SUPPORT_GPU | 1148 #if SK_SUPPORT_GPU |
| 1149 template<typename T> | 1149 template<typename T> |
| 1150 void call_test(T test, skiatest::Reporter* reporter, const GrContextFactory::Con
textInfo& context); | 1150 void call_test(T test, skiatest::Reporter* reporter, GrContextFactory::ContextIn
fo* context); |
| 1151 template<> | 1151 template<> |
| 1152 void call_test(TestWithGrContext test, skiatest::Reporter* reporter, | 1152 void call_test(TestWithGrContext test, skiatest::Reporter* reporter, |
| 1153 const GrContextFactory::ContextInfo& context) { | 1153 GrContextFactory::ContextInfo* context) { |
| 1154 test(reporter, context.fGrContext); | 1154 test(reporter, context->fGrContext); |
| 1155 } | 1155 } |
| 1156 template<> | 1156 template<> |
| 1157 void call_test(TestWithGrContextAndGLContext test, skiatest::Reporter* reporter, | 1157 void call_test(TestWithGrContextAndGLContext test, skiatest::Reporter* reporter, |
| 1158 const GrContextFactory::ContextInfo& context) { | 1158 GrContextFactory::ContextInfo* context) { |
| 1159 test(reporter, context.fGrContext, context.fGLContext); | 1159 test(reporter, context->fGrContext, context->fGLContext); |
| 1160 } | 1160 } |
| 1161 #endif | 1161 #endif |
| 1162 } // namespace | 1162 } // namespace |
| 1163 | 1163 |
| 1164 template<typename T> | 1164 template<typename T> |
| 1165 void RunWithGPUTestContexts(T test, GPUTestContexts testContexts, Reporter* repo
rter, | 1165 void RunWithGPUTestContexts(T test, GPUTestContexts testContexts, Reporter* repo
rter, |
| 1166 GrContextFactory* factory) { | 1166 GrContextFactory* factory) { |
| 1167 #if SK_SUPPORT_GPU | 1167 #if SK_SUPPORT_GPU |
| 1168 // Iterate over context types, except use "native" instead of explicitly try
ing OpenGL and | 1168 // Iterate over context types, except use "native" instead of explicitly try
ing OpenGL and |
| 1169 // OpenGL ES. Do not use GLES on desktop, since tests do not account for not
fixing | 1169 // OpenGL ES. Do not use GLES on desktop, since tests do not account for not
fixing |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1195 } else if (contextType == GrContextFactory::kNative_GLContextType) { | 1195 } else if (contextType == GrContextFactory::kNative_GLContextType) { |
| 1196 contextSelector |= kNative_GPUTestContexts; | 1196 contextSelector |= kNative_GPUTestContexts; |
| 1197 } else if (contextType == GrContextFactory::kNull_GLContextType) { | 1197 } else if (contextType == GrContextFactory::kNull_GLContextType) { |
| 1198 contextSelector |= kNull_GPUTestContexts; | 1198 contextSelector |= kNull_GPUTestContexts; |
| 1199 } else if (contextType == GrContextFactory::kDebug_GLContextType) { | 1199 } else if (contextType == GrContextFactory::kDebug_GLContextType) { |
| 1200 contextSelector |= kDebug_GPUTestContexts; | 1200 contextSelector |= kDebug_GPUTestContexts; |
| 1201 } | 1201 } |
| 1202 if ((testContexts & contextSelector) == 0) { | 1202 if ((testContexts & contextSelector) == 0) { |
| 1203 continue; | 1203 continue; |
| 1204 } | 1204 } |
| 1205 GrContextFactory::ContextInfo context = factory->getContextInfo(contextT
ype); | 1205 if (GrContextFactory::ContextInfo* context = factory->getContextInfo(con
textType)) { |
| 1206 if (context.fGrContext) { | |
| 1207 call_test(test, reporter, context); | 1206 call_test(test, reporter, context); |
| 1208 } | 1207 } |
| 1209 context = factory->getContextInfo(contextType, | 1208 if (GrContextFactory::ContextInfo* context = |
| 1210 GrContextFactory::kEnableNVPR_GLContex
tOptions); | 1209 factory->getContextInfo(contextType, GrContextFactory::kEnableNVPR_G
LContextOptions)) { |
| 1211 if (context.fGrContext) { | |
| 1212 call_test(test, reporter, context); | 1210 call_test(test, reporter, context); |
| 1213 } | 1211 } |
| 1214 } | 1212 } |
| 1215 #endif | 1213 #endif |
| 1216 } | 1214 } |
| 1217 | 1215 |
| 1218 template | 1216 template |
| 1219 void RunWithGPUTestContexts<TestWithGrContext>(TestWithGrContext test, | 1217 void RunWithGPUTestContexts<TestWithGrContext>(TestWithGrContext test, |
| 1220 GPUTestContexts testContexts, | 1218 GPUTestContexts testContexts, |
| 1221 Reporter* reporter, | 1219 Reporter* reporter, |
| 1222 GrContextFactory* factory); | 1220 GrContextFactory* factory); |
| 1223 template | 1221 template |
| 1224 void RunWithGPUTestContexts<TestWithGrContextAndGLContext>(TestWithGrContextAndG
LContext test, | 1222 void RunWithGPUTestContexts<TestWithGrContextAndGLContext>(TestWithGrContextAndG
LContext test, |
| 1225 GPUTestContexts testC
ontexts, | 1223 GPUTestContexts testC
ontexts, |
| 1226 Reporter* reporter, | 1224 Reporter* reporter, |
| 1227 GrContextFactory* fac
tory); | 1225 GrContextFactory* fac
tory); |
| 1228 } // namespace skiatest | 1226 } // namespace skiatest |
| 1229 | 1227 |
| 1230 #if !defined(SK_BUILD_FOR_IOS) | 1228 #if !defined(SK_BUILD_FOR_IOS) |
| 1231 int main(int argc, char** argv) { | 1229 int main(int argc, char** argv) { |
| 1232 SkCommandLineFlags::Parse(argc, argv); | 1230 SkCommandLineFlags::Parse(argc, argv); |
| 1233 return dm_main(); | 1231 return dm_main(); |
| 1234 } | 1232 } |
| 1235 #endif | 1233 #endif |
| OLD | NEW |