diff options
author | kbr@chromium.org <kbr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-17 18:58:43 +0000 |
---|---|---|
committer | kbr@chromium.org <kbr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-17 18:58:43 +0000 |
commit | ea72ed22b211990955c5e3ffcd46295a92453e48 (patch) | |
tree | 658d4954a886f0e966d1e65ed0577f60a5a9a02b /gpu | |
parent | 1a55d6ce32d8d83480caf494edef2db52d74af08 (diff) | |
download | chromium_src-ea72ed22b211990955c5e3ffcd46295a92453e48.zip chromium_src-ea72ed22b211990955c5e3ffcd46295a92453e48.tar.gz chromium_src-ea72ed22b211990955c5e3ffcd46295a92453e48.tar.bz2 |
Clear tex_image_2d_failed_ flag during new early return path in
DoTexImage2D. This fixes a regression where redefinition using
glTexImage2D of a texture that did not fit in the command buffer would
be silently skipped.
Thanks to gman for help with the unit test.
BUG=93150
TEST=GLES2DecoderTest.TexImage2DRedefinitionSucceeds
Review URL: http://codereview.chromium.org/7670033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97175 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r-- | gpu/command_buffer/service/gles2_cmd_decoder.cc | 1 | ||||
-rw-r--r-- | gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc | 35 |
2 files changed, 36 insertions, 0 deletions
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index 22e01c2..4f35103 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -5751,6 +5751,7 @@ error::Error GLES2DecoderImpl::DoTexImage2D( type == tex_type && format == tex_format; if (level_is_same && !pixels) { + tex_image_2d_failed_ = false; return error::kNoError; } diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc index fa85ea5..cf648fd 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc @@ -3969,6 +3969,41 @@ TEST_F(GLES2DecoderTest, GetMultipleIntegervCHROMIUMInvalidArgs) { EXPECT_EQ(kSentinel, results[num_results]); // End of results } +TEST_F(GLES2DecoderTest, TexImage2DRedefinitionSucceeds) { + const int kWidth = 16; + const int kHeight = 8; + DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); + EXPECT_CALL(*gl_, GetError()) + .WillRepeatedly(Return(GL_NO_ERROR)); + for (int ii = 0; ii < 2; ++ii) { + if (ii == 0) { + EXPECT_CALL(*gl_, TexImage2D( + GL_TEXTURE_2D, 0, GL_RGBA, kWidth, kHeight, 0, GL_RGBA, + GL_UNSIGNED_BYTE, _)) + .Times(1) + .RetiresOnSaturation(); + } + TexImage2D cmd; + cmd.Init( + GL_TEXTURE_2D, 0, GL_RGBA, kWidth, kHeight, 0, GL_RGBA, + GL_UNSIGNED_BYTE, 0, 0); + EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); + EXPECT_CALL(*gl_, TexSubImage2D( + GL_TEXTURE_2D, 0, 0, 0, kWidth, kHeight - 1, GL_RGBA, GL_UNSIGNED_BYTE, + shared_memory_address_)) + .Times(1) + .RetiresOnSaturation(); + // Consider this TexSubImage2D command part of the previous TexImage2D + // (last GL_TRUE argument). It will be skipped if there are bugs in the + // redefinition case. + TexSubImage2D cmd2; + cmd2.Init( + GL_TEXTURE_2D, 0, 0, 0, kWidth, kHeight - 1, GL_RGBA, GL_UNSIGNED_BYTE, + kSharedMemoryId, kSharedMemoryOffset, GL_TRUE); + EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); + } +} + TEST_F(GLES2DecoderTest, TexImage2DGLError) { GLenum target = GL_TEXTURE_2D; GLint level = 0; |