diff options
author | zmo@chromium.org <zmo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-13 01:52:41 +0000 |
---|---|---|
committer | zmo@chromium.org <zmo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-13 01:52:41 +0000 |
commit | 0732918e290716f8e7380df063fc2b43f8a02191 (patch) | |
tree | 08da26281fd7a0e8950bf38815277e7678fcd72b /gpu | |
parent | 31a71eafe08fd3bdc538862f1d389205a3a54252 (diff) | |
download | chromium_src-0732918e290716f8e7380df063fc2b43f8a02191.zip chromium_src-0732918e290716f8e7380df063fc2b43f8a02191.tar.gz chromium_src-0732918e290716f8e7380df063fc2b43f8a02191.tar.bz2 |
Test code paths with/without a few workarounds.
BUG=
TEST=gpu_unittests
R=bajones@chromium.org
Review URL: https://codereview.chromium.org/196743006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@256731 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
4 files changed, 84 insertions, 26 deletions
diff --git a/gpu/command_buffer/service/feature_info.h b/gpu/command_buffer/service/feature_info.h index a47a080..9877ef6 100644 --- a/gpu/command_buffer/service/feature_info.h +++ b/gpu/command_buffer/service/feature_info.h @@ -112,7 +112,6 @@ class GPU_EXPORT FeatureInfo : public base::RefCounted<FeatureInfo> { private: friend class base::RefCounted<FeatureInfo>; friend class BufferManagerClientSideArraysTest; - friend class GLES2DecoderTestBase; typedef base::hash_map<GLenum, ValueValidator<GLenum> > ValidatorMap; ValidatorMap texture_format_validators_; diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc index 0b49b07..96554c3 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc @@ -119,7 +119,13 @@ class GLES2DecoderRGBBackbufferTest : public GLES2DecoderWithShaderTest { GLES2DecoderRGBBackbufferTest() { } virtual void SetUp() { - InitDecoder( + // Test codepath with workaround clear_alpha_in_readpixels because + // ReadPixelsEmulator emulates the incorrect driver behavior. + CommandLine command_line(0, NULL); + command_line.AppendSwitchASCII( + switches::kGpuDriverBugWorkarounds, + base::IntToString(gpu::CLEAR_ALPHA_IN_READPIXELS)); + InitDecoderWithCommandLine( "", // extensions "3.0", // gl version false, // has alpha @@ -128,7 +134,8 @@ class GLES2DecoderRGBBackbufferTest : public GLES2DecoderWithShaderTest { false, // request alpha false, // request depth false, // request stencil - true); // bind generates resource + true, // bind generates resource + &command_line); SetupDefaultProgram(); } }; @@ -314,6 +321,41 @@ TEST_F(GLES2DecoderWithShaderTest, DrawArraysValidAttributesSucceeds) { EXPECT_EQ(GL_NO_ERROR, GetGLError()); } +// Same as DrawArraysValidAttributesSucceeds, but with workaround +// |init_vertex_attributes|. +TEST_F(GLES2DecoderManualInitTest, InitVertexAttributes) { + CommandLine command_line(0, NULL); + command_line.AppendSwitchASCII( + switches::kGpuDriverBugWorkarounds, + base::IntToString(gpu::INIT_VERTEX_ATTRIBUTES)); + InitDecoderWithCommandLine( + "", // extensions + "3.0", // gl version + true, // has alpha + true, // has depth + false, // has stencil + true, // request alpha + true, // request depth + false, // request stencil + true, // bind generates resource + &command_line); + SetupDefaultProgram(); + SetupTexture(); + SetupVertexBuffer(); + DoEnableVertexAttribArray(1); + DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); + AddExpectationsForSimulatedAttrib0(kNumVertices, kServiceBufferId); + SetupExpectationsForApplyingDefaultDirtyState(); + + EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) + .Times(1) + .RetiresOnSaturation(); + DrawArrays cmd; + cmd.Init(GL_TRIANGLES, 0, kNumVertices); + EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); + EXPECT_EQ(GL_NO_ERROR, GetGLError()); +} + TEST_F(GLES2DecoderWithShaderTest, DrawArraysDeletedBufferFails) { SetupVertexBuffer(); DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); @@ -1846,16 +1888,8 @@ TEST_F(GLES2DecoderTest, GenerateMipmapHandlesOutOfMemory) { DoTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, kSharedMemoryId, kSharedMemoryOffset); - EXPECT_CALL(*gl_, TexParameteri( - GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST)) - .Times(1) - .RetiresOnSaturation(); EXPECT_CALL(*gl_, GenerateMipmapEXT(GL_TEXTURE_2D)) .Times(1); - EXPECT_CALL(*gl_, TexParameteri( - GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_LINEAR)) - .Times(1) - .RetiresOnSaturation(); EXPECT_CALL(*gl_, GetError()) .WillOnce(Return(GL_NO_ERROR)) .WillOnce(Return(GL_OUT_OF_MEMORY)) @@ -1876,6 +1910,44 @@ TEST_F(GLES2DecoderTest, GenerateMipmapClearsUnclearedTexture) { SetupClearTextureExpectations( kServiceTextureId, kServiceTextureId, GL_TEXTURE_2D, GL_TEXTURE_2D, 0, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, 2, 2); + EXPECT_CALL(*gl_, GenerateMipmapEXT(GL_TEXTURE_2D)); + EXPECT_CALL(*gl_, GetError()) + .WillOnce(Return(GL_NO_ERROR)) + .WillOnce(Return(GL_NO_ERROR)) + .RetiresOnSaturation(); + GenerateMipmap cmd; + cmd.Init(GL_TEXTURE_2D); + EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); + EXPECT_EQ(GL_NO_ERROR, GetGLError()); +} + +// Same as GenerateMipmapClearsUnclearedTexture, but with workaround +// |set_texture_filters_before_generating_mipmap|. +TEST_F(GLES2DecoderManualInitTest, SetTextureFiltersBeforeGenerateMipmap) { + CommandLine command_line(0, NULL); + command_line.AppendSwitchASCII( + switches::kGpuDriverBugWorkarounds, + base::IntToString(gpu::SET_TEXTURE_FILTER_BEFORE_GENERATING_MIPMAP)); + InitDecoderWithCommandLine( + "", // extensions + "3.0", // gl version + false, // has alpha + false, // has depth + false, // has stencil + false, // request alpha + false, // request depth + false, // request stencil + true, // bind generates resource + &command_line); + + EXPECT_CALL(*gl_, GenerateMipmapEXT(_)) + .Times(0); + DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); + DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, + 0, 0); + SetupClearTextureExpectations( + kServiceTextureId, kServiceTextureId, GL_TEXTURE_2D, GL_TEXTURE_2D, + 0, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, 2, 2); EXPECT_CALL(*gl_, TexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST)) .Times(1) diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_1.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_1.cc index 9c3d733..7da87dd 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_1.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_1.cc @@ -45,14 +45,6 @@ void GLES2DecoderTestBase::SpecializedSetup<cmds::GenerateMipmap, 0>( GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, kSharedMemoryId, kSharedMemoryOffset); if (valid) { - EXPECT_CALL(*gl_, TexParameteri( - GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST)) - .Times(1) - .RetiresOnSaturation(); - EXPECT_CALL(*gl_, TexParameteri( - GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_LINEAR)) - .Times(1) - .RetiresOnSaturation(); EXPECT_CALL(*gl_, GetError()) .WillOnce(Return(GL_NO_ERROR)) .WillOnce(Return(GL_NO_ERROR)) 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 7374ffb..389f544 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc @@ -134,12 +134,6 @@ void GLES2DecoderTestBase::InitDecoderWithCommandLine( memory_tracker_, feature_info.get(), bind_generates_resource)); - // These three workarounds are always turned on in testing. - // TODO(zmo): Test code paths without these workarounds. - group_->feature_info( - )->workarounds_.set_texture_filter_before_generating_mipmap = true; - group_->feature_info()->workarounds_.clear_alpha_in_readpixels = true; - group_->feature_info()->workarounds_.init_vertex_attributes = true; InSequence sequence; @@ -166,7 +160,8 @@ void GLES2DecoderTestBase::InitDecoderWithCommandLine( EXPECT_TRUE( group_->Initialize(mock_decoder_.get(), DisallowedFeatures())); - AddExpectationsForVertexAttribManager(); + if (group_->feature_info()->workarounds().init_vertex_attributes) + AddExpectationsForVertexAttribManager(); AddExpectationsForBindVertexArrayOES(); |