aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/gpu/GrContextFactory.cpp
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-11-16 22:31:30 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-11-16 22:31:39 +0000
commit1e09e461d2ffcf8b07242cfe93dd7d12c4d75866 (patch)
tree59ecb8a613b8a958522036043ed6e5a4c4e329ca /tools/gpu/GrContextFactory.cpp
parent8dca18ac7b8af9a945abe4ae0d9190a1d2bff3d6 (diff)
Revert "Add method to sk_gpu_test::TestContext to automatically restore the previous context."
This reverts commit 5627d65146cb92624b682389e017d488872228c7. Reason for revert: Google3 Original change's description: > Add method to sk_gpu_test::TestContext to automatically restore the previous context. > > The motivation for this is to allow a GM to create a GL context, do some some work in it, and then return to the context that was set when it was invoked. > > Change-Id: Ie8496072a10f8f3ff36a08889e593a6ca961b61a > Reviewed-on: https://skia-review.googlesource.com/70720 > Commit-Queue: Brian Salomon <bsalomon@google.com> > Reviewed-by: Brian Osman <brianosman@google.com> TBR=bsalomon@google.com,brianosman@google.com Change-Id: Ifb79638c9d4500ca3be9a5be39a5ad78b20247c1 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/72981 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'tools/gpu/GrContextFactory.cpp')
-rw-r--r--tools/gpu/GrContextFactory.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/tools/gpu/GrContextFactory.cpp b/tools/gpu/GrContextFactory.cpp
index 00c4b65edc..21766db2b8 100644
--- a/tools/gpu/GrContextFactory.cpp
+++ b/tools/gpu/GrContextFactory.cpp
@@ -52,9 +52,8 @@ GrContextFactory::~GrContextFactory() {
void GrContextFactory::destroyContexts() {
for (Context& context : fContexts) {
- SkScopeExit restore(nullptr);
if (context.fTestContext) {
- restore = context.fTestContext->makeCurrentAndAutoRestore();
+ context.fTestContext->makeCurrent();
}
if (!context.fGrContext->unique()) {
context.fGrContext->releaseResourcesAndAbandonContext();
@@ -70,7 +69,7 @@ void GrContextFactory::abandonContexts() {
for (Context& context : fContexts) {
if (!context.fAbandoned) {
if (context.fTestContext) {
- auto restore = context.fTestContext->makeCurrentAndAutoRestore();
+ context.fTestContext->makeCurrent();
context.fTestContext->testAbandon();
delete(context.fTestContext);
context.fTestContext = nullptr;
@@ -83,10 +82,9 @@ void GrContextFactory::abandonContexts() {
void GrContextFactory::releaseResourcesAndAbandonContexts() {
for (Context& context : fContexts) {
- SkScopeExit restore(nullptr);
if (!context.fAbandoned) {
if (context.fTestContext) {
- restore = context.fTestContext->makeCurrentAndAutoRestore();
+ context.fTestContext->makeCurrent();
}
context.fGrContext->releaseResourcesAndAbandonContext();
context.fAbandoned = true;
@@ -239,7 +237,7 @@ ContextInfo GrContextFactory::getContextInfoInternal(ContextType type, ContextOv
default:
return ContextInfo();
}
-
+ testCtx->makeCurrent();
SkASSERT(testCtx && testCtx->backend() == backend);
GrContextOptions grOptions = fGlobalOptions;
if (ContextOverrides::kDisableNVPR & overrides) {
@@ -254,11 +252,7 @@ ContextInfo GrContextFactory::getContextInfoInternal(ContextType type, ContextOv
if (ContextOverrides::kAvoidStencilBuffers & overrides) {
grOptions.fAvoidStencilBuffers = true;
}
- sk_sp<GrContext> grCtx;
- {
- auto restore = testCtx->makeCurrentAndAutoRestore();
- grCtx = testCtx->makeGrContext(grOptions);
- }
+ sk_sp<GrContext> grCtx = testCtx->makeGrContext(grOptions);
if (!grCtx.get()) {
return ContextInfo();
}
@@ -288,7 +282,6 @@ ContextInfo GrContextFactory::getContextInfoInternal(ContextType type, ContextOv
context.fShareContext = shareContext;
context.fShareIndex = shareIndex;
context.fOptions = grOptions;
- context.fTestContext->makeCurrent();
return ContextInfo(context.fType, context.fTestContext, context.fGrContext, context.fOptions);
}