diff options
author | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-09 23:50:56 +0000 |
---|---|---|
committer | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-09 23:50:56 +0000 |
commit | f770e25acb2588ef50b1f0397413d902cb8899fc (patch) | |
tree | 83a7598491467f85a7b2666d57001c06fd8a9409 /gpu | |
parent | 956900a27a68afca0c35e592d590d6df0d2cb11a (diff) | |
download | chromium_src-f770e25acb2588ef50b1f0397413d902cb8899fc.zip chromium_src-f770e25acb2588ef50b1f0397413d902cb8899fc.tar.gz chromium_src-f770e25acb2588ef50b1f0397413d902cb8899fc.tar.bz2 |
Initialize GL attribs
Some drivers are buggy and don't have the correct defaults.
TEST=unit tests and ran WebGL conformance tests
BUG=none
Review URL: https://chromiumcodereview.appspot.com/10383095
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136178 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
4 files changed, 24 insertions, 0 deletions
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc index 4cf8bd2..69f8624 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc @@ -64,6 +64,14 @@ void GLES2DecoderTestBase::SetUp() { true); // bind generates resource } +void GLES2DecoderTestBase::AddExpectationsForVertexAttribManager() { + for (GLint ii = 0; ii < kNumVertexAttribs; ++ii) { + EXPECT_CALL(*gl_, VertexAttrib4f(ii, 0.0f, 0.0f, 0.0f, 1.0f)) + .Times(1) + .RetiresOnSaturation(); + } +} + // Setup the expectations required for the inialiazation of the resources // used by the GL_CHROMIUM_copy_texture extension. void GLES2DecoderTestBase::AddExpectationsForCopyTextureCHROMIUM() { @@ -204,6 +212,7 @@ void GLES2DecoderTestBase::InitDecoder( EXPECT_TRUE(group_->Initialize(DisallowedFeatures(), NULL)); AddExpectationsForCopyTextureCHROMIUM(); + AddExpectationsForVertexAttribManager(); EXPECT_CALL(*gl_, EnableVertexAttribArray(0)) .Times(1) diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h index 2cae914..4e5fa2b 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h @@ -509,6 +509,7 @@ class GLES2DecoderTestBase : public testing::Test { }; void AddExpectationsForCopyTextureCHROMIUM(); + void AddExpectationsForVertexAttribManager(); scoped_ptr< ::testing::StrictMock<MockCommandBufferEngine> > engine_; ContextGroup::Ref group_; diff --git a/gpu/command_buffer/service/vertex_attrib_manager.cc b/gpu/command_buffer/service/vertex_attrib_manager.cc index 4a07bf9..e1bde6d 100644 --- a/gpu/command_buffer/service/vertex_attrib_manager.cc +++ b/gpu/command_buffer/service/vertex_attrib_manager.cc @@ -6,6 +6,7 @@ #include <list> +#include "base/command_line.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "build/build_config.h" @@ -13,6 +14,7 @@ #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" +#include "gpu/command_buffer/service/gpu_switches.h" namespace gpu { namespace gles2 { @@ -71,9 +73,15 @@ void VertexAttribManager::Initialize(uint32 max_vertex_attribs) { max_vertex_attribs_ = max_vertex_attribs; vertex_attrib_infos_.reset( new VertexAttribInfo[max_vertex_attribs]); + bool disable_workarounds = CommandLine::ForCurrentProcess()->HasSwitch( + switches::kDisableGpuDriverBugWorkarounds); + for (uint32 vv = 0; vv < max_vertex_attribs; ++vv) { vertex_attrib_infos_[vv].set_index(vv); vertex_attrib_infos_[vv].SetList(&disabled_vertex_attribs_); + if (!disable_workarounds) { + glVertexAttrib4f(vv, 0.0f, 0.0f, 0.0f, 1.0f); + } } } diff --git a/gpu/command_buffer/service/vertex_attrib_manager_unittest.cc b/gpu/command_buffer/service/vertex_attrib_manager_unittest.cc index 74ed4de..f0496a1 100644 --- a/gpu/command_buffer/service/vertex_attrib_manager_unittest.cc +++ b/gpu/command_buffer/service/vertex_attrib_manager_unittest.cc @@ -31,6 +31,12 @@ class VertexAttribManagerTest : public testing::Test { gl_.reset(new ::testing::StrictMock< ::gfx::MockGLInterface>()); ::gfx::GLInterface::SetGLInterface(gl_.get()); + for (uint32 ii = 0; ii < kNumVertexAttribs; ++ii) { + EXPECT_CALL(*gl_, VertexAttrib4f(ii, 0.0f, 0.0f, 0.0f, 1.0f)) + .Times(1) + .RetiresOnSaturation(); + } + manager_.reset(new VertexAttribManager()); manager_->Initialize(kNumVertexAttribs); } |