aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-10-28 14:59:07 +0000
committerGravatar tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-10-28 14:59:07 +0000
commit8382394bf260af223d5217ff8c45961f149bf1cf (patch)
treee4c32983da16fd8cc7e4bd62a65313d0e9ed0e39
parent67f11b15aead838e7f52748ad3023bcabbefa9ef (diff)
Instead of using fixed size for GPU context in benchmain, walk list of
benchmarks and find the largest size required. codereview.appspot.com/5330045/ git-svn-id: http://skia.googlecode.com/svn/trunk@2551 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--bench/benchmain.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/bench/benchmain.cpp b/bench/benchmain.cpp
index 5debfee925..7800abccb0 100644
--- a/bench/benchmain.cpp
+++ b/bench/benchmain.cpp
@@ -216,6 +216,22 @@ static int findConfig(const char config[]) {
return -1;
}
+static void determine_gpu_context_size(SkTDict<const char*>& defineDict,
+ int* contextWidth,
+ int* contextHeight) {
+ Iter iter(&defineDict);
+ SkBenchmark* bench;
+ while ((bench = iter.next()) != NULL) {
+ SkIPoint dim = bench->getSize();
+ if (*contextWidth < dim.fX) {
+ *contextWidth = dim.fX;
+ }
+ if (*contextHeight < dim.fY) {
+ *contextHeight = dim.fY;
+ }
+ }
+}
+
int main (int argc, char * const argv[]) {
SkAutoGraphics ag;
@@ -426,7 +442,10 @@ int main (int argc, char * const argv[]) {
} else {
glctx.reset(new SkNativeGLContext);
}
- if (glctx.get()->init(1024, 1024)) {
+ int contextWidth = 1024;
+ int contextHeight = 1024;
+ determine_gpu_context_size(defineDict, &contextWidth, &contextHeight);
+ if (glctx.get()->init(contextWidth, contextHeight)) {
GrPlatform3DContext ctx =
reinterpret_cast<GrPlatform3DContext>(glctx.get()->gl());
context = GrContext::Create(kOpenGL_Shaders_GrEngine, ctx);
@@ -434,8 +453,8 @@ int main (int argc, char * const argv[]) {
GrPlatformSurfaceDesc desc;
desc.reset();
desc.fConfig = kRGBA_8888_GrPixelConfig;
- desc.fWidth = 1024;
- desc.fHeight = 1024;
+ desc.fWidth = contextWidth;
+ desc.fHeight = contextHeight;
desc.fStencilBits = 8;
desc.fPlatformRenderTarget = glctx.get()->getFBOID();
desc.fSurfaceType = kRenderTarget_GrPlatformSurfaceType;