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

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

Issue 199443004: gpu: Raise GL_OUT_OF_MEMORY when BeginQueryEXT fails to allocate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: checkmem: benchmark 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
600 void RunIfContextNotLost(const base::Closure& callback); 595 void RunIfContextNotLost(const base::Closure& callback);
601 596
602 void OnSwapBuffersComplete(); 597 void OnSwapBuffersComplete();
603 598
604 // Remove the transfer buffer from the buffer tracker. For buffers used 599 // Remove the transfer buffer from the buffer tracker. For buffers used
605 // asynchronously the memory is free:ed if the upload has completed. For 600 // asynchronously the memory is free:ed if the upload has completed. For
606 // other buffers, the memory is either free:ed immediately or free:ed pending 601 // other buffers, the memory is either free:ed immediately or free:ed pending
607 // a token. 602 // a token.
608 void RemoveTransferBuffer(BufferTracker::Buffer* buffer); 603 void RemoveTransferBuffer(BufferTracker::Buffer* buffer);
609 604
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 scoped_ptr<VertexArrayObjectManager> vertex_array_object_manager_; 717 scoped_ptr<VertexArrayObjectManager> vertex_array_object_manager_;
723 718
724 GLuint reserved_ids_[2]; 719 GLuint reserved_ids_[2];
725 720
726 // Current GL error bits. 721 // Current GL error bits.
727 uint32 error_bits_; 722 uint32 error_bits_;
728 723
729 // Whether or not to print debugging info. 724 // Whether or not to print debugging info.
730 bool debug_; 725 bool debug_;
731 726
727 // When true, the context is lost when a GL_OUT_OF_MEMORY error occurs.
728 bool lose_context_when_out_of_memory_;
729
732 // Used to check for single threaded access. 730 // Used to check for single threaded access.
733 int use_count_; 731 int use_count_;
734 732
735 // Map of GLenum to Strings for glGetString. We need to cache these because 733 // Map of GLenum to Strings for glGetString. We need to cache these because
736 // the pointer passed back to the client has to remain valid for eternity. 734 // the pointer passed back to the client has to remain valid for eternity.
737 typedef std::map<uint32, std::set<std::string> > GLStringMap; 735 typedef std::map<uint32, std::set<std::string> > GLStringMap;
738 GLStringMap gl_strings_; 736 GLStringMap gl_strings_;
739 737
740 // Similar cache for glGetRequestableExtensionsCHROMIUM. We don't 738 // Similar cache for glGetRequestableExtensionsCHROMIUM. We don't
741 // have an enum for this so handle it separately. 739 // have an enum for this so handle it separately.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 804
807 inline bool GLES2Implementation::GetTexParameterivHelper( 805 inline bool GLES2Implementation::GetTexParameterivHelper(
808 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { 806 GLenum /* target */, GLenum /* pname */, GLint* /* params */) {
809 return false; 807 return false;
810 } 808 }
811 809
812 } // namespace gles2 810 } // namespace gles2
813 } // namespace gpu 811 } // namespace gpu
814 812
815 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ 813 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/gl_in_process_context.cc ('k') | gpu/command_buffer/client/gles2_implementation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698