a6841be235
This fixes a large number of SkSL namespaces which were labeled as if they were anonymous, and also a handful of other mislabeled namespaces. Missing namespace-end comments have been added throughout. A number of diffs are just indentation-related (adjusting 1- or 3- space indents to 2-space). Change-Id: I6c62052a0d3aea4ae12ca07e0c2a8587b2fce4ec Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308503 Commit-Queue: John Stiles <johnstiles@google.com> Reviewed-by: Mike Klein <mtklein@google.com> Auto-Submit: John Stiles <johnstiles@google.com>
69 lines
1.9 KiB
C++
69 lines
1.9 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 "tools/gpu/TestContext.h"
|
|
|
|
#include "include/gpu/GrDirectContext.h"
|
|
#include "src/core/SkTraceEvent.h"
|
|
#include "tools/gpu/FlushFinishTracker.h"
|
|
#include "tools/gpu/GpuTimer.h"
|
|
|
|
namespace sk_gpu_test {
|
|
TestContext::TestContext() : fGpuTimer(nullptr) {}
|
|
|
|
TestContext::~TestContext() {
|
|
// Subclass should call teardown.
|
|
SkASSERT(!fGpuTimer);
|
|
}
|
|
|
|
sk_sp<GrDirectContext> TestContext::makeContext(const GrContextOptions&) {
|
|
return nullptr;
|
|
}
|
|
|
|
void TestContext::makeNotCurrent() const { this->onPlatformMakeNotCurrent(); }
|
|
void TestContext::makeCurrent() const { this->onPlatformMakeCurrent(); }
|
|
|
|
SkScopeExit TestContext::makeCurrentAndAutoRestore() const {
|
|
auto asr = SkScopeExit(this->onPlatformGetAutoContextRestore());
|
|
this->makeCurrent();
|
|
return asr;
|
|
}
|
|
|
|
void TestContext::flushAndWaitOnSync(GrDirectContext* context) {
|
|
TRACE_EVENT0("skia.gpu", TRACE_FUNC);
|
|
SkASSERT(context);
|
|
|
|
if (fFinishTrackers[fCurrentFlushIdx]) {
|
|
fFinishTrackers[fCurrentFlushIdx]->waitTillFinished();
|
|
}
|
|
|
|
fFinishTrackers[fCurrentFlushIdx].reset(new FlushFinishTracker(context));
|
|
|
|
// We add an additional ref to the current flush tracker here. This ref is owned by the finish
|
|
// callback on the flush call. The finish callback will unref the tracker when called.
|
|
fFinishTrackers[fCurrentFlushIdx]->ref();
|
|
|
|
GrFlushInfo flushInfo;
|
|
flushInfo.fFinishedProc = FlushFinishTracker::FlushFinished;
|
|
flushInfo.fFinishedContext = fFinishTrackers[fCurrentFlushIdx].get();
|
|
|
|
context->flush(flushInfo);
|
|
context->submit();
|
|
|
|
fCurrentFlushIdx = (fCurrentFlushIdx + 1) % SK_ARRAY_COUNT(fFinishTrackers);
|
|
}
|
|
|
|
void TestContext::testAbandon() {
|
|
}
|
|
|
|
void TestContext::teardown() {
|
|
fGpuTimer.reset();
|
|
}
|
|
|
|
} // namespace sk_gpu_test
|