Virtualize SkGLContext with subclasses SkNativeGLContext and SkMesaGLContext, allow both in gm
Review URL: http://codereview.appspot.com/5307045/
git-svn-id: http://skia.googlecode.com/svn/trunk@2499 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/bench/benchmain.cpp b/bench/benchmain.cpp
index 3b2be8d..c988e12 100644
--- a/bench/benchmain.cpp
+++ b/bench/benchmain.cpp
@@ -15,7 +15,7 @@
#include "SkBenchmark.h"
#include "SkCanvas.h"
#include "SkColorPriv.h"
-#include "SkGLContext.h"
+#include "SkNativeGLContext.h"
#include "SkGpuDevice.h"
#include "SkGraphics.h"
#include "SkImageEncoder.h"
@@ -416,9 +416,11 @@
GrRenderTarget* rt = NULL;
//Don't do GL when fixed.
#if !defined(SK_SCALAR_IS_FIXED)
- SkGLContext glContext;
+ SkNativeGLContext glContext;
if (glContext.init(1024, 1024)) {
- context = GrContext::CreateGLShaderContext();
+ GrPlatform3DContext ctx =
+ reinterpret_cast<GrPlatform3DContext>(glContext.gl());
+ context = GrContext::Create(kOpenGL_Shaders_GrEngine, ctx);
if (NULL != context) {
GrPlatformSurfaceDesc desc;
desc.reset();
@@ -435,9 +437,11 @@
}
}
}
+ BenchTimer timer = BenchTimer(&glContext);
+#else
+ BenchTimer timer = BenchTimer();
#endif
- BenchTimer timer = BenchTimer();
Iter iter(&defineDict);
SkBenchmark* bench;
@@ -500,7 +504,7 @@
bench->draw(&canvas);
if (gpu) {
context->flush();
- glFinish();
+ SK_GL(glContext, Finish());
}
}
@@ -513,7 +517,7 @@
}
}
if (gpu) {
- glFinish();
+ SK_GL(glContext, Finish());
}
timer.end();