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

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder.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/gles2_cmd_decoder.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 542d3776531a4dd1212291ca54b655899a919831..2b5a562407f831e678338f617335d971489b1108 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -3078,8 +3078,7 @@ bool GLES2DecoderImpl::Initialize(
state_.indexed_uniform_buffer_bindings = new IndexedBufferBindingHost(
group_->max_uniform_buffer_bindings(), needs_emulation);
- state_.InitGenericAttribBaseType(group_->max_vertex_attribs());
- state_.attrib_values.resize(group_->max_vertex_attribs());
+ state_.InitGenericAttribs(group_->max_vertex_attribs());
vertex_array_manager_.reset(new VertexArrayManager());
GLuint default_vertex_attrib_service_id = 0;
@@ -9137,21 +9136,34 @@ void GLES2DecoderImpl::RestoreStateForSimulatedFixedAttribs() {
}
bool GLES2DecoderImpl::AttribsTypeMatch() {
- for (uint32_t index = 0; index < group_->max_vertex_attribs(); index += 16) {
- uint32_t shader_attrib_written_mask =
- state_.current_program->vertex_input_type_written_mask(index);
- uint32_t vao_attrib_enabled_mask =
- state_.vertex_attrib_manager->attrib_enabled_mask(index);
-
- uint32_t vertex_attrib_base_type_mask =
- (~vao_attrib_enabled_mask &
- state_.GetGenericVertexAttribBaseTypeMask(index)) |
- (vao_attrib_enabled_mask &
- state_.vertex_attrib_manager->attrib_base_type_mask(index));
-
- if ((state_.current_program->vertex_input_base_type_mask(index)
- & shader_attrib_written_mask) !=
- (vertex_attrib_base_type_mask & shader_attrib_written_mask)) {
+ if (!state_.current_program.get())
+ return true;
Zhenyao Mo 2016/07/23 16:10:40 This is actually the crash fix. Everything else i
yunchao 2016/07/24 04:52:13 I see...
+ const std::vector<uint32_t>& shader_attrib_active_mask =
+ state_.current_program->vertex_input_active_mask();
+ const std::vector<uint32_t>& shader_attrib_type_mask =
+ state_.current_program->vertex_input_base_type_mask();
+ const std::vector<uint32_t>& generic_vertex_attrib_type_mask =
+ state_.generic_attrib_base_type_mask();
+ const std::vector<uint32_t>& vertex_attrib_array_enabled_mask =
+ state_.vertex_attrib_manager->attrib_enabled_mask();
+ const std::vector<uint32_t>& vertex_attrib_array_type_mask =
+ state_.vertex_attrib_manager->attrib_base_type_mask();
+ DCHECK_EQ(shader_attrib_active_mask.size(),
+ shader_attrib_type_mask.size());
+ DCHECK_EQ(shader_attrib_active_mask.size(),
+ generic_vertex_attrib_type_mask.size());
+ DCHECK_EQ(shader_attrib_active_mask.size(),
+ vertex_attrib_array_enabled_mask.size());
+ DCHECK_EQ(shader_attrib_active_mask.size(),
+ vertex_attrib_array_type_mask.size());
+ for (size_t ii = 0; ii < shader_attrib_active_mask.size(); ++ii) {
Zhenyao Mo 2016/07/23 16:10:40 This is a minor optimization. We can just query th
+ uint32_t vertex_attrib_source_type_mask =
+ (~vertex_attrib_array_enabled_mask[ii] &
+ generic_vertex_attrib_type_mask[ii]) |
+ (vertex_attrib_array_enabled_mask[ii] &
+ vertex_attrib_array_type_mask[ii]);
+ if ((shader_attrib_type_mask[ii] & shader_attrib_active_mask[ii]) !=
+ (vertex_attrib_source_type_mask & shader_attrib_active_mask[ii])) {
return false;
}
}

Powered by Google App Engine
This is Rietveld 408576698