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_SERVICE_BUFFER_MANAGER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_BUFFER_MANAGER_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_BUFFER_MANAGER_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_BUFFER_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "gpu/command_buffer/service/gl_utils.h" | 14 #include "gpu/command_buffer/service/gl_utils.h" |
15 #include "gpu/command_buffer/service/memory_tracking.h" | 15 #include "gpu/command_buffer/service/memory_tracking.h" |
16 #include "gpu/gpu_export.h" | 16 #include "gpu/gpu_export.h" |
17 | 17 |
18 namespace gpu { | 18 namespace gpu { |
19 namespace gles2 { | 19 namespace gles2 { |
20 | 20 |
21 class BufferManager; | 21 class BufferManager; |
| 22 class ErrorState; |
22 class FeatureInfo; | 23 class FeatureInfo; |
23 class GLES2Decoder; | |
24 | 24 |
25 // Info about Buffers currently in the system. | 25 // Info about Buffers currently in the system. |
26 class GPU_EXPORT Buffer : public base::RefCounted<Buffer> { | 26 class GPU_EXPORT Buffer : public base::RefCounted<Buffer> { |
27 public: | 27 public: |
28 Buffer(BufferManager* manager, GLuint service_id); | 28 Buffer(BufferManager* manager, GLuint service_id); |
29 | 29 |
30 GLuint service_id() const { | 30 GLuint service_id() const { |
31 return service_id_; | 31 return service_id_; |
32 } | 32 } |
33 | 33 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 187 |
188 // Removes a buffer info for the given buffer. | 188 // Removes a buffer info for the given buffer. |
189 void RemoveBuffer(GLuint client_id); | 189 void RemoveBuffer(GLuint client_id); |
190 | 190 |
191 // Gets a client id for a given service id. | 191 // Gets a client id for a given service id. |
192 bool GetClientId(GLuint service_id, GLuint* client_id) const; | 192 bool GetClientId(GLuint service_id, GLuint* client_id) const; |
193 | 193 |
194 // Does a glBufferData and updates the approprate accounting. Currently | 194 // Does a glBufferData and updates the approprate accounting. Currently |
195 // assume the values have already been validated. | 195 // assume the values have already been validated. |
196 void DoBufferData( | 196 void DoBufferData( |
197 GLES2Decoder* decoder, | 197 ErrorState* error_state, |
198 Buffer* buffer, | 198 Buffer* buffer, |
199 GLsizeiptr size, | 199 GLsizeiptr size, |
200 GLenum usage, | 200 GLenum usage, |
201 const GLvoid* data); | 201 const GLvoid* data); |
202 | 202 |
203 // Does a glBufferSubData and updates the approrate accounting. | 203 // Does a glBufferSubData and updates the approrate accounting. |
204 void DoBufferSubData( | 204 void DoBufferSubData( |
205 GLES2Decoder* decoder, | 205 ErrorState* error_state, |
206 Buffer* buffer, | 206 Buffer* buffer, |
207 GLintptr offset, | 207 GLintptr offset, |
208 GLsizeiptr size, | 208 GLsizeiptr size, |
209 const GLvoid* data); | 209 const GLvoid* data); |
210 | 210 |
211 // Sets the target of a buffer. Returns false if the target can not be set. | 211 // Sets the target of a buffer. Returns false if the target can not be set. |
212 bool SetTarget(Buffer* buffer, GLenum target); | 212 bool SetTarget(Buffer* buffer, GLenum target); |
213 | 213 |
214 void set_allow_buffers_on_multiple_targets(bool allow) { | 214 void set_allow_buffers_on_multiple_targets(bool allow) { |
215 allow_buffers_on_multiple_targets_ = allow; | 215 allow_buffers_on_multiple_targets_ = allow; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 bool have_context_; | 249 bool have_context_; |
250 bool use_client_side_arrays_for_stream_buffers_; | 250 bool use_client_side_arrays_for_stream_buffers_; |
251 | 251 |
252 DISALLOW_COPY_AND_ASSIGN(BufferManager); | 252 DISALLOW_COPY_AND_ASSIGN(BufferManager); |
253 }; | 253 }; |
254 | 254 |
255 } // namespace gles2 | 255 } // namespace gles2 |
256 } // namespace gpu | 256 } // namespace gpu |
257 | 257 |
258 #endif // GPU_COMMAND_BUFFER_SERVICE_BUFFER_MANAGER_H_ | 258 #endif // GPU_COMMAND_BUFFER_SERVICE_BUFFER_MANAGER_H_ |
OLD | NEW |