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

Side by Side Diff: src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp

Issue 137753005: Make GrGLInterface be context-specific on all platforms (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp ('k') | 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 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "gl/GrGLExtensions.h" 10 #include "gl/GrGLExtensions.h"
(...skipping 23 matching lines...) Expand all
34 FreeLibrary(fModule); 34 FreeLibrary(fModule);
35 } 35 }
36 } 36 }
37 HMODULE get() const { return fModule; } 37 HMODULE get() const { return fModule; }
38 38
39 private: 39 private:
40 HMODULE fModule; 40 HMODULE fModule;
41 }; 41 };
42 42
43 const GrGLInterface* GrGLCreateNativeInterface() { 43 const GrGLInterface* GrGLCreateNativeInterface() {
44 // wglGetProcAddress requires a context.
45 // GL Function pointers retrieved in one context may not be valid in another
46 // context. For that reason we create a new GrGLInterface each time we're
47 // called.
48 AutoLibraryUnload alu("opengl32.dll"); 44 AutoLibraryUnload alu("opengl32.dll");
49 if (NULL == alu.get()) { 45 if (NULL == alu.get()) {
50 return NULL; 46 return NULL;
51 } 47 }
52 48
53 if (NULL != wglGetCurrentContext()) { 49 if (NULL != wglGetCurrentContext()) {
54 50
55 // These should always be present and don't require wglGetProcAddress 51 // These should always be present and don't require wglGetProcAddress
56 GrGLGetStringProc glGetString = 52 GrGLGetStringProc glGetString =
57 (GrGLGetStringProc) GetProcAddress(alu.get(), "glGetString"); 53 (GrGLGetStringProc) GetProcAddress(alu.get(), "glGetString");
(...skipping 10 matching lines...) Expand all
68 if (!extensions.init(kDesktop_GrGLBinding, glGetString, glGetStringi, gl GetIntegerv)) { 64 if (!extensions.init(kDesktop_GrGLBinding, glGetString, glGetStringi, gl GetIntegerv)) {
69 return NULL; 65 return NULL;
70 } 66 }
71 const char* versionString = (const char*) glGetString(GR_GL_VERSION); 67 const char* versionString = (const char*) glGetString(GR_GL_VERSION);
72 GrGLVersion glVer = GrGLGetVersionFromString(versionString); 68 GrGLVersion glVer = GrGLGetVersionFromString(versionString);
73 69
74 if (glVer < GR_GL_VER(1,5)) { 70 if (glVer < GR_GL_VER(1,5)) {
75 // We must have array and element_array buffer objects. 71 // We must have array and element_array buffer objects.
76 return NULL; 72 return NULL;
77 } 73 }
78 GrGLInterface* interface = new GrGLInterface(); 74 GrGLInterface* interface = SkNEW(GrGLInterface);
79 75
80 // Functions that are part of GL 1.1 will return NULL in 76 // Functions that are part of GL 1.1 will return NULL in
81 // wglGetProcAddress 77 // wglGetProcAddress
82 SET_PROC(BindTexture) 78 SET_PROC(BindTexture)
83 SET_PROC(BlendFunc) 79 SET_PROC(BlendFunc)
84 80
85 if (glVer >= GR_GL_VER(1,4) || 81 if (glVer >= GR_GL_VER(1,4) ||
86 extensions.has("GL_ARB_imaging") || 82 extensions.has("GL_ARB_imaging") ||
87 extensions.has("GL_EXT_blend_color")) { 83 extensions.has("GL_EXT_blend_color")) {
88 WGL_SET_PROC(BlendColor); 84 WGL_SET_PROC(BlendColor);
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 WGL_SET_PROC_SUFFIX(PointAlongPath, NV); 307 WGL_SET_PROC_SUFFIX(PointAlongPath, NV);
312 } 308 }
313 309
314 interface->fBindingsExported = kDesktop_GrGLBinding; 310 interface->fBindingsExported = kDesktop_GrGLBinding;
315 311
316 return interface; 312 return interface;
317 } else { 313 } else {
318 return NULL; 314 return NULL;
319 } 315 }
320 } 316 }
OLDNEW
« no previous file with comments | « src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698