diff options
author | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-11 18:11:43 +0000 |
---|---|---|
committer | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-11 18:11:43 +0000 |
commit | d8ea977258cef32228032f48076bbfd9746cb13a (patch) | |
tree | 76fb578b365d8dddfa37144547f53394f646dcf3 /gpu | |
parent | 5d8826db2f608ee6e90e5cd987d34aac5e2ee6e4 (diff) | |
download | chromium_src-d8ea977258cef32228032f48076bbfd9746cb13a.zip chromium_src-d8ea977258cef32228032f48076bbfd9746cb13a.tar.gz chromium_src-d8ea977258cef32228032f48076bbfd9746cb13a.tar.bz2 |
Move VertexAttribManager to another file.
Just trying to slowly pair down gles2_cmd_decoder.cc
TEST=unit tests
BUG=none
R=apatrick@chromium.org
Review URL: http://codereview.chromium.org/7331023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92029 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r-- | gpu/command_buffer/service/gles2_cmd_decoder.cc | 259 | ||||
-rw-r--r-- | gpu/command_buffer/service/vertex_attrib_manager.cc | 66 | ||||
-rw-r--r-- | gpu/command_buffer/service/vertex_attrib_manager.h | 230 | ||||
-rw-r--r-- | gpu/command_buffer/service/vertex_attrib_manager_unittest.cc | 181 | ||||
-rw-r--r-- | gpu/gpu.gyp | 3 |
5 files changed, 481 insertions, 258 deletions
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index 9c344e1..674cc63 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -36,6 +36,7 @@ #include "gpu/command_buffer/service/shader_translator.h" #include "gpu/command_buffer/service/surface_manager.h" #include "gpu/command_buffer/service/texture_manager.h" +#include "gpu/command_buffer/service/vertex_attrib_manager.h" #include "gpu/GLES2/gles2_command_buffer.h" #include "ui/gfx/gl/gl_context.h" #include "ui/gfx/gl/gl_implementation.h" @@ -441,264 +442,6 @@ GLES2Decoder::GLES2Decoder() GLES2Decoder::~GLES2Decoder() { } -class VertexAttribManager { - public: - // Info about Vertex Attributes. This is used to track what the user currently - // has bound on each Vertex Attribute so that checking can be done at - // glDrawXXX time. - class VertexAttribInfo { - public: - typedef std::list<VertexAttribInfo*> VertexAttribInfoList; - struct Vec4 { - float v[4]; - }; - - VertexAttribInfo() - : index_(0), - enabled_(false), - size_(4), - type_(GL_FLOAT), - offset_(0), - normalized_(GL_FALSE), - gl_stride_(0), - real_stride_(16), - list_(NULL) { - value_.v[0] = 0.0f; - value_.v[1] = 0.0f; - value_.v[2] = 0.0f; - value_.v[3] = 1.0f; - } - - // Returns true if this VertexAttrib can access index. - bool CanAccess(GLuint index) const; - - BufferManager::BufferInfo* buffer() const { - return buffer_; - } - - GLsizei offset() const { - return offset_; - } - - GLuint index() const { - return index_; - } - - GLint size() const { - return size_; - } - - GLenum type() const { - return type_; - } - - GLboolean normalized() const { - return normalized_; - } - - GLsizei gl_stride() const { - return gl_stride_; - } - - bool enabled() const { - return enabled_; - } - - void set_value(const Vec4& value) { - value_ = value; - } - - const Vec4& value() const { - return value_; - } - - private: - friend class VertexAttribManager; - - void set_enabled(bool enabled) { - enabled_ = enabled; - } - - void set_index(GLuint index) { - index_ = index; - } - - void SetList(VertexAttribInfoList* new_list) { - DCHECK(new_list); - - if (list_) { - list_->erase(it_); - } - - it_ = new_list->insert(new_list->end(), this); - list_ = new_list; - } - - void SetInfo( - BufferManager::BufferInfo* buffer, - GLint size, - GLenum type, - GLboolean normalized, - GLsizei gl_stride, - GLsizei real_stride, - GLsizei offset) { - DCHECK_GT(real_stride, 0); - buffer_ = buffer; - size_ = size; - type_ = type; - normalized_ = normalized; - gl_stride_ = gl_stride; - real_stride_ = real_stride; - offset_ = offset; - } - - // The index of this attrib. - GLuint index_; - - // Whether or not this attribute is enabled. - bool enabled_; - - // number of components (1, 2, 3, 4) - GLint size_; - - // GL_BYTE, GL_FLOAT, etc. See glVertexAttribPointer. - GLenum type_; - - // The offset into the buffer. - GLsizei offset_; - - GLboolean normalized_; - - // The stride passed to glVertexAttribPointer. - GLsizei gl_stride_; - - // The stride that will be used to access the buffer. This is the actual - // stide, NOT the GL bogus stride. In other words there is never a stride - // of 0. - GLsizei real_stride_; - - // The current value of the attrib. - Vec4 value_; - - // The buffer bound to this attribute. - BufferManager::BufferInfo::Ref buffer_; - - // List this info is on. - VertexAttribInfoList* list_; - - // Iterator for list this info is on. Enabled/Disabled - VertexAttribInfoList::iterator it_; - }; - - typedef std::list<VertexAttribInfo*> VertexAttribInfoList; - - VertexAttribManager() - : max_vertex_attribs_(0), - num_fixed_attribs_(0) { - } - - void Initialize(uint32 num_vertex_attribs); - - bool Enable(GLuint index, bool enable); - - bool HaveFixedAttribs() const { - return num_fixed_attribs_ != 0; - } - - const VertexAttribInfoList& GetEnabledVertexAttribInfos() const { - return enabled_vertex_attribs_; - } - - VertexAttribInfo* GetVertexAttribInfo(GLuint index) { - if (index < max_vertex_attribs_) { - return &vertex_attrib_infos_[index]; - } - return NULL; - } - - void SetAttribInfo( - GLuint index, - BufferManager::BufferInfo* buffer, - GLint size, - GLenum type, - GLboolean normalized, - GLsizei gl_stride, - GLsizei real_stride, - GLsizei offset) { - VertexAttribInfo* info = GetVertexAttribInfo(index); - if (info) { - if (info->type() == GL_FIXED) { - --num_fixed_attribs_; - } - if (type == GL_FIXED) { - ++num_fixed_attribs_; - } - info->SetInfo( - buffer, size, type, normalized, gl_stride, real_stride, offset); - } - } - - - private: - uint32 max_vertex_attribs_; - - // number of attribs using type GL_FIXED. - int num_fixed_attribs_; - - // Info for each vertex attribute saved so we can check at glDrawXXX time - // if it is safe to draw. - scoped_array<VertexAttribInfo> vertex_attrib_infos_; - - // Lists for which vertex attribs are enabled, disabled. - VertexAttribInfoList enabled_vertex_attribs_; - VertexAttribInfoList disabled_vertex_attribs_; -}; - -bool VertexAttribManager::VertexAttribInfo::CanAccess(GLuint index) const { - if (!enabled_) { - return true; - } - - if (!buffer_ || buffer_->IsDeleted()) { - return false; - } - - // The number of elements that can be accessed. - GLsizeiptr buffer_size = buffer_->size(); - if (offset_ > buffer_size || real_stride_ == 0) { - return false; - } - - uint32 usable_size = buffer_size - offset_; - GLuint num_elements = usable_size / real_stride_ + - ((usable_size % real_stride_) >= - (GLES2Util::GetGLTypeSizeForTexturesAndBuffers(type_) * size_) ? 1 : 0); - return index < num_elements; -} - - -void VertexAttribManager::Initialize(uint32 max_vertex_attribs) { - max_vertex_attribs_ = max_vertex_attribs; - vertex_attrib_infos_.reset( - new VertexAttribInfo[max_vertex_attribs]); - for (uint32 vv = 0; vv < max_vertex_attribs; ++vv) { - vertex_attrib_infos_[vv].set_index(vv); - vertex_attrib_infos_[vv].SetList(&disabled_vertex_attribs_); - } -} - -bool VertexAttribManager::Enable(GLuint index, bool enable) { - if (index >= max_vertex_attribs_) { - return false; - } - VertexAttribInfo& info = vertex_attrib_infos_[index]; - if (info.enabled() != enable) { - info.set_enabled(enable); - info.SetList(enable ? &enabled_vertex_attribs_ : &disabled_vertex_attribs_); - } - return true; -} - // This class implements GLES2Decoder so we don't have to expose all the GLES2 // cmd stuff to outside this class. class GLES2DecoderImpl : public base::SupportsWeakPtr<GLES2DecoderImpl>, diff --git a/gpu/command_buffer/service/vertex_attrib_manager.cc b/gpu/command_buffer/service/vertex_attrib_manager.cc new file mode 100644 index 0000000..831c543 --- /dev/null +++ b/gpu/command_buffer/service/vertex_attrib_manager.cc @@ -0,0 +1,66 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "gpu/command_buffer/service/vertex_attrib_manager.h" + +#include <list> + +#include "base/logging.h" +#include "base/memory/scoped_ptr.h" +#include "build/build_config.h" +#define GLES2_GPU_SERVICE 1 +#include "gpu/command_buffer/common/gles2_cmd_format.h" +#include "gpu/command_buffer/common/gles2_cmd_utils.h" +#include "gpu/command_buffer/service/gl_utils.h" + +namespace gpu { +namespace gles2 { + +bool VertexAttribManager::VertexAttribInfo::CanAccess(GLuint index) const { + if (!enabled_) { + return true; + } + + if (!buffer_ || buffer_->IsDeleted()) { + return false; + } + + // The number of elements that can be accessed. + GLsizeiptr buffer_size = buffer_->size(); + if (offset_ > buffer_size || real_stride_ == 0) { + return false; + } + + uint32 usable_size = buffer_size - offset_; + GLuint num_elements = usable_size / real_stride_ + + ((usable_size % real_stride_) >= + (GLES2Util::GetGLTypeSizeForTexturesAndBuffers(type_) * size_) ? 1 : 0); + return index < num_elements; +} + + +void VertexAttribManager::Initialize(uint32 max_vertex_attribs) { + max_vertex_attribs_ = max_vertex_attribs; + vertex_attrib_infos_.reset( + new VertexAttribInfo[max_vertex_attribs]); + for (uint32 vv = 0; vv < max_vertex_attribs; ++vv) { + vertex_attrib_infos_[vv].set_index(vv); + vertex_attrib_infos_[vv].SetList(&disabled_vertex_attribs_); + } +} + +bool VertexAttribManager::Enable(GLuint index, bool enable) { + if (index >= max_vertex_attribs_) { + return false; + } + VertexAttribInfo& info = vertex_attrib_infos_[index]; + if (info.enabled() != enable) { + info.set_enabled(enable); + info.SetList(enable ? &enabled_vertex_attribs_ : &disabled_vertex_attribs_); + } + return true; +} + +} // namespace gles2 +} // namespace gpu diff --git a/gpu/command_buffer/service/vertex_attrib_manager.h b/gpu/command_buffer/service/vertex_attrib_manager.h new file mode 100644 index 0000000..a26457d --- /dev/null +++ b/gpu/command_buffer/service/vertex_attrib_manager.h @@ -0,0 +1,230 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <list> +#include "base/logging.h" +#include "base/memory/scoped_ptr.h" +#include "build/build_config.h" +#include "gpu/command_buffer/service/buffer_manager.h" +#include "gpu/command_buffer/service/gl_utils.h" + +namespace gpu { +namespace gles2 { + +// Manages vertex attributes. +class VertexAttribManager { + public: + // Info about Vertex Attributes. This is used to track what the user currently + // has bound on each Vertex Attribute so that checking can be done at + // glDrawXXX time. + class VertexAttribInfo { + public: + typedef std::list<VertexAttribInfo*> VertexAttribInfoList; + struct Vec4 { + float v[4]; + }; + + VertexAttribInfo() + : index_(0), + enabled_(false), + size_(4), + type_(GL_FLOAT), + offset_(0), + normalized_(GL_FALSE), + gl_stride_(0), + real_stride_(16), + list_(NULL) { + value_.v[0] = 0.0f; + value_.v[1] = 0.0f; + value_.v[2] = 0.0f; + value_.v[3] = 1.0f; + } + + // Returns true if this VertexAttrib can access index. + bool CanAccess(GLuint index) const; + + BufferManager::BufferInfo* buffer() const { + return buffer_; + } + + GLsizei offset() const { + return offset_; + } + + GLuint index() const { + return index_; + } + + GLint size() const { + return size_; + } + + GLenum type() const { + return type_; + } + + GLboolean normalized() const { + return normalized_; + } + + GLsizei gl_stride() const { + return gl_stride_; + } + + bool enabled() const { + return enabled_; + } + + void set_value(const Vec4& value) { + value_ = value; + } + + const Vec4& value() const { + return value_; + } + + private: + friend class VertexAttribManager; + + void set_enabled(bool enabled) { + enabled_ = enabled; + } + + void set_index(GLuint index) { + index_ = index; + } + + void SetList(VertexAttribInfoList* new_list) { + DCHECK(new_list); + + if (list_) { + list_->erase(it_); + } + + it_ = new_list->insert(new_list->end(), this); + list_ = new_list; + } + + void SetInfo( + BufferManager::BufferInfo* buffer, + GLint size, + GLenum type, + GLboolean normalized, + GLsizei gl_stride, + GLsizei real_stride, + GLsizei offset) { + DCHECK_GT(real_stride, 0); + buffer_ = buffer; + size_ = size; + type_ = type; + normalized_ = normalized; + gl_stride_ = gl_stride; + real_stride_ = real_stride; + offset_ = offset; + } + + // The index of this attrib. + GLuint index_; + + // Whether or not this attribute is enabled. + bool enabled_; + + // number of components (1, 2, 3, 4) + GLint size_; + + // GL_BYTE, GL_FLOAT, etc. See glVertexAttribPointer. + GLenum type_; + + // The offset into the buffer. + GLsizei offset_; + + GLboolean normalized_; + + // The stride passed to glVertexAttribPointer. + GLsizei gl_stride_; + + // The stride that will be used to access the buffer. This is the actual + // stide, NOT the GL bogus stride. In other words there is never a stride + // of 0. + GLsizei real_stride_; + + // The current value of the attrib. + Vec4 value_; + + // The buffer bound to this attribute. + BufferManager::BufferInfo::Ref buffer_; + + // List this info is on. + VertexAttribInfoList* list_; + + // Iterator for list this info is on. Enabled/Disabled + VertexAttribInfoList::iterator it_; + }; + + typedef std::list<VertexAttribInfo*> VertexAttribInfoList; + + VertexAttribManager() + : max_vertex_attribs_(0), + num_fixed_attribs_(0) { + } + + void Initialize(uint32 num_vertex_attribs); + + bool Enable(GLuint index, bool enable); + + bool HaveFixedAttribs() const { + return num_fixed_attribs_ != 0; + } + + const VertexAttribInfoList& GetEnabledVertexAttribInfos() const { + return enabled_vertex_attribs_; + } + + VertexAttribInfo* GetVertexAttribInfo(GLuint index) { + if (index < max_vertex_attribs_) { + return &vertex_attrib_infos_[index]; + } + return NULL; + } + + void SetAttribInfo( + GLuint index, + BufferManager::BufferInfo* buffer, + GLint size, + GLenum type, + GLboolean normalized, + GLsizei gl_stride, + GLsizei real_stride, + GLsizei offset) { + VertexAttribInfo* info = GetVertexAttribInfo(index); + if (info) { + if (info->type() == GL_FIXED) { + --num_fixed_attribs_; + } + if (type == GL_FIXED) { + ++num_fixed_attribs_; + } + info->SetInfo( + buffer, size, type, normalized, gl_stride, real_stride, offset); + } + } + + + private: + uint32 max_vertex_attribs_; + + // number of attribs using type GL_FIXED. + int num_fixed_attribs_; + + // Info for each vertex attribute saved so we can check at glDrawXXX time + // if it is safe to draw. + scoped_array<VertexAttribInfo> vertex_attrib_infos_; + + // Lists for which vertex attribs are enabled, disabled. + VertexAttribInfoList enabled_vertex_attribs_; + VertexAttribInfoList disabled_vertex_attribs_; +}; + +} // namespace gles2 +} // namespace gpu diff --git a/gpu/command_buffer/service/vertex_attrib_manager_unittest.cc b/gpu/command_buffer/service/vertex_attrib_manager_unittest.cc new file mode 100644 index 0000000..1d99ea7 --- /dev/null +++ b/gpu/command_buffer/service/vertex_attrib_manager_unittest.cc @@ -0,0 +1,181 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "gpu/command_buffer/service/vertex_attrib_manager.h" + +#include "base/memory/scoped_ptr.h" +#include "gpu/GLES2/gles2_command_buffer.h" +#include "gpu/command_buffer/common/gl_mock.h" +#include "gpu/command_buffer/service/feature_info.h" +#include "gpu/command_buffer/service/test_helper.h" +#include "testing/gtest/include/gtest/gtest.h" + +using ::testing::Pointee; +using ::testing::_; + +namespace gpu { +namespace gles2 { + +class VertexAttribManagerTest : public testing::Test { + public: + static const uint32 kNumVertexAttribs = 8; + + VertexAttribManagerTest() { + } + + ~VertexAttribManagerTest() { + } + + protected: + virtual void SetUp() { + gl_.reset(new ::testing::StrictMock< ::gfx::MockGLInterface>()); + ::gfx::GLInterface::SetGLInterface(gl_.get()); + + manager_.Initialize(kNumVertexAttribs); + } + + virtual void TearDown() { + ::gfx::GLInterface::SetGLInterface(NULL); + gl_.reset(); + } + + // Use StrictMock to make 100% sure we know how GL will be called. + scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_; + VertexAttribManager manager_; +}; + +// GCC requires these declarations, but MSVC requires they not be present +#ifndef COMPILER_MSVC +const uint32 VertexAttribManagerTest::kNumVertexAttribs; +#endif + +TEST_F(VertexAttribManagerTest, Basic) { + EXPECT_TRUE(manager_.GetVertexAttribInfo(kNumVertexAttribs) == NULL); + EXPECT_FALSE(manager_.HaveFixedAttribs()); + + const VertexAttribManager::VertexAttribInfoList& infos = + manager_.GetEnabledVertexAttribInfos(); + EXPECT_EQ(0u, infos.size()); + + for (uint32 ii = 0; ii < kNumVertexAttribs; ii += kNumVertexAttribs - 1) { + VertexAttribManager::VertexAttribInfo* info = + manager_.GetVertexAttribInfo(ii); + ASSERT_TRUE(info != NULL); + EXPECT_EQ(ii, info->index()); + EXPECT_TRUE(info->buffer() == NULL); + EXPECT_EQ(0, info->offset()); + EXPECT_EQ(4, info->size()); + EXPECT_EQ(static_cast<GLenum>(GL_FLOAT), info->type()); + EXPECT_EQ(GL_FALSE, info->normalized()); + EXPECT_EQ(0, info->gl_stride()); + EXPECT_FALSE(info->enabled()); + EXPECT_EQ(0.0f, info->value().v[0]); + EXPECT_EQ(0.0f, info->value().v[1]); + EXPECT_EQ(0.0f, info->value().v[2]); + EXPECT_EQ(1.0f, info->value().v[3]); + manager_.Enable(ii, true); + EXPECT_TRUE(info->enabled()); + } +} + +TEST_F(VertexAttribManagerTest, Enable) { + const VertexAttribManager::VertexAttribInfoList& infos = + manager_.GetEnabledVertexAttribInfos(); + + VertexAttribManager::VertexAttribInfo* info1 = + manager_.GetVertexAttribInfo(1); + VertexAttribManager::VertexAttribInfo* info2 = + manager_.GetVertexAttribInfo(3); + + manager_.Enable(1, true); + ASSERT_EQ(1u, infos.size()); + EXPECT_TRUE(info1->enabled()); + manager_.Enable(3, true); + ASSERT_EQ(2u, infos.size()); + EXPECT_TRUE(info2->enabled()); + + manager_.Enable(1, false); + ASSERT_EQ(1u, infos.size()); + EXPECT_FALSE(info1->enabled()); + + manager_.Enable(3, false); + ASSERT_EQ(0u, infos.size()); + EXPECT_FALSE(info2->enabled()); +} + +TEST_F(VertexAttribManagerTest, SetAttribInfo) { + BufferManager buffer_manager; + buffer_manager.CreateBufferInfo(1, 2); + BufferManager::BufferInfo* buffer = buffer_manager.GetBufferInfo(1); + ASSERT_TRUE(buffer != NULL); + + VertexAttribManager::VertexAttribInfo* info = + manager_.GetVertexAttribInfo(1); + + manager_.SetAttribInfo(1, buffer, 3, GL_SHORT, GL_TRUE, 32, 32, 4); + + EXPECT_EQ(buffer, info->buffer()); + EXPECT_EQ(4, info->offset()); + EXPECT_EQ(3, info->size()); + EXPECT_EQ(static_cast<GLenum>(GL_SHORT), info->type()); + EXPECT_EQ(GL_TRUE, info->normalized()); + EXPECT_EQ(32, info->gl_stride()); + buffer_manager.Destroy(false); +} + +TEST_F(VertexAttribManagerTest, HaveFixedAttribs) { + EXPECT_FALSE(manager_.HaveFixedAttribs()); + manager_.SetAttribInfo(1, NULL, 4, GL_FIXED, GL_FALSE, 0, 16, 0); + EXPECT_TRUE(manager_.HaveFixedAttribs()); + manager_.SetAttribInfo(3, NULL, 4, GL_FIXED, GL_FALSE, 0, 16, 0); + EXPECT_TRUE(manager_.HaveFixedAttribs()); + manager_.SetAttribInfo(1, NULL, 4, GL_FLOAT, GL_FALSE, 0, 16, 0); + EXPECT_TRUE(manager_.HaveFixedAttribs()); + manager_.SetAttribInfo(3, NULL, 4, GL_FLOAT, GL_FALSE, 0, 16, 0); + EXPECT_FALSE(manager_.HaveFixedAttribs()); +} + +TEST_F(VertexAttribManagerTest, CanAccess) { + BufferManager buffer_manager; + buffer_manager.CreateBufferInfo(1, 2); + BufferManager::BufferInfo* buffer = buffer_manager.GetBufferInfo(1); + ASSERT_TRUE(buffer != NULL); + + VertexAttribManager::VertexAttribInfo* info = + manager_.GetVertexAttribInfo(1); + + EXPECT_TRUE(info->CanAccess(0)); + manager_.Enable(1, true); + EXPECT_FALSE(info->CanAccess(0)); + + manager_.SetAttribInfo(1, buffer, 4, GL_FLOAT, GL_FALSE, 0, 16, 0); + EXPECT_FALSE(info->CanAccess(0)); + + EXPECT_TRUE(buffer_manager.SetTarget(buffer, GL_ARRAY_BUFFER)); + buffer_manager.SetInfo(buffer, 15, GL_STATIC_DRAW); + + EXPECT_FALSE(info->CanAccess(0)); + buffer_manager.SetInfo(buffer, 16, GL_STATIC_DRAW); + EXPECT_TRUE(info->CanAccess(0)); + EXPECT_FALSE(info->CanAccess(1)); + + manager_.SetAttribInfo(1, buffer, 4, GL_FLOAT, GL_FALSE, 0, 16, 1); + EXPECT_FALSE(info->CanAccess(0)); + + buffer_manager.SetInfo(buffer, 32, GL_STATIC_DRAW); + EXPECT_TRUE(info->CanAccess(0)); + EXPECT_FALSE(info->CanAccess(1)); + manager_.SetAttribInfo(1, buffer, 4, GL_FLOAT, GL_FALSE, 0, 16, 0); + EXPECT_TRUE(info->CanAccess(1)); + manager_.SetAttribInfo(1, buffer, 4, GL_FLOAT, GL_FALSE, 0, 20, 0); + EXPECT_TRUE(info->CanAccess(0)); + EXPECT_FALSE(info->CanAccess(1)); + + buffer_manager.Destroy(false); +} + +} // namespace gles2 +} // namespace gpu + + diff --git a/gpu/gpu.gyp b/gpu/gpu.gyp index 7060e1f3..b2f3c63 100644 --- a/gpu/gpu.gyp +++ b/gpu/gpu.gyp @@ -234,6 +234,8 @@ 'command_buffer/service/surface_manager.h', 'command_buffer/service/texture_manager.h', 'command_buffer/service/texture_manager.cc', + 'command_buffer/service/vertex_attrib_manager.h', + 'command_buffer/service/vertex_attrib_manager.cc', ], 'conditions': [ ['toolkit_uses_gtk == 1', { @@ -309,6 +311,7 @@ 'command_buffer/service/test_helper.cc', 'command_buffer/service/test_helper.h', 'command_buffer/service/texture_manager_unittest.cc', + 'command_buffer/service/vertex_attrib_manager_unittest.cc', ], }, { |