Index: gpu/command_buffer/service/context_state.h |
diff --git a/gpu/command_buffer/service/context_state.h b/gpu/command_buffer/service/context_state.h |
index 6e2d2931883ee8a1f1237e6ff1998a390cfb2be1..2378eeb3906693caec6f0b98b451a2b5eeedc1c9 100644 |
--- a/gpu/command_buffer/service/context_state.h |
+++ b/gpu/command_buffer/service/context_state.h |
@@ -243,30 +243,27 @@ struct GPU_EXPORT ContextState { |
void SetBoundBuffer(GLenum target, Buffer* buffer); |
void RemoveBoundBuffer(Buffer* buffer); |
- void InitGenericAttribBaseType(GLuint 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; |
- generic_attrib_base_type_mask_.resize(packed_size); |
- for (uint32_t i = 0; i < packed_size; ++i) { |
- // All generic attribs are float type by default. |
- generic_attrib_base_type_mask_[i] = 0x55555555u * SHADER_VARIABLE_FLOAT; |
- } |
+ void InitGenericAttribs(GLuint max_vertex_attribs) { |
+ attrib_values.resize(max_vertex_attribs); |
+ |
+ uint32_t packed_size = max_vertex_attribs / 16; |
+ packed_size += (max_vertex_attribs % 16 == 0) ? 0 : 1; |
+ generic_attrib_base_type_mask_.resize(packed_size); |
+ for (uint32_t i = 0; i < packed_size; ++i) { |
+ // All generic attribs are float type by default. |
+ generic_attrib_base_type_mask_[i] = 0x55555555u * SHADER_VARIABLE_FLOAT; |
+ } |
} |
void SetGenericVertexAttribBaseType(GLuint index, GLenum base_type) { |
- DCHECK(index < max_vertex_attribs_); |
+ DCHECK_LT(index, attrib_values.size()); |
int shift_bits = (index % 16) * 2; |
generic_attrib_base_type_mask_[index / 16] &= ~(0x3 << shift_bits); |
generic_attrib_base_type_mask_[index / 16] |= (base_type << shift_bits); |
} |
- // Return 16 attributes' base types, in which the generic attribute |
- // specified by argument 'index' located. |
- uint32_t GetGenericVertexAttribBaseTypeMask(GLuint index) { |
- DCHECK(index < max_vertex_attribs_); |
- return generic_attrib_base_type_mask_[index / 16]; |
+ const std::vector<uint32_t>& generic_attrib_base_type_mask() const { |
+ return generic_attrib_base_type_mask_; |
} |
void UnbindTexture(TextureRef* texture); |
@@ -346,10 +343,9 @@ struct GPU_EXPORT ContextState { |
bool framebuffer_srgb_; |
- uint32_t max_vertex_attribs_; |
// Generic vertex attrib base types: FLOAT, INT, or UINT. |
// Each base type is encoded into 2 bits, the lowest 2 bits for location 0, |
- // the highest 2 bits for location (max_vertex_attribs_ - 1). |
+ // the highest 2 bits for location (max_vertex_attribs - 1). |
std::vector<uint32_t> generic_attrib_base_type_mask_; |
FeatureInfo* feature_info_; |