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

Unified Diff: gpu/command_buffer/client/share_group.h

Issue 162023002: Reduce internal Flush() in GL resource glGen/Delete APIs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Lock required in FreeContext(). Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/client/share_group.h
diff --git a/gpu/command_buffer/client/share_group.h b/gpu/command_buffer/client/share_group.h
index 68ea6a9895a536b10e43d3f996b42eca33724473..8e66c73c76d6886f22f134f42f6eab6e926696f7 100644
--- a/gpu/command_buffer/client/share_group.h
+++ b/gpu/command_buffer/client/share_group.h
@@ -20,6 +20,24 @@ class ProgramInfoManager;
typedef void (GLES2Implementation::*DeleteFn)(GLsizei n, const GLuint* ids);
+class ShareGroupContextData {
+ public:
+ struct IdHandlerData {
+ IdHandlerData();
+ ~IdHandlerData();
+
+ std::vector<GLuint> freed_ids_;
+ uint32 flush_generation_;
+ };
+
+ IdHandlerData* id_handler_data(int namespace_id) {
+ return &id_handler_data_[namespace_id];
+ }
+
+ private:
+ IdHandlerData id_handler_data_[id_namespaces::kNumIdNamespaces];
+};
+
// Base class for IdHandlers
class IdHandlerInterface {
public:
@@ -37,7 +55,10 @@ class IdHandlerInterface {
DeleteFn delete_fn) = 0;
// Marks an id as used for glBind functions. id = 0 does nothing.
- virtual bool MarkAsUsedForBind(GLuint id) = 0;
+ virtual bool MarkAsUsedForBind(GLES2Implementation* gl_impl, GLuint id) = 0;
+
+ // Called when a context in the share group is destructed.
+ virtual void FreeContext(GLES2Implementation* gl_impl) = 0;
};
// ShareGroup manages shared resources for contexts that are sharing resources.
@@ -60,6 +81,12 @@ class GLES2_IMPL_EXPORT ShareGroup
return program_info_manager_.get();
}
+ void FreeContext(GLES2Implementation* gl_impl) {
+ for (int i = 0; i < id_namespaces::kNumIdNamespaces; ++i) {
+ id_handlers_[i]->FreeContext(gl_impl);
+ }
+ }
+
private:
friend class gpu::RefCountedThreadSafe<ShareGroup>;
friend class gpu::gles2::GLES2ImplementationTest;

Powered by Google App Engine
This is Rietveld 408576698