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

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

Issue 2469803003: Revert of Initialize buffers before allowing access to them. (Closed)
Patch Set: Created 4 years, 1 month 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
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()) {
« no previous file with comments | « gpu/command_buffer/service/vertex_attrib_manager.h ('k') | gpu/command_buffer/service/vertex_attrib_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698