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

Unified Diff: gpu/gles2_conform_support/egl/egl.cc

Issue 1509833002: Support arguments and driver bug workarounds in command_buffer_gles2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addition for gn Created 5 years 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 | « gpu/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/gles2_conform_support/egl/egl.cc
diff --git a/gpu/gles2_conform_support/egl/egl.cc b/gpu/gles2_conform_support/egl/egl.cc
index e64285a02ea4f98b8ba16d281b6598989bf41d67..200f892fdfada829780318cea05820bb602ba565 100644
--- a/gpu/gles2_conform_support/egl/egl.cc
+++ b/gpu/gles2_conform_support/egl/egl.cc
@@ -5,7 +5,11 @@
#include <EGL/egl.h>
#include "base/command_line.h"
+#include "base/environment.h"
+#include "base/strings/string_split.h"
#include "gpu/command_buffer/client/gles2_lib.h"
+#include "gpu/command_buffer/service/gpu_switches.h"
+#include "gpu/config/gpu_util.h"
#include "gpu/gles2_conform_support/egl/display.h"
#include "ui/gl/gl_context.h"
#include "ui/gl/gl_surface.h"
@@ -107,9 +111,26 @@ EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy,
// eglInitialize can be called multiple times, prevent InitializeOneOff from
// being called multiple times.
if (gfx::GetGLImplementation() == gfx::kGLImplementationNone) {
- int argc = 1;
- const char* const argv[] = {"dummy"};
- base::CommandLine::Init(argc, argv);
+ scoped_ptr<base::Environment> env(base::Environment::Create());
+ std::vector<std::string> args;
+ std::string env_args;
+ if (env->GetVar("CHROME_COMMAND_BUFFER_GLES2_ARGS", &env_args)) {
+ args = base::SplitString(env_args, " ", base::TRIM_WHITESPACE,
+ base::SPLIT_WANT_NONEMPTY);
+ }
+ if (args.empty()) {
+ args.push_back("dummy");
+ }
+ scoped_ptr<const char* []> argv(new const char*[args.size()]);
+ for (size_t i = 0; i < args.size(); ++i) {
+ argv[i] = args[i].c_str();
+ }
+ base::CommandLine::Init(args.size(), argv.get());
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ if (!command_line->HasSwitch(switches::kDisableGpuDriverBugWorkarounds)) {
+ gpu::ApplyGpuDriverBugWorkarounds(command_line);
+ }
+
gfx::GLSurface::InitializeOneOff();
}
« no previous file with comments | « gpu/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698