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

Unified Diff: gpu/command_buffer/service/vertex_attrib_manager.cc

Issue 2174173002: current program can be null in ES2/ES3 contexts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
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;
}

Powered by Google App Engine
This is Rietveld 408576698