| Index: bench/benchmain.cpp
|
| diff --git a/bench/benchmain.cpp b/bench/benchmain.cpp
|
| index 25c552c5e06565933ae74f68f785a84b9dbd2aa0..0dc3b899f851fa346186dbaedeb331a98ab16999 100644
|
| --- a/bench/benchmain.cpp
|
| +++ b/bench/benchmain.cpp
|
| @@ -49,6 +49,11 @@ const char* BenchMode_Name[] = {
|
|
|
| static const char kDefaultsConfigStr[] = "defaults";
|
|
|
| +#if SK_SUPPORT_GPU
|
| +static const char kGpuApiNameGL[] = "gl";
|
| +static const char kGpuApiNameGLES[] = "gles";
|
| +#endif
|
| +
|
| ///////////////////////////////////////////////////////////////////////////////
|
|
|
| class Iter {
|
| @@ -238,6 +243,10 @@ DEFINE_bool(forceFilter, false, "Force bitmap filtering?");
|
| DEFINE_string(forceDither, "default", "Force dithering: true, false, or default?");
|
| DEFINE_bool(forceBlend, false, "Force alpha blending?");
|
|
|
| +DEFINE_string(forceGpuApi, "", "Force use of specific gpu API. Using \"gl\" "
|
| + "forces OpenGL API. Using \"gles\" forces OpenGL ES API. "
|
| + "Defaults to empty string, which selects the API native to the "
|
| + "system.");
|
| DEFINE_int32(gpuCacheBytes, -1, "GPU cache size limit in bytes. 0 to disable cache.");
|
| DEFINE_int32(gpuCacheCount, -1, "GPU cache size limit in object count. 0 to disable cache.");
|
|
|
| @@ -367,11 +376,20 @@ int tool_main(int argc, char** argv) {
|
| }
|
|
|
| #if SK_SUPPORT_GPU
|
| + GrGLStandard forcedGpuApi = kNone_GrGLStandard;
|
| + if (1 == FLAGS_forceGpuApi.count()) {
|
| + if (strcmp(FLAGS_forceGpuApi[0], kGpuApiNameGL) == 0) {
|
| + forcedGpuApi = kGL_GrGLStandard;
|
| + } else if (strcmp(FLAGS_forceGpuApi[0], kGpuApiNameGLES) == 0) {
|
| + forcedGpuApi = kGLES_GrGLStandard;
|
| + }
|
| + }
|
| +
|
| for (int i = 0; i < configs.count(); ++i) {
|
| const Config& config = gConfigs[configs[i]];
|
|
|
| if (SkBenchmark::kGPU_Backend == config.backend) {
|
| - GrContext* context = gContextFactory.get(config.contextType);
|
| + GrContext* context = gContextFactory.get(config.contextType, forcedGpuApi);
|
| if (NULL == context) {
|
| SkDebugf("GrContext could not be created for config %s. Config will be skipped.\n",
|
| config.name);
|
| @@ -431,7 +449,7 @@ int tool_main(int argc, char** argv) {
|
| if (SkBenchmark::kGPU_Backend != config.backend) {
|
| continue;
|
| }
|
| - GrContext* context = gContextFactory.get(config.contextType);
|
| + GrContext* context = gContextFactory.get(config.contextType, forcedGpuApi);
|
| if (NULL == context) {
|
| continue;
|
| }
|
| @@ -477,7 +495,7 @@ int tool_main(int argc, char** argv) {
|
| #if SK_SUPPORT_GPU
|
| SkGLContextHelper* glContext = NULL;
|
| if (SkBenchmark::kGPU_Backend == config.backend) {
|
| - context = gContextFactory.get(config.contextType);
|
| + context = gContextFactory.get(config.contextType, forcedGpuApi);
|
| if (NULL == context) {
|
| continue;
|
| }
|
|
|