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

Side by Side 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: 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 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 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/environment.h"
9 #include "base/strings/string_split.h"
8 #include "gpu/command_buffer/client/gles2_lib.h" 10 #include "gpu/command_buffer/client/gles2_lib.h"
11 #include "gpu/command_buffer/service/gpu_switches.h"
12 #include "gpu/config/gpu_util.h"
9 #include "gpu/gles2_conform_support/egl/display.h" 13 #include "gpu/gles2_conform_support/egl/display.h"
10 #include "ui/gl/gl_context.h" 14 #include "ui/gl/gl_context.h"
11 #include "ui/gl/gl_surface.h" 15 #include "ui/gl/gl_surface.h"
12 16
13 #if REGAL_STATIC_EGL 17 #if REGAL_STATIC_EGL
14 extern "C" { 18 extern "C" {
15 19
16 typedef EGLContext RegalSystemContext; 20 typedef EGLContext RegalSystemContext;
17 #define REGAL_DECL 21 #define REGAL_DECL
18 REGAL_DECL void RegalMakeCurrent( RegalSystemContext ctx ); 22 REGAL_DECL void RegalMakeCurrent( RegalSystemContext ctx );
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 if (dpy == EGL_NO_DISPLAY) 104 if (dpy == EGL_NO_DISPLAY)
101 return EglError(EGL_BAD_DISPLAY, EGL_FALSE); 105 return EglError(EGL_BAD_DISPLAY, EGL_FALSE);
102 106
103 egl::Display* display = static_cast<egl::Display*>(dpy); 107 egl::Display* display = static_cast<egl::Display*>(dpy);
104 if (!display->Initialize()) 108 if (!display->Initialize())
105 return EglError(EGL_NOT_INITIALIZED, EGL_FALSE); 109 return EglError(EGL_NOT_INITIALIZED, EGL_FALSE);
106 110
107 // eglInitialize can be called multiple times, prevent InitializeOneOff from 111 // eglInitialize can be called multiple times, prevent InitializeOneOff from
108 // being called multiple times. 112 // being called multiple times.
109 if (gfx::GetGLImplementation() == gfx::kGLImplementationNone) { 113 if (gfx::GetGLImplementation() == gfx::kGLImplementationNone) {
110 int argc = 1; 114 scoped_ptr<base::Environment> env(base::Environment::Create());
111 const char* const argv[] = {"dummy"}; 115 std::vector<std::string> args;
112 base::CommandLine::Init(argc, argv); 116 std::string env_args;
117 if (env->GetVar("CHROME_COMMAND_BUFFER_GLES2_ARGS", &env_args)) {
118 args = base::SplitString(env_args, " ", base::TRIM_WHITESPACE,
119 base::SPLIT_WANT_NONEMPTY);
120 }
121 if (args.size() == 0) {
hendrikw 2015/12/17 18:39:18 Nit: if (args.empty())
Kimmo Kinnunen 2015/12/18 08:07:05 Done.
122 args.push_back("dummy");
123 }
124 scoped_ptr<const char* []> argv(new const char*[args.size()]);
125 for (size_t i = 0; i < args.size(); ++i) {
hendrikw 2015/12/17 18:39:18 Nit: range-for instead >> for (auto& arg : args)
Kimmo Kinnunen 2015/12/18 08:07:05 The index is used in the lhs of the assignment.
126 argv[i] = args[i].c_str();
127 }
128 base::CommandLine::Init(args.size(), argv.get());
129 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
130 if (!command_line->HasSwitch(switches::kDisableGpuDriverBugWorkarounds)) {
131 gpu::ApplyGpuDriverBugWorkarounds(command_line);
132 }
133
113 gfx::GLSurface::InitializeOneOff(); 134 gfx::GLSurface::InitializeOneOff();
114 } 135 }
115 136
116 *major = 1; 137 *major = 1;
117 *minor = 4; 138 *minor = 4;
118 return EglSuccess(EGL_TRUE); 139 return EglSuccess(EGL_TRUE);
119 } 140 }
120 141
121 EGLAPI EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy) { 142 EGLAPI EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy) {
122 EGLint error_code = ValidateDisplay(dpy); 143 EGLint error_code = ValidateDisplay(dpy);
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 return EGL_FALSE; 452 return EGL_FALSE;
432 } 453 }
433 454
434 /* Now, define eglGetProcAddress using the generic function ptr. type */ 455 /* Now, define eglGetProcAddress using the generic function ptr. type */
435 EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY 456 EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY
436 eglGetProcAddress(const char* procname) { 457 eglGetProcAddress(const char* procname) {
437 return reinterpret_cast<__eglMustCastToProperFunctionPointerType>( 458 return reinterpret_cast<__eglMustCastToProperFunctionPointerType>(
438 gles2::GetGLFunctionPointer(procname)); 459 gles2::GetGLFunctionPointer(procname));
439 } 460 }
440 } // extern "C" 461 } // 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