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

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 10019003: Always write data to new buffer in SimulateAttrib0 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/gles2_cmd_decoder.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 1f3ac6f1e93ccc5bfae105341b2adfcd2c165eb3..6e5bdd701a39882bffaefcee288c68f9a43f7629 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -4962,21 +4962,22 @@ bool GLES2DecoderImpl::SimulateAttrib0(
CopyRealGLErrorsToWrapper();
glBindBuffer(GL_ARRAY_BUFFER, attrib_0_buffer_id_);
- if (static_cast<GLsizei>(size_needed) > attrib_0_size_) {
+ bool new_buffer = static_cast<GLsizei>(size_needed) > attrib_0_size_;
+ if (new_buffer) {
glBufferData(GL_ARRAY_BUFFER, size_needed, NULL, GL_DYNAMIC_DRAW);
GLenum error = glGetError();
if (error != GL_NO_ERROR) {
SetGLError(GL_OUT_OF_MEMORY, "glDrawXXX: Simulating attrib 0");
return false;
}
- attrib_0_buffer_matches_value_ = false;
- }
- if (attrib_0_used &&
- (!attrib_0_buffer_matches_value_ ||
- (info->value().v[0] != attrib_0_value_.v[0] ||
- info->value().v[1] != attrib_0_value_.v[1] ||
- info->value().v[2] != attrib_0_value_.v[2] ||
- info->value().v[3] != attrib_0_value_.v[3]))) {
+ }
+ if (new_buffer ||
+ (attrib_0_used &&
+ (!attrib_0_buffer_matches_value_ ||
+ (info->value().v[0] != attrib_0_value_.v[0] ||
+ info->value().v[1] != attrib_0_value_.v[1] ||
+ info->value().v[2] != attrib_0_value_.v[2] ||
+ info->value().v[3] != attrib_0_value_.v[3])))) {
std::vector<Vec4> temp(num_vertices, info->value());
glBufferSubData(GL_ARRAY_BUFFER, 0, size_needed, &temp[0].v[0]);
attrib_0_buffer_matches_value_ = true;
« 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