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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.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, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 3060 matching lines...) Expand 10 before | Expand all | Expand 10 after
3071 glGenTransformFeedbacks(1, &default_transform_feedback); 3071 glGenTransformFeedbacks(1, &default_transform_feedback);
3072 state_.default_transform_feedback = 3072 state_.default_transform_feedback =
3073 transform_feedback_manager_->CreateTransformFeedback( 3073 transform_feedback_manager_->CreateTransformFeedback(
3074 0, default_transform_feedback); 3074 0, default_transform_feedback);
3075 glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, default_transform_feedback); 3075 glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, default_transform_feedback);
3076 state_.bound_transform_feedback = state_.default_transform_feedback.get(); 3076 state_.bound_transform_feedback = state_.default_transform_feedback.get();
3077 } 3077 }
3078 state_.indexed_uniform_buffer_bindings = new IndexedBufferBindingHost( 3078 state_.indexed_uniform_buffer_bindings = new IndexedBufferBindingHost(
3079 group_->max_uniform_buffer_bindings(), needs_emulation); 3079 group_->max_uniform_buffer_bindings(), needs_emulation);
3080 3080
3081 state_.InitGenericAttribs(group_->max_vertex_attribs()); 3081 state_.InitGenericAttribBaseType(group_->max_vertex_attribs());
3082 state_.attrib_values.resize(group_->max_vertex_attribs());
3082 vertex_array_manager_.reset(new VertexArrayManager()); 3083 vertex_array_manager_.reset(new VertexArrayManager());
3083 3084
3084 GLuint default_vertex_attrib_service_id = 0; 3085 GLuint default_vertex_attrib_service_id = 0;
3085 if (features().native_vertex_array_object) { 3086 if (features().native_vertex_array_object) {
3086 glGenVertexArraysOES(1, &default_vertex_attrib_service_id); 3087 glGenVertexArraysOES(1, &default_vertex_attrib_service_id);
3087 glBindVertexArrayOES(default_vertex_attrib_service_id); 3088 glBindVertexArrayOES(default_vertex_attrib_service_id);
3088 } 3089 }
3089 3090
3090 state_.default_vertex_attrib_manager = 3091 state_.default_vertex_attrib_manager =
3091 CreateVertexAttribManager(0, default_vertex_attrib_service_id, false); 3092 CreateVertexAttribManager(0, default_vertex_attrib_service_id, false);
(...skipping 6037 matching lines...) Expand 10 before | Expand all | Expand 10 after
9129 void GLES2DecoderImpl::RestoreStateForSimulatedFixedAttribs() { 9130 void GLES2DecoderImpl::RestoreStateForSimulatedFixedAttribs() {
9130 // There's no need to call glVertexAttribPointer because we shadow all the 9131 // There's no need to call glVertexAttribPointer because we shadow all the
9131 // settings and passing GL_FIXED to it will not work. 9132 // settings and passing GL_FIXED to it will not work.
9132 glBindBuffer( 9133 glBindBuffer(
9133 GL_ARRAY_BUFFER, 9134 GL_ARRAY_BUFFER,
9134 state_.bound_array_buffer.get() ? state_.bound_array_buffer->service_id() 9135 state_.bound_array_buffer.get() ? state_.bound_array_buffer->service_id()
9135 : 0); 9136 : 0);
9136 } 9137 }
9137 9138
9138 bool GLES2DecoderImpl::AttribsTypeMatch() { 9139 bool GLES2DecoderImpl::AttribsTypeMatch() {
9139 if (!state_.current_program.get()) 9140 for (uint32_t index = 0; index < group_->max_vertex_attribs(); index += 16) {
9140 return true; 9141 uint32_t shader_attrib_written_mask =
9141 const std::vector<uint32_t>& shader_attrib_active_mask = 9142 state_.current_program->vertex_input_type_written_mask(index);
9142 state_.current_program->vertex_input_active_mask(); 9143 uint32_t vao_attrib_enabled_mask =
9143 const std::vector<uint32_t>& shader_attrib_type_mask = 9144 state_.vertex_attrib_manager->attrib_enabled_mask(index);
9144 state_.current_program->vertex_input_base_type_mask(); 9145
9145 const std::vector<uint32_t>& generic_vertex_attrib_type_mask = 9146 uint32_t vertex_attrib_base_type_mask =
9146 state_.generic_attrib_base_type_mask(); 9147 (~vao_attrib_enabled_mask &
9147 const std::vector<uint32_t>& vertex_attrib_array_enabled_mask = 9148 state_.GetGenericVertexAttribBaseTypeMask(index)) |
9148 state_.vertex_attrib_manager->attrib_enabled_mask(); 9149 (vao_attrib_enabled_mask &
9149 const std::vector<uint32_t>& vertex_attrib_array_type_mask = 9150 state_.vertex_attrib_manager->attrib_base_type_mask(index));
9150 state_.vertex_attrib_manager->attrib_base_type_mask(); 9151
9151 DCHECK_EQ(shader_attrib_active_mask.size(), 9152 if ((state_.current_program->vertex_input_base_type_mask(index)
9152 shader_attrib_type_mask.size()); 9153 & shader_attrib_written_mask) !=
9153 DCHECK_EQ(shader_attrib_active_mask.size(), 9154 (vertex_attrib_base_type_mask & shader_attrib_written_mask)) {
9154 generic_vertex_attrib_type_mask.size());
9155 DCHECK_EQ(shader_attrib_active_mask.size(),
9156 vertex_attrib_array_enabled_mask.size());
9157 DCHECK_EQ(shader_attrib_active_mask.size(),
9158 vertex_attrib_array_type_mask.size());
9159 for (size_t ii = 0; ii < shader_attrib_active_mask.size(); ++ii) {
9160 uint32_t vertex_attrib_source_type_mask =
9161 (~vertex_attrib_array_enabled_mask[ii] &
9162 generic_vertex_attrib_type_mask[ii]) |
9163 (vertex_attrib_array_enabled_mask[ii] &
9164 vertex_attrib_array_type_mask[ii]);
9165 if ((shader_attrib_type_mask[ii] & shader_attrib_active_mask[ii]) !=
9166 (vertex_attrib_source_type_mask & shader_attrib_active_mask[ii])) {
9167 return false; 9155 return false;
9168 } 9156 }
9169 } 9157 }
9170 return true; 9158 return true;
9171 } 9159 }
9172 9160
9173 error::Error GLES2DecoderImpl::DoDrawArrays( 9161 error::Error GLES2DecoderImpl::DoDrawArrays(
9174 const char* function_name, 9162 const char* function_name,
9175 bool instanced, 9163 bool instanced,
9176 GLenum mode, 9164 GLenum mode,
(...skipping 8466 matching lines...) Expand 10 before | Expand all | Expand 10 after
17643 } 17631 }
17644 17632
17645 // Include the auto-generated part of this file. We split this because it means 17633 // Include the auto-generated part of this file. We split this because it means
17646 // we can easily edit the non-auto generated parts right here in this file 17634 // we can easily edit the non-auto generated parts right here in this file
17647 // instead of having to edit some template or the code generator. 17635 // instead of having to edit some template or the code generator.
17648 #include "base/macros.h" 17636 #include "base/macros.h"
17649 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 17637 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
17650 17638
17651 } // namespace gles2 17639 } // namespace gles2
17652 } // namespace gpu 17640 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/context_state.cc ('k') | gpu/command_buffer/service/program_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698