Chromium Code Reviews| Index: gpu/command_buffer/service/vertex_attrib_manager.cc |
| diff --git a/gpu/command_buffer/service/vertex_attrib_manager.cc b/gpu/command_buffer/service/vertex_attrib_manager.cc |
| index 2e18356ccae22edcaac6af37b76778a843901a03..b344a7726ee431f7f50bd9dacadb6c3fc8a0cdf5 100644 |
| --- a/gpu/command_buffer/service/vertex_attrib_manager.cc |
| +++ b/gpu/command_buffer/service/vertex_attrib_manager.cc |
| @@ -127,9 +127,8 @@ VertexAttribManager::~VertexAttribManager() { |
| void VertexAttribManager::Initialize(uint32_t max_vertex_attribs, |
| bool init_attribs) { |
| vertex_attribs_.resize(max_vertex_attribs); |
| - max_vertex_attribs_ = max_vertex_attribs; |
| - uint32_t packed_size = max_vertex_attribs_ / 16; |
| - packed_size += (max_vertex_attribs_ % 16 == 0) ? 0 : 1; |
| + uint32_t packed_size = max_vertex_attribs / 16; |
| + packed_size += (max_vertex_attribs % 16 == 0) ? 0 : 1; |
|
piman
2016/07/25 20:04:04
nit: ditto, uint32_t packed_size = (max_vertex_att
|
| attrib_base_type_mask_.resize(packed_size); |
| attrib_enabled_mask_.resize(packed_size); |
| @@ -157,18 +156,16 @@ bool VertexAttribManager::Enable(GLuint index, bool enable) { |
| return false; |
| } |
| - DCHECK(index < max_vertex_attribs_); |
| - GLuint shift_bits = (index % 16) * 2; |
| - if (enable) { |
| - attrib_enabled_mask_[index / 16] |= (0x3 << shift_bits); |
| - } else { |
| - attrib_enabled_mask_[index / 16] &= ~(0x3 << shift_bits); |
| - } |
| - |
| VertexAttrib& info = vertex_attribs_[index]; |
| if (info.enabled() != enable) { |
| info.set_enabled(enable); |
| info.SetList(enable ? &enabled_vertex_attribs_ : &disabled_vertex_attribs_); |
| + GLuint shift_bits = (index % 16) * 2; |
|
Zhenyao Mo
2016/07/23 16:10:40
We only need to do this if the glEnableDisable cal
yunchao
2016/07/24 04:52:13
Acknowledged.
|
| + if (enable) { |
| + attrib_enabled_mask_[index / 16] |= (0x3 << shift_bits); |
| + } else { |
| + attrib_enabled_mask_[index / 16] &= ~(0x3 << shift_bits); |
| + } |
| } |
| return true; |
| } |