aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench
diff options
context:
space:
mode:
authorGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-03-19 14:42:13 +0000
committerGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-03-19 14:42:13 +0000
commit0da3719050473344b6013fd7b614611984f20eff (patch)
treed3081e12ae3d4b6c884f9b7a700c2f740ce19b78 /bench
parent6c5ccd95f73661b07dd0a300c62c7da17cd6e55a (diff)
Added debug GL Interface. This interface tracks various GL objects in order to find leaks & invalid accesses.
Core Review: http://codereview.appspot.com/5846049/ git-svn-id: http://skia.googlecode.com/svn/trunk@3426 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'bench')
-rw-r--r--bench/benchmain.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/bench/benchmain.cpp b/bench/benchmain.cpp
index 7732268759..32aace3697 100644
--- a/bench/benchmain.cpp
+++ b/bench/benchmain.cpp
@@ -20,6 +20,7 @@
#include "SkImageEncoder.h"
#include "gl/SkNativeGLContext.h"
#include "gl/SkNullGLContext.h"
+#include "gl/SkDebugGLContext.h"
#include "SkNWayCanvas.h"
#include "SkPicture.h"
#include "SkString.h"
@@ -208,6 +209,12 @@ public:
return true;
}
+ void cleanup() {
+ fGLContext.reset(NULL);
+ fGrContext.reset(NULL);
+ fRenderTarget.reset(NULL);
+ }
+
bool isValid() {
return NULL != fGLContext.get();
}
@@ -231,6 +238,7 @@ private:
static GLHelper gRealGLHelper;
static GLHelper gNullGLHelper;
+static GLHelper gDebugGLHelper;
static SkDevice* make_device(SkBitmap::Config config, const SkIPoint& size,
Backend backend, GLHelper* glHelper) {
@@ -512,8 +520,10 @@ int main (int argc, char * const argv[]) {
determine_gpu_context_size(defineDict, &contextWidth, &contextHeight);
SkAutoTUnref<SkGLContext> realGLCtx(new SkNativeGLContext);
SkAutoTUnref<SkGLContext> nullGLCtx(new SkNullGLContext);
+ SkAutoTUnref<SkGLContext> debugGLCtx(new SkDebugGLContext);
gRealGLHelper.init(realGLCtx.get(), contextWidth, contextHeight);
gNullGLHelper.init(nullGLCtx.get(), contextWidth, contextHeight);
+ gDebugGLHelper.init(debugGLCtx.get(), contextWidth, contextHeight);
#endif
BenchTimer timer = BenchTimer(gRealGLHelper.glContext());
@@ -617,5 +627,8 @@ int main (int argc, char * const argv[]) {
log_progress("\n");
}
+ // need to clean up here rather than post-main to allow leak detection to work
+ gDebugGLHelper.cleanup();
+
return 0;
}