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

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

Issue 10268004: Merge 131538 - Always write data to new buffer in SimulateAttrib0 (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1084/src/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 5050 matching lines...) Expand 10 before | Expand all | Expand 10 after
5061 !SafeMultiply(num_vertices, static_cast<GLuint>(sizeof(Vec4)), 5061 !SafeMultiply(num_vertices, static_cast<GLuint>(sizeof(Vec4)),
5062 &size_needed) || 5062 &size_needed) ||
5063 size_needed > 0x7FFFFFFFU) { 5063 size_needed > 0x7FFFFFFFU) {
5064 SetGLError(GL_OUT_OF_MEMORY, "glDrawXXX: Simulating attrib 0"); 5064 SetGLError(GL_OUT_OF_MEMORY, "glDrawXXX: Simulating attrib 0");
5065 return false; 5065 return false;
5066 } 5066 }
5067 5067
5068 CopyRealGLErrorsToWrapper(); 5068 CopyRealGLErrorsToWrapper();
5069 glBindBuffer(GL_ARRAY_BUFFER, attrib_0_buffer_id_); 5069 glBindBuffer(GL_ARRAY_BUFFER, attrib_0_buffer_id_);
5070 5070
5071 if (static_cast<GLsizei>(size_needed) > attrib_0_size_) { 5071 bool new_buffer = static_cast<GLsizei>(size_needed) > attrib_0_size_;
5072 if (new_buffer) {
5072 glBufferData(GL_ARRAY_BUFFER, size_needed, NULL, GL_DYNAMIC_DRAW); 5073 glBufferData(GL_ARRAY_BUFFER, size_needed, NULL, GL_DYNAMIC_DRAW);
5073 GLenum error = glGetError(); 5074 GLenum error = glGetError();
5074 if (error != GL_NO_ERROR) { 5075 if (error != GL_NO_ERROR) {
5075 SetGLError(GL_OUT_OF_MEMORY, "glDrawXXX: Simulating attrib 0"); 5076 SetGLError(GL_OUT_OF_MEMORY, "glDrawXXX: Simulating attrib 0");
5076 return false; 5077 return false;
5077 } 5078 }
5078 attrib_0_buffer_matches_value_ = false;
5079 } 5079 }
5080 if (attrib_0_used && 5080 if (new_buffer ||
5081 (!attrib_0_buffer_matches_value_ || 5081 (attrib_0_used &&
5082 (info->value().v[0] != attrib_0_value_.v[0] || 5082 (!attrib_0_buffer_matches_value_ ||
5083 info->value().v[1] != attrib_0_value_.v[1] || 5083 (info->value().v[0] != attrib_0_value_.v[0] ||
5084 info->value().v[2] != attrib_0_value_.v[2] || 5084 info->value().v[1] != attrib_0_value_.v[1] ||
5085 info->value().v[3] != attrib_0_value_.v[3]))) { 5085 info->value().v[2] != attrib_0_value_.v[2] ||
5086 info->value().v[3] != attrib_0_value_.v[3])))) {
5086 std::vector<Vec4> temp(num_vertices, info->value()); 5087 std::vector<Vec4> temp(num_vertices, info->value());
5087 glBufferSubData(GL_ARRAY_BUFFER, 0, size_needed, &temp[0].v[0]); 5088 glBufferSubData(GL_ARRAY_BUFFER, 0, size_needed, &temp[0].v[0]);
5088 attrib_0_buffer_matches_value_ = true; 5089 attrib_0_buffer_matches_value_ = true;
5089 attrib_0_value_ = info->value(); 5090 attrib_0_value_ = info->value();
5090 attrib_0_size_ = size_needed; 5091 attrib_0_size_ = size_needed;
5091 } 5092 }
5092 5093
5093 glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, NULL); 5094 glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, NULL);
5094 5095
5095 if (info->divisor()) 5096 if (info->divisor())
(...skipping 3322 matching lines...) Expand 10 before | Expand all | Expand 10 after
8418 } 8419 }
8419 } 8420 }
8420 8421
8421 // Include the auto-generated part of this file. We split this because it means 8422 // Include the auto-generated part of this file. We split this because it means
8422 // we can easily edit the non-auto generated parts right here in this file 8423 // we can easily edit the non-auto generated parts right here in this file
8423 // instead of having to edit some template or the code generator. 8424 // instead of having to edit some template or the code generator.
8424 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 8425 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
8425 8426
8426 } // namespace gles2 8427 } // namespace gles2
8427 } // namespace gpu 8428 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698