From dcfca431e3c350e17eedb3402cc63577cea8d4ea Mon Sep 17 00:00:00 2001 From: Brian Salomon Date: Wed, 15 Nov 2017 15:48:03 -0500 Subject: Use GrContextFactories that produce a single GrContext in unit tests. This is to alleviate problems due to the command buffer getting bent out of shape when the current OpenGL context is switched out from under it (because we ran a test with a native GL context). This, however is not a full solution. More changes will be required to ensure that after running each command buffer or native test we bind the null context. This does allow us to take a step in that direction without breaking anything too badly. Moreover, there is no real benefit to reusing a GrContextFactory. Modifies DEF_GPUTEST to take GrContextOptions rather than a factory to use. Tests were already using their own factories anyway. In tests that use GrContextFactory the factory instance is moved to the inner loop. Modifies gpucts and skia_test to not use persistent GrContextFactories. Change-Id: Ie7a36793545c775f2f30653ead6fec93a3d22717 Reviewed-on: https://skia-review.googlesource.com/71861 Reviewed-by: Brian Osman Commit-Queue: Brian Salomon --- tests/SurfaceSemaphoreTest.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'tests/SurfaceSemaphoreTest.cpp') diff --git a/tests/SurfaceSemaphoreTest.cpp b/tests/SurfaceSemaphoreTest.cpp index 9b3f90429a..8ae0953d88 100644 --- a/tests/SurfaceSemaphoreTest.cpp +++ b/tests/SurfaceSemaphoreTest.cpp @@ -169,7 +169,7 @@ void surface_semaphore_test(skiatest::Reporter* reporter, draw_child(reporter, childInfo2, backendImage, semaphores[1]); } -DEF_GPUTEST(SurfaceSemaphores, reporter, factory) { +DEF_GPUTEST(SurfaceSemaphores, reporter, options) { #if defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_WIN) || defined(SK_BUILD_FOR_MAC) static constexpr auto kNativeGLType = sk_gpu_test::GrContextFactory::kGL_ContextType; #else @@ -188,7 +188,8 @@ DEF_GPUTEST(SurfaceSemaphores, reporter, factory) { continue; } } - sk_gpu_test::ContextInfo ctxInfo = factory->getContextInfo( + sk_gpu_test::GrContextFactory factory(options); + sk_gpu_test::ContextInfo ctxInfo = factory.getContextInfo( contextType, sk_gpu_test::GrContextFactory::ContextOverrides::kDisableNVPR); if (!sk_gpu_test::GrContextFactory::IsRenderingContext(contextType)) { continue; @@ -196,10 +197,10 @@ DEF_GPUTEST(SurfaceSemaphores, reporter, factory) { skiatest::ReporterContext ctx( reporter, SkString(sk_gpu_test::GrContextFactory::ContextTypeName(contextType))); if (ctxInfo.grContext()) { - sk_gpu_test::ContextInfo child1 = factory->getSharedContextInfo(ctxInfo.grContext(), - 0); - sk_gpu_test::ContextInfo child2 = factory->getSharedContextInfo(ctxInfo.grContext(), - 1); + sk_gpu_test::ContextInfo child1 = + factory.getSharedContextInfo(ctxInfo.grContext(), 0); + sk_gpu_test::ContextInfo child2 = + factory.getSharedContextInfo(ctxInfo.grContext(), 1); if (!child1.grContext() || !child2.grContext()) { continue; } -- cgit v1.2.3