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

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: update per piman review 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
« no previous file with comments | « gpu/command_buffer/service/vertex_attrib_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..6336c5462d1bebaea112143923626b74b38c1558 100644
--- a/gpu/command_buffer/service/vertex_attrib_manager.cc
+++ b/gpu/command_buffer/service/vertex_attrib_manager.cc
@@ -127,9 +127,7 @@ 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 + 15) / 16;
attrib_base_type_mask_.resize(packed_size);
attrib_enabled_mask_.resize(packed_size);
@@ -157,18 +155,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;
+ if (enable) {
+ attrib_enabled_mask_[index / 16] |= (0x3 << shift_bits);
+ } else {
+ attrib_enabled_mask_[index / 16] &= ~(0x3 << shift_bits);
+ }
}
return true;
}
« no previous file with comments | « gpu/command_buffer/service/vertex_attrib_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698