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

Side by Side Diff: ui/gl/gl_implementation_win.cc

Issue 11266023: Make GL calls go through subclassable class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « ui/gl/gl_implementation_mac.cc ('k') | ui/gl/gl_osmesa_api_implementation.h » ('j') | 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 <vector> 5 #include <vector>
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/base_paths.h" 8 #include "base/base_paths.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/native_library.h" 13 #include "base/native_library.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/stringprintf.h" 15 #include "base/stringprintf.h"
16 #include "base/threading/thread_restrictions.h" 16 #include "base/threading/thread_restrictions.h"
17 #include "ui/gl/gl_bindings.h" 17 #include "ui/gl/gl_bindings.h"
18 #include "ui/gl/gl_egl_api_implementation.h"
19 #include "ui/gl/gl_gl_api_implementation.h"
18 #include "ui/gl/gl_implementation.h" 20 #include "ui/gl/gl_implementation.h"
21 #include "ui/gl/gl_osmesa_api_implementation.h"
22 #include "ui/gl/gl_wgl_api_implementation.h"
19 23
20 #if defined(ENABLE_SWIFTSHADER) 24 #if defined(ENABLE_SWIFTSHADER)
21 #include "software_renderer.h" 25 #include "software_renderer.h"
22 #endif 26 #endif
23 27
24 namespace gfx { 28 namespace gfx {
25 29
26 namespace { 30 namespace {
31
27 // This is the D3DX_SDK_VERSION for the last 'separate' DirectX SDK which 32 // This is the D3DX_SDK_VERSION for the last 'separate' DirectX SDK which
28 // is from June 2010. Since June 2012 Microsoft includes DirectX in the regular 33 // is from June 2010. Since June 2012 Microsoft includes DirectX in the regular
29 // Windows SDK and the D3DX library has been deprecated. 34 // Windows SDK and the D3DX library has been deprecated.
30 const int kPinnedD3DXVersion = 43; 35 const int kPinnedD3DXVersion = 43;
31 36
32 void GL_BINDING_CALL MarshalClearDepthToClearDepthf(GLclampd depth) { 37 void GL_BINDING_CALL MarshalClearDepthToClearDepthf(GLclampd depth) {
33 glClearDepthf(static_cast<GLclampf>(depth)); 38 glClearDepthf(static_cast<GLclampf>(depth));
34 } 39 }
35 40
36 void GL_BINDING_CALL MarshalDepthRangeToDepthRangef(GLclampd z_near, 41 void GL_BINDING_CALL MarshalDepthRangeToDepthRangef(GLclampd z_near,
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 SetGLGetProcAddressProc(get_proc_address); 179 SetGLGetProcAddressProc(get_proc_address);
175 AddGLNativeLibrary(egl_library); 180 AddGLNativeLibrary(egl_library);
176 AddGLNativeLibrary(gles_library); 181 AddGLNativeLibrary(gles_library);
177 SetGLImplementation(kGLImplementationEGLGLES2); 182 SetGLImplementation(kGLImplementationEGLGLES2);
178 183
179 InitializeGLBindingsGL(); 184 InitializeGLBindingsGL();
180 InitializeGLBindingsEGL(); 185 InitializeGLBindingsEGL();
181 186
182 // These two functions take single precision float rather than double 187 // These two functions take single precision float rather than double
183 // precision float parameters in GLES. 188 // precision float parameters in GLES.
184 ::gfx::g_glClearDepth = MarshalClearDepthToClearDepthf; 189 ::gfx::g_driver_gl.fn.glClearDepthFn = MarshalClearDepthToClearDepthf;
185 ::gfx::g_glDepthRange = MarshalDepthRangeToDepthRangef; 190 ::gfx::g_driver_gl.fn.glDepthRangeFn = MarshalDepthRangeToDepthRangef;
186 break; 191 break;
187 } 192 }
188 case kGLImplementationDesktopGL: { 193 case kGLImplementationDesktopGL: {
189 // When using Windows OpenGL, first try wglGetProcAddress and then 194 // When using Windows OpenGL, first try wglGetProcAddress and then
190 // Windows GetProcAddress. 195 // Windows GetProcAddress.
191 base::NativeLibrary library = base::LoadNativeLibrary( 196 base::NativeLibrary library = base::LoadNativeLibrary(
192 FilePath(L"opengl32.dll"), NULL); 197 FilePath(L"opengl32.dll"), NULL);
193 if (!library) { 198 if (!library) {
194 DVLOG(1) << "opengl32.dll not found"; 199 DVLOG(1) << "opengl32.dll not found";
195 return false; 200 return false;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 void ClearGLBindings() { 266 void ClearGLBindings() {
262 ClearGLBindingsEGL(); 267 ClearGLBindingsEGL();
263 ClearGLBindingsGL(); 268 ClearGLBindingsGL();
264 ClearGLBindingsOSMESA(); 269 ClearGLBindingsOSMESA();
265 ClearGLBindingsWGL(); 270 ClearGLBindingsWGL();
266 SetGLImplementation(kGLImplementationNone); 271 SetGLImplementation(kGLImplementationNone);
267 UnloadGLNativeLibraries(); 272 UnloadGLNativeLibraries();
268 } 273 }
269 274
270 } // namespace gfx 275 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gl/gl_implementation_mac.cc ('k') | ui/gl/gl_osmesa_api_implementation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698