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