OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2015 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 |
| 8 #ifndef GLBench_DEFINED |
| 9 #define GLBench_DEFINED |
| 10 |
| 11 #include "Benchmark.h" |
| 12 #include "SkCanvas.h" |
| 13 #include "SkImageEncoder.h" |
| 14 |
| 15 #if SK_SUPPORT_GPU |
| 16 #include "gl/GrGLFunctions.h" |
| 17 |
| 18 class GrGLContext; |
| 19 struct GrGLInterface; |
| 20 |
| 21 /* |
| 22 * A virtual base class for microbenches which want to specifically test the per
formance of GL |
| 23 */ |
| 24 |
| 25 class GLBench : public Benchmark { |
| 26 public: |
| 27 GLBench() {} |
| 28 |
| 29 protected: |
| 30 const GrGLContext* getGLContext(SkCanvas*); |
| 31 virtual const GrGLContext* onGetGLContext(const GrGLContext* ctx) { return c
tx; } |
| 32 void onPerCanvasPreDraw(SkCanvas* canvas) override; |
| 33 virtual void setup(const GrGLContext*)=0; |
| 34 void onPerCanvasPostDraw(SkCanvas* canvas) override; |
| 35 virtual void teardown(const GrGLInterface*)=0; |
| 36 void onDraw(const int loops, SkCanvas*) override; |
| 37 virtual void glDraw(const int loops, const GrGLContext*)=0; |
| 38 static GrGLuint CompileShader(const GrGLInterface*, const char* shaderSrc, G
rGLenum type); |
| 39 static GrGLuint CreateProgram(const GrGLInterface*, const char* vshader, con
st char* fshader); |
| 40 static GrGLuint SetupFramebuffer(const GrGLInterface*, int screenWidth, int
screenHeight); |
| 41 static void DumpImage(const GrGLInterface* gl, uint32_t screenWidth, uint32_
t screenHeight, |
| 42 const char* filename); |
| 43 |
| 44 |
| 45 private: |
| 46 typedef Benchmark INHERITED; |
| 47 }; |
| 48 |
| 49 |
| 50 #endif |
| 51 #endif |
OLD | NEW |