OLD | NEW |
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 #ifndef GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ | 5 #ifndef GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ |
6 #define GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ | 6 #define GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ |
7 | 7 |
8 #include <GLES2/gl2.h> | 8 #include <GLES2/gl2.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <queue> | 11 #include <queue> |
12 #include <set> | 12 #include <set> |
13 #include <string> | 13 #include <string> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
| 16 #include "../common/compiler_specific.h" |
16 #include "../common/debug_marker_manager.h" | 17 #include "../common/debug_marker_manager.h" |
17 #include "../common/gles2_cmd_utils.h" | 18 #include "../common/gles2_cmd_utils.h" |
18 #include "../common/scoped_ptr.h" | 19 #include "../common/scoped_ptr.h" |
19 #include "../client/ref_counted.h" | 20 #include "../client/ref_counted.h" |
20 #include "../client/gles2_cmd_helper.h" | 21 #include "../client/gles2_cmd_helper.h" |
| 22 #include "../client/gles2_interface.h" |
21 #include "../client/query_tracker.h" | 23 #include "../client/query_tracker.h" |
22 #include "../client/ring_buffer.h" | 24 #include "../client/ring_buffer.h" |
23 #include "../client/share_group.h" | 25 #include "../client/share_group.h" |
24 #include "gles2_impl_export.h" | 26 #include "gles2_impl_export.h" |
25 | 27 |
26 #if !defined(NDEBUG) && !defined(__native_client__) && !defined(GLES2_CONFORMANC
E_TESTS) // NOLINT | 28 #if !defined(NDEBUG) && !defined(__native_client__) && !defined(GLES2_CONFORMANC
E_TESTS) // NOLINT |
27 #if defined(GLES2_INLINE_OPTIMIZATION) | 29 #if defined(GLES2_INLINE_OPTIMIZATION) |
28 // TODO(gman): Replace with macros that work with inline optmization. | 30 // TODO(gman): Replace with macros that work with inline optmization. |
29 #define GPU_CLIENT_SINGLE_THREAD_CHECK() | 31 #define GPU_CLIENT_SINGLE_THREAD_CHECK() |
30 #define GPU_CLIENT_LOG(args) | 32 #define GPU_CLIENT_LOG(args) |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 namespace gles2 { | 93 namespace gles2 { |
92 | 94 |
93 class ClientSideBufferHelper; | 95 class ClientSideBufferHelper; |
94 | 96 |
95 // This class emulates GLES2 over command buffers. It can be used by a client | 97 // This class emulates GLES2 over command buffers. It can be used by a client |
96 // program so that the program does not need deal with shared memory and command | 98 // program so that the program does not need deal with shared memory and command |
97 // buffer management. See gl2_lib.h. Note that there is a performance gain to | 99 // buffer management. See gl2_lib.h. Note that there is a performance gain to |
98 // be had by changing your code to use command buffers directly by using the | 100 // be had by changing your code to use command buffers directly by using the |
99 // GLES2CmdHelper but that entails changing your code to use and deal with | 101 // GLES2CmdHelper but that entails changing your code to use and deal with |
100 // shared memory and synchronization issues. | 102 // shared memory and synchronization issues. |
101 class GLES2_IMPL_EXPORT GLES2Implementation { | 103 class GLES2_IMPL_EXPORT GLES2Implementation : public GLES2Interface { |
102 public: | 104 public: |
103 class ErrorMessageCallback { | 105 class ErrorMessageCallback { |
104 public: | 106 public: |
105 virtual ~ErrorMessageCallback() { } | 107 virtual ~ErrorMessageCallback() { } |
106 virtual void OnErrorMessage(const char* msg, int id) = 0; | 108 virtual void OnErrorMessage(const char* msg, int id) = 0; |
107 }; | 109 }; |
108 | 110 |
109 // Stores client side cached GL state. | 111 // Stores client side cached GL state. |
110 struct GLCachedState { | 112 struct GLCachedState { |
111 struct GLES2_IMPL_EXPORT IntState { | 113 struct GLES2_IMPL_EXPORT IntState { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 // Number of swap buffers allowed before waiting. | 175 // Number of swap buffers allowed before waiting. |
174 static const size_t kMaxSwapBuffers = 2; | 176 static const size_t kMaxSwapBuffers = 2; |
175 | 177 |
176 GLES2Implementation( | 178 GLES2Implementation( |
177 GLES2CmdHelper* helper, | 179 GLES2CmdHelper* helper, |
178 ShareGroup* share_group, | 180 ShareGroup* share_group, |
179 TransferBufferInterface* transfer_buffer, | 181 TransferBufferInterface* transfer_buffer, |
180 bool share_resources, | 182 bool share_resources, |
181 bool bind_generates_resource); | 183 bool bind_generates_resource); |
182 | 184 |
183 ~GLES2Implementation(); | 185 virtual ~GLES2Implementation(); |
184 | 186 |
185 bool Initialize( | 187 bool Initialize( |
186 unsigned int starting_transfer_buffer_size, | 188 unsigned int starting_transfer_buffer_size, |
187 unsigned int min_transfer_buffer_size, | 189 unsigned int min_transfer_buffer_size, |
188 unsigned int max_transfer_buffer_size); | 190 unsigned int max_transfer_buffer_size); |
189 | 191 |
190 // The GLES2CmdHelper being used by this GLES2Implementation. You can use | 192 // The GLES2CmdHelper being used by this GLES2Implementation. You can use |
191 // this to issue cmds at a lower level for certain kinds of optimization. | 193 // this to issue cmds at a lower level for certain kinds of optimization. |
192 GLES2CmdHelper* helper() const; | 194 GLES2CmdHelper* helper() const; |
193 | 195 |
194 // Gets client side generated errors. | 196 // Gets client side generated errors. |
195 GLenum GetClientSideGLError(); | 197 GLenum GetClientSideGLError(); |
196 | 198 |
197 // Include the auto-generated part of this class. We split this because | 199 // Include the auto-generated part of this class. We split this because |
198 // it means we can easily edit the non-auto generated parts right here in | 200 // it means we can easily edit the non-auto generated parts right here in |
199 // this file instead of having to edit some template or the code generator. | 201 // this file instead of having to edit some template or the code generator. |
200 #include "../client/gles2_implementation_autogen.h" | 202 #include "../client/gles2_implementation_autogen.h" |
201 | 203 |
202 void DisableVertexAttribArray(GLuint index); | 204 virtual void DisableVertexAttribArray(GLuint index) OVERRIDE; |
203 void EnableVertexAttribArray(GLuint index); | 205 virtual void EnableVertexAttribArray(GLuint index) OVERRIDE; |
204 void GetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params); | 206 virtual void GetVertexAttribfv( |
205 void GetVertexAttribiv(GLuint index, GLenum pname, GLint* params); | 207 GLuint index, GLenum pname, GLfloat* params) OVERRIDE; |
| 208 virtual void GetVertexAttribiv( |
| 209 GLuint index, GLenum pname, GLint* params) OVERRIDE; |
206 | 210 |
207 void GetProgramInfoCHROMIUMHelper(GLuint program, std::vector<int8>* result); | 211 void GetProgramInfoCHROMIUMHelper(GLuint program, std::vector<int8>* result); |
208 GLint GetAttribLocationHelper(GLuint program, const char* name); | 212 GLint GetAttribLocationHelper(GLuint program, const char* name); |
209 GLint GetUniformLocationHelper(GLuint program, const char* name); | 213 GLint GetUniformLocationHelper(GLuint program, const char* name); |
210 bool GetActiveAttribHelper( | 214 bool GetActiveAttribHelper( |
211 GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, | 215 GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, |
212 GLint* size, GLenum* type, char* name); | 216 GLint* size, GLenum* type, char* name); |
213 bool GetActiveUniformHelper( | 217 bool GetActiveUniformHelper( |
214 GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, | 218 GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, |
215 GLint* size, GLenum* type, char* name); | 219 GLint* size, GLenum* type, char* name); |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 | 613 |
610 inline bool GLES2Implementation::GetTexParameterivHelper( | 614 inline bool GLES2Implementation::GetTexParameterivHelper( |
611 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { | 615 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { |
612 return false; | 616 return false; |
613 } | 617 } |
614 | 618 |
615 } // namespace gles2 | 619 } // namespace gles2 |
616 } // namespace gpu | 620 } // namespace gpu |
617 | 621 |
618 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ | 622 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ |
OLD | NEW |