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 // This file contains the ContextState class. | 5 // This file contains the ContextState class. |
6 | 6 |
7 #ifndef GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ | 7 #ifndef GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ |
8 #define GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ | 8 #define GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
240 | 240 |
241 ErrorState* GetErrorState(); | 241 ErrorState* GetErrorState(); |
242 | 242 |
243 void SetBoundBuffer(GLenum target, Buffer* buffer); | 243 void SetBoundBuffer(GLenum target, Buffer* buffer); |
244 void RemoveBoundBuffer(Buffer* buffer); | 244 void RemoveBoundBuffer(Buffer* buffer); |
245 | 245 |
246 void InitGenericAttribBaseType(GLuint max_vertex_attribs) { | 246 void InitGenericAttribBaseType(GLuint max_vertex_attribs) { |
247 max_vertex_attribs_ = max_vertex_attribs; | 247 max_vertex_attribs_ = max_vertex_attribs; |
248 | 248 |
249 uint32_t packed_size = max_vertex_attribs_ / 16; | 249 uint32_t packed_size = max_vertex_attribs_ / 16; |
250 packed_size += (max_vertex_attribs_ % 16 == 0) ? 0 : 1; | 250 packed_size += (max_vertex_attribs_ % 16 == 0) ? 0 : 1; |
yunchao
2016/07/22 17:32:24
If you want to use ceil(), please don't forget to
| |
251 generic_attrib_base_type_mask_.resize(packed_size); | 251 generic_attrib_base_type_mask_.resize(packed_size); |
252 for (uint32_t i = 0; i < packed_size; ++i) { | 252 for (uint32_t i = 0; i < packed_size; ++i) { |
253 generic_attrib_base_type_mask_[i] = 0xFFFFFFFF; | 253 // All generic attribs are float type by default. |
254 generic_attrib_base_type_mask_[i] = 0x55555555u * SHADER_VARIABLE_FLOAT; | |
254 } | 255 } |
255 } | 256 } |
256 | 257 |
257 void SetGenericVertexAttribBaseType(GLuint index, GLenum base_type) { | 258 void SetGenericVertexAttribBaseType(GLuint index, GLenum base_type) { |
258 DCHECK(index < max_vertex_attribs_); | 259 DCHECK(index < max_vertex_attribs_); |
259 int shift_bits = (index % 16) * 2; | 260 int shift_bits = (index % 16) * 2; |
260 generic_attrib_base_type_mask_[index / 16] &= ~(0x3 << shift_bits); | 261 generic_attrib_base_type_mask_[index / 16] &= ~(0x3 << shift_bits); |
261 generic_attrib_base_type_mask_[index / 16] |= (base_type << shift_bits); | 262 generic_attrib_base_type_mask_[index / 16] |= (base_type << shift_bits); |
262 } | 263 } |
263 | 264 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
353 | 354 |
354 FeatureInfo* feature_info_; | 355 FeatureInfo* feature_info_; |
355 std::unique_ptr<ErrorState> error_state_; | 356 std::unique_ptr<ErrorState> error_state_; |
356 }; | 357 }; |
357 | 358 |
358 } // namespace gles2 | 359 } // namespace gles2 |
359 } // namespace gpu | 360 } // namespace gpu |
360 | 361 |
361 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ | 362 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ |
362 | 363 |
OLD | NEW |