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 #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> |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 | 195 |
196 void FreeTextureId(GLuint id) { | 196 void FreeTextureId(GLuint id) { |
197 id_handlers_[id_namespaces::kTextures]->FreeIds(1, &id); | 197 id_handlers_[id_namespaces::kTextures]->FreeIds(1, &id); |
198 } | 198 } |
199 | 199 |
200 void SetSharedMemoryChunkSizeMultiple(unsigned int multiple); | 200 void SetSharedMemoryChunkSizeMultiple(unsigned int multiple); |
201 | 201 |
202 void FreeUnusedSharedMemory(); | 202 void FreeUnusedSharedMemory(); |
203 | 203 |
204 private: | 204 private: |
| 205 |
| 206 // Used to track whether an extension is available |
| 207 enum ExtensionStatus { |
| 208 kAvailableExtensionStatus, |
| 209 kUnavailableExtensionStatus, |
| 210 kUnknownExtensionStatus |
| 211 }; |
| 212 |
205 // Wraps RingBufferWrapper to provide aligned allocations. | 213 // Wraps RingBufferWrapper to provide aligned allocations. |
206 class AlignedRingBuffer : public RingBufferWrapper { | 214 class AlignedRingBuffer : public RingBufferWrapper { |
207 public: | 215 public: |
208 AlignedRingBuffer(RingBuffer::Offset base_offset, | 216 AlignedRingBuffer(RingBuffer::Offset base_offset, |
209 unsigned int size, | 217 unsigned int size, |
210 CommandBufferHelper *helper, | 218 CommandBufferHelper *helper, |
211 void *base) | 219 void *base) |
212 : RingBufferWrapper(base_offset, size, helper, base) { | 220 : RingBufferWrapper(base_offset, size, helper, base) { |
213 } | 221 } |
214 | 222 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 uint32 result_shm_offset() const { | 339 uint32 result_shm_offset() const { |
332 return result_shm_offset_; | 340 return result_shm_offset_; |
333 } | 341 } |
334 | 342 |
335 // Gets the value of the result. | 343 // Gets the value of the result. |
336 template <typename T> | 344 template <typename T> |
337 T GetResultAs() const { | 345 T GetResultAs() const { |
338 return static_cast<T>(result_buffer_); | 346 return static_cast<T>(result_buffer_); |
339 } | 347 } |
340 | 348 |
| 349 // Lazily determines if GL_ANGLE_pack_reverse_row_order is available |
| 350 bool IsAnglePackReverseRowOrderAvailable(); |
| 351 |
341 // Gets the GLError through our wrapper. | 352 // Gets the GLError through our wrapper. |
342 GLenum GetGLError(); | 353 GLenum GetGLError(); |
343 | 354 |
344 // Sets our wrapper for the GLError. | 355 // Sets our wrapper for the GLError. |
345 void SetGLError(GLenum error, const char* msg); | 356 void SetGLError(GLenum error, const char* msg); |
346 | 357 |
347 // Returns the last error and clears it. Useful for debugging. | 358 // Returns the last error and clears it. Useful for debugging. |
348 const std::string& GetLastError() { | 359 const std::string& GetLastError() { |
349 return last_error_; | 360 return last_error_; |
350 } | 361 } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 scoped_ptr<IdHandlerInterface> id_handlers_[id_namespaces::kNumIdNamespaces]; | 436 scoped_ptr<IdHandlerInterface> id_handlers_[id_namespaces::kNumIdNamespaces]; |
426 AlignedRingBuffer transfer_buffer_; | 437 AlignedRingBuffer transfer_buffer_; |
427 int transfer_buffer_id_; | 438 int transfer_buffer_id_; |
428 void* result_buffer_; | 439 void* result_buffer_; |
429 uint32 result_shm_offset_; | 440 uint32 result_shm_offset_; |
430 std::string last_error_; | 441 std::string last_error_; |
431 | 442 |
432 std::queue<int32> swap_buffers_tokens_; | 443 std::queue<int32> swap_buffers_tokens_; |
433 std::queue<int32> rate_limit_tokens_; | 444 std::queue<int32> rate_limit_tokens_; |
434 | 445 |
| 446 ExtensionStatus angle_pack_reverse_row_order_status; |
| 447 |
435 GLState gl_state_; | 448 GLState gl_state_; |
436 | 449 |
437 // pack alignment as last set by glPixelStorei | 450 // pack alignment as last set by glPixelStorei |
438 GLint pack_alignment_; | 451 GLint pack_alignment_; |
439 | 452 |
440 // unpack alignment as last set by glPixelStorei | 453 // unpack alignment as last set by glPixelStorei |
441 GLint unpack_alignment_; | 454 GLint unpack_alignment_; |
442 | 455 |
443 // unpack yflip as last set by glPixelstorei | 456 // unpack yflip as last set by glPixelstorei |
444 bool unpack_flip_y_; | 457 bool unpack_flip_y_; |
445 | 458 |
| 459 // pack reverse row order as last set by glPixelstorei |
| 460 bool pack_reverse_row_order_; |
| 461 |
446 scoped_array<TextureUnit> texture_units_; | 462 scoped_array<TextureUnit> texture_units_; |
447 | 463 |
448 // 0 to gl_state_.max_combined_texture_image_units. | 464 // 0 to gl_state_.max_combined_texture_image_units. |
449 GLuint active_texture_unit_; | 465 GLuint active_texture_unit_; |
450 | 466 |
451 GLuint bound_framebuffer_; | 467 GLuint bound_framebuffer_; |
452 GLuint bound_renderbuffer_; | 468 GLuint bound_renderbuffer_; |
453 | 469 |
454 // The currently bound array buffer. | 470 // The currently bound array buffer. |
455 GLuint bound_array_buffer_id_; | 471 GLuint bound_array_buffer_id_; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 | 546 |
531 inline bool GLES2Implementation::GetTexParameterivHelper( | 547 inline bool GLES2Implementation::GetTexParameterivHelper( |
532 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { | 548 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { |
533 return false; | 549 return false; |
534 } | 550 } |
535 | 551 |
536 } // namespace gles2 | 552 } // namespace gles2 |
537 } // namespace gpu | 553 } // namespace gpu |
538 | 554 |
539 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ | 555 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ |
OLD | NEW |