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 <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <queue> | 10 #include <queue> |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 // Validate if a size is valid, i.e., non-negative and fit into 32-bit. | 622 // Validate if a size is valid, i.e., non-negative and fit into 32-bit. |
623 // If not, generate an approriate error, and return false. | 623 // If not, generate an approriate error, and return false. |
624 bool ValidateSize(const char* func, GLsizeiptr offset); | 624 bool ValidateSize(const char* func, GLsizeiptr offset); |
625 | 625 |
626 // Remove the transfer buffer from the buffer tracker. For buffers used | 626 // Remove the transfer buffer from the buffer tracker. For buffers used |
627 // asynchronously the memory is free:ed if the upload has completed. For | 627 // asynchronously the memory is free:ed if the upload has completed. For |
628 // other buffers, the memory is either free:ed immediately or free:ed pending | 628 // other buffers, the memory is either free:ed immediately or free:ed pending |
629 // a token. | 629 // a token. |
630 void RemoveTransferBuffer(BufferTracker::Buffer* buffer); | 630 void RemoveTransferBuffer(BufferTracker::Buffer* buffer); |
631 | 631 |
632 // Returns true if the async upload token has passed. | |
633 // | |
634 // NOTE: This will detect wrapped async tokens by checking if the most | |
635 // significant bit of async token to check is 1 but the last read is 0, i.e. | |
636 // the uint32 wrapped. | |
637 bool HasAsyncUploadTokenPassed(uint32 token) const { | |
638 return async_upload_sync_->HasAsyncUploadTokenPassed(token); | |
639 } | |
640 | |
641 // Get the next async upload token. | |
642 uint32 NextAsyncUploadToken(); | |
643 | |
644 // Ensure that the shared memory used for synchronizing async upload tokens | |
645 // has been mapped. | |
646 // | |
647 // Returns false on error, true on success. | |
648 bool EnsureAsyncUploadSync(); | |
649 | |
650 // Checks the last read asynchronously upload token and frees any unmanaged | |
651 // transfer buffer that has its async token passed. | |
652 void PollAsyncUploads(); | |
653 | |
654 // Free every async upload buffer. If some async upload buffer is still in use | |
655 // wait for them to finish before freeing. | |
656 void FreeAllAsyncUploadBuffers(); | |
657 | |
658 bool GetBoundPixelTransferBuffer( | 632 bool GetBoundPixelTransferBuffer( |
659 GLenum target, const char* function_name, GLuint* buffer_id); | 633 GLenum target, const char* function_name, GLuint* buffer_id); |
660 BufferTracker::Buffer* GetBoundPixelUnpackTransferBufferIfValid( | 634 BufferTracker::Buffer* GetBoundPixelUnpackTransferBufferIfValid( |
661 GLuint buffer_id, | 635 GLuint buffer_id, |
662 const char* function_name, GLuint offset, GLsizei size); | 636 const char* function_name, GLuint offset, GLsizei size); |
663 | 637 |
664 // Pack 2D arrays of char into a bucket. | 638 // Pack 2D arrays of char into a bucket. |
665 // Helper function for ShaderSource(), TransformFeedbackVaryings(), etc. | 639 // Helper function for ShaderSource(), TransformFeedbackVaryings(), etc. |
666 bool PackStringsToBucket(GLsizei count, | 640 bool PackStringsToBucket(GLsizei count, |
667 const char* const* str, | 641 const char* const* str, |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 GLuint bound_copy_write_buffer_; | 717 GLuint bound_copy_write_buffer_; |
744 GLuint bound_pixel_pack_buffer_; | 718 GLuint bound_pixel_pack_buffer_; |
745 GLuint bound_pixel_unpack_buffer_; | 719 GLuint bound_pixel_unpack_buffer_; |
746 GLuint bound_transform_feedback_buffer_; | 720 GLuint bound_transform_feedback_buffer_; |
747 GLuint bound_uniform_buffer_; | 721 GLuint bound_uniform_buffer_; |
748 | 722 |
749 // The currently bound pixel transfer buffers. | 723 // The currently bound pixel transfer buffers. |
750 GLuint bound_pixel_pack_transfer_buffer_id_; | 724 GLuint bound_pixel_pack_transfer_buffer_id_; |
751 GLuint bound_pixel_unpack_transfer_buffer_id_; | 725 GLuint bound_pixel_unpack_transfer_buffer_id_; |
752 | 726 |
753 // The current asynchronous pixel buffer upload token. | |
754 uint32 async_upload_token_; | |
755 | |
756 // The shared memory used for synchronizing asynchronous upload tokens. | |
757 AsyncUploadSync* async_upload_sync_; | |
758 int32 async_upload_sync_shm_id_; | |
759 unsigned int async_upload_sync_shm_offset_; | |
760 | |
761 // Unmanaged pixel transfer buffer memory pending asynchronous upload token. | |
762 typedef std::list<std::pair<void*, uint32> > DetachedAsyncUploadMemoryList; | |
763 DetachedAsyncUploadMemoryList detached_async_upload_memory_; | |
764 | |
765 // Client side management for vertex array objects. Needed to correctly | 727 // Client side management for vertex array objects. Needed to correctly |
766 // track client side arrays. | 728 // track client side arrays. |
767 scoped_ptr<VertexArrayObjectManager> vertex_array_object_manager_; | 729 scoped_ptr<VertexArrayObjectManager> vertex_array_object_manager_; |
768 | 730 |
769 GLuint reserved_ids_[2]; | 731 GLuint reserved_ids_[2]; |
770 | 732 |
771 // Current GL error bits. | 733 // Current GL error bits. |
772 uint32 error_bits_; | 734 uint32 error_bits_; |
773 | 735 |
774 // Whether or not to print debugging info. | 736 // Whether or not to print debugging info. |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 | 826 |
865 inline bool GLES2Implementation::GetTexParameterivHelper( | 827 inline bool GLES2Implementation::GetTexParameterivHelper( |
866 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { | 828 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { |
867 return false; | 829 return false; |
868 } | 830 } |
869 | 831 |
870 } // namespace gles2 | 832 } // namespace gles2 |
871 } // namespace gpu | 833 } // namespace gpu |
872 | 834 |
873 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ | 835 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ |
OLD | NEW |