aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/SurfaceSemaphoreTest.cpp
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-11-15 15:48:03 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-11-15 22:03:07 +0000
commitdcfca431e3c350e17eedb3402cc63577cea8d4ea (patch)
treeb65ff91284663aef37e7603bbdba1fda51eb0c89 /tests/SurfaceSemaphoreTest.cpp
parent20800c8b1bb7181fc7d3c6af756dc4440094ac90 (diff)
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 <brianosman@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'tests/SurfaceSemaphoreTest.cpp')
-rw-r--r--tests/SurfaceSemaphoreTest.cpp13
1 files changed, 7 insertions, 6 deletions
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;
}