| 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 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 return FLAGS_gpu; | 807 return FLAGS_gpu; |
| 808 #else | 808 #else |
| 809 return false; | 809 return false; |
| 810 #endif | 810 #endif |
| 811 } | 811 } |
| 812 | 812 |
| 813 static Sink* create_sink(const SkCommandLineConfig* config) { | 813 static Sink* create_sink(const SkCommandLineConfig* config) { |
| 814 #if SK_SUPPORT_GPU | 814 #if SK_SUPPORT_GPU |
| 815 if (gpu_supported()) { | 815 if (gpu_supported()) { |
| 816 if (const SkCommandLineConfigGpu* gpuConfig = config->asConfigGpu()) { | 816 if (const SkCommandLineConfigGpu* gpuConfig = config->asConfigGpu()) { |
| 817 GrContextFactory::ContextType contextType = gpuConfig->getContextTyp
e(); | 817 GrContextFactory::GLContextType contextType = gpuConfig->getContextT
ype(); |
| 818 GrContextFactory::ContextOptions contextOptions = | 818 GrContextFactory::GLContextOptions contextOptions = |
| 819 GrContextFactory::kNone_ContextOptions; | 819 GrContextFactory::kNone_GLContextOptions; |
| 820 if (gpuConfig->getUseNVPR()) { | 820 if (gpuConfig->getUseNVPR()) { |
| 821 contextOptions = static_cast<GrContextFactory::ContextOptions>( | 821 contextOptions = static_cast<GrContextFactory::GLContextOptions>
( |
| 822 contextOptions | GrContextFactory::kEnableNVPR_ContextOption
s); | 822 contextOptions | GrContextFactory::kEnableNVPR_GLContextOpti
ons); |
| 823 } | 823 } |
| 824 if (kSRGB_SkColorProfileType == gpuConfig->getProfileType() || | 824 if (kSRGB_SkColorProfileType == gpuConfig->getProfileType() || |
| 825 kRGBA_F16_SkColorType == gpuConfig->getColorType()) { | 825 kRGBA_F16_SkColorType == gpuConfig->getColorType()) { |
| 826 contextOptions = static_cast<GrContextFactory::ContextOptions>( | 826 contextOptions = static_cast<GrContextFactory::GLContextOptions>
( |
| 827 contextOptions | GrContextFactory::kRequireSRGBSupport_Conte
xtOptions); | 827 contextOptions | GrContextFactory::kRequireSRGBSupport_GLCon
textOptions); |
| 828 } | 828 } |
| 829 GrContextFactory testFactory; | 829 GrContextFactory testFactory; |
| 830 if (!testFactory.get(contextType, contextOptions)) { | 830 if (!testFactory.get(contextType, contextOptions)) { |
| 831 info("WARNING: can not create GPU context for config '%s'. " | 831 info("WARNING: can not create GPU context for config '%s'. " |
| 832 "GM tests will be skipped.\n", gpuConfig->getTag().c_str())
; | 832 "GM tests will be skipped.\n", gpuConfig->getTag().c_str())
; |
| 833 return nullptr; | 833 return nullptr; |
| 834 } | 834 } |
| 835 return new GPUSink(contextType, contextOptions, gpuConfig->getSample
s(), | 835 return new GPUSink(contextType, contextOptions, gpuConfig->getSample
s(), |
| 836 gpuConfig->getUseDIText(), gpuConfig->getColorTyp
e(), | 836 gpuConfig->getUseDIText(), gpuConfig->getColorTyp
e(), |
| 837 gpuConfig->getProfileType(), FLAGS_gpu_threading)
; | 837 gpuConfig->getProfileType(), FLAGS_gpu_threading)
; |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1435 #endif | 1435 #endif |
| 1436 } // namespace | 1436 } // namespace |
| 1437 | 1437 |
| 1438 template<typename T> | 1438 template<typename T> |
| 1439 void RunWithGPUTestContexts(T test, GPUTestContexts testContexts, Reporter* repo
rter, | 1439 void RunWithGPUTestContexts(T test, GPUTestContexts testContexts, Reporter* repo
rter, |
| 1440 GrContextFactory* factory) { | 1440 GrContextFactory* factory) { |
| 1441 #if SK_SUPPORT_GPU | 1441 #if SK_SUPPORT_GPU |
| 1442 // Iterate over context types, except use "native" instead of explicitly try
ing OpenGL and | 1442 // Iterate over context types, except use "native" instead of explicitly try
ing OpenGL and |
| 1443 // OpenGL ES. Do not use GLES on desktop, since tests do not account for not
fixing | 1443 // OpenGL ES. Do not use GLES on desktop, since tests do not account for not
fixing |
| 1444 // http://skbug.com/2809 | 1444 // http://skbug.com/2809 |
| 1445 GrContextFactory::ContextType contextTypes[] = { | 1445 GrContextFactory::GLContextType contextTypes[] = { |
| 1446 GrContextFactory::kNativeGL_ContextType, | 1446 GrContextFactory::kNative_GLContextType, |
| 1447 #if SK_ANGLE | 1447 #if SK_ANGLE |
| 1448 #ifdef SK_BUILD_FOR_WIN | 1448 #ifdef SK_BUILD_FOR_WIN |
| 1449 GrContextFactory::kANGLE_ContextType, | 1449 GrContextFactory::kANGLE_GLContextType, |
| 1450 #endif | 1450 #endif |
| 1451 GrContextFactory::kANGLE_GL_ContextType, | 1451 GrContextFactory::kANGLE_GL_GLContextType, |
| 1452 #endif | 1452 #endif |
| 1453 #if SK_COMMAND_BUFFER | 1453 #if SK_COMMAND_BUFFER |
| 1454 GrContextFactory::kCommandBuffer_ContextType, | 1454 GrContextFactory::kCommandBuffer_GLContextType, |
| 1455 #endif | 1455 #endif |
| 1456 #if SK_MESA | 1456 #if SK_MESA |
| 1457 GrContextFactory::kMESA_ContextType, | 1457 GrContextFactory::kMESA_GLContextType, |
| 1458 #endif | 1458 #endif |
| 1459 GrContextFactory::kNullGL_ContextType, | 1459 GrContextFactory::kNull_GLContextType, |
| 1460 GrContextFactory::kDebugGL_ContextType, | 1460 GrContextFactory::kDebug_GLContextType, |
| 1461 }; | 1461 }; |
| 1462 // Should have named all the context types except one of GL or GLES. | 1462 static_assert(SK_ARRAY_COUNT(contextTypes) == GrContextFactory::kGLContextTy
peCnt - 2, |
| 1463 static_assert(SK_ARRAY_COUNT(contextTypes) == GrContextFactory::kContextType
Cnt - 1, | 1463 "Skipping unexpected GLContextType for GPU tests"); |
| 1464 "Skipping unexpected ContextType for GPU tests"); | |
| 1465 | 1464 |
| 1466 for (auto& contextType : contextTypes) { | 1465 for (auto& contextType : contextTypes) { |
| 1467 int contextSelector = kNone_GPUTestContexts; | 1466 int contextSelector = kNone_GPUTestContexts; |
| 1468 if (GrContextFactory::IsRenderingContext(contextType)) { | 1467 if (GrContextFactory::IsRenderingGLContext(contextType)) { |
| 1469 contextSelector |= kAllRendering_GPUTestContexts; | 1468 contextSelector |= kAllRendering_GPUTestContexts; |
| 1470 } else if (contextType == GrContextFactory::kNativeGL_ContextType) { | 1469 } else if (contextType == GrContextFactory::kNative_GLContextType) { |
| 1471 contextSelector |= kNative_GPUTestContexts; | 1470 contextSelector |= kNative_GPUTestContexts; |
| 1472 } else if (contextType == GrContextFactory::kNullGL_ContextType) { | 1471 } else if (contextType == GrContextFactory::kNull_GLContextType) { |
| 1473 contextSelector |= kNull_GPUTestContexts; | 1472 contextSelector |= kNull_GPUTestContexts; |
| 1474 } else if (contextType == GrContextFactory::kDebugGL_ContextType) { | 1473 } else if (contextType == GrContextFactory::kDebug_GLContextType) { |
| 1475 contextSelector |= kDebug_GPUTestContexts; | 1474 contextSelector |= kDebug_GPUTestContexts; |
| 1476 } | 1475 } |
| 1477 if ((testContexts & contextSelector) == 0) { | 1476 if ((testContexts & contextSelector) == 0) { |
| 1478 continue; | 1477 continue; |
| 1479 } | 1478 } |
| 1480 GrContextFactory::ContextInfo context = factory->getContextInfo(contextT
ype); | 1479 GrContextFactory::ContextInfo context = factory->getContextInfo(contextT
ype); |
| 1481 if (context.fGrContext) { | 1480 if (context.fGrContext) { |
| 1482 call_test(test, reporter, context); | 1481 call_test(test, reporter, context); |
| 1483 } | 1482 } |
| 1484 context = factory->getContextInfo(contextType, | 1483 context = factory->getContextInfo(contextType, |
| 1485 GrContextFactory::kEnableNVPR_ContextO
ptions); | 1484 GrContextFactory::kEnableNVPR_GLContex
tOptions); |
| 1486 if (context.fGrContext) { | 1485 if (context.fGrContext) { |
| 1487 call_test(test, reporter, context); | 1486 call_test(test, reporter, context); |
| 1488 } | 1487 } |
| 1489 } | 1488 } |
| 1490 #endif | 1489 #endif |
| 1491 } | 1490 } |
| 1492 | 1491 |
| 1493 template | 1492 template |
| 1494 void RunWithGPUTestContexts<TestWithGrContext>(TestWithGrContext test, | 1493 void RunWithGPUTestContexts<TestWithGrContext>(TestWithGrContext test, |
| 1495 GPUTestContexts testContexts, | 1494 GPUTestContexts testContexts, |
| 1496 Reporter* reporter, | 1495 Reporter* reporter, |
| 1497 GrContextFactory* factory); | 1496 GrContextFactory* factory); |
| 1498 template | 1497 template |
| 1499 void RunWithGPUTestContexts<TestWithGrContextAndGLContext>(TestWithGrContextAndG
LContext test, | 1498 void RunWithGPUTestContexts<TestWithGrContextAndGLContext>(TestWithGrContextAndG
LContext test, |
| 1500 GPUTestContexts testC
ontexts, | 1499 GPUTestContexts testC
ontexts, |
| 1501 Reporter* reporter, | 1500 Reporter* reporter, |
| 1502 GrContextFactory* fac
tory); | 1501 GrContextFactory* fac
tory); |
| 1503 } // namespace skiatest | 1502 } // namespace skiatest |
| 1504 | 1503 |
| 1505 #if !defined(SK_BUILD_FOR_IOS) | 1504 #if !defined(SK_BUILD_FOR_IOS) |
| 1506 int main(int argc, char** argv) { | 1505 int main(int argc, char** argv) { |
| 1507 SkCommandLineFlags::Parse(argc, argv); | 1506 SkCommandLineFlags::Parse(argc, argv); |
| 1508 return dm_main(); | 1507 return dm_main(); |
| 1509 } | 1508 } |
| 1510 #endif | 1509 #endif |
| OLD | NEW |