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 |
| 622 // Free every async upload buffer. If some async upload buffer is still in use |
| 623 // wait for them to finish before freeing. |
| 624 void FreeAllAsyncUploadBuffers(); |
| 625 |
594 bool GetBoundPixelTransferBuffer( | 626 bool GetBoundPixelTransferBuffer( |
595 GLenum target, const char* function_name, GLuint* buffer_id); | 627 GLenum target, const char* function_name, GLuint* buffer_id); |
596 BufferTracker::Buffer* GetBoundPixelUnpackTransferBufferIfValid( | 628 BufferTracker::Buffer* GetBoundPixelUnpackTransferBufferIfValid( |
597 GLuint buffer_id, | 629 GLuint buffer_id, |
598 const char* function_name, GLuint offset, GLsizei size); | 630 const char* function_name, GLuint offset, GLsizei size); |
599 | 631 |
600 const std::string& GetLogPrefix() const; | 632 const std::string& GetLogPrefix() const; |
601 | 633 |
602 #if defined(GL_CLIENT_FAIL_GL_ERRORS) | 634 #if defined(GL_CLIENT_FAIL_GL_ERRORS) |
603 void CheckGLError(); | 635 void CheckGLError(); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 // The program in use by glUseProgram | 688 // The program in use by glUseProgram |
657 GLuint current_program_; | 689 GLuint current_program_; |
658 | 690 |
659 // The currently bound array buffer. | 691 // The currently bound array buffer. |
660 GLuint bound_array_buffer_id_; | 692 GLuint bound_array_buffer_id_; |
661 | 693 |
662 // The currently bound pixel transfer buffers. | 694 // The currently bound pixel transfer buffers. |
663 GLuint bound_pixel_pack_transfer_buffer_id_; | 695 GLuint bound_pixel_pack_transfer_buffer_id_; |
664 GLuint bound_pixel_unpack_transfer_buffer_id_; | 696 GLuint bound_pixel_unpack_transfer_buffer_id_; |
665 | 697 |
| 698 // The current asynchronous pixel buffer upload token. |
| 699 uint32 async_upload_token_; |
| 700 |
| 701 // The shared memory used for synchronizing asynchronous upload tokens. |
| 702 AsyncUploadSync* async_upload_sync_; |
| 703 int32 async_upload_sync_shm_id_; |
| 704 unsigned int async_upload_sync_shm_offset_; |
| 705 |
| 706 // Unmanaged pixel transfer buffer memory pending asynchronous upload token. |
| 707 typedef std::list<std::pair<void*, uint32> > DetachedAsyncUploadMemoryList; |
| 708 DetachedAsyncUploadMemoryList detached_async_upload_memory_; |
| 709 |
666 // Client side management for vertex array objects. Needed to correctly | 710 // Client side management for vertex array objects. Needed to correctly |
667 // track client side arrays. | 711 // track client side arrays. |
668 scoped_ptr<VertexArrayObjectManager> vertex_array_object_manager_; | 712 scoped_ptr<VertexArrayObjectManager> vertex_array_object_manager_; |
669 | 713 |
670 GLuint reserved_ids_[2]; | 714 GLuint reserved_ids_[2]; |
671 | 715 |
672 // Current GL error bits. | 716 // Current GL error bits. |
673 uint32 error_bits_; | 717 uint32 error_bits_; |
674 | 718 |
675 // Whether or not to print debugging info. | 719 // Whether or not to print debugging info. |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 | 798 |
755 inline bool GLES2Implementation::GetTexParameterivHelper( | 799 inline bool GLES2Implementation::GetTexParameterivHelper( |
756 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { | 800 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { |
757 return false; | 801 return false; |
758 } | 802 } |
759 | 803 |
760 } // namespace gles2 | 804 } // namespace gles2 |
761 } // namespace gpu | 805 } // namespace gpu |
762 | 806 |
763 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ | 807 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ |
OLD | NEW |