summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorsievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-05 03:50:15 +0000
committersievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-05 03:50:15 +0000
commitc7b4d1de98037d4984b1af9fe9eb109d3e283a2c (patch)
treec91878c6e902b02bd07966619447eda4fe893cf2 /gpu
parent8729d23654870f16e9cbdf5000de37eec207aca9 (diff)
downloadchromium_src-c7b4d1de98037d4984b1af9fe9eb109d3e283a2c.zip
chromium_src-c7b4d1de98037d4984b1af9fe9eb109d3e283a2c.tar.gz
chromium_src-c7b4d1de98037d4984b1af9fe9eb109d3e283a2c.tar.bz2
Add unit test to verify a texture can be reused with stream textures.
Verify that a stream's gl texture bound and destroyed previously can be used to create a new stream texture. Review URL: https://chromiumcodereview.appspot.com/8676048 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171151 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc49
1 files changed, 49 insertions, 0 deletions
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
index cee68f4..de780a4 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
@@ -5868,6 +5868,55 @@ TEST_F(GLES2DecoderManualInitTest, StreamTextureCHROMIUMNullMgr) {
GetGLError(); // ignore internal error
}
+TEST_F(GLES2DecoderManualInitTest, ReCreateStreamTextureCHROMIUM) {
+ const GLuint kObjectId = 123;
+ InitDecoder(
+ "GL_CHROMIUM_stream_texture GL_OES_EGL_image_external", // extensions
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
+
+ StrictMock<MockStreamTextureManager> manager;
+ StrictMock<MockStreamTexture> texture;
+ decoder_->SetStreamTextureManager(&manager);
+
+ EXPECT_CALL(manager, LookupStreamTexture(kServiceTextureId))
+ .WillOnce(Return(&texture))
+ .RetiresOnSaturation();
+ EXPECT_CALL(texture, Update())
+ .Times(1)
+ .RetiresOnSaturation();
+ EXPECT_CALL(manager, DestroyStreamTexture(kServiceTextureId))
+ .Times(1)
+ .RetiresOnSaturation();
+ EXPECT_CALL(manager, CreateStreamTexture(kServiceTextureId,
+ client_texture_id_))
+ .WillOnce(Return(kObjectId))
+ .RetiresOnSaturation();
+
+ TextureManager::TextureInfo* info = GetTextureInfo(client_texture_id_);
+ info->SetStreamTexture(true);
+
+ DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId);
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+
+ DestroyStreamTextureCHROMIUM cmd;
+ cmd.Init(client_texture_id_);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+ EXPECT_FALSE(info->IsStreamTexture());
+
+ CreateStreamTextureCHROMIUM cmd2;
+ cmd2.Init(client_texture_id_, shared_memory_id_, shared_memory_offset_);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2));
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+ EXPECT_TRUE(info->IsStreamTexture());
+}
+
TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleBindTexture) {
InitDecoder(
"GL_ARB_texture_rectangle", // extensions