aboutsummaryrefslogtreecommitdiffhomepage
path: root/dm
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2016-04-06 14:02:39 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-06 14:02:39 -0700
commit758586c7f11a6b3529bd4a1c9b4e982a0d0b0582 (patch)
tree6a325080ce7cd2b6b1396eade7eaa3ff804b44e6 /dm
parent9e65f9399ea9d50dca723ca23c10ec4145b54abe (diff)
Make existing unit tests only run on GL contexts
Diffstat (limited to 'dm')
-rw-r--r--dm/DM.cpp69
1 files changed, 31 insertions, 38 deletions
diff --git a/dm/DM.cpp b/dm/DM.cpp
index 9611f493f1..93ebae19f4 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -1415,48 +1415,41 @@ int dm_main() {
// TODO: currently many GPU tests are declared outside SK_SUPPORT_GPU guards.
// Thus we export the empty RunWithGPUTestContexts when SK_SUPPORT_GPU=0.
namespace skiatest {
-void RunWithGPUTestContexts(GrContextTestFn* test, GPUTestContexts testContexts,
- Reporter* reporter, GrContextFactory* factory) {
+
#if SK_SUPPORT_GPU
- // Iterate over context types, except use "native" instead of explicitly trying OpenGL and
- // OpenGL ES. Do not use GLES on desktop, since tests do not account for not fixing
- // http://skbug.com/2809
- GrContextFactory::ContextType contextTypes[] = {
- GrContextFactory::kNativeGL_ContextType,
-#if SK_ANGLE
-#ifdef SK_BUILD_FOR_WIN
- GrContextFactory::kANGLE_ContextType,
-#endif
- GrContextFactory::kANGLE_GL_ContextType,
-#endif
-#if SK_COMMAND_BUFFER
- GrContextFactory::kCommandBuffer_ContextType,
-#endif
-#if SK_MESA
- GrContextFactory::kMESA_ContextType,
+bool IsGLContextType(sk_gpu_test::GrContextFactory::ContextType type) {
+ return kOpenGL_GrBackend == GrContextFactory::ContextTypeBackend(type);
+}
+bool IsRenderingGLContextType(sk_gpu_test::GrContextFactory::ContextType type) {
+ return IsGLContextType(type) && GrContextFactory::IsRenderingContext(type);
+}
+bool IsNullGLContextType(sk_gpu_test::GrContextFactory::ContextType type) {
+ return type == GrContextFactory::kNullGL_ContextType;
+}
+#else
+bool IsGLContextType(int) { return false; }
+bool IsRenderingGLContextType(int) { return false; }
+bool IsNullGLContextType(int) { return false; }
#endif
- GrContextFactory::kNullGL_ContextType,
- GrContextFactory::kDebugGL_ContextType,
- };
- // Should have named all the context types except one of GL or GLES.
- static_assert(SK_ARRAY_COUNT(contextTypes) == GrContextFactory::kContextTypeCnt - 1,
- "Skipping unexpected ContextType for GPU tests");
-
- for (auto& contextType : contextTypes) {
- int contextSelector = kNone_GPUTestContexts;
- if (GrContextFactory::IsRenderingContext(contextType)) {
- contextSelector |= kAllRendering_GPUTestContexts;
- } else if (contextType == GrContextFactory::kNativeGL_ContextType) {
- contextSelector |= kNative_GPUTestContexts;
- } else if (contextType == GrContextFactory::kNullGL_ContextType) {
- contextSelector |= kNull_GPUTestContexts;
- } else if (contextType == GrContextFactory::kDebugGL_ContextType) {
- contextSelector |= kDebug_GPUTestContexts;
- }
- if ((testContexts & contextSelector) == 0) {
+
+void RunWithGPUTestContexts(GrContextTestFn* test, GrContextTypeFilterFn* contextTypeFilter,
+ Reporter* reporter, GrContextFactory* factory) {
+#if SK_SUPPORT_GPU
+
+ for (int typeInt = 0; typeInt < GrContextFactory::kContextTypeCnt; ++typeInt) {
+ GrContextFactory::ContextType contextType = (GrContextFactory::ContextType) typeInt;
+ ContextInfo ctxInfo = factory->getContextInfo(contextType);
+ if (!(*contextTypeFilter)(contextType)) {
continue;
}
- ContextInfo ctxInfo = factory->getContextInfo(contextType);
+ // Use "native" instead of explicitly trying OpenGL and OpenGL ES. Do not use GLES on,
+ // desktop since tests do not account for not fixing http://skbug.com/2809
+ if (contextType == GrContextFactory::kGL_ContextType ||
+ contextType == GrContextFactory::kGLES_ContextType) {
+ if (contextType != GrContextFactory::kNativeGL_ContextType) {
+ continue;
+ }
+ }
if (ctxInfo.fGrContext) {
(*test)(reporter, ctxInfo);
}