OLD | NEW |
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 // This file contains the GLES2Decoder class. | 5 // This file contains the GLES2Decoder class. |
6 | 6 |
7 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_H_ | 7 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_H_ |
8 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_H_ | 8 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_H_ |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/callback_old.h" | 13 #include "base/callback_old.h" |
14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
15 #include "gpu/command_buffer/service/common_decoder.h" | 15 #include "gpu/command_buffer/service/common_decoder.h" |
16 #include "ui/gfx/size.h" | 16 #include "ui/gfx/size.h" |
17 | 17 |
18 namespace gfx { | 18 namespace gfx { |
19 class GLContext; | 19 class GLContext; |
| 20 class GLSurface; |
20 } | 21 } |
21 | 22 |
22 namespace gpu { | 23 namespace gpu { |
23 | 24 |
24 namespace gles2 { | 25 namespace gles2 { |
25 | 26 |
26 class ContextGroup; | 27 class ContextGroup; |
27 class GLES2Util; | 28 class GLES2Util; |
28 | 29 |
29 struct DisallowedExtensions { | 30 struct DisallowedExtensions { |
(...skipping 18 matching lines...) Expand all Loading... |
48 } | 49 } |
49 | 50 |
50 void set_debug(bool debug) { | 51 void set_debug(bool debug) { |
51 debug_ = debug; | 52 debug_ = debug; |
52 } | 53 } |
53 | 54 |
54 // Initializes the graphics context. Can create an offscreen | 55 // Initializes the graphics context. Can create an offscreen |
55 // decoder with a frame buffer that can be referenced from the parent. | 56 // decoder with a frame buffer that can be referenced from the parent. |
56 // Takes ownership of GLContext. | 57 // Takes ownership of GLContext. |
57 // Parameters: | 58 // Parameters: |
| 59 // surface: the GL surface to render to. |
58 // context: the GL context to render to. | 60 // context: the GL context to render to. |
59 // size: the size if the GL context is offscreen. | 61 // size: the size if the GL context is offscreen. |
60 // allowed_extensions: A string in the same format as | 62 // allowed_extensions: A string in the same format as |
61 // glGetString(GL_EXTENSIONS) that lists the extensions this context | 63 // glGetString(GL_EXTENSIONS) that lists the extensions this context |
62 // should allow. Passing NULL or "*" means allow all extensions. | 64 // should allow. Passing NULL or "*" means allow all extensions. |
63 // parent: the GLES2 decoder that can access this decoder's front buffer | 65 // parent: the GLES2 decoder that can access this decoder's front buffer |
64 // through a texture ID in its namespace. | 66 // through a texture ID in its namespace. |
65 // parent_client_texture_id: the texture ID of the front buffer in the | 67 // parent_client_texture_id: the texture ID of the front buffer in the |
66 // parent's namespace. | 68 // parent's namespace. |
67 // Returns: | 69 // Returns: |
68 // true if successful. | 70 // true if successful. |
69 virtual bool Initialize(gfx::GLContext* context, | 71 virtual bool Initialize(gfx::GLSurface* surface, |
| 72 gfx::GLContext* context, |
70 const gfx::Size& size, | 73 const gfx::Size& size, |
71 const DisallowedExtensions& disallowed_extensions, | 74 const DisallowedExtensions& disallowed_extensions, |
72 const char* allowed_extensions, | 75 const char* allowed_extensions, |
73 const std::vector<int32>& attribs, | 76 const std::vector<int32>& attribs, |
74 GLES2Decoder* parent, | 77 GLES2Decoder* parent, |
75 uint32 parent_client_texture_id) = 0; | 78 uint32 parent_client_texture_id) = 0; |
76 | 79 |
77 // Destroys the graphics context. | 80 // Destroys the graphics context. |
78 virtual void Destroy() = 0; | 81 virtual void Destroy() = 0; |
79 | 82 |
80 // Resize an offscreen frame buffer. | 83 // Resize an offscreen frame buffer. |
81 virtual void ResizeOffscreenFrameBuffer(const gfx::Size& size) = 0; | 84 virtual void ResizeOffscreenFrameBuffer(const gfx::Size& size) = 0; |
82 | 85 |
83 // Force the offscreen frame buffer's size to be updated. This | 86 // Force the offscreen frame buffer's size to be updated. This |
84 // usually occurs lazily, during SwapBuffers, but on some platforms | 87 // usually occurs lazily, during SwapBuffers, but on some platforms |
85 // (Mac OS X in particular) it must be done immediately. | 88 // (Mac OS X in particular) it must be done immediately. |
86 virtual bool UpdateOffscreenFrameBufferSize() = 0; | 89 virtual bool UpdateOffscreenFrameBufferSize() = 0; |
87 | 90 |
88 // Make this decoder's GL context current. | 91 // Make this decoder's GL context current. |
89 virtual bool MakeCurrent() = 0; | 92 virtual bool MakeCurrent() = 0; |
90 | 93 |
91 // Gets the GLES2 Util which holds info. | 94 // Gets the GLES2 Util which holds info. |
92 virtual GLES2Util* GetGLES2Util() = 0; | 95 virtual GLES2Util* GetGLES2Util() = 0; |
93 | 96 |
| 97 // Gets the associated GLSurface. |
| 98 virtual gfx::GLSurface* GetGLSurface() = 0; |
| 99 |
94 // Gets the associated GLContext. | 100 // Gets the associated GLContext. |
95 virtual gfx::GLContext* GetGLContext() = 0; | 101 virtual gfx::GLContext* GetGLContext() = 0; |
96 | 102 |
97 // Gets the associated ContextGroup | 103 // Gets the associated ContextGroup |
98 virtual ContextGroup* GetContextGroup() = 0; | 104 virtual ContextGroup* GetContextGroup() = 0; |
99 | 105 |
100 // Sets a callback which is called when a glResizeCHROMIUM command | 106 // Sets a callback which is called when a glResizeCHROMIUM command |
101 // is processed. | 107 // is processed. |
102 virtual void SetResizeCallback(Callback1<gfx::Size>::Type* callback) = 0; | 108 virtual void SetResizeCallback(Callback1<gfx::Size>::Type* callback) = 0; |
103 | 109 |
(...skipping 16 matching lines...) Expand all Loading... |
120 private: | 126 private: |
121 bool debug_; | 127 bool debug_; |
122 | 128 |
123 DISALLOW_COPY_AND_ASSIGN(GLES2Decoder); | 129 DISALLOW_COPY_AND_ASSIGN(GLES2Decoder); |
124 }; | 130 }; |
125 | 131 |
126 } // namespace gles2 | 132 } // namespace gles2 |
127 } // namespace gpu | 133 } // namespace gpu |
128 | 134 |
129 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_H_ | 135 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_H_ |
OLD | NEW |