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

Side by Side Diff: dm/DM.cpp

Issue 1845923004: Rename enums in GrContextFactory to remove "GL" (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: working Created 4 years, 8 months 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
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 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::GLContextType contextType = gpuConfig->getContextT ype(); 817 GrContextFactory::ContextType contextType = gpuConfig->getContextTyp e();
818 GrContextFactory::GLContextOptions contextOptions = 818 GrContextFactory::ContextOptions contextOptions =
819 GrContextFactory::kNone_GLContextOptions; 819 GrContextFactory::kNone_ContextOptions;
820 if (gpuConfig->getUseNVPR()) { 820 if (gpuConfig->getUseNVPR()) {
821 contextOptions = static_cast<GrContextFactory::GLContextOptions> ( 821 contextOptions = static_cast<GrContextFactory::ContextOptions>(
822 contextOptions | GrContextFactory::kEnableNVPR_GLContextOpti ons); 822 contextOptions | GrContextFactory::kEnableNVPR_ContextOption s);
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::GLContextOptions> ( 826 contextOptions = static_cast<GrContextFactory::ContextOptions>(
827 contextOptions | GrContextFactory::kRequireSRGBSupport_GLCon textOptions); 827 contextOptions | GrContextFactory::kRequireSRGBSupport_Conte xtOptions);
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
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::GLContextType contextTypes[] = { 1445 GrContextFactory::ContextType contextTypes[] = {
1446 GrContextFactory::kNative_GLContextType, 1446 GrContextFactory::kNativeGL_ContextType,
1447 #if SK_ANGLE 1447 #if SK_ANGLE
1448 #ifdef SK_BUILD_FOR_WIN 1448 #ifdef SK_BUILD_FOR_WIN
1449 GrContextFactory::kANGLE_GLContextType, 1449 GrContextFactory::kANGLE_ContextType,
1450 #endif 1450 #endif
1451 GrContextFactory::kANGLE_GL_GLContextType, 1451 GrContextFactory::kANGLE_GL_ContextType,
1452 #endif 1452 #endif
1453 #if SK_COMMAND_BUFFER 1453 #if SK_COMMAND_BUFFER
1454 GrContextFactory::kCommandBuffer_GLContextType, 1454 GrContextFactory::kCommandBuffer_ContextType,
1455 #endif 1455 #endif
1456 #if SK_MESA 1456 #if SK_MESA
1457 GrContextFactory::kMESA_GLContextType, 1457 GrContextFactory::kMESA_ContextType,
1458 #endif 1458 #endif
1459 GrContextFactory::kNull_GLContextType, 1459 GrContextFactory::kNullGL_ContextType,
1460 GrContextFactory::kDebug_GLContextType, 1460 GrContextFactory::kDebugGL_ContextType,
1461 }; 1461 };
1462 static_assert(SK_ARRAY_COUNT(contextTypes) == GrContextFactory::kGLContextTy peCnt - 2, 1462 // Should have named all the context types except one of GL or GLES.
1463 "Skipping unexpected GLContextType for GPU tests"); 1463 static_assert(SK_ARRAY_COUNT(contextTypes) == GrContextFactory::kContextType Cnt - 1,
1464 "Skipping unexpected ContextType for GPU tests");
1464 1465
1465 for (auto& contextType : contextTypes) { 1466 for (auto& contextType : contextTypes) {
1466 int contextSelector = kNone_GPUTestContexts; 1467 int contextSelector = kNone_GPUTestContexts;
1467 if (GrContextFactory::IsRenderingGLContext(contextType)) { 1468 if (GrContextFactory::IsRenderingContext(contextType)) {
1468 contextSelector |= kAllRendering_GPUTestContexts; 1469 contextSelector |= kAllRendering_GPUTestContexts;
1469 } else if (contextType == GrContextFactory::kNative_GLContextType) { 1470 } else if (contextType == GrContextFactory::kNativeGL_ContextType) {
1470 contextSelector |= kNative_GPUTestContexts; 1471 contextSelector |= kNative_GPUTestContexts;
1471 } else if (contextType == GrContextFactory::kNull_GLContextType) { 1472 } else if (contextType == GrContextFactory::kNullGL_ContextType) {
1472 contextSelector |= kNull_GPUTestContexts; 1473 contextSelector |= kNull_GPUTestContexts;
1473 } else if (contextType == GrContextFactory::kDebug_GLContextType) { 1474 } else if (contextType == GrContextFactory::kDebugGL_ContextType) {
1474 contextSelector |= kDebug_GPUTestContexts; 1475 contextSelector |= kDebug_GPUTestContexts;
1475 } 1476 }
1476 if ((testContexts & contextSelector) == 0) { 1477 if ((testContexts & contextSelector) == 0) {
1477 continue; 1478 continue;
1478 } 1479 }
1479 GrContextFactory::ContextInfo context = factory->getContextInfo(contextT ype); 1480 GrContextFactory::ContextInfo context = factory->getContextInfo(contextT ype);
1480 if (context.fGrContext) { 1481 if (context.fGrContext) {
1481 call_test(test, reporter, context); 1482 call_test(test, reporter, context);
1482 } 1483 }
1483 context = factory->getContextInfo(contextType, 1484 context = factory->getContextInfo(contextType,
1484 GrContextFactory::kEnableNVPR_GLContex tOptions); 1485 GrContextFactory::kEnableNVPR_ContextO ptions);
1485 if (context.fGrContext) { 1486 if (context.fGrContext) {
1486 call_test(test, reporter, context); 1487 call_test(test, reporter, context);
1487 } 1488 }
1488 } 1489 }
1489 #endif 1490 #endif
1490 } 1491 }
1491 1492
1492 template 1493 template
1493 void RunWithGPUTestContexts<TestWithGrContext>(TestWithGrContext test, 1494 void RunWithGPUTestContexts<TestWithGrContext>(TestWithGrContext test,
1494 GPUTestContexts testContexts, 1495 GPUTestContexts testContexts,
1495 Reporter* reporter, 1496 Reporter* reporter,
1496 GrContextFactory* factory); 1497 GrContextFactory* factory);
1497 template 1498 template
1498 void RunWithGPUTestContexts<TestWithGrContextAndGLContext>(TestWithGrContextAndG LContext test, 1499 void RunWithGPUTestContexts<TestWithGrContextAndGLContext>(TestWithGrContextAndG LContext test,
1499 GPUTestContexts testC ontexts, 1500 GPUTestContexts testC ontexts,
1500 Reporter* reporter, 1501 Reporter* reporter,
1501 GrContextFactory* fac tory); 1502 GrContextFactory* fac tory);
1502 } // namespace skiatest 1503 } // namespace skiatest
1503 1504
1504 #if !defined(SK_BUILD_FOR_IOS) 1505 #if !defined(SK_BUILD_FOR_IOS)
1505 int main(int argc, char** argv) { 1506 int main(int argc, char** argv) {
1506 SkCommandLineFlags::Parse(argc, argv); 1507 SkCommandLineFlags::Parse(argc, argv);
1507 return dm_main(); 1508 return dm_main();
1508 } 1509 }
1509 #endif 1510 #endif
OLDNEW
« no previous file with comments | « bench/nanobench.cpp ('k') | dm/DMGpuSupport.h » ('j') | tools/gpu/GrContextFactory.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698