diff options
author | bsalomon <bsalomon@google.com> | 2016-04-05 11:06:27 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-05 11:06:27 -0700 |
commit | 85b4b53e78dcdeae2a51935ca5e214b0f1a06492 (patch) | |
tree | 909cb8ef0862154b2e6bc6c66e0e40cd5d018bae /tests | |
parent | 3a15fd4a9a019dc781368c26499ff899c2f03e3f (diff) |
Rename enums in GrContextFactory to remove "GL"
Also, remove kNative as a separate context type and instead make it an alias for kGL or kGLES based on OS.
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1845923004
Committed: https://skia.googlesource.com/skia/+/2d9c6f81353597aebf5934547e5cba7a872196fb
Review URL: https://codereview.chromium.org/1845923004
Diffstat (limited to 'tests')
-rw-r--r-- | tests/GrContextAbandonTest.cpp | 8 | ||||
-rw-r--r-- | tests/GrContextFactoryTest.cpp | 32 | ||||
-rw-r--r-- | tests/GrPorterDuffTest.cpp | 2 | ||||
-rw-r--r-- | tests/ImageTest.cpp | 4 | ||||
-rw-r--r-- | tests/SkpSkGrTest.cpp | 6 | ||||
-rw-r--r-- | tests/TestConfigParsing.cpp | 25 | ||||
-rw-r--r-- | tests/VkClearTests.cpp | 8 | ||||
-rw-r--r-- | tests/VkUploadPixelsTests.cpp | 8 | ||||
-rwxr-xr-x | tests/VkWrapTests.cpp | 8 |
9 files changed, 48 insertions, 53 deletions
diff --git a/tests/GrContextAbandonTest.cpp b/tests/GrContextAbandonTest.cpp index c62973f4da..e1ad8f7de7 100644 --- a/tests/GrContextAbandonTest.cpp +++ b/tests/GrContextAbandonTest.cpp @@ -16,10 +16,10 @@ using sk_gpu_test::GrContextFactory; DEF_GPUTEST(GrContext_abandonContext, reporter, /*factory*/) { for (int testType = 0; testType < 6; ++testType) { - for (int i = 0; i < GrContextFactory::kGLContextTypeCnt; ++i) { - GrContextFactory testFactory; - GrContextFactory::GLContextType ctxType = (GrContextFactory::GLContextType) i; - GrContextFactory::ContextInfo info = testFactory.getContextInfo(ctxType); + for (int i = 0; i < GrContextFactory::kContextTypeCnt; ++i) { + GrContextFactory testFactory; + GrContextFactory::ContextType ctxType = (GrContextFactory::ContextType) i; + GrContextFactory::ContextInfo info = testFactory.getContextInfo(ctxType); if (GrContext* context = info.fGrContext) { switch (testType) { case 0: diff --git a/tests/GrContextFactoryTest.cpp b/tests/GrContextFactoryTest.cpp index bd1888380a..6e51b2fda3 100644 --- a/tests/GrContextFactoryTest.cpp +++ b/tests/GrContextFactoryTest.cpp @@ -20,10 +20,10 @@ DEF_GPUTEST(GrContextFactory_NVPRContextOptionHasPathRenderingSupport, reporter, // or the context creation fails. GrContextFactory testFactory; // Test that if NVPR is possible, caps are in sync. - for (int i = 0; i < GrContextFactory::kGLContextTypeCnt; ++i) { - GrContextFactory::GLContextType glCtxType = static_cast<GrContextFactory::GLContextType>(i); - GrContext* context = testFactory.get(glCtxType, - GrContextFactory::kEnableNVPR_GLContextOptions); + for (int i = 0; i < GrContextFactory::kContextTypeCnt; ++i) { + GrContextFactory::ContextType ctxType = static_cast<GrContextFactory::ContextType>(i); + GrContext* context = testFactory.get(ctxType, + GrContextFactory::kEnableNVPR_ContextOptions); if (!context) { continue; } @@ -37,9 +37,9 @@ DEF_GPUTEST(GrContextFactory_NoPathRenderingUnlessNVPRRequested, reporter, /*fac // Test that if NVPR is not requested, the context never has path rendering support. GrContextFactory testFactory; - for (int i = 0; i <= GrContextFactory::kLastGLContextType; ++i) { - GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContextType)i; - GrContext* context = testFactory.get(glCtxType); + for (int i = 0; i <= GrContextFactory::kLastContextType; ++i) { + GrContextFactory::ContextType ctxType = (GrContextFactory::ContextType)i; + GrContext* context = testFactory.get(ctxType); if (context) { REPORTER_ASSERT( reporter, @@ -54,16 +54,15 @@ DEF_GPUTEST(GrContextFactory_RequiredSRGBSupport, reporter, /*factory*/) { // created without that flag would not have had sRGB support. GrContextFactory testFactory; // Test that if sRGB is requested, caps are in sync. - for (int i = 0; i < GrContextFactory::kGLContextTypeCnt; ++i) { - GrContextFactory::GLContextType glCtxType = static_cast<GrContextFactory::GLContextType>(i); + for (int i = 0; i < GrContextFactory::kContextTypeCnt; ++i) { + GrContextFactory::ContextType ctxType = static_cast<GrContextFactory::ContextType>(i); GrContext* context = - testFactory.get(glCtxType, - GrContextFactory::kRequireSRGBSupport_GLContextOptions); + testFactory.get(ctxType, GrContextFactory::kRequireSRGBSupport_ContextOptions); if (context) { REPORTER_ASSERT(reporter, context->caps()->srgbSupport()); } else { - context = testFactory.get(glCtxType); + context = testFactory.get(ctxType); if (context) { REPORTER_ASSERT(reporter, !context->caps()->srgbSupport()); } @@ -73,10 +72,9 @@ DEF_GPUTEST(GrContextFactory_RequiredSRGBSupport, reporter, /*factory*/) { DEF_GPUTEST(GrContextFactory_abandon, reporter, /*factory*/) { GrContextFactory testFactory; - for (int i = 0; i < GrContextFactory::kGLContextTypeCnt; ++i) { - GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContextType) i; - GrContextFactory::ContextInfo info1 = - testFactory.getContextInfo(glCtxType); + for (int i = 0; i < GrContextFactory::kContextTypeCnt; ++i) { + GrContextFactory::ContextType ctxType = (GrContextFactory::ContextType) i; + GrContextFactory::ContextInfo info1 = testFactory.getContextInfo(ctxType); if (!info1.fGrContext) { continue; } @@ -87,7 +85,7 @@ DEF_GPUTEST(GrContextFactory_abandon, reporter, /*factory*/) { // Test that we get different context after abandon. GrContextFactory::ContextInfo info2 = - testFactory.getContextInfo(glCtxType); + testFactory.getContextInfo(ctxType); REPORTER_ASSERT(reporter, info2.fGrContext); REPORTER_ASSERT(reporter, info2.fGLContext); REPORTER_ASSERT(reporter, info1.fGrContext != info2.fGrContext); diff --git a/tests/GrPorterDuffTest.cpp b/tests/GrPorterDuffTest.cpp index 566ec12f5d..b0377715b4 100644 --- a/tests/GrPorterDuffTest.cpp +++ b/tests/GrPorterDuffTest.cpp @@ -1148,7 +1148,7 @@ DEF_GPUTEST(PorterDuffNoDualSourceBlending, reporter, /*factory*/) { GrContextOptions opts; opts.fSuppressDualSourceBlending = true; sk_gpu_test::GrContextFactory mockFactory(opts); - GrContext* ctx = mockFactory.get(sk_gpu_test::GrContextFactory::kNull_GLContextType); + GrContext* ctx = mockFactory.get(sk_gpu_test::GrContextFactory::kNullGL_ContextType); if (!ctx) { SkFAIL("Failed to create null context without ARB_blend_func_extended."); return; diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp index 96bc48e711..a1c522b7b7 100644 --- a/tests/ImageTest.cpp +++ b/tests/ImageTest.cpp @@ -407,7 +407,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkImage_Gpu2Cpu, reporter, context) { DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkImage_newTextureImage, reporter, context, glContext) { GrContextFactory otherFactory; GrContextFactory::ContextInfo otherContextInfo = - otherFactory.getContextInfo(GrContextFactory::kNative_GLContextType); + otherFactory.getContextInfo(GrContextFactory::kNativeGL_ContextType); glContext->makeCurrent(); std::function<sk_sp<SkImage>()> imageFactories[] = { @@ -825,7 +825,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredTextureImage, reporter, context, glCo GrContextFactory otherFactory; GrContextFactory::ContextInfo otherContextInfo = - otherFactory.getContextInfo(GrContextFactory::kNative_GLContextType); + otherFactory.getContextInfo(GrContextFactory::kNativeGL_ContextType); glContext->makeCurrent(); REPORTER_ASSERT(reporter, proxy); diff --git a/tests/SkpSkGrTest.cpp b/tests/SkpSkGrTest.cpp index 4469d4fb57..e5553a9a75 100644 --- a/tests/SkpSkGrTest.cpp +++ b/tests/SkpSkGrTest.cpp @@ -253,11 +253,11 @@ static SkString make_png_name(const char* filename) { return pngName; } -typedef GrContextFactory::GLContextType GLContextType; +typedef GrContextFactory::ContextType ContextType; #ifdef SK_BUILD_FOR_WIN -static const GLContextType kAngle = GrContextFactory::kANGLE_GLContextType; +static const ContextType kAngle = GrContextFactory::kANGLE_ContextType; #else -static const GLContextType kNative = GrContextFactory::kNative_GLContextType; +static const ContextType kNative = GrContextFactory::kNativeGL_ContextType; #endif static int similarBits(const SkBitmap& gr, const SkBitmap& sk) { diff --git a/tests/TestConfigParsing.cpp b/tests/TestConfigParsing.cpp index 301f6a2d9a..ac7037f9d2 100644 --- a/tests/TestConfigParsing.cpp +++ b/tests/TestConfigParsing.cpp @@ -41,7 +41,7 @@ DEF_TEST(ParseConfigs_Gpu, reporter) { #if SK_SUPPORT_GPU REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()); REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getContextType() - == GrContextFactory::kNative_GLContextType); + == GrContextFactory::kNativeGL_ContextType); REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseNVPR() == false); REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseDIText() == false); REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getSamples() == 0); @@ -184,48 +184,48 @@ DEF_TEST(ParseConfigs_ExtendedGpuConfigsCorrect, reporter) { } #if SK_SUPPORT_GPU REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getContextType() == - GrContextFactory::kNative_GLContextType); + GrContextFactory::kNativeGL_ContextType); REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseNVPR()); REPORTER_ASSERT(reporter, !configs[0]->asConfigGpu()->getUseDIText()); REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getSamples() == 0); #if SK_ANGLE #ifdef SK_BUILD_FOR_WIN REPORTER_ASSERT(reporter, configs[1]->asConfigGpu()->getContextType() == - GrContextFactory::kANGLE_GLContextType); + GrContextFactory::kANGLE_ContextType); #else REPORTER_ASSERT(reporter, !configs[1]->asConfigGpu()); #endif REPORTER_ASSERT(reporter, configs[2]->asConfigGpu()->getContextType() == - GrContextFactory::kANGLE_GL_GLContextType); + GrContextFactory::kANGLE_GL_ContextType); #else REPORTER_ASSERT(reporter, !configs[1]->asConfigGpu()); REPORTER_ASSERT(reporter, !configs[2]->asConfigGpu()); #endif #if SK_MESA REPORTER_ASSERT(reporter, configs[3]->asConfigGpu()->getContextType() == - GrContextFactory::kMESA_GLContextType); + GrContextFactory::kMESA_ContextType); #else REPORTER_ASSERT(reporter, !configs[3]->asConfigGpu()); #endif #if SK_COMMAND_BUFFER REPORTER_ASSERT(reporter, configs[4]->asConfigGpu()->getContextType() == - GrContextFactory::kCommandBuffer_GLContextType); + GrContextFactory::kCommandBuffer_ContextType); #else REPORTER_ASSERT(reporter, !configs[4]->asConfigGpu()); #endif REPORTER_ASSERT(reporter, configs[5]->asConfigGpu()->getContextType() == - GrContextFactory::kNative_GLContextType); + GrContextFactory::kNativeGL_ContextType); REPORTER_ASSERT(reporter, !configs[5]->asConfigGpu()->getUseNVPR()); REPORTER_ASSERT(reporter, !configs[5]->asConfigGpu()->getUseDIText()); REPORTER_ASSERT(reporter, configs[5]->asConfigGpu()->getSamples() == 0); REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()->getContextType() == - GrContextFactory::kGLES_GLContextType); + GrContextFactory::kGLES_ContextType); REPORTER_ASSERT(reporter, !configs[6]->asConfigGpu()->getUseNVPR()); REPORTER_ASSERT(reporter, !configs[6]->asConfigGpu()->getUseDIText()); REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()->getSamples() == 0); REPORTER_ASSERT(reporter, configs[7]->asConfigGpu()->getContextType() == - GrContextFactory::kGL_GLContextType); + GrContextFactory::kGL_ContextType); REPORTER_ASSERT(reporter, !configs[7]->asConfigGpu()->getUseNVPR()); REPORTER_ASSERT(reporter, !configs[7]->asConfigGpu()->getUseDIText()); REPORTER_ASSERT(reporter, configs[7]->asConfigGpu()->getSamples() == 0); @@ -260,16 +260,13 @@ DEF_TEST(ParseConfigs_ExtendedGpuConfigsIncorrect, reporter) { } } - DEF_TEST(ParseConfigs_ExtendedGpuConfigsSurprises, reporter) { // These just list explicitly some properties of the system. SkCommandLineFlags::StringArray config1 = make_string_array({ // Options are not canonized -> two same configs have a different tag. "gpu(nvpr=true,dit=true)", "gpu(dit=true,nvpr=true)", - // API native is alias for gl or gles, but it's not canonized -> different tag. - "gpu(api=native)", "gpu(api=gl)", "gpu(api=gles)", "" - // Default values are not canonized -> different tag. - "gpu", "gpu()", "gpu(samples=0)", "gpu(api=native,samples=0)" + "gpu(api=debug)", "gpu(api=gl)", "gpu(api=gles)", "" + "gpu", "gpu()", "gpu(samples=0)", "gpu(api=gles,samples=0)" }); SkCommandLineConfigArray configs; ParseConfigs(config1, &configs); diff --git a/tests/VkClearTests.cpp b/tests/VkClearTests.cpp index ab13ffd1c9..5b8a30bc1b 100644 --- a/tests/VkClearTests.cpp +++ b/tests/VkClearTests.cpp @@ -200,12 +200,12 @@ DEF_GPUTEST(VkClearTests, reporter, factory) { GrContextOptions opts; opts.fSuppressPrints = true; GrContextFactory debugFactory(opts); - for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) { - if (static_cast<GrContextFactory::GLContextType>(type) != - GrContextFactory::kNative_GLContextType) { + for (int type = 0; type < GrContextFactory::kContextTypeCnt; ++type) { + if (static_cast<GrContextFactory::ContextType>(type) != + GrContextFactory::kNativeGL_ContextType) { continue; } - GrContext* context = debugFactory.get(static_cast<GrContextFactory::GLContextType>(type)); + GrContext* context = debugFactory.get(static_cast<GrContextFactory::ContextType>(type)); if (context) { basic_clear_test(reporter, context, kRGBA_8888_GrPixelConfig); basic_clear_test(reporter, context, kBGRA_8888_GrPixelConfig); diff --git a/tests/VkUploadPixelsTests.cpp b/tests/VkUploadPixelsTests.cpp index a509978eda..e5f72dd635 100644 --- a/tests/VkUploadPixelsTests.cpp +++ b/tests/VkUploadPixelsTests.cpp @@ -137,12 +137,12 @@ DEF_GPUTEST(VkUploadPixelsTests, reporter, factory) { GrContextOptions opts; opts.fSuppressPrints = true; GrContextFactory debugFactory(opts); - for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) { - if (static_cast<GrContextFactory::GLContextType>(type) != - GrContextFactory::kNative_GLContextType) { + for (int type = 0; type < GrContextFactory::kContextTypeCnt; ++type) { + if (static_cast<GrContextFactory::ContextType>(type) != + GrContextFactory::kNativeGL_ContextType) { continue; } - GrContext* context = debugFactory.get(static_cast<GrContextFactory::GLContextType>(type)); + GrContext* context = debugFactory.get(static_cast<GrContextFactory::ContextType>(type)); if (context) { basic_texture_test(reporter, context, kRGBA_8888_GrPixelConfig, false, false); basic_texture_test(reporter, context, kRGBA_8888_GrPixelConfig, true, false); diff --git a/tests/VkWrapTests.cpp b/tests/VkWrapTests.cpp index 382bdbe64e..a4fec0876d 100755 --- a/tests/VkWrapTests.cpp +++ b/tests/VkWrapTests.cpp @@ -162,12 +162,12 @@ DEF_GPUTEST(VkWrapTests, reporter, factory) { GrContextOptions opts; opts.fSuppressPrints = true; GrContextFactory debugFactory(opts); - for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) { - if (static_cast<GrContextFactory::GLContextType>(type) != - GrContextFactory::kNative_GLContextType) { + for (int type = 0; type < GrContextFactory::kLastContextType; ++type) { + if (static_cast<GrContextFactory::ContextType>(type) != + GrContextFactory::kNativeGL_ContextType) { continue; } - GrContext* context = debugFactory.get(static_cast<GrContextFactory::GLContextType>(type)); + GrContext* context = debugFactory.get(static_cast<GrContextFactory::ContextType>(type)); if (context) { wrap_tex_test(reporter, context); wrap_rt_test(reporter, context); |