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

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: rebase 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
« no previous file with comments | « bench/nanobench.cpp ('k') | dm/DMGpuSupport.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
1434 #endif 1434 #endif
1435 } // namespace 1435 } // namespace
1436 1436
1437 template<typename T> 1437 template<typename T>
1438 void RunWithGPUTestContexts(T test, GPUTestContexts testContexts, Reporter* repo rter, 1438 void RunWithGPUTestContexts(T test, GPUTestContexts testContexts, Reporter* repo rter,
1439 GrContextFactory* factory) { 1439 GrContextFactory* factory) {
1440 #if SK_SUPPORT_GPU 1440 #if SK_SUPPORT_GPU
1441 // Iterate over context types, except use "native" instead of explicitly try ing OpenGL and 1441 // Iterate over context types, except use "native" instead of explicitly try ing OpenGL and
1442 // OpenGL ES. Do not use GLES on desktop, since tests do not account for not fixing 1442 // OpenGL ES. Do not use GLES on desktop, since tests do not account for not fixing
1443 // http://skbug.com/2809 1443 // http://skbug.com/2809
1444 GrContextFactory::GLContextType contextTypes[] = { 1444 GrContextFactory::ContextType contextTypes[] = {
1445 GrContextFactory::kNative_GLContextType, 1445 GrContextFactory::kNativeGL_ContextType,
1446 #if SK_ANGLE 1446 #if SK_ANGLE
1447 #ifdef SK_BUILD_FOR_WIN 1447 #ifdef SK_BUILD_FOR_WIN
1448 GrContextFactory::kANGLE_GLContextType, 1448 GrContextFactory::kANGLE_ContextType,
1449 #endif 1449 #endif
1450 GrContextFactory::kANGLE_GL_GLContextType, 1450 GrContextFactory::kANGLE_GL_ContextType,
1451 #endif 1451 #endif
1452 #if SK_COMMAND_BUFFER 1452 #if SK_COMMAND_BUFFER
1453 GrContextFactory::kCommandBuffer_GLContextType, 1453 GrContextFactory::kCommandBuffer_ContextType,
1454 #endif 1454 #endif
1455 #if SK_MESA 1455 #if SK_MESA
1456 GrContextFactory::kMESA_GLContextType, 1456 GrContextFactory::kMESA_ContextType,
1457 #endif 1457 #endif
1458 GrContextFactory::kNull_GLContextType, 1458 GrContextFactory::kNullGL_ContextType,
1459 GrContextFactory::kDebug_GLContextType, 1459 GrContextFactory::kDebugGL_ContextType,
1460 }; 1460 };
1461 static_assert(SK_ARRAY_COUNT(contextTypes) == GrContextFactory::kGLContextTy peCnt - 2, 1461 // Should have named all the context types except one of GL or GLES.
1462 "Skipping unexpected GLContextType for GPU tests"); 1462 static_assert(SK_ARRAY_COUNT(contextTypes) == GrContextFactory::kContextType Cnt - 1,
1463 "Skipping unexpected ContextType for GPU tests");
1463 1464
1464 for (auto& contextType : contextTypes) { 1465 for (auto& contextType : contextTypes) {
1465 int contextSelector = kNone_GPUTestContexts; 1466 int contextSelector = kNone_GPUTestContexts;
1466 if (GrContextFactory::IsRenderingGLContext(contextType)) { 1467 if (GrContextFactory::IsRenderingContext(contextType)) {
1467 contextSelector |= kAllRendering_GPUTestContexts; 1468 contextSelector |= kAllRendering_GPUTestContexts;
1468 } else if (contextType == GrContextFactory::kNative_GLContextType) { 1469 } else if (contextType == GrContextFactory::kNativeGL_ContextType) {
1469 contextSelector |= kNative_GPUTestContexts; 1470 contextSelector |= kNative_GPUTestContexts;
1470 } else if (contextType == GrContextFactory::kNull_GLContextType) { 1471 } else if (contextType == GrContextFactory::kNullGL_ContextType) {
1471 contextSelector |= kNull_GPUTestContexts; 1472 contextSelector |= kNull_GPUTestContexts;
1472 } else if (contextType == GrContextFactory::kDebug_GLContextType) { 1473 } else if (contextType == GrContextFactory::kDebugGL_ContextType) {
1473 contextSelector |= kDebug_GPUTestContexts; 1474 contextSelector |= kDebug_GPUTestContexts;
1474 } 1475 }
1475 if ((testContexts & contextSelector) == 0) { 1476 if ((testContexts & contextSelector) == 0) {
1476 continue; 1477 continue;
1477 } 1478 }
1478 GrContextFactory::ContextInfo context = factory->getContextInfo(contextT ype); 1479 GrContextFactory::ContextInfo context = factory->getContextInfo(contextT ype);
1479 if (context.fGrContext) { 1480 if (context.fGrContext) {
1480 call_test(test, reporter, context); 1481 call_test(test, reporter, context);
1481 } 1482 }
1482 context = factory->getContextInfo(contextType, 1483 context = factory->getContextInfo(contextType,
1483 GrContextFactory::kEnableNVPR_GLContex tOptions); 1484 GrContextFactory::kEnableNVPR_ContextO ptions);
1484 if (context.fGrContext) { 1485 if (context.fGrContext) {
1485 call_test(test, reporter, context); 1486 call_test(test, reporter, context);
1486 } 1487 }
1487 } 1488 }
1488 #endif 1489 #endif
1489 } 1490 }
1490 1491
1491 template 1492 template
1492 void RunWithGPUTestContexts<TestWithGrContext>(TestWithGrContext test, 1493 void RunWithGPUTestContexts<TestWithGrContext>(TestWithGrContext test,
1493 GPUTestContexts testContexts, 1494 GPUTestContexts testContexts,
1494 Reporter* reporter, 1495 Reporter* reporter,
1495 GrContextFactory* factory); 1496 GrContextFactory* factory);
1496 template 1497 template
1497 void RunWithGPUTestContexts<TestWithGrContextAndGLContext>(TestWithGrContextAndG LContext test, 1498 void RunWithGPUTestContexts<TestWithGrContextAndGLContext>(TestWithGrContextAndG LContext test,
1498 GPUTestContexts testC ontexts, 1499 GPUTestContexts testC ontexts,
1499 Reporter* reporter, 1500 Reporter* reporter,
1500 GrContextFactory* fac tory); 1501 GrContextFactory* fac tory);
1501 } // namespace skiatest 1502 } // namespace skiatest
1502 1503
1503 #if !defined(SK_BUILD_FOR_IOS) 1504 #if !defined(SK_BUILD_FOR_IOS)
1504 int main(int argc, char** argv) { 1505 int main(int argc, char** argv) {
1505 SkCommandLineFlags::Parse(argc, argv); 1506 SkCommandLineFlags::Parse(argc, argv);
1506 return dm_main(); 1507 return dm_main();
1507 } 1508 }
1508 #endif 1509 #endif
OLDNEW
« no previous file with comments | « bench/nanobench.cpp ('k') | dm/DMGpuSupport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698