skia2/tools/gpu/FlushFinishTracker.cpp
Robert Phillips 00f78de600 Update additional tools to take a GrDirectContext
GM was updated in:
https://skia-review.googlesource.com/c/skia/+/300172 (Make GM::onGpuSetup take a GrDirectContext)

This CL updates: skpbench, nanobench, and some testing infrastructure.

Only minor changes were made to the unit tests as they will be updated
en masse in a follow up cl.

Change-Id: Ieffc98865d4c9fc73e292d3c807ed4ae2081745a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300220
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-07-01 20:42:25 +00:00

31 lines
789 B
C++

/*
* Copyright 2020 Google LLC
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "tools/gpu/FlushFinishTracker.h"
#include "include/gpu/GrDirectContext.h"
#include "src/core/SkTraceEvent.h"
#include <chrono>
namespace sk_gpu_test {
void FlushFinishTracker::waitTillFinished() {
TRACE_EVENT0("skia.gpu", TRACE_FUNC);
auto begin = std::chrono::steady_clock::now();
auto end = begin;
while (!fIsFinished && (end - begin) < std::chrono::seconds(2)) {
fContext->checkAsyncWorkCompletion();
end = std::chrono::steady_clock::now();
}
if (!fIsFinished) {
SkDebugf("WARNING: Wait failed for flush sync. Timings might not be accurate.\n");
}
}
} //namespace sk_gpu_test