dcfca431e3
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>
54 lines
1.7 KiB
C++
54 lines
1.7 KiB
C++
/*
|
|
* Copyright 2016 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#include "SkTypes.h"
|
|
|
|
#if SK_SUPPORT_GPU
|
|
|
|
#include "GrContextFactory.h"
|
|
#include "Test.h"
|
|
|
|
using namespace sk_gpu_test;
|
|
|
|
DEF_GPUTEST(GrContext_abandonContext, reporter, options) {
|
|
for (int testType = 0; testType < 6; ++testType) {
|
|
for (int i = 0; i < GrContextFactory::kContextTypeCnt; ++i) {
|
|
GrContextFactory testFactory(options);
|
|
GrContextFactory::ContextType ctxType = (GrContextFactory::ContextType) i;
|
|
ContextInfo info = testFactory.getContextInfo(ctxType);
|
|
if (GrContext* context = info.grContext()) {
|
|
switch (testType) {
|
|
case 0:
|
|
context->abandonContext();
|
|
break;
|
|
case 1:
|
|
context->releaseResourcesAndAbandonContext();
|
|
break;
|
|
case 2:
|
|
context->abandonContext();
|
|
context->abandonContext();
|
|
break;
|
|
case 3:
|
|
context->abandonContext();
|
|
context->releaseResourcesAndAbandonContext();
|
|
break;
|
|
case 4:
|
|
context->releaseResourcesAndAbandonContext();
|
|
context->abandonContext();
|
|
break;
|
|
case 5:
|
|
context->releaseResourcesAndAbandonContext();
|
|
context->releaseResourcesAndAbandonContext();
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#endif
|