| 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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 | 589 |
| 590 // Asserts that the context is lost. | 590 // Asserts that the context is lost. |
| 591 // NOTE: This is an expensive call and should only be called | 591 // NOTE: This is an expensive call and should only be called |
| 592 // for error checking. | 592 // for error checking. |
| 593 bool MustBeContextLost(); | 593 bool MustBeContextLost(); |
| 594 | 594 |
| 595 void RunIfContextNotLost(const base::Closure& callback); | 595 void RunIfContextNotLost(const base::Closure& callback); |
| 596 | 596 |
| 597 void OnSwapBuffersComplete(); | 597 void OnSwapBuffersComplete(); |
| 598 | 598 |
| 599 // Remove the transfer buffer from the buffer tracker. For buffers used |
| 600 // asynchronously the memory is free:ed if the upload has completed. For |
| 601 // other buffers, the memory is either free:ed immediately or free:ed pending |
| 602 // a token. |
| 603 void RemoveTransferBuffer(BufferTracker::Buffer* buffer); |
| 604 |
| 605 // Returns true if the async upload token has passed. |
| 606 // |
| 607 // NOTE: This will detect wrapped async tokens by checking if the most |
| 608 // significant bit of async token to check is 1 but the last read is 0, i.e. |
| 609 // the uint32 wrapped. |
| 610 bool HasAsyncUploadTokenPassed(uint32 token) const { |
| 611 return async_upload_sync_->HasAsyncUploadTokenPassed(token); |
| 612 } |
| 613 |
| 614 // Get the next async upload token. |
| 615 uint32 NextAsyncUploadToken(); |
| 616 |
| 617 // Ensure that the shared memory used for synchronizing async upload tokens |
| 618 // has been mapped. |
| 619 // |
| 620 // Returns false on error, true on success. |
| 621 bool EnsureAsyncUploadSync(); |
| 622 |
| 623 // Checks the last read asynchronously upload token and frees any unmanaged |
| 624 // transfer buffer that has its async token passed. |
| 625 void PollAsyncUploads(); |
| 626 |
| 627 // Free every async upload buffer. If some async upload buffer is still in use |
| 628 // wait for them to finish before freeing. |
| 629 void FreeAllAsyncUploadBuffers(); |
| 630 |
| 599 bool GetBoundPixelTransferBuffer( | 631 bool GetBoundPixelTransferBuffer( |
| 600 GLenum target, const char* function_name, GLuint* buffer_id); | 632 GLenum target, const char* function_name, GLuint* buffer_id); |
| 601 BufferTracker::Buffer* GetBoundPixelUnpackTransferBufferIfValid( | 633 BufferTracker::Buffer* GetBoundPixelUnpackTransferBufferIfValid( |
| 602 GLuint buffer_id, | 634 GLuint buffer_id, |
| 603 const char* function_name, GLuint offset, GLsizei size); | 635 const char* function_name, GLuint offset, GLsizei size); |
| 604 | 636 |
| 605 const std::string& GetLogPrefix() const; | 637 const std::string& GetLogPrefix() const; |
| 606 | 638 |
| 607 #if defined(GL_CLIENT_FAIL_GL_ERRORS) | 639 #if defined(GL_CLIENT_FAIL_GL_ERRORS) |
| 608 void CheckGLError(); | 640 void CheckGLError(); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 // The program in use by glUseProgram | 693 // The program in use by glUseProgram |
| 662 GLuint current_program_; | 694 GLuint current_program_; |
| 663 | 695 |
| 664 // The currently bound array buffer. | 696 // The currently bound array buffer. |
| 665 GLuint bound_array_buffer_id_; | 697 GLuint bound_array_buffer_id_; |
| 666 | 698 |
| 667 // The currently bound pixel transfer buffers. | 699 // The currently bound pixel transfer buffers. |
| 668 GLuint bound_pixel_pack_transfer_buffer_id_; | 700 GLuint bound_pixel_pack_transfer_buffer_id_; |
| 669 GLuint bound_pixel_unpack_transfer_buffer_id_; | 701 GLuint bound_pixel_unpack_transfer_buffer_id_; |
| 670 | 702 |
| 703 // The current asynchronous pixel buffer upload token. |
| 704 uint32 async_upload_token_; |
| 705 |
| 706 // The shared memory used for synchronizing asynchronous upload tokens. |
| 707 AsyncUploadSync* async_upload_sync_; |
| 708 int32 async_upload_sync_shm_id_; |
| 709 unsigned int async_upload_sync_shm_offset_; |
| 710 |
| 711 // Unmanaged pixel transfer buffer memory pending asynchronous upload token. |
| 712 typedef std::list<std::pair<void*, uint32> > DetachedAsyncUploadMemoryList; |
| 713 DetachedAsyncUploadMemoryList detached_async_upload_memory_; |
| 714 |
| 671 // Client side management for vertex array objects. Needed to correctly | 715 // Client side management for vertex array objects. Needed to correctly |
| 672 // track client side arrays. | 716 // track client side arrays. |
| 673 scoped_ptr<VertexArrayObjectManager> vertex_array_object_manager_; | 717 scoped_ptr<VertexArrayObjectManager> vertex_array_object_manager_; |
| 674 | 718 |
| 675 GLuint reserved_ids_[2]; | 719 GLuint reserved_ids_[2]; |
| 676 | 720 |
| 677 // Current GL error bits. | 721 // Current GL error bits. |
| 678 uint32 error_bits_; | 722 uint32 error_bits_; |
| 679 | 723 |
| 680 // Whether or not to print debugging info. | 724 // Whether or not to print debugging info. |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 | 801 |
| 758 inline bool GLES2Implementation::GetTexParameterivHelper( | 802 inline bool GLES2Implementation::GetTexParameterivHelper( |
| 759 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { | 803 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { |
| 760 return false; | 804 return false; |
| 761 } | 805 } |
| 762 | 806 |
| 763 } // namespace gles2 | 807 } // namespace gles2 |
| 764 } // namespace gpu | 808 } // namespace gpu |
| 765 | 809 |
| 766 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ | 810 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ |
| OLD | NEW |