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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 // Alignment of allocations. | 173 // Alignment of allocations. |
174 static const unsigned int kAlignment = 4; | 174 static const unsigned int kAlignment = 4; |
175 | 175 |
176 // GL names for the buffers used to emulate client side buffers. | 176 // GL names for the buffers used to emulate client side buffers. |
177 static const GLuint kClientSideArrayId = 0xFEDCBA98u; | 177 static const GLuint kClientSideArrayId = 0xFEDCBA98u; |
178 static const GLuint kClientSideElementArrayId = 0xFEDCBA99u; | 178 static const GLuint kClientSideElementArrayId = 0xFEDCBA99u; |
179 | 179 |
180 // Number of swap buffers allowed before waiting. | 180 // Number of swap buffers allowed before waiting. |
181 static const size_t kMaxSwapBuffers = 2; | 181 static const size_t kMaxSwapBuffers = 2; |
182 | 182 |
183 GLES2Implementation(GLES2CmdHelper* helper, | 183 GLES2Implementation( |
184 ShareGroup* share_group, | 184 GLES2CmdHelper* helper, |
185 TransferBufferInterface* transfer_buffer, | 185 ShareGroup* share_group, |
186 bool bind_generates_resource, | 186 TransferBufferInterface* transfer_buffer, |
187 bool lose_context_when_out_of_memory, | 187 bool bind_generates_resource, |
188 GpuControl* gpu_control); | 188 GpuControl* gpu_control); |
189 | 189 |
190 virtual ~GLES2Implementation(); | 190 virtual ~GLES2Implementation(); |
191 | 191 |
192 bool Initialize( | 192 bool Initialize( |
193 unsigned int starting_transfer_buffer_size, | 193 unsigned int starting_transfer_buffer_size, |
194 unsigned int min_transfer_buffer_size, | 194 unsigned int min_transfer_buffer_size, |
195 unsigned int max_transfer_buffer_size, | 195 unsigned int max_transfer_buffer_size, |
196 unsigned int mapped_memory_limit); | 196 unsigned int mapped_memory_limit); |
197 | 197 |
198 // The GLES2CmdHelper being used by this GLES2Implementation. You can use | 198 // The GLES2CmdHelper being used by this GLES2Implementation. You can use |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 | 585 |
586 bool IsExtensionAvailable(const char* ext); | 586 bool IsExtensionAvailable(const char* ext); |
587 | 587 |
588 // Caches certain capabilties state. Return true if cached. | 588 // Caches certain capabilties state. Return true if cached. |
589 bool SetCapabilityState(GLenum cap, bool enabled); | 589 bool SetCapabilityState(GLenum cap, bool enabled); |
590 | 590 |
591 IdHandlerInterface* GetIdHandler(int id_namespace) const; | 591 IdHandlerInterface* GetIdHandler(int id_namespace) const; |
592 | 592 |
593 void FinishHelper(); | 593 void FinishHelper(); |
594 | 594 |
| 595 // Asserts that the context is lost. |
| 596 // NOTE: This is an expensive call and should only be called |
| 597 // for error checking. |
| 598 bool MustBeContextLost(); |
| 599 |
595 void RunIfContextNotLost(const base::Closure& callback); | 600 void RunIfContextNotLost(const base::Closure& callback); |
596 | 601 |
597 void OnSwapBuffersComplete(); | 602 void OnSwapBuffersComplete(); |
598 | 603 |
599 // Remove the transfer buffer from the buffer tracker. For buffers used | 604 // Remove the transfer buffer from the buffer tracker. For buffers used |
600 // asynchronously the memory is free:ed if the upload has completed. For | 605 // 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 | 606 // other buffers, the memory is either free:ed immediately or free:ed pending |
602 // a token. | 607 // a token. |
603 void RemoveTransferBuffer(BufferTracker::Buffer* buffer); | 608 void RemoveTransferBuffer(BufferTracker::Buffer* buffer); |
604 | 609 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 scoped_ptr<VertexArrayObjectManager> vertex_array_object_manager_; | 722 scoped_ptr<VertexArrayObjectManager> vertex_array_object_manager_; |
718 | 723 |
719 GLuint reserved_ids_[2]; | 724 GLuint reserved_ids_[2]; |
720 | 725 |
721 // Current GL error bits. | 726 // Current GL error bits. |
722 uint32 error_bits_; | 727 uint32 error_bits_; |
723 | 728 |
724 // Whether or not to print debugging info. | 729 // Whether or not to print debugging info. |
725 bool debug_; | 730 bool debug_; |
726 | 731 |
727 // When true, the context is lost when a GL_OUT_OF_MEMORY error occurs. | |
728 bool lose_context_when_out_of_memory_; | |
729 | |
730 // Used to check for single threaded access. | 732 // Used to check for single threaded access. |
731 int use_count_; | 733 int use_count_; |
732 | 734 |
733 // Map of GLenum to Strings for glGetString. We need to cache these because | 735 // Map of GLenum to Strings for glGetString. We need to cache these because |
734 // the pointer passed back to the client has to remain valid for eternity. | 736 // the pointer passed back to the client has to remain valid for eternity. |
735 typedef std::map<uint32, std::set<std::string> > GLStringMap; | 737 typedef std::map<uint32, std::set<std::string> > GLStringMap; |
736 GLStringMap gl_strings_; | 738 GLStringMap gl_strings_; |
737 | 739 |
738 // Similar cache for glGetRequestableExtensionsCHROMIUM. We don't | 740 // Similar cache for glGetRequestableExtensionsCHROMIUM. We don't |
739 // have an enum for this so handle it separately. | 741 // have an enum for this so handle it separately. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 | 806 |
805 inline bool GLES2Implementation::GetTexParameterivHelper( | 807 inline bool GLES2Implementation::GetTexParameterivHelper( |
806 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { | 808 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { |
807 return false; | 809 return false; |
808 } | 810 } |
809 | 811 |
810 } // namespace gles2 | 812 } // namespace gles2 |
811 } // namespace gpu | 813 } // namespace gpu |
812 | 814 |
813 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ | 815 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ |
OLD | NEW |