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

Side by Side Diff: gpu/gles2_conform_support/egl/egl.cc

Issue 1613103002: command_buffer_gles2: Fix command-line arguments if they are passed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sampler-binduniform-bug
Patch Set: win2 Created 4 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <EGL/egl.h> 5 #include <EGL/egl.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/environment.h" 9 #include "base/environment.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
11 #include "base/strings/string_util.h"
12 #include "base/strings/utf_string_conversions.h"
11 #include "gpu/command_buffer/client/gles2_lib.h" 13 #include "gpu/command_buffer/client/gles2_lib.h"
12 #include "gpu/command_buffer/service/gpu_switches.h" 14 #include "gpu/command_buffer/service/gpu_switches.h"
13 #include "gpu/config/gpu_util.h" 15 #include "gpu/config/gpu_util.h"
14 #include "gpu/gles2_conform_support/egl/display.h" 16 #include "gpu/gles2_conform_support/egl/display.h"
15 #include "ui/gl/gl_context.h" 17 #include "ui/gl/gl_context.h"
16 #include "ui/gl/gl_surface.h" 18 #include "ui/gl/gl_surface.h"
17 19
18 #if REGAL_STATIC_EGL 20 #if REGAL_STATIC_EGL
19 extern "C" { 21 extern "C" {
20 22
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 if (dpy == EGL_NO_DISPLAY) 107 if (dpy == EGL_NO_DISPLAY)
106 return EglError(EGL_BAD_DISPLAY, EGL_FALSE); 108 return EglError(EGL_BAD_DISPLAY, EGL_FALSE);
107 109
108 egl::Display* display = static_cast<egl::Display*>(dpy); 110 egl::Display* display = static_cast<egl::Display*>(dpy);
109 if (!display->Initialize()) 111 if (!display->Initialize())
110 return EglError(EGL_NOT_INITIALIZED, EGL_FALSE); 112 return EglError(EGL_NOT_INITIALIZED, EGL_FALSE);
111 113
112 // eglInitialize can be called multiple times, prevent InitializeOneOff from 114 // eglInitialize can be called multiple times, prevent InitializeOneOff from
113 // being called multiple times. 115 // being called multiple times.
114 if (gfx::GetGLImplementation() == gfx::kGLImplementationNone) { 116 if (gfx::GetGLImplementation() == gfx::kGLImplementationNone) {
117 base::CommandLine::StringVector argv;
115 scoped_ptr<base::Environment> env(base::Environment::Create()); 118 scoped_ptr<base::Environment> env(base::Environment::Create());
116 std::vector<std::string> args; 119 std::string env_string;
117 std::string env_args; 120 env->GetVar("CHROME_COMMAND_BUFFER_GLES2_ARGS", &env_string);
118 if (env->GetVar("CHROME_COMMAND_BUFFER_GLES2_ARGS", &env_args)) { 121 #if defined(OS_WIN)
119 args = base::SplitString(env_args, " ", base::TRIM_WHITESPACE, 122 argv = base::SplitString(base::UTF8ToUTF16(env_string),
120 base::SPLIT_WANT_NONEMPTY); 123 base::kWhitespaceUTF16, base::TRIM_WHITESPACE,
121 } 124 base::SPLIT_WANT_NONEMPTY);
122 if (args.empty()) { 125 argv.insert(argv.begin(), base::UTF8ToUTF16("dummy"));
123 args.push_back("dummy"); 126 #else
124 } 127 argv = base::SplitString(env_string,
125 scoped_ptr<const char* []> argv(new const char*[args.size()]); 128 base::kWhitespaceASCII, base::TRIM_WHITESPACE,
126 for (size_t i = 0; i < args.size(); ++i) { 129 base::SPLIT_WANT_NONEMPTY);
127 argv[i] = args[i].c_str(); 130 argv.insert(argv.begin(), "dummy");
128 } 131 #endif
129 base::CommandLine::Init(static_cast<int>(args.size()), argv.get()); 132 base::CommandLine::Init(0, nullptr);
130 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 133 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
134 // Need to call both Init and InitFromArgv, since Windows does not use
135 // argc, argv in CommandLine::Init(argc, argv).
136 command_line->InitFromArgv(argv);
131 if (!command_line->HasSwitch(switches::kDisableGpuDriverBugWorkarounds)) { 137 if (!command_line->HasSwitch(switches::kDisableGpuDriverBugWorkarounds)) {
132 gpu::ApplyGpuDriverBugWorkarounds(command_line); 138 gpu::ApplyGpuDriverBugWorkarounds(command_line);
133 } 139 }
134 140
135 gfx::GLSurface::InitializeOneOff(); 141 gfx::GLSurface::InitializeOneOff();
136 } 142 }
137 143
138 *major = 1; 144 *major = 1;
139 *minor = 4; 145 *minor = 4;
140 return EglSuccess(EGL_TRUE); 146 return EglSuccess(EGL_TRUE);
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 return EGL_FALSE; 459 return EGL_FALSE;
454 } 460 }
455 461
456 /* Now, define eglGetProcAddress using the generic function ptr. type */ 462 /* Now, define eglGetProcAddress using the generic function ptr. type */
457 EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY 463 EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY
458 eglGetProcAddress(const char* procname) { 464 eglGetProcAddress(const char* procname) {
459 return reinterpret_cast<__eglMustCastToProperFunctionPointerType>( 465 return reinterpret_cast<__eglMustCastToProperFunctionPointerType>(
460 gles2::GetGLFunctionPointer(procname)); 466 gles2::GetGLFunctionPointer(procname));
461 } 467 }
462 } // extern "C" 468 } // extern "C"
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698