5961bc9278
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2288033003 Committed: https://skia.googlesource.com/skia/+/9b0fe3d125f237d9884732a48414fa85fc71b4e3 Committed: https://skia.googlesource.com/skia/+/b12b3c6908c62c908b3680be01e3b5bfd30de310 Committed: https://skia.googlesource.com/skia/+/f008b0a59f45c0d4bea3e66faf3b01805009ec89 Committed: https://skia.googlesource.com/skia/+/08b2ccf398e2b81bc05d2c105837e5419899469b Committed: https://skia.googlesource.com/skia/+/dcfe6dba4a335e50e86ff68e3252065d4197432c Committed: https://skia.googlesource.com/skia/+/ccb1dd8f267f9d7fe7c9d0ce222ebc81b41853b3 Review-Url: https://codereview.chromium.org/2288033003
52 lines
1.4 KiB
C++
52 lines
1.4 KiB
C++
/*
|
|
* 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 onPreDraw(SkCanvas*) override;
|
|
virtual void setup(const GrGLContext*)=0;
|
|
void onPostDraw(SkCanvas* canvas) override;
|
|
virtual void teardown(const GrGLInterface*)=0;
|
|
void onDraw(int loops, SkCanvas*) override;
|
|
virtual void glDraw(int loops, const GrGLContext*)=0;
|
|
static GrGLuint CompileShader(const GrGLContext*, const char* shaderSrc, GrGLenum type);
|
|
static GrGLuint CreateProgram(const GrGLContext*, 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
|