aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/skpbench/skpbench.cpp
diff options
context:
space:
mode:
authorGravatar csmartdalton <csmartdalton@google.com>2016-10-04 11:08:45 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-10-04 11:08:45 -0700
commit421a3c1cc1b227084c7c84618d0b6a6804faabef (patch)
tree121df15df779adc93866c323571c3a02ee349429 /tools/skpbench/skpbench.cpp
parentd36baa7a4a5ae3cc94cc4a45379f55658f80c0a6 (diff)
Move GPU fences into sk_gpu_test
Diffstat (limited to 'tools/skpbench/skpbench.cpp')
-rw-r--r--tools/skpbench/skpbench.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/tools/skpbench/skpbench.cpp b/tools/skpbench/skpbench.cpp
index 734a1b79b2..adb6af0b14 100644
--- a/tools/skpbench/skpbench.cpp
+++ b/tools/skpbench/skpbench.cpp
@@ -33,6 +33,10 @@
* Currently, only GPU configs are supported.
*/
+using sk_gpu_test::PlatformFence;
+using sk_gpu_test::kInvalidPlatformFence;
+using sk_gpu_test::FenceSync;
+
DEFINE_int32(duration, 5000, "number of milliseconds to run the benchmark");
DEFINE_int32(sampleMs, 50, "minimum duration of a sample");
DEFINE_bool(fps, false, "use fps instead of ms");
@@ -62,7 +66,7 @@ struct Sample {
class GpuSync {
public:
- GpuSync(const SkGpuFenceSync* fenceSync);
+ GpuSync(const FenceSync* fenceSync);
~GpuSync();
void syncToPreviousFrame();
@@ -70,8 +74,8 @@ public:
private:
void updateFence();
- const SkGpuFenceSync* const fFenceSync;
- SkPlatformGpuFence fFence;
+ const FenceSync* const fFenceSync;
+ PlatformFence fFence;
};
enum class ExitErr {
@@ -88,7 +92,7 @@ static bool mkdir_p(const SkString& name);
static SkString join(const SkCommandLineFlags::StringArray&);
static void exitf(ExitErr, const char* format, ...);
-static void run_benchmark(const SkGpuFenceSync* fenceSync, SkCanvas* canvas, const SkPicture* skp,
+static void run_benchmark(const FenceSync* fenceSync, SkCanvas* canvas, const SkPicture* skp,
std::vector<Sample>* samples) {
using clock = Sample::clock;
const clock::duration sampleDuration = std::chrono::milliseconds(FLAGS_sampleMs);
@@ -296,7 +300,7 @@ static void exitf(ExitErr err, const char* format, ...) {
exit((int)err);
}
-GpuSync::GpuSync(const SkGpuFenceSync* fenceSync)
+GpuSync::GpuSync(const FenceSync* fenceSync)
: fFenceSync(fenceSync) {
this->updateFence();
}
@@ -306,7 +310,7 @@ GpuSync::~GpuSync() {
}
void GpuSync::syncToPreviousFrame() {
- if (kInvalidPlatformGpuFence == fFence) {
+ if (kInvalidPlatformFence == fFence) {
exitf(ExitErr::kSoftware, "attempted to sync with invalid fence");
}
if (!fFenceSync->waitFence(fFence)) {
@@ -318,7 +322,7 @@ void GpuSync::syncToPreviousFrame() {
void GpuSync::updateFence() {
fFence = fFenceSync->insertFence();
- if (kInvalidPlatformGpuFence == fFence) {
+ if (kInvalidPlatformFence == fFence) {
exitf(ExitErr::kUnavailable, "failed to insert fence");
}
}