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> |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 | 584 |
585 // Asserts that the context is lost. | 585 // Asserts that the context is lost. |
586 // NOTE: This is an expensive call and should only be called | 586 // NOTE: This is an expensive call and should only be called |
587 // for error checking. | 587 // for error checking. |
588 bool MustBeContextLost(); | 588 bool MustBeContextLost(); |
589 | 589 |
590 void RunIfContextNotLost(const base::Closure& callback); | 590 void RunIfContextNotLost(const base::Closure& callback); |
591 | 591 |
592 void OnSwapBuffersComplete(); | 592 void OnSwapBuffersComplete(); |
593 | 593 |
| 594 // Remove the transfer buffer from the buffer tracker. For buffers used |
| 595 // asynchronously the memory is free:ed if the upload has completed. For |
| 596 // other buffers, the memory is either free:ed immediately or free:ed pending |
| 597 // a token. |
| 598 void RemoveTransferBuffer(BufferTracker::Buffer* buffer); |
| 599 |
| 600 // Returns true if the async upload token has passed. |
| 601 // |
| 602 // NOTE: This will detect wrapped async tokens by checking if the most |
| 603 // significant bit of async token to check is 1 but the last read is 0, i.e. |
| 604 // the uint32 wrapped. |
| 605 bool HasAsyncUploadTokenPassed(uint32 token) const { |
| 606 return async_upload_sync_->HasAsyncUploadTokenPassed(token); |
| 607 } |
| 608 |
| 609 // Get the next async upload token. |
| 610 uint32 NextAsyncUploadToken(); |
| 611 |
| 612 // Ensure that the shared memory used for synchronizing async upload tokens |
| 613 // has been mapped. |
| 614 // |
| 615 // Returns false on error, true on success. |
| 616 bool EnsureAsyncUploadSync(); |
| 617 |
| 618 // Checks the last read asynchronously upload token and frees any unmanaged |
| 619 // transfer buffer that has its async token passed. |
| 620 void PollAsyncUploads(); |
| 621 |
594 bool GetBoundPixelTransferBuffer( | 622 bool GetBoundPixelTransferBuffer( |
595 GLenum target, const char* function_name, GLuint* buffer_id); | 623 GLenum target, const char* function_name, GLuint* buffer_id); |
596 BufferTracker::Buffer* GetBoundPixelUnpackTransferBufferIfValid( | 624 BufferTracker::Buffer* GetBoundPixelUnpackTransferBufferIfValid( |
597 GLuint buffer_id, | 625 GLuint buffer_id, |
598 const char* function_name, GLuint offset, GLsizei size); | 626 const char* function_name, GLuint offset, GLsizei size); |
599 | 627 |
600 const std::string& GetLogPrefix() const; | 628 const std::string& GetLogPrefix() const; |
601 | 629 |
602 #if defined(GL_CLIENT_FAIL_GL_ERRORS) | 630 #if defined(GL_CLIENT_FAIL_GL_ERRORS) |
603 void CheckGLError(); | 631 void CheckGLError(); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 // The program in use by glUseProgram | 684 // The program in use by glUseProgram |
657 GLuint current_program_; | 685 GLuint current_program_; |
658 | 686 |
659 // The currently bound array buffer. | 687 // The currently bound array buffer. |
660 GLuint bound_array_buffer_id_; | 688 GLuint bound_array_buffer_id_; |
661 | 689 |
662 // The currently bound pixel transfer buffers. | 690 // The currently bound pixel transfer buffers. |
663 GLuint bound_pixel_pack_transfer_buffer_id_; | 691 GLuint bound_pixel_pack_transfer_buffer_id_; |
664 GLuint bound_pixel_unpack_transfer_buffer_id_; | 692 GLuint bound_pixel_unpack_transfer_buffer_id_; |
665 | 693 |
| 694 // The current asynchronous pixel buffer upload token. |
| 695 uint32 async_upload_token_; |
| 696 |
| 697 // The shared memory used for synchronizing asynchronous upload tokens. |
| 698 AsyncUploadSync* async_upload_sync_; |
| 699 int32 async_upload_sync_shm_id_; |
| 700 unsigned int async_upload_sync_shm_offset_; |
| 701 |
| 702 // Unmanaged pixel transfer buffer memory pending asynchronous upload token. |
| 703 typedef std::list<std::pair<void*, uint32> > DetachedAsyncUploadMemoryList; |
| 704 DetachedAsyncUploadMemoryList detached_async_upload_memory_; |
| 705 |
666 // Client side management for vertex array objects. Needed to correctly | 706 // Client side management for vertex array objects. Needed to correctly |
667 // track client side arrays. | 707 // track client side arrays. |
668 scoped_ptr<VertexArrayObjectManager> vertex_array_object_manager_; | 708 scoped_ptr<VertexArrayObjectManager> vertex_array_object_manager_; |
669 | 709 |
670 GLuint reserved_ids_[2]; | 710 GLuint reserved_ids_[2]; |
671 | 711 |
672 // Current GL error bits. | 712 // Current GL error bits. |
673 uint32 error_bits_; | 713 uint32 error_bits_; |
674 | 714 |
675 // Whether or not to print debugging info. | 715 // Whether or not to print debugging info. |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 | 794 |
755 inline bool GLES2Implementation::GetTexParameterivHelper( | 795 inline bool GLES2Implementation::GetTexParameterivHelper( |
756 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { | 796 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { |
757 return false; | 797 return false; |
758 } | 798 } |
759 | 799 |
760 } // namespace gles2 | 800 } // namespace gles2 |
761 } // namespace gpu | 801 } // namespace gpu |
762 | 802 |
763 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ | 803 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ |
OLD | NEW |