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

Side by Side Diff: gpu/command_buffer/service/context_group.h

Issue 11568029: Add a command to lose the context (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add docs, lose parent and children, fix typo Created 8 years 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_SERVICE_CONTEXT_GROUP_H_ 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ 6 #define GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector>
9 #include "base/basictypes.h" 10 #include "base/basictypes.h"
10 #include "base/hash_tables.h" 11 #include "base/hash_tables.h"
11 #include "base/memory/linked_ptr.h" 12 #include "base/memory/linked_ptr.h"
12 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h"
14 #include "gpu/command_buffer/common/gles2_cmd_format.h" 16 #include "gpu/command_buffer/common/gles2_cmd_format.h"
15 #include "gpu/command_buffer/service/gles2_cmd_validation.h" 17 #include "gpu/command_buffer/service/gles2_cmd_validation.h"
16 #include "gpu/command_buffer/service/feature_info.h" 18 #include "gpu/command_buffer/service/feature_info.h"
17 #include "gpu/gpu_export.h" 19 #include "gpu/gpu_export.h"
18 20
19 namespace gpu { 21 namespace gpu {
20 22
21 class IdAllocatorInterface; 23 class IdAllocatorInterface;
22 class TransferBufferManagerInterface; 24 class TransferBufferManagerInterface;
23 25
(...skipping 19 matching lines...) Expand all
43 typedef scoped_refptr<ContextGroup> Ref; 45 typedef scoped_refptr<ContextGroup> Ref;
44 46
45 ContextGroup( 47 ContextGroup(
46 MailboxManager* mailbox_manager, 48 MailboxManager* mailbox_manager,
47 ImageManager* image_manager, 49 ImageManager* image_manager,
48 MemoryTracker* memory_tracker, 50 MemoryTracker* memory_tracker,
49 bool bind_generates_resource); 51 bool bind_generates_resource);
50 52
51 // This should only be called by GLES2Decoder. This must be paired with a 53 // This should only be called by GLES2Decoder. This must be paired with a
52 // call to destroy if it succeeds. 54 // call to destroy if it succeeds.
53 bool Initialize(const DisallowedFeatures& disallowed_features, 55 bool Initialize(
54 const char* allowed_features); 56 GLES2Decoder* decoder,
57 const DisallowedFeatures& disallowed_features,
58 const char* allowed_features);
55 59
56 // Destroys all the resources when called for the last context in the group. 60 // Destroys all the resources when called for the last context in the group.
57 // It should only be called by GLES2Decoder. 61 // It should only be called by GLES2Decoder.
58 void Destroy(bool have_context); 62 void Destroy(GLES2Decoder* decoder, bool have_context);
59 63
60 MailboxManager* mailbox_manager() const { 64 MailboxManager* mailbox_manager() const {
61 return mailbox_manager_.get(); 65 return mailbox_manager_.get();
62 } 66 }
63 67
64 ImageManager* image_manager() const { 68 ImageManager* image_manager() const {
65 return image_manager_.get(); 69 return image_manager_.get();
66 } 70 }
67 71
68 MemoryTracker* memory_tracker() const { 72 MemoryTracker* memory_tracker() const {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 } 142 }
139 143
140 TransferBufferManagerInterface* transfer_buffer_manager() const { 144 TransferBufferManagerInterface* transfer_buffer_manager() const {
141 return transfer_buffer_manager_.get(); 145 return transfer_buffer_manager_.get();
142 } 146 }
143 147
144 IdAllocatorInterface* GetIdAllocator(unsigned namespace_id); 148 IdAllocatorInterface* GetIdAllocator(unsigned namespace_id);
145 149
146 uint32 GetMemRepresented() const; 150 uint32 GetMemRepresented() const;
147 151
152 // Loses all the context associated with this group.
153 void LoseContexts(GLenum reset_status);
154
148 private: 155 private:
149 friend class base::RefCounted<ContextGroup>; 156 friend class base::RefCounted<ContextGroup>;
150 ~ContextGroup(); 157 ~ContextGroup();
151 158
152 bool CheckGLFeature(GLint min_required, GLint* v); 159 bool CheckGLFeature(GLint min_required, GLint* v);
153 bool CheckGLFeatureU(GLint min_required, uint32* v); 160 bool CheckGLFeatureU(GLint min_required, uint32* v);
154 bool QueryGLFeature(GLenum pname, GLint min_required, GLint* v); 161 bool QueryGLFeature(GLenum pname, GLint min_required, GLint* v);
155 bool QueryGLFeatureU(GLenum pname, GLint min_required, uint32* v); 162 bool QueryGLFeatureU(GLenum pname, GLint min_required, uint32* v);
163 bool HaveContexts();
156 164
157 scoped_refptr<MailboxManager> mailbox_manager_; 165 scoped_refptr<MailboxManager> mailbox_manager_;
158 scoped_refptr<ImageManager> image_manager_; 166 scoped_refptr<ImageManager> image_manager_;
159 scoped_refptr<MemoryTracker> memory_tracker_; 167 scoped_refptr<MemoryTracker> memory_tracker_;
160 scoped_ptr<TransferBufferManagerInterface> transfer_buffer_manager_; 168 scoped_ptr<TransferBufferManagerInterface> transfer_buffer_manager_;
161 169
162 // Whether or not this context is initialized.
163 int num_contexts_;
164 bool enforce_gl_minimums_; 170 bool enforce_gl_minimums_;
165 bool bind_generates_resource_; 171 bool bind_generates_resource_;
166 172
167 uint32 max_vertex_attribs_; 173 uint32 max_vertex_attribs_;
168 uint32 max_texture_units_; 174 uint32 max_texture_units_;
169 uint32 max_texture_image_units_; 175 uint32 max_texture_image_units_;
170 uint32 max_vertex_texture_image_units_; 176 uint32 max_vertex_texture_image_units_;
171 uint32 max_fragment_uniform_vectors_; 177 uint32 max_fragment_uniform_vectors_;
172 uint32 max_varying_vectors_; 178 uint32 max_varying_vectors_;
173 uint32 max_vertex_uniform_vectors_; 179 uint32 max_vertex_uniform_vectors_;
(...skipping 10 matching lines...) Expand all
184 190
185 scoped_ptr<ProgramManager> program_manager_; 191 scoped_ptr<ProgramManager> program_manager_;
186 192
187 scoped_ptr<ShaderManager> shader_manager_; 193 scoped_ptr<ShaderManager> shader_manager_;
188 194
189 linked_ptr<IdAllocatorInterface> 195 linked_ptr<IdAllocatorInterface>
190 id_namespaces_[id_namespaces::kNumIdNamespaces]; 196 id_namespaces_[id_namespaces::kNumIdNamespaces];
191 197
192 FeatureInfo::Ref feature_info_; 198 FeatureInfo::Ref feature_info_;
193 199
200 std::vector<base::WeakPtr<gles2::GLES2Decoder> > decoders_;
201
194 DISALLOW_COPY_AND_ASSIGN(ContextGroup); 202 DISALLOW_COPY_AND_ASSIGN(ContextGroup);
195 }; 203 };
196 204
197 } // namespace gles2 205 } // namespace gles2
198 } // namespace gpu 206 } // namespace gpu
199 207
200 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ 208 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_
201 209
202 210
OLDNEW
« no previous file with comments | « gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h ('k') | gpu/command_buffer/service/context_group.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698