Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1227)

Unified Diff: bench/GLBench.h

Issue 1214203004: cleanup GLBenches (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: cpu warnings Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | bench/GLBench.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/GLBench.h
diff --git a/bench/GLBench.h b/bench/GLBench.h
new file mode 100644
index 0000000000000000000000000000000000000000..0755c4f1a893410f0ff600c32389616704b54dc0
--- /dev/null
+++ b/bench/GLBench.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GLBench_DEFINED
+#define GLBench_DEFINED
+
+#include "Benchmark.h"
+#include "SkCanvas.h"
+#include "SkImageEncoder.h"
+
+#if SK_SUPPORT_GPU
+#include "gl/GrGLFunctions.h"
+
+class GrGLContext;
+struct GrGLInterface;
+
+/*
+ * A virtual base class for microbenches which want to specifically test the performance of GL
+ */
+
+class GLBench : public Benchmark {
+public:
+ GLBench() {}
+
+protected:
+ const GrGLContext* getGLContext(SkCanvas*);
+ virtual const GrGLContext* onGetGLContext(const GrGLContext* ctx) { return ctx; }
+ void onPerCanvasPreDraw(SkCanvas* canvas) override;
+ virtual void setup(const GrGLContext*)=0;
+ void onPerCanvasPostDraw(SkCanvas* canvas) override;
+ virtual void teardown(const GrGLInterface*)=0;
+ void onDraw(const int loops, SkCanvas*) override;
+ virtual void glDraw(const int loops, const GrGLContext*)=0;
+ static GrGLuint CompileShader(const GrGLInterface*, const char* shaderSrc, GrGLenum type);
+ static GrGLuint CreateProgram(const GrGLInterface*, const char* vshader, const char* fshader);
+ static GrGLuint SetupFramebuffer(const GrGLInterface*, int screenWidth, int screenHeight);
+ static void DumpImage(const GrGLInterface* gl, uint32_t screenWidth, uint32_t screenHeight,
+ const char* filename);
+
+
+private:
+ typedef Benchmark INHERITED;
+};
+
+
+#endif
+#endif
« no previous file with comments | « no previous file | bench/GLBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698