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

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

Issue 1708983002: Command buffer: Fix bugs for drawing when the type of vertex attrib is a packed type (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « gpu/command_buffer/service/gles2_cmd_decoder.cc ('k') | no next file » | 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 #include "gpu/command_buffer/service/vertex_attrib_manager.h" 5 #include "gpu/command_buffer/service/vertex_attrib_manager.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <list> 9 #include <list>
10 10
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 // The number of elements that can be accessed. 82 // The number of elements that can be accessed.
83 GLsizeiptr buffer_size = buffer_->size(); 83 GLsizeiptr buffer_size = buffer_->size();
84 if (offset_ > buffer_size || real_stride_ == 0) { 84 if (offset_ > buffer_size || real_stride_ == 0) {
85 return false; 85 return false;
86 } 86 }
87 87
88 uint32_t usable_size = buffer_size - offset_; 88 uint32_t usable_size = buffer_size - offset_;
89 GLuint num_elements = usable_size / real_stride_ + 89 GLuint num_elements = usable_size / real_stride_ +
90 ((usable_size % real_stride_) >= 90 ((usable_size % real_stride_) >=
91 (GLES2Util::GetGLTypeSizeForTexturesAndBuffers(type_) * size_) ? 1 : 0); 91 (GLES2Util::GetGroupSizeForBufferType(size_, type_)) ? 1 : 0);
92 return index < num_elements; 92 return index < num_elements;
93 } 93 }
94 94
95 VertexAttribManager::VertexAttribManager() 95 VertexAttribManager::VertexAttribManager()
96 : num_fixed_attribs_(0), 96 : num_fixed_attribs_(0),
97 element_array_buffer_(NULL), 97 element_array_buffer_(NULL),
98 manager_(NULL), 98 manager_(NULL),
99 deleted_(false), 99 deleted_(false),
100 service_id_(0) { 100 service_id_(0) {
101 } 101 }
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 if (current_buffer_id != kInitialBufferId) { 274 if (current_buffer_id != kInitialBufferId) {
275 // Restore the buffer binding. 275 // Restore the buffer binding.
276 decoder->RestoreBufferBindings(); 276 decoder->RestoreBufferBindings();
277 } 277 }
278 278
279 return true; 279 return true;
280 } 280 }
281 281
282 } // namespace gles2 282 } // namespace gles2
283 } // namespace gpu 283 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698