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

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

Issue 2181193002: Revert of 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
« no previous file with comments | « gpu/command_buffer/service/program_manager.h ('k') | gpu/command_buffer/service/vertex_attrib_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/program_manager.cc
diff --git a/gpu/command_buffer/service/program_manager.cc b/gpu/command_buffer/service/program_manager.cc
index 7adbbdfea11e2ffdad89eef7bd3080effa36fed9..ca0725533b0a172b70f41b72dd2e2b2dc1f54fc2 100644
--- a/gpu/command_buffer/service/program_manager.cc
+++ b/gpu/command_buffer/service/program_manager.cc
@@ -310,10 +310,6 @@
fragment_output_written_mask_(0u) {
DCHECK(manager_);
manager_->StartTracking(this);
- uint32_t packed_size = (manager_->max_vertex_attribs() + 15) / 16;
- vertex_input_base_type_mask_.resize(packed_size);
- vertex_input_active_mask_.resize(packed_size);
- ClearVertexInputMasks();
}
void Program::Reset() {
@@ -331,14 +327,8 @@
attrib_location_to_index_map_.clear();
fragment_output_type_mask_ = 0u;
fragment_output_written_mask_ = 0u;
- ClearVertexInputMasks();
-}
-
-void Program::ClearVertexInputMasks() {
- for (uint32_t ii = 0; ii < vertex_input_base_type_mask_.size(); ++ii) {
- vertex_input_base_type_mask_[ii] = 0u;
- vertex_input_active_mask_[ii] = 0u;
- }
+ vertex_input_base_type_mask_.clear();
+ vertex_input_type_written_mask_.clear();
}
void Program::UpdateFragmentOutputBaseTypes() {
@@ -380,17 +370,27 @@
}
void Program::UpdateVertexInputBaseTypes() {
- ClearVertexInputMasks();
- DCHECK_LE(attrib_infos_.size(), manager_->max_vertex_attribs());
+ max_vertex_attribs_ = manager_->max_vertex_attribs();
+ uint32_t packed_size = max_vertex_attribs_ / 16;
+ packed_size += (max_vertex_attribs_ % 16 == 0) ? 0 : 1;
+ vertex_input_base_type_mask_.resize(packed_size);
+ vertex_input_type_written_mask_.resize(packed_size);
+
+ for (uint32_t ii = 0; ii < packed_size; ++ii) {
+ vertex_input_type_written_mask_[ii] = 0u;
+ vertex_input_base_type_mask_[ii] = 0u;
+ }
+
for (size_t ii = 0; ii < attrib_infos_.size(); ++ii) {
+ DCHECK(ii < max_vertex_attribs_);
const VertexAttrib& input = attrib_infos_[ii];
if (ProgramManager::HasBuiltInPrefix(input.name)) {
continue;
}
int shift_bits = (input.location % 16) * 2;
- vertex_input_active_mask_[ii / 16] |= 0x3 << shift_bits;
- vertex_input_base_type_mask_[ii / 16] |=
- InputOutputTypeToBaseType(true, input.type) << shift_bits;
+ vertex_input_type_written_mask_[ii / 16] |= 0x3 << shift_bits;
+ vertex_input_base_type_mask_[ii / 16] |=
+ InputOutputTypeToBaseType(true, input.type) << shift_bits;
}
}
« no previous file with comments | « gpu/command_buffer/service/program_manager.h ('k') | gpu/command_buffer/service/vertex_attrib_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698