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

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

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

Powered by Google App Engine
This is Rietveld 408576698