Index: dm/DM.cpp |
diff --git a/dm/DM.cpp b/dm/DM.cpp |
index fb9699c049478d1a052fb269dedcdd73a8af77bc..c191ac9c2ed895aa4b0364f3b0c7a7a0bd88e712 100644 |
--- a/dm/DM.cpp |
+++ b/dm/DM.cpp |
@@ -1147,6 +1147,34 @@ int dm_main() { |
return 0; |
} |
+void skiatest::RunWithGPUTestContexts(void(*test)(skiatest::Reporter*, GrContext*), |
+ skiatest::GPUTestContexts testContexts, |
+ skiatest::Reporter* reporter, |
+ GrContextFactory* factory) { |
+#if SK_SUPPORT_GPU |
+ for (int i = 0; i < GrContextFactory::kGLContextTypeCnt; ++i) { |
+ GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContextType) i; |
+ int contextSelector = skiatest::kNone_GPUTestContexts; |
+ if (GrContextFactory::IsRenderingGLContext(glCtxType)) { |
+ contextSelector |= kAllRendering_GPUTestContexts; |
+ } |
+ if (glCtxType == GrContextFactory::kNative_GLContextType) { |
+ contextSelector |= kNative_GPUTestContexts; |
+ } |
+ if (glCtxType == GrContextFactory::kNull_GLContextType) { |
+ contextSelector |= kNull_GPUTestContexts; |
+ } |
+ if ((testContexts & contextSelector) == 0) { |
+ continue; |
+ } |
+ if (GrContext* context = factory->get(glCtxType)) { |
+ test(reporter, context); |
bsalomon
2015/11/17 14:49:36
I'm in the process of adding tests that would want
|
+ } |
+ } |
+#endif |
+} |
+ |
+ |
#if !defined(SK_BUILD_FOR_IOS) |
int main(int argc, char** argv) { |
SkCommandLineFlags::Parse(argc, argv); |