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( | 183 GLES2Implementation(GLES2CmdHelper* helper, |
184 GLES2CmdHelper* helper, | 184 ShareGroup* share_group, |
185 ShareGroup* share_group, | 185 TransferBufferInterface* transfer_buffer, |
186 TransferBufferInterface* transfer_buffer, | 186 bool bind_generates_resource, |
187 bool bind_generates_resource, | 187 bool lose_context_when_out_of_memory, |
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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 | 578 |
579 bool IsExtensionAvailable(const char* ext); | 579 bool IsExtensionAvailable(const char* ext); |
580 | 580 |
581 // Caches certain capabilties state. Return true if cached. | 581 // Caches certain capabilties state. Return true if cached. |
582 bool SetCapabilityState(GLenum cap, bool enabled); | 582 bool SetCapabilityState(GLenum cap, bool enabled); |
583 | 583 |
584 IdHandlerInterface* GetIdHandler(int id_namespace) const; | 584 IdHandlerInterface* GetIdHandler(int id_namespace) const; |
585 | 585 |
586 void FinishHelper(); | 586 void FinishHelper(); |
587 | 587 |
588 // Asserts that the context is lost. | |
589 // NOTE: This is an expensive call and should only be called | |
590 // for error checking. | |
591 bool MustBeContextLost(); | |
592 | |
593 void RunIfContextNotLost(const base::Closure& callback); | 588 void RunIfContextNotLost(const base::Closure& callback); |
594 | 589 |
595 void OnSwapBuffersComplete(); | 590 void OnSwapBuffersComplete(); |
596 | 591 |
597 bool GetBoundPixelTransferBuffer( | 592 bool GetBoundPixelTransferBuffer( |
598 GLenum target, const char* function_name, GLuint* buffer_id); | 593 GLenum target, const char* function_name, GLuint* buffer_id); |
599 BufferTracker::Buffer* GetBoundPixelUnpackTransferBufferIfValid( | 594 BufferTracker::Buffer* GetBoundPixelUnpackTransferBufferIfValid( |
600 GLuint buffer_id, | 595 GLuint buffer_id, |
601 const char* function_name, GLuint offset, GLsizei size); | 596 const char* function_name, GLuint offset, GLsizei size); |
602 | 597 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 scoped_ptr<VertexArrayObjectManager> vertex_array_object_manager_; | 666 scoped_ptr<VertexArrayObjectManager> vertex_array_object_manager_; |
672 | 667 |
673 GLuint reserved_ids_[2]; | 668 GLuint reserved_ids_[2]; |
674 | 669 |
675 // Current GL error bits. | 670 // Current GL error bits. |
676 uint32 error_bits_; | 671 uint32 error_bits_; |
677 | 672 |
678 // Whether or not to print debugging info. | 673 // Whether or not to print debugging info. |
679 bool debug_; | 674 bool debug_; |
680 | 675 |
| 676 // When true, the context is lost when a GL_OUT_OF_MEMORY error occurs. |
| 677 bool lose_context_when_out_of_memory_; |
| 678 |
681 // Used to check for single threaded access. | 679 // Used to check for single threaded access. |
682 int use_count_; | 680 int use_count_; |
683 | 681 |
684 // Map of GLenum to Strings for glGetString. We need to cache these because | 682 // Map of GLenum to Strings for glGetString. We need to cache these because |
685 // the pointer passed back to the client has to remain valid for eternity. | 683 // the pointer passed back to the client has to remain valid for eternity. |
686 typedef std::map<uint32, std::set<std::string> > GLStringMap; | 684 typedef std::map<uint32, std::set<std::string> > GLStringMap; |
687 GLStringMap gl_strings_; | 685 GLStringMap gl_strings_; |
688 | 686 |
689 // Similar cache for glGetRequestableExtensionsCHROMIUM. We don't | 687 // Similar cache for glGetRequestableExtensionsCHROMIUM. We don't |
690 // have an enum for this so handle it separately. | 688 // have an enum for this so handle it separately. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 | 753 |
756 inline bool GLES2Implementation::GetTexParameterivHelper( | 754 inline bool GLES2Implementation::GetTexParameterivHelper( |
757 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { | 755 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { |
758 return false; | 756 return false; |
759 } | 757 } |
760 | 758 |
761 } // namespace gles2 | 759 } // namespace gles2 |
762 } // namespace gpu | 760 } // namespace gpu |
763 | 761 |
764 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ | 762 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ |
OLD | NEW |