Index: gpu/command_buffer/service/vertex_attrib_manager.cc |
diff --git a/gpu/command_buffer/service/vertex_attrib_manager.cc b/gpu/command_buffer/service/vertex_attrib_manager.cc |
index abaecea39018b6c13321f7ab7fa10c9becb41b36..6336c5462d1bebaea112143923626b74b38c1558 100644 |
--- a/gpu/command_buffer/service/vertex_attrib_manager.cc |
+++ b/gpu/command_buffer/service/vertex_attrib_manager.cc |
@@ -10,7 +10,6 @@ |
#include "base/logging.h" |
#include "base/strings/string_number_conversions.h" |
-#include "base/strings/stringprintf.h" |
#include "build/build_config.h" |
#include "gpu/command_buffer/common/gles2_cmd_format.h" |
#include "gpu/command_buffer/common/gles2_cmd_utils.h" |
@@ -77,7 +76,10 @@ |
return true; |
} |
- DCHECK(buffer_.get() && !buffer_->IsDeleted()); |
+ if (!buffer_.get() || buffer_->IsDeleted()) { |
+ return false; |
+ } |
+ |
// The number of elements that can be accessed. |
GLsizeiptr buffer_size = buffer_->size(); |
if (offset_ > buffer_size || real_stride_ == 0) { |
@@ -180,7 +182,6 @@ |
const char* function_name, |
GLES2Decoder* decoder, |
FeatureInfo* feature_info, |
- BufferManager* buffer_manager, |
Program* current_program, |
GLuint max_vertex_accessed, |
bool instanced, |
@@ -201,13 +202,6 @@ |
for (VertexAttribList::iterator it = enabled_vertex_attribs_.begin(); |
it != enabled_vertex_attribs_.end(); ++it) { |
VertexAttrib* attrib = *it; |
- Buffer* buffer = attrib->buffer(); |
- std::string msg_tag = base::StringPrintf( |
- "attached to enabled attrib %u", attrib->index()); |
- if (!buffer_manager->RequestBufferAccess( |
- error_state, buffer, function_name, msg_tag.c_str())) { |
- return false; |
- } |
const Program::VertexAttrib* attrib_info = |
current_program->GetAttribInfoByLocation(attrib->index()); |
if (attrib_info) { |
@@ -224,6 +218,7 @@ |
return false; |
} |
if (use_client_side_arrays_for_stream_buffers) { |
+ Buffer* buffer = attrib->buffer(); |
glEnableVertexAttribArray(attrib->index()); |
if (buffer->IsClientSideArray()) { |
if (current_buffer_id != 0) { |
@@ -259,7 +254,16 @@ |
} |
} else { |
// This attrib is not used in the current program. |
- if (use_client_side_arrays_for_stream_buffers) { |
+ if (!attrib->buffer()) { |
+ ERRORSTATE_SET_GL_ERROR( |
+ error_state, GL_INVALID_OPERATION, function_name, |
+ (std::string( |
+ "attempt to render with no buffer attached to " |
+ "enabled attribute ") + |
+ base::UintToString(attrib->index())).c_str()); |
+ return false; |
+ } else if (use_client_side_arrays_for_stream_buffers) { |
+ Buffer* buffer = attrib->buffer(); |
// Disable client side arrays for unused attributes else we'll |
// read bad memory |
if (buffer->IsClientSideArray()) { |