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

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

Issue 2175673003: WebGL 2: Fix nits when check vertexAttrib type with variable type in vertex shader (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 unified diff | Download patch
« no previous file with comments | « no previous file | gpu/command_buffer/service/context_state.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // This file contains the ContextState class. 5 // This file contains the ContextState class.
6 6
7 #ifndef GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ 7 #ifndef GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_
8 #define GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ 8 #define GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_
9 9
10 #include <memory> 10 #include <memory>
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 240
241 ErrorState* GetErrorState(); 241 ErrorState* GetErrorState();
242 242
243 void SetBoundBuffer(GLenum target, Buffer* buffer); 243 void SetBoundBuffer(GLenum target, Buffer* buffer);
244 void RemoveBoundBuffer(Buffer* buffer); 244 void RemoveBoundBuffer(Buffer* buffer);
245 245
246 void InitGenericAttribBaseType(GLuint max_vertex_attribs) { 246 void InitGenericAttribBaseType(GLuint max_vertex_attribs) {
247 max_vertex_attribs_ = max_vertex_attribs; 247 max_vertex_attribs_ = max_vertex_attribs;
248 248
249 uint32_t packed_size = max_vertex_attribs_ / 16; 249 uint32_t packed_size = max_vertex_attribs_ / 16;
250 packed_size += (max_vertex_attribs_ % 16 == 0) ? 0 : 1; 250 packed_size += (max_vertex_attribs_ % 16 == 0) ? 0 : 1;
yunchao 2016/07/22 17:32:24 If you want to use ceil(), please don't forget to
251 generic_attrib_base_type_mask_.resize(packed_size); 251 generic_attrib_base_type_mask_.resize(packed_size);
252 for (uint32_t i = 0; i < packed_size; ++i) { 252 for (uint32_t i = 0; i < packed_size; ++i) {
253 generic_attrib_base_type_mask_[i] = 0xFFFFFFFF; 253 // All generic attribs are float type by default.
254 generic_attrib_base_type_mask_[i] = 0x55555555u * SHADER_VARIABLE_FLOAT;
254 } 255 }
255 } 256 }
256 257
257 void SetGenericVertexAttribBaseType(GLuint index, GLenum base_type) { 258 void SetGenericVertexAttribBaseType(GLuint index, GLenum base_type) {
258 DCHECK(index < max_vertex_attribs_); 259 DCHECK(index < max_vertex_attribs_);
259 int shift_bits = (index % 16) * 2; 260 int shift_bits = (index % 16) * 2;
260 generic_attrib_base_type_mask_[index / 16] &= ~(0x3 << shift_bits); 261 generic_attrib_base_type_mask_[index / 16] &= ~(0x3 << shift_bits);
261 generic_attrib_base_type_mask_[index / 16] |= (base_type << shift_bits); 262 generic_attrib_base_type_mask_[index / 16] |= (base_type << shift_bits);
262 } 263 }
263 264
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 354
354 FeatureInfo* feature_info_; 355 FeatureInfo* feature_info_;
355 std::unique_ptr<ErrorState> error_state_; 356 std::unique_ptr<ErrorState> error_state_;
356 }; 357 };
357 358
358 } // namespace gles2 359 } // namespace gles2
359 } // namespace gpu 360 } // namespace gpu
360 361
361 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ 362 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_
362 363
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/service/context_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698