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

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

Issue 169403005: command_buffer: Implement path rendering functions for CHROMIUM_path_rendering (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@nv-pr-02-texgen
Patch Set: fix windows build Created 5 years, 5 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 "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "gles2_impl_export.h" 10 #include "gles2_impl_export.h"
11 #include "gpu/command_buffer/client/ref_counted.h" 11 #include "gpu/command_buffer/client/ref_counted.h"
12 #include "gpu/command_buffer/common/gles2_cmd_format.h" 12 #include "gpu/command_buffer/common/gles2_cmd_format.h"
13 13
14 namespace gpu { 14 namespace gpu {
15 namespace gles2 { 15 namespace gles2 {
16 16
17 class GLES2Implementation; 17 class GLES2Implementation;
18 class GLES2ImplementationTest; 18 class GLES2ImplementationTest;
19 class ProgramInfoManager; 19 class ProgramInfoManager;
20 20
21 typedef void (GLES2Implementation::*DeleteFn)(GLsizei n, const GLuint* ids); 21 typedef void (GLES2Implementation::*DeleteFn)(GLsizei n, const GLuint* ids);
22 typedef void (GLES2Implementation::*DeleteRangeFn)(const GLuint first_id,
23 GLsizei range);
22 typedef void (GLES2Implementation::*BindFn)(GLenum target, GLuint id); 24 typedef void (GLES2Implementation::*BindFn)(GLenum target, GLuint id);
23 typedef void (GLES2Implementation::*BindIndexedFn)( \ 25 typedef void (GLES2Implementation::*BindIndexedFn)( \
24 GLenum target, GLuint index, GLuint id); 26 GLenum target, GLuint index, GLuint id);
25 typedef void (GLES2Implementation::*BindIndexedRangeFn)( \ 27 typedef void (GLES2Implementation::*BindIndexedRangeFn)( \
26 GLenum target, GLuint index, GLuint id, GLintptr offset, GLsizeiptr size); 28 GLenum target, GLuint index, GLuint id, GLintptr offset, GLsizeiptr size);
27 29
28 class ShareGroupContextData { 30 class ShareGroupContextData {
29 public: 31 public:
30 struct IdHandlerData { 32 struct IdHandlerData {
31 IdHandlerData(); 33 IdHandlerData();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 GLuint index, 81 GLuint index,
80 GLuint id, 82 GLuint id,
81 GLintptr offset, 83 GLintptr offset,
82 GLsizeiptr size, 84 GLsizeiptr size,
83 BindIndexedRangeFn bind_fn) = 0; 85 BindIndexedRangeFn bind_fn) = 0;
84 86
85 // Called when a context in the share group is destructed. 87 // Called when a context in the share group is destructed.
86 virtual void FreeContext(GLES2Implementation* gl_impl) = 0; 88 virtual void FreeContext(GLES2Implementation* gl_impl) = 0;
87 }; 89 };
88 90
91 class RangeIdHandlerInterface {
92 public:
93 RangeIdHandlerInterface() {}
94 virtual ~RangeIdHandlerInterface() {}
95
96 // Makes a continuous range of ids. Stores the first allocated id to
97 // |first_id| or 0 if allocation failed.
98 virtual void MakeIdRange(GLES2Implementation* gl_impl,
99 GLsizei n,
100 GLuint* first_id) = 0;
101
102 // Frees a continuous |range| of ids beginning at |first_id|.
103 virtual void FreeIdRange(GLES2Implementation* gl_impl,
104 const GLuint first_id,
105 GLsizei range,
106 DeleteRangeFn delete_fn) = 0;
107
108 // Called when a context in the share group is destructed.
109 virtual void FreeContext(GLES2Implementation* gl_impl) = 0;
110 };
111
89 // ShareGroup manages shared resources for contexts that are sharing resources. 112 // ShareGroup manages shared resources for contexts that are sharing resources.
90 class GLES2_IMPL_EXPORT ShareGroup 113 class GLES2_IMPL_EXPORT ShareGroup
91 : public gpu::RefCountedThreadSafe<ShareGroup> { 114 : public gpu::RefCountedThreadSafe<ShareGroup> {
92 public: 115 public:
93 ShareGroup(bool bind_generates_resource); 116 ShareGroup(bool bind_generates_resource);
94 117
95 bool bind_generates_resource() const { 118 bool bind_generates_resource() const {
96 return bind_generates_resource_; 119 return bind_generates_resource_;
97 } 120 }
98 121
99 IdHandlerInterface* GetIdHandler(int namespace_id) const { 122 IdHandlerInterface* GetIdHandler(int namespace_id) const {
100 return id_handlers_[namespace_id].get(); 123 return id_handlers_[namespace_id].get();
101 } 124 }
102 125
126 RangeIdHandlerInterface* GetRangeIdHandler(int range_namespace_id) const {
127 return range_id_handlers_[range_namespace_id].get();
128 }
129
103 ProgramInfoManager* program_info_manager() { 130 ProgramInfoManager* program_info_manager() {
104 return program_info_manager_.get(); 131 return program_info_manager_.get();
105 } 132 }
106 133
107 void FreeContext(GLES2Implementation* gl_impl) { 134 void FreeContext(GLES2Implementation* gl_impl) {
108 for (int i = 0; i < id_namespaces::kNumIdNamespaces; ++i) { 135 for (int i = 0; i < id_namespaces::kNumIdNamespaces; ++i) {
109 id_handlers_[i]->FreeContext(gl_impl); 136 id_handlers_[i]->FreeContext(gl_impl);
110 } 137 }
138 for (auto& range_id_handler : range_id_handlers_) {
139 range_id_handler->FreeContext(gl_impl);
140 }
111 } 141 }
112 142
113 private: 143 private:
114 friend class gpu::RefCountedThreadSafe<ShareGroup>; 144 friend class gpu::RefCountedThreadSafe<ShareGroup>;
115 friend class gpu::gles2::GLES2ImplementationTest; 145 friend class gpu::gles2::GLES2ImplementationTest;
116 ~ShareGroup(); 146 ~ShareGroup();
117 147
118 // Install a new program info manager. Used for testing only; 148 // Install a new program info manager. Used for testing only;
119 void set_program_info_manager(ProgramInfoManager* manager); 149 void set_program_info_manager(ProgramInfoManager* manager);
120 150
121 scoped_ptr<IdHandlerInterface> id_handlers_[id_namespaces::kNumIdNamespaces]; 151 scoped_ptr<IdHandlerInterface> id_handlers_[id_namespaces::kNumIdNamespaces];
152 scoped_ptr<RangeIdHandlerInterface>
153 range_id_handlers_[id_namespaces::kNumRangeIdNamespaces];
122 scoped_ptr<ProgramInfoManager> program_info_manager_; 154 scoped_ptr<ProgramInfoManager> program_info_manager_;
123 155
124 bool bind_generates_resource_; 156 bool bind_generates_resource_;
125 157
126 DISALLOW_COPY_AND_ASSIGN(ShareGroup); 158 DISALLOW_COPY_AND_ASSIGN(ShareGroup);
127 }; 159 };
128 160
129 } // namespace gles2 161 } // namespace gles2
130 } // namespace gpu 162 } // namespace gpu
131 163
132 #endif // GPU_COMMAND_BUFFER_CLIENT_SHARE_GROUP_H_ 164 #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/client/share_group.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698