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

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

Issue 10392068: ui: Move gl/ directory out of gfx/, up to ui/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix mac_rel Created 8 years, 7 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 | « ui/gfx/gl/gl_bindings_skia_in_process.cc ('k') | ui/gfx/gl/gl_context.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef UI_GFX_GL_GL_CONTEXT_H_
6 #define UI_GFX_GL_GL_CONTEXT_H_
7 #pragma once
8
9 #include <string>
10
11 #include "base/basictypes.h"
12 #include "base/memory/ref_counted.h"
13 #include "ui/gfx/gl/gl_share_group.h"
14 #include "ui/gfx/gl/gpu_preference.h"
15
16 namespace gfx {
17
18 class GLSurface;
19
20 // Encapsulates an OpenGL context, hiding platform specific management.
21 class GL_EXPORT GLContext : public base::RefCounted<GLContext> {
22 public:
23 explicit GLContext(GLShareGroup* share_group);
24
25 // Initializes the GL context to be compatible with the given surface. The GL
26 // context can be made with other surface's of the same type. The compatible
27 // surface is only needed for certain platforms like WGL, OSMesa and GLX. It
28 // should be specific for all platforms though.
29 virtual bool Initialize(
30 GLSurface* compatible_surface, GpuPreference gpu_preference) = 0;
31
32 // Destroys the GL context.
33 virtual void Destroy() = 0;
34
35 // Makes the GL context and a surface current on the current thread.
36 virtual bool MakeCurrent(GLSurface* surface) = 0;
37
38 // Releases this GL context and surface as current on the current thread.
39 virtual void ReleaseCurrent(GLSurface* surface) = 0;
40
41 // Returns true if this context and surface is current. Pass a null surface
42 // if the current surface is not important.
43 virtual bool IsCurrent(GLSurface* surface) = 0;
44
45 // Get the underlying platform specific GL context "handle".
46 virtual void* GetHandle() = 0;
47
48 // Set swap interval. This context must be current.
49 virtual void SetSwapInterval(int interval) = 0;
50
51 // Returns space separated list of extensions. The context must be current.
52 virtual std::string GetExtensions();
53
54 // Returns whether the current context supports the named extension. The
55 // context must be current.
56 bool HasExtension(const char* name);
57
58 GLShareGroup* share_group();
59
60 // Create a GL context that is compatible with the given surface.
61 // |share_group|, if non-NULL, is a group of contexts which the
62 // internally created OpenGL context shares textures and other resources.
63 static scoped_refptr<GLContext> CreateGLContext(
64 GLShareGroup* share_group,
65 GLSurface* compatible_surface,
66 GpuPreference gpu_preference);
67
68 static bool LosesAllContextsOnContextLost();
69
70 static bool SupportsDualGpus();
71
72 static GLContext* GetCurrent();
73
74 virtual bool WasAllocatedUsingARBRobustness();
75
76 protected:
77 virtual ~GLContext();
78 static void SetCurrent(GLContext* context, GLSurface* surface);
79
80 // Initialize function pointers to extension functions in the GL
81 // implementation. Should be called immediately after this context is made
82 // current.
83 bool InitializeExtensionBindings();
84
85 private:
86 scoped_refptr<GLShareGroup> share_group_;
87 friend class base::RefCounted<GLContext>;
88 DISALLOW_COPY_AND_ASSIGN(GLContext);
89 };
90
91 } // namespace gfx
92
93 #endif // UI_GFX_GL_GL_CONTEXT_H_
OLDNEW
« no previous file with comments | « ui/gfx/gl/gl_bindings_skia_in_process.cc ('k') | ui/gfx/gl/gl_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698