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

Side by Side Diff: ui/gfx/gl/gl_context.cc

Issue 8566041: Allow GLSurface to indicate that it supports a specific extension. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix gpu_unittests. Created 9 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 | « gpu/command_buffer/service/gles2_cmd_decoder.cc ('k') | ui/gfx/gl/gl_surface.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <string> 5 #include <string>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/threading/thread_local.h" 10 #include "base/threading/thread_local.h"
(...skipping 21 matching lines...) Expand all
32 32
33 GLContext::~GLContext() { 33 GLContext::~GLContext() {
34 share_group_->RemoveContext(this); 34 share_group_->RemoveContext(this);
35 if (GetCurrent() == this) { 35 if (GetCurrent() == this) {
36 SetCurrent(NULL, NULL); 36 SetCurrent(NULL, NULL);
37 } 37 }
38 } 38 }
39 39
40 std::string GLContext::GetExtensions() { 40 std::string GLContext::GetExtensions() {
41 DCHECK(IsCurrent(NULL)); 41 DCHECK(IsCurrent(NULL));
42 const char* ext = reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS)); 42
43 return std::string(ext ? ext : ""); 43 std::string extensions;
44 if (GLSurface::GetCurrent()) {
45 extensions = GLSurface::GetCurrent()->GetExtensions();
46 }
47
48 const char* gl_ext = reinterpret_cast<const char*>(
49 glGetString(GL_EXTENSIONS));
50 if (gl_ext) {
51 extensions += (!extensions.empty() && gl_ext[0]) ? " " : "";
52 extensions += gl_ext;
53 }
54
55 return extensions;
44 } 56 }
45 57
46 bool GLContext::HasExtension(const char* name) { 58 bool GLContext::HasExtension(const char* name) {
47 std::string extensions = GetExtensions(); 59 std::string extensions = GetExtensions();
48 extensions += " "; 60 extensions += " ";
49 61
50 std::string delimited_name(name); 62 std::string delimited_name(name);
51 delimited_name += " "; 63 delimited_name += " ";
52 64
53 return extensions.find(delimited_name) != std::string::npos; 65 return extensions.find(delimited_name) != std::string::npos;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 static bool initialized = false; 104 static bool initialized = false;
93 if (initialized) 105 if (initialized)
94 return initialized; 106 return initialized;
95 initialized = InitializeGLExtensionBindings(GetGLImplementation(), this); 107 initialized = InitializeGLExtensionBindings(GetGLImplementation(), this);
96 if (!initialized) 108 if (!initialized)
97 LOG(ERROR) << "Could not initialize extension bindings."; 109 LOG(ERROR) << "Could not initialize extension bindings.";
98 return initialized; 110 return initialized;
99 } 111 }
100 112
101 } // namespace gfx 113 } // namespace gfx
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.cc ('k') | ui/gfx/gl/gl_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698