Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: trunk/src/gpu/command_buffer/client/gles2_implementation.h

Issue 216673006: Revert 260177 "By keeping track of transfer buffer usage (both s..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
631 bool GetBoundPixelTransferBuffer( 599 bool GetBoundPixelTransferBuffer(
632 GLenum target, const char* function_name, GLuint* buffer_id); 600 GLenum target, const char* function_name, GLuint* buffer_id);
633 BufferTracker::Buffer* GetBoundPixelUnpackTransferBufferIfValid( 601 BufferTracker::Buffer* GetBoundPixelUnpackTransferBufferIfValid(
634 GLuint buffer_id, 602 GLuint buffer_id,
635 const char* function_name, GLuint offset, GLsizei size); 603 const char* function_name, GLuint offset, GLsizei size);
636 604
637 const std::string& GetLogPrefix() const; 605 const std::string& GetLogPrefix() const;
638 606
639 #if defined(GL_CLIENT_FAIL_GL_ERRORS) 607 #if defined(GL_CLIENT_FAIL_GL_ERRORS)
640 void CheckGLError(); 608 void CheckGLError();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 // The program in use by glUseProgram 661 // The program in use by glUseProgram
694 GLuint current_program_; 662 GLuint current_program_;
695 663
696 // The currently bound array buffer. 664 // The currently bound array buffer.
697 GLuint bound_array_buffer_id_; 665 GLuint bound_array_buffer_id_;
698 666
699 // The currently bound pixel transfer buffers. 667 // The currently bound pixel transfer buffers.
700 GLuint bound_pixel_pack_transfer_buffer_id_; 668 GLuint bound_pixel_pack_transfer_buffer_id_;
701 GLuint bound_pixel_unpack_transfer_buffer_id_; 669 GLuint bound_pixel_unpack_transfer_buffer_id_;
702 670
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
715 // Client side management for vertex array objects. Needed to correctly 671 // Client side management for vertex array objects. Needed to correctly
716 // track client side arrays. 672 // track client side arrays.
717 scoped_ptr<VertexArrayObjectManager> vertex_array_object_manager_; 673 scoped_ptr<VertexArrayObjectManager> vertex_array_object_manager_;
718 674
719 GLuint reserved_ids_[2]; 675 GLuint reserved_ids_[2];
720 676
721 // Current GL error bits. 677 // Current GL error bits.
722 uint32 error_bits_; 678 uint32 error_bits_;
723 679
724 // Whether or not to print debugging info. 680 // Whether or not to print debugging info.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 757
802 inline bool GLES2Implementation::GetTexParameterivHelper( 758 inline bool GLES2Implementation::GetTexParameterivHelper(
803 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { 759 GLenum /* target */, GLenum /* pname */, GLint* /* params */) {
804 return false; 760 return false;
805 } 761 }
806 762
807 } // namespace gles2 763 } // namespace gles2
808 } // namespace gpu 764 } // namespace gpu
809 765
810 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ 766 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698