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

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

Issue 2818993002: GL Implementation for GPU Discardable
Patch Set: rebase Created 3 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
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_SHARE_GROUP_H_ 5 #ifndef GPU_COMMAND_BUFFER_CLIENT_SHARE_GROUP_H_
6 #define GPU_COMMAND_BUFFER_CLIENT_SHARE_GROUP_H_ 6 #define GPU_COMMAND_BUFFER_CLIENT_SHARE_GROUP_H_
7 7
8 #include <GLES2/gl2.h> 8 #include <GLES2/gl2.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <memory> 11 #include <memory>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/synchronization/lock.h" 14 #include "base/synchronization/lock.h"
15 #include "gles2_impl_export.h" 15 #include "gles2_impl_export.h"
16 #include "gpu/command_buffer/client/client_discardable_manager.h"
16 #include "gpu/command_buffer/client/ref_counted.h" 17 #include "gpu/command_buffer/client/ref_counted.h"
17 #include "gpu/command_buffer/common/gles2_cmd_format.h" 18 #include "gpu/command_buffer/common/gles2_cmd_format.h"
18 19
19 namespace gpu { 20 namespace gpu {
20 namespace gles2 { 21 namespace gles2 {
21 22
22 class GLES2Implementation; 23 class GLES2Implementation;
23 class GLES2ImplementationTest; 24 class GLES2ImplementationTest;
24 class ProgramInfoManager; 25 class ProgramInfoManager;
25 26
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 for (int i = 0; i < id_namespaces::kNumIdNamespaces; ++i) { 141 for (int i = 0; i < id_namespaces::kNumIdNamespaces; ++i) {
141 id_handlers_[i]->FreeContext(gl_impl); 142 id_handlers_[i]->FreeContext(gl_impl);
142 } 143 }
143 for (auto& range_id_handler : range_id_handlers_) { 144 for (auto& range_id_handler : range_id_handlers_) {
144 range_id_handler->FreeContext(gl_impl); 145 range_id_handler->FreeContext(gl_impl);
145 } 146 }
146 } 147 }
147 148
148 uint64_t TracingGUID() const { return tracing_guid_; } 149 uint64_t TracingGUID() const { return tracing_guid_; }
149 150
151 ClientDiscardableManager* discardable_manager() {
152 return &discardable_manager_;
153 }
154
150 // Mark the ShareGroup as lost when an error occurs on any context in the 155 // Mark the ShareGroup as lost when an error occurs on any context in the
151 // group. This is thread safe as contexts may be on different threads. 156 // group. This is thread safe as contexts may be on different threads.
152 void Lose(); 157 void Lose();
153 // Report if any context in the ShareGroup has reported itself lost. This is 158 // Report if any context in the ShareGroup has reported itself lost. This is
154 // thread safe as contexts may be on different threads. 159 // thread safe as contexts may be on different threads.
155 bool IsLost() const; 160 bool IsLost() const;
156 161
157 private: 162 private:
158 friend class gpu::RefCountedThreadSafe<ShareGroup>; 163 friend class gpu::RefCountedThreadSafe<ShareGroup>;
159 friend class gpu::gles2::GLES2ImplementationTest; 164 friend class gpu::gles2::GLES2ImplementationTest;
160 ~ShareGroup(); 165 ~ShareGroup();
161 166
162 // Install a new program info manager. Used for testing only; 167 // Install a new program info manager. Used for testing only;
163 void SetProgramInfoManagerForTesting(ProgramInfoManager* manager); 168 void SetProgramInfoManagerForTesting(ProgramInfoManager* manager);
164 169
165 std::unique_ptr<IdHandlerInterface> 170 std::unique_ptr<IdHandlerInterface>
166 id_handlers_[id_namespaces::kNumIdNamespaces]; 171 id_handlers_[id_namespaces::kNumIdNamespaces];
167 std::unique_ptr<RangeIdHandlerInterface> 172 std::unique_ptr<RangeIdHandlerInterface>
168 range_id_handlers_[id_namespaces::kNumRangeIdNamespaces]; 173 range_id_handlers_[id_namespaces::kNumRangeIdNamespaces];
169 std::unique_ptr<ProgramInfoManager> program_info_manager_; 174 std::unique_ptr<ProgramInfoManager> program_info_manager_;
175 ClientDiscardableManager discardable_manager_;
170 176
171 bool bind_generates_resource_; 177 bool bind_generates_resource_;
172 uint64_t tracing_guid_; 178 uint64_t tracing_guid_;
173 179
174 mutable base::Lock lost_lock_; 180 mutable base::Lock lost_lock_;
175 bool lost_ = false; 181 bool lost_ = false;
176 182
177 DISALLOW_COPY_AND_ASSIGN(ShareGroup); 183 DISALLOW_COPY_AND_ASSIGN(ShareGroup);
178 }; 184 };
179 185
180 } // namespace gles2 186 } // namespace gles2
181 } // namespace gpu 187 } // namespace gpu
182 188
183 #endif // GPU_COMMAND_BUFFER_CLIENT_SHARE_GROUP_H_ 189 #endif // GPU_COMMAND_BUFFER_CLIENT_SHARE_GROUP_H_
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h ('k') | gpu/command_buffer/cmd_buffer_functions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698