Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3623)

Unified Diff: bench/benchmain.cpp

Issue 319043005: Support using OpenGL ES context on desktop (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add docs Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | dm/DM.cpp » ('j') | src/gpu/gl/android/SkNativeGLContext_android.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/benchmain.cpp
diff --git a/bench/benchmain.cpp b/bench/benchmain.cpp
index e097fe094771fe44eaa8609dd31f3108f29dcd63..3a9f0c2a465c1b230ce45148a1451d0d45502a64 100644
--- a/bench/benchmain.cpp
+++ b/bench/benchmain.cpp
@@ -48,6 +48,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 {
@@ -225,6 +230,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(gpuAPI, "", "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.");
@@ -346,11 +355,24 @@ int tool_main(int argc, char** argv) {
}
#if SK_SUPPORT_GPU
+ GrGLStandard gpuAPI = kNone_GrGLStandard;
+ if (1 == FLAGS_gpuAPI.count()) {
+ if (FLAGS_gpuAPI.contains(kGpuAPINameGL)) {
+ gpuAPI = kGL_GrGLStandard;
+ } else if (FLAGS_gpuAPI.contains(kGpuAPINameGLES)) {
+ gpuAPI = kGLES_GrGLStandard;
+ } else {
+ SkDebugf("Selected gpu API could not be used. Using the default.\n");
+ }
+ } else if (FLAGS_gpuAPI.count() > 1) {
+ SkDebugf("Selected gpu API could not be used. Using the default.\n");
+ }
+
for (int i = 0; i < configs.count(); ++i) {
const Config& config = gConfigs[configs[i]];
if (Benchmark::kGPU_Backend == config.backend) {
- GrContext* context = gContextFactory.get(config.contextType);
+ GrContext* context = gContextFactory.get(config.contextType, gpuAPI);
if (NULL == context) {
SkDebugf("GrContext could not be created for config %s. Config will be skipped.\n",
config.name);
@@ -410,7 +432,7 @@ int tool_main(int argc, char** argv) {
if (Benchmark::kGPU_Backend != config.backend) {
continue;
}
- GrContext* context = gContextFactory.get(config.contextType);
+ GrContext* context = gContextFactory.get(config.contextType, gpuAPI);
if (NULL == context) {
continue;
}
@@ -456,7 +478,7 @@ int tool_main(int argc, char** argv) {
#if SK_SUPPORT_GPU
SkGLContextHelper* glContext = NULL;
if (Benchmark::kGPU_Backend == config.backend) {
- context = gContextFactory.get(config.contextType);
+ context = gContextFactory.get(config.contextType, gpuAPI);
if (NULL == context) {
continue;
}
« no previous file with comments | « no previous file | dm/DM.cpp » ('j') | src/gpu/gl/android/SkNativeGLContext_android.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698