OLD | NEW |
---|---|
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_VERTEX_ATTRIB_MANAGER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_VERTEX_ATTRIB_MANAGER_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_VERTEX_ATTRIB_MANAGER_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_VERTEX_ATTRIB_MANAGER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <vector> | 9 #include <vector> |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
58 } | 58 } |
59 | 59 |
60 GLsizei gl_stride() const { | 60 GLsizei gl_stride() const { |
61 return gl_stride_; | 61 return gl_stride_; |
62 } | 62 } |
63 | 63 |
64 GLuint divisor() const { | 64 GLuint divisor() const { |
65 return divisor_; | 65 return divisor_; |
66 } | 66 } |
67 | 67 |
68 GLboolean integer() const { | |
69 return integer_; | |
70 } | |
71 | |
68 bool enabled() const { | 72 bool enabled() const { |
69 return enabled_; | 73 return enabled_; |
70 } | 74 } |
71 | 75 |
72 // Find the maximum vertex accessed, accounting for instancing. | 76 // Find the maximum vertex accessed, accounting for instancing. |
73 GLuint MaxVertexAccessed(GLsizei primcount, | 77 GLuint MaxVertexAccessed(GLsizei primcount, |
74 GLuint max_vertex_accessed) const { | 78 GLuint max_vertex_accessed) const { |
75 return divisor_ ? ((primcount - 1) / divisor_) : max_vertex_accessed; | 79 return divisor_ ? ((primcount - 1) / divisor_) : max_vertex_accessed; |
76 } | 80 } |
77 | 81 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
111 GLenum type, | 115 GLenum type, |
112 GLboolean normalized, | 116 GLboolean normalized, |
113 GLsizei gl_stride, | 117 GLsizei gl_stride, |
114 GLsizei real_stride, | 118 GLsizei real_stride, |
115 GLsizei offset); | 119 GLsizei offset); |
116 | 120 |
117 void SetDivisor(GLsizei divisor) { | 121 void SetDivisor(GLsizei divisor) { |
118 divisor_ = divisor; | 122 divisor_ = divisor; |
119 } | 123 } |
120 | 124 |
125 void SetInteger(GLboolean integer) { | |
126 integer_ = integer; | |
127 } | |
128 | |
121 void Unbind(Buffer* buffer); | 129 void Unbind(Buffer* buffer); |
122 | 130 |
123 // The index of this attrib. | 131 // The index of this attrib. |
124 GLuint index_; | 132 GLuint index_; |
125 | 133 |
126 // Whether or not this attribute is enabled. | 134 // Whether or not this attribute is enabled. |
127 bool enabled_; | 135 bool enabled_; |
128 | 136 |
129 // number of components (1, 2, 3, 4) | 137 // number of components (1, 2, 3, 4) |
130 GLint size_; | 138 GLint size_; |
131 | 139 |
132 // GL_BYTE, GL_FLOAT, etc. See glVertexAttribPointer. | 140 // GL_BYTE, GL_FLOAT, etc. See glVertexAttribPointer. |
133 GLenum type_; | 141 GLenum type_; |
134 | 142 |
135 // The offset into the buffer. | 143 // The offset into the buffer. |
136 GLsizei offset_; | 144 GLsizei offset_; |
137 | 145 |
138 GLboolean normalized_; | 146 GLboolean normalized_; |
139 | 147 |
140 // The stride passed to glVertexAttribPointer. | 148 // The stride passed to glVertexAttribPointer. |
141 GLsizei gl_stride_; | 149 GLsizei gl_stride_; |
142 | 150 |
143 // The stride that will be used to access the buffer. This is the actual | 151 // The stride that will be used to access the buffer. This is the actual |
144 // stide, NOT the GL bogus stride. In other words there is never a stride | 152 // stide, NOT the GL bogus stride. In other words there is never a stride |
145 // of 0. | 153 // of 0. |
146 GLsizei real_stride_; | 154 GLsizei real_stride_; |
147 | 155 |
148 GLsizei divisor_; | 156 GLsizei divisor_; |
149 | 157 |
158 GLboolean integer_; | |
159 | |
150 // Will be true if this was assigned to a client side array. | 160 // Will be true if this was assigned to a client side array. |
151 bool is_client_side_array_; | 161 bool is_client_side_array_; |
152 | 162 |
153 // The buffer bound to this attribute. | 163 // The buffer bound to this attribute. |
154 scoped_refptr<Buffer> buffer_; | 164 scoped_refptr<Buffer> buffer_; |
155 | 165 |
156 // List this info is on. | 166 // List this info is on. |
157 VertexAttribList* list_; | 167 VertexAttribList* list_; |
158 | 168 |
159 // Iterator for list this info is on. Enabled/Disabled | 169 // Iterator for list this info is on. Enabled/Disabled |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
211 } | 221 } |
212 } | 222 } |
213 | 223 |
214 void SetDivisor(GLuint index, GLuint divisor) { | 224 void SetDivisor(GLuint index, GLuint divisor) { |
215 VertexAttrib* attrib = GetVertexAttrib(index); | 225 VertexAttrib* attrib = GetVertexAttrib(index); |
216 if (attrib) { | 226 if (attrib) { |
217 attrib->SetDivisor(divisor); | 227 attrib->SetDivisor(divisor); |
218 } | 228 } |
219 } | 229 } |
220 | 230 |
231 void SetInteger(GLuint index, GLboolean integer) { | |
piman
2015/05/11 21:12:50
Does anything call this? The DoVertexAttribI* func
Zhenyao Mo
2015/05/12 23:57:45
Yes, they would. As I mentioned in a previous com
| |
232 VertexAttrib* attrib = GetVertexAttrib(index); | |
233 if (attrib) { | |
234 attrib->SetInteger(integer); | |
235 } | |
236 } | |
237 | |
221 void SetElementArrayBuffer(Buffer* buffer); | 238 void SetElementArrayBuffer(Buffer* buffer); |
222 | 239 |
223 Buffer* element_array_buffer() const { return element_array_buffer_.get(); } | 240 Buffer* element_array_buffer() const { return element_array_buffer_.get(); } |
224 | 241 |
225 GLuint service_id() const { | 242 GLuint service_id() const { |
226 return service_id_; | 243 return service_id_; |
227 } | 244 } |
228 | 245 |
229 void Unbind(Buffer* buffer); | 246 void Unbind(Buffer* buffer); |
230 | 247 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
287 | 304 |
288 // Service side vertex array object id. | 305 // Service side vertex array object id. |
289 GLuint service_id_; | 306 GLuint service_id_; |
290 }; | 307 }; |
291 | 308 |
292 } // namespace gles2 | 309 } // namespace gles2 |
293 } // namespace gpu | 310 } // namespace gpu |
294 | 311 |
295 #endif // GPU_COMMAND_BUFFER_SERVICE_VERTEX_ATTRIB_MANAGER_H_ | 312 #endif // GPU_COMMAND_BUFFER_SERVICE_VERTEX_ATTRIB_MANAGER_H_ |
296 | 313 |
OLD | NEW |