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

Side by Side Diff: gpu/command_buffer/service/context_state.cc

Issue 1136713003: Add ES3 commands GetVertexAttribI{u}iv to GPU command buffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 7 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/context_state.h" 5 #include "gpu/command_buffer/service/context_state.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 9 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
10 #include "gpu/command_buffer/service/buffer_manager.h" 10 #include "gpu/command_buffer/service/buffer_manager.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 void ContextState::RestoreActiveTextureUnitBinding(unsigned int target) const { 178 void ContextState::RestoreActiveTextureUnitBinding(unsigned int target) const {
179 DCHECK_LT(active_texture_unit, texture_units.size()); 179 DCHECK_LT(active_texture_unit, texture_units.size());
180 const TextureUnit& texture_unit = texture_units[active_texture_unit]; 180 const TextureUnit& texture_unit = texture_units[active_texture_unit];
181 if (TargetIsSupported(feature_info_, target)) 181 if (TargetIsSupported(feature_info_, target))
182 glBindTexture(target, GetServiceId(texture_unit, target)); 182 glBindTexture(target, GetServiceId(texture_unit, target));
183 } 183 }
184 184
185 void ContextState::RestoreVertexAttribValues() const { 185 void ContextState::RestoreVertexAttribValues() const {
186 for (size_t attrib = 0; attrib < vertex_attrib_manager->num_attribs(); 186 for (size_t attrib = 0; attrib < vertex_attrib_manager->num_attribs();
187 ++attrib) { 187 ++attrib) {
188 glVertexAttrib4fv(attrib, attrib_values[attrib].v); 188 switch (attrib_values[attrib].type) {
189 case Vec4::kFloat:
190 {
191 GLfloat v[4];
192 for (size_t ii = 0; ii < 4; ++ii) {
193 v[ii] = static_cast<GLfloat>(attrib_values[attrib].v[ii]);
194 }
195 glVertexAttrib4fv(attrib, v);
196 }
197 break;
198 case Vec4::kInt:
199 {
200 GLint v[4];
201 for (size_t ii = 0; ii < 4; ++ii) {
202 v[ii] = static_cast<GLint>(attrib_values[attrib].v[ii]);
203 }
204 glVertexAttribI4iv(attrib, v);
205 }
206 break;
207 case Vec4::kUInt:
208 {
209 GLuint v[4];
210 for (size_t ii = 0; ii < 4; ++ii) {
211 v[ii] = static_cast<GLuint>(attrib_values[attrib].v[ii]);
212 }
213 glVertexAttribI4uiv(attrib, v);
214 }
215 break;
216 }
189 } 217 }
190 } 218 }
191 219
192 void ContextState::RestoreVertexAttribArrays( 220 void ContextState::RestoreVertexAttribArrays(
193 const scoped_refptr<VertexAttribManager> attrib_manager) const { 221 const scoped_refptr<VertexAttribManager> attrib_manager) const {
194 // This is expected to be called only for VAO with service_id 0, 222 // This is expected to be called only for VAO with service_id 0,
195 // either to restore the default VAO or a virtual VAO with service_id 0. 223 // either to restore the default VAO or a virtual VAO with service_id 0.
196 GLuint vao_service_id = attrib_manager->service_id(); 224 GLuint vao_service_id = attrib_manager->service_id();
197 DCHECK(vao_service_id == 0); 225 DCHECK(vao_service_id == 0);
198 226
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 325
298 // Include the auto-generated part of this file. We split this because it means 326 // Include the auto-generated part of this file. We split this because it means
299 // we can easily edit the non-auto generated parts right here in this file 327 // we can easily edit the non-auto generated parts right here in this file
300 // instead of having to edit some template or the code generator. 328 // instead of having to edit some template or the code generator.
301 #include "gpu/command_buffer/service/context_state_impl_autogen.h" 329 #include "gpu/command_buffer/service/context_state_impl_autogen.h"
302 330
303 } // namespace gles2 331 } // namespace gles2
304 } // namespace gpu 332 } // namespace gpu
305 333
306 334
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698