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 8ce940ab6bb2a46124baa326300da1d089aa481e..cf3c44b0083ff7fc828e52aaab1ca3196687b207 100644 |
--- a/gpu/command_buffer/client/share_group.h |
+++ b/gpu/command_buffer/client/share_group.h |
@@ -5,24 +5,79 @@ |
#ifndef GPU_COMMAND_BUFFER_CLIENT_SHARE_GROUP_H_ |
#define GPU_COMMAND_BUFFER_CLIENT_SHARE_GROUP_H_ |
+#include <GLES2/gl2.h> |
#include "../client/ref_counted.h" |
+#include "../common/gles2_cmd_format.h" |
+#include "../common/scoped_ptr.h" |
#include "gles2_impl_export.h" |
namespace gpu { |
namespace gles2 { |
+class GLES2Implementation; |
+class ProgramInfoManager; |
+ |
+// Base class for IdHandlers |
+class IdHandlerInterface { |
+ public: |
+ IdHandlerInterface() { } |
+ virtual ~IdHandlerInterface() { } |
+ |
+ // Free everything. |
+ virtual void Destroy(GLES2Implementation* gl_impl) = 0; |
+ |
+ // Makes some ids at or above id_offset. |
+ virtual void MakeIds( |
+ GLES2Implementation* gl_impl, |
+ GLuint id_offset, GLsizei n, GLuint* ids) = 0; |
+ |
+ // Frees some ids. |
+ virtual bool FreeIds( |
+ GLES2Implementation* gl_impl, GLsizei n, const GLuint* ids) = 0; |
+ |
+ // Marks an id as used for glBind functions. id = 0 does nothing. |
+ virtual bool MarkAsUsedForBind(GLuint id) = 0; |
+}; |
+ |
// ShareGroup manages shared resources for contexts that are sharing resources. |
class GLES2_IMPL_EXPORT ShareGroup |
: public gpu::RefCountedThreadSafe<ShareGroup> { |
public: |
typedef scoped_refptr<ShareGroup> Ref; |
- ShareGroup(); |
+ ShareGroup(bool share_resources, bool bind_generates_resource); |
~ShareGroup(); |
+ void SetGLES2ImplementationForDestruction(GLES2Implementation* gl_impl); |
+ |
+ bool sharing_resources() const { |
+ return sharing_resources_; |
+ } |
+ |
+ bool bind_generates_resource() const { |
+ return bind_generates_resource_; |
+ } |
+ |
bool Initialize(); |
+ IdHandlerInterface* GetIdHandler(int namespace_id) const { |
+ return id_handlers_[namespace_id].get(); |
+ } |
+ |
+ ProgramInfoManager* program_info_manager() { |
+ return program_info_manager_.get(); |
+ } |
+ |
private: |
+ scoped_ptr<IdHandlerInterface> id_handlers_[id_namespaces::kNumIdNamespaces]; |
+ scoped_ptr<ProgramInfoManager> program_info_manager_; |
+ |
+ // Whether or not this context is sharing resources. |
+ bool sharing_resources_; |
+ bool bind_generates_resource_; |
+ |
+ GLES2Implementation* gles2_; |
+ |
DISALLOW_COPY_AND_ASSIGN(ShareGroup); |
}; |